Commit 0a0c7316 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Edward Hervey

codecparsers: h264: fix slice_header() parsing.

We were not parsing the slice headers until the actual end, we are now
parsing until the end.
parent 43e47009
......@@ -109,6 +109,30 @@ const guint8 zigzag_4x4[16] = {
7, 11, 14, 15,
};
/* Compute Ceil(Log2(v)) */
/* Derived from branchless code for integer log2(v) from:
<http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog> */
static guint
ceil_log2 (guint32 v)
{
guint r, shift;
v--;
r = (v > 0xFFFF) << 4;
v >>= r;
shift = (v > 0xFF) << 3;
v >>= shift;
r |= shift;
shift = (v > 0xF) << 2;
v >>= shift;
r |= shift;
shift = (v > 0x3) << 1;
v >>= shift;
r |= shift;
r |= (v >> 1);
return r + 1;
}
/****** Nal parser ******/
typedef struct
......
......@@ -546,6 +546,16 @@ struct _GstH264SliceHdr
/* if nal_unit.ref_idc != 0 */
GstH264DecRefPicMarking dec_ref_pic_marking;
guint8 cabac_init_idc;
gint8 slice_qp_delta;
gint8 slice_qs_delta;
guint8 disable_deblocking_filter_idc;
gint8 slice_alpha_c0_offset_div2;
gint8 slice_beta_offset_div2;
guint16 slice_group_change_cycle;
/* calculated values */
guint32 max_pic_num;
gboolean valid;
......
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