( bitstream: Bitstream, commonInfPresentFlag: boolean, maxNumSubLayersMinus1: number, )
| 776 | }; |
| 777 | |
| 778 | const skipHrdParameters = ( |
| 779 | bitstream: Bitstream, |
| 780 | commonInfPresentFlag: boolean, |
| 781 | maxNumSubLayersMinus1: number, |
| 782 | ) => { |
| 783 | let nal_hrd_parameters_present_flag = false; |
| 784 | let vcl_hrd_parameters_present_flag = false; |
| 785 | let sub_pic_hrd_params_present_flag = false; |
| 786 | |
| 787 | if (commonInfPresentFlag) { |
| 788 | nal_hrd_parameters_present_flag = bitstream.readBits(1) === 1; |
| 789 | vcl_hrd_parameters_present_flag = bitstream.readBits(1) === 1; |
| 790 | if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag) { |
| 791 | sub_pic_hrd_params_present_flag = bitstream.readBits(1) === 1; |
| 792 | if (sub_pic_hrd_params_present_flag) { |
| 793 | bitstream.readBits(8); // tick_divisor_minus2 |
| 794 | bitstream.readBits(5); // du_cpb_removal_delay_increment_length_minus1 |
| 795 | bitstream.readBits(1); // sub_pic_cpb_params_in_pic_timing_sei_flag |
| 796 | bitstream.readBits(5); // dpb_output_delay_du_length_minus1 |
| 797 | } |
| 798 | bitstream.readBits(4); // bit_rate_scale |
| 799 | bitstream.readBits(4); // cpb_size_scale |
| 800 | if (sub_pic_hrd_params_present_flag) { |
| 801 | bitstream.readBits(4); // cpb_size_du_scale |
| 802 | } |
| 803 | bitstream.readBits(5); // initial_cpb_removal_delay_length_minus1 |
| 804 | bitstream.readBits(5); // au_cpb_removal_delay_length_minus1 |
| 805 | bitstream.readBits(5); // dpb_output_delay_length_minus1 |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | for (let i = 0; i <= maxNumSubLayersMinus1; i++) { |
| 810 | const fixed_pic_rate_general_flag = bitstream.readBits(1) === 1; |
| 811 | let fixed_pic_rate_within_cvs_flag = true; // Default assumption if general is true |
| 812 | if (!fixed_pic_rate_general_flag) { |
| 813 | fixed_pic_rate_within_cvs_flag = bitstream.readBits(1) === 1; |
| 814 | } |
| 815 | |
| 816 | let low_delay_hrd_flag = false; // Default assumption |
| 817 | if (fixed_pic_rate_within_cvs_flag) { |
| 818 | readExpGolomb(bitstream); // elemental_duration_in_tc_minus1[i] |
| 819 | } else { |
| 820 | low_delay_hrd_flag = bitstream.readBits(1) === 1; |
| 821 | } |
| 822 | |
| 823 | let CpbCnt = 1; // Default if low_delay is true |
| 824 | if (!low_delay_hrd_flag) { |
| 825 | const cpb_cnt_minus1 = readExpGolomb(bitstream); // cpb_cnt_minus1[i] |
| 826 | CpbCnt = cpb_cnt_minus1 + 1; |
| 827 | } |
| 828 | |
| 829 | if (nal_hrd_parameters_present_flag) { |
| 830 | skipSubLayerHrdParameters(bitstream, CpbCnt, sub_pic_hrd_params_present_flag); |
| 831 | } |
| 832 | if (vcl_hrd_parameters_present_flag) { |
| 833 | skipSubLayerHrdParameters(bitstream, CpbCnt, sub_pic_hrd_params_present_flag); |
| 834 | } |
| 835 | } |
no test coverage detected