sequence-layer is serialized in little-endian byte order except for
STRUCT_C which is serialized in big-endian byte order.
But since STRUCT_A and STRUCT_B fields are defined as unsigned int msb
first, we have to pass them as big-endian to their parsing function. So
we basically use temporary buffers to convert them in big-endian.
See SMPTE 421M Annex J and L.
https://bugzilla.gnome.org/show_bug.cgi?id=736871
Fix parsing of residual bytes. This is a two-step process. First,
remaining colums of full vertical resolution (<height>) need to be
processed. Next, remaining bytes in the first row can be processed,
while taking into account the fact that we may have filled in the
first columns already. So, this is not full horizontal resolution.
The following figure helps in understanding the expected order of
operations, for a 8x5 MBs bitplane.
5 5 6 6 6 6 6 6
5 5 1 1 1 2 2 2
5 5 1 1 1 2 2 2
5 5 3 3 3 4 4 4
5 5 3 3 3 4 4 4
So, after tiles 1 to 4 are decoded, vertical tile 5 needs to be
processed (2x5 MBs) and then the horizontal tile 6 (6x1 MBs).
https://bugzilla.gnome.org/show_bug.cgi?id=692461
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Fix decoding of DIFF6 or NORM6 bitplanes with an odd number of lines
(3x2 "horizontal" tiles). In this case, we have to skip the first line
of macroblocks but <width> number of bytes was used to do so, instead
of the actual <stride> size.
This fixes decoding for the video sample attached to:
https://bugzilla.gnome.org/show_bug.cgi?id=668565https://bugzilla.gnome.org/show_bug.cgi?id=692461
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
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>
Fix decoding of DIFF2 or NORM2 bitplanes with an odd number of macroblocks.
In particular, account for the first bit that was already parsed so that to
avoid a buffer overflow after all pairs are parsed.
This fixes SA00040.vc1 conformance test.
https://bugzilla.gnome.org/show_bug.cgi?id=692312
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Rename dqsbedge to dqbedge. The intent is that we can only have a single
boundary edge selector, depending on the value of dqprofile. So, dqbedge
represents DQSBEDGE if dqprofile == GST_VC1_DQPROFILE_SINGLE_EDGE, or
DQDBEDGE if dqprofile == GST_VC1_DQPROFILE_DOUBLE_EDGE.
The former dqbedge field is marked as unused and can be removed on the
next gst-plugins-bad version that allows ABI changes.
https://bugzilla.gnome.org/show_bug.cgi?id=692272
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Fix parsing of VOPDQUANT when DQUANT == 2. In particular, DQUANTFRM is
not present in the bitstream in this case and it shall be derived to
the default value of zero (7.1.1.31.1).
https://bugzilla.gnome.org/show_bug.cgi?id=692271
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Fix calculation of ALTPQUANT when DQUANT == 1. PQDIFF alters ALTPQUANT
in any case. See 7.1.1.31.6.
https://bugzilla.gnome.org/show_bug.cgi?id=692270
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Fix parse_vopdquant() to correctly parse DQPROFILE, which is 2 bits
instead of a single bit.
https://bugzilla.gnome.org/show_bug.cgi?id=692267
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Coverity found missing break in parse_frame_header_advanced() when
determining PTYPE from FPTYPE for interlaced streams.
https://bugzilla.gnome.org/show_bug.cgi?id=688626
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
ASPECT_HORIZ_SIZE and ASPECT_VERT_SIZE are syntax elements that hold
binary encodings of sizes ranging from 1 to 256. Thus, the calculated
pixel-aspect-ratio was off by one.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=683858
This always happens with GstByteReader/Writer and friends when
not taking into account returned boolean of the _read/_write functions
(which is actually wrong).
Make use of the *_unchecked variant as much as possible, or take the
returned value into account.
Const-ify one more VLC table. Fix spelling of 'hybrid'.
No need to explicitly call ensure_debug_category() everywhere,
that will be done automatically from GST_LOG() and friends
via GST_CAT_DEFAULT.
Instead of having a single VC1SequenceHeader structure, use the 3 structs
from the "Table 265: Sequence Layer Data Structure" of the specification
for the library to be more flexible.
Implement the functions to parse them