Commit graph

246 commits

Author SHA1 Message Date
Gwenole Beauchesne
a61b7728b4 codecparsers: h264: clarifications and documentation fixes.
Fix documentation for GstH264NalUnit. The @ref_idc part was totally
unbalanced. Also add a note about @offset and @size fields to remind
that this is relative to the start of the NAL unit, thus including
the header bytes.
2014-07-01 16:26:48 +02:00
Gwenole Beauchesne
22b68b60ec codecparsers: h264: fix identification of EOSEQ and EOS NALs.
An end_of_seq() [EOSEQ] or end_of_stream() [EOS] NAL unit is really
one byte long because this shall include the NalHeaderBytes (1) too.
The NALU.offset starts from the first byte of the header.

This is the proper fix to commit d37f842. In practice, this fixes
parsing of FRExt1_Panasonic_D and FRExt2_Panasonic_C, that include
additional frames after an EOSEQ.

https://bugzilla.gnome.org/show_bug.cgi?id=732553

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-01 16:26:48 +02:00
Gwenole Beauchesne
9bd186a960 codecparsers: h264: fix memory leak in GstH264PPS.
The gst_h264_parse_pps() function dynamically allocates the slice
group ids map array, so that needs to be cleared before parsing a
new PPS NAL unit again, or when it is no longer needed.

Likewise, a clean copy to the internal NAL parser state needs to be
performed so that to avoid a double-free corruption.

https://bugzilla.gnome.org/show_bug.cgi?id=707282

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-27 14:00:10 +02:00
Gwenole Beauchesne
b458a1e255 codecparsers: h264: fix typo in GstH264VUIParams description. 2014-06-26 17:22:26 +02:00
Aurélien Zanelli
67df207280 codecparsers: h264: add support for Recovery Point SEI message.
The recovery point SEI message helps a decoder in determining if the
decoding process would produce acceptable pictures for display after
the decoder initiates random access or after the encoder indicates
a broken link in the coded video sequence.

This is not used in the h264parse element, but it could help debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=723380
2014-06-26 17:22:26 +02:00
Gwenole Beauchesne
0440cabf49 codecparsers: h264: add nal_reader_skip_long() helper.
Add nal_reader_skip_long() helper function to allow an arbitrary number
of bits to be skipped. The former nal_reader_skip() function is too
limited to the actual cache size.

Use this new function to simplify gst_h264_parser_parse_sei_message()
default case, that skips unsupported payloads.

v2: made args consistent from header to source file.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-26 17:22:26 +02:00
Gwenole Beauchesne
c46b63d44e codecparsers: vp8: move up built-in range decoder private data.
Use the first _gst_reserved[] slot to hold the built-in range decoder
private data. The first slot was formerly the buffer size, which was
then promoted to semi-public namespace when it got integrated as git
commit 2940ac6.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-26 16:04:54 +02:00
Gwenole Beauchesne
db887f05ca codecparsers: h264: fix quantization matrix conversion routine names.
Fix routine names for zigzag/raster scan order conversion routines for
quantization matrices. This ought to use the gst_h264_quant_matrix_*()
naming convention instead of gst_h264_video_quant_matrix_*(), which
derived from the MPEG-2 function names.

https://bugzilla.gnome.org/show_bug.cgi?id=731524

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-12 10:26:26 +02:00
Gwenole Beauchesne
5196f24138 codecparsers: add C++ guards for MPEG-4 and VP8 parsers.
Fix MPEG-4 and VP8 APIs to export their external symbols as pure C
symbols, i.e. un-mangled for C++.

https://bugzilla.gnome.org/show_bug.cgi?id=731522

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-12 10:25:54 +02:00
Nicolas Dufresne
9cdafffe7f Revert "h264parser: Remove unused fps_num/fps_den fields"
This breaks the build since mss has not been ported.

This reverts commit aeb6a52074.
2014-05-22 13:03:33 -04:00
Sebastian Dröge
aeb6a52074 h264parser: Remove unused fps_num/fps_den fields
Instead the newly added function should be used to calculate
the framerate properly.
2014-05-22 16:12:36 +02:00
Aurélien Zanelli
753701bf68 codecparsers_h264: add gst_h264_video_calculate_framerate()
Add a new function to calculate video stream framerate which rely on
SPS, slice header and pic timing using formula:

         time_scale                1                         1
fps = -----------------  x  ---------------  x  ------------------------
      num_units_in_tick     DeltaTfiDivisor     (field_pic_flag ? 2 : 1)

See section E2.1 of H264 specification for definition of variables.

https://bugzilla.gnome.org/show_bug.cgi?id=723352
2014-05-22 16:12:35 +02:00
Gwenole Beauchesne
a66f2dca60 codecparsers: h264: fix parsing of slice groups for map type = 2.
When parsing slice groups information for slice_group_map_type = 2, we
should only be reading up to num_slice_groups_minus1 groups since there
is always a "leftover" slice group and as many "foreground" slice groups
as needed.

This fixes parsing for SVCBMT-5 and SVCBMT-12 whereby the base layer would
have incorrectly been parsed to have up to 38 reference frames in list0,
which is not possible.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-27 23:41:19 +02:00
Gwenole Beauchesne
1b9e8a25a0 codecparsers: h264: fix derivation of default scaling lists.
When useDefaultScalingMatrixFlag is computed to be 1 while parsing
scaling_list(), then the scaling list shall be inferred to be equal
to the default list (7.4.2.1.1.1). That default list is really one
of Default_4x4_{Intra,Inter} or Default_8x8_{Intra,Inter} and not
one from fall-back rule sets A or B.

This fixes parsing for FRExt1_Panasonic_D, FRExt2_Panasonic_C,
FRExt3_Panasonic_E and FRExt4_Panasonic_B.

https://bugzilla.gnome.org/show_bug.cgi?id=724518

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-26 22:24:45 +02:00
Sebastian Dröge
cea860021d codecparsers: vp8: rename dboolhuff symbols.
Rename VP8 dboolhuff symbols so that to avoid clashes with libvpx when
static linking.
2014-04-18 16:32:40 +02:00
Gwenole Beauchesne
e2aaa91c5a codecparsers: vp8: add GStreamer native utilities.
Import libvpx 1.3.0 range decoder files (dboolhuff.[ch]) to implement
the VP8 utilities native interface. Likewise, copy and use the default
libvpx generated entropy probabilities tables.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-18 16:32:40 +02:00
Zhao, Halley
3da5a54399 codecparsers: add VP8 bitstream parser.
https://bugzilla.gnome.org/show_bug.cgi?id=722760

[refactored, among other fixes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-18 16:32:40 +02:00
Thibault Saunier
15d00a32fd h264parse: Set framerate even for interlaced videos
Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>

https://bugzilla.gnome.org/show_bug.cgi?id=726752
2014-04-10 09:09:38 +02:00
Gwenole Beauchesne
e84b0d626c codecparsers: cosmetics: drop TAB characters.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-25 15:48:40 +01:00
Li Xiaowei
24c1ae72d3 codecparsers: h264: fix slice_header() parsing for MVC.
The idr_pic_id syntax element depends on IdrPicFlag, which is a calculated
value that does not only depend on NAL unit type (IDR), but possibly also
on MVC non_idr_flag syntax element.

The computed idr_pic_flag is already stored in GstH264NalUnit structure.

https://bugzilla.gnome.org/show_bug.cgi?id=721772

Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 19:38:13 +01:00
Gwenole Beauchesne
8dc7ab49fe codecparsers: h264: add gst_h264_parse_nalu_header() helper.
Add helper to parse the NALU header. Move bounds checking to there.

https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 19:38:13 +01:00
Gwenole Beauchesne
e61ae7ffa2 codecparsers: h264: add gst_h264_parse_sps_data() helper.
Split seq_parameter_set_data() parsing off gst_h264_parse_sps() so
that it could be re-used later on.

https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 19:38:13 +01:00
Gwenole Beauchesne
bd4dceeff4 codecparsers: h264: complete set of NAL unit types.
Add missing NAL unit types. They are mostly related to alpha blending,
scalable video coding extensions (SVC, Annex.G), and multiview video
coding extensions (MVC, Annex.H).

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 19:38:13 +01:00
Gwenole Beauchesne
afff27651b codecparsers: h264: clean-up gst_h264_parser_parse_sei_message().
Fix build when GST_DISABLE_GST_DEBUG is not defined. Use a switch
statement to dispatch to the various SEI payload handlers.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 19:38:13 +01:00
Gwenole Beauchesne
1b42180817 codecparsers: h264: fix skipping of unsupported SEI messages.
The payloadSize does not account for emulation prevention bytes. So,
just use nal_reader_skip() for skipping payload_size bits. It should
be possible to further optimize this code since the NAL reader shall
be aligned to byte boundary already.

Kill the now unused nal_reader_skip_to_next_byte() function.

https://bugzilla.gnome.org/show_bug.cgi?id=726829

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 18:09:27 +01:00
Gwenole Beauchesne
aa73624638 codecparsers: h264: fix SEI buffering_period() parsing.
Fix parsing of buffering_period() SEI messages. The number of bits
used to express {nal,vcl}_initial_cpb_removal_delay{,_offset} syntax
elements is not 5 but 1 + initial_cpb_removal_delay_length_minus1.

https://bugzilla.gnome.org/show_bug.cgi?id=726828

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 18:09:27 +01:00
Gwenole Beauchesne
80a51a8fab codecparsers: h264: fix rbsp_more_data() implementation.
Account for trailing zero bits when checking for rbsp_more_data().

In particular, fix an hypothetical stream whereby rbsp_more_data()
is called in the following conditions for PPS header: NalReader
reached position 20, 12 bits are remaining and trailing data at
current byte position is c8 00.

rbsp_more_data() used to return TRUE whereas it should obviously
return FALSE because x8 00 represents a valid rbsp_trailing_bits()
structure.

https://bugzilla.gnome.org/show_bug.cgi?id=685890

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-03-24 18:09:27 +01:00
Edward Hervey
274387e8e9 codecparsers: Don't use gst_ as prefix for private symbols
Otherwise they get exposed/accessible in the resulting .so

And make check-exports will complain
2014-01-29 10:50:40 +01:00
Thiago Santos
61192a1619 codecparsers: refactor common nal parsing to nalutils
Moves common code from h264 and h265 to a separate file
2014-01-24 09:30:35 -03:00
Aurélien Zanelli
af78b45979 h264parse: Fix multiple SEI messages in one SEI RBSP parsing.
An SEI RBSP could contains more than one SEI message as specified in
7.4.2.3.1.

This commit change the parser API: the gst_h264_parser_parse_sei()
function now create and fill a GArray containing GstH264SEIMessage.

https://bugzilla.gnome.org/show_bug.cgi?id=721715
2014-01-23 20:18:53 +01:00
Thiago Santos
24c87b18c2 h265parser: remove trailling 0x00 bytes as the spec doesn't allow them
Just like h264, the spec doesn't allow the last bytes of a NAL to be 0x00.
So remove it as it is probably just padding.

This is related to https://bugzilla.gnome.org/show_bug.cgi?id=721384
2014-01-22 10:27:01 -03:00
Thiago Santos
4f0fc9a16f h264parser: remove trailling 0x00 bytes as the spec doesn't allow them
The spec states that the last byte of a NAL 'shall not' be 0x00
and it is allowed for byte-stream format to add padding 0x00 for
alignment.

So our parser should strip any trailling 0x00.

https://bugzilla.gnome.org/show_bug.cgi?id=721384
2014-01-22 08:36:30 -03:00
duhui.lee
686c2f8e79 h265parser: Initialize pointer correctly that is never assigned but freed in error cases
Fixes crash on broken streams.

https://bugzilla.gnome.org/show_bug.cgi?id=722669
2014-01-21 09:58:18 +01:00
duhui.lee
13a397a0b9 h265parser: Fix segfault when parsing HRD parameter
https://bugzilla.gnome.org/show_bug.cgi?id=722240
2014-01-20 10:04:23 +01:00
duhui.lee
a8151d78fc h265parser: Fix segfault when parsing VPS
https://bugzilla.gnome.org/show_bug.cgi?id=722081
2014-01-14 16:26:51 +01:00
Justin Joy
6587e924f1 h265parser: prevent to overrun chroma_weight_l0_flag
The index of elements cannot exceed or equal to the size of elements.

https://bugzilla.gnome.org/show_bug.cgi?id=722101
2014-01-13 15:04:52 +01:00
Sebastian Dröge
bacef9cbc4 h265parser: Fix debug output 2014-01-06 14:47:43 +01:00
Luis de Bethencourt
692a053ef8 mpegvideoparse: Fix documentation of GstMpegVideoSequenceScalableMode 2013-12-18 16:26:17 -05:00
Matej Knopp
6af387cd5a h264parser: not all startcodes should have 3-byte 0 prefix
The parser assumes that every time there is a 0 before the startcode,
it is part of the startcode. But that's not true.

From the specification

Byte stream NAL unit syntax
zero_byte is a single byte equal to 0x00.
  When any of the following conditions are fulfilled, the zero_byte syntax
  element shall be present.
  – the nal_unit_type within the nal_unit( ) is equal to 7 (sequence parameter
    set) or 8 (picture parameter set)
  – the byte stream NAL unit syntax structure contains the first NAL unit of an
    access unit in decoding order, as specified by subclause 7.4.1.2.3.

The problem with doing this for all startcodes is that a trailing zero can mess
up timestamps. The trailing zero gets prepended to the startcode, which will
carry the PTS and DTS of previous buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=664443
2013-12-14 12:17:40 +01:00
Cong Zhong
631d5d94ed codecparsers: h264: fix picture level scaling lists derivation (rule B).
Fix picture level scaling lists derivation from fall-back rule set B,
as specified in 7.4.2.2. More precisely, the sequence level scaling
lists need to be used but intra and inter lists arguments were swapped.

This fixes FRExt/freh5.264 from conformance testing.

https://bugzilla.gnome.org/show_bug.cgi?id=720099

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-12-10 10:32:43 +01:00
Olivier Crête
a167173063 mpegvideoparser: Also initialize debug category in parse_sequence_header
Also remove the useless initialized flag, this is already done by the macro

https://bugzilla.gnome.org/show_bug.cgi?id=719657
2013-12-04 17:55:05 -05:00
Reynaldo H. Verdejo Pinochet
b4f29e6945 codecparsers: Add -lm needed by H.265 parser 2013-11-13 19:51:12 -03:00
Aurélien Zanelli
660979bbf2 codecparsers: Fix bad condition in h264 parser
https://bugzilla.gnome.org/show_bug.cgi?id=711615
2013-11-07 18:48:22 +01:00
Sebastian Dröge
2b348161ed codecparsers: Remove some unused functions 2013-11-07 09:54:40 +01:00
Sreerenj Balachandran
33451e0791 codecparsers: add H.265 HEVC bitstream parser
https://bugzilla.gnome.org/show_bug.cgi?id=708438
2013-11-06 23:14:22 +00:00
Sreerenj Balachandran
e943f56bf8 codecparsers: h264: store quantization matrices in zig-zag order
Quantizer matrices are encoded in zigzag scan order in the bitstream,
so always parse it as it is.

https://bugzilla.gnome.org/show_bug.cgi?id=708629
2013-10-02 10:59:10 +02:00
Sreerenj Balachandran
8c9eaf0dc9 codecparsers: h264: add helpers to convert quantization matrices
Add utility functions to convert quantization matrices from zig-zag scan
order into raster scan order and vice-versa

https://bugzilla.gnome.org/show_bug.cgi?id=708629
2013-10-02 10:57:54 +02:00
Tim-Philipp Müller
0bd6f374c8 codecparsers: mpegvideoparse: turn internal consistency check into a g_assert()
We only check input from the API user with g_return_*_if_fail().
Internal sanity checks should use g_assert() instead, which is
disabled by default for releases.
2013-08-13 17:53:33 +01:00
Tim-Philipp Müller
4200946cf1 codecparsers: mpegvideoparser: minor doc fixes 2013-08-13 17:53:29 +01:00
Edward Hervey
97426a1caa all: Fix for GST_DISABLE_GST_DEBUG
Where applicable, remove methods that don't do anything different than
the default implementation.
2013-07-29 09:42:12 +02:00
Edward Hervey
3b6825a546 codecparser: Make warnings more meaningful
By stating whether we don't have enough data or it's a corrupted
packet
2013-07-26 06:46:41 +02:00
Gwenole Beauchesne
ac9c1ae5a8 codecparsers: h264: fix calculation of the frame cropping rectangle.
Fix calculation of the frame cropping rectangle, and more precisely
the actual cropped height. The frame_crop_top_offset subtraction
was not scaled up with SubHeightC.

Also clean-up variables to align more with (7-18) to (7-21).

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-09 12:15:07 +02:00
Sreerenj Balachandran
529ece338f h264parser: Parse the cropping-rectangle separately.
Assign the un-cropped width/height to sps->width/sps->height
during sps header parsing. Added new fields to SPS header structure
to provide the crop-rectangle dimensions.

https://bugzilla.gnome.org/show_bug.cgi?id=694068
2013-07-09 12:15:07 +02:00
Gwenole Beauchesne
5ad6f2d4a0 codecparsers: mpeg2: fix video packet header size checks.
Fix video packet header size checks for:
- Sequence Header: 64 bits ;
- Sequence Scalable Extension: 10 bits ;
- Slice Header: 6 bits.

https://bugzilla.gnome.org/show_bug.cgi?id=703668

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-05 18:58:20 +02:00
Sreerenj Balachandran
9a2ed78532 codecparsers: mpeg2: add slice header parsing API.
Add API to parse the Slice header. This also calculates the macroblock
position as specified in 6.3.16.

https://bugzilla.gnome.org/show_bug.cgi?id=664274

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-05 17:39:28 +02:00
Sreerenj Balachandran
2adfbe36f1 codecparsers: mpeg2: add sequence scalable extension parsing API.
Add API to parse the Sequence Scalable Extension header.

https://bugzilla.gnome.org/show_bug.cgi?id=664274

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-05 17:39:28 +02:00
Gwenole Beauchesne
1a5265ef72 codecparsers: mpeg2: add new API that takes GstMpegVideoPacket arguments.
Add new interface to MPEG-2 video parser that takes GstMpegVideoPacket
arguments instead of data, size, and offset. New functions are called
after gst_mpeg_video_packet_*() and provide the default implementation.

Older API is moved to the deprecated namespace and uses the new functions.

https://bugzilla.gnome.org/show_bug.cgi?id=692933

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-05 17:37:34 +02:00
Sreerenj Balachandran
65758debf1 h264parser: Fix the return value type for the SEI palyload parsing methods.
The return value type of SEI payload parsing functions
are GstH264ParserResult.

https://bugzilla.gnome.org/show_bug.cgi?id=695475
2013-07-01 11:24:17 +02:00
Edward Hervey
b00192d7c0 codecparsers: Fix gtk-doc
Detected by initial pre-run of gi-scanner.
2013-06-23 11:46:01 +02:00
Sreerenj Balachandran
0a496f4167 mpegvideoparser: Fix the pixel-aspect-ratio calculation
Ignore the display_extension values if they are greater than the width/height
values provided by seqhdr and calculate the PAR based on the seqhdr values.T
his is what DVD players are doing.

Thanks to "David Schleef <ds@schleef.org>"

https://bugzilla.gnome.org/show_bug.cgi?id=685103
2013-06-06 14:32:45 +02:00
Edward Hervey
f7893fb63e codecparsers: Actually store mpeg video bitrate value
And use the extension also (higher 12 bits)
2013-05-23 14:59:33 +02:00
Thiago Santos
529b248a89 codecparsers: ensure the debug category is properly initialized
The user of the library might not need to create a NalParser, so
the debug category needs to be initialized from other functions
as well if required.
2013-05-07 21:05:10 -03:00
Sreerenj Balachandran
0511a6b032 mpegvideometa: Fix typo in comment
https://bugzilla.gnome.org/show_bug.cgi?id=699827
2013-05-07 14:52:50 +02:00
Tim-Philipp Müller
3f228f3dfc docs: add since markers to new codecparsers video meta API
https://bugzilla.gnome.org/show_bug.cgi?id=691712
2013-04-02 23:34:19 +01:00
Edward Hervey
67ac84c7b5 codecparsers: Add Mpeg Video GstMeta
This can be used by parsers to provide pre-parsed information to
downstream elements that would require it (so they can avoid having
to parse the bitstream again).
2013-03-31 18:55:29 +02:00
Edward Hervey
3bb62cbf1d codecparser: Fix picture packet extension size check
It is at least 34 bit big (5 bytes with byte padding)
2013-03-31 12:18:32 +02:00
Sebastian Dröge
4bf50b6af0 codecparsers: Use correct type specifiers for format strings to fix compiler warnings 2013-03-03 12:29:42 +01:00
David Schleef
743098fe8c mpegvideoparser: increase min size for picture coding ext
This could use additional work.  The parsing code overruns the
end of buffers during normal operation, triggering GST_WARNINGs.
2013-02-11 18:02:23 -08:00
Gwenole Beauchesne
6e440f1da4 codecparsers: h264: add profile enums.
Add all useful profiles from AVC, MVC and SVC specifications.

https://bugzilla.gnome.org/show_bug.cgi?id=693140

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-02-07 14:38:27 +01:00
Gwenole Beauchesne
250555a7de codecparsers: mpeg2: add helpers to convert quantization matrices.
Add utility functions to convert quantization matrices from zigzag scan
order (as encoded in the bitstream) into raster scan order. Also provide
another function to reverse the operation.

https://bugzilla.gnome.org/show_bug.cgi?id=693000

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-02-06 14:22:41 +01:00
Cong Zhong
46c01de05d codecparsers: mpeg2: store quantization matrices in zigzag scan order.
Quantizer matrices are encoded in zigzag scan order in the bitstream,
but they are stored in raster scan order when they are parsed. However,
default matrices were also prepared in zigzag scan order, hence the
mismatch. i.e. the matrices were presented either in raster scan order
if they are explicitly present in the bitstream, or they were presented
in zigzag scan order if the default definitions were to be used instead.

One way to solve this problem is to always expose the quantization
matrices in zigzag scan order, since this is the role of the parser to
not build up stories from the source bitstream and just present what
is in there.

Utility functions will be provided to convert quantization matrices in
either scan order.

https://bugzilla.gnome.org/show_bug.cgi?id=693000

Signed-off-by: Cong Zhong <congx.zhong@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-02-06 14:22:41 +01:00
Gwenole Beauchesne
10639eb889 codecparsers: vc1: fix bitplanes decoding (DIFF6 or NORM6 residual bytes).
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>
2013-01-25 09:53:05 +01:00
Gwenole Beauchesne
fa2a526f04 codecparsers: vc1: fix bitplanes decoding (DIFF6 or NORM6).
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=668565

https://bugzilla.gnome.org/show_bug.cgi?id=692461

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-25 09:39:01 +01:00
Gwenole Beauchesne
07a51b16eb 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>
2013-01-23 17:22:07 +01:00
Gwenole Beauchesne
82200d75ae codecparsers: vc1: fix bitplanes decoding.
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>
2013-01-23 09:35:11 +01:00
Gwenole Beauchesne
cbec9bfcd0 codecparsers: vc1: simplify GstVC1VopDquant structure.
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>
2013-01-22 14:22:30 +01:00
Gwenole Beauchesne
93fbcfda23 codecparsers: vc1: fix VOPDQUANT parser for DQUANT == 2.
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>
2013-01-22 11:20:06 +01:00
Gwenole Beauchesne
73213e273f codecparsers: vc1: fix calculation of ALTPQUANT.
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>
2013-01-22 11:19:56 +01:00
Gwenole Beauchesne
f3698c6289 codecparsers: vc1: fix parser for DQPROFILE in VOPDQUANT.
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>
2013-01-22 11:19:44 +01:00
Gwenole Beauchesne
56e2405a35 codecparsers: h264: add inferred value for slice_beta_offset_div2.
The standard specifies that when slice_beta_offset_div2 is not present
in the slice header, then the value of slice_beta_offset_div2 shall be
inferred to be equal to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=692265

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-22 11:19:17 +01:00
Mark Nauwelaerts
c20d13d8f8 codecparsers: h264: zero-initialize SPS VUI parameters
... so all 'present' flags indicate no presence of optional parts
in case VUI parameters end up not being parsed.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=681818
2013-01-15 19:44:06 +01:00
Gwenole Beauchesne
e179a6b4dc codecparsers: vc1: fix PTYPE for interlaced frames.
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>
2012-11-19 13:57:48 +01:00
Gwenole Beauchesne
c951d201ec codecparsers: h264: fix error code for invalid size parsed in SPS.
gst_h264_parse_sps() returned FALSE if it parsed invalid (negative)
size components. Now make it gracefully return GST_H264_PARSER_ERROR
instead of GST_H264_PARSER_OK (FALSE).

https://bugzilla.gnome.org/show_bug.cgi?id=684568
2012-11-19 12:06:04 +00:00
Tim-Philipp Müller
9e1b75fda3 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:09:59 +00:00
Peter Seiderer
fd030c15b7 gsth264parser: fix Coverity found not initialized sps/pps valid member.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683264
2012-09-14 17:27:49 +02:00
Peter Seiderer
8a91eed6ad gsth264parser: fix Coverity detected off by one at call to READ_UE_ALLOWED.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683263
2012-09-14 17:27:49 +02:00
Arnaud Vrac
0331fb6203 mpeg4parser: parse complexity estimation header in video object layer
https://bugzilla.gnome.org/show_bug.cgi?id=683254
2012-09-14 09:14:26 +02:00
Arnaud Vrac
af379b0b8e mpeg4parser: fix some issues related to video object layer parsing
https://bugzilla.gnome.org/show_bug.cgi?id=683254
2012-09-14 09:14:24 +02:00
Jan Schmidt
c5c44628fc mpegvideoparse: Handle Sequence Display Extension
Change the way the pixel-aspect-ratio is computed by
interpreting the sequence header aspect ratio info
as MPEG-1 values until a sequence extension or
sequence display extension is seen, and then updating
the sequence header struct accordingly.

Fixes incorrect anamorphic display on some MPEG-2 (DVD)
sequences.
2012-09-12 23:05:47 -07:00
Gwenole Beauchesne
0b2dd2e723 codecparsers: vc1: fix aspect ratio calculation.
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
2012-09-12 10:44:10 +01:00
Gwenole Beauchesne
2c3eaf527b codecparsers: h264parse: don't use anonymous unions.
Anonymous union is an ISO C (2011) feature that is not exposed in
compilers strictly conforming to the previous standard.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-09-12 10:39:32 +01:00
Gwenole Beauchesne
a08273be72 codecparsers: h264: compute pixel aspect ratio.
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-09-12 10:38:46 +01:00
Tim-Philipp Müller
7d41bc7825 codecparsers: minor header indentation clean-up for mpegvideoparser 2012-07-11 00:10:55 +01:00
Vincent Penquerc'h
8800946aa3 h264parser: do not assert on data input, just return
https://bugzilla.gnome.org/show_bug.cgi?id=674069
2012-06-11 11:12:36 +01:00
Edward Hervey
7d4f1aa8e8 h264parser: Remove un-needed checks and inline some functions
val and nr always exist (&nr, &value)
bits is always called smaller than the width

Makes parsing 30% faster
2012-06-06 10:33:18 +02:00
Mark Nauwelaerts
8d6aed5297 codecparsers: mpeg: relax entry constraint
... since it is acceptable and properly handled further on.
2012-06-01 11:13:17 +02:00
Mark Nauwelaerts
28f3858b94 mpegvideoparse: tweak codec parser API and adjust parser element
... to allow for more efficient parsing and (more) consistent parsing API
among various codec parsers.

Fixes #672701.

Conflicts:

	gst/videoparsers/gstmpegvideoparse.c
2012-05-22 14:09:47 +02:00
Mark Nauwelaerts
29a947642e codecparsers: mpeg4: fixup documentation spelling 2012-05-22 14:00:50 +02:00
Nicolas Dufresne
920053dae6 mpegvideoparser: Optimize scanning for start code
https://bugzilla.gnome.org/show_bug.cgi?id=672701
2012-05-22 14:00:48 +02:00
Mark Nauwelaerts
e560ce0909 codecparsers: mpegvideoparser: fix buffer size check
... to mind unsigned integer wrap

Based on patch by Alban Browaeys <prahal@yahoo.com>

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=673436
2012-05-21 15:29:37 +02:00