[vlc-commits] [Git][videolan/vlc][master] 2 commits: packetizer: h264: expose max_dec_buffering

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jan 28 07:04:21 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6343d481 by François Cartegnie at 2025-01-28T06:28:49+00:00
packetizer: h264: expose max_dec_buffering

- - - - -
a5344913 by François Cartegnie at 2025-01-28T06:28:49+00:00
codec: videotoolbox: use max dec buffering for DPB

- - - - -


3 changed files:

- modules/codec/videotoolbox/decoder.c
- modules/packetizer/h264_nal.c
- modules/packetizer/h264_nal.h


Changes:

=====================================
modules/codec/videotoolbox/decoder.c
=====================================
@@ -284,8 +284,8 @@ static bool FillReorderInfoH264(decoder_t *p_dec, const block_t *p_block,
 
                 p_info->i_num_ts = h264_get_num_ts(p_sps, slice, sei.i_pic_struct,
                                                    p_info->i_foc, bFOC);
-                unsigned dummy;
-                h264_get_dpb_values(p_sps, &p_info->i_max_pics_buffering, &dummy);
+
+                h264_get_dpb_values(p_sps, &p_info->i_max_num_reorder, &p_info->i_max_pics_buffering);
 
                 if (!p_info->b_progressive)
                     p_info->b_top_field_first = (sei.i_pic_struct % 2 == 1);


=====================================
modules/packetizer/h264_nal.c
=====================================
@@ -533,7 +533,7 @@ static bool h264_parse_sequence_parameter_set_rbsp( bs_t *p_bs,
             bs_read_ue( p_bs ); /* log2 max mv h */
             bs_read_ue( p_bs ); /* log2 max mv v */
             p_sps->vui.i_max_num_reorder_frames = bs_read_ue( p_bs );
-            bs_read_ue( p_bs ); /* max dec frame buffering */
+            p_sps->vui.i_max_dec_frame_buffering = bs_read_ue( p_bs );
         }
     }
 
@@ -816,14 +816,11 @@ static uint8_t h264_get_max_dpb_frames( const h264_sequence_parameter_set_t *p_s
 }
 
 bool h264_get_dpb_values( const h264_sequence_parameter_set_t *p_sps,
-                          uint8_t *pi_depth, unsigned *pi_delay )
+                          uint8_t *pi_max_num_reorder, uint8_t *pi_max_dec_buffering )
 {
     uint8_t i_max_num_reorder_frames = p_sps->vui.i_max_num_reorder_frames;
-    if( p_sps->i_pic_order_cnt_type == 2 ) /* 8.2.1.3 */
-    {
-        i_max_num_reorder_frames = 0;
-    }
-    else if( !p_sps->vui.b_bitstream_restriction_flag )
+    uint8_t i_max_dec_frame_buffering = p_sps->vui.i_max_dec_frame_buffering;
+    if( !p_sps->vui.b_bitstream_restriction_flag )
     {
         switch( p_sps->i_profile ) /* E-2.1 */
         {
@@ -838,18 +835,23 @@ bool h264_get_dpb_values( const h264_sequence_parameter_set_t *p_sps,
             case PROFILE_H264_HIGH_444_PREDICTIVE:
                 if( p_sps->i_constraint_set_flags & H264_CONSTRAINT_SET_FLAG(3) )
                 {
-                    i_max_num_reorder_frames = 0; /* all IDR */
+                    i_max_num_reorder_frames =
+                    i_max_dec_frame_buffering = 0; /* all IDR */
                     break;
                 }
                 /* fallthrough */
             default:
-                i_max_num_reorder_frames = h264_get_max_dpb_frames( p_sps );
+                i_max_num_reorder_frames =
+                i_max_dec_frame_buffering = h264_get_max_dpb_frames( p_sps );
                 break;
         }
     }
 
-    *pi_depth = i_max_num_reorder_frames;
-    *pi_delay = 0;
+    if( i_max_num_reorder_frames > i_max_dec_frame_buffering )
+        i_max_num_reorder_frames = i_max_dec_frame_buffering;
+
+    *pi_max_num_reorder = i_max_num_reorder_frames;
+    *pi_max_dec_buffering = i_max_dec_frame_buffering;
 
     return true;
 }


=====================================
modules/packetizer/h264_nal.h
=====================================
@@ -154,6 +154,7 @@ struct h264_sequence_parameter_set_t
         /* restrictions */
         uint8_t b_bitstream_restriction_flag;
         uint8_t i_max_num_reorder_frames;
+        uint8_t i_max_dec_frame_buffering;
     } vui;
 };
 
@@ -209,7 +210,7 @@ uint8_t * h264_avcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
                                    size_t *pi_result, uint8_t *pi_nal_length_size );
 
 bool h264_get_dpb_values( const h264_sequence_parameter_set_t *,
-                          uint8_t *pi_depth, unsigned *pi_delay );
+                          uint8_t *pi_max_num_reorder, uint8_t *pi_max_dec_buffering );
 
 unsigned h264_get_max_frame_num( const h264_sequence_parameter_set_t * );
 bool h264_is_frames_only( const h264_sequence_parameter_set_t * );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1a408ca871366a9099445e007df7479b830a8ea1...a53449135ff2f5c2d740215300820ae0ca4780d3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1a408ca871366a9099445e007df7479b830a8ea1...a53449135ff2f5c2d740215300820ae0ca4780d3
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