[vlc-commits] packetizer: h26x: recovery point has changed for HEVC

Francois Cartegnie git at videolan.org
Wed Feb 3 13:22:35 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Feb  3 13:38:29 2021 +0100| [63a50f5439faf553635cc6b218dd7448d79e5c4e] | committer: Francois Cartegnie

packetizer: h26x: recovery point has changed for HEVC

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

 modules/packetizer/h264.c     | 10 +++++++---
 modules/packetizer/h264_nal.c |  9 +++++++++
 modules/packetizer/h264_nal.h |  8 ++++++++
 modules/packetizer/hevc.c     |  6 ++++--
 modules/packetizer/hevc_nal.c |  6 ++++++
 modules/packetizer/hevc_nal.h |  7 +++++++
 modules/packetizer/hxxx_sei.c |  5 +----
 modules/packetizer/hxxx_sei.h |  4 ----
 8 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index ea4d2f994b..4bb1949e53 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -1228,9 +1228,13 @@ static bool ParseSeiCallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
             /* Look for SEI recovery point */
         case HXXX_SEI_RECOVERY_POINT:
         {
-            if( !p_sys->b_recovered )
-                msg_Dbg( p_dec, "Seen SEI recovery point, %d recovery frames", p_sei_data->recovery.i_frames );
-            p_sys->i_recovery_frame_cnt = p_sei_data->recovery.i_frames;
+            h264_sei_recovery_point_t reco;
+            if( !p_sys->b_recovered &&
+                h264_decode_sei_recovery_point( p_sei_data->p_bs, &reco ) )
+            {
+                msg_Dbg( p_dec, "Seen SEI recovery point, %u recovery frames", reco.i_frames );
+                p_sys->i_recovery_frame_cnt = reco.i_frames;
+            }
         } break;
 
         default:
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index 8233a3e6f7..c1e21239bb 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -861,3 +861,12 @@ bool h264_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile,
 
     return true;
 }
+
+bool h264_decode_sei_recovery_point( bs_t *p_bs, h264_sei_recovery_point_t *p_reco )
+{
+    p_reco->i_frames = bs_read_ue( p_bs );
+    //bool b_exact_match = bs_read( p_bs, 1 );
+    //bool b_broken_link = bs_read( p_bs, 1 );
+    //int i_changing_slice_group = bs_read( p_bs, 2 );
+    return true;
+}
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index b3a3001f23..e736ff1c2a 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -22,6 +22,7 @@
 
 # include <vlc_common.h>
 # include <vlc_es.h>
+# include <vlc_bits.h>
 
 #define PROFILE_H264_BASELINE             66
 #define PROFILE_H264_MAIN                 77
@@ -198,4 +199,11 @@ bool h264_get_colorimetry( const h264_sequence_parameter_set_t *p_sps,
 bool h264_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile,
                             uint8_t *pi_level, uint8_t *p_nal_length_size);
 
+typedef struct
+{
+    unsigned i_frames;
+} h264_sei_recovery_point_t;
+
+bool h264_decode_sei_recovery_point( bs_t *, h264_sei_recovery_point_t * );
+
 #endif /* H264_NAL_H */
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 73f9a243e8..9b064a638a 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -1063,9 +1063,11 @@ static bool ParseSEICallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
         } break;
         case HXXX_SEI_RECOVERY_POINT:
         {
-            if( !p_sys->b_recovery_point )
+            hevc_sei_recovery_point_t reco;
+            if( !p_sys->b_recovery_point &&
+                hevc_decode_sei_recovery_point( p_sei_data->p_bs, &reco ) )
             {
-                msg_Dbg( p_dec, "Seen SEI recovery point, %d recovery frames", p_sei_data->recovery.i_frames );
+                msg_Dbg( p_dec, "Seen SEI recovery point, %d recovery frames", reco.i_frames );
                 p_sys->b_recovery_point = true;
             }
         } break;
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 0f8daf263c..65d830047e 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1654,6 +1654,12 @@ hevc_sei_pic_timing_t * hevc_decode_sei_pic_timing( bs_t *p_bs,
     return p_timing;
 }
 
+bool hevc_decode_sei_recovery_point( bs_t *p_bs, hevc_sei_recovery_point_t *p_reco )
+{
+    p_reco->i_frames = bs_read_se( p_bs );
+    return true;
+}
+
 bool hevc_frame_is_progressive( const hevc_sequence_parameter_set_t *p_sps,
                                 const hevc_sei_pic_timing_t *p_timing )
 {
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 8abe6d57d2..6796b1fab7 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -375,6 +375,13 @@ hevc_sei_pic_timing_t * hevc_decode_sei_pic_timing( bs_t *,
                                                     const hevc_sequence_parameter_set_t * );
 void hevc_release_sei_pic_timing( hevc_sei_pic_timing_t * );
 
+typedef struct
+{
+    int i_frames;
+} hevc_sei_recovery_point_t;
+
+bool hevc_decode_sei_recovery_point( bs_t *, hevc_sei_recovery_point_t * );
+
 uint8_t hevc_get_num_clock_ts( const hevc_sequence_parameter_set_t *,
                                const hevc_sei_pic_timing_t * /* can be NULL */ );
 bool hevc_frame_is_progressive( const hevc_sequence_parameter_set_t *,
diff --git a/modules/packetizer/hxxx_sei.c b/modules/packetizer/hxxx_sei.c
index b6661f80b5..2ae5f66aa0 100644
--- a/modules/packetizer/hxxx_sei.c
+++ b/modules/packetizer/hxxx_sei.c
@@ -168,10 +168,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
             /* Look for SEI recovery point */
             case HXXX_SEI_RECOVERY_POINT:
             {
-                sei_data.recovery.i_frames = bs_read_ue( &s );
-                //bool b_exact_match = bs_read( &s, 1 );
-                //bool b_broken_link = bs_read( &s, 1 );
-                //int i_changing_slice_group = bs_read( &s, 2 );
+                sei_data.p_bs = &s;
                 b_continue = pf_callback( &sei_data, cbdata );
             } break;
 
diff --git a/modules/packetizer/hxxx_sei.h b/modules/packetizer/hxxx_sei.h
index 6691fb8b67..503cc59720 100644
--- a/modules/packetizer/hxxx_sei.h
+++ b/modules/packetizer/hxxx_sei.h
@@ -74,10 +74,6 @@ typedef struct
             bool b_frame0;
         } frame_packing;
         struct
-        {
-            int i_frames;
-        } recovery;
-        struct
         {
             uint16_t primaries[3*2]; /* G,B,R / x,y */
             uint16_t white_point[2]; /* x,y */



More information about the vlc-commits mailing list