Commit Graph

31 Commits

Author SHA1 Message Date
Michael Niedermayer 8b55591757 avcodec/h264_mc_template: Only prefetch motion if the list is used.
Fixes: index 59 out of bounds for type 'H264Ref [48]'
Fixes: 8232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5703295145345024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-11 00:51:20 +02: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
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 0ab1816315 Merge commit '56087ec0a29314d1860f6f0e6f40fbb9b40feccd'
* commit '56087ec0a29314d1860f6f0e6f40fbb9b40feccd':
  h264: drop a pointless indirection

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-20 12:31:29 +02:00
Derek Buitenhuis ee38234c43 Merge commit 'e481458bc308ee838deaeacac51929514762e7a7'
* commit 'e481458bc308ee838deaeacac51929514762e7a7':
  h264: factor out pred weight table parsing into a separate file

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-26 15:04:29 +01:00
Anton Khirnov 56087ec0a2 h264: drop a pointless indirection 2016-04-24 10:06:25 +02:00
Anton Khirnov e481458bc3 h264: factor out pred weight table parsing into a separate file
This will allow decoupling the parser from the decoder.
2016-03-28 09:48:31 +02:00
Michael Niedermayer c8ea57664f avcodec/h264_mc_template: prefetch list1 only if it is used in the MB
Fixes ubsan warning
Fixes Mozilla bug 1230276

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-18 00:54:37 +01:00
Michael Niedermayer a0b39747b7 Merge commit '6490a0c0fbe0e55f765ea2aa2e8495181ea1f719'
* commit '6490a0c0fbe0e55f765ea2aa2e8495181ea1f719':
  h264_mb: constify all uses of H264Context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 17:23:10 +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 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 2cc08cad9e Merge commit '5f390eef8ee2b8adab00c5d2923a52aa261eb999'
* commit '5f390eef8ee2b8adab00c5d2923a52aa261eb999':
  h264: move mb_[uv]linesize into the per-slice context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 14:16:29 +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 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 6490a0c0fb h264_mb: 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 ed451a08a4 h264: move sub_mb_type into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov 5f390eef8e h264: move mb_[uv]linesize 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 92c6c2a605 h264: split weighted pred-related vars into per-slice context 2015-03-21 11:27:09 +01:00
Michael Niedermayer 0371eaebcd Merge commit 'aba70bb5387f12dfa5e6cd8cb861c9c7e668151f'
* commit 'aba70bb5387f12dfa5e6cd8cb861c9c7e668151f':
  Add missing headers to make template files compile (more) standalone

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 14:50:55 +01:00
Diego Biurrun aba70bb538 Add missing headers to make template files compile (more) standalone 2014-03-26 04:31:27 -07:00
Michael Niedermayer 80e9e63c94 Merge commit '759001c534287a96dc96d1e274665feb7059145d'
* commit '759001c534287a96dc96d1e274665feb7059145d':
  lavc decoders: work with refcounted frames.

Anton Khirnov (1):
      lavc decoders: work with refcounted frames.

Clément Bœsch (47):
      lavc/ansi: reset file
      lavc/ansi: re-do refcounted frame changes from Anton
      fraps: reset file
      lavc/fraps: switch to refcounted frames
      gifdec: reset file
      lavc/gifdec: switch to refcounted frames
      dsicinav: resolve conflicts
      smc: resolve conflicts
      zmbv: resolve conflicts
      rpza: resolve conflicts
      vble: resolve conflicts
      xxan: resolve conflicts
      targa: resolve conflicts
      vmnc: resolve conflicts
      utvideodec: resolve conflicts
      tscc: resolve conflicts
      ulti: resolve conflicts
      ffv1dec: resolve conflicts
      dnxhddec: resolve conflicts
      v210dec: resolve conflicts
      vp3: resolve conflicts
      vcr1: resolve conflicts
      v210x: resolve conflicts
      wavpack: resolve conflicts
      pngdec: fix compilation
      roqvideodec: resolve conflicts
      pictordec: resolve conflicts
      mdec: resolve conflicts
      tiertexseqv: resolve conflicts
      smacker: resolve conflicts
      vb: resolve conflicts
      vqavideo: resolve conflicts
      xl: resolve conflicts
      tmv: resolve conflicts
      vmdav: resolve conflicts
      truemotion1: resolve conflicts
      truemotion2: resolve conflicts
      lcldec: fix compilation
      libcelt_dec: fix compilation
      qdrw: fix compilation
      r210dec: fix compilation
      rl2: fix compilation
      wnv1: fix compilation
      yop: fix compilation
      tiff: resolve conflicts
      interplayvideo: fix compilation
      qpeg: resolve conflicts (FIXME/TESTME).

Hendrik Leppkes (33):
      012v: convert to refcounted frames
      8bps: fix compilation
      8svx: resolve conflicts
      4xm: resolve conflicts
      aasc: resolve conflicts
      bfi: fix compilation
      aura: fix compilation
      alsdec: resolve conflicts
      avrndec: convert to refcounted frames
      avuidec: convert to refcounted frames
      bintext: convert to refcounted frames
      cavsdec: resolve conflicts
      brender_pix: convert to refcounted frames
      cinepak: resolve conflicts
      cinepak: avoid using AVFrame struct directly in private context
      cljr: fix compilation
      cpia: convert to refcounted frames
      cscd: resolve conflicts
      iff: resolve conflicts and do proper conversion to refcounted frames
      4xm: fix reference frame handling
      cyuv: fix compilation
      dxa: fix compilation
      eacmv: fix compilation
      eamad: fix compilation
      eatgv: fix compilation
      escape124: remove unused variable.
      escape130: convert to refcounted frames
      evrcdec: convert to refcounted frames
      exr: convert to refcounted frames
      mvcdec: convert to refcounted frames
      paf: properly free the frame data on decode close
      sgirle: convert to refcounted frames
      lavfi/moviesrc: use refcounted frames

Michael Niedermayer (56):
      Merge commit '759001c534287a96dc96d1e274665feb7059145d'
      resolve conflicts in headers
      motion_est: resolve conflict
      mpeg4videodec: fix conflicts
      dpcm conflict fix
      dpx: fix conflicts
      indeo3: resolve confilcts
      kmvc: resolve conflicts
      kmvc: resolve conflicts
      h264: resolve conflicts
      utils: resolve conflicts
      rawdec: resolve conflcits
      mpegvideo: resolve conflicts
      svq1enc: resolve conflicts
      mpegvideo: dont clear data, fix assertion failure on fate vsynth1 with threads
      pthreads: resolve conflicts
      frame_thread_encoder: simple compilefix not yet tested
      snow: update to buffer refs
      crytsalhd: fix compile
      dirac: switch to new API
      sonic: update to new API
      svq1: resolve conflict, update to new API
      ffwavesynth: update to new buffer API
      g729: update to new API
      indeo5: fix compile
      j2kdec: update to new buffer API
      linopencore-amr: fix compile
      libvorbisdec: update to new API
      loco: fix compile
      paf: update to new API
      proresdec: update to new API
      vp56: update to new api / resolve conflicts
      xface: convert to refcounted frames
      xan: fix compile&fate
      v408: update to ref counted buffers
      v308: update to ref counted buffers
      yuv4dec: update to ref counted buffers
      y41p: update to ref counted frames
      xbm: update to refcounted frames
      targa_y216: update to refcounted buffers
      qpeg: fix fate/crash
      cdxl: fix fate
      tscc: fix reget buffer useage
      targa_y216dec: fix style
      msmpeg4: fix fate
      h264: ref_picture() copy fields that have been lost too
      update_frame_pool: use channel field
      h264: Put code that prevents deadlocks back
      mpegvideo: dont allow last == current
      wmalossless: fix buffer ref messup
      ff_alloc_picture: free tables in case of dimension mismatches
      h264: fix null pointer dereference and assertion failure
      frame_thread_encoder: update to bufrefs
      ec: fix used arrays
      snowdec: fix off by 1 error in dimensions check
      h264: disallow single unpaired fields as references of frames

Paul B Mahol (2):
      lavc/vima: convert to refcounted frames
      sanm: convert to refcounted frames

Conflicts:
	libavcodec/4xm.c
	libavcodec/8bps.c
	libavcodec/8svx.c
	libavcodec/aasc.c
	libavcodec/alsdec.c
	libavcodec/anm.c
	libavcodec/ansi.c
	libavcodec/avs.c
	libavcodec/bethsoftvideo.c
	libavcodec/bfi.c
	libavcodec/c93.c
	libavcodec/cavsdec.c
	libavcodec/cdgraphics.c
	libavcodec/cinepak.c
	libavcodec/cljr.c
	libavcodec/cscd.c
	libavcodec/dnxhddec.c
	libavcodec/dpcm.c
	libavcodec/dpx.c
	libavcodec/dsicinav.c
	libavcodec/dvdec.c
	libavcodec/dxa.c
	libavcodec/eacmv.c
	libavcodec/eamad.c
	libavcodec/eatgq.c
	libavcodec/eatgv.c
	libavcodec/eatqi.c
	libavcodec/error_resilience.c
	libavcodec/escape124.c
	libavcodec/ffv1.h
	libavcodec/ffv1dec.c
	libavcodec/flicvideo.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/g723_1.c
	libavcodec/gifdec.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_direct.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_refs.c
	libavcodec/huffyuvdec.c
	libavcodec/idcinvideo.c
	libavcodec/iff.c
	libavcodec/indeo2.c
	libavcodec/indeo3.c
	libavcodec/internal.h
	libavcodec/interplayvideo.c
	libavcodec/ivi_common.c
	libavcodec/jvdec.c
	libavcodec/kgv1dec.c
	libavcodec/kmvc.c
	libavcodec/lagarith.c
	libavcodec/libopenjpegdec.c
	libavcodec/mdec.c
	libavcodec/mimic.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mmvideo.c
	libavcodec/motion_est.c
	libavcodec/motionpixels.c
	libavcodec/mpc7.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo.h
	libavcodec/msrle.c
	libavcodec/msvideo1.c
	libavcodec/nuv.c
	libavcodec/options_table.h
	libavcodec/pcx.c
	libavcodec/pictordec.c
	libavcodec/pngdec.c
	libavcodec/pnmdec.c
	libavcodec/pthread.c
	libavcodec/qpeg.c
	libavcodec/qtrle.c
	libavcodec/r210dec.c
	libavcodec/rawdec.c
	libavcodec/roqvideodec.c
	libavcodec/rpza.c
	libavcodec/smacker.c
	libavcodec/smc.c
	libavcodec/svq1dec.c
	libavcodec/svq1enc.c
	libavcodec/targa.c
	libavcodec/tiertexseqv.c
	libavcodec/tiff.c
	libavcodec/tmv.c
	libavcodec/truemotion1.c
	libavcodec/truemotion2.c
	libavcodec/tscc.c
	libavcodec/ulti.c
	libavcodec/utils.c
	libavcodec/utvideodec.c
	libavcodec/v210dec.c
	libavcodec/v210x.c
	libavcodec/vb.c
	libavcodec/vble.c
	libavcodec/vcr1.c
	libavcodec/vmdav.c
	libavcodec/vmnc.c
	libavcodec/vp3.c
	libavcodec/vp56.c
	libavcodec/vp56.h
	libavcodec/vp6.c
	libavcodec/vqavideo.c
	libavcodec/wavpack.c
	libavcodec/xl.c
	libavcodec/xxan.c
	libavcodec/zmbv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-12 03:23:28 +01:00
Anton Khirnov 759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Michael Niedermayer b7fe35c9e5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: deMpegEncContextize

Conflicts:
	libavcodec/dxva2_h264.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb_template.c
	libavcodec/h264_parser.c
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c
	libavcodec/h264_sei.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 23:30:09 +01:00
Anton Khirnov 2c54155407 h264: deMpegEncContextize
Most of the changes are just trivial are just trivial replacements of
fields from MpegEncContext with equivalent fields in H264Context.
Everything in h264* other than h264.c are those trivial changes.

The nontrivial parts are:
1) extracting a simplified version of the frame management code from
   mpegvideo.c. We don't need last/next_picture anymore, since h264 uses
   its own more complex system already and those were set only to appease
   the mpegvideo parts.
2) some tables that need to be allocated/freed in appropriate places.
3) hwaccels -- mostly trivial replacements.
   for dxva, the draw_horiz_band() call is moved from
   ff_dxva2_common_end_frame() to per-codec end_frame() callbacks,
   because it's now different for h264 and MpegEncContext-based
   decoders.
4) svq3 -- it does not use h264 complex reference system, so I just
   added some very simplistic frame management instead and dropped the
   use of ff_h264_frame_start(). Because of this I also had to move some
   initialization code to svq3.

Additional fixes for chroma format and bit depth changes by
Janne Grunau <janne-libav@jannau.net>

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-15 16:35:16 +01:00
Michael Niedermayer b0c51bbcd1 h264_mc_template: switch to av_assert
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-01 04:19:46 +02:00
Michael Niedermayer 24823a761c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  qdm2: remove broken and disabled dump_context() debug function
  x86: h264_intrapred: use newly introduced SPLAT* and PSHUFLW macros
  x86inc: add SPLATB_LOAD, SPLATB_REG, PSHUFLW macros
  x86inc: modify ALIGN to not generate long nops on i586
  x86: h264_intrapred: port to cpuflag macros
  avplay: update input filter pointer when the filtergraph is reset.
  avconv: fix parsing of -force_key_frames option.
  h264: use templates to avoid excessive inlining
  xtea: Make the count parameter match the documentation
  blowfish: Make the count parameter match the documentation
  mpegvideo: Don't use ff_mspel_motion() for vc1
  xtea: invert branch and loop precedence
  blowfish: invert branch and loop precedence
  flvdec: optionally trust the metadata
  avconv: Set audio filter time base to the sample rate
  vp8: Add ifdef guards around the sse2 loopfilter in the sse2slow branch too

Conflicts:
	ffmpeg.c
	ffplay.c
	libavcodec/h264.c
	libavcodec/mpegvideo_common.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-05 21:55:31 +02:00
Mans Rullgard 28fff0d974 h264: use templates to avoid excessive inlining
Instead of inlining everything into ff_h264_hl_decode_mb(), use
explicit templating to create versions of the called functions
with constant parameters filled in.  This greatly speeds up
compilation of h264.c and reduces the code size without any
measurable impact on performance.

Compilation time for h264.c on an i7 goes from 30s to 5.5s.
Code size is reduced by 430kB.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-05 11:50:18 +01:00