summaryrefslogtreecommitdiff
path: root/libavcodec/vp3.c
Commit message (Collapse)AuthorAge
* avcodec/vp3: Check input amount in theora_decode_header()Michael Niedermayer2021-01-31
| | | | | | | | | Fixes: Timeout Fixes: 29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-01
| | | | They are not properly namespaced and not intended for public use.
* avcodec/vp3: Remove code duplication when initializing Theora VLCsAndreas Rheinhardt2020-12-08
| | | | | | | theora_init_huffman_tables() does essentially the same as ff_init_vlcs_from_lengths(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Use symbols table for VP3 motion vectorsAndreas Rheinhardt2020-12-08
| | | | | | | | | | | | | Expressions like array[get_vlc2()] can be optimized by using a symbols table if the array is always the same for a given VLC. This requirement is fulfilled for the VLC used for VP3 motion vectors. The reason it hasn't been done before is probably that the array in this case contained entries in the range -31..31; but this is no problem with ff_init_vlc_from_lengths(): Just apply an offset of 31 to the symbols before storing them in the table used to initialize VP3 motion vectors and apply an offset of -31 when initializing the actual VLC. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Make tables used to initialize VLCs smallerAndreas Rheinhardt2020-12-08
| | | | | | | | | This is possible by switching to ff_init_vlc_from_lengths() because it allows to replace codes of type uint16_t by symbols of type uint8_t; in some cases (like here) it also allows to replace explicitly coded codes by implicitly coded symbols. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Apply VLC offset during initAndreas Rheinhardt2020-12-08
| | | | | | | | | | By switching to ff_init_vlc_from_lengths() one can apply both positive as well as negative offsets for free; in this case it even saves space because one replaces codes tables that don't fit into an uint8_t by symbols tables that fit into an uint8_t or can even be completely avoided as they are trivial. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Don't check for errors for complete VLCAndreas Rheinhardt2020-10-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Make parsing Theora Huffman tables more spec-compliantAndreas Rheinhardt2020-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Theora allows to use custom Huffman tables which are coded in the bitstream as a tree: Whether the next node is a leaf or not is coded in a bit; each node itself contains a five bit token. Each tree can contain at most 32 leafs; typically they contain exactly 32 with the 32 symbols forming a permutation of 0..31. Yet the standard does not impose either of these requirements. It explicitly allows less than 32 leafs and multiple codes with the same token. But our decoder used an algorithm that required the codes->token mapping to be injective and that also presumed that there be at least two leafs: Instead of using an array for codes, tokens and code lengths, the decoder only had arrays for codes and code lengths. The code and length for a given token were stored in entry[token]. As no symbols table was used when initializing the VLC, the default one applied and therefore the entry[token] got the symbol token (if the length of said entry is >0). Yet if multiple codes had the same token, the codes and lengths from the later token would overwrite the earlier codes and lengths. Furthermore, less than 32 leafs could also lead to problems: Namely if this was not the first time Huffman tables have been parsed in which case the array is not zeroed initially so that old entries could make the new table invalid. libtheora seems to always use 32 leafs and no duplicate tokens; I am not aware of any existing valid files that do not. This is fixed by using a codes, symbols and lengths array when initializing the VLC. In order to reduce the amount of stuff kept in the context only the symbols and lengths (which both fit into an uint8_t) are kept in the context; the codes are derived from the lengths immediately before creating the tables. There is now only one thing left which is not spec-compliant: Trees with only one node (which has length zero) are not supported by ff_init_vlc_sparse() yet. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Unify initializing and freeing VLC tablesAndreas Rheinhardt2020-10-21
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Check allocations of VLCsAndreas Rheinhardt2020-10-21
| | | | | | | It would lead to crashs lateron if they failed. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Fix memleak upon init failureAndreas Rheinhardt2020-10-21
| | | | | | | | | | Up until now, there was no cleanup in case initializing the Theora VLC tables failed, leading to memleaks. This commit gets rid of them by setting the FF_CODEC_CAP_INIT_CLEANUP flag for all decoders in vp3.c; this also allows to remove some (now redundant) cleanup code. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: fix indentationPeter Ross2020-04-17
|
* pthread_frame: merge the functionality for normal decoder init and ↵Anton Khirnov2020-04-10
| | | | | | | | | | | | | | | | init_thread_copy The current design, where - proper init is called for the first per-thread context - first thread's private data is copied into private data for all the other threads - a "fixup" function is called for all the other threads to e.g. allocate dynamically allocated data is very fragile and hard to follow, so it is abandoned. Instead, the same init function is used to init each per-thread context. Where necessary, AVCodecInternal.is_copy can be used to differentiate between the first thread and the other ones (e.g. for decoding the extradata just once).
* lavc: replace AVCodecInternal.allocate_progress with an internal capAnton Khirnov2020-04-10
| | | | This is a constant codec property, so a capability flag is more appropriate.
* avcodec/vp3: propagate error codesPeter Ross2020-04-07
| | | | | | | throughout vp3_decode_frame the error code was being captured (ret) but never returned. Signed-off-by: Peter Ross <pross@xvid.org> Reviewed-by: Anton Khirnov <anton@khirnov.net>
* vp3: eliminate copy_fieldsAnton Khirnov2020-03-16
| | | | | It is very fragile against fields being moved and hides what is actually being copied. Copy all the fields explicitly instead.
* avcodec: Replace get_bits_long() by get_bits() where possibleMichael Niedermayer2019-12-31
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* vp4: prevent unaligned memory access in loop filterPeter Ross2019-10-30
| | | | | | | | | | | | VP4 applies a loop filter during motion compensation, causing the block offset will often by unaligned. This produces a bus error on some platforms, namely ARMv7 NEON. This patch adds a unaligned version of the loop filter function pointer to VP3DSPContext. Reported-by: Mike Melanson <mike@multimedia.cx> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Check for end of input in 2 places of vp4_unpack_macroblocks()Michael Niedermayer2019-09-02
| | | | | | | | | Fixes: Timeout (82sec -> 1sec) Fixes: 16411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5166958151991296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Check for end of input in vp4_unpack_vlcs()Michael Niedermayer2019-08-03
| | | | | | | | | Fixes: Timeout (too long -> 1sec) Fixes: 15232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5769583086010368 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Check that theora is theoraMichael Niedermayer2019-08-02
| | | | | | | | | | | Theora is forced to be non zero if it is zero and a sample is asked for, as suggested by reimar Fixes: Timeout (2min -> 600ms) Fixes: 15366/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5737849938247680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* VP4 video decoderPeter Ross2019-06-12
|
* avcodec/vp3: spin off get_eob_run and get_coeff coeff functionsPeter Ross2019-06-12
| | | | these reoutines are shared by vp3 and vp4.
* avcodec/vp3data: combine eob_run_base and eob_run_get_bits tablesPeter Ross2019-06-08
|
* avcodec/vp3dsp: move vp3 init loop filter function to vp3dspPeter Ross2019-01-26
| | | | | | This is also used by the VP6 decoder. Signed-off-by: Peter Ross <pross@xvid.org>
* avcodec/vp3: ref_frame/ref_frames are only required when HAVE_THREADS=1Peter Ross2019-01-14
|
* avcodec/vp3: reindent unpack_superblocks()Michael Niedermayer2018-10-29
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Do not recalculate coded_fragment_list for keyframesMichael Niedermayer2018-10-29
| | | | | | | | | | This improves decoding speed of keyframes Fixes: Timeout (102->27sec) Fixes: 9642/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-6676767875006464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Reuse local variable in unpack_superblocks()Michael Niedermayer2018-10-29
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Do not initialize unused tables for keyframes in ↵Michael Niedermayer2018-10-29
| | | | | | | | | | unpack_superblock() Fixes: Timeout (139sec -> 102sec) Fixes: 9642/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-6676767875006464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Fix end of bitstream check in unpack_superblocks()Michael Niedermayer2018-06-02
| | | | | | | | Fixes: regression Found-by: Frank Liberato <liberato@google.com> Tested-by: Frank Liberato <liberato@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Check that there will be sufficient input for the coded ↵Michael Niedermayer2018-05-13
| | | | | | | | | | fragments in unpack_superblocks() Fixes: Timeout Fixes: 6292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4871218218926080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Error out on invalid num_coeffs in unpack_vlcs()Michael Niedermayer2018-02-11
| | | | | | This fixes a hypothetical integer overflow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Check eob_runMichael Niedermayer2018-02-11
| | | | | | | | | Fixes: out of array access Fixes: 5919/clusterfuzz-testcase-minimized-5859311382167552 Fixes: special case for theora (untested due to lack of sample) Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: remove remaining uses of avcodec_get_chroma_sub_sampleMartin Vignali2017-11-06
| | | | | | Replace them with av_pix_fmt_get_chroma_sub_sample. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/theora: export cropping information instead of handling it internallyJames Almer2017-05-26
| | | | | | | | | This merges commit 1202b712690c14f0efb06e4ad8b06c5b3df6822a from libav, originally written by Anton Khirnov and skipped in fc63d5ceb357c4b760cb02772de0b50d0557140f. libavcodec/vp3.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
* avcodec/vp3: Check remaining bits in unpack_dct_coeffs()Michael Niedermayer2017-05-01
| | | | | | | | | Decreases the time spend decoding junk. May fix: 1283/clusterfuzz-testcase-minimized-6221126759874560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Do not return random positive values but the buf sizeMichael Niedermayer2017-03-03
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\ | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/vp3: Fix "runtime error: left shift of negative value"Michael Niedermayer2015-12-04
| | | | | | | | | | | | | | Fixes: 5c6129154b356b80bcab86f9e3ee5d29/signal_sigabrt_7ffff6ae7cc9_7322_d26ac6d7cb6567db1b8be0159b387d0b.ogg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp3: ensure header is parsed successfully before tablesMichael Niedermayer2015-12-03
| | | | | | | | | | | | | | | | Fixes assertion failure Fixes: 266ee543812e934f7b4a72923a2701d4/signal_sigabrt_7ffff6ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp3: always set pix_fmt in theora_decode_header()Michael Niedermayer2015-11-30
| | | | | | | | | | | | | | | | Fixes assertion failure Fixes: d0bb0662da342ec65f8f2a081222e6b9/signal_sigabrt_7ffff6ae7cc9_5471_82964f0a9ac2f4d3d59390c15473f6f7.ogg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp3: Fix several memleaksMichael Niedermayer2015-11-28
| | | | | | | | | | | | | | Fixes: 1536b9b096a8f95b742bae9d3d761cc6/signal_sigsegv_294aaed_4460_b209bd1e7cebe458b53072a44191316d.ogg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp3: Clear context on reinitialization failureMichael Niedermayer2015-11-28
| | | | | | | | | | | | | | | | Fixes null pointer dereference Fixes: 1536b9b096a8f95b742bae9d3d761cc6/signal_sigsegv_294aaed_2039_8d1797aeb823ea43858d0fa45c9eb899.ogv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: use HAVE_THREADS header guards to silence -Wunused-functionGanesh Ajjanagadde2015-10-04
| | | | | | | | | | | | | | | | | | | | When compiled with --disable-pthreads, e.g http://fate.ffmpeg.org/report.cgi?time=20150917015044&slot=alpha-debian-qemu-gcc-4.7, a bunch of -Wunused-functions are reported due to missing header guards around threading related functions. This patch should silence such warnings. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | avcodec/vp3: Check init_get_bits8() for failureMichael Niedermayer2015-09-04
| | | | | | | | | | | | Fixes CID1322316 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-27
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>