Commit Graph

101 Commits

Author SHA1 Message Date
Andreas Rheinhardt 5d63bd5b9c avcodec/h264dec: Move inline functions only used by CABAC/CAVLC code
Most of the inline functions in h264dec.h are only used
by h264_cavlc.c and h264_cabac.c. Therefore move them
to the common header for these two, namely h264_mvpred.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt c3ff716808 avcodec/h264_*: Remove unnecessary internal.h inclusions
Also remove some other unnecessary headers while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-26 15:30:54 +01:00
Anton Khirnov e15371061d lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
They are not properly namespaced and not intended for public use.
2021-01-01 14:14:57 +01:00
Michael Niedermayer 222c9f031d avcodec/h264_mvpred: Fix runtime error: left shift of negative value -1
Fixes: 734/clusterfuzz-testcase-4821293192970240

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-09 23:28:10 +01:00
Michael Niedermayer ab998f4c7f avcodec/h264_mvpred: Fix multiple runtime error: left shift of negative value
Fixes: 710/clusterfuzz-testcase-5091051431788544

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-04 17:48:04 +01: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 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 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
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
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
Michael Niedermayer 53fd70579b avcodec/h264_mvpred: Fix undefined shifts in MAP_F2F
Fixes: asan_heap-oob_17301a3_2100_cov_3226131691_ff_add_pixels_clamped_mmx.m2ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 15:53:15 +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 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 bc5383e6c4 Merge commit '3bea6409a1868354a1d29b34de424c3636c222b7'
* commit '3bea6409a1868354a1d29b34de424c3636c222b7':
  h264_mvpred: constify all uses of H264Context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 17:21:44 +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 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 c9841c05be Merge commit 'a67f8ae9a2c8529bf6a635e8ca4e3483592708b1'
* commit 'a67f8ae9a2c8529bf6a635e8ca4e3483592708b1':
  h264: move mvd_table into the per-slice context

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 15:57:21 +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 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 a8ac4c9b06 Merge commit '066aafced4dc6c7c9e7b37082635472249f1e93e'
* commit '066aafced4dc6c7c9e7b37082635472249f1e93e':
  h264: move direct_spatial_mv_pred into the per-slice context

Conflicts:
	libavcodec/h264_mvpred.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:38:59 +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
Michael Niedermayer 6abd1e901c Merge commit '7d8154edd594981e7891d57de91f2260f8a62939'
* commit '7d8154edd594981e7891d57de91f2260f8a62939':
  h264: move intra4x4_pred_mode[_cache] into the per-slice context

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 13:44:38 +01:00
Michael Niedermayer 61635c7a88 Merge commit '8b00f4df20f4a8ab0656fdaf7d00233a6515a052'
* commit '8b00f4df20f4a8ab0656fdaf7d00233a6515a052':
  h264: move some neighbour information into the per-slice context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 13:42:44 +01:00
Michael Niedermayer c07b7e483a Merge commit '5355ed6b20e941430c4f8fb82644e87a65366d61'
* commit '5355ed6b20e941430c4f8fb82644e87a65366d61':
  h264: move {prev,next}_mb_skipped into the per-slice context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 13:35:05 +01:00
Michael Niedermayer c27f53b9fb Merge commit 'd231e84b06a9964c840cff4e228509f706165fb6'
* commit 'd231e84b06a9964c840cff4e228509f706165fb6':
  h264: move the quantizers into the per-slice context

Conflicts:
	libavcodec/dxva2_h264.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 13:24:23 +01:00
Anton Khirnov bc98e8c0e0 h264: move mb_field_decoding_flag into the per-slice context 2015-03-21 11:27:15 +01:00
Anton Khirnov 3bea6409a1 h264_mvpred: constify all uses of H264Context
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
2015-03-21 11:27:15 +01:00
Anton Khirnov d4d9068cdf h264: move mb_{x,y} into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov 0edbe6faa7 h264: move mb_xy into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov bd3e460b73 h264: move direct_cache into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov 6479c79f55 h264: move mvd_cache into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov a67f8ae9a2 h264: move mvd_table into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov e7226984ac h264: move [{top,left}_]cbp into the per-slice context 2015-03-21 11:27:13 +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 066aafced4 h264: move direct_spatial_mv_pred 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 99a35d1ccb h264: move neighbor_transform_size into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov e6287f077c h264: move {mv,ref}_cache into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov f69574cf7a h264: move non_zero_count_cache into the per-slice context 2015-03-21 11:27:12 +01:00
Anton Khirnov 64c81b2cd0 h264: move *_samples_available into the per-slice context 2015-03-21 11:27:12 +01:00
Anton Khirnov 7d8154edd5 h264: move intra4x4_pred_mode[_cache] into the per-slice context 2015-03-21 11:27:12 +01:00
Anton Khirnov 8b00f4df20 h264: move some neighbour information into the per-slice context 2015-03-21 11:27:12 +01:00