4 years agocodecparsers: h264: fix typo in GstH264VUIParams description.
Gwenole Beauchesne [Thu, 26 Jun 2014 15:18:47 +0000 (17:18 +0200)]
codecparsers: h264: fix typo in GstH264VUIParams description.

4 years agocodecparsers: h264: add support for Recovery Point SEI message.
Aurélien Zanelli [Fri, 31 Jan 2014 16:07:42 +0000 (17:07 +0100)]
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.

4 years agocodecparsers: h264: add nal_reader_skip_long() helper.
Gwenole Beauchesne [Tue, 25 Mar 2014 11:01:55 +0000 (12:01 +0100)]
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 <>
4 years agocodecparsers: vp8: move up built-in range decoder private data.
Gwenole Beauchesne [Thu, 26 Jun 2014 13:59:35 +0000 (15:59 +0200)]
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 <>
4 years agoAdd repository names to TAGS file.
Gwenole Beauchesne [Fri, 13 Jun 2014 09:00:07 +0000 (11:00 +0200)]
Add repository names to TAGS file.

4 years agoh264parse: use new gst_h264_video_calculate_framerate() to get framerate
Aurélien Zanelli [Mon, 19 May 2014 15:52:38 +0000 (17:52 +0200)]
h264parse: use new gst_h264_video_calculate_framerate() to get framerate

4 years agoh264parse: set field_pic_flag when parsing a slice header
Aurélien Zanelli [Mon, 19 May 2014 09:48:55 +0000 (11:48 +0200)]
h264parse: set field_pic_flag when parsing a slice header

field_pic_flag was used but never set to other value than its default

4 years agoImport h264parse from git master commit 36a2aca.
Gwenole Beauchesne [Mon, 28 Apr 2014 08:46:39 +0000 (10:46 +0200)]
Import h264parse from git master commit 36a2aca.

4 years agobytereader: Use concistant derefence method
Nicolas Dufresne [Tue, 10 Jun 2014 14:23:13 +0000 (10:23 -0400)]
bytereader: Use concistant derefence method

This is minor style fix to not mix *var and var[N].

4 years agobytereader: Use pointer instead of index access
Sungho Bae [Tue, 10 Jun 2014 13:35:38 +0000 (09:35 -0400)]
bytereader: Use pointer instead of index access

Currently the scan uses Boyer-moore method and its performance is good.
but, it can be optimized from an implementation of view.

The original scan code is implemented by byte array and index-based access.
In _scan_for_start_code(), the index is increasing from start to end and the
base address of the byte array is referred to as return value.

In the case, index-based access can be replaced by pointer access, which
improve the performance by removing index-related operations.

Its performace is enhanced by approximately 8% on arm-based embedded devices.
Although it seems trivial, it can affect the overall performance because the
_scan_for_start_code() function is very often called when H.264/H.265 video is

In addition, the technique can apply for all architectures and it is good in
view of readability and maintainability.

4 years agoImport GstBitReader and GstByteReader.
Gwenole Beauchesne [Fri, 23 May 2014 09:34:19 +0000 (11:34 +0200)]
Import GstBitReader and GstByteReader.

Import GstBitReader and GstByteReader utilities from GStreamer base
libraries, as of git master commit 683a6ee.

4 years agoUpdate to git master commit 402086a.
Gwenole Beauchesne [Fri, 13 Jun 2014 08:58:23 +0000 (10:58 +0200)]
Update to git master commit 402086a.

4 years agocodecparsers: h264: fix quantization matrix conversion routine names.
Gwenole Beauchesne [Wed, 11 Jun 2014 13:11:40 +0000 (15:11 +0200)]
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.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: add C++ guards for MPEG-4 and VP8 parsers.
Gwenole Beauchesne [Mon, 26 May 2014 16:29:21 +0000 (18:29 +0200)]
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++.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers_h264: add gst_h264_video_calculate_framerate()
Aurélien Zanelli [Mon, 19 May 2014 15:43:54 +0000 (17:43 +0200)]
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.

4 years agoUpdate to git master commit a66f2dc.
Gwenole Beauchesne [Mon, 28 Apr 2014 07:37:41 +0000 (09:37 +0200)]
Update to git master commit a66f2dc.

4 years agocodecparsers: h264: fix parsing of slice groups for map type = 2.
Gwenole Beauchesne [Sun, 27 Apr 2014 21:29:41 +0000 (23:29 +0200)]
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 <>
4 years agoUpdate to git master commit 1b9e8a2.
Gwenole Beauchesne [Sat, 26 Apr 2014 20:30:51 +0000 (22:30 +0200)]
Update to git master commit 1b9e8a2.

4 years agocodecparsers: h264: fix derivation of default scaling lists.
Gwenole Beauchesne [Sat, 26 Apr 2014 06:08:57 +0000 (08:08 +0200)]
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 ( 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.

Signed-off-by: Gwenole Beauchesne <>
4 years agoFix build with built-in headers and libraries.
Gwenole Beauchesne [Fri, 18 Apr 2014 16:59:09 +0000 (18:59 +0200)]
Fix build with built-in headers and libraries.

4 years agoUpdate to git master commit abadffd.
Gwenole Beauchesne [Fri, 18 Apr 2014 16:56:24 +0000 (18:56 +0200)]
Update to git master commit abadffd.

4 years agotests: add test for VP8 bitstream parsing library.
Zhao, Halley [Tue, 7 Jan 2014 18:49:00 +0000 (02:49 +0800)]
tests: add test for VP8 bitstream parsing library.

[updated to new parser API]
Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: vp8: rename dboolhuff symbols.
Sebastian Dröge [Wed, 9 Apr 2014 07:22:02 +0000 (09:22 +0200)]
codecparsers: vp8: rename dboolhuff symbols.

Rename VP8 dboolhuff symbols so that to avoid clashes with libvpx when
static linking.

4 years agocodecparsers: vp8: add GStreamer native utilities.
Gwenole Beauchesne [Tue, 8 Apr 2014 08:30:09 +0000 (10:30 +0200)]
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 <>
4 years agocodecparsers: add VP8 bitstream parser.
Zhao, Halley [Tue, 7 Jan 2014 18:49:00 +0000 (02:49 +0800)]
codecparsers: add VP8 bitstream parser.

[refactored, among other fixes]
Signed-off-by: Gwenole Beauchesne <>
4 years agoh264parse: Set framerate even for interlaced videos
Thibault Saunier [Mon, 17 Mar 2014 15:39:42 +0000 (16:39 +0100)]
h264parse: Set framerate even for interlaced videos

Co-Authored by: Mathieu Duponchelle <>

4 years agoUpdate to git master commit e84b0d6.
Gwenole Beauchesne [Tue, 25 Mar 2014 14:56:34 +0000 (15:56 +0100)]
Update to git master commit e84b0d6.

4 years agocodecparsers: cosmetics: drop TAB characters.
Gwenole Beauchesne [Tue, 25 Mar 2014 14:04:14 +0000 (15:04 +0100)]
codecparsers: cosmetics: drop TAB characters.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: h264: fix slice_header() parsing for MVC.
Li Xiaowei [Fri, 8 Mar 2013 01:57:22 +0000 (09:57 +0800)]
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.

Signed-off-by: Li Xiaowei <>
Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: h264: add gst_h264_parse_nalu_header() helper.
Gwenole Beauchesne [Mon, 1 Oct 2012 07:48:06 +0000 (09:48 +0200)]
codecparsers: h264: add gst_h264_parse_nalu_header() helper.

Add helper to parse the NALU header. Move bounds checking to there.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: h264: add gst_h264_parse_sps_data() helper.
Gwenole Beauchesne [Mon, 1 Oct 2012 07:37:21 +0000 (09:37 +0200)]
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.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: h264: complete set of NAL unit types.
Gwenole Beauchesne [Wed, 26 Sep 2012 16:46:36 +0000 (18:46 +0200)]
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 <>
4 years agocodecparsers: h264: clean-up gst_h264_parser_parse_sei_message().
Gwenole Beauchesne [Mon, 24 Mar 2014 18:27:44 +0000 (19:27 +0100)]
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 <>
4 years agocodecparsers: h264: fix skipping of unsupported SEI messages.
Gwenole Beauchesne [Fri, 21 Mar 2014 16:07:19 +0000 (17:07 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: h264: fix SEI buffering_period() parsing.
Gwenole Beauchesne [Fri, 21 Mar 2014 16:03:36 +0000 (17:03 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
4 years agocodecparsers: h264: fix rbsp_more_data() implementation.
Gwenole Beauchesne [Wed, 10 Oct 2012 14:19:49 +0000 (16:19 +0200)]
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()

Signed-off-by: Gwenole Beauchesne <>
4 years agoUpdate to git master commit 05cb4bc.
Gwenole Beauchesne [Fri, 21 Mar 2014 13:50:50 +0000 (14:50 +0100)]
Update to git master commit 05cb4bc.

4 years agocodecparsers: Don't use gst_ as prefix for private symbols
Edward Hervey [Wed, 29 Jan 2014 09:50:40 +0000 (10:50 +0100)]
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

4 years agocodecparsers: refactor common nal parsing to nalutils
Thiago Santos [Fri, 24 Jan 2014 04:07:45 +0000 (01:07 -0300)]
codecparsers: refactor common nal parsing to nalutils

Moves common code from h264 and h265 to a separate file

4 years agoh264parse: Fix multiple SEI messages in one SEI RBSP parsing.
Aurélien Zanelli [Fri, 3 Jan 2014 08:44:28 +0000 (09:44 +0100)]
h264parse: Fix multiple SEI messages in one SEI RBSP parsing.

An SEI RBSP could contains more than one SEI message as specified in

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

4 years agoh265parser: remove trailling 0x00 bytes as the spec doesn't allow them
Thiago Santos [Wed, 22 Jan 2014 13:26:32 +0000 (10:26 -0300)]
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

4 years agoh264parser: remove trailling 0x00 bytes as the spec doesn't allow them
Thiago Santos [Mon, 20 Jan 2014 20:24:54 +0000 (17:24 -0300)]
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

So our parser should strip any trailling 0x00.

4 years agoh265parser: Initialize pointer correctly that is never assigned but freed in error...
duhui.lee [Tue, 21 Jan 2014 01:58:35 +0000 (10:58 +0900)]
h265parser: Initialize pointer correctly that is never assigned but freed in error cases

Fixes crash on broken streams.

4 years agoh265parser: Fix segfault when parsing HRD parameter
duhui.lee [Mon, 20 Jan 2014 08:03:09 +0000 (17:03 +0900)]
h265parser: Fix segfault when parsing HRD parameter

4 years agoh265parser: Fix segfault when parsing VPS
duhui.lee [Tue, 14 Jan 2014 14:21:25 +0000 (23:21 +0900)]
h265parser: Fix segfault when parsing VPS

4 years agoh265parser: prevent to overrun chroma_weight_l0_flag
Justin Joy [Mon, 13 Jan 2014 12:50:16 +0000 (21:50 +0900)]
h265parser: prevent to overrun chroma_weight_l0_flag

The index of elements cannot exceed or equal to the size of elements.

4 years agoh265parser: Fix debug output
Sebastian Dröge [Mon, 6 Jan 2014 13:47:43 +0000 (14:47 +0100)]
h265parser: Fix debug output

4 years agompegvideoparse: Fix documentation of GstMpegVideoSequenceScalableMode
Luis de Bethencourt [Wed, 18 Dec 2013 21:26:17 +0000 (16:26 -0500)]
mpegvideoparse: Fix documentation of GstMpegVideoSequenceScalableMode

4 years agoh264parser: not all startcodes should have 3-byte 0 prefix
Matej Knopp [Thu, 12 Dec 2013 16:49:24 +0000 (17:49 +0100)]
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

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.

4 years agocodecparsers: h264: fix picture level scaling lists derivation (rule B).
Cong Zhong [Wed, 17 Apr 2013 02:44:48 +0000 (10:44 +0800)]
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 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.

Signed-off-by: Gwenole Beauchesne <>
4 years agoUpdate to git master commit ffeb719.
Gwenole Beauchesne [Mon, 9 Dec 2013 10:36:50 +0000 (11:36 +0100)]
Update to git master commit ffeb719.

4 years agompegvideoparser: Also initialize debug category in parse_sequence_header
Olivier Crête [Wed, 4 Dec 2013 22:31:27 +0000 (17:31 -0500)]
mpegvideoparser: Also initialize debug category in parse_sequence_header

Also remove the useless initialized flag, this is already done by the macro

4 years agocodecparsers: Add -lm needed by H.265 parser
Reynaldo H. Verdejo Pinochet [Wed, 13 Nov 2013 21:59:48 +0000 (18:59 -0300)]
codecparsers: Add -lm needed by H.265 parser

4 years agocodecparsers: Fix bad condition in h264 parser
Aurélien Zanelli [Thu, 7 Nov 2013 13:39:26 +0000 (14:39 +0100)]
codecparsers: Fix bad condition in h264 parser

4 years agocodecparsers: Remove some unused functions
Sebastian Dröge [Thu, 7 Nov 2013 08:54:40 +0000 (09:54 +0100)]
codecparsers: Remove some unused functions

4 years agocodecparsers: add H.265 HEVC bitstream parser
Sreerenj Balachandran [Tue, 1 Oct 2013 10:39:41 +0000 (13:39 +0300)]
codecparsers: add H.265 HEVC bitstream parser

4 years agocodecparsers: h264: store quantization matrices in zig-zag order
Sreerenj Balachandran [Tue, 20 Aug 2013 14:03:38 +0000 (17:03 +0300)]
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.

4 years agocodecparsers: h264: add helpers to convert quantization matrices
Sreerenj Balachandran [Wed, 2 Oct 2013 08:24:58 +0000 (11:24 +0300)]
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

4 years agocodecparsers: mpegvideoparse: turn internal consistency check into a g_assert()
Tim-Philipp Müller [Tue, 13 Aug 2013 16:47:14 +0000 (17:47 +0100)]
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.

4 years agocodecparsers: mpegvideoparser: minor doc fixes
Tim-Philipp Müller [Tue, 13 Aug 2013 16:45:51 +0000 (17:45 +0100)]
codecparsers: mpegvideoparser: minor doc fixes

4 years agoall: Fix for GST_DISABLE_GST_DEBUG
Edward Hervey [Mon, 29 Jul 2013 07:35:08 +0000 (09:35 +0200)]

Where applicable, remove methods that don't do anything different than
the default implementation.

4 years agocodecparser: Make warnings more meaningful
Edward Hervey [Wed, 24 Jul 2013 15:49:59 +0000 (17:49 +0200)]
codecparser: Make warnings more meaningful

By stating whether we don't have enough data or it's a corrupted

4 years agocodecparsers: h264: fix calculation of the frame cropping rectangle.
Gwenole Beauchesne [Mon, 8 Jul 2013 16:44:24 +0000 (18:44 +0200)]
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 <>
4 years agoh264parser: Parse the cropping-rectangle separately.
Sreerenj Balachandran [Fri, 15 Feb 2013 12:18:49 +0000 (14:18 +0200)]
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.

5 years agoUpdate to git master commit 5ad6f2d.
Gwenole Beauchesne [Fri, 5 Jul 2013 17:01:21 +0000 (19:01 +0200)]
Update to git master commit 5ad6f2d.

5 years agocodecparsers: mpeg2: fix video packet header size checks.
Gwenole Beauchesne [Fri, 5 Jul 2013 16:33:42 +0000 (18:33 +0200)]
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.

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: mpeg2: update test program with new GstMpegVideoPacket API.
Gwenole Beauchesne [Thu, 31 Jan 2013 10:57:54 +0000 (11:57 +0100)]
codecparsers: mpeg2: update test program with new GstMpegVideoPacket API.

This is the lost hunk from:

Signed-off-by: Gwenole Beauchesne <>
5 years agoUpdate to git master commit 9a2ed78.
Gwenole Beauchesne [Fri, 5 Jul 2013 15:43:56 +0000 (17:43 +0200)]
Update to git master commit 9a2ed78.

5 years agocodecparsers: mpeg2: add slice header parsing API.
Sreerenj Balachandran [Wed, 30 Jan 2013 14:56:15 +0000 (16:56 +0200)]
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.

Signed-off-by: Sreerenj Balachandran <>
Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: mpeg2: add sequence scalable extension parsing API.
Sreerenj Balachandran [Fri, 25 Jan 2013 13:48:58 +0000 (15:48 +0200)]
codecparsers: mpeg2: add sequence scalable extension parsing API.

Add API to parse the Sequence Scalable Extension header.

Signed-off-by: Sreerenj Balachandran <>
Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: mpeg2: add new API that takes GstMpegVideoPacket arguments.
Gwenole Beauchesne [Thu, 31 Jan 2013 10:57:54 +0000 (11:57 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
5 years agoh264parser: Fix the return value type for the SEI palyload parsing methods.
Sreerenj Balachandran [Fri, 8 Mar 2013 23:49:23 +0000 (01:49 +0200)]
h264parser: Fix the return value type for the SEI palyload parsing methods.

The return value type of SEI payload parsing functions
are GstH264ParserResult.

5 years agocodecparsers: Fix gtk-doc
Edward Hervey [Sat, 22 Jun 2013 06:57:12 +0000 (08:57 +0200)]
codecparsers: Fix gtk-doc

Detected by initial pre-run of gi-scanner.

5 years agoDrop GstMpegVideoMeta.
Gwenole Beauchesne [Fri, 14 Jun 2013 08:22:21 +0000 (10:22 +0200)]
Drop GstMpegVideoMeta.

Drop GstMpegVideoMeta as this is out-of-scope for this project, which
is only about using the most recent bitstream parsers.

5 years agoUpdate to git master commit a5402d6.
Gwenole Beauchesne [Fri, 14 Jun 2013 08:21:51 +0000 (10:21 +0200)]
Update to git master commit a5402d6.

5 years agompegvideoparser: Fix the pixel-aspect-ratio calculation
Sreerenj Balachandran [Wed, 5 Jun 2013 13:16:36 +0000 (16:16 +0300)]
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 <>"

5 years agocodecparsers: Actually store mpeg video bitrate value
Edward Hervey [Wed, 1 May 2013 14:37:54 +0000 (16:37 +0200)]
codecparsers: Actually store mpeg video bitrate value

And use the extension also (higher 12 bits)

5 years agocodecparsers: ensure the debug category is properly initialized
Thiago Santos [Fri, 21 Dec 2012 18:37:45 +0000 (15:37 -0300)]
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.

5 years agompegvideometa: Fix typo in comment
Sreerenj Balachandran [Tue, 7 May 2013 11:22:10 +0000 (14:22 +0300)]
mpegvideometa: Fix typo in comment

5 years agodocs: add since markers to new codecparsers video meta API
Tim-Philipp Müller [Tue, 2 Apr 2013 22:33:54 +0000 (23:33 +0100)]
docs: add since markers to new codecparsers video meta API

5 years agocodecparsers: Add Mpeg Video GstMeta
Edward Hervey [Thu, 20 Sep 2012 16:03:59 +0000 (18:03 +0200)]
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).

5 years agocodecparser: Fix picture packet extension size check
Edward Hervey [Wed, 26 Dec 2012 12:16:27 +0000 (13:16 +0100)]
codecparser: Fix picture packet extension size check

It is at least 34 bit big (5 bytes with byte padding)

5 years agocodecparsers: Use correct type specifiers for format strings to fix compiler warnings
Sebastian Dröge [Sun, 3 Mar 2013 11:29:42 +0000 (12:29 +0100)]
codecparsers: Use correct type specifiers for format strings to fix compiler warnings

5 years agompegvideoparser: increase min size for picture coding ext
David Schleef [Tue, 12 Feb 2013 01:58:31 +0000 (17:58 -0800)]
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.

5 years agocodecparsers: h264: add profile enums.
Gwenole Beauchesne [Tue, 2 Oct 2012 09:02:32 +0000 (11:02 +0200)]
codecparsers: h264: add profile enums.

Add all useful profiles from AVC, MVC and SVC specifications.

Signed-off-by: Gwenole Beauchesne <>
5 years agoUpdate to git master commit 250555a.
Gwenole Beauchesne [Wed, 6 Feb 2013 14:17:40 +0000 (15:17 +0100)]
Update to git master commit 250555a.

5 years agocodecparsers: mpeg2: add helpers to convert quantization matrices.
Gwenole Beauchesne [Tue, 5 Feb 2013 10:56:46 +0000 (11:56 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: mpeg2: store quantization matrices in zigzag scan order.
Cong Zhong [Thu, 31 Jan 2013 08:13:22 +0000 (16:13 +0800)]
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.

Signed-off-by: Cong Zhong <>
Signed-off-by: Gwenole Beauchesne <>
5 years agoUpdate to git master commit 10639eb.
Gwenole Beauchesne [Fri, 25 Jan 2013 09:28:51 +0000 (10:28 +0100)]
Update to git master commit 10639eb.

5 years agocodecparsers: vc1: fix bitplanes decoding (DIFF6 or NORM6 residual bytes).
Gwenole Beauchesne [Thu, 24 Jan 2013 17:14:28 +0000 (18:14 +0100)]
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).

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: fix bitplanes decoding (DIFF6 or NORM6).
Gwenole Beauchesne [Thu, 24 Jan 2013 16:28:22 +0000 (17:28 +0100)]
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:

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: add API to parse slice headers.
Gwenole Beauchesne [Wed, 23 Jan 2013 13:47:58 +0000 (14:47 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: fix bitplanes decoding.
Gwenole Beauchesne [Tue, 22 Jan 2013 17:01:24 +0000 (18:01 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: simplify GstVC1VopDquant structure.
Gwenole Beauchesne [Tue, 22 Jan 2013 10:42:49 +0000 (11:42 +0100)]
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

The former dqbedge field is marked as unused and can be removed on the
next gst-plugins-bad version that allows ABI changes.

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: fix VOPDQUANT parser for DQUANT == 2.
Gwenole Beauchesne [Tue, 22 Jan 2013 09:48:39 +0000 (10:48 +0100)]
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 (

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: fix calculation of ALTPQUANT.
Gwenole Beauchesne [Tue, 22 Jan 2013 09:38:20 +0000 (10:38 +0100)]
codecparsers: vc1: fix calculation of ALTPQUANT.

Fix calculation of ALTPQUANT when DQUANT == 1. PQDIFF alters ALTPQUANT
in any case. See

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: vc1: fix parser for DQPROFILE in VOPDQUANT.
Gwenole Beauchesne [Tue, 22 Jan 2013 09:11:34 +0000 (10:11 +0100)]
codecparsers: vc1: fix parser for DQPROFILE in VOPDQUANT.

Fix parse_vopdquant() to correctly parse DQPROFILE, which is 2 bits
instead of a single bit.

Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: h264: add inferred value for slice_beta_offset_div2.
Gwenole Beauchesne [Sun, 6 Jan 2013 17:54:52 +0000 (18:54 +0100)]
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.

Signed-off-by: Gwenole Beauchesne <>
5 years agoUpdate to git master commit 49fefbd.
Gwenole Beauchesne [Thu, 17 Jan 2013 14:43:49 +0000 (15:43 +0100)]
Update to git master commit 49fefbd.

5 years agocodecparsers: h264: zero-initialize SPS VUI parameters
Mark Nauwelaerts [Sat, 12 Jan 2013 12:15:02 +0000 (13:15 +0100)]
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.