ref: e84284523a77c44f1689f5ebbb99847f2dcbc182
parent: c48f47ab19968f3f640602bf501a3ec9e80dcb4f
parent: 2c830e64d784d1e70af5ada7ee37aed5f36fbf47
author: HaiboZhu <haibozhu@cisco.com>
date: Wed Sep 9 05:01:18 EDT 2015
Merge pull request #2104 from ruil2/valid exception case for width or height is less than 16
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -185,6 +185,10 @@
pSvcParam->SUsedPicRect.iTop = 0;
pSvcParam->SUsedPicRect.iWidth = ((kpSrcPic->iPicWidth >> 1) << 1);
pSvcParam->SUsedPicRect.iHeight = ((kpSrcPic->iPicHeight >> 1) << 1);
+ if((pSvcParam->SUsedPicRect.iWidth<16)||((pSvcParam->SUsedPicRect.iHeight<16))){
+ WelsLog ( & (pCtx->sLogCtx), WELS_LOG_ERROR, "Don't support width(%d) or height(%d) which is less than 16 ",pSvcParam->SUsedPicRect.iWidth,pSvcParam->SUsedPicRect.iHeight);
+ return -1;
+ }
if (WelsPreprocessReset (pCtx) != 0)
return -1;
--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -10,7 +10,7 @@
#define MB_SIZE (16)
#define MAX_WIDTH (3840)
#define MAX_HEIGHT (2160)
-#define VALID_SIZE(iSize) (((iSize)>1)?(iSize):1)
+#define VALID_SIZE(iSize) (((iSize)>16)?(iSize):16)
#define MEM_VARY_SIZE (512)
#define IMAGE_VARY_SIZE (512)
#define TEST_FRAMES (30)
@@ -87,9 +87,10 @@
pSrcPic->uiTimeStamp = 0;
pSrcPic->iPicWidth = pParamExt->iPicWidth;
pSrcPic->iPicHeight = pParamExt->iPicHeight;
-
- m_iWidth = pParamExt->iPicWidth;
- m_iHeight = pParamExt->iPicHeight;
+ pSrcPic->iPicWidth = VALID_SIZE (pParamExt->iPicWidth);
+ pSrcPic->iPicHeight = VALID_SIZE (pParamExt->iPicHeight);
+ m_iWidth = pSrcPic->iPicWidth;
+ m_iHeight = pSrcPic->iPicHeight;
m_iPicResSize = m_iWidth * m_iHeight * 3 >> 1;
pYUV[0] = rand() % 256;