add a para check for max_nal_size
This commit is contained in:
parent
fba745f04e
commit
2211324e2b
@ -106,9 +106,11 @@
|
||||
#endif//PPS_BUFFER_SIZE
|
||||
|
||||
#if !defined(MAX_MACROBLOCK_SIZE_IN_BYTE)
|
||||
#define MAX_MACROBLOCK_SIZE_IN_BYTE 800 //3200*2/8
|
||||
#define MAX_MACROBLOCK_SIZE_IN_BYTE 400 //3200/8, 3200 is from Annex A.3.1.(n)
|
||||
#endif
|
||||
|
||||
#define MAX_MACROBLOCK_SIZE_IN_BYTE_x2 (MAX_MACROBLOCK_SIZE_IN_BYTE<<1)
|
||||
|
||||
#if defined(NUM_SPATIAL_LAYERS_CONSTRAINT)
|
||||
#define MAX_DEPENDENCY_LAYER MAX_SPATIAL_LAYER_NUM // Maximal dependency layer
|
||||
#else
|
||||
|
@ -529,9 +529,9 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
|
||||
if (pCodingParam->uiMaxNalSize <= NAL_HEADER_ADD_0X30BYTES) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiMaxNalSize (%d) settings!",
|
||||
pCodingParam->uiMaxNalSize);
|
||||
if (pCodingParam->uiMaxNalSize <= (NAL_HEADER_ADD_0X30BYTES + MAX_MACROBLOCK_SIZE_IN_BYTE)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiMaxNalSize (%d) settings! should be larger than (NAL_HEADER_ADD_0X30BYTES + MAX_MACROBLOCK_SIZE_IN_BYTE)(%d)",
|
||||
pCodingParam->uiMaxNalSize, (NAL_HEADER_ADD_0X30BYTES + MAX_MACROBLOCK_SIZE_IN_BYTE));
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
|
||||
@ -1740,7 +1740,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa
|
||||
fCompressRatioThr = COMPRESS_RATIO_THR;
|
||||
|
||||
iLayerBsSize = WELS_ROUND (((3 * fDlp->iVideoWidth * fDlp->iVideoHeight) >> 1) * fCompressRatioThr) +
|
||||
MAX_MACROBLOCK_SIZE_IN_BYTE;
|
||||
MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
|
||||
iLayerBsSize = WELS_ALIGN (iLayerBsSize, 4); // 4 bytes alinged
|
||||
iVclLayersBsSizeCount += iLayerBsSize;
|
||||
++ iIndex;
|
||||
|
@ -212,7 +212,7 @@ int32_t CheckBitstreamBuffer (const uint32_t kuiSliceIdx, sWelsEncCtx* pEncCtx,
|
||||
const intX_t iLeftLength = pBs->pBufEnd - pBs->pBufPtr - 1;
|
||||
assert (iLeftLength > 0);
|
||||
|
||||
if (iLeftLength < MAX_MACROBLOCK_SIZE_IN_BYTE) {
|
||||
if (iLeftLength < MAX_MACROBLOCK_SIZE_IN_BYTE_x2) {
|
||||
return ENC_RETURN_MEMALLOCERR;
|
||||
//TODO: call the realloc© instead
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user