Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 25 files). Show all
Unified · Split
| @@ -124,6 +124,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 123 unmodified lines | ||
| 124 | 124 | uiBsZero = pSrcRbsp[iIndex]; |
| 125 | 125 | if (0 == uiBsZero) { |
| 126 | 126 | --iNalSize; |
| 127 | + ++ (*pConsumedBytes); | |
| 127 | 128 | --iIndex; |
| 128 | 129 | } else { |
| 129 | 130 | break; |
| @@ -991,16 +992,10 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 861 unmodified lines | ||
| 991 | 992 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag |
| 992 | 993 | pSps->bSeqScalingMatrixPresentFlag = !!uiCode; |
| 993 | 994 | |
| 994 | − if (pSps->bSeqScalingMatrixPresentFlag)// For high profile, it is not used in current application. FIXME | |
| 995 | − | |
| 995 | + if (pSps->bSeqScalingMatrixPresentFlag) { | |
| 996 | 996 | WELS_READ_VERIFY (ParseScalingList (pSps, pBs, 0, pSps->bSeqScalingListPresentFlag, pSps->iScalingList4x4, |
| 997 | 997 | pSps->iScalingList8x8)); |
| 998 | − //if exist, to parse scalinglist matrix value | |
| 999 | − | |
| 1000 | − // WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | |
| 1001 | − // "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.", | |
| 1002 | − // pSps->bSeqScalingMatrixPresentFlag); | |
| 1003 | − //return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | |
| 998 | + } | |
| 1004 | 999 | } |
| 1005 | 1000 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_frame_num_minus4 |
| 1006 | 1001 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX, "log2_max_frame_num_minus4", |
| @@ -1379,28 +1374,27 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 372 unmodified lines | ||
| 1379 | 1374 | pPps->bConstainedIntraPredFlag = !!uiCode; |
| 1380 | 1375 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag |
| 1381 | 1376 | pPps->bRedundantPicCntPresentFlag = !!uiCode; |
| 1382 | − /*TODO: to judge whether going on to parse*/ | |
| 1383 | −//going on to parse high profile syntax, need fix me | |
| 1384 | − if (0) { | |
| 1385 | − WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); | |
| 1386 | − pPps->bTransform_8x8_mode_flag = !!uiCode; | |
| 1387 | − WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); | |
| 1377 | + | |
| 1378 | + if (CheckMoreRBSPData (pBsAux)) { | |
| 1379 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //transform_8x8_mode_flag | |
| 1380 | + pPps->bTransform8x8ModeFlag = !!uiCode; | |
| 1381 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //pic_scaling_matrix_present_flag | |
| 1388 | 1382 | pPps->bPicScalingMatrixPresentFlag = !!uiCode; |
| 1389 | 1383 | if (pPps->bPicScalingMatrixPresentFlag) { |
| 1390 | − if (pCtx->bSpsAvailFlags[pPps->iSpsId]) | |
| 1384 | + if (pCtx->bSpsAvailFlags[pPps->iSpsId]) { | |
| 1391 | 1385 | WELS_READ_VERIFY (ParseScalingList (&pCtx->sSpsBuffer[pPps->iSpsId], pBsAux, 1, pPps->bPicScalingListPresentFlag, |
| 1392 | 1386 | pPps->iScalingList4x4, pPps->iScalingList8x8)); |
| 1393 | − else { | |
| 1387 | + } else { | |
| 1394 | 1388 | pCtx->bSpsLatePps = true; |
| 1395 | 1389 | WELS_READ_VERIFY (ParseScalingList (NULL, pBsAux, 1, pPps->bPicScalingListPresentFlag, pPps->iScalingList4x4, |
| 1396 | 1390 | pPps->iScalingList8x8)); |
| 1397 | 1391 | } |
| 1398 | 1392 | } |
| 1399 | − //add second chroma qp parsing process | |
| 1400 | − WELS_READ_VERIFY (BsGetSe (pBsAux, &iCode)); //chroma_qp_index_offset,cr | |
| 1401 | − pPps->iChromaQpIndexOffset[1] = iCode; | |
| 1402 | − WELS_CHECK_SE_BOTH_ERROR (pPps->iChromaQpIndexOffset[1], PPS_CHROMA_QP_INDEX_OFFSET_MIN, PPS_CHROMA_QP_INDEX_OFFSET_MAX, | |
| 1403 | − "second_chroma_qp_index_offset", GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CHROMA_QP_INDEX_OFFSET)); | |
| 1393 | + WELS_READ_VERIFY (BsGetSe (pBsAux, &iCode)); //second_chroma_qp_index_offset | |
| 1394 | + pPps->iChromaQpIndexOffset[1] = iCode; | |
| 1395 | + WELS_CHECK_SE_BOTH_ERROR (pPps->iChromaQpIndexOffset[1], PPS_CHROMA_QP_INDEX_OFFSET_MIN, | |
| 1396 | + PPS_CHROMA_QP_INDEX_OFFSET_MAX, "chroma_qp_index_offset", GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, | |
| 1397 | + ERR_INFO_INVALID_CHROMA_QP_INDEX_OFFSET)); | |
| 1404 | 1398 | } |
| 1405 | 1399 | |
| 1406 | 1400 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| @@ -1481,6 +1475,7 @@ int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* b · 74 unmodified lines | ||
| 1481 | 1475 | int iNextScale = 8; |
| 1482 | 1476 | int iDeltaScale; |
| 1483 | 1477 | int32_t iCode; |
| 1478 | + int32_t iIdx; | |
| 1484 | 1479 | for (int j = 0; j < iScalingListNum; j++) { |
| 1485 | 1480 | if (iNextScale != 0) { |
| 1486 | 1481 | WELS_READ_VERIFY (BsGetSe (pBsAux, &iCode)); |
| @@ -1492,8 +1487,9 @@ int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* b · 5 unmodified lines | ||
| 1492 | 1487 | if (*bUseDefaultScalingMatrixFlag) |
| 1493 | 1488 | break; |
| 1494 | 1489 | } |
| 1495 | − pScalingList[g_kuiZigzagScan[j]] = (iNextScale == 0) ? iLastScale : iNextScale; | |
| 1496 | − iLastScale = pScalingList[g_kuiZigzagScan[j]]; | |
| 1490 | + iIdx = iScalingListNum == 16 ? g_kuiZigzagScan[j] : g_kuiZigzagScan8x8[j]; | |
| 1491 | + pScalingList[iIdx] = (iNextScale == 0) ? iLastScale : iNextScale; | |
| 1492 | + iLastScale = pScalingList[iIdx]; | |
| 1497 | 1493 | } |
| 1498 | 1494 | |
| 1499 | 1495 | |