Commit 177451c9 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Thibault Saunier

codecparsers: h264: record ref_pic_list_modification().

parent 99101a58
...@@ -743,60 +743,56 @@ error: ...@@ -743,60 +743,56 @@ error:
} }
static gboolean static gboolean
slice_parse_ref_pic_list_modification (GstH264SliceHdr * slice, NalReader * nr) slice_parse_ref_pic_list_modification_1 (GstH264SliceHdr * slice,
NalReader * nr, guint list)
{ {
GST_DEBUG ("parsing \"Reference picture list modification\""); GstH264RefPicListModification *entries;
guint8 *ref_pic_list_modification_flag;
guint32 modification_of_pic_nums_idc;
guint i = 0;
if (!GST_H264_IS_I_SLICE (slice) && !GST_H264_IS_SI_SLICE (slice)) { if (list == 0) {
guint8 ref_pic_list_modification_flag_l0; entries = slice->ref_pic_list_modification_l0;
guint32 modification_of_pic_nums_idc; ref_pic_list_modification_flag = &slice->ref_pic_list_modification_flag_l0;
} else {
READ_UINT8 (nr, ref_pic_list_modification_flag_l0, 1); entries = slice->ref_pic_list_modification_l1;
if (ref_pic_list_modification_flag_l0) ref_pic_list_modification_flag = &slice->ref_pic_list_modification_flag_l1;
do {
READ_UE (nr, modification_of_pic_nums_idc);
if (modification_of_pic_nums_idc == 0
|| modification_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 (modification_of_pic_nums_idc == 2) {
guint32 long_term_pic_num;
READ_UE (nr, long_term_pic_num);
}
} while (modification_of_pic_nums_idc != 3);
} }
if (GST_H264_IS_B_SLICE (slice)) { READ_UINT8 (nr, *ref_pic_list_modification_flag, 1);
guint8 ref_pic_list_modification_flag_l1; do {
guint32 modification_of_pic_nums_idc; READ_UE (nr, modification_of_pic_nums_idc);
if (modification_of_pic_nums_idc == 0 || modification_of_pic_nums_idc == 1) {
READ_UINT8 (nr, ref_pic_list_modification_flag_l1, 1); READ_UE_ALLOWED (nr, entries[i].value.abs_diff_pic_num_minus1, 0,
if (ref_pic_list_modification_flag_l1) slice->max_pic_num - 1);
do { } else if (modification_of_pic_nums_idc == 2) {
READ_UE (nr, modification_of_pic_nums_idc); READ_UE (nr, entries[i].value.long_term_pic_num);
if (modification_of_pic_nums_idc == 0 }
|| modification_of_pic_nums_idc == 1) { } while (modification_of_pic_nums_idc != 3);
guint32 abs_diff_num_minus1;
READ_UE (nr, abs_diff_num_minus1);
} else if (modification_of_pic_nums_idc == 2) {
guint32 long_term_pic_num;
READ_UE (nr, long_term_pic_num);
}
} while (modification_of_pic_nums_idc != 3);
}
return TRUE; return TRUE;
error: error:
GST_WARNING ("error parsing \"Reference picture list modification\""); GST_WARNING ("error parsing \"Reference picture list %u modification\"",
list);
return FALSE; return FALSE;
} }
static gboolean
slice_parse_ref_pic_list_modification (GstH264SliceHdr * slice, NalReader * nr)
{
if (!GST_H264_IS_I_SLICE (slice) && !GST_H264_IS_SI_SLICE (slice)) {
if (!slice_parse_ref_pic_list_modification_1 (slice, nr, 0))
return FALSE;
}
if (GST_H264_IS_B_SLICE (slice)) {
if (!slice_parse_ref_pic_list_modification_1 (slice, nr, 1))
return FALSE;
}
return TRUE;
}
static gboolean static gboolean
gst_h264_slice_parse_dec_ref_pic_marking (GstH264SliceHdr * slice, gst_h264_slice_parse_dec_ref_pic_marking (GstH264SliceHdr * slice,
GstH264NalUnit * nalu, NalReader * nr) GstH264NalUnit * nalu, NalReader * nr)
......
...@@ -168,24 +168,25 @@ typedef enum ...@@ -168,24 +168,25 @@ typedef enum
GST_H264_S_SI_SLICE = 9 GST_H264_S_SI_SLICE = 9
} GstH264SliceType; } GstH264SliceType;
typedef struct _GstH264NalParser GstH264NalParser; typedef struct _GstH264NalParser GstH264NalParser;
typedef struct _GstH264NalUnit GstH264NalUnit; typedef struct _GstH264NalUnit GstH264NalUnit;
typedef struct _GstH264SPS GstH264SPS; typedef struct _GstH264SPS GstH264SPS;
typedef struct _GstH264PPS GstH264PPS; typedef struct _GstH264PPS GstH264PPS;
typedef struct _GstH264HRDParams GstH264HRDParams; typedef struct _GstH264HRDParams GstH264HRDParams;
typedef struct _GstH264VUIParams GstH264VUIParams; typedef struct _GstH264VUIParams GstH264VUIParams;
typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking; typedef struct _GstH264RefPicListModification GstH264RefPicListModification;
typedef struct _GstH264RefPicMarking GstH264RefPicMarking; typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking;
typedef struct _GstH264PredWeightTable GstH264PredWeightTable; typedef struct _GstH264RefPicMarking GstH264RefPicMarking;
typedef struct _GstH264SliceHdr GstH264SliceHdr; typedef struct _GstH264PredWeightTable GstH264PredWeightTable;
typedef struct _GstH264SliceHdr GstH264SliceHdr;
typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp; typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp;
typedef struct _GstH264PicTiming GstH264PicTiming; typedef struct _GstH264PicTiming GstH264PicTiming;
typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod; typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod;
typedef struct _GstH264SEIMessage GstH264SEIMessage; typedef struct _GstH264SEIMessage GstH264SEIMessage;
/** /**
* GstH264NalUnit: * GstH264NalUnit:
...@@ -485,6 +486,18 @@ struct _GstH264PPS ...@@ -485,6 +486,18 @@ struct _GstH264PPS
gboolean valid; gboolean valid;
}; };
struct _GstH264RefPicListModification
{
guint8 modification_of_pic_nums_idc;
union
{
/* if modification_of_pic_nums_idc == 0 || 1 */
guint32 abs_diff_pic_num_minus1;
/* if modification_of_pic_nums_idc == 2 */
guint32 long_term_pic_num;
} value;
};
struct _GstH264PredWeightTable struct _GstH264PredWeightTable
{ {
guint8 luma_log2_weight_denom; guint8 luma_log2_weight_denom;
...@@ -559,6 +572,11 @@ struct _GstH264SliceHdr ...@@ -559,6 +572,11 @@ struct _GstH264SliceHdr
guint8 num_ref_idx_l0_active_minus1; guint8 num_ref_idx_l0_active_minus1;
guint8 num_ref_idx_l1_active_minus1; guint8 num_ref_idx_l1_active_minus1;
guint8 ref_pic_list_modification_flag_l0;
GstH264RefPicListModification ref_pic_list_modification_l0[32];
guint8 ref_pic_list_modification_flag_l1;
GstH264RefPicListModification ref_pic_list_modification_l1[32];
GstH264PredWeightTable pred_weight_table; GstH264PredWeightTable pred_weight_table;
/* if nal_unit.ref_idc != 0 */ /* if nal_unit.ref_idc != 0 */
GstH264DecRefPicMarking dec_ref_pic_marking; GstH264DecRefPicMarking dec_ref_pic_marking;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment