modify bs buffer size to double the AU size

This commit is contained in:
huili2 2014-05-14 19:43:14 -07:00
parent 3d5990500b
commit b63332de80
3 changed files with 4 additions and 3 deletions

View File

@ -93,6 +93,7 @@
#define MAX_NAL_UNIT_NUM_IN_AU 32 // predefined maximal number of NAL Units in an access unit
#define MAX_ACCESS_UNIT_CAPACITY 1048576 // Maximal AU capacity in bytes: (1<<20) = 1024 KB predefined
#define BS_BUFFER_SIZE (MAX_ACCESS_UNIT_CAPACITY + MAX_ACCESS_UNIT_CAPACITY) //for delay case, save two AU at most
#define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
#endif//WELS_CONSTANCE_H__

View File

@ -314,13 +314,13 @@ int32_t WelsInitMemory (PWelsDecoderContext pCtx) {
if (MemInitNalList (&pCtx->pAccessUnitList, MAX_NAL_UNIT_NUM_IN_AU) != 0)
return ERR_INFO_OUT_OF_MEMORY;
if ((pCtx->sRawData.pHead = static_cast<uint8_t*> (WelsMalloc (MAX_ACCESS_UNIT_CAPACITY,
if ((pCtx->sRawData.pHead = static_cast<uint8_t*> (WelsMalloc (BS_BUFFER_SIZE,
"pCtx->sRawData->pHead"))) == NULL) {
return ERR_INFO_OUT_OF_MEMORY;
}
pCtx->sRawData.pStartPos =
pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;
pCtx->sRawData.pEnd = pCtx->sRawData.pHead + MAX_ACCESS_UNIT_CAPACITY;
pCtx->sRawData.pEnd = pCtx->sRawData.pHead + BS_BUFFER_SIZE;
pCtx->uiTargetDqId = (uint8_t) - 1;
pCtx->bEndOfStreamFlag = false;

View File

@ -326,7 +326,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
m_pDecContext->iErrorCode |= dsOutOfMemory;
IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO,
"max AU size exceeded. Allowed size = %d, current size = %d",
MAX_ACCESS_UNIT_CAPACITY, kiSrcLen);
MAX_ACCESS_UNIT_CAPACITY - MAX_MACROBLOCK_CAPACITY, kiSrcLen);
return dsOutOfMemory;
}
if (kiSrcLen > 0 && kpSrc != NULL) {