MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / parseVuiForMinSpatialSegmentationIdc

Function parseVuiForMinSpatialSegmentationIdc

src/codec_data.ts:720–776  ·  view source on GitHub ↗
(bitstream: Bitstream, sps_max_sub_layers_minus1: number)

Source from the content-addressed store, hash-verified

718};
719
720const parseVuiForMinSpatialSegmentationIdc = (bitstream: Bitstream, sps_max_sub_layers_minus1: number) => {
721 if (bitstream.readBits(1)) { // aspect_ratio_info_present_flag
722 const aspect_ratio_idc = bitstream.readBits(8);
723 if (aspect_ratio_idc === 255) {
724 bitstream.readBits(16); // sar_width
725 bitstream.readBits(16); // sar_height
726 }
727 }
728 if (bitstream.readBits(1)) { // overscan_info_present_flag
729 bitstream.readBits(1); // overscan_appropriate_flag
730 }
731 if (bitstream.readBits(1)) { // video_signal_type_present_flag
732 bitstream.readBits(3); // video_format
733 bitstream.readBits(1); // video_full_range_flag
734 if (bitstream.readBits(1)) {
735 bitstream.readBits(8); // colour_primaries
736 bitstream.readBits(8); // transfer_characteristics
737 bitstream.readBits(8); // matrix_coeffs
738 }
739 }
740 if (bitstream.readBits(1)) { // chroma_loc_info_present_flag
741 readExpGolomb(bitstream); // chroma_sample_loc_type_top_field
742 readExpGolomb(bitstream); // chroma_sample_loc_type_bottom_field
743 }
744 bitstream.readBits(1); // neutral_chroma_indication_flag
745 bitstream.readBits(1); // field_seq_flag
746 bitstream.readBits(1); // frame_field_info_present_flag
747 if (bitstream.readBits(1)) { // default_display_window_flag
748 readExpGolomb(bitstream); // def_disp_win_left_offset
749 readExpGolomb(bitstream); // def_disp_win_right_offset
750 readExpGolomb(bitstream); // def_disp_win_top_offset
751 readExpGolomb(bitstream); // def_disp_win_bottom_offset
752 }
753 if (bitstream.readBits(1)) { // vui_timing_info_present_flag
754 bitstream.readBits(32); // vui_num_units_in_tick
755 bitstream.readBits(32); // vui_time_scale
756 if (bitstream.readBits(1)) { // vui_poc_proportional_to_timing_flag
757 readExpGolomb(bitstream); // vui_num_ticks_poc_diff_one_minus1
758 }
759 if (bitstream.readBits(1)) {
760 skipHrdParameters(bitstream, true, sps_max_sub_layers_minus1);
761 }
762 }
763 if (bitstream.readBits(1)) { // bitstream_restriction_flag
764 bitstream.readBits(1); // tiles_fixed_structure_flag
765 bitstream.readBits(1); // motion_vectors_over_pic_boundaries_flag
766 bitstream.readBits(1); // restricted_ref_pic_lists_flag
767 const min_spatial_segmentation_idc = readExpGolomb(bitstream);
768 // skip the rest
769 readExpGolomb(bitstream); // max_bytes_per_pic_denom
770 readExpGolomb(bitstream); // max_bits_per_min_cu_denom
771 readExpGolomb(bitstream); // log2_max_mv_length_horizontal
772 readExpGolomb(bitstream); // log2_max_mv_length_vertical
773 return min_spatial_segmentation_idc;
774 }
775 return 0;
776};
777

Callers 1

Calls 3

readExpGolombFunction · 0.85
skipHrdParametersFunction · 0.85
readBitsMethod · 0.80

Tested by

no test coverage detected