summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2011-09-20 17:53:51 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2011-09-20 17:53:51 +0200
commitd3243c6ad973e3a11bd1d45d287cd54d177ab621 (patch)
tree95726da7b767401f1b40ce9e0d2f48e03f6c39ba
parent169c1c53b40d704d4278e224480b5ceb71991e5f (diff)
codecparsers: h264: record ref_pic_list_reordering().bitstreamparserlibs
-rw-r--r--gst-libs/gst/codecparsers/gsth264parser.c81
-rw-r--r--gst-libs/gst/codecparsers/gsth264parser.h15
2 files changed, 56 insertions, 40 deletions
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index 1378d3ac5..f7a65a215 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -743,56 +743,57 @@ error:
}
static gboolean
-slice_parse_ref_pic_list_reordering (GstH264SliceHdr * slice, NalReader * nr)
+slice_parse_ref_pic_list_reordering_1 (GstH264SliceHdr * slice, NalReader * nr,
+ guint list)
{
- GST_DEBUG ("parsing \"Reference picture list reordering\"");
+ GstH264RefPicListReordering *entries;
+ guint8 *ref_pic_list_reordering_flag;
+ guint8 reordering_of_pic_nums_idc;
+ guint i = 0;
- if (!GST_H264_IS_I_SLICE (slice) && !GST_H264_IS_SI_SLICE (slice)) {
- guint8 ref_pic_list_reordering_flag_l0;
- guint32 reordering_of_pic_nums_idc;
-
- READ_UINT8 (nr, ref_pic_list_reordering_flag_l0, 1);
- if (ref_pic_list_reordering_flag_l0)
- do {
- READ_UE (nr, reordering_of_pic_nums_idc);
- if (reordering_of_pic_nums_idc == 0 || reordering_of_pic_nums_idc == 1) {
- guint32 abs_diff_pic_num_minus1 G_GNUC_UNUSED;
-
- READ_UE_ALLOWED (nr, abs_diff_pic_num_minus1, 0,
- slice->max_pic_num - 1);
- } else if (reordering_of_pic_nums_idc == 2) {
- guint32 long_term_pic_num;
-
- READ_UE (nr, long_term_pic_num);
- }
- } while (reordering_of_pic_nums_idc != 3);
+ if (list == 0) {
+ entries = slice->ref_pic_list_reordering_l0;
+ ref_pic_list_reordering_flag = &slice->ref_pic_list_reordering_flag_l0;
+ } else {
+ entries = slice->ref_pic_list_reordering_l1;
+ ref_pic_list_reordering_flag = &slice->ref_pic_list_reordering_flag_l1;
}
- if (GST_H264_IS_B_SLICE (slice)) {
- guint8 ref_pic_list_reordering_flag_l1;
- guint32 reordering_of_pic_nums_idc;
+ READ_UINT8 (nr, *ref_pic_list_reordering_flag, 1);
+ do {
+ READ_UE_ALLOWED (nr, reordering_of_pic_nums_idc, 0, 3);
+ entries[i].reordering_of_pic_nums_idc = reordering_of_pic_nums_idc;
+ if (reordering_of_pic_nums_idc == 0 || reordering_of_pic_nums_idc == 1) {
+ READ_UE_ALLOWED (nr, entries[i].value.abs_diff_pic_num_minus1, 0,
+ slice->max_pic_num - 1);
+ } else if (reordering_of_pic_nums_idc == 2) {
+ READ_UE (nr, entries[i].value.long_term_pic_num);
+ }
+ if (++i >= 32)
+ return FALSE;
+ } while (reordering_of_pic_nums_idc != 3);
+ return TRUE;
- READ_UINT8 (nr, ref_pic_list_reordering_flag_l1, 1);
- if (ref_pic_list_reordering_flag_l1)
- do {
- READ_UE (nr, reordering_of_pic_nums_idc);
- if (reordering_of_pic_nums_idc == 0 || reordering_of_pic_nums_idc == 1) {
- guint32 abs_diff_num_minus1;
+error:
+ GST_WARNING ("error parsing ref_pic_list_reordering() list %u", list);
+ return FALSE;
+}
- READ_UE (nr, abs_diff_num_minus1);
- } else if (reordering_of_pic_nums_idc == 2) {
- guint32 long_term_pic_num;
+static gboolean
+slice_parse_ref_pic_list_reordering (GstH264SliceHdr * slice, NalReader * nr)
+{
+ GST_DEBUG ("parsing \"Reference picture list reordering\"");
- READ_UE (nr, long_term_pic_num);
- }
- } while (reordering_of_pic_nums_idc != 3);
+ if (!GST_H264_IS_I_SLICE (slice) && !GST_H264_IS_SI_SLICE (slice)) {
+ if (!slice_parse_ref_pic_list_reordering_1 (slice, nr, 0))
+ return FALSE;
}
+ if (GST_H264_IS_B_SLICE (slice)) {
+ if (!slice_parse_ref_pic_list_reordering_1 (slice, nr, 1))
+ return FALSE;
+ }
return TRUE;
-
-error:
- GST_WARNING ("error parsing \"Reference picture list reordering\"");
- return FALSE;
}
static gboolean
diff --git a/gst-libs/gst/codecparsers/gsth264parser.h b/gst-libs/gst/codecparsers/gsth264parser.h
index 84577f686..0047761e2 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.h
+++ b/gst-libs/gst/codecparsers/gsth264parser.h
@@ -172,6 +172,7 @@ typedef struct _GstH264PPS GstH264PPS;
typedef struct _GstH264HRDParams GstH264HRDParams;
typedef struct _GstH264VUIParams GstH264VUIParams;
+typedef struct _GstH264RefPicListReordering GstH264RefPicListReordering;
typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking;
typedef struct _GstH264RefPicMarking GstH264RefPicMarking;
typedef struct _GstH264PredWeightTable GstH264PredWeightTable;
@@ -475,6 +476,15 @@ struct _GstH264PPS
gboolean valid;
};
+struct _GstH264RefPicListReordering
+{
+ guint8 reordering_of_pic_nums_idc;
+ union {
+ guint32 abs_diff_pic_num_minus1;
+ guint32 long_term_pic_num;
+ } value;
+};
+
struct _GstH264PredWeightTable
{
guint8 luma_log2_weight_denom;
@@ -549,6 +559,11 @@ struct _GstH264SliceHdr
guint8 num_ref_idx_l0_active_minus1;
guint8 num_ref_idx_l1_active_minus1;
+ guint8 ref_pic_list_reordering_flag_l0;
+ GstH264RefPicListReordering ref_pic_list_reordering_l0[32];
+ guint8 ref_pic_list_reordering_flag_l1;
+ GstH264RefPicListReordering ref_pic_list_reordering_l1[32];
+
GstH264PredWeightTable pred_weight_table;
/* if nal_unit.ref_idc != 0 */
GstH264DecRefPicMarking dec_ref_pic_marking;