History

Merge pull request #384 from licaiguo/check-spsid-ppsid

add checks for spsid and ppsid

volvet committed 12 years ago

Commit aa043fa2 parents a3f129d ba312b03 files · +23 −11Browse files

Unified · Split

3 files
  1. codec/decoder/core/inc/error_code.h +2 −0
  2. codec/decoder/core/src/au_parser.cpp +9 −10
  3. codec/decoder/core/src/decoder_core.cpp +12 −1
codec/decoder/core/inc/error_code.h+2−0
@@ -126,6 +126,8 @@ enum { · 125 unmodified lines
126 ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE,126 ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE,
127 ERR_INFO_INVALID_DBLOCKING_IDC,127 ERR_INFO_INVALID_DBLOCKING_IDC,
128 ERR_INFO_INVALID_MB_TYPE,128 ERR_INFO_INVALID_MB_TYPE,
129 ERR_INFO_INVALID_SPS_ID,
130 ERR_INFO_INVALID_PPS_ID,
129 ERR_INFO_INVALID_SUB_MB_TYPE,131 ERR_INFO_INVALID_SUB_MB_TYPE,
130 ERR_INFO_UNAVAILABLE_TOP_BLOCK_FOR_INTRA,132 ERR_INFO_UNAVAILABLE_TOP_BLOCK_FOR_INTRA,
131 ERR_INFO_UNAVAILABLE_LEFT_BLOCK_FOR_INTRA,133 ERR_INFO_UNAVAILABLE_LEFT_BLOCK_FOR_INTRA,
codec/decoder/core/src/au_parser.cpp+9−10
@@ -783,12 +783,6 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 782 unmodified lines
783 pCtx->bSubspsExistAheadFlag = true;783 pCtx->bSubspsExistAheadFlag = true;
784 } else { // Sps784 } else { // Sps
785 pCtx->bSpsExistAheadFlag = true;785 pCtx->bSpsExistAheadFlag = true;
786
787 // added for EC, 10/28/2009
788 // for safe
789 memset (&pCtx->bSpsAvailFlags[0], 0, sizeof (pCtx->bSpsAvailFlags));
790 memset (&pCtx->bSubspsAvailFlags[0], 0, sizeof (pCtx->bSubspsAvailFlags));
791 memset (&pCtx->bPpsAvailFlags[0], 0, sizeof (pCtx->bPpsAvailFlags));
792 }786 }
793 787
794 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc788 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc
@@ -818,10 +812,10 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 23 unmodified lines
818 if (kbUseSubsetFlag) {812 if (kbUseSubsetFlag) {
819 pSubsetSps = &pCtx->sSubsetSpsBuffer[iSpsId];813 pSubsetSps = &pCtx->sSubsetSpsBuffer[iSpsId];
820 pSps = &pSubsetSps->sSps;814 pSps = &pSubsetSps->sSps;
821 pCtx->bSubspsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009815 pCtx->bSubspsAvailFlags[iSpsId] = false;
822 } else {816 } else {
823 pSps = &pCtx->sSpsBuffer[iSpsId];817 pSps = &pCtx->sSpsBuffer[iSpsId];
824 pCtx->bSpsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009818 pCtx->bSpsAvailFlags[iSpsId] = false;
825 }819 }
826 const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]);820 const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]);
827 if (NULL == pSLevelLimits) {821 if (NULL == pSLevelLimits) {
@@ -1000,7 +994,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 172 unmodified lines
1000 994
1001 *pPicWidth = pSps->iMbWidth << 4;995 *pPicWidth = pSps->iMbWidth << 4;
1002 *pPicHeight = pSps->iMbHeight << 4;996 *pPicHeight = pSps->iMbHeight << 4;
1003 997 if (kbUseSubsetFlag) {
998 pCtx->bSubspsAvailFlags[iSpsId] = true;
999 } else {
1000 pCtx->bSpsAvailFlags[iSpsId] = true;
1001 }
1004 return 0;1002 return 0;
1005}1003}
1006 1004
@@ -1032,6 +1030,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 25 unmodified lines
1032 return ERR_INFO_PPS_ID_OVERFLOW;1030 return ERR_INFO_PPS_ID_OVERFLOW;
1033 }1031 }
1034 1032
1033 pCtx->bPpsAvailFlags[uiPpsId] = false;
1035 pPps = &pPpsList[uiPpsId];1034 pPps = &pPpsList[uiPpsId];
1036 1035
1037 pPps->iPpsId = uiPpsId;1036 pPps->iPpsId = uiPpsId;
@@ -1114,7 +1113,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 76 unmodified lines
1114 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag1113 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag
1115 pPps->bRedundantPicCntPresentFlag = !!uiCode;1114 pPps->bRedundantPicCntPresentFlag = !!uiCode;
1116 1115
1117 pCtx->bPpsAvailFlags[uiPpsId] = true; // added for EC, 10/28/20091116 pCtx->bPpsAvailFlags[uiPpsId] = true;
1118 1117
1119 return ERR_NONE;1118 return ERR_NONE;
1120}1119}
codec/decoder/core/src/decoder_core.cpp+12−1
@@ -459,6 +459,10 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 458 unmodified lines
459 }459 }
460 460
461 //add check PPS available here461 //add check PPS available here
462 if (pCtx->bPpsAvailFlags[iPpsId] == false) {
463 WelsLog (pCtx, WELS_LOG_ERROR, "PPS id is invalid!\n");
464 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID);
465 }
462 466
463 pPps = &pCtx->sPpsBuffer[iPpsId];467 pPps = &pCtx->sPpsBuffer[iPpsId];
464 468
@@ -473,11 +477,18 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 8 unmodified lines
473 }477 }
474 478
475 //add check SPS available here479 //add check SPS available here
476
477 if (kbExtensionFlag) {480 if (kbExtensionFlag) {
478 pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];481 pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];
479 pSps = &pSubsetSps->sSps;482 pSps = &pSubsetSps->sSps;
483 if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) {
484 WelsLog (pCtx, WELS_LOG_ERROR, "SPS id is invalid!\n");
485 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
486 }
480 } else {487 } else {
488 if (pCtx->bSpsAvailFlags[pPps->iSpsId] == false) {
489 WelsLog (pCtx, WELS_LOG_ERROR, "SPS id is invalid!\n");
490 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
491 }
481 pSps = &pCtx->sSpsBuffer[pPps->iSpsId];492 pSps = &pCtx->sSpsBuffer[pPps->iSpsId];
482 }493 }
483 pCtx->pSps = pSps;494 pCtx->pSps = pSps;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t