[FFmpeg-cvslog] h264: Refactor decode_frame_packing_arrangement

Vittorio Giovara git at videolan.org
Tue Dec 17 19:38:30 CET 2013


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Dec 13 18:12:59 2013 +0100| [3d9fc21e593aa89b5877bd739268499b079052f2] | committer: Vittorio Giovara

h264: Refactor decode_frame_packing_arrangement

Directly set the fields when necessary.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d9fc21e593aa89b5877bd739268499b079052f2
---

 libavcodec/h264_sei.c |   23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 746c213..28e044d 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -178,35 +178,26 @@ static int decode_buffering_period(H264Context *h)
 
 static int decode_frame_packing_arrangement(H264Context *h)
 {
-    int cancel;
-    int quincunx =  0;
-    int content  = -1;
-    int type     = -1;
-
     get_ue_golomb(&h->gb);              // frame_packing_arrangement_id
-    cancel = get_bits1(&h->gb);         // frame_packing_arrangement_cancel_flag
-    if (cancel == 0) {
-        type = get_bits(&h->gb, 7);     // frame_packing_arrangement_type
-        quincunx = get_bits1(&h->gb);   // quincunx_sampling_flag
-        content = get_bits(&h->gb, 6);  // content_interpretation_type
+    h->sei_frame_packing_present = !get_bits1(&h->gb);
+
+    if (h->sei_frame_packing_present) {
+        h->frame_packing_arrangement_type = get_bits(&h->gb, 7);
+        h->quincunx_subsampling           = get_bits1(&h->gb);
+        h->content_interpretation_type    = get_bits(&h->gb, 6);
 
         // the following skips: spatial_flipping_flag, frame0_flipped_flag,
         // field_views_flag, current_frame_is_frame0_flag,
         // frame0_self_contained_flag, frame1_self_contained_flag
         skip_bits(&h->gb, 6);
 
-        if (quincunx == 0 && type != 5)
+        if (!h->quincunx_subsampling && h->frame_packing_arrangement_type != 5)
             skip_bits(&h->gb, 16);      // frame[01]_grid_position_[xy]
         skip_bits(&h->gb, 8);           // frame_packing_arrangement_reserved_byte
         get_ue_golomb(&h->gb);          // frame_packing_arrangement_repetition_period
     }
     skip_bits1(&h->gb);                 // frame_packing_arrangement_extension_flag
 
-    h->sei_frame_packing_present      = (cancel == 0);
-    h->frame_packing_arrangement_type = type;
-    h->content_interpretation_type    = content;
-    h->quincunx_subsampling           = quincunx;
-
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list