| 1489 | #define VUI_LOG2_MAX_MV_LENGTH_VER_MAX 16 |
| 1490 | #define VUI_MAX_DEC_FRAME_BUFFERING_MAX 16 |
| 1491 | int32_t ParseVui (PWelsDecoderContext pCtx, PSps pSps, PBitStringAux pBsAux) { |
| 1492 | uint32_t uiCode; |
| 1493 | PVui pVui = &pSps->sVui; |
| 1494 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //aspect_ratio_info_present_flag |
| 1495 | pVui->bAspectRatioInfoPresentFlag = !!uiCode; |
| 1496 | if (pSps->sVui.bAspectRatioInfoPresentFlag) { |
| 1497 | WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //aspect_ratio_idc |
| 1498 | pVui->uiAspectRatioIdc = uiCode; |
| 1499 | if (pVui->uiAspectRatioIdc < 17) { |
| 1500 | pVui->uiSarWidth = g_ksVuiSampleAspectRatio[pVui->uiAspectRatioIdc].uiWidth; |
| 1501 | pVui->uiSarHeight = g_ksVuiSampleAspectRatio[pVui->uiAspectRatioIdc].uiHeight; |
| 1502 | } else if (pVui->uiAspectRatioIdc == EXTENDED_SAR) { |
| 1503 | WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //sar_width |
| 1504 | pVui->uiSarWidth = uiCode; |
| 1505 | WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //sar_height |
| 1506 | pVui->uiSarHeight = uiCode; |
| 1507 | } |
| 1508 | } |
| 1509 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //overscan_info_present_flag |
| 1510 | pVui->bOverscanInfoPresentFlag = !!uiCode; |
| 1511 | if (pVui->bOverscanInfoPresentFlag) { |
| 1512 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //overscan_appropriate_flag |
| 1513 | pVui->bOverscanAppropriateFlag = !!uiCode; |
| 1514 | } |
| 1515 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //video_signal_type_present_flag |
| 1516 | pVui->bVideoSignalTypePresentFlag = !!uiCode; |
| 1517 | if (pVui->bVideoSignalTypePresentFlag) { |
| 1518 | WELS_READ_VERIFY (BsGetBits (pBsAux, 3, &uiCode)); //video_format |
| 1519 | pVui->uiVideoFormat = uiCode; |
| 1520 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //video_full_range_flag |
| 1521 | pVui->bVideoFullRangeFlag = !!uiCode; |
| 1522 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //colour_description_present_flag |
| 1523 | pVui->bColourDescripPresentFlag = !!uiCode; |
| 1524 | if (pVui->bColourDescripPresentFlag) { |
| 1525 | WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //colour_primaries |
| 1526 | pVui->uiColourPrimaries = uiCode; |
| 1527 | WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //transfer_characteristics |
| 1528 | pVui->uiTransferCharacteristics = uiCode; |
| 1529 | WELS_READ_VERIFY (BsGetBits (pBsAux, 8, &uiCode)); //matrix_coefficients |
| 1530 | pVui->uiMatrixCoeffs = uiCode; |
| 1531 | } |
| 1532 | } |
| 1533 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //chroma_loc_info_present_flag |
| 1534 | pVui->bChromaLocInfoPresentFlag = !!uiCode; |
| 1535 | if (pVui->bChromaLocInfoPresentFlag) { |
| 1536 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //chroma_sample_loc_type_top_field |
| 1537 | pVui->uiChromaSampleLocTypeTopField = uiCode; |
| 1538 | WELS_CHECK_SE_UPPER_WARNING (pVui->uiChromaSampleLocTypeTopField, VUI_MAX_CHROMA_LOG_TYPE_TOP_BOTTOM_FIELD_MAX, |
| 1539 | "chroma_sample_loc_type_top_field"); |
| 1540 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //chroma_sample_loc_type_bottom_field |
| 1541 | pVui->uiChromaSampleLocTypeBottomField = uiCode; |
| 1542 | WELS_CHECK_SE_UPPER_WARNING (pVui->uiChromaSampleLocTypeBottomField, VUI_MAX_CHROMA_LOG_TYPE_TOP_BOTTOM_FIELD_MAX, |
| 1543 | "chroma_sample_loc_type_bottom_field"); |
| 1544 | } |
| 1545 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //timing_info_present_flag |
| 1546 | pVui->bTimingInfoPresentFlag = !!uiCode; |
| 1547 | if (pVui->bTimingInfoPresentFlag) { |
| 1548 | uint32_t uiTmp = 0; |
no test coverage detected