Merge pull request #2104 from ruil2/valid

exception case for width or height is less than 16
This commit is contained in:
HaiboZhu 2015-09-09 09:01:18 +08:00
commit e84284523a
2 changed files with 9 additions and 4 deletions

View File

@ -185,6 +185,10 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi
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;

View File

@ -10,7 +10,7 @@ class EncoderInterfaceTest : public ::testing::Test {
#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 @@ void EncoderInterfaceTest::PrepareOneSrcFrame() {
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;