Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 11 files). Show all
Unified · Split
| @@ -1134,7 +1134,9 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 1133 unmodified lines | ||
| 1134 | 1134 | } |
| 1135 | 1135 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag |
| 1136 | 1136 | pSps->bVuiParamPresentFlag = !!uiCode; |
| 1137 | − | |
| 1137 | + if (pSps->bVuiParamPresentFlag && !kbUseSubsetFlag) { //parse Part of Vui Parameters in avc sps only | |
| 1138 | + WELS_READ_VERIFY (ParseVui (pCtx, pSps, pBsAux)); | |
| 1139 | + } | |
| 1138 | 1140 | if (pCtx->pParam->bParseOnly) { |
| 1139 | 1141 | if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds! |
| 1140 | 1142 | pCtx->iErrorCode |= dsOutOfMemory; |
| @@ -1425,9 +1427,10 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 284 unmodified lines | ||
| 1425 | 1427 | if (memcmp (pCtx->pPps, pPps, sizeof (*pPps)) != 0) { |
| 1426 | 1428 | memcpy (&pCtx->sPpsBuffer[MAX_PPS_COUNT], pPps, sizeof (SPps)); |
| 1427 | 1429 | pCtx->iOverwriteFlags |= OVERWRITE_PPS; |
| 1428 | − pCtx->bAuReadyFlag = true; | |
| 1429 | − pCtx->pAccessUnitList->uiEndPos = (pCtx->pAccessUnitList->uiAvailUnitsNum > 0 ? (pCtx->pAccessUnitList->uiAvailUnitsNum | |
| 1430 | − - 1) : 0); | |
| 1430 | + if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | |
| 1431 | + pCtx->bAuReadyFlag = true; | |
| 1432 | + pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | |
| 1433 | + } | |
| 1431 | 1434 | } |
| 1432 | 1435 | } else { |
| 1433 | 1436 | memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps)); |
| @@ -1456,7 +1459,75 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 22 unmodified lines | ||
| 1456 | 1459 | } |
| 1457 | 1460 | return ERR_NONE; |
| 1458 | 1461 | } |
| 1462 | +int32_t ParseVui (PWelsDecoderContext pCtx, PSps pSps, PBitStringAux pBsAux) { | |
| 1463 | + uint32_t uiCode; | |
| 1464 | + PVui pVui = &pSps->sVui; | |
| 1465 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //aspect_ratio_info_present_flag | |
| 1466 | + pVui->bAspectRatioInfoPresentFlag = !!uiCode; | |
| 1467 | + if (pSps->sVui.bAspectRatioInfoPresentFlag) { | |
| 1468 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //aspect_ratio_idc | |
| 1469 | + pVui->uiAspectRatioIdc = uiCode; | |
| 1470 | + if (pVui->uiAspectRatioIdc < 17) { | |
| 1471 | + pVui->uiSarWidth = g_ksVuiSampleAspectRatio[pVui->uiAspectRatioIdc].uiWidth; | |
| 1472 | + pVui->uiSarHeight = g_ksVuiSampleAspectRatio[pVui->uiAspectRatioIdc].uiHeight; | |
| 1473 | + } else if (pVui->uiAspectRatioIdc == EXTENDED_SAR) { | |
| 1474 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //sar_width | |
| 1475 | + pVui->uiSarWidth = uiCode; | |
| 1476 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //sar_height | |
| 1477 | + pVui->uiSarHeight = uiCode; | |
| 1478 | + } | |
| 1479 | + } | |
| 1480 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //overscan_info_present_flag | |
| 1481 | + pVui->bOverscanInfoPresentFlag = !!uiCode; | |
| 1482 | + if (pVui->bOverscanInfoPresentFlag) { | |
| 1483 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //overscan_appropriate_flag | |
| 1484 | + pVui->bOverscanAppropriateFlag = !!uiCode; | |
| 1485 | + } | |
| 1486 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //video_signal_type_present_flag | |
| 1487 | + pVui->bVideoSignalTypePresentFlag = !!uiCode; | |
| 1488 | + if (pVui->bVideoSignalTypePresentFlag) { | |
| 1489 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 3, &uiCode)); //video_format | |
| 1490 | + pVui->uiVideoFormat = uiCode; | |
| 1491 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //video_full_range_flag | |
| 1492 | + pVui->bVideoFullRangeFlag = !!uiCode; | |
| 1493 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //colour_description_present_flag | |
| 1494 | + pVui->bColourDescripPresentFlag = !!uiCode; | |
| 1495 | + if (pVui->bColourDescripPresentFlag) { | |
| 1496 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //colour_primaries | |
| 1497 | + pVui->uiColourPrimaries = uiCode; | |
| 1498 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //transfer_characteristics | |
| 1499 | + pVui->uiTransferCharacteristics = uiCode; | |
| 1500 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //matrix_coefficients | |
| 1501 | + pVui->uiMatrixCoeffs = uiCode; | |
| 1502 | + } | |
| 1503 | + } | |
| 1504 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //chroma_loc_info_present_flag | |
| 1505 | + pVui->bChromaLocInfoPresentFlag = !!uiCode; | |
| 1506 | + if (pVui->bChromaLocInfoPresentFlag) { | |
| 1507 | + WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //chroma_sample_loc_type_top_field | |
| 1508 | + pVui->uiChromaSampleLocTypeTopField = uiCode; | |
| 1509 | + WELS_CHECK_SE_UPPER_WARNING (pVui->uiChromaSampleLocTypeTopField, VUI_MAX_CHROMA_LOG_TYPE_TOP_BOTTOM_FIELD, | |
| 1510 | + "chroma_sample_loc_type_top_field"); | |
| 1511 | + WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //chroma_sample_loc_type_bottom_field | |
| 1512 | + pVui->uiChromaSampleLocTypeBottomField = uiCode; | |
| 1513 | + WELS_CHECK_SE_UPPER_WARNING (pVui->uiChromaSampleLocTypeBottomField, VUI_MAX_CHROMA_LOG_TYPE_TOP_BOTTOM_FIELD, | |
| 1514 | + "chroma_sample_loc_type_bottom_field"); | |
| 1515 | + } | |
| 1516 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //timing_info_present_flag | |
| 1517 | + pVui->bTimingInfoPresentFlag = !!uiCode; | |
| 1518 | + if (pVui->bTimingInfoPresentFlag) { | |
| 1519 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 32, &uiCode)); //num_units_in_tick | |
| 1520 | + pVui->uiNumUnitsInTick = uiCode; | |
| 1521 | + WELS_CHECK_SE_LOWER_WARNING (pVui->uiNumUnitsInTick, 1, "num_units_in_tick"); | |
| 1522 | + WELS_READ_VERIFY (BsGetBits (pBsAux, 32, &uiCode)); //time_scale | |
| 1523 | + pVui->uiTimeScale = uiCode; | |
| 1524 | + WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //fixed_frame_rate_flag | |
| 1525 | + pVui->bFixedFrameRateFlag = !!uiCode; | |
| 1526 | + } | |
| 1527 | + //following HRD related parameters, omitted | |
| 1459 | 1528 | |
| 1529 | + return ERR_NONE; | |
| 1530 | +} | |
| 1460 | 1531 | /*! |
| 1461 | 1532 | ************************************************************************************* |
| 1462 | 1533 | * \brief to parse SEI message payload |