(uint8array)
| 41 | } |
| 42 | |
| 43 | static parseSPS(uint8array) { |
| 44 | let rbsp = SPSParser._ebsp2rbsp(uint8array); |
| 45 | let gb = new ExpGolomb(rbsp); |
| 46 | |
| 47 | gb.readByte(); |
| 48 | let profile_idc = gb.readByte(); // profile_idc |
| 49 | gb.readByte(); // constraint_set_flags[5] + reserved_zero[3] |
| 50 | let level_idc = gb.readByte(); // level_idc |
| 51 | gb.readUEG(); // seq_parameter_set_id |
| 52 | |
| 53 | let profile_string = SPSParser.getProfileString(profile_idc); |
| 54 | let level_string = SPSParser.getLevelString(level_idc); |
| 55 | let chroma_format_idc = 1; |
| 56 | let chroma_format = 420; |
| 57 | let chroma_format_table = [0, 420, 422, 444]; |
| 58 | let bit_depth = 8; |
| 59 | |
| 60 | if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || |
| 61 | profile_idc === 244 || profile_idc === 44 || profile_idc === 83 || |
| 62 | profile_idc === 86 || profile_idc === 118 || profile_idc === 128 || |
| 63 | profile_idc === 138 || profile_idc === 144) { |
| 64 | |
| 65 | chroma_format_idc = gb.readUEG(); |
| 66 | if (chroma_format_idc === 3) { |
| 67 | gb.readBits(1); // separate_colour_plane_flag |
| 68 | } |
| 69 | if (chroma_format_idc <= 3) { |
| 70 | chroma_format = chroma_format_table[chroma_format_idc]; |
| 71 | } |
| 72 | |
| 73 | bit_depth = gb.readUEG() + 8; // bit_depth_luma_minus8 |
| 74 | gb.readUEG(); // bit_depth_chroma_minus8 |
| 75 | gb.readBits(1); // qpprime_y_zero_transform_bypass_flag |
| 76 | if (gb.readBool()) { // seq_scaling_matrix_present_flag |
| 77 | let scaling_list_count = (chroma_format_idc !== 3) ? 8 : 12; |
| 78 | for (let i = 0; i < scaling_list_count; i++) { |
| 79 | if (gb.readBool()) { // seq_scaling_list_present_flag |
| 80 | if (i < 6) { |
| 81 | SPSParser._skipScalingList(gb, 16); |
| 82 | } else { |
| 83 | SPSParser._skipScalingList(gb, 64); |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | gb.readUEG(); // log2_max_frame_num_minus4 |
| 90 | let pic_order_cnt_type = gb.readUEG(); |
| 91 | if (pic_order_cnt_type === 0) { |
| 92 | gb.readUEG(); // log2_max_pic_order_cnt_lsb_minus_4 |
| 93 | } else if (pic_order_cnt_type === 1) { |
| 94 | gb.readBits(1); // delta_pic_order_always_zero_flag |
| 95 | gb.readSEG(); // offset_for_non_ref_pic |
| 96 | gb.readSEG(); // offset_for_top_to_bottom_field |
| 97 | let num_ref_frames_in_pic_order_cnt_cycle = gb.readUEG(); |
| 98 | for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) { |
| 99 | gb.readSEG(); // offset_for_ref_frame |
| 100 | } |
no test coverage detected