Commit Graph

236 Commits

Author SHA1 Message Date
Clément Bœsch
5be1440c74 Merge commit '0a35f128f3c6e0ae9a0a2236c557602c108da269'
* commit '0a35f128f3c6e0ae9a0a2236c557602c108da269':
  cabac: x86: Give optimizations header a more meaningful name

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-08 14:30:13 +02:00
Michael Niedermayer
a3a4082599 avcodec/h264_cabac: Fix runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 858/clusterfuzz-testcase-5168477042114560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-16 16:16:05 +01:00
Michael Niedermayer
258763ad0e avcodec/h264_cabac: runtime error: signed integer overflow: 2147483647 + 14 cannot be represented in type 'int'
Fixes: 614/clusterfuzz-testcase-4931860079575040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 22:41:40 +01:00
Diego Biurrun
0a35f128f3 cabac: x86: Give optimizations header a more meaningful name 2016-12-01 08:23:54 +01:00
James Almer
fd4eb56528 Merge commit '8281cd5cb80582d668ce0848e0e035b383f161f6'
* commit '8281cd5cb80582d668ce0848e0e035b383f161f6':
  h264_cabac: drop an always true condition

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 16:46:57 -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
Clément Bœsch
5565e27111 Merge commit '6e92181bf836f48627a4733b6fd240a99fd36365'
* commit '6e92181bf836f48627a4733b6fd240a99fd36365':
  h264: pass just the PPS to get_chroma_qp()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-07-01 14:23:38 +02:00
Clément Bœsch
bef74ef367 Merge commit '4f81f8dba735c212efae077c4fec8ad4fe53b352'
* commit '4f81f8dba735c212efae077c4fec8ad4fe53b352':
  Drop unnecessary golomb.h #includes

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:54:54 +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
8281cd5cb8 h264_cabac: drop an always true condition 2016-06-21 11:17:53 +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
James Almer
94011f994a avodec/h264dec: fix compilation with -DTRACE
Signed-off-by: James Almer <jamrial@gmail.com>
2016-06-16 18:52:23 -03:00
Anton Khirnov
6e92181bf8 h264: pass just the PPS to get_chroma_qp()
It does not need the whole context. This will simplify the following
commit.
2016-06-12 20:27:53 +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
Diego Biurrun
4f81f8dba7 Drop unnecessary golomb.h #includes 2016-06-08 18:51:57 +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
Diego Biurrun
c11c693acc h264: Drop broken trace debug output 2016-05-03 15:45:11 +02:00
Derek Buitenhuis
a2922b5d61 Merge commit 'ecc31f6b086453ab9811dce2ae5ceb6a7c19e4ad'
* commit 'ecc31f6b086453ab9811dce2ae5ceb6a7c19e4ad':
  h264: move ff_h264_check_intra[4x4]_pred_mode() to h264_parse

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-27 16:34:40 +01:00
Derek Buitenhuis
9809371aa5 Merge commit 'a7da517f6a5c472f46f67dd33bb6b95ccc919923'
* commit 'a7da517f6a5c472f46f67dd33bb6b95ccc919923':
  h264data: Move all data tables from a header to a .c file

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-24 11:54:53 +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
ecc31f6b08 h264: move ff_h264_check_intra[4x4]_pred_mode() to h264_parse
It is shared with svq3.
2016-03-28 09:53:56 +02:00
Diego Biurrun
a7da517f6a h264data: Move all data tables from a header to a .c file 2016-03-25 15:56:14 +01:00
Michael Niedermayer
e5655a32bc avcodec/h264_cabac: Check decode_cabac_mb_mvd() for failure
Fixes harmless integer overflow
Fixes Ticket5150

No speedloss measured, actually its slightly faster, but please benchmark & double check this

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-14 21:09:07 +01:00
Michael Niedermayer
8000d484b8 avcodec/cabac: Check initial cabac decoder state
Fixes integer overflows
Fixes: 1430e9c43fae47a24c179c7c54f94918/signal_sigsegv_421427_2340_591e9810c7b09efe501ad84638c9e9f8.264

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Found-by: xiedingbao (Ticket4727)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-27 13:52:47 +01:00
Vittorio Giovara
10aa6f9db4 h264: Use the correct argument context in debug log 2015-10-04 13:07:12 +02:00
Michael Niedermayer
d52a8bf158 avcodec/h264_cabac: Use ff_tlog() for block level information
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-26 00:58:51 +02:00
Michael Niedermayer
8f7b022c8c Merge commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25'
* commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25':
  lavc: Replace av_dlog and tprintf with internal macros

Conflicts:
	libavcodec/aacdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/bitstream.c
	libavcodec/dcadec.c
	libavcodec/dnxhddec.c
	libavcodec/dvbsubdec.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/get_bits.h
	libavcodec/gifdec.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_refs.c
	libavcodec/imc.c
	libavcodec/interplayvideo.c
	libavcodec/jpeglsdec.c
	libavcodec/libopencore-amr.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_parser.c
	libavcodec/pngdec.c
	libavcodec/ratecontrol.c
	libavcodec/rv10.c
	libavcodec/svq1dec.c
	libavcodec/vqavideo.c
	libavcodec/wmadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 04:10:10 +02:00
Vittorio Giovara
6a85dfc830 lavc: Replace av_dlog and tprintf with internal macros 2015-04-19 12:41:59 +01:00
Michael Niedermayer
563a8b4aac avcodec/h264_cabac: Drop local_ref_count
7966 -> 7897 decicycles

This basically switches to the implementation from f6f7d15041
which seems faster

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-22 14:39:32 +01:00
Michael Niedermayer
a6cb0534e2 Merge commit 'b53569e0681ff7bc99103ab4c961dbac3cc0fce6'
* commit 'b53569e0681ff7bc99103ab4c961dbac3cc0fce6':
  h264_cabac: remove now unnecessary H264Context function parameters

Conflicts:
	libavcodec/h264_cabac.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 23:13:25 +01:00
Michael Niedermayer
eb058a8dc5 Merge commit 'ba7e165b864d69da4f0c79ec7757cb351535002f'
* commit 'ba7e165b864d69da4f0c79ec7757cb351535002f':
  h264_cabac: constify all uses of H264Context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 18:19:24 +01:00
Michael Niedermayer
9d0450ae94 Merge commit 'e9b2383bf86b38ad18a001801aee20c8182e29bd'
* commit 'e9b2383bf86b38ad18a001801aee20c8182e29bd':
  h264: move mb_mbaff into the per-slice context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 18:07:01 +01:00
Michael Niedermayer
d511dc6530 Merge commit 'bc98e8c0e0a8babfea35c98855e366b29cbe1191'
* commit 'bc98e8c0e0a8babfea35c98855e366b29cbe1191':
  h264: move mb_field_decoding_flag into the per-slice context

Conflicts:
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 18:03:54 +01:00
Michael Niedermayer
d76559fb5f Merge commit 'd4d9068cdf8f4b2b87ae87a2ef880d243f77b977'
* commit 'd4d9068cdf8f4b2b87ae87a2ef880d243f77b977':
  h264: move mb_{x,y} into the per-slice context

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_mb.c
	libavcodec/h264_slice.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 16:46:15 +01:00
Michael Niedermayer
668c65e7e7 Merge commit '0edbe6faa7ef80daf0e84353cbe733389bf1a522'
* commit '0edbe6faa7ef80daf0e84353cbe733389bf1a522':
  h264: move mb_xy into the per-slice context

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_cabac.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 16:18:29 +01:00
Michael Niedermayer
04d23cf1c5 Merge commit 'a9b201cacf85d710b102010cb4baef97f00ea39b'
* commit 'a9b201cacf85d710b102010cb4baef97f00ea39b':
  h264: move cabac_init_idc into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 16:06:57 +01:00
Michael Niedermayer
ad6cee117e Merge commit 'bd3e460b73dd54a68dc253e010c239cefc8d8d55'
* commit 'bd3e460b73dd54a68dc253e010c239cefc8d8d55':
  h264: move direct_cache into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:58:50 +01:00
Michael Niedermayer
6a2e1ff02a Merge commit '6479c79f5517e2881bc881e737b2dbce69553878'
* commit '6479c79f5517e2881bc881e737b2dbce69553878':
  h264: move mvd_cache into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:58:05 +01:00
Michael Niedermayer
a4952e7343 Merge commit '5c8280c3075dd54f26752c3a1185647578421703'
* commit '5c8280c3075dd54f26752c3a1185647578421703':
  h264: move last_qscale_diff into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:48:53 +01:00
Michael Niedermayer
4c5c913dd8 Merge commit 'e7226984ac13aacb84eae77a372df8ff7685848f'
* commit 'e7226984ac13aacb84eae77a372df8ff7685848f':
  h264: move [{top,left}_]cbp into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:48:13 +01:00
Michael Niedermayer
f5d4d61824 Merge commit '30da98adbda6de1f55188f9058a3a5c715049633'
* commit '30da98adbda6de1f55188f9058a3a5c715049633':
  h264: move cabac[_state] into the per-slice context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:45:44 +01:00
Michael Niedermayer
739edc1a7e Merge commit 'bf03a878a76dea29b36f368759e9f66102b39a5f'
* commit 'bf03a878a76dea29b36f368759e9f66102b39a5f':
  h264: move mb[_{padding,luma_dc}] into the per-slice context

Conflicts:
	libavcodec/h264.h
	libavcodec/h264_cavlc.c
	libavcodec/h264_mb.c
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:36:57 +01:00
Michael Niedermayer
35a788d953 Merge commit 'b063582e0c4f775a8ba377488bd085595e0e7fae'
* commit 'b063582e0c4f775a8ba377488bd085595e0e7fae':
  h264: move intra_pcm_ptr into the per-slice context

Conflicts:
	libavcodec/h264.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:27:29 +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
4ffbeddd35 Merge commit 'ed451a08a46b2b07fd2dba3e55ffddd18ae6e3d6'
* commit 'ed451a08a46b2b07fd2dba3e55ffddd18ae6e3d6':
  h264: move sub_mb_type into the per-slice context

Conflicts:
	libavcodec/h264_cabac.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:37:55 +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
892a6d0028 Merge commit '99a35d1ccbb6b6cd260ce5c8369a897a79fe6a3a'
* commit '99a35d1ccbb6b6cd260ce5c8369a897a79fe6a3a':
  h264: move neighbor_transform_size into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:14:05 +01:00
Michael Niedermayer
f1436a7f96 Merge commit 'e6287f077c3e8e4aca11e61dd4bade1351439e6b'
* commit 'e6287f077c3e8e4aca11e61dd4bade1351439e6b':
  h264: move {mv,ref}_cache into the per-slice context

Conflicts:
	libavcodec/h264_cabac.c
	libavcodec/h264_mb.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:06:30 +01:00
Michael Niedermayer
b7e0356cc3 Merge commit 'f69574cf7aca4fe4d57a2155e925f37fc863474d'
* commit 'f69574cf7aca4fe4d57a2155e925f37fc863474d':
  h264: move non_zero_count_cache into the per-slice context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:02:02 +01:00
Michael Niedermayer
6ec279b54c Merge commit '64c81b2cd0dcf1fe66c381a5d2c707dddcf35a7e'
* commit '64c81b2cd0dcf1fe66c381a5d2c707dddcf35a7e':
  h264: move *_samples_available into the per-slice context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 13:59:16 +01:00