Commit Graph

202 Commits

Author SHA1 Message Date
Michael Niedermayer
d9d9fd9446 avcodec/error_resilience: Optimize motion recovery code by using blcok lists
This makes the code 7 times faster with the testcase from libfuzzer
and should reduce the amount of timeouts we hit in automated fuzzing.
(for example 438/fuzz-2-ffmpeg_VIDEO_AV_CODEC_ID_RV40_fuzzer)

The code is also faster with more realistic input though the difference
is small here as that is far from the worst cases the fuzzers pick out

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-22 21:39:43 +01:00
Michael Niedermayer
6e26b6e43f avcodec/error_resilience: Move variable initialization down, remove unneeded inits
This makes the code faster and easier to read

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-25 22:58:52 +01:00
Michael Niedermayer
d5ecffbac6 avcodec/error_resilience: Merge surrounding status checks
Simplifies code and is also faster

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-25 21:04:32 +01:00
Michael Niedermayer
cafc72bd7b avcodec/error_resilience: Factor block parity check out
This makes the code noticably faster when there are lots of blocks

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-25 21:04:32 +01:00
Clément Bœsch
0491d6993a lavc/error_resilience: remove unused skip_last_mv label
Unused since a7b8a6e704
2016-06-22 11:07: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
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Michael Niedermayer
df820af2c5 avcodec/error_resilience: Improve missing slice handling for mpeg2
Fixes: m702_2.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-03 01:07:24 +02:00
Michael Niedermayer
a7b8a6e704 avcodec/error_resilience: remove unneeded and disabled code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-18 03:11:16 +01:00
Michael Niedermayer
5694b28211 avcodec/error_resilience: wait for previous frame to be available
This is possibly redundant but its more correct

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-18 03:10:16 +01:00
Michael Niedermayer
a105f52855 avcodec/error_resilience: avoid accessing previous or next frames tables beyond height
The height of tables can be rounded up for MBAFF but this does not imply that is also true
for the previous frames

Fixes out of array reads
Fixes: c106b36fa36db8ff8f3ed0c82be7bea2/asan_heap-oob_32699f0_6321_467b9a1d7e03d7cfd310b7e65dc53bcc.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-14 22:51:30 +01:00
Ronald S. Bultje
030b5a4f77 lavc: put remaining bits of vdpau-in-decoder under FF_API_CAP_VDPAU. 2015-08-18 15:57:19 -04:00
Michael Niedermayer
444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Michael Niedermayer
5c8809b45b avcodec/error_resilience: support grayscale
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-09 02:42:47 +02:00
Michael Niedermayer
cf880ccb6a avcodec/error_resilience: Avoid race with updating the error_count
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-05 13:32:09 +02:00
Michael Niedermayer
dd186b5825 avcodec/error_resilience: Fix mbskip_table==NULL codepath
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 19:24:03 +01:00
Michael Niedermayer
b37b0a58e3 Merge commit '5bc69f38c1af71fbcbfb4b5efa77d0aeb5424c04'
* commit '5bc69f38c1af71fbcbfb4b5efa77d0aeb5424c04':
  error_resilience: do not require mbintra/skip tables

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 19:03:10 +01:00
Anton Khirnov
5bc69f38c1 error_resilience: do not require mbintra/skip tables
h264dec does not use them at all and only allocates them for ER.
2015-03-21 11:27:15 +01:00
Michael Niedermayer
3d04117078 Merge commit 'cf1e0786ed64e69614760bfb4ecd7adbde8e6094'
* commit 'cf1e0786ed64e69614760bfb4ecd7adbde8e6094':
  error_resilience: move the MECmpContext initialization into ER code

Conflicts:
	libavcodec/error_resilience.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_slice.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-27 14:56:52 +01:00
Anton Khirnov
cf1e0786ed error_resilience: move the MECmpContext initialization into ER code
Currently, it needs to be initialized by the ER caller (which is
currently either a mpegvideo decoder or h264dec). However, since none of
those decoders use MECmpContext for anything except ER, it makes more
sense to handle it purely inside ER.
2015-01-27 09:07:59 +01:00
Michael Niedermayer
8b13a4d6f0 avcodec/error_resilience: Remove special case for H.264 from is_intra_more_likely
This should not be needed

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-11 17:30:02 +01:00
Michael Niedermayer
e1bcbca998 Merge commit 'c442190a6bfd8036f6c32b78e1e96ff3b830f8f0'
* commit 'c442190a6bfd8036f6c32b78e1e96ff3b830f8f0':
  error_resilience: initialize prev_* variables

Note, these variables are not used without initialization prior
to the change

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-04 21:28:48 +01:00
Vittorio Giovara
c442190a6b error_resilience: initialize prev_* variables
CC: libav-stable@libav.org
Bug-Id: CID 732293 / CID 732294
2014-11-03 12:45:09 -05:00
Michael Niedermayer
20df02680c avcodec/error_resilience: avoid pointer arithmetic with NULL
move the code after the existing NULL check
Fixes: signal_sigsegv_844d59_10_signal_sigsegv_a17bb7_366_mpegts_mpeg2video_mp2_dvbsub_topfield.rec

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-12 04:49:08 +02:00
Diego Biurrun
7cb66ebc0b error_resilience: Drop asserts from guess_mv()
The asserts check struct members that are not referenced in guess_mv()
and one of them fails to compile.
2014-08-21 04:18:23 -07:00
Michael Niedermayer
c103c48525 avcodec/error_resilience: make error an local variable where possible
This makes the code easier to understand as the scope of the variable is
smaller.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 22:04:08 +02:00
Michael Niedermayer
459996325d avcodec/error_resilience: comment out unused assignment
Its not removed as the code which uses this is out-commented too.

Found-by: CSA
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 22:01:59 +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
Diego Biurrun
2d60444331 dsputil: Split motion estimation compare bits off into their own context 2014-07-17 09:07:10 -07:00
Michael Niedermayer
81d1fcf37d avcodec: add option to make is_intra_more_likely() from error concealment return "no"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-12 22:55:39 +02:00
Michael Niedermayer
36053aeff6 vcodec/error_resilience: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-12 15:33:55 +02:00
Janne Grunau
c829b35c08 lavc: er: remove unused variable size
The code using it was removed in d66e305bd1.
2014-03-18 13:07:52 +01: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
Michael Niedermayer
4f22e39e65 avcodec/error_resilience: fix the case when MVs are not available
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 05:36:17 +01:00
Michael Niedermayer
533bc4c0a3 Merge commit 'd66e305bd1b4f3e91ae4e7e549148509d0811672'
* commit 'd66e305bd1b4f3e91ae4e7e549148509d0811672':
  er: move relevant fields from Picture to ERPicture

Conflicts:
	libavcodec/error_resilience.c
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 05:08:46 +01:00
Vittorio Giovara
e0c16e4e32 mpegvideo: move mpegvideo formats-related defines to mpegutils.h 2014-03-16 23:04:41 +01:00
Vittorio Giovara
d66e305bd1 er: move relevant fields from Picture to ERPicture
This is done to disentangle ER from mpegvideo. In order to use a
classic Picture, callers can use ff_mpeg_set_erpic() or use a custom function
to set the fields. Please note that buffers need to be allocated before
calling ff_er_frame_end().
2014-03-16 23:01:00 +01:00
Michael Niedermayer
6016b8329b Merge commit '05563ccacc98fd185affdbf8cbaf094caf36b852'
* commit '05563ccacc98fd185affdbf8cbaf094caf36b852':
  dsputil: cosmetics: Lose camelCase on ff_cropTbl and ff_squareTbl names

Conflicts:
	libavcodec/bit_depth_template.c
	libavcodec/motionpixels_tablegen.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-14 00:39:51 +01:00
Diego Biurrun
05563ccacc dsputil: cosmetics: Lose camelCase on ff_cropTbl and ff_squareTbl names
Also switch from "tbl" to "tab" name suffixes.
2014-03-13 08:12:44 -07:00
Ivan Kalvachev
1c63aed232 Convert XvMC to hwaccel v3
Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-22 22:03:47 +01:00
Michael Niedermayer
90539cea33 avcodec/error_resilience: check that er is supported before attempting to read the status of the previous slice
Fixes incorrectly set error_occured and improves speed

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-06 16:49:35 +01:00
Michael Niedermayer
afb18c5578 avcodec/error_resilience: factor er_supported() check out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-06 16:49:00 +01:00
Michael Niedermayer
5231eecdaf Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Deprecate obsolete XvMC hardware decoding support

Conflicts:
	libavcodec/mpeg12.c
	libavcodec/mpeg12dec.c
	libavcodec/mpegvideo.c
	libavcodec/options_table.h
	libavutil/pixdesc.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-14 03:26:35 +01:00
Diego Biurrun
19e30a58fc Deprecate obsolete XvMC hardware decoding support
XvMC has long ago been superseded by newer acceleration APIs, such as
VDPAU, and few downstreams still support it. Furthermore XvMC is not
implemented within the hwaccel framework, but requires its own specific
code in the MPEG-1/2 decoder, which is a maintenance burden.
2013-11-13 21:07:45 +01:00
Anton Khirnov
f354f30836 error resilience: check error_concealment, not err_recognition.
err_recognition is supposed to trigger detecting and reporting errors,
not trying to fix them.
2013-10-28 07:22:11 +01:00
Anton Khirnov
346e09638c avcodec/error_resilience check error_concealment, not err_recognition.
err_recognition is supposed to trigger detecting and reporting errors,
not trying to fix them.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 09:51:21 +01:00
Michael Niedermayer
990bbc15b8 avcodec/error_resilience: change out commented printf() to av_log()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-01 03:50:08 +02:00
Michael Niedermayer
7d776062f9 avcodec/error_resilience: Fix handling of matrox mpeg2
Fixes Ticket2615

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 14:37:12 +02:00
Michael Niedermayer
a0c6c8e53e Revert "Merge commit of 'vdpau: remove old-style decoders'"
This reverts commit bf36dc50ea, reversing
changes made to b7fc2693c7.

Conflicts:

	libavcodec/h264.c

Keeping support for the old VDPAU API has been requested by our VDPAU maintainer

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-17 22:17:49 +02:00
Michael Niedermayer
bf36dc50ea Merge commit '578ea75a9e4ac56e0bbbbe668700be756aa699f8'
* commit '578ea75a9e4ac56e0bbbbe668700be756aa699f8':
  vdpau: remove old-style decoders

Conflicts:
	libavcodec/allcodecs.c
	libavcodec/h263dec.c
	libavcodec/h264.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg4videodec.c
	libavcodec/vc1dec.c
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 13:24:22 +02:00