Commit Graph

76 Commits

Author SHA1 Message Date
Nekopanda f4d5d7e8de avcodec/mpeg2dec: Fix motion vector rounding for chroma components
In 16x8 motion compensation, for lower 16x8 region, the input to mpeg_motion() for motion_y was "motion_y + 16", which causes wrong rounding. For 4:2:0, chroma scaling for y is dividing by two and rounding toward zero. When motion_y < 0 and motion_y + 16 > 0, the rounding direction of "motion_y" and "motion_y + 16" is different and rounding "motion_y + 16" would be incorrect.

We should input "motion_y" as is to round correctly. I add "is_16x8" flag to do that.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-11 12:04:47 +01:00
Clément Bœsch adef752f1b Merge commit '0e285c2f908789e96e29bfd969ad5eaaa0eece65'
* commit '0e285c2f908789e96e29bfd969ad5eaaa0eece65':
  mpegvideo: Kill some disabled code

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-19 16:07:30 +01:00
Michael Niedermayer 6179dc8aa7 avcodec/mpeg4video: Fix runtime error: left shift of negative value
Fixes: 644/clusterfuzz-testcase-4726434209726464
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-22 02:42:48 +01:00
Michael Niedermayer 2c9106257f avcodec/mpeg4videodec: Workaround interlaced mpeg4 edge MC bug
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-17 12:21:48 +01:00
Michael Niedermayer 85407c7e63 avcodec/mpegvideo: Fix edge emu buffer overlap with interlaced mpeg4
Fixes Ticket5936
Regression since c5fc8ae126

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-17 12:21:48 +01:00
Diego Biurrun 0e285c2f90 mpegvideo: Kill some disabled code 2016-08-17 12:16:42 +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
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 d3e1c6f975 Merge commit '0242351390643d176b10600c2eb854414f9559e6'
* commit '0242351390643d176b10600c2eb854414f9559e6':
  mpegvideo: Fix undefined negative shifts in mpeg_motion_internal

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-13 16:29:12 +01:00
Luca Barbato 0242351390 mpegvideo: Fix undefined negative shifts in mpeg_motion_internal
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-03-05 08:26:36 -05:00
Luca Barbato 39a2d3288e mpegvideo: Refactor emulated_edge_mc calls 2016-03-05 08:26:36 -05: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 db8ae37a78 Merge commit 'da0c8664b4dc906696803685f7e53ade68594ab8'
* commit 'da0c8664b4dc906696803685f7e53ade68594ab8':
  mpegvideo: Move various temporary buffers to a separate context

Conflicts:
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/rv34.c
	libavcodec/vc1_mc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 21:05:12 +02:00
Vittorio Giovara da0c8664b4 mpegvideo: Move various temporary buffers to a separate context 2015-06-08 12:39:42 +01:00
Michael Niedermayer f5ee10c16a Merge commit '2f15846ad7ad57beb0bca99c624affa0facf284b'
* commit '2f15846ad7ad57beb0bca99c624affa0facf284b':
  mpegvideo: wmv2: Move function declarations

Conflicts:
	libavcodec/wmv2.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 01:09:38 +02:00
Vittorio Giovara 2f15846ad7 mpegvideo: wmv2: Move function declarations 2015-05-31 13:06:19 +02:00
Michael Niedermayer d9b264bc73 Merge commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42'
* commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42':
  mpegvideo: Drop flags and flags2

Conflicts:
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/ratecontrol.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-22 20:24:41 +02:00
Vittorio Giovara 848e86f74d mpegvideo: Drop flags and flags2
They are just duplicates of AVCodecContext members so use those instead.
2015-05-22 15:34:39 +01:00
Michael Niedermayer fd4e17fcc2 avcodec/mpegvideo_motion: Fix undefined shifts in mpeg_motion_internal()
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 19:12:38 +01:00
Michael Niedermayer 8849c4ceac avcodec/mpegvideo_motion: Fix off by 1 error in MV bounds checking in qpel, chroma_4mv and 8x8
No testcase available

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-08 01:46:50 +01:00
Michael Niedermayer 9f0eaf792a avcodec/mpegvideo_motion: Fix off by 1 error in MV bounds checking
Fixes Ticket4299

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-08 01:27:56 +01:00
Michael Niedermayer fd52d2d3d1 avcodec/mpegvideo_motion: Fix gmc chroma dimensions
Fixes integer overflow and out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 00:33:50 +01:00
Michael Niedermayer c1df467d73 Merge commit '835f798c7d20bca89eb4f3593846251ad0d84e4b'
* commit '835f798c7d20bca89eb4f3593846251ad0d84e4b':
  mpegvideo: cosmetics: Lowercase ugly uppercase MPV_ function name prefixes

Conflicts:
	libavcodec/h261dec.c
	libavcodec/intrax8.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpeg4videoenc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/x86/mpegvideoenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 20:11:56 +02:00
Diego Biurrun 835f798c7d mpegvideo: cosmetics: Lowercase ugly uppercase MPV_ function name prefixes 2014-08-15 01:26:33 -07:00
Michael Niedermayer d7463c6813 Merge commit 'fab9df63a3156ffe1f9490aafaea41e03ef60ddf'
* commit 'fab9df63a3156ffe1f9490aafaea41e03ef60ddf':
  dsputil: Split off global motion compensation bits into a separate context

Conflicts:
	libavcodec/dsputil.c
	libavcodec/dsputil.h
	libavcodec/ppc/dsputil_altivec.h
	libavcodec/x86/dsputil_init.c
	libavcodec/x86/dsputil_mmx.c
	libavcodec/x86/dsputil_x86.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 21:10:10 +02:00
Diego Biurrun fab9df63a3 dsputil: Split off global motion compensation bits into a separate context 2014-06-23 09:58:17 -07:00
Michael Niedermayer c5fc8ae126 avcodec/mpegvideo: fix edge emulation with uvlinesize below 25
Fixes fate-vsynth3-wmv2

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-13 01:56:01 +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
Diego Biurrun 368f50359e dsputil: Split off quarterpel bits into their own context 2014-05-29 06:48:31 -07:00
Michael Niedermayer 59a53842d3 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpegvideo: operate with pointers to AVFrames instead of whole structs

Conflicts:
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/intrax8.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/mpegvideo_xvmc.c
	libavcodec/msmpeg4.c
	libavcodec/ratecontrol.c
	libavcodec/vaapi.c
	libavcodec/vc1dec.c
	libavcodec/vdpau_vc1.c

See: fc567ac49e
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-09 15:18:46 +02:00
wm4 f6774f905f mpegvideo: operate with pointers to AVFrames instead of whole structs
The most interesting parts are initialization in ff_MPV_common_init() and
uninitialization in ff_MPV_common_end().

ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL
checks for Picture.f, because these functions can be called on
uninitialized or partially initialized Pictures.

NULL pointer checks are added to ff_thread_release_buffer() stub function.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-04-09 02:12:19 +02:00
Michael Niedermayer 9517900bef Merge commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b'
* commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b':
  mpegvideo: move mpegvideo formats-related defines to mpegutils.h

Conflicts:
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_mvpred.h
	libavcodec/svq1enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 12:36:48 +01:00
Vittorio Giovara e0c16e4e32 mpegvideo: move mpegvideo formats-related defines to mpegutils.h 2014-03-16 23:04:41 +01:00
Michael Niedermayer 1c788eaca9 Merge commit '831a1180785a786272cdcefb71566a770bfb879e'
* commit '831a1180785a786272cdcefb71566a770bfb879e':
  Update dsputil- and SIMD-related comments to match reality more closely

Conflicts:
	libavcodec/x86/hpeldsp.asm
	libavutil/arm/float_dsp_init_arm.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-13 23:59:56 +01:00
Diego Biurrun 831a118078 Update dsputil- and SIMD-related comments to match reality more closely 2014-03-13 05:50:29 -07:00
Michael Niedermayer 2830f287e2 Merge commit 'ebfe622bb1ca57cecb932e42926745cba7161913'
* commit 'ebfe622bb1ca57cecb932e42926745cba7161913':
  mpegvideo: drop support for real (non-emulated) edges

Conflicts:
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_motion.c
	libavcodec/wmv2.c

If this is slower on a major platform then it should be investigated
and potentially reverted.

See: 8fc52a5ef9
See: 3969b4b861
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-09 14:19:24 +01:00
Anton Khirnov ebfe622bb1 mpegvideo: drop support for real (non-emulated) edges
Several decoders disable those anyway and they are not measurably faster
on x86. They might be somewhat faster on other platforms due to missing
emu edge SIMD, but the gain is not large enough (and those decoders
relevant enough) to justify the added complexity.
2014-01-09 09:41:19 +01:00
Michael Niedermayer 91e00c4a78 Merge commit '458446acfa1441d283dacf9e6e545beb083b8bb0'
* commit '458446acfa1441d283dacf9e6e545beb083b8bb0':
  lavc: Edge emulation with dst/src linesize

Conflicts:
	libavcodec/cavs.c
	libavcodec/h264.c
	libavcodec/hevc.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/rv34.c
	libavcodec/svq3.c
	libavcodec/vc1dec.c
	libavcodec/videodsp.h
	libavcodec/videodsp_template.c
	libavcodec/vp3.c
	libavcodec/vp8.c
	libavcodec/wmv2.c
	libavcodec/x86/videodsp.asm
	libavcodec/x86/videodsp_init.c

Changes to the asm are not merged, they are left for volunteers or
in their absence for later.
The changes this merge introduces are reordering of the function
arguments

See: face578d56
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-15 15:07:10 +01:00
Ronald S. Bultje 458446acfa lavc: Edge emulation with dst/src linesize
Allow supporting files for which the image stride is smaller than
the maximum block size + number of subpel mc taps, e.g. a 64x64 VP9
file or a 16x16 VP8 file with -fflags +emu_edge.
2013-11-15 10:16:27 +01:00
Michael Niedermayer 7b1e0beb2d avcodec/mpegvideo_motion: Handle edge emulation even without unrestricted_mv
Fixes out of array reads
Fixes part of: MSVR 440 (the other issues seem to have been fixed already)
Found-by: Jeremy Brown (jerbrown) of ReSP
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-12 18:21:20 +01:00
Michael Niedermayer 4d41a25d39 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpegvideo: Move 8x8 in a separate function

Conflicts:
	libavcodec/mpegvideo_motion.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-16 15:08:10 +02:00
Michael Niedermayer 8210e38461 Merge commit '95587859cc69e5abe37c9e3af48008032d98e262' into HEAD
* commit '95587859cc69e5abe37c9e3af48008032d98e262':
  mpegvideo: Move obmc in a separate function

Conflicts:
	libavcodec/mpegvideo_motion.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-16 14:51:00 +02:00
Michael Niedermayer 8610751d07 Merge commit 'a84616b736fca5ebd6b87489dd41bc06ccdf7860'
* commit 'a84616b736fca5ebd6b87489dd41bc06ccdf7860':
  mpegvideo: K&R formatting cosmetics

Conflicts:
	libavcodec/mpegvideo_motion.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-16 13:54:41 +02:00
Michael Niedermayer 10c6d1b28c Merge commit '93f305473f880729d18b5e42067f19d2106cb2e5'
* commit '93f305473f880729d18b5e42067f19d2106cb2e5':
  lavc: Convert some remaining strides to ptrdiff_t

Conflicts:
	libavcodec/h264.h
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/vp56.c
	libavcodec/wmv2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-16 13:08:37 +02:00
Luca Barbato 825c7c62bb mpegvideo: Move 8x8 in a separate function 2013-10-15 23:58:20 +02:00
Luca Barbato 95587859cc mpegvideo: Move obmc in a separate function 2013-10-15 23:58:20 +02:00
Luca Barbato a84616b736 mpegvideo: K&R formatting cosmetics 2013-10-15 23:58:20 +02:00
Ronald S. Bultje 93f305473f lavc: Convert some remaining strides to ptrdiff_t 2013-10-15 23:58:20 +02:00
Ronald S. Bultje face578d56 Rewrite emu_edge functions to have separate src/dst_stride arguments.
This allows supporting files for which the image stride is smaller than
the max. block size + number of subpel mc taps, e.g. a 64x64 VP9 file
or a 16x16 VP8 file with -fflags +emu_edge.
2013-09-28 20:28:08 -04:00