summaryrefslogtreecommitdiff
path: root/libavcodec/svq3.c
Commit message (Collapse)AuthorAge
* 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>
* avcodec/svq3: Mark decoder as init-threadsafeAndreas Rheinhardt2022-02-18
| | | | | | | The only interesting thing done in SVQ3's init function is using zlib, but this is fine: https://zlib.net/zlib_faq.html#faq21 Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/svq3: stop including h264dec.hAnton Khirnov2022-01-26
| | | | | | | The only thing that is actually used directly from there is the PART_NOT_AVAILABLE constant, which can be moved to h264pred.h. Otherwise it only depends on other indirectly included headers.
* avcodec/svq3: Remove dead topright_samples_available variable, codeAndreas Rheinhardt2022-01-13
| | | | | | Topright samples are always available. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo, svq3: Remove unused next_p_frame_damagedAndreas Rheinhardt2022-01-13
| | | | | | Always zero since 4d2858deac5213eaddfdc06f98379b6325d7b953. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> 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/svq3: Free array of frames in a loopAndreas Rheinhardt2021-04-26
| | | | | | Avoids code duplication Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/svq3: Remove unused function parameterAndreas Rheinhardt2021-04-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/svq3: Don't copy watermarked frame data twiceAndreas Rheinhardt2021-03-23
| | | | | | | | | | | | | | | The SVQ3 decoder modifies the input bitstream at two places. One of them is only reached when the file is watermarked. Therefore commit 2264c1108135380c49fdf0aef97520bf77a6ed37 made a copy of all the frame data in this case. But there is a second possibility for modifying the frame and therefore Libav commit 1098f5c0495c61a98d4ff6b8e24c17974d4bace5 made the decoder always copy the data. This of course makes the additional copy for watermarked frames redundant, but it hasn't been removed. This commit does so. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()Andreas Rheinhardt2021-03-23
| | | | | | | | It takes care of zeroing padding (which has been forgotten here). Also rename the size variable to indicate that this is not the size of the current slice. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* 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/svq3: Avoid overhead of AVBuffer APIAndreas Rheinhardt2020-09-17
| | | | | | | | | | | | Up until now, the SVQ3 decoder allocated several refcounted buffers, despite no sharing/refcounting happening at all: Their refcount never exceeds one and they are treated like ordinary buffers (with the exception that the pointer used to access them is in the middle of the allocated buffer, but this does not warrant using the AVBuffer API at all). Given that using the AVBuffer API incurs overhead, it is no longer used at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/svq3: Remove unused bufferAndreas Rheinhardt2020-09-17
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/svq3: Fix memleaks upon allocation errorAndreas Rheinhardt2020-09-17
| | | | | | | | | | | Commit b2361cfb94738298a6c4037cc348fe5015efb841e made all of the error paths in svq3_decode_init() call svq3_decode_end(); yet several new error paths that were added later (in merges from Libav) returned directly without cleaning up properly. This commit fixes the resulting potential memleaks by setting the FF_CODEC_CAP_INIT_CLEANUP flag. This also allows to simplify freeing by returning directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/svq3: Fix segfault on allocation error, avoid allocationsAndreas Rheinhardt2020-09-17
| | | | | | | | | | | | | | | | The very first thing the SVQ3 decoder currently does is allocating several SVQ3Frames, a structure which contains members that need to be freed on their own. If one of these allocations fails, the decoder calls its own close function to not leak the already allocated SVQ3Frames. Yet said function presumes that the SVQ3Frames have been successfully allocated as there is no check before freeing the members that need to be freed. This commit fixes this by making these frames part of the SVQ3Context, thereby avoiding the allocations altogether. Notice that the pointers to the frames have been retained in order to allow to just swap them as the code already does. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec/svq: Remove ff_svq1_packet_checksum()Michael Niedermayer2020-02-19
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/svq3: Use ff_set_dimension()Michael Niedermayer2019-07-08
| | | | | | | | Fixes: OOM Fixes: 15410/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5659464805384192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/svq3: Fix regression decoding some files.Nikolas Bowe2018-08-03
| | | | | | | | | | | Fixes some SVQ3 encoded files which fail to decode correctly after 6d6faa2a2d. These files exhibit lots of artifacts and logs show "Media key encryption is not implemented". However they decode without artifacts before 6d6faa2a2d. The attatched patch allows these files to successfully decode, but also reject media key files. Tested on the files in #6094 and http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/svq3: Do not write into memory defined as const.Carl Eugen Hoyos2018-01-21
| | | | | Fixes a warning on ppc: libavcodec/svq3.c:1055:21: warning: passing argument 1 of ‘av_write_bswap32’ discards 'const' qualifier from pointer target type
* Merge commit 'b2788fe9347c02b1355574f3d28d60bfe1250ea7'James Almer2017-10-03
|\ | | | | | | | | | | | | * commit 'b2788fe9347c02b1355574f3d28d60bfe1250ea7': svq3: fix the slice size check Merged-by: James Almer <jamrial@gmail.com>
| * svq3: fix the slice size checkAnton Khirnov2017-02-25
| | | | | | | | | | | | | | | | | | Currently it incorrectly compares bits with bytes. Also, move the check right before where it's relevant, so that the correct number of remaining bits is used. CC: libav-stable@libav.org
| * svq3: Convert to the new bitstream readerAlexandra Hájková2017-02-02
| |
| * golomb: Convert to the new bitstream readerDiego Biurrun2017-01-31
| |
| * svq3: Drop unused function dctcoef_get()Diego Biurrun2016-11-03
| | | | | | | | libavcodec/svq3.c:627:29: warning: unused function 'dctcoef_get' [-Wunused-function]
* | avcodec/svq3: Fix overflow in svq3_add_idct_c()Michael Niedermayer2017-09-22
| | | | | | | | | | | | | | | | Fixes: runtime error: signed integer overflow: 2147392585 + 524288 cannot be represented in type 'int' Fixes: 3348/clusterfuzz-testcase-minimized-4809500517203968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: Fix runtime error: left shift of negative value -6Michael Niedermayer2017-05-16
| | | | | | | | | | | | | | Fixes: 1604/clusterfuzz-testcase-minimized-5312060206350336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: Fix runtime error: signed integer overflow: 169 * 12717677 ↵Michael Niedermayer2017-05-13
| | | | | | | | | | | | | | | | | | cannot be represented in type 'int' Fixes: 1556/clusterfuzz-testcase-minimized-5027865978470400 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: Fix multiple runtime error: signed integer overflow: -237341 * ↵Michael Niedermayer2017-05-10
| | | | | | | | | | | | | | | | | | 24552 cannot be represented in type 'int' Fixes: 1429/clusterfuzz-testcase-minimized-5959951610544128 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: Fix multiple runtime error: signed integer overflow: 44161 * ↵Michael Niedermayer2017-05-07
| | | | | | | | | | | | | | | | | | 61694 cannot be represented in type 'int' Fixes: 1382/clusterfuzz-testcase-minimized-6013445293998080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: Reject dx/dy beyond 16bitMichael Niedermayer2017-05-03
| | | | | | | | | | | | The code does use 16bit sized arrays later so larger deltas would not work Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: Increase offsets to prevent integer overflowsMichael Niedermayer2017-05-03
| | | | | | | | | | | | | | Fixes: 1280/clusterfuzz-testcase-minimized-6102353767825408 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/svq3: Remove an unused function.Carl Eugen Hoyos2017-02-27
| |
* | lavc/svq3: Fail for media key encryption.Carl Eugen Hoyos2017-01-24
| | | | | | | | | | | | Tested-by: ami_stuff Fixes a part of ticket #6094.
* | lavc: Remove CR/LF from avpriv_request_sample() calls.Carl Eugen Hoyos2016-12-03
| |
* | avcodec/svq3: Reintroduce slice_typeMichael Niedermayer2016-09-08
| | | | | | | | | | | | | | | | Fixes out of array read Fixes: 1642cd3962249d6aaf0eec2836023fb6/signal_sigsegv_2557a72_2995_04efaf2ff57a052f609a3b4a2ea4e622.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/svq3: fix slice size checkMichael Niedermayer2016-08-20
| | | | | | | | | | | | | | | | Fixes out of array read Fixes: 09f46aa2175cade93e3e3932646a56a9/asan_heap-oob_4a5385_2995_498f6abfdc0248288cefe5f4b7ad316c.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/vdpau: clean up vdpau_internal.hJames Almer2016-08-04
| | | | | | | | | | | | | | | | | | | | Also don't include it on files that don't need it. This reduces differences with libav Tested-by: Timothy Gu <timothygu99@gmail.com> Reveiwed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '4e2f6212483ae1b2a4043cddf0a1cb001b476abc'Clément Bœsch2016-07-29
|\| | | | | | | | | | | | | * commit '4e2f6212483ae1b2a4043cddf0a1cb001b476abc': svq3: stop using H264Picture Merged-by: Clément Bœsch <u@pkh.me>
| * svq3: stop using H264PictureAnton Khirnov2016-06-21
| | | | | | | | | | The SVQ3 decoder has been decoupled from the H.264 decoder, so it can now use its own data type.
* | Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'Clément Bœsch2016-07-29
|\| | | | | | | | | | | | | * commit '9df889a5f116c1ee78c2f239e0ba599c492431aa': h264: rename h264.[ch] to h264dec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
| * h264: rename h264.[ch] to h264dec.[ch]Anton Khirnov2016-06-21
| | | | | | | | This is more consistent with the naming of other decoders.
* | Merge commit '4024b566d664a4b161d677554be52f32e7ad4236'Hendrik Leppkes2016-06-26
|\| | | | | | | | | | | | | * commit '4024b566d664a4b161d677554be52f32e7ad4236': golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better namesDiego Biurrun2016-05-25
| |
* | 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>