[0.11] gst-plugins-bad: codecparsers: h264: fix ref_pic_list_modification()

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Jan 25 04:23:58 PST 2012


Module: gst-plugins-bad
Branch: 0.11
Commit: c92efe38e9f3e60509449ce1bb0d5a6d880c337a
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c92efe38e9f3e60509449ce1bb0d5a6d880c337a

Author: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Date:   Wed Jan 18 16:35:16 2012 +0100

codecparsers: h264: fix ref_pic_list_modification()

The entries were not filled in linearly and the termination was not
recorded either. Now, the actual number of modifications is recorded
similarly to dec_ref_pic_marking(). i.e. an explicit counter instead
of storing the termination value in the array.

https://bugzilla.gnome.org/show_bug.cgi?id=668192

---

 gst-libs/gst/codecparsers/gsth264parser.c |   13 +++++++++----
 gst-libs/gst/codecparsers/gsth264parser.h |    2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index 6a164ec..45039f7 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -747,22 +747,26 @@ slice_parse_ref_pic_list_modification_1 (GstH264SliceHdr * slice,
     NalReader * nr, guint list)
 {
   GstH264RefPicListModification *entries;
-  guint8 *ref_pic_list_modification_flag;
+  guint8 *ref_pic_list_modification_flag, *n_ref_pic_list_modification;
   guint32 modification_of_pic_nums_idc;
   guint i = 0;
 
   if (list == 0) {
     entries = slice->ref_pic_list_modification_l0;
     ref_pic_list_modification_flag = &slice->ref_pic_list_modification_flag_l0;
+    n_ref_pic_list_modification = &slice->n_ref_pic_list_modification_l0;
   } else {
     entries = slice->ref_pic_list_modification_l1;
     ref_pic_list_modification_flag = &slice->ref_pic_list_modification_flag_l1;
+    n_ref_pic_list_modification = &slice->n_ref_pic_list_modification_l1;
   }
 
   READ_UINT8 (nr, *ref_pic_list_modification_flag, 1);
   if (*ref_pic_list_modification_flag) {
-    do {
+    while (1) {
       READ_UE (nr, modification_of_pic_nums_idc);
+      if (modification_of_pic_nums_idc == 3)
+        break;
       if (modification_of_pic_nums_idc == 0 ||
           modification_of_pic_nums_idc == 1) {
         READ_UE_ALLOWED (nr, entries[i].value.abs_diff_pic_num_minus1, 0,
@@ -770,9 +774,10 @@ slice_parse_ref_pic_list_modification_1 (GstH264SliceHdr * slice,
       } else if (modification_of_pic_nums_idc == 2) {
         READ_UE (nr, entries[i].value.long_term_pic_num);
       }
-    } while (modification_of_pic_nums_idc != 3);
+      entries[i++].modification_of_pic_nums_idc = modification_of_pic_nums_idc;
+    }
   }
-
+  *n_ref_pic_list_modification = i;
   return TRUE;
 
 error:
diff --git a/gst-libs/gst/codecparsers/gsth264parser.h b/gst-libs/gst/codecparsers/gsth264parser.h
index d58f1b0..3c22156 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.h
+++ b/gst-libs/gst/codecparsers/gsth264parser.h
@@ -573,8 +573,10 @@ struct _GstH264SliceHdr
   guint8 num_ref_idx_l1_active_minus1;
 
   guint8 ref_pic_list_modification_flag_l0;
+  guint8 n_ref_pic_list_modification_l0;
   GstH264RefPicListModification ref_pic_list_modification_l0[32];
   guint8 ref_pic_list_modification_flag_l1;
+  guint8 n_ref_pic_list_modification_l1;
   GstH264RefPicListModification ref_pic_list_modification_l1[32];
 
   GstH264PredWeightTable pred_weight_table;



More information about the gstreamer-commits mailing list