mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
codecparsers: vc1: add API to parse slice headers.
Add gst_vc1_parse_slice_header() function to parse slice headers as described in 7.1.2. Slice layers are optional and allowed in advanced profile mode only. Picture header, if available (PIC_HEADER_FLAG), is parsed but not recorded because it shall be the same as that was previously parsed with gst_vc1_parse_frame_header(). This fixes SA00049.vc1 conformance test. https://bugzilla.gnome.org/show_bug.cgi?id=692388 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
82200d75ae
commit
07a51b16eb
2 changed files with 63 additions and 0 deletions
|
@ -2052,6 +2052,50 @@ gst_vc1_parse_field_header (const guint8 * data, gsize size,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vc1_parse_slice_header:
|
||||||
|
* @data: The data to parse
|
||||||
|
* @size: The size of @data
|
||||||
|
* @slicehdr: The #GstVC1SliceHdr to fill
|
||||||
|
* @seqhdr: The #GstVC1SeqHdr that was previously parsed
|
||||||
|
*
|
||||||
|
* Parses @data, and fills @slicehdr fields.
|
||||||
|
*
|
||||||
|
* Returns: a #GstVC1ParserResult
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
GstVC1ParserResult
|
||||||
|
gst_vc1_parse_slice_header (const guint8 * data, gsize size,
|
||||||
|
GstVC1SliceHdr * slicehdr, GstVC1SeqHdr * seqhdr)
|
||||||
|
{
|
||||||
|
GstBitReader br;
|
||||||
|
GstVC1FrameHdr framehdr;
|
||||||
|
GstVC1ParserResult result;
|
||||||
|
guint8 pic_header_flag;
|
||||||
|
|
||||||
|
GST_DEBUG ("Parsing slice header");
|
||||||
|
|
||||||
|
if (seqhdr->profile != GST_VC1_PROFILE_ADVANCED)
|
||||||
|
return GST_VC1_PARSER_BROKEN_DATA;
|
||||||
|
|
||||||
|
gst_bit_reader_init (&br, data, size);
|
||||||
|
|
||||||
|
READ_UINT16 (&br, slicehdr->slice_addr, 9);
|
||||||
|
READ_UINT8 (&br, pic_header_flag, 1);
|
||||||
|
if (pic_header_flag)
|
||||||
|
result = parse_frame_header_advanced (&br, &framehdr, seqhdr, NULL, FALSE);
|
||||||
|
else
|
||||||
|
result = GST_VC1_PARSER_OK;
|
||||||
|
|
||||||
|
slicehdr->header_size = gst_bit_reader_get_pos (&br);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
GST_WARNING ("Failed to parse slice header");
|
||||||
|
return GST_VC1_PARSER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vc1_bitplanes_new:
|
* gst_vc1_bitplanes_new:
|
||||||
* @seqhdr: The #GstVC1SeqHdr from which to set @bitplanes
|
* @seqhdr: The #GstVC1SeqHdr from which to set @bitplanes
|
||||||
|
|
|
@ -154,6 +154,7 @@ typedef struct _GstVC1FrameHdr GstVC1FrameHdr;
|
||||||
typedef struct _GstVC1PicAdvanced GstVC1PicAdvanced;
|
typedef struct _GstVC1PicAdvanced GstVC1PicAdvanced;
|
||||||
typedef struct _GstVC1PicSimpleMain GstVC1PicSimpleMain;
|
typedef struct _GstVC1PicSimpleMain GstVC1PicSimpleMain;
|
||||||
typedef struct _GstVC1Picture GstVC1Picture;
|
typedef struct _GstVC1Picture GstVC1Picture;
|
||||||
|
typedef struct _GstVC1SliceHdr GstVC1SliceHdr;
|
||||||
|
|
||||||
typedef struct _GstVC1VopDquant GstVC1VopDquant;
|
typedef struct _GstVC1VopDquant GstVC1VopDquant;
|
||||||
|
|
||||||
|
@ -547,6 +548,19 @@ struct _GstVC1FrameHdr
|
||||||
guint header_size;
|
guint header_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstVC1SliceHdr:
|
||||||
|
*
|
||||||
|
* Structure that represents slice layer in advanced profile.
|
||||||
|
*/
|
||||||
|
struct _GstVC1SliceHdr
|
||||||
|
{
|
||||||
|
guint16 slice_addr;
|
||||||
|
|
||||||
|
/* Size of the slice layer in bits */
|
||||||
|
guint header_size;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVC1BDU:
|
* GstVC1BDU:
|
||||||
*
|
*
|
||||||
|
@ -609,6 +623,11 @@ GstVC1ParserResult gst_vc1_parse_field_header (const guint8 *data,
|
||||||
GstVC1SeqHdr *seqhdr,
|
GstVC1SeqHdr *seqhdr,
|
||||||
GstVC1BitPlanes *bitplanes);
|
GstVC1BitPlanes *bitplanes);
|
||||||
|
|
||||||
|
GstVC1ParserResult gst_vc1_parse_slice_header (const guint8 *data,
|
||||||
|
gsize size,
|
||||||
|
GstVC1SliceHdr *slicehdr,
|
||||||
|
GstVC1SeqHdr *seqhdr);
|
||||||
|
|
||||||
GstVC1BitPlanes * gst_vc1_bitplanes_new (void);
|
GstVC1BitPlanes * gst_vc1_bitplanes_new (void);
|
||||||
|
|
||||||
void gst_vc1_bitplanes_free (GstVC1BitPlanes *bitplanes);
|
void gst_vc1_bitplanes_free (GstVC1BitPlanes *bitplanes);
|
||||||
|
|
Loading…
Reference in a new issue