[vlc-commits] packetizer: h264: remove temp ep3b to rbsp conversions

Francois Cartegnie git at videolan.org
Thu Dec 17 18:09:52 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 17 18:06:47 2015 +0100| [74f4224105ce9925b606a06867c7fa1ab4a4c703] | committer: Francois Cartegnie

packetizer: h264: remove temp ep3b to rbsp conversions

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74f4224105ce9925b606a06867c7fa1ab4a4c703
---

 modules/packetizer/h264.c     |   13 ++++---------
 modules/packetizer/h264_nal.c |   16 +++++-----------
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index de0a317..6f21cba 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -778,8 +778,6 @@ static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
                         int i_nal_ref_idc, int i_nal_type, const block_t *p_frag )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    uint8_t *pb_dec;
-    size_t i_dec = 0;
     int i_slice_type;
     slice_t slice;
     bs_t s;
@@ -787,12 +785,10 @@ static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
     if(p_frag->i_buffer < 6)
         return false;
 
-    /* do not convert the whole frame */
-    pb_dec = hxxx_ep3b_to_rbsp(&p_frag->p_buffer[5], __MIN( p_frag->i_buffer - 5, 60 ), &i_dec);
-    if(!pb_dec)
-        return false;
-
-    bs_init( &s, pb_dec, i_dec );
+    bs_init( &s, &p_frag->p_buffer[5], p_frag->i_buffer - 5 );
+    unsigned i_bitflow = 0;
+    s.p_fwpriv = &i_bitflow;
+    s.pf_forward = hxxx_bsfw_ep3b_to_rbsp;  /* Does the emulated 3bytes conversion to rbsp */
 
     /* first_mb_in_slice */
     /* int i_first_mb = */ bs_read_ue( &s );
@@ -858,7 +854,6 @@ static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
         if( p_sys->i_pic_order_present_flag && !slice.i_field_pic_flag )
             slice.i_delta_pic_order_cnt1 = bs_read_se( &s );
     }
-    free( pb_dec );
 
     /* Detection of the first VCL NAL unit of a primary coded picture
      * (cf. 7.4.1.2.4) */
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index b8d1c29..2838a8e 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -402,8 +402,6 @@ int h264_get_spspps( uint8_t *p_buf, size_t i_buf,
 int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
                     struct h264_nal_sps *p_sps )
 {
-    uint8_t *pb_dec = NULL;
-    size_t     i_dec = 0;
     bs_t s;
     int i_tmp;
 
@@ -411,11 +409,12 @@ int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
         return -1;
 
     memset( p_sps, 0, sizeof(struct h264_nal_sps) );
-    pb_dec = hxxx_ep3b_to_rbsp( &p_sps_buf[5], i_sps_size - 5, &i_dec );
-    if( !pb_dec )
-        return -1;
 
-    bs_init( &s, pb_dec, i_dec );
+    bs_init( &s, &p_sps_buf[5], i_sps_size - 5 );
+    unsigned i_bitflow = 0;
+    s.p_fwpriv = &i_bitflow;
+    s.pf_forward = hxxx_bsfw_ep3b_to_rbsp;  /* Does the emulated 3bytes conversion to rbsp */
+
     int i_profile_idc = bs_read( &s, 8 );
     p_sps->i_profile = i_profile_idc;
     p_sps->i_profile_compatibility = bs_read( &s, 8 );
@@ -423,10 +422,7 @@ int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
     /* sps id */
     p_sps->i_id = bs_read_ue( &s );
     if( p_sps->i_id >= H264_SPS_MAX )
-    {
-        free( pb_dec );
         return -1;
-    }
 
     if( i_profile_idc == PROFILE_H264_HIGH ||
         i_profile_idc == PROFILE_H264_HIGH_10 ||
@@ -661,8 +657,6 @@ int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
         /* + unparsed remains */
     }
 
-    free( pb_dec );
-
     return 0;
 }
 



More information about the vlc-commits mailing list