@@ -1099,8 +1099,8 @@ srs_error_t SrsFormat::hevc_demux_vps(SrsBuffer *stream)
10991099 }
11001100
11011101 // nal_unit_type specifies the type of RBSP data structure contained in the NAL unit as specified in Table 7-1.
1102- // @see 7.4.2 NAL unit semantics
1103- // @doc ITU-T-H.265-2021.pdf, page 64 .
1102+ // @see 7.4.2.2 NAL unit header semantics
1103+ // @doc ITU-T-H.265-2021.pdf, page 86 .
11041104 SrsHevcNaluType nal_unit_type = (SrsHevcNaluType)((nutv >> 1 ) & 0x3f );
11051105 if (nal_unit_type != SrsHevcNaluType_VPS) {
11061106 return srs_error_new (ERROR_HEVC_DECODE_ERROR, " hevc vps nal_unit_type=%d shall be equal to 33" , nal_unit_type);
@@ -1143,8 +1143,8 @@ srs_error_t SrsFormat::hevc_demux_vps_rbsp(char* rbsp, int nb_rbsp)
11431143 SrsBuffer stream (rbsp, nb_rbsp);
11441144
11451145 // H265 VPS (video_parameter_set_rbsp()) NAL Unit.
1146- // Section 7.3.2.1 ("Video parameter set data syntax") of the H.265
1147- // ITU-T-H.265-2021.pdf, page 53 .
1146+ // Section 7.3.2.1 ("Video parameter set RBSP syntax") of the H.265
1147+ // ITU-T-H.265-2021.pdf, page 54 .
11481148 if (!stream.require (4 )) {
11491149 return srs_error_new (ERROR_HEVC_DECODE_ERROR, " vps requires 4 only %d bytes" , stream.left ());
11501150 }
@@ -1328,8 +1328,8 @@ srs_error_t SrsFormat::hevc_demux_sps(SrsBuffer *stream)
13281328 }
13291329
13301330 // nal_unit_type specifies the type of RBSP data structure contained in the NAL unit as specified in Table 7-1.
1331- // @see 7.4.2 NAL unit semantics
1332- // @doc ITU-T-H.265-2021.pdf, page 64 .
1331+ // @see 7.4.2.2 NAL unit header semantics
1332+ // @doc ITU-T-H.265-2021.pdf, page 86 .
13331333 SrsHevcNaluType nal_unit_type = (SrsHevcNaluType)((nutv >> 1 ) & 0x3f );
13341334 if (nal_unit_type != SrsHevcNaluType_SPS) {
13351335 return srs_error_new (ERROR_HEVC_DECODE_ERROR, " hevc sps nal_unit_type=%d shall be equal to 33" , nal_unit_type);
@@ -1378,7 +1378,7 @@ srs_error_t SrsFormat::hevc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
13781378 SrsBuffer stream (rbsp, nb_rbsp);
13791379
13801380 // H265 SPS Nal Unit (seq_parameter_set_rbsp()) parser.
1381- // Section 7.3.2.2 ("Sequence parameter set data syntax") of the H.265
1381+ // Section 7.3.2.2 ("Sequence parameter set RBSP syntax") of the H.265
13821382 // ITU-T-H.265-2021.pdf, page 55.
13831383 if (!stream.require (2 )) {
13841384 return srs_error_new (ERROR_HEVC_DECODE_ERROR, " sps requires 2 only %d bytes" , stream.left ());
@@ -1516,7 +1516,7 @@ srs_error_t SrsFormat::hevc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
15161516srs_error_t SrsFormat::hevc_demux_pps (SrsBuffer *stream)
15171517{
15181518 // for NALU, ITU-T H.265 7.3.2.3 Picture parameter set RBSP syntax
1519- // @see 7.3.2.3.1 General picture parameter set RBSP syntax
1519+ // @see 7.3.2.3 Picture parameter set RBSP syntax
15201520 // @doc ITU-T-H.265-2021.pdf, page 57.
15211521 if (!stream->require (1 )) {
15221522 return srs_error_new (ERROR_HEVC_DECODE_ERROR, " decode hevc pps requires 1 only %d bytes" , stream->left ());
@@ -1574,7 +1574,7 @@ srs_error_t SrsFormat::hevc_demux_pps_rbsp(char* rbsp, int nb_rbsp)
15741574 SrsBuffer stream (rbsp, nb_rbsp);
15751575
15761576 // H265 PPS NAL Unit (pic_parameter_set_rbsp()) parser.
1577- // Section 7.3.2.3 ("Parameter parameter set data syntax") of the H.265
1577+ // Section 7.3.2.3 ("Picture parameter set RBSP syntax") of the H.265
15781578 // ITU-T-H.265-2021.pdf, page 57.
15791579 SrsBitBuffer bs (&stream);
15801580
@@ -1922,7 +1922,11 @@ srs_error_t SrsFormat::hevc_demux_rbsp_ptl(SrsBitBuffer* bs, SrsHevcProfileTierL
19221922 if (ptl->general_profile_idc == 4 || ptl->general_profile_compatibility_flag [4 ] ||
19231923 ptl->general_profile_idc == 5 || ptl->general_profile_compatibility_flag [5 ] ||
19241924 ptl->general_profile_idc == 6 || ptl->general_profile_compatibility_flag [6 ] ||
1925- ptl->general_profile_idc == 7 || ptl->general_profile_compatibility_flag [7 ])
1925+ ptl->general_profile_idc == 7 || ptl->general_profile_compatibility_flag [7 ] ||
1926+ ptl->general_profile_idc == 8 || ptl->general_profile_compatibility_flag [8 ] ||
1927+ ptl->general_profile_idc == 9 || ptl->general_profile_compatibility_flag [9 ] ||
1928+ ptl->general_profile_idc == 10 || ptl->general_profile_compatibility_flag [10 ] ||
1929+ ptl->general_profile_idc == 11 || ptl->general_profile_compatibility_flag [11 ])
19261930 {
19271931 // The number of bits in this syntax structure is not affected by
19281932 // this condition
@@ -1945,12 +1949,10 @@ srs_error_t SrsFormat::hevc_demux_rbsp_ptl(SrsBitBuffer* bs, SrsHevcProfileTierL
19451949 // lower_bit_rate_constraint_flag u(1)
19461950 ptl->general_lower_bit_rate_constraint_flag = bs->read_bit ();
19471951
1948- if (ptl->general_profile_idc == 5 ||
1949- ptl->general_profile_compatibility_flag [5 ] == 1 ||
1950- ptl->general_profile_idc == 9 ||
1951- ptl->general_profile_compatibility_flag [9 ] == 1 ||
1952- ptl->general_profile_idc == 10 ||
1953- ptl->general_profile_compatibility_flag [10 ] == 1 )
1952+ if (ptl->general_profile_idc == 5 || ptl->general_profile_compatibility_flag [5 ] == 1 ||
1953+ ptl->general_profile_idc == 9 || ptl->general_profile_compatibility_flag [9 ] == 1 ||
1954+ ptl->general_profile_idc == 10 || ptl->general_profile_compatibility_flag [10 ] == 1 ||
1955+ ptl->general_profile_idc == 11 || ptl->general_profile_compatibility_flag [11 ] == 1 )
19541956 {
19551957 // max_14bit_constraint_flag u(1)
19561958 ptl->general_max_14bit_constraint_flag = bs->read_bit ();
@@ -1971,13 +1973,14 @@ srs_error_t SrsFormat::hevc_demux_rbsp_ptl(SrsBitBuffer* bs, SrsHevcProfileTierL
19711973 ptl->general_reserved_zero_43bits = ((uint64_t )bits_tmp_hi << 32 ) | bits_tmp;
19721974 }
19731975
1974- // The number of bits in this syntax structure is not affected by
1975- // this condition
1976- if ((ptl->general_profile_idc >= 1 && ptl->general_profile_idc <=5 ) ||
1977- ptl->general_profile_compatibility_flag [1 ] || ptl->general_profile_compatibility_flag [2 ] ||
1978- ptl->general_profile_compatibility_flag [3 ] || ptl->general_profile_compatibility_flag [4 ] ||
1979- ptl->general_profile_compatibility_flag [5 ])
1980- {
1976+ // The number of bits in this syntax structure is not affected by this condition
1977+ if (ptl->general_profile_idc == 1 || ptl->general_profile_compatibility_flag [1 ] ||
1978+ ptl->general_profile_idc == 2 || ptl->general_profile_compatibility_flag [2 ] ||
1979+ ptl->general_profile_idc == 3 || ptl->general_profile_compatibility_flag [3 ] ||
1980+ ptl->general_profile_idc == 4 || ptl->general_profile_compatibility_flag [4 ] ||
1981+ ptl->general_profile_idc == 5 || ptl->general_profile_compatibility_flag [5 ] ||
1982+ ptl->general_profile_idc == 9 || ptl->general_profile_compatibility_flag [9 ] ||
1983+ ptl->general_profile_idc == 11 || ptl->general_profile_compatibility_flag [11 ]) {
19811984 // inbld_flag u(1)
19821985 ptl->general_inbld_flag = bs->read_bit ();
19831986 } else {
@@ -2064,7 +2067,11 @@ srs_error_t SrsFormat::hevc_demux_rbsp_ptl(SrsBitBuffer* bs, SrsHevcProfileTierL
20642067 if (ptl->sub_layer_profile_idc [i] == 4 || ptl->sub_layer_profile_compatibility_flag [i][4 ] ||
20652068 ptl->sub_layer_profile_idc [i] == 5 || ptl->sub_layer_profile_compatibility_flag [i][5 ] ||
20662069 ptl->sub_layer_profile_idc [i] == 6 || ptl->sub_layer_profile_compatibility_flag [i][6 ] ||
2067- ptl->sub_layer_profile_idc [i] == 7 || ptl->sub_layer_profile_compatibility_flag [i][7 ])
2070+ ptl->sub_layer_profile_idc [i] == 7 || ptl->sub_layer_profile_compatibility_flag [i][7 ] ||
2071+ ptl->sub_layer_profile_idc [i] == 8 || ptl->sub_layer_profile_compatibility_flag [i][8 ] ||
2072+ ptl->sub_layer_profile_idc [i] == 9 || ptl->sub_layer_profile_compatibility_flag [i][9 ] ||
2073+ ptl->sub_layer_profile_idc [i] == 10 || ptl->sub_layer_profile_compatibility_flag [i][10 ] ||
2074+ ptl->sub_layer_profile_idc [i] == 11 || ptl->sub_layer_profile_compatibility_flag [i][11 ])
20682075 {
20692076 // max_12bit_constraint_flag u(1)
20702077 ptl->sub_layer_max_12bit_constraint_flag [i] = bs->read_bit ();
@@ -2085,12 +2092,12 @@ srs_error_t SrsFormat::hevc_demux_rbsp_ptl(SrsBitBuffer* bs, SrsHevcProfileTierL
20852092 // lower_bit_rate_constraint_flag u(1)
20862093 ptl->sub_layer_lower_bit_rate_constraint_flag [i] = bs->read_bit ();
20872094
2088- if (ptl->general_profile_idc == 5 ||
2089- ptl->general_profile_compatibility_flag [5 ] == 1 ||
2090- ptl->general_profile_idc == 9 ||
2091- ptl->general_profile_compatibility_flag [9 ] == 1 ||
2092- ptl->general_profile_idc == 10 ||
2093- ptl->general_profile_compatibility_flag [10 ] == 1 )
2095+ if (ptl->sub_layer_profile_idc [i] == 5 ||
2096+ ptl->sub_layer_profile_compatibility_flag [i] [5 ] == 1 ||
2097+ ptl->sub_layer_profile_idc [i] == 9 ||
2098+ ptl->sub_layer_profile_compatibility_flag [i] [9 ] == 1 ||
2099+ ptl->sub_layer_profile_idc [i] == 10 ||
2100+ ptl->sub_layer_profile_compatibility_flag [i] [10 ] == 1 )
20942101 {
20952102 // max_14bit_constraint_flag u(1)
20962103 ptl->general_max_14bit_constraint_flag = bs->read_bit ();
@@ -2111,14 +2118,21 @@ srs_error_t SrsFormat::hevc_demux_rbsp_ptl(SrsBitBuffer* bs, SrsHevcProfileTierL
21112118 ptl->sub_layer_reserved_zero_43bits [i] = ((uint64_t )bits_tmp_hi << 32 ) | bits_tmp;
21122119 }
21132120
2114- // to check
2115- if (( ptl->sub_layer_profile_idc [i] >= 1 && ptl-> sub_layer_profile_idc [i] <= 5 ) ||
2121+ // The number of bits in this syntax structure is not affected by this condition
2122+ if (ptl->sub_layer_profile_idc [i] == 1 ||
21162123 ptl->sub_layer_profile_compatibility_flag [i][1 ] ||
2124+ ptl->sub_layer_profile_idc [i] == 2 ||
21172125 ptl->sub_layer_profile_compatibility_flag [i][2 ] ||
2126+ ptl->sub_layer_profile_idc [i] == 3 ||
21182127 ptl->sub_layer_profile_compatibility_flag [i][3 ] ||
2128+ ptl->sub_layer_profile_idc [i] == 4 ||
21192129 ptl->sub_layer_profile_compatibility_flag [i][4 ] ||
2120- ptl->sub_layer_profile_compatibility_flag [i][5 ])
2121- {
2130+ ptl->sub_layer_profile_idc [i] == 5 ||
2131+ ptl->sub_layer_profile_compatibility_flag [i][5 ] ||
2132+ ptl->sub_layer_profile_idc [i] == 9 ||
2133+ ptl->sub_layer_profile_compatibility_flag [i][9 ] ||
2134+ ptl->sub_layer_profile_idc [i] == 11 ||
2135+ ptl->sub_layer_profile_compatibility_flag [i][11 ]) {
21222136 // inbld_flag u(1)
21232137 ptl->sub_layer_inbld_flag [i] = bs->read_bit ();
21242138 } else {
0 commit comments