Commit Graph

135 Commits

Author SHA1 Message Date
Mark Harris c51c08e0e7 avcodec: Use get_ue_golomb_long() when needed
get_ue_golomb() cannot decode values larger than 8190 (the maximum
value that can be golomb encoded in 25 bits) and produces the error
"Invalid UE golomb code" if a larger value is encountered.  Use
get_ue_golomb_long() instead (which supports 63 bits, up to 4294967294)
when valid h264/hevc values can exceed 8190.

This updates decoding of the following values:   (maximum)
  first_mb_in_slice                                36863* for level 5.2
  abs_diff_pic_num_minus1                         131071
  difference_of_pic_nums_minus1                   131071
  idr_pic_id                                       65535
  recovery_frame_cnt                               65535
  frame_packing_arrangement_id                4294967294
  frame_packing_arrangement_repetition_period      16384
  display_orientation_repetition_period            16384

An alternative would be to modify get_ue_golomb() to handle encoded
values of up to 49 bits as was done for get_se_golomb() in a92816c.
In that case get_ue_golomb() could continue to be used for all of
these except frame_packing_arrangement_id.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-29 13:11:51 +01:00
Michael Niedermayer bc48c88918 avcodec/h264: Do not fail with randomly truncated VUIs
Fixes Ticket4445

Tested-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-10 18:35:07 +02:00
Michael Niedermayer 0f8bb0efc3 Merge commit '5bf3c0fa49afd5bbf43aa841ff78007d72c80736'
* commit '5bf3c0fa49afd5bbf43aa841ff78007d72c80736':
  h264: drop the now unused per-slice H264Contexts

Conflicts:
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 21:41:17 +01:00
Michael Niedermayer 84ae7294cb Merge commit '3178f4d33ff62243f7cdddb081db516ea34396c9'
* commit '3178f4d33ff62243f7cdddb081db516ea34396c9':
  h264: move rbsp_buffer into the per-slice context

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_parser.c
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 20:16:21 +01:00
Michael Niedermayer 55215383dc Merge commit 'f42485dbce614b3f63182845da43db690b427b7c'
* commit 'f42485dbce614b3f63182845da43db690b427b7c':
  h264: use a separate GetBitContext for slice data

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_parser.c
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 17:13:24 +01:00
Michael Niedermayer cc2cfdc497 Merge commit '95eb35f30513e335990ad0d5dca6ddc318477291'
* commit '95eb35f30513e335990ad0d5dca6ddc318477291':
  h264: move the ref lists variables into the per-slice context

Conflicts:
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_direct.c
	libavcodec/h264_mb.c
	libavcodec/h264_picture.c
	libavcodec/h264_refs.c
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:18:10 +01:00
Michael Niedermayer 97c8ecaada Merge commit '56febc993b928ccc039a32158ca60b234c311875'
* commit '56febc993b928ccc039a32158ca60b234c311875':
  h264: move the slice type variables into the per-slice context

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:30:19 +01:00
Michael Niedermayer 756dc7bd18 Merge commit '92c6c2a605f9b077b8fbc25b7ed6625541232b87'
* commit '92c6c2a605f9b077b8fbc25b7ed6625541232b87':
  h264: split weighted pred-related vars into per-slice context

Conflicts:
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_mb.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 13:13:12 +01:00
Anton Khirnov 5bf3c0fa49 h264: drop the now unused per-slice H264Contexts 2015-03-21 11:27:16 +01:00
Anton Khirnov 3178f4d33f h264: move rbsp_buffer into the per-slice context 2015-03-21 11:27:15 +01:00
Anton Khirnov f42485dbce h264: use a separate GetBitContext for slice data 2015-03-21 11:27:14 +01:00
Anton Khirnov 95eb35f305 h264: move the ref lists variables into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov 56febc993b h264: move the slice type variables into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov 92c6c2a605 h264: split weighted pred-related vars into per-slice context 2015-03-21 11:27:09 +01:00
Michael Niedermayer 560eb7179a Merge commit '31d2039cb42668ebcf08248bc48bbad44aa05f49'
* commit '31d2039cb42668ebcf08248bc48bbad44aa05f49':
  h264_parser: export video format and dimensions

Conflicts:
	libavcodec/h264_parser.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-19 20:39:04 +01:00
Anton Khirnov 31d2039cb4 h264_parser: export video format and dimensions 2015-02-19 15:07:52 +01:00
Zhaoxiu Zeng 2a72b1664d avcodec/h264: use avpriv_find_start_code() in h264_split()
This also allows replacing several literal numbers by named constants
And it should be faster, the function is not speed relevant though as it is
generally only called a few times at the streams start.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-15 01:13:32 +01:00
Michael Niedermayer ccaa5dcb31 avcodec/h264_parser: Rename close()
This avoids a potential conflict with the equally named function for closing files
It also could reduce confusion in debugger backtraces

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-28 13:11:03 +01:00
Michael Niedermayer 6e57d2da90 Merge commit '9404a47a2d1df418946a338938eb6cdb3afed474'
* commit '9404a47a2d1df418946a338938eb6cdb3afed474':
  h264: move parser-only variables to their own context

Conflicts:
	libavcodec/h264_parser.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-27 15:08:17 +01:00
Anton Khirnov 58ae8d5957 h264_parser: restore a comment lost in 0268a54 2015-01-27 09:09:56 +01:00
Anton Khirnov 9404a47a2d h264: move parser-only variables to their own context 2015-01-27 09:08:31 +01:00
Michael Niedermayer 9d6ad68fa4 avcodec/h264_parser: Avoid adding SEI to the global header
Only consider SEI when no PPS has been found yet

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-12 03:28:15 +01:00
Michael Niedermayer 940f5c08e5 Merge commit '1b667269062eb6aec0b8726393ea91b7f7f57fde'
* commit '1b667269062eb6aec0b8726393ea91b7f7f57fde':
  h264_parser: don't stop on SPS_EXT in split

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-11 23:21:12 +01:00
John Stebbins 1b66726906 h264_parser: don't stop on SPS_EXT in split
Add SPS_EXT, SEI, and subset SPS to codes that are skipped during split.
These codes can come before the PPS and results in incomplete extradata.
2014-11-11 11:49:55 +01:00
Michael Niedermayer fc8d59fa6f avcodec/h264_parser: Use av_freep() to avoid leaving stale pointers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 23:58:52 +01:00
Michael Niedermayer 69a9a90d2e avcodec/h264_parser: rewrite the parse_nal_units() loop logic based on h264.c
Fixes Ticket4011

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-27 04:58:49 +01:00
Michael Niedermayer 09450c5509 avcodec/h264: fix time_base and framerate
They are not just inverses of each other.
This should restore behavior to before the introduction of framerate

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-15 16:08:36 +02:00
Michael Niedermayer fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Michael Niedermayer 77aafadc56 Merge commit 'db7f1c7c5a1d37e7f4da64a79a97bea1c4b6e9f8'
* commit 'db7f1c7c5a1d37e7f4da64a79a97bea1c4b6e9f8':
  h264: Move start code search functions into separate source files.

Conflicts:
	libavcodec/arm/Makefile
	libavcodec/arm/h264dsp_init_arm.c
	libavcodec/h264_parser.c
	libavcodec/h264dsp.c
	libavcodec/startcode.c
	libavcodec/startcode.h

See: 270cede3f3
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-05 12:46:10 +02:00
Ben Avison db7f1c7c5a h264: Move start code search functions into separate source files.
This permits re-use with parsers for codecs which use similar start codes.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-04 22:22:54 +02:00
Michael Niedermayer 92be540636 avcodec/h264_parser: remove redundant assignment
Found-by: CSA
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 05:14:18 +02:00
Michael Niedermayer 0782fb6bcb libavcodec/h264_parser: Increase parse_history, fix huge resolutions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 16:39:04 +02:00
Michael Niedermayer 9517900bef Merge commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b'
* commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b':
  mpegvideo: move mpegvideo formats-related defines to mpegutils.h

Conflicts:
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_mvpred.h
	libavcodec/svq1enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 12:36:48 +01:00
Vittorio Giovara e0c16e4e32 mpegvideo: move mpegvideo formats-related defines to mpegutils.h 2014-03-16 23:04:41 +01:00
Michael Niedermayer f3a862935d Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264_parser: use enum values in h264_find_frame_end()

Conflicts:
	libavcodec/h264_parser.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-15 21:05:31 +01:00
Vittorio Giovara dc971acf4a h264_parser: use enum values in h264_find_frame_end() 2014-02-15 18:29:49 +01:00
Michael Niedermayer 60b46a00c6 Merge commit '73e8fab31dc19c4371499e612856accbc00b2820'
* commit '73e8fab31dc19c4371499e612856accbc00b2820':
  h264: print values in case of error

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_ps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-14 13:35:45 +01:00
Vittorio Giovara 73e8fab31d h264: print values in case of error
Also make error style consistent and drop redundant information.
2014-02-14 05:05:35 +01:00
Michael Niedermayer e0b2bdd37a avcodec/h264_parser: heuristically detect non marked keyframes
Fixes Ticket3083

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-26 15:56:11 +02:00
Michael Niedermayer 4aeafbaab8 Merge commit '103d073dd7ce23b912df32be8c9524ba25dd5991'
* commit '103d073dd7ce23b912df32be8c9524ba25dd5991':
  h264_parser: Use ff_h264_reset_sei()

Conflicts:
	libavcodec/h264_parser.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-22 19:19:28 +02:00
Yusuke Nakamura 103d073dd7 h264_parser: Use ff_h264_reset_sei()
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-22 10:55:22 +02:00
Michael Niedermayer 19f5384000 h264_parser: Fix order of operations
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-22 10:53:04 +02:00
Michael Niedermayer 9c0fe487c7 avcodec/h264_parser: fix order of operations
Fixes CID1108576

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-19 23:44:34 +02:00
Michael Niedermayer f7f74a37b8 Merge commit '4baba6c813b7a1f27370e20fb1a87b05fcb39208'
* commit '4baba6c813b7a1f27370e20fb1a87b05fcb39208':
  h264_parser: Fix POC parsing for the case where MMCO_RESET is present.

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-16 12:51:26 +02:00
Michael Niedermayer 91248f081f Merge commit 'b81dbd6cb7522bea96d78a52f8a4c25a47b820c9'
* commit 'b81dbd6cb7522bea96d78a52f8a4c25a47b820c9':
  h264_parser: Fix POC parsing for the case where MMCO_RESET is absent.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-16 12:39:02 +02:00
Yusuke Nakamura 4baba6c813 h264_parser: Fix POC parsing for the case where MMCO_RESET is present.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-15 20:02:55 +02:00
Yusuke Nakamura b81dbd6cb7 h264_parser: Fix POC parsing for the case where MMCO_RESET is absent.
The prev_ values were not set after parsing POC.
Increase length of the buffer decoded to parse enough safely.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-15 20:02:47 +02:00
Michael Niedermayer c0f2ad3dbd Merge commit '218d6844b37d339ffbf2044ad07d8be7767e2734'
* commit '218d6844b37d339ffbf2044ad07d8be7767e2734':
  h264dsp: Factorize code into a new function, h264_find_start_code_candidate

Conflicts:
	libavcodec/h264_parser.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-08 12:47:05 +02:00
Michael Niedermayer 50b7ce1257 Merge commit '7a82022ee2f9b1fad991ace0936901e7419444be'
* commit '7a82022ee2f9b1fad991ace0936901e7419444be':
  h264_parser: Initialize the h264dsp context in the parser as well

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-08 12:29:35 +02:00