summaryrefslogtreecommitdiff
path: root/libavcodec/vp8.c
Commit message (Collapse)AuthorAge
* avcodec/vp8: Constify slice threads' ptr to main contextAndreas Rheinhardt2022-07-31
| | | | | | | | | Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify ThreadFrames if possibleAndreas Rheinhardt2022-07-31
| | | | | | | This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9Andreas Rheinhardt2022-07-28
| | | | | | | | | | | | | | | | | | | | | | | | Instead replace VP56mv by new and identical structures VP8mv and VP9mv. Also replace VP56Frame by VP8FrameType in vp8.h and use that in VP8 code. Also remove VP56_FRAME_GOLDEN2, as this has only been used by VP8, and use VP8_FRAME_ALTREF as replacement for its usage in VP8 as this is more in line with VP8 verbiage. This allows to remove all inclusions of vp56.h from everything that is not VP5/6. This also removes implicit inclusions of hpeldsp.h, h264chroma.h, vp3dsp.h and vp56dsp.h from all VP8/9 files. (This also fixes a build issue: If one compiles with -O0 and disables everything except the VP8-VAAPI encoder, the file containing ff_vpx_norm_shift is not compiled, yet this is used implicitly by vp56_rac_gets_nn() which is defined in vp56.h; it is unused by the VP8-VAAPI encoder and declared as av_unused, yet with -O0 unused noninline functions are not optimized away, leading to linking failures. With this patch, said function is not included in vaapi_encode_vp8.c any more.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp56: Move VP5-9 range coder functions to a header of their ownAndreas Rheinhardt2022-07-28
| | | | | | Also use a vpx prefix for them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp56: Move VP8/9-only rac functions to a header of their ownAndreas Rheinhardt2022-07-28
| | | | | | Also rename these functions from vp8_rac_* to vp89_rac_*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp56.h: Move VP8-only functions to vp8.cAndreas Rheinhardt2022-07-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-05
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-05
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-21
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-21
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/threadframe: Add ff_thread_(get|release)_ext_buffer()Andreas Rheinhardt2022-02-09
| | | | | | | | | These will be used by the codecs that need allocated progress and is in preparation for no longer using ThreadFrame by the codecs that don't. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/thread: Move ff_thread_(await|report)_progress to new headerAndreas Rheinhardt2022-02-09
| | | | | | | | | | This is in preparation for further commits that will stop using ThreadFrame for frame-threaded codecs that don't use ff_thread_(await|report)_progress(); the API for those codecs having inter-frame depdendencies will live in threadframe.h. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp8: Remove always-false checkAndreas Rheinhardt2022-02-09
| | | | | | | | | | Since e9b66175793e5c2af19beefe8e143f6e4901b5df a codec's close function is never ever called for a codec whose init function has not been called; in particular, it is never ever called if the AVCodecContext's private data has not been allocated. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp8: Mark decoders as init-threadsafeAndreas Rheinhardt2021-05-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Constify some AVPacketsAndreas Rheinhardt2021-03-09
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp8: Move end check into MB loop in vp78_decode_mv_mb_modes()Michael Niedermayer2021-02-16
| | | | | | | | | Fixes: Timeout (long -> 5sec) Fixes: 30269/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5430325004075008 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>
* Mark some pointers as constAndreas Rheinhardt2021-01-01
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavu: move LOCAL_ALIGNED from internal.h to mem_internal.hAnton Khirnov2021-01-01
| | | | That is a more appropriate place for it.
* libavcodec/vp8dec: fix the multi-thread HWAccel decode errorShaofei Wang2020-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the issue: https://github.com/intel/media-driver/issues/317 the root cause is update_dimensions will be called multple times when decoder thread number is not only 1, but update_dimensions call get_pixel_format in each decode thread will trigger the hwaccel_uninit/hwaccel_init more than once. But only one hwaccel should be shared with all decode threads. in current context, there are 3 situations in the update_dimensions(): 1. First time calling. No matter single thread or multithread, get_pixel_format() should be called after dimensions were set; 2. Dimention changed at the runtime. Dimention need to be updated when macroblocks_base is already allocated, get_pixel_format() should be called to recreate new frames according to updated dimension; 3. Multithread first time calling. After decoder init, the other threads will call update_dimensions() at first time to allocate macroblocks_base and set dimensions. But get_pixel_format() is shouldn't be called due to low level frames and context are already created. In this fix, we only call update_dimensions as need. Signed-off-by: Wang, Shaofei <shaofei.wang@intel.com> Reviewed-by: Jun, Zhao <jun.zhao@intel.com> Reviewed-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* lavc: Rename hwaccel.h to hwconfig.hMark Thompson2020-04-26
| | | | | This already applied to decoders as well as hwaccels, and adding encoder support was going to make the name even more inaccurate.
* 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/vp8: fix multiple ff_thread_finish_setup() callsZhao Zhili2019-11-28
| | | | | | | | | | webp decoder doesn't set update_thread_context field $ ffmpeg -i rgb_q80.webp -f null - [webp @ 0x7ffbd5823200] Multiple ff_thread_finish_setup() calls Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp5/6/8: use vpX_rac_is_end()Michael Niedermayer2019-08-22
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp8: do vp7_fade_frame() laterMichael Niedermayer2019-08-03
| | | | | | | | Fixes: Timeout (100sec -> 5sec) Fixes: 15073/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5649257362620416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp7: Check for end of input in vp78_decode_mv_mb_modes()Michael Niedermayer2018-12-16
| | | | | | | | | Fixes: Timeout Fixes: 10313/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5637719389110272 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/vp8: Check bitstream input in vp7_fade_frame() before time consuming ↵Michael Niedermayer2018-09-12
| | | | | | operation Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/vp8: Do not compute line pointers per pixel in fade()Michael Niedermayer2018-07-07
| | | | | | | 72->60 seconds Testcase: 8680/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5861504418054144 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp8: Check for bitstream end before vp7_fade_frame()Michael Niedermayer2018-02-17
| | | | | | | | Fixes: Timeout Fixes: 5653/clusterfuzz-testcase-5497680018014208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/vp8: Support resolution changes in the VP8 decoder hwaccelJun Zhao2017-12-15
| | | | | | | | | | | | | Use the following command to reproduce this issue: make fate-vp8-size-change HWACCEL="vaapi -vaapi_device \ /dev/dri/renderD128 -hwaccel_output_format yuv420p" SAMPLES=../fate-suite/. At the same time, reconstruct the public logic as a function. Signed-off-by: Yun Zhou <yunx.z.zhou@intel.com> Signed-off-by: Jun Zhao <jun.zhao@intel.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
* avcodec/nvdec: Implement vp8 hwaccelPhilip Langdale2017-11-26
|
* vaapi: Add VP8 decode hwaccelMark Thompson2017-11-26
|
* vp8: Add hwaccel hooksMark Thompson2017-11-26
| | | | | | | | | | Also adds some extra fields to the main context structure that may be needed by a hwaccel decoder. The current behaviour of the WebP decoder is maintained by adding an additional field to the VP8 decoder private context to indicate that it is actually being used as WebP (no hwaccel is supported for that case).
* Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'James Almer2017-09-26
|\ | | | | | | | | | | | | * commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3': Mark some arrays that never change as const. Merged-by: James Almer <jamrial@gmail.com>
| * Mark some arrays that never change as const.Anton Khirnov2017-02-01
| |
| * lavc/vaapi: Add VP8 decode hwaccelMark Thompson2016-09-08
| |
| * vp8: Add hwaccel hooksMark Thompson2016-09-08
| | | | | | | | | | Also adds some extra fields to the main context structure that may be needed by a hwaccel decoder.
* | avcodec/webp: Always set pix_fmtMichael Niedermayer2017-05-10
| | | | | | | | | | | | | | | | | | | | Fixes: out of array access Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632 Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | vp8: make mv_min/max thread-local if using partition threading.Ronald S. Bultje2017-04-06
| | | | | | | | | | | | | | | | | | | | | | Fixes tsan warnings like this in fate-vp8-test-vector-007: WARNING: ThreadSanitizer: data race (pid=65909) Write of size 4 at 0x7d8c0000e088 by thread T1: #0 vp8_decode_mb_row_sliced vp8.c:2519 (ffmpeg:x86_64+0x100995ede) [..] Previous write of size 4 at 0x7d8c0000e088 by thread T2: #0 vp8_decode_mb_row_sliced vp8.c:2519 (ffmpeg:x86_64+0x100995ede)
* | vp8: make wait/thread_mb_pos atomic.Ronald S. Bultje2017-04-06
| | | | | | | | | | | | | | | | | | | | | | Fixes tsan warnings like this in fate-vp8-test-vector-007: WARNING: ThreadSanitizer: data race (pid=3590) Write of size 4 at 0x7d8c0000e07c by thread T2: #0 decode_mb_row_no_filter src/libavcodec/vp8.c:2330 (ffmpeg+0x000000ffb59e) [..] Previous write of size 4 at 0x7d8c0000e07c by thread T1: #0 decode_mb_row_no_filter src/libavcodec/vp8.c:2330 (ffmpeg+0x000000ffb59e)
* | Merge commit '87c6c78604e4dd16f1f45862b27ca006da010527'James Almer2017-03-19
|\| | | | | | | | | | | | | * commit '87c6c78604e4dd16f1f45862b27ca006da010527': vp8: Change type of stride parameters to ptrdiff_t Merged-by: James Almer <jamrial@gmail.com>
| * vp8: Change type of stride parameters to ptrdiff_tDiego Biurrun2016-08-26
| | | | | | | | ptrdiff_t is the correct type for array strides and similar.
* | avcodec/vp8: Fix hang with slice threadsThomas Guilbert2017-03-10
| | | | | | | | | | | | | | Fixes: 447860.webm Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp8: Check for the bitstream end per MB in decode_mb_row_no_filter()Michael Niedermayer2017-03-07
| | | | | | | | | | | | | | | | Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 2 of 2) Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Reviewed-by: BBB Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp568: Check that there is enough data for ff_vp56_init_range_decoder()Michael Niedermayer2017-03-07
| | | | | | | | | | | | | | | | Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 1 of 2) Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Reviewed-by: BBB Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp8: remove redundant checkMichael Niedermayer2017-03-07
| | | | | | | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vp8: Check for bitsteam end in decode_mb_row_no_filter()Michael Niedermayer2017-03-01
| | | | | | | | | | | | | | | | | | | | | | Fixes timeout with 686/clusterfuzz-testcase-5853946876788736 this shortcuts (i.e. speeds up) the error and return-to-user when decoding a truncated frame Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Previous version reviewed by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>