Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 55 files). Show all
Unified · Split
| @@ -46,6 +46,8 @@ · 45 unmodified lines | |||
| 46 | #include "bit_stream.h" | 46 | #include "bit_stream.h" |
| 47 | #include "memory_align.h" | 47 | #include "memory_align.h" |
| 48 | 48 | ||
| 49 | #define _PARSE_NALHRD_VCLHRD_PARAMS_ 1 | ||
| 50 | |||
| 49 | namespace WelsDec { | 51 | namespace WelsDec { |
| 50 | /*! | 52 | /*! |
| 51 | ************************************************************************************* | 53 | ************************************************************************************* |
| @@ -1558,16 +1560,51 @@ int32_t ParseVui (PWelsDecoderContext pCtx, PSps pSps, PBitStringAux pBsAux) { · 1506 unmodified lines | |||
| 1558 | } | 1560 | } |
| 1559 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //nal_hrd_parameters_present_flag | 1561 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //nal_hrd_parameters_present_flag |
| 1560 | pVui->bNalHrdParamPresentFlag = !!uiCode; | 1562 | pVui->bNalHrdParamPresentFlag = !!uiCode; |
| 1561 | if (pVui->bNalHrdParamPresentFlag) { //HRD parse not supported | 1563 | if (pVui->bNalHrdParamPresentFlag) { //Add HRD parse. the values are not being used though. |
| 1564 | #ifdef _PARSE_NALHRD_VCLHRD_PARAMS_ | ||
| 1565 | int32_t cpb_cnt_minus1 = BsGetUe (pBsAux, &uiCode); | ||
| 1566 | /*bit_rate_scale = */BsGetBits (pBsAux, 4, &uiCode); | ||
| 1567 | /*cpb_size_scale = */BsGetBits (pBsAux, 4, &uiCode); | ||
| 1568 | for (int32_t i = 0; i <= cpb_cnt_minus1; i++) { | ||
| 1569 | /*bit_rate_value_minus1[i] = */BsGetUe (pBsAux, &uiCode); | ||
| 1570 | /*cpb_size_value_minus1[i] = */BsGetUe (pBsAux, &uiCode); | ||
| 1571 | /*cbr_flag[i] = */BsGetOneBit (pBsAux, &uiCode); | ||
| 1572 | } | ||
| 1573 | /*initial_cpb_removal_delay_length_minus1 = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1574 | /*cpb_removal_delay_length_minus1 = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1575 | /*dpb_output_delay_length_minus1 = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1576 | /*time_offset_length = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1577 | #else | ||
| 1562 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "nal_hrd_parameters_present_flag = 1 not supported."); | 1578 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "nal_hrd_parameters_present_flag = 1 not supported."); |
| 1563 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_VUI_HRD); | 1579 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_VUI_HRD); |
| 1580 | #endif | ||
| 1564 | } | 1581 | } |
| 1565 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //vcl_hrd_parameters_present_flag | 1582 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //vcl_hrd_parameters_present_flag |
| 1566 | pVui->bVclHrdParamPresentFlag = !!uiCode; | 1583 | pVui->bVclHrdParamPresentFlag = !!uiCode; |
| 1567 | if (pVui->bVclHrdParamPresentFlag) { //HRD parse not supported | 1584 | if (pVui->bVclHrdParamPresentFlag) {//Add HRD parse. the values are not being used though. |
| 1585 | #ifdef _PARSE_NALHRD_VCLHRD_PARAMS_ | ||
| 1586 | int32_t cpb_cnt_minus1 = BsGetUe (pBsAux, &uiCode); | ||
| 1587 | /*bit_rate_scale = */BsGetBits (pBsAux, 4, &uiCode); | ||
| 1588 | /*cpb_size_scale = */BsGetBits (pBsAux, 4, &uiCode); | ||
| 1589 | for (int32_t i = 0; i <= cpb_cnt_minus1; i++) { | ||
| 1590 | /*bit_rate_value_minus1[i] = */BsGetUe (pBsAux, &uiCode); | ||
| 1591 | /*cpb_size_value_minus1[i] = */BsGetUe (pBsAux, &uiCode); | ||
| 1592 | /*cbr_flag[i] = */BsGetOneBit (pBsAux, &uiCode); | ||
| 1593 | } | ||
| 1594 | /*initial_cpb_removal_delay_length_minus1 = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1595 | /*cpb_removal_delay_length_minus1 = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1596 | /*dpb_output_delay_length_minus1 = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1597 | /*time_offset_length = */BsGetBits (pBsAux, 5, &uiCode); | ||
| 1598 | #else | ||
| 1568 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "vcl_hrd_parameters_present_flag = 1 not supported."); | 1599 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "vcl_hrd_parameters_present_flag = 1 not supported."); |
| 1569 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_VUI_HRD); | 1600 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_VUI_HRD); |
| 1601 | #endif | ||
| 1602 | } | ||
| 1603 | #ifdef _PARSE_NALHRD_VCLHRD_PARAMS_ | ||
| 1604 | if (pVui->bNalHrdParamPresentFlag | pVui->bVclHrdParamPresentFlag) { | ||
| 1605 | /*low_delay_hrd_flag = */BsGetOneBit (pBsAux, &uiCode); | ||
| 1570 | } | 1606 | } |
| 1607 | #endif | ||
| 1571 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //pic_struct_present_flag | 1608 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //pic_struct_present_flag |
| 1572 | pVui->bPicStructPresentFlag = !!uiCode; | 1609 | pVui->bPicStructPresentFlag = !!uiCode; |
| 1573 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //bitstream_restriction_flag | 1610 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //bitstream_restriction_flag |