1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-26 06:01:30 +02:00
Commit Graph

77 Commits

Author SHA1 Message Date
Michael Niedermayer
0faf04e807 avcodec/snowdec: Maintain avmv buffer
This avoids reallocating per frame

Fixes: Assertion failure
Fixes: 36359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6733238591684608
Fixes: 38623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6098656512573440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-19 22:36:23 +02:00
Andreas Rheinhardt
a7f4abbc62 avcodec/snow: Hardcode table to save space
The size of ff_qexp is only 32 bytes, but the code to generate it at
runtime takes 47 bytes (GCC 9.3, x64, -O3 in an av_cold function); so
just hardcode it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
James Almer
95a6de5674 avcodec/snowenc: fix setting motion_est option
Remove usage of FF_MPV_COMMON_OPTS, and set SnowContext.motion_est directly.
Based on code from svq1enc.c

Signed-off-by: James Almer <jamrial@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-28 21:27:01 -03:00
Michael Niedermayer
b9c032ebc0 avcodec/snow: Fix runtime error: signed integer overflow: 1086573993 + 1086573994 cannot be represented in type 'int'
Fixes: 1871/clusterfuzz-testcase-minimized-5719950331215872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-28 17:13:07 +02:00
Michael Niedermayer
4efbeadadc avcodec/snow: Document BlockNode
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-17 21:48:34 +02:00
Michael Niedermayer
737f06577c avcodec/snow: Remove unused function
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-17 21:48:34 +02:00
Derek Buitenhuis
f3af379b5c Merge commit '2862b63783b5556f7f3fb2d097629bc6879f833a'
* commit '2862b63783b5556f7f3fb2d097629bc6879f833a':
  lavc: Move prediction_method to codec private options

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-03 16:49:19 +00:00
Derek Buitenhuis
e8c5d5f429 snow: Move scenechange_threshold to a private option
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-28 15:36:06 +00:00
Hendrik Leppkes
5fa5e73e81 Merge commit '1aa24df74c052a73175c43e57d35b4835e537ec8'
* commit '1aa24df74c052a73175c43e57d35b4835e537ec8':
  lavu: Deprecate AVFrame.error[]

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-03 09:52:39 +02:00
Michael Niedermayer
b2955b6c5a avcodec/rangecoder: Check e
Fixes hang.nut

Found-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-25 14:36:41 +02:00
Michael Niedermayer
55b803e33e avcodec/snowenc: Remove unused new_picture field
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-20 23:26:39 +02:00
Michael Niedermayer
4bd99f715d avcodec/snowenc: Support setting the iterative dia size separately
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-30 04:23:30 +02:00
Michael Niedermayer
16df02fd2e avcodec/snowenc: Avoid use of deprecated me_method
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-09 14:33:31 +02:00
Andreas Cadhalpun
3526a120f9 snow: remove an obsolete av_assert2
It asserts that the frame linesize is larger than 37, but it can be
smaller and decoding such frames works.

Before commit cc884a35 src_stride > 7*MB_SIZE was necessary, because the
blocks were interleaved in the tmp buffer and the last block was added
with an offset of 6*MB_SIZE.
It was changed for src_stride <= 7*MB_SIZE to write the blocks
sequentially, hence the larger tmp_step.
After that the assert was only necessary to make sure that the buffer
remained large enough.
Since commit bd2b6b33 s->scratchbuf is used as tmp buffer.
As part of commit 86e107a7 the minimal scratchbuf size was increased to
256*7*MB_SIZE, which is enough for any src_stride <= 7*MB_SIZE.

Also add a comment explaining the tmp_step calculation.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-07-10 16:21:50 +02:00
Michael Niedermayer
b62297805b avcodec/snowenc: add intra_penalty AVOption
This allows favoring intra or inter blocks by a user specified amount.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-09 23:52:36 +02:00
Michael Niedermayer
7873f9aa72 avcodec/snowdec: AVMotionVector support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-20 01:16:25 +01:00
Michael Niedermayer
bf301258b4 avcodec/snowenc: add FF_MPV_COMMON_OPTS
This fixes the ratecontrol code with snow
adding FF_MPV_COMMON_OPTS is needed as the generic rate control options
are currently in the (unrelated) MpegEncContext

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-18 19:41:48 +02:00
Michael Niedermayer
3a7f9db180 avcodec/snow: Make block argumrnt of ff_snow_pred_block() const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-22 18:06:56 +02:00
Michael Niedermayer
35a9959aca avcodec/snow: make new_picture const
Fixes "assignment discards const qualifier from pointer target type"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-09 21:02:37 +02:00
Michael Niedermayer
596636a474 avcodec/snow: check coeffs for validity
Fixes deadlock
Fixes integer overflow
Fixes Ticket 3892

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-30 02:12:10 +02:00
Michael Niedermayer
3a2d1465c8 Merge commit '2d60444331fca1910510038dd3817bea885c2367'
* commit '2d60444331fca1910510038dd3817bea885c2367':
  dsputil: Split motion estimation compare bits off into their own context

Conflicts:
	configure
	libavcodec/Makefile
	libavcodec/arm/Makefile
	libavcodec/dvenc.c
	libavcodec/error_resilience.c
	libavcodec/h264.h
	libavcodec/h264_slice.c
	libavcodec/me_cmp.c
	libavcodec/me_cmp.h
	libavcodec/motion_est.c
	libavcodec/motion_est_template.c
	libavcodec/mpeg4videoenc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/x86/Makefile
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-17 23:27:40 +02:00
Michael Niedermayer
3790801f9c Merge commit '3c650efb81aaa3b395ba4606ee68a47ee4efb57b'
* commit '3c650efb81aaa3b395ba4606ee68a47ee4efb57b':
  dsputil: Move draw_edges() to mpegvideoencdsp

Conflicts:
	libavcodec/mpegvideo_enc.c
	libavcodec/x86/Makefile
	libavcodec/x86/dsputil_init.c
	libavcodec/x86/dsputil_mmx.c
	libavcodec/x86/dsputil_x86.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-07 16:17:27 +02:00
Michael Niedermayer
b96c9513f3 avcodec/snow: factor ff_snow_get_buffer() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-27 04:49:09 +02:00
Michael Niedermayer
98a6806fdd Merge commit '368f50359eb328b0b9d67451f56fda20b3255f9a'
* commit '368f50359eb328b0b9d67451f56fda20b3255f9a':
  dsputil: Split off quarterpel bits into their own context

Conflicts:
	configure
	libavcodec/dsputil.c
	libavcodec/h263dec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/vc1dec.c
	libavcodec/vc1dsp.c
	libavcodec/x86/dsputil_init.c
	libavcodec/x86/qpeldsp.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-30 02:43:34 +02:00
Michael Niedermayer
61d59703c9 avcodec/snow: split block clipping checks
Fixes out of array read
Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-18 02:54:18 +01:00
Ronald S. Bultje
c341f734e5 Convert multiplier for MV from int to ptrdiff_t.
This prevents emulated_edge_mc from not undoing mvy*stride-related
integer overflows.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-28 11:28:09 +02:00
Michael Niedermayer
c4224fff1b avcodec/snow: gray support
Fixes Ticket839

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-29 22:52:04 +02:00
Michael Niedermayer
cf06dee58d libavcodec/snow: change AVFrame to pointers to AVFrame for ABI stability
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-29 19:46:52 +02:00
Ronald S. Bultje
771ba8f206 snow: use hpeldsp instead of dsputil for half-pel functions. 2013-03-13 03:58:49 +01:00
Michael Niedermayer
fc13a89654 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dsputil: Separate h264 qpel

Conflicts:
	libavcodec/dsputil_template.c
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-24 15:47:47 +01:00
Michael Niedermayer
30981a966f lavc: split snow and dirac DWTs
There is only about 4 lines of common code, so it alot cleaner
when seperated.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 22:59:05 +01:00
Diego Biurrun
a0c5917f86 Drop Snow codec
Snow is a toy codec with no real-world use and horrible code.
2013-01-06 16:30:02 +01:00
Luca Barbato
d615da60c1 snow: use VideoDSPContext
It was left over from the initial conversion.
2012-12-29 18:05:49 +01:00
Michael Niedermayer
a41bf09d9c Merge commit '6906b19346ae8a330bfaa1c16ce535be10789723'
* commit '6906b19346ae8a330bfaa1c16ce535be10789723':
  lavc: add missing files for arm
  lavc: introduce VideoDSPContext

Conflicts:
	configure
	libavcodec/arm/dsputil_init_armv5te.c
	libavcodec/dsputil.c
	libavcodec/dsputil.h
	libavcodec/dsputil_template.c
	libavcodec/h264.c
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c
	libavcodec/x86/dsputil_mmx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-21 17:18:43 +01:00
Michael Niedermayer
6ecf1eb0dd snowdec: add 2 av_asserts to check run validity
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-16 01:35:10 +02:00
Michael Niedermayer
4a596d19ff snowdec: check log in get_symbol2()
Fixes Ticket1635

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-16 01:31:19 +02:00
Michael Niedermayer
86e107a7d4 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  cosmetics: Consistently use C-style comments with multiple inclusion guards
  anm: fix a few Doxygen comments
  misc typo and wording fixes
  attributes: add av_noreturn
  attributes: drop pointless define guards
  configure: do not disable av_always_inline with --enable-small
  flvdec: initial stream switch support
  avplay: fix write on freed memory for rawvideo
  snow: remove a VLA used for edge emulation
  x86: lavfi: fix gradfun/yadif build with mmx/sse disabled
  snow: remove the runs[] VLA.
  snow: Check mallocs at init
  flacdec: remove redundant setting of avctx->sample_fmt

Conflicts:
	ffplay.c
	libavcodec/h264.c
	libavcodec/snow.c
	libavcodec/snow.h
	libavcodec/snowdec.c
	libavcodec/snowenc.c
	libavformat/flvdec.c
	libavutil/attributes.h
	tools/patcheck

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-04 00:32:31 +02:00
Ronald S. Bultje
3389545157 snow: remove a VLA used for edge emulation
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-03 16:31:23 +03:00
Ronald S. Bultje
cbd9b2f918 snow: remove the runs[] VLA.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-03 12:16:46 +03:00
Michael Niedermayer
f8fe4d2295 snow.h: use av_assert
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-23 21:12:29 +02:00
Michael Niedermayer
68c845cdba snow: yuv444 support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-22 15:46:13 +02:00
Michael Niedermayer
82edf6727f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavr: add x86-optimized functions for mixing 1-to-2 s16p with flt coeffs
  lavr: add x86-optimized functions for mixing 1-to-2 fltp with flt coeffs
  Add Dolby/DPLII downmix support to libavresample
  vorbisdec: replace div/mod in loop with a counter
  fate: vorbis: add 5.1 surround test
  rtpenc: Allow requesting H264 RTP packetization mode 0
  configure: Sort the library listings in the help text alphabetically
  dwt: remove variable-length arrays
  RTMPT protocol support
  http: Properly handle chunked transfer-encoding for replies to post data
  http: Fail reading if the connection has gone away
  amr: Mark an array const
  amr: More space cleanup
  rtpenc: Fix memory leaks in the muxer open function

Conflicts:
	Changelog
	configure
	doc/APIchanges
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-18 20:07:00 +02:00
Ronald S. Bultje
d9669eab0b dwt: remove variable-length arrays
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-17 23:20:10 +01:00
Michael Niedermayer
87c1783c77 snowenc: move runs from stack to heap.
Fixes ticket1082

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-19 22:37:06 +01:00
Reimar Döffinger
6fe8cb7d70 snowenc: add no_bitstream option.
This allows making e.g. MPlayer's -vf uspp filter about 20% faster.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-03-10 20:17:11 +01:00
Michael Niedermayer
6cb2085278 Merge remote-tracking branch 'qatar/master'
* qatar/master: (27 commits)
  ppc: Add ff_ prefix to nonstatic symbols
  sh4: Add ff_ prefix to nonstatic symbols
  mpegvideo: Add ff_ prefix to nonstatic functions
  rtjpeg: Add ff_ prefix to nonstatic symbols
  rv: Add ff_ prefix to nonstatic symbols
  vp56: Add ff_ prefix to nonstatic symbols
  vorbis: Add ff_ prefix to nonstatic symbols
  msmpeg4: Add ff_ prefix to nonstatic symbols
  vc1: Add ff_ prefix to nonstatic symbols
  msmpeg4: Add ff_ prefixes to nonstatic symbols
  snow: Add ff_ prefix to nonstatic symbols
  mpeg12: Add ff_ prefix to nonstatic symbols
  mpeg4: Add ff_ prefixes to nonstatic symbols
  lagarith: Add ff_ prefix to lag_rac_init
  libavcodec: Add ff_ prefix to j_rev_dct*
  dsputil: Add ff_ prefix to inv_zigzag_direct16
  libavcodec: Prefix fdct_ifast, fdct_ifast248
  dsputil: Add ff_ prefix to the dsputil*_init* functions
  libavcodec: Add ff_ prefix to some nonstatic symbols
  vlc/rl: Add ff_ prefix to the nonstatic symbols
  ...

Conflicts:
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/dnxhddec.c
	libavcodec/ffv1.c
	libavcodec/h263.h
	libavcodec/h263dec.c
	libavcodec/h264.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/nuv.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/proresdsp.c
	libavcodec/svq3.c
	libavcodec/version.h
	libavformat/dv.h
	libavformat/dvenc.c
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-16 01:34:37 +01:00
Martin Storsjö
35e02a3d0e snow: Add ff_ prefix to nonstatic symbols
This allows getting rid of a hack for conflicting symbol/define
names.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:58 +02:00
Michael Niedermayer
5c15b78e4a Merge remote-tracking branch 'qatar/master'
* qatar/master: (42 commits)
  swscale: fix signed overflow in yuv2mono_X_c_template
  snow: fix integer overflows
  svq1enc: remove stale altivec-related hack
  snow: fix signed overflow in byte to 32-bit replication
  adx: rename ff_adx_decode_header() to avpriv_adx_decode_header()
  avformat: add CRI ADX format demuxer
  adx: add an ADX parser.
  adx: move header decoding to ADX common code
  adx: calculate the number of blocks in a packet
  adx: define and use 2 new macro constants BLOCK_SIZE and BLOCK_SAMPLES
  adx: check for unsupported ADX formats
  adx: simplify encoding by using put_sbits()
  adx: calculate correct LPC coeffs
  adx: use 12-bit coefficients instead of 14-bit to avoid integer overflow
  adx: simplify adx_decode() by using get_sbits() to read residual samples
  adx: fix the data offset parsing in adx_decode_header()
  adx: remove unneeded post-decode channel interleaving
  adx: validate header values
  adx: cosmetics: general pretty-printing and comment clean-up
  adx: remove useless comments
  ...

Conflicts:
	Changelog
	libavcodec/cook.c
	libavcodec/fraps.c
	libavcodec/nuv.c
	libavcodec/pthread.c
	libavcodec/version.h
	libavformat/Makefile
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-27 00:30:13 +01:00
Mans Rullgard
8540dcfd7a snow: fix integer overflows
The way these values are used, they should have an unsigned type.
A similar change was made for mpegvideo in cb66847.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-11-26 22:53:47 +00:00
Michael Niedermayer
92afb43162 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  snow: split snow in snowdec and snowenc
  tiffenc: deprecate using compression_level
  swscale: fix failing fate tests.
  swscale: add support for planar RGB input.
  h264: add support for decoding planar RGB images.
  Clean up swscale pixfmt macros using av_pix_fmt_descriptors[].
  pixfmt: add planar RGB formats.

Conflicts:
	libavcodec/h264.c
	libavcodec/snow.c
	libavcodec/utils.c
	libavutil/avutil.h
	libavutil/pixdesc.c
	libavutil/pixfmt.h
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/swscale_unscaled.c
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-25 04:34:44 +01:00