Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-02-29 15:27:02 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2016-02-29 15:27:02 +0300
commit24a233052b366cd49145eb0cda3c7b3c2fcbbc81 (patch)
tree4393ff5f2fce315600d0bbcc92d110c8db20c200 /decoder
parent8af822edb6106475291aaad5a49a66b143dbafdd (diff)
msdk_mvc: refactor async queue size setting
Diffstat (limited to 'decoder')
-rw-r--r--decoder/LAVVideo/decoders/msdk_mvc.cpp12
-rw-r--r--decoder/LAVVideo/decoders/msdk_mvc.h5
2 files changed, 9 insertions, 8 deletions
diff --git a/decoder/LAVVideo/decoders/msdk_mvc.cpp b/decoder/LAVVideo/decoders/msdk_mvc.cpp
index 39a85848..dce19e66 100644
--- a/decoder/LAVVideo/decoders/msdk_mvc.cpp
+++ b/decoder/LAVVideo/decoders/msdk_mvc.cpp
@@ -154,7 +154,7 @@ void CDecMSDKMVC::DestroyDecoder(bool bFull)
{
CAutoLock lock(&m_BufferCritSec);
- for (int i = 0; i < ASYNC_DEPTH; i++) {
+ for (int i = 0; i < ASYNC_QUEUE_SIZE; i++) {
ReleaseBuffer(&m_pOutputQueue[i]->surface);
}
memset(m_pOutputQueue, 0, sizeof(m_pOutputQueue));
@@ -383,7 +383,7 @@ STDMETHODIMP CDecMSDKMVC::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME
if (sts == MFX_ERR_NONE) {
m_mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
- m_mfxVideoParams.AsyncDepth = ASYNC_DEPTH - 2;
+ m_mfxVideoParams.AsyncDepth = ASYNC_DEPTH;
sts = MFXVideoDECODE_Init(m_mfxSession, &m_mfxVideoParams);
if (sts != MFX_ERR_NONE) {
@@ -652,7 +652,7 @@ void CDecMSDKMVC::GetOffsetSideData(LAVFrame *pFrame, mfxU64 timestamp)
HRESULT CDecMSDKMVC::HandleOutput(MVCBuffer * pOutputBuffer)
{
- int nCur = m_nOutputQueuePosition, nNext = (m_nOutputQueuePosition + 1) % ASYNC_DEPTH;
+ int nCur = m_nOutputQueuePosition, nNext = (m_nOutputQueuePosition + 1) % ASYNC_QUEUE_SIZE;
if (m_pOutputQueue[nCur] && m_pOutputQueue[nNext]) {
DeliverOutput(m_pOutputQueue[nCur], m_pOutputQueue[nNext]);
@@ -767,7 +767,7 @@ STDMETHODIMP CDecMSDKMVC::Flush()
MFXVideoDECODE_Reset(m_mfxSession, &m_mfxVideoParams);
// TODO: decode sequence data
- for (int i = 0; i < ASYNC_DEPTH; i++) {
+ for (int i = 0; i < ASYNC_QUEUE_SIZE; i++) {
ReleaseBuffer(&m_pOutputQueue[i]->surface);
}
memset(m_pOutputQueue, 0, sizeof(m_pOutputQueue));
@@ -788,8 +788,8 @@ STDMETHODIMP CDecMSDKMVC::EndOfStream()
Decode(nullptr, 0, AV_NOPTS_VALUE, AV_NOPTS_VALUE, FALSE, FALSE);
// Process all remaining frames in the queue
- for (int i = 0; i < ASYNC_DEPTH; i++) {
- int nCur = (m_nOutputQueuePosition + i) % ASYNC_DEPTH, nNext = (m_nOutputQueuePosition + i + 1) % ASYNC_DEPTH;
+ for (int i = 0; i < ASYNC_QUEUE_SIZE; i++) {
+ int nCur = (m_nOutputQueuePosition + i) % ASYNC_QUEUE_SIZE, nNext = (m_nOutputQueuePosition + i + 1) % ASYNC_QUEUE_SIZE;
if (m_pOutputQueue[nCur] && m_pOutputQueue[nNext]) {
DeliverOutput(m_pOutputQueue[nCur], m_pOutputQueue[nNext]);
diff --git a/decoder/LAVVideo/decoders/msdk_mvc.h b/decoder/LAVVideo/decoders/msdk_mvc.h
index 069cf25f..48c26015 100644
--- a/decoder/LAVVideo/decoders/msdk_mvc.h
+++ b/decoder/LAVVideo/decoders/msdk_mvc.h
@@ -29,7 +29,8 @@
#include <deque>
#include <vector>
-#define ASYNC_DEPTH 10
+#define ASYNC_DEPTH 8
+#define ASYNC_QUEUE_SIZE (ASYNC_DEPTH + 2)
// 1s timestamp offset to avoid negative timestamps
#define TIMESTAMP_OFFSET 10000000i64
@@ -103,7 +104,7 @@ private:
GrowableArray<BYTE> m_buff;
CAnnexBConverter *m_pAnnexBConverter = nullptr;
- MVCBuffer *m_pOutputQueue[ASYNC_DEPTH] = { 0 };
+ MVCBuffer *m_pOutputQueue[ASYNC_QUEUE_SIZE] = { 0 };
int m_nOutputQueuePosition = 0;
std::deque<MVCGOP> m_GOPs;