Commit graph

390 commits

Author SHA1 Message Date
Tim-Philipp Müller
d9354b83bb codecparsers: mark symbols explicitly for export with GST_EXPORT 2017-07-18 12:46:57 +01:00
Tim-Philipp Müller
2db4ff751f codecparsers: h264: flesh out documentation for GST_H264_PARSER_NO_NAL_END 2017-07-04 15:28:36 +01:00
Vincent Penquerc'h
e5a0c4a751 jpeg2000sampling: fix critical when sampling is missing from caps
This can happen with real files
2017-06-08 16:17:43 +01:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Tim-Philipp Müller
95c842a860 codecparsers: remove problematic 'extern inline'
'extern inline' was added in 2fb76c89 for MSVC (it was just
'inline' before), but all of this doesn't really make sense,
the functions are not going to be inlined anyway, and what
'extern inline' means exactly also appears to depend on the
Cxx standard targetted. Let's just remove the 'extern inline'
entirely. At least gcc6 still emits the exact same code as
before anyway. Fixes compilation/linking with gcc 4.8 as
used on L4T on the TK1.
2017-01-10 16:03:30 +00:00
Anton Eliasson
03615a772a codecparsers: h264parse: improve documentation commentary
https://bugzilla.gnome.org/show_bug.cgi?id=775306
2016-11-29 10:34:16 +00:00
Anton Eliasson
0e8567a981 codecparsers: h264parse: docs spellcheck
Spell checks, correct capitalization and some rewording to
better fit the terms used in the H.264 spec.

https://bugzilla.gnome.org/show_bug.cgi?id=775306
2016-11-29 10:30:50 +00:00
Scott D Phillips
e4407d4599 Fix some MSVC warnings about const-ness
Some miscellaneous warnings about const-ness, either casting away const
where we know it's safe or removing const where it's not correct.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-15 14:53:49 +02:00
Scott D Phillips
3c53da5e09 Cast away const from GstMetaInfo in *_get_meta_info() functions
MSVC warns about the const in the implicit argument conversion in the
calls to g_once_init_{enter,leave}. It's OK so explicitly cast it.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-15 14:53:49 +02:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Nirbheek Chauhan
2fb76c89fc codecparsers: Explicitly export functions marked inline
On MSVC, inline functions are not available outside of a file unless
explicitly exported
2016-08-19 14:37:04 +01:00
Tim-Philipp Müller
e92894e4ab codecparsers: jpeg2000: don't allow 0 value for array access with i-1 2016-07-01 12:20:14 +01:00
Tim-Philipp Müller
1462ac7cdf codecparsers: jpeg2000: fix possible out-of-bounds array access
sizeof(array) != G_N_ELEMENTS(array).

CID 1362900
2016-07-01 12:15:28 +01:00
Luis de Bethencourt
276dd2750f jpeg2000parse: fix typo in sampling check
Fixing small typo that changes the value of the return.
2016-06-28 12:12:29 +02:00
Aaron Boxer
e7e6a3579d jpeg2000parse: use enums for colorspace and sampling, rather than strings
Also, move gstjpeg2000sampling to codecparsers project

https://bugzilla.gnome.org/show_bug.cgi?id=767908
2016-06-24 11:23:31 +03:00
Michael Olbrich
378051d80a h264parse: fix default time_offset_length
The default value for time_offset_length should be 24, see
section E2.2 of the H264 spec.

https://bugzilla.gnome.org/show_bug.cgi?id=767792
2016-06-21 10:45:43 +03:00
Reynaldo H. Verdejo Pinochet
ea272f0bac codecparsers: drop all otherwizes 2016-06-17 15:58:09 -07:00
Tim-Philipp Müller
1b58bbf3ad h264parser: maintain minimal ABI compat
Because we can.

https://bugzilla.gnome.org/show_bug.cgi?id=723352
2016-05-28 10:54:13 +01:00
Sebastian Dröge
b5f8b556e9 h264parser: Remove unused fps_num/fps_den fields
Instead the newly added function should be used to calculate
the framerate properly.

https://bugzilla.gnome.org/show_bug.cgi?id=723352
2016-05-28 10:54:01 +01:00
Sreerenj Balachandran
8f853cfed5 codecparsers: mpegvideo: Parse more slice header fields
https://bugzilla.gnome.org/show_bug.cgi?id=733872
2016-04-15 01:22:52 +10:00
Sreerenj Balachandran
51c7526030 codecparsers: mpegvideo: Add vbv_delay field to PictureHeader
https://bugzilla.gnome.org/show_bug.cgi?id=733872
2016-04-15 01:22:52 +10:00
Sreerenj Balachandran
7b0b74041e codecparsers: mpegvideo: Add more fields to the GstMpegVideoSequenceHdr
Added the fields load_non_intra_quantiser_matrix and
load_chroma_intra_quantiser_matrix to the sequence header structure.

https://bugzilla.gnome.org/show_bug.cgi?id=733872
2016-04-15 01:22:52 +10:00
Sebastian Dröge
ccc068576a meta: Initialize all GstMeta fields
During allocation they are not initialized to all zeroes.

https://bugzilla.gnome.org/show_bug.cgi?id=764902
2016-04-13 10:17:24 +03:00
Sreerenj Balachandran
88a3b4da3c codecparser: vp9: move persistent fields from GstVp9FrameHdr to GstVp9Parser
The subsampling_x, subsampling_y, bit_depth, color_space and color_range
fileds are moved from GstVp9FrameHdr to the global GstVp9Parser structure.
These fields are only present in keyframe or intra-only frame, no need to
duplicate them for inter-frames. This is an ABI change.

https://bugzilla.gnome.org/show_bug.cgi?id=764370
2016-04-01 14:12:08 +03:00
Edward Hervey
5ebf1d477d mpegvideoparser: Handle non-hierarchical profiles again
This is a regression from since mpegvideoparser was switched to
use the codecparsing library.

The problem is that the high bit of the profile_and_level is used
to specify non-hierarchical profiles and levels. Unfortunately we
were discarding that information.

Expose that escape bit, and use it in the element

https://bugzilla.gnome.org/show_bug.cgi?id=763220
2016-03-09 15:18:42 +01:00
Scott D Phillips
cf0d45c100 codecparsers: h265: Fix initialization of slice_deblocking_filter_disabled_flag
H.265 7.4.7.1 says:

> When slice_deblocking_filter_disabled_flag is not present, it is
> inferred to be equal to pps_deblocking_filter_disabled_flag.

https://bugzilla.gnome.org/show_bug.cgi?id=762351
2016-02-20 10:55:46 +02:00
Thiago Santos
115945b663 mpeg4parser: prevent assertion when scanning for sync code
Only search if there is indeed enough data to be searched otherwise
an assertion is raised
2016-02-19 16:42:35 -03:00
Tim-Philipp Müller
4e37976d83 codecparsers: vp9: minor clean-up
Remove setting of parser variable to NULL after free,
that makes no sense (and coverity is no doubt going
to complain about it).
2015-12-30 13:17:24 +00:00
Tim-Philipp Müller
d6834432ed codecparsers: vp9: fix macro namespacing and rename GstVp9InterpFilter 2015-12-30 13:12:13 +00:00
Tim-Philipp Müller
75b31d1872 codecparsers: vp9: fix doc typos and sprinkle some Since markers 2015-12-30 13:09:23 +00:00
Tim-Philipp Müller
10392acca5 codecparsers: vp9: move license blurb into header and remove aux files
This is just a bunch of lookup tables..
2015-12-30 11:04:32 +00:00
Sebastian Dröge
814cb85822 codecparsers: Add another G_GNUC_INTERNAL 2015-12-30 11:54:14 +02:00
Sebastian Dröge
d0332c2a16 codecparsers: Spread some G_GNUC_INTERNAL in various places 2015-12-30 11:40:59 +02:00
Sebastian Dröge
1bf448cbbd vp9parser: Fix indentation to make gst-indent happier 2015-12-30 11:38:14 +02:00
Sebastian Dröge
45f2ad952f vp9parser: Rename symbols to prevent symbol conflicts
Also make clamp() a static function for the same reason and use CLAMP (as
defined by GLib) in the GStreamer code.
2015-12-30 11:37:59 +02:00
Sreerenj Balachandran
b245e0f16c codecparsers: Add VP9 codec parser
https://bugzilla.gnome.org/show_bug.cgi?id=757597
2015-12-30 11:19:33 +02:00
Víctor Manuel Jáquez Leal
d054a6918c codecparser: h264: initialize parsing structures
Initialize to 0 these parse structures before filling them: GstH264SEIMessage,
GstH264NalUnit, GstH264PPS, GstH264SPS and GstH264SliceHdr.

When calling the functions which fill those structures, they may fail, leaving
unitialized those structures. This situation may lead to future problems, such
as a segmentation fault when freeing, for example.

This patch initializes to zero these structures, before filling them.

https://bugzilla.gnome.org/show_bug.cgi?id=755161
2015-10-29 11:26:37 +02:00
Víctor Manuel Jáquez Leal
c8b3d84757 codecparser: h265: initialize parsing structures
Initialize to 0 these parse structures before filling them: GstH265SEIMessage,
GstH265NalUnit, GstH265VPS, GstH265PPS, GstH265SPS and GstH265SliceHdr.

When calling the functions which fill those structures, they may fail, leaving
unitialized those structures. This situation may lead to future problems, such
as a segmentation fault when freeing, for example.

This patch initializes to zero these structures, before filling them.

https://bugzilla.gnome.org/show_bug.cgi?id=755161
2015-10-29 11:26:36 +02:00
Sreerenj Balachandran
fcd42b7d77 codecparsers: h265: Fix the selection of Active Ref Pic Set
If short_term_ref_pic_set_sps_flag is FALSE, the ShortTermRefPicSet
structure is supposed to derive from slice header. Which means,
CurrRpsIdx is equal to num_short_term_ref_pic_sets. But the number
of refpicsets communicated via sps header is only num_short_term_ref_pic_sets - 1.
And we are using slice_header structure to reference the last entry, which is
ShortTermRefPicSet[num_short_term_ref_pic_sets].

https://bugzilla.gnome.org/show_bug.cgi?id=754834
2015-09-10 21:12:30 +02:00
Sreerenj Balachandran
81435c8891 codecparsers: h265 : Fix default scaling list values
Fix the default_scaling_list values based on Table 7-6

https://bugzilla.gnome.org/show_bug.cgi?id=754834
2015-09-10 21:10:17 +02:00
XuGuangxin
54c2620bdb codecparsers: h265: Fix tile row and column parsing
Section 6.5.1:  Coding tree block raster and tile scanning conversion process
Follow the equations 6-3 and 6-4

This will provide correct offset_max in slice_header for parsing
num_entry_point_offsets.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-26 12:24:02 +03:00
lyb
497f372668 codecparsers: h265: Add APIs for up-right-diagonal/raster scan conversion
As per  7-42 and 7-43 the ScalingFactor's scanIdx is 0,
which is "up-right-diagonal" scan. Add APIs for converting
up-right-diagonal to raster and vise versa.

https://bugzilla.gnome.org/show_bug.cgi?id=754024
2015-08-24 21:28:08 +03:00
XuGuangxin
26e350f0bf codecparsers: h265: Fix the range of delta_chroma_log2_weight_denom
Being more strict on specification, According to 7.4.7.3,
delta_chroma_log2_weight_denom should be in the range of
[(0 - luma_log2_weight_denom), (7 - luma_log2_weight_denom)]

https://bugzilla.gnome.org/show_bug.cgi?id=754024
2015-08-24 21:21:29 +03:00
Jan Schmidt
fdac09d843 h264parse: Clear SPS info after processing.
The SPS struct might be filled out by a call to
gst_h264_parser_parse_subset_sps, which fills out
dynamically allocated data and requires a call
to gst_h264_sps_clear() to free it. Also make sure
to clear out any allocated SPS data when returning
an error.

https://bugzilla.gnome.org/show_bug.cgi?id=753306
2015-08-15 15:39:23 +10:00
Sreerenj Balachandran
8a6cc4ed27 codecparsers: h265: Fix the range of delta_chroma_log2_weight_denom
ChromaLog2WeightDenom = luma_log2_weight_denom + delta_chroma_log2_weight_denom

The value of ChromaLog2WeightDenom should be in the range of 0 to 7 and
the value luma_log2_weight_denom  should be also in the range of 0 to 7.
Which means , delta_chroma_log2_weight_denom can have values in the range
between -7 and 7.

https://bugzilla.gnome.org/show_bug.cgi?id=753552
2015-08-12 14:11:31 +02:00
Sreerenj Balachandran
b6b2e04501 codecparsers: h265: Fix the parsing of ref_pic_lists_modification
https://bugzilla.gnome.org/show_bug.cgi?id=753552
2015-08-12 14:11:26 +02:00
Jan Schmidt
c1b0d818bb h264parse: Add more NAL types for debugging output.
Register more NAL unit types so that they are dumped
by name in the debug output instead of being labelled
'Invalid'
2015-07-29 23:10:49 +10:00
Hyunjun Ko
aae9119d97 mpegvideometa: add meta transform function
https://bugzilla.gnome.org/show_bug.cgi?id=751778
2015-07-07 13:43:47 +03:00
Tim-Philipp Müller
bd5db4f72f codecparsers: jpeg: add some padding to ScanHdr struct
For bits that we don't parse out at the moment.
2015-06-21 17:13:07 +01:00
Tim-Philipp Müller
5b02e4ac59 codecparsers: jpeg: fix docs for table parsing functions 2015-06-21 14:59:13 +01:00
Tim-Philipp Müller
d8963a015f docs: add new JPEG codecparser API to the docs
And sprinkle some more Since markers
2015-06-21 13:55:29 +01:00
Tim-Philipp Müller
7d8f694501 codecparsers: jpeg: fix validity checking of data parsed
g_return_val_if_fail() and g_assert() are not appropriate
for checking untrusted external data.

https://bugzilla.gnome.org/show_bug.cgi?id=673925
2015-06-21 11:32:10 +01:00
Tim-Philipp Müller
0f04a61bbe codecparsers: jpeg: fix up API
- add data pointer to GstJpegSegment and pass segment
  to all parsing functions, rename accordingly
- shorten GstJpegMarkerCode enum type name to GstJpegMarker
- move function gtk-doc blurbs into .c file
- add since markers
- flesh out docs for SOF markers

https://bugzilla.gnome.org/show_bug.cgi?id=673925
2015-06-21 11:31:50 +01:00
Tim-Philipp Müller
4a85958909 codecparsers: jpeg: tweak API a little
https://bugzilla.gnome.org/show_bug.cgi?id=673925
2015-06-21 11:30:30 +01:00
Tim-Philipp Müller
441478d161 codecparsers: jpeg: hide gst_jpeg_scan_for_marker_code()
Make this function private for now, since it's unclear whether
it's actually needed seeing that gst_jpeg_parse() scans too.

https://bugzilla.gnome.org/show_bug.cgi?id=673925
2015-06-21 11:30:30 +01:00
Gwenole Beauchesne
d279e12c8f codecparsers: jpeg: fix and optimize scan for next marker code.
Fix scan for next marker code when there is an odd number of filler
(0xff) bytes before the actual marker code. Also optimize the loop
to execute with fewer instructions (~10%).

This fixes parsing for Spectralfan.mov.
2015-06-21 11:28:38 +01:00
Gwenole Beauchesne
41ed5c0266 codecparsers: jpeg: fix calculation of segment size.
The size of a marker segment is defined to be exclusive of any initial
marker code. So, fix the size for SOI, EOI and APPn segments but also
the size of any possible segment that is usually "reserved" or not
explicitly defined.

https://bugzilla.gnome.org/show_bug.cgi?id=707447
2015-06-21 11:28:38 +01:00
Wind Yuan
c83e413656 codecparsers: jpeg: fix default Huffman tables generation.
Fix build_huffman_table() to correctly fill in the associated HUFFVAL
entries to the default Huffman tables.
2015-06-21 11:28:38 +01:00
Gwenole Beauchesne
7e7b4d68f4 codecparsers: jpeg: add JPEG bitstream parser
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=673925
2015-06-21 11:28:30 +01:00
Vineeth TM
7823e6d606 nalutils: trivial patch to check if
trivial patch to add proper ( while checking for if(G_UNLIKELY())

https://bugzilla.gnome.org/show_bug.cgi?id=751087
2015-06-16 22:05:34 -04:00
Luis de Bethencourt
417db39d0d codecparsers: mpeg4: actually return full number of bits of resync marker
Switch the increment of markersize from when it is used to when it is
returned from compute_resync_marker_size.

This also makes the CHECK_REMAINING in gst_mpeg4_parse_video_packet_header
check for the actually required number of bits now and not one too few.

https://bugzilla.gnome.org/show_bug.cgi?id=739345
2015-06-13 18:03:11 +01:00
Tim-Philipp Müller
b14fb383ed Revert "codecparsers: remove ignored increment of return"
This reverts commit 916b954315.

Clearly something else was intended, and it also makes
more sense to add the extra bit. The resync marker is
N zero bits plus a 1 bit, and the pattern/mask needs to
be run on N+1 bits too.

(Even after the rever the code doesn't do that of course, so
it still needs to be fixed differently.)

https://bugzilla.gnome.org/show_bug.cgi?id=739345
2015-06-13 17:59:42 +01:00
Sreerenj Balachandran
e6e0702821 codecparser: h265: Fix nal unit size checking
The EOS and EOB nals have the size 2 which is the size of
nal unit header itself. The gst_h265_parser_identify_nalu()
is not required to scan start code again in this case.

In other cases, for a valid nalunit the minimum required size
is 3 bytes (2 byte header and at least 1 byte RBSP payload)
2015-04-30 21:47:38 +02:00
Sreerenj Balachandran
af7ff2bd95 codecparser: h265: Calculate crop rectangle dimensions 2015-04-30 21:46:31 +02:00
Sreerenj Balachandran
877e69c9ec codecparser: h265: Fix parsing multiple SEI messages in a single SEI Nal
An SEI Nal can have more than one SEI message.

Change in API: the gst_h265_parser_parse_sei()
2015-04-30 21:45:39 +02:00
Sreerenj Balachandran
8407622c93 codecparser: h265: Fix the number of tile rows/columns parsing
The possible minimum value for num_tile_columns_minus1 and num_tile_rows_minus1
is zero (7.4.3.3).

https://bugzilla.gnome.org/show_bug.cgi?id=748641
2015-04-29 19:16:48 +02:00
Sreerenj Balachandran
989643ff7c codecparsers: h265: 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=747613
2015-04-26 21:46:25 +02:00
Sreerenj Balachandran
a86e7c1c1f codecparser: h265: skip byte alignment bits while parsing slice header
Skip the byte alignment bits as per the logic of byte_alignment()
provided in hevc specification. This will fix the calculation of
slice header size.

https://bugzilla.gnome.org/show_bug.cgi?id=747613
2015-04-26 21:45:31 +02:00
Sreerenj Balachandran
b17a026eb7 codecparser: h265: Fix the NumDeltaPocs calculation
Always use the equation provided in spec (7-57) for finding
the NumDeltaPocs

https://bugzilla.gnome.org/show_bug.cgi?id=747613
2015-04-26 21:45:08 +02:00
Sreerenj Balachandran
333ba075a5 codecparser: h265: Fix the NumPocTotalCurr calculation
The NumPocToalCurr should be calculated for all B and P slices.

https://bugzilla.gnome.org/show_bug.cgi?id=747613
2015-04-26 21:44:25 +02:00
Sreerenj Balachandran
889cc8ee31 codecparser: h265: Fix nal size calculation for EOS and EOB
https://bugzilla.gnome.org/show_bug.cgi?id=747613
2015-04-26 21:43:40 +02:00
Tim-Philipp Müller
699452ef31 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:59:32 +01:00
Edward Hervey
aebec9bd24 codecparsers: Indent file
Someone's been commiting without using gst-indent :)
2015-01-23 12:26:16 +01:00
Edward Hervey
3da1c9c8d5 codecparsers: Add READ_UE_MAX macro
READ_UE_ALLOWED was almost exclusively used with min == 0, which doesn't
make much point for unsigned integers.

Add a READ_UE_MAX variant and use that instead. Also replaced two usages
of CHECK_ALLOWED (a,0,something) by CHECK_ALLOWED_MAX (a, something)
2015-01-23 12:24:52 +01:00
Sebastian Dröge
80e02cbdf9 Constify some static arrays everywhere 2015-01-21 10:18:50 +01:00
Vincent Penquerc'h
c73a5e0c54 h264parser: fix stack smashing
Ensure that we do not trust the bitstream when filling a table
with a fixed max size.
Additionally, the code was not quite matching what the spec says:
- a value of 3 broke from the loop before adding an entry
- an unhandled value did not add an entry
The reference algorithm does these things differently (7.3.3.1
in ITU-T Rec. H.264 (05/2003)).

This plays (apparently correctly) the original repro file, with
no stack smashing.

Based on a patch and bug report by André Draszik <git@andred.net>
2015-01-14 11:39:55 +00:00
Julien Isorce
3fb3758e7d codecparsers: fix some compiler warnings
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1

"warning: comparison is always true due to limited
range of data type"

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740673
2014-11-25 23:05:15 +00:00
Gwenole Beauchesne
8c76b5897a codecparsers: h264: fix derivation of MaxPicNum variable.
The logic to compute the MaxPicNum variable was reversed. In paricular,
MaxPicNum is double MaxFrameNum only if field_pic_flag is set to 1.

https://bugzilla.gnome.org/show_bug.cgi?id=739291
2014-11-14 09:36:27 +01:00
Aurélien Zanelli
6511a7282b h264parser: fix GstH264ParserResult documentation typo
https://bugzilla.gnome.org/show_bug.cgi?id=739906
2014-11-10 23:37:37 +00:00
Gwenole Beauchesne
65fc58da4d codecparsers: h264: recognize SVC NAL units.
Identify SVC NAL units and tag them as such. This is necessary for
gst_h264_parser_parse_slice_hdr() to fail gracefully, if the user
did not perform the check himself.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-10-29 15:00:56 +01:00
Gwenole Beauchesne
b50c3e2127 codecparsers: h264: fix number of list0 {,non-}anchor refs.
Fix copy-paste error in gst_h264_sps_mvc_copy() where num_anchor_refs_l0
and num_non_anchor_refs_l0 were incorrectly initialized from list1.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-10-29 15:00:56 +01:00
Tim-Philipp Müller
3e62612259 codecparsers: sprinkle some gtk-doc Since: markers for new API 2014-10-29 13:15:51 +00:00
Jan Schmidt
86b948587e codecparsers: Initialise nalu extension type to NONE
Always set a default NALU extension type, and override it
when we find a supported extension, to avoid having it unset/random
for unsupported NALU extensions
2014-10-29 23:23:02 +11:00
Jan Schmidt
cc71119539 h264parser: Fix frame packing SEI parsing 2014-10-29 23:21:47 +11:00
Sreerenj Balachandran
3776e78ae6 codecparsers: h264: add support for Frame Packing Arrangement SEI message.
This parses the frame_packing_arragement() payload in SEI message.
This information can be used by decoders to appropriately rearrange the
samples which belong to Stereoscopic and Multiview High profiles.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-10-29 23:09:41 +11:00
Sreerenj Balachandran
51f003e469 codecparsers: h264: add support for Stereo Video Information SEI message.
Add the necessary payload parsing support for stereo_video_info.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2014-10-29 23:09:41 +11:00
Gwenole Beauchesne
8911a80662 codecparsers: h264: parse seq_parameter_set_mvc_extension().
https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-10-29 23:09:41 +11:00
Gwenole Beauchesne
c1deab84e6 codecparsers: h264: parse MVC syntax elements.
https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-10-29 23:09:41 +11:00
Luis de Bethencourt
916b954315 codecparsers: remove ignored increment of return
'return val++;' returns the value before it is incremented because the post
increment happens after the statement. Removing the unused increment.

https://bugzilla.gnome.org/show_bug.cgi?id=739345
2014-10-29 10:37:38 +00:00
Aurélien Zanelli
de327bf45b vc1parser: fix level values for simple/main profile
In simple profile, level set to 0 or 2 indicate low and medium level
respectively. In main profile, level set to 0, 2 or 4 indicate low,
medium and high level respectively.

Level values are defined in Annex J.1.2 of the SMPTE 421M.

https://bugzilla.gnome.org/show_bug.cgi?id=738230
2014-10-20 12:40:54 +02:00
Aurélien Zanelli
c9a196d54d vc1parser: take care of endianness when parsing sequence-layer
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
2014-09-18 13:36:07 +03:00
Sreerenj Balachandran
e93551d5b0 codecparser: h264: Use proper bit_reader api while parsing buffering_period SEI
https://bugzilla.gnome.org/show_bug.cgi?id=734970
2014-08-18 11:45:54 +01:00
Aurélien Zanelli
41df512eb9 codecparsers_h264: initialize some fields of pic_timing structure
Otherwise pic timing structure can have invalid cpb_removal_delay,
dpb_output_delay or pic_struct_present_flag which are blindly retrieved
in h264parse.

https://bugzilla.gnome.org/show_bug.cgi?id=734124
2014-08-01 17:06:29 +02:00
Fabrice Bellet
2f28fcb862 parser: mpeg4: fix vlc table used for sprite trajectory
The vlc table members cbits, cword and values were assigned in the wrong
order, causing the mpeg4 parser to fail when handling sprite
trajectories.

https://bugzilla.gnome.org/show_bug.cgi?id=733322
2014-07-21 09:37:51 +02:00
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