Commit Graph

163 Commits

Author SHA1 Message Date
James Almer
9ee1f03365 Merge commit '70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4'
* commit '70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4':
  h264: tighten the valid range for ref_frame_count

Conflicts:
libavcodec/h264_ps.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:02:20 -03:00
James Almer
8c7932884d Merge commit 'f638b67e5790735f34620bf82025c9b9d6fc7216'
* commit 'f638b67e5790735f34620bf82025c9b9d6fc7216':
  h264: move the parameter set definitions to a new header file

Conflicts:
libavcodec/h264_parse.h
libavcodec/h264_ps.c
libavcodec/h264dec.h

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 12:58:09 -03:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Carl Eugen Hoyos
9bd35a76fc lavc/h264_ps: Be more verbose when truncating likely oversized PPS. 2016-07-24 20:21:37 +02:00
Clément Bœsch
b4abf0e396 Merge commit 'a833ff68f6bf9dc72c3ef0ddf830ebed743c0703'
* commit 'a833ff68f6bf9dc72c3ef0ddf830ebed743c0703':
  h264: Fix decoding delay for Intra only streams

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:06:11 +02:00
Benoit Fouet
879330c561 h264: make H264ParamSets sps const 2016-06-30 09:24:39 +02:00
Benoit Fouet
4cc1ce4a91 h264: straighten dimensions check ff_h264_decode_seq_parameter_set
The MBS only flag was not taken into account when checking macroblock dimensions.
Also removes the unneeded check in init_dimensions for slices.
2016-06-30 09:24:39 +02:00
Benoit Fouet
3e8cda1eb1 h264_ps: change decode_scaling_matrices so that it takes const {s,p}ps
In order to be able to make SPS const in H264ParamSets,
modify decode_scaling_matrices so that it returns if the scaling
matrix are present in the SPS, instead of altering the input SPS
structure.
2016-06-30 09:24:39 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Anton Khirnov
70b1dcef2d h264: tighten the valid range for ref_frame_count
This field (which the spec calls max_num_ref_frames) must be less than
or equal to MaxDpbFrames, which is at most 16.
2016-06-21 11:14:07 +02:00
Anton Khirnov
f638b67e57 h264: move the parameter set definitions to a new header file
The PS parsing code is independent from the decoder, so it makes more
sense for it to have its own separate header.
2016-06-21 11:13:29 +02:00
Anton Khirnov
9df889a5f1 h264: rename h264.[ch] to h264dec.[ch]
This is more consistent with the naming of other decoders.
2016-06-21 11:11:26 +02:00
Matthieu Bouron
0ea58059d6 lavc/h264_ps: add ff_h264_ps_uninit and use it 2016-06-20 16:09:09 +02:00
Anton Mitrofanov
a833ff68f6 h264: Fix decoding delay for Intra only streams
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-06-12 20:29:29 +02:00
Clément Bœsch
1534ef87c7 Merge commit '3176217c60ca7828712985092d9102d331ea4f3d'
* commit '3176217c60ca7828712985092d9102d331ea4f3d':
  h264: decouple h264_ps from the h264 decoder

Main changes:

- a local GetBitContext is created for the various
  ff_h264_decode_seq_parameter_set() attempts

- just like the old code, remove_sps() is adjusted so it doesn't remove
  the pps.

  Fixes decode with Ticket #631
  http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20111108/dae58f17/attachment.mp4
  but see next point as well.

- ff_h264_update_thread_context() is updated to work even when SPS
  isn't set as it breaks current skip_frame code. This makes sure we
  can still decode the sample from ticket #631 without the need for
  -flags2 +chunks. (Thanks to Michael)

- keep {sps,pps}_ref pointers that stay alive even when the active
  pps/sps get removed from the available lists (patch by michaelni with
  additionnal frees in ff_h264_free_context() from mateo)

- added a check on sps in avpriv_h264_has_num_reorder_frames() to fix
  crashes with mpegts_with_dvbsubs.ts from Ticket #4074
  http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4074/mpegts_with_dvbsubs.ts

- in h264_parser.c:h264_parse(), after the ff_h264_decode_extradata() is
  called, the pps and sps from the local parser context are updated with
  the pps and sps from the used h264context. This fixes fate-flv-demux.

- in h264_slice.c, "PPS changed between slices" error is not triggered
  anymore in one condition as it makes fate-h264-xavc-4389 fails with
  THREADS=N (Thanks to Michael)

Merged-by: Clément Bœsch <clement@stupeflix.com>
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-06-12 13:26:52 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Derek Buitenhuis
a454ad670c Merge commit 'add1467e5e447b79e8743a0b05c54dcf58c61dfe'
* commit 'add1467e5e447b79e8743a0b05c54dcf58c61dfe':
  svq3: drop the build dependency on the h264 decoder

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:57:36 +01:00
Derek Buitenhuis
a5a6621616 Merge commit 'f4d581cda3897f66c1dda7586b93f86a591dbbef'
* commit 'f4d581cda3897f66c1dda7586b93f86a591dbbef':
  lavc: Deduplicate zigzag_scan table

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-24 11:47:39 +01:00
Anton Khirnov
3176217c60 h264: decouple h264_ps from the h264 decoder
Make the SPS/PPS parsing independent of the H264Context, to allow
decoupling the parser from the decoder. The change is modelled after the
one done earlier for HEVC.

Move the dequant buffers to the PPS to avoid complex checks whether they
changed and an expensive copy for frame threads.
2016-04-24 10:06:23 +02:00
Anton Khirnov
add1467e5e svq3: drop the build dependency on the h264 decoder 2016-03-28 09:58:26 +02:00
Diego Biurrun
f4d581cda3 lavc: Deduplicate zigzag_scan table 2016-03-25 15:23:56 +01:00
Hendrik Leppkes
10e55bd658 Merge commit 'b09ad37c83841c399abb7f2503a2ab214d0c2d48'
* commit 'b09ad37c83841c399abb7f2503a2ab214d0c2d48':
  h264: derive the delay from the level when it's not present

Merged without changing the strict_std_compliance check, as it breaks FATE
and changes decoding behavior.

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:07:08 +01:00
Anton Khirnov
b09ad37c83 h264: derive the delay from the level when it's not present
Fall back to maximum DPB size if the level is unknown.

This should be more spec-compliant and does not depend on the caller
setting has_b_frames before opening the decoder.

The old behaviour, when the delay is supplied by the caller setting
has_b_frames, can still be obtained by setting strict_std_compliance
below normal.
2015-12-06 09:43:52 +01:00
Michael Niedermayer
85c92789b6 avcodec/h264_ps: Fix copying oversized pps&sps data
Fixes: https://trac.ffmpeg.org/attachment/ticket/685/movie.264

In the available testcase the actual PPS only uses a few bits
while there are 7kbyte of apparently random data after it

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-03 11:55:23 +02:00
wm4
069190f707 avcodec/h264: keep SPS and PPS bitstream data
We assume an upper bound of 4096 bytes for each raw SPS/PPS. It's hard
to determine an exact maximum size, but this value was was considered
high enough and safe.

Needed for the following VideotoolBox commit.
2015-10-02 19:08:54 +02:00
Michael Niedermayer
94d68a41fa Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'
* commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615':
  lavc: AV-prefix all codec flags

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/ac3enc_float.c
	libavcodec/atrac1.c
	libavcodec/atrac3.c
	libavcodec/atrac3plusdec.c
	libavcodec/dcadec.c
	libavcodec/ffv1enc.c
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb.c
	libavcodec/imc.c
	libavcodec/libmp3lame.c
	libavcodec/libtheoraenc.c
	libavcodec/libtwolame.c
	libavcodec/libvpxenc.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegaudiodec_template.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/nellymoserdec.c
	libavcodec/nellymoserenc.c
	libavcodec/nvenc.c
	libavcodec/on2avc.c
	libavcodec/options_table.h
	libavcodec/opus_celt.c
	libavcodec/pngenc.c
	libavcodec/ra288.c
	libavcodec/ratecontrol.c
	libavcodec/twinvq.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c
	libavcodec/vorbisdec.c
	libavcodec/vp3.c
	libavcodec/wma.c
	libavcodec/wmaprodec.c
	libavcodec/x86/hpeldsp_init.c
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:10:35 +02:00
Vittorio Giovara
7c6eb0a1b7 lavc: AV-prefix all codec flags
Convert doxygen to multiline and express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Michael Niedermayer
037c9c25e6 Merge commit '86e1a35802df42f51337d3fed8d5d99d0898c8bf'
* commit '86e1a35802df42f51337d3fed8d5d99d0898c8bf':
  h264_ps: Return meaningful error codes and address a memory leak

Conflicts:
	libavcodec/h264_ps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 22:49:50 +02:00
Vittorio Giovara
86e1a35802 h264_ps: Return meaningful error codes and address a memory leak
Bug-Id: CID 1026763
2015-04-20 14:59:40 +01:00
Michael Niedermayer
c658269cd1 avcodec/h264_ps: Validate num_units_in_tick/time_scale before setting them in the context
This probably makes no big difference but it is more correct

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-16 03:41:41 +02:00
Vittorio Giovara
7498f2221e h264: Do not fail on unsupported timing info
The spec madandate both time_scale and num_units_in_tick greater than 0,
however since they are not essential for decoding, just ignore the whole
block and try to finish parsing the VUI.

Related to Ticket4445.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-04-16 03:41:41 +02: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
32e06c485b avcodec/h264_ps: Move truncation check from VUI to SPS
This more completely checks for truncation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-08 22:19:56 +02:00
Michael Niedermayer
cde98920da Merge commit '84f226a3bcd8b39801a4c9051c033ab7d61aaf76'
* commit '84f226a3bcd8b39801a4c9051c033ab7d61aaf76':
  h264: use the correct SPS during PPS parsing

Conflicts:
	libavcodec/h264_ps.c

See: dc35b77b28
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-05 20:48:14 +02:00
Anton Khirnov
84f226a3bc h264: use the correct SPS during PPS parsing
There is in general no reason for the currently active SPS to be the one
referenced by the PPS being parsed.
2015-04-05 12:01:34 +02:00
Michael Niedermayer
665e0c10a6 Merge commit 'd8a45d2d49f54fde042b195f9d5859251252493d'
* commit 'd8a45d2d49f54fde042b195f9d5859251252493d':
  h264_ps: properly check cropping parameters against overflow

Conflicts:
	libavcodec/h264_ps.c

See: c3bd306e78
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 12:09:03 +01:00
Anton Khirnov
d8a45d2d49 h264_ps: properly check cropping parameters against overflow
CC: libav-stable@libav.org
2015-03-21 09:35:23 +01:00
Michael Niedermayer
69aa79365c avcodec/h264_ps: More completely check the bit depths
Fixes out of array read
Fixes: asan_static-oob_30328b6_719_cov_3325483287_H264_artifacts_motion.h264

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-06 04:32:14 +01:00
Christophe Gisquet
6a2bfd52e5 h264_ps: move and export aspect_ratio
Needed for filters that may need it, like an SPS bsf.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-30 04:15:40 +01: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
45ba9d8545 Merge commit 'cba4e6062a02d5bf684e13a770be88aa1fec717e'
* commit 'cba4e6062a02d5bf684e13a770be88aa1fec717e':
  More correct printf format specifiers

Conflicts:
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-02 02:54:09 +02:00
Diego Biurrun
cba4e6062a More correct printf format specifiers
This avoids compiler warnings about argument and specifier type mismatch.
2014-04-02 00:27:22 +02:00
Michael Niedermayer
8d024c5107 Merge commit 'cc8163e1a3601a56f722a4720516e860bf1c6198'
* commit 'cc8163e1a3601a56f722a4720516e860bf1c6198':
  avcodec: more correct printf specifiers

Conflicts:
	libavcodec/4xm.c
	libavcodec/alsdec.c
	libavcodec/dfa.c
	libavcodec/h264_ps.c
	libavcodec/jpeg2000dec.c
	libavcodec/lagarith.c
	libavcodec/mpeg12dec.c
	libavcodec/rv10.c
	libavcodec/svq3.c
	libavcodec/wmaprodec.c
	libavcodec/xwddec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-22 18:43:40 +01:00
Diego Biurrun
cc8163e1a3 avcodec: more correct printf specifiers 2014-03-22 14:08:20 +01:00
Michael Niedermayer
a81a2b514e Merge commit '5d1c2e53ab3ce27b48c138d22bb01ff8e8304f27'
* commit '5d1c2e53ab3ce27b48c138d22bb01ff8e8304f27':
  h264: Replace mpegvideo-specific MAX_PICTURE_COUNT by private define

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 06:05:19 +01:00
Vittorio Giovara
5d1c2e53ab h264: Replace mpegvideo-specific MAX_PICTURE_COUNT by private define 2014-03-16 23:01:01 +01:00
Michael Niedermayer
983c7f4015 Merge commit 'ee6280ca12696a67535ce2245c77190edc513794'
* commit 'ee6280ca12696a67535ce2245c77190edc513794':
  h264: parse two additional constraint flags

Conflicts:
	libavcodec/h264_ps.c

See: 9091ba9dfa
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-01 04:51:05 +01:00
Michael Niedermayer
3ec3f70ddb Merge commit 'e70ab7c1f5005041bba0e4efc1165410f83495b2'
* commit 'e70ab7c1f5005041bba0e4efc1165410f83495b2':
  h264: add MVCD to the list of High profiles in SPS

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-01 04:30:57 +01:00
Vittorio Giovara
ee6280ca12 h264: parse two additional constraint flags 2014-02-28 18:14:34 +01:00