[vlc-commits] [Git][videolan/vlc][master] 3 commits: packetizer: h264: use num_slice_groups_minus1 as stored
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Sep 30 10:30:07 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
486e2e67 by Steve Lhomme at 2025-09-30T10:15:02+00:00
packetizer: h264: use num_slice_groups_minus1 as stored
And also as the specs compare it. The loop for slice_group_map_type was bogus.
- - - - -
52e0d1a6 by Steve Lhomme at 2025-09-30T10:15:02+00:00
packetizer: h264: simplify sliceGroupSize computation
num_slice_groups_minus1 can only be in the [1,7] range when reaching this code.
- - - - -
1327a621 by Steve Lhomme at 2025-09-30T10:15:02+00:00
packetizer: h264: skip all slice group ID's at once
- - - - -
1 changed file:
- modules/packetizer/h264_nal.c
Changes:
=====================================
modules/packetizer/h264_nal.c
=====================================
@@ -563,20 +563,20 @@ static bool h264_parse_picture_parameter_set_rbsp( bs_t *p_bs,
bs_skip( p_bs, 1 ); // entropy coding mode flag
p_pps->i_pic_order_present_flag = bs_read( p_bs, 1 );
- unsigned num_slice_groups = bs_read_ue( p_bs ) + 1;
- if( num_slice_groups > 8 ) /* never has value > 7. Annex A, G & J */
+ unsigned num_slice_groups_minus1 = bs_read_ue( p_bs );
+ if( num_slice_groups_minus1 > 7 ) /* never has value > 7. Annex A, G & J */
return false;
- if( num_slice_groups > 1 )
+ if( num_slice_groups_minus1 > 0 )
{
unsigned slice_group_map_type = bs_read_ue( p_bs );
if( slice_group_map_type == 0 )
{
- for( unsigned i = 0; i < num_slice_groups; i++ )
+ for( unsigned i = 0; i <= num_slice_groups_minus1; i++ )
bs_read_ue( p_bs ); /* run_length_minus1[group] */
}
else if( slice_group_map_type == 2 )
{
- for( unsigned i = 0; i < num_slice_groups; i++ )
+ for( unsigned i = 0; i < num_slice_groups_minus1; i++ )
{
bs_read_ue( p_bs ); /* top_left[group] */
bs_read_ue( p_bs ); /* bottom_right[group] */
@@ -590,16 +590,14 @@ static bool h264_parse_picture_parameter_set_rbsp( bs_t *p_bs,
else if( slice_group_map_type == 6 )
{
unsigned pic_size_in_maps_units = bs_read_ue( p_bs ) + 1;
- unsigned sliceGroupSize = 1;
- while(num_slice_groups > 1)
+ // Ceil( Log2( num_slice_groups_minus1 + 1 ) )
+ static const int ceil_log2_table[8] =
{
- sliceGroupSize++;
- num_slice_groups = ((num_slice_groups - 1) >> 1) + 1;
- }
- for( unsigned i = 0; i < pic_size_in_maps_units; i++ )
- {
- bs_skip( p_bs, sliceGroupSize );
- }
+ 0,1,2,2,3,3,3,3
+ };
+ unsigned sliceGroupSize = ceil_log2_table[num_slice_groups_minus1];
+ // slice_group_id[]
+ bs_skip( p_bs, sliceGroupSize * pic_size_in_maps_units );
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8cc1583480ab48334bfdc68a342f6850f0409884...1327a621feed33b5156bcbea701c1023355d5931
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8cc1583480ab48334bfdc68a342f6850f0409884...1327a621feed33b5156bcbea701c1023355d5931
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list