aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/tests
Commit message (Collapse)AuthorAgeFilesLines
* libavcodec/tests: fix gitignore hashtableNicolas Gaullier2025-06-281-0/+1
| | | | | Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tests/dct: add CONFIG_PRORES_DECODER guardPeter Ross2025-06-171-0/+6
| | | | | | Only enable the proresdsp check when the prores decoder is enabled. This fixes fate when configuring with --disable-everything
* avcodec/iirfilter: Remove iirfilter, psy-preprocessingAndreas Rheinhardt2025-06-062-70/+0
| | | | | | | | The iirfilter is only used in its test tool since 01ecb7172b684f1c4b3e748f95c5a9a494ca36ec which stopped using it in AAC, its only user. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/hashtable: create generic robin hood hash tableEmma Worley2025-06-021-0/+110
| | | | | | Adds a generic hash table with the DXV encoder as an initial use case. Signed-off-by: Emma Worley <emma@emma.gg>
* avcodec/tests/avcodec: Check only frame-mt decoders set update_thread_ctxAndreas Rheinhardt2025-05-211-0/+3
| | | | | | Possible since 554b52b1b3f653ab3e59a0004da73b7aaf0fc4fd. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/.gitignore: Add apv test toolAndreas Rheinhardt2025-05-211-0/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: Add unit test for APV entropy decodeMark Thompson2025-05-131-0/+449
|
* avcodec/mjpegenc_huffman: Avoid AV_QSORT to sort entries by lengthAndreas Rheinhardt2025-04-181-46/+57
| | | | | | | | | | | | | | | | | | | | It is unnecessary, as we already have the entries sorted by probability and therefore implicitly by length. All we need on top of that to build the tree is the number of entries of a given length. Doing so gives a 3.6% speedup of ff_mjpeg_encode_huffman_close() here; it also saves about 640B of .text here. The new code puts values with higher probability to the left of the tree. The old code did not and therefore the FATE checksums needed to be updated. Due to MJPEG's 0xFF unescaping file sizes as well as file checksums needed to be updated; the decoded picture hashes stayed the same. Given that codes on the left of the tree have on average fewer bits set than codes on the right, the file sizes mostly improve (all except vsynth3-mjpeg-444). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/mjpegenc_huffman: Also test length countsAndreas Rheinhardt2025-04-181-11/+37
| | | | | | This is better than just testing that the tree is not overdetermined. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_huffman: Make ff_mjpegenc_huffman_compute_bits() staticAndreas Rheinhardt2025-04-091-9/+9
| | | | | | Only used here and in a test tool. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/celp_math: Reuse ff_scalarproduct_float_c()Andreas Rheinhardt2025-04-091-2/+9
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/avcodec: Silence deprecation warningsAndreas Rheinhardt2025-03-131-0/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/simple_idct: Move ProRes-only code to proresdsp.cAndreas Rheinhardt2025-02-271-1/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeg2000: Fix undefined behaviour in left shift operationsOsamu Watanabe2024-12-071-1/+1
| | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
* avcodec/jpeg2000: Improve FF_DWT97_INT to pass ISO/IEC 15444-4 conformance testsOsamu Watanabe2024-11-081-0/+5
| | | | | | Fixes https://trac.ffmpeg.org/ticket/10123 Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
* avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.cAndreas Rheinhardt2024-06-301-1/+16
| | | | | | It is only used by the test. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/me_cmp: Zero MECmpContext in ff_me_cmp_init()Andreas Rheinhardt2024-06-201-2/+0
| | | | | | | | | Not every function will be set, so zero the context to initialize everything. This also allows to remove an initialization in dvenc.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/dct: Use 64bit in intermediate for error computationMichael Niedermayer2024-06-021-2/+2
| | | | | | | Fixes: CID1500284 Unintentional integer overflow Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tests/jpeg2000dwt: Use 64bit in comparissionMichael Niedermayer2024-06-021-1/+1
| | | | | | | Found while reviewing: CID1500309 Unintentional integer overflow Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tests/jpeg2000dwt: Use 64bit in err2 computationMichael Niedermayer2024-06-021-1/+1
| | | | | | | | | This issue cannot happen with the current function parameters Fixes: CID1500309 Unintentional integer overflow Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tests/bitstream_template: Assert bits_init8() returnMichael Niedermayer2024-05-281-1/+3
| | | | | | | | Helps: CID1518967 Unchecked return value Helps: CID1518968 Unchecked return value Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/aarch64/fdct: add neon-optimized fdct for aarch64Ramiro Polla2024-05-131-0/+2
| | | | | | | The code is imported from libjpeg-turbo-3.0.1. The neon registers used have been changed to avoid modifying v8-v15. Reviewed-by: Martin Storsjö <martin@martin.st>
* Remove remnants of prores_lgpl decoderAndreas Rheinhardt2024-05-071-2/+2
| | | | | | Forgotten in 5c6a3604f0592786db557c82de93112745597a2d. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Remove FF_CODEC_CAP_ALLOCATE_PROGRESSAndreas Rheinhardt2024-04-191-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before commit f025b8e110b36c1cdb4fb56c4cd57aeca1767b5b, every frame-threaded decoder used ThreadFrames, even when they did not have any inter-frame dependencies at all. In order to distinguish those decoders that need the AVBuffer for progress communication from those that do not (to avoid the allocation for the latter), the former decoders were marked with the FF_CODEC_CAP_ALLOCATE_PROGRESS internal codec cap. Yet distinguishing these two can be done in a more natural way: Don't use ThreadFrames when not needed and split ff_thread_get_buffer() into a core function that calls the user's get_buffer2 callback and a wrapper around it that also allocates the progress AVBuffer. This has been done in 02220b88fc38ef9dd4f2d519f5d3e4151258b60c and since that commit the ALLOCATE_PROGRESS cap was nearly redundant. The only exception was WebP and VP8. WebP can contain VP8 and uses the VP8 decoder directly (i.e. they share the same AVCodecContext). Both decoders are frame-threaded and VP8 has inter-frame dependencies (in general, not in valid WebP) and therefore the ALLOCATE_PROGRESS cap. In order to avoid allocating progress in case of a frame-threaded WebP decoder the cap and the check for the cap has been kept in place. Yet now the VP8 decoder has been switched to use ProgressFrames and therefore there is just no reason any more for this check and the cap. This commit therefore removes both. Also change the value of FF_CODEC_CAP_USES_PROGRESSFRAMES to leave no gaps. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/decode: Add new ProgressFrame APIAndreas Rheinhardt2024-04-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Frame-threaded decoders with inter-frame dependencies use the ThreadFrame API for syncing. It works as follows: During init each thread allocates an AVFrame for every ThreadFrame. Thread A reads the header of its packet and allocates a buffer for an AVFrame with ff_thread_get_ext_buffer() (which also allocates a small structure that is shared with other references to this frame) and sets its fields, including side data. Then said thread calls ff_thread_finish_setup(). From that moment onward it is not allowed to change any of the AVFrame fields at all any more, but it may change fields which are an indirection away, like the content of AVFrame.data or already existing side data. After thread A has called ff_thread_finish_setup(), another thread (the user one) calls the codec's update_thread_context callback which in turn calls ff_thread_ref_frame() which calls av_frame_ref() which reads every field of A's AVFrame; hence the above restriction on modifications of the AVFrame (as any modification of the AVFrame by A after ff_thread_finish_setup() would be a data race). Of course, this av_frame_ref() also incurs allocations and therefore needs to be checked. ff_thread_ref_frame() also references the small structure used for communicating progress. This av_frame_ref() makes it awkward to propagate values that only become known during decoding to later threads (in case of frame reordering or other mechanisms of delayed output (like show-existing-frames) it's not the decoding thread, but a later thread that returns the AVFrame). E.g. for VP9 when exporting video encoding parameters as side data the number of blocks only becomes known during decoding, so one can't allocate the side data before ff_thread_finish_setup(). It is currently being done afterwards and this leads to a data race in the vp9-encparams test when using frame-threading. Returning decode_error_flags is also complicated by this. To perform this exchange a buffer shared between the references is needed (notice that simply giving the later threads a pointer to the original AVFrame does not work, because said AVFrame will be reused lateron when thread A decodes the next packet given to it). One could extend the buffer already used for progress for this or use a new one (requiring yet another allocation), yet both of these approaches have the drawback of being unnatural, ugly and requiring quite a lot of ad-hoc code. E.g. in case of the VP9 side data mentioned above one could not simply use the helper that allocates and adds the side data to an AVFrame in one go. The ProgressFrame API meanwhile offers a different solution to all of this. It is based around the idea that the most natural shared object for sharing information about an AVFrame between decoding threads is the AVFrame itself. To actually implement this the AVFrame needs to be reference counted. This is achieved by putting a (ownership) pointer into a shared (and opaque) structure that is managed by the RefStruct API and which also contains the stuff necessary for progress reporting. The users get a pointer to this AVFrame with the understanding that the owner may set all the fields until it has indicated that it has finished decoding this AVFrame; then the users are allowed to read everything. Every decoder may of course employ a different contract than the one outlined above. Given that there is no underlying av_frame_ref(), creating references to a ProgressFrame can't fail. Only ff_thread_progress_get_buffer() can fail, but given that it will replace calls to ff_thread_get_ext_buffer() it is at places where errors are already expected and properly taken care of. The ProgressFrames are empty (i.e. the AVFrame pointer is NULL and the AVFrames are not allocated during init at all) while not being in use; ff_thread_progress_get_buffer() both sets up the actual ProgressFrame and already calls ff_thread_get_buffer(). So instead of checking for ThreadFrame.f->data[0] or ThreadFrame.f->buf[0] being NULL for "this reference frame is non-existing" one should check for ProgressFrame.f. This also implies that one can only set AVFrame properties after having allocated the buffer. This restriction is not deep: if it becomes onerous for any codec, ff_thread_progress_get_buffer() can be broken up. The user would then have to get a buffer himself. In order to avoid unnecessary allocations, the shared structure is pooled, so that both the structure as well as the AVFrame itself are reused. This means that there won't be lots of unnecessary allocations in case of non-frame-threaded decoding. It might even turn out to have fewer than the current code (the current code allocates AVFrames for every DPB slot, but these are often excessively large and not completely used; the new code allocates them on demand). Pooling relies on the reset function of the RefStruct pool API, it would be impossible to implement with the AVBufferPool API. Finally, ProgressFrames have no notion of owner; they are built on top of the ThreadProgress API which also lacks such a concept. Instead every ThreadProgress and every ProgressFrame contains its own mutex and condition variable, making it completely independent of pthread_frame.c. Just like the ThreadFrame API it is simply presumed that only the actual owner/producer of a frame reports progress on said frame. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-312-0/+2
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/snowenc: Fix mixed declaration and codeAndreas Rheinhardt2024-03-151-1/+1
| | | | | Reviewed-by: Sean McGovern <gseanmcg@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Avoid codec_desc.h, codec_par.h inclusionsAndreas Rheinhardt2023-10-031-1/+1
| | | | | | | | | Instead, use forward declarations; and in order not to affect any user include these headers for them, but not internally. This has the advantage of removing implicit inclusions of these headers from almost all files providing codecs. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Remove DCT, FFT, MDCT and RDFTAndreas Rheinhardt2023-10-014-732/+0
| | | | | | | | | | | | | They were replaced by TX from libavutil; the tremendous work to get to this point (both creating TX as well as porting the users of the components removed in this commit) was completely performed by Lynne alone. Removing the subsystems from configure may break some command lines, because the --disable-fft etc. options are no longer recognized. Co-authored-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/.gitignore: Add bitstream test toolsAndreas Rheinhardt2023-09-281-0/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/av1: Add unit test for level handlingFei Wang2023-09-222-0/+127
| | | | | Signed-off-by: Fei Wang <fei.w.wang@intel.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
* avutil/mem: Don't include avutil.hAndreas Rheinhardt2023-09-071-1/+5
| | | | | | | | | It is not necessary at all. So remove it. This also breaks an inclusion cycle mem.h->avutil.h->common.h->mem.h. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/internal: Don't auto-include emms.hAndreas Rheinhardt2023-09-042-0/+2
| | | | | | Instead include emms.h wherever it is needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/avfft: deprecate the APILynne2023-09-011-0/+6
| | | | This deprecates the currently unused API.
* avcodec/dct: Move fdct function declarations to fdctdsp.hAndreas Rheinhardt2023-07-291-0/+1
| | | | | | | | | It is the more proper place for them given that this is the only API using them. Also use a forward-declaration of AVCodecContext in fdctdsp.h to avoid including avcodec.h in jfdct(fst|int).c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/test/avcodec: check decoders for FF_CODEC_CAP_SETS_PKT_DTSJames Almer2023-07-111-0/+4
| | | | | | Ensure that only decode() callback ones set it. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/tests/avcodec: Remove unnecessary internal.h inclusionAndreas Rheinhardt2023-06-301-1/+0
| | | | | | Forgotten in a688f3c13ce55c2ba51dbbb344564649f1bb52fe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: deprecate AV_CODEC_CAP_SUBFRAMESAnton Khirnov2023-05-151-2/+1
| | | | There is nothing meaningful the caller can do with it.
* avcodec/tests/snowenc: Fix 2nd testMichael Niedermayer2023-03-261-2/+2
|
* avcodec/tests/snowenc: return a failure if DWT/IDWT mismatchesMichael Niedermayer2023-03-261-3/+10
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tests/snowenc: unbreak DWT testsMichael Niedermayer2023-03-261-9/+14
| | | | | | the IDWT data type mismatched current code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc: add a private cap for fake-delay encodersAnton Khirnov2023-01-291-0/+4
| | | | | | | | | Some encoders (ffv1, flac, adx) are marked with AV_CODEC_CAP_DELAY onky in order to be flushed at the end, otherwise they behave as no-delay encoders. Add a capability to mark these encoders. Use it for setting pts generically.
* lavc/tests/bitstream: test bits_*_signed_nz and bits_peek_signed*Anton Khirnov2023-01-181-1/+18
|
* lavc/tests: add a cached bitstream reader testAnton Khirnov2023-01-063-0/+222
|
* avcodec/tests/fft: Fix building with CONFIG_MDCT disabledMartin Storsjö2022-11-071-0/+4
| | | | | | | Since e6afa61be97674312e36c9b6f8bb5fba009232e7, no components in libavcodec enable CONFIG_MDCT. This fixes building "make testprogs". Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new headerAndreas Rheinhardt2022-10-041-0/+3
| | | | | | It allows to avoid including mpegvideo.h when including mpeg12.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/avcodec: Mark frame-thrd encoder incompatible with delayAndreas Rheinhardt2022-08-271-0/+3
| | | | | | | The API for frame-threaded encoders only works for one-in-one-out encoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/tests/snowenc: Remove unused-but-set variableAndreas Rheinhardt2022-07-031-11/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/x86/idctdsp: Remove obsolete MMX(EXT) functionsAndreas Rheinhardt2022-06-221-3/+0
| | | | | | | | | | | x64 always has MMX, MMXEXT, SSE and SSE2 and this means that some functions for MMX, MMXEXT and 3dnow are always overridden by other functions (unless one e.g. explicitly disables SSE2) for x64. So given that the only systems that benefit from these functions are truely ancient 32bit x86s they are removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/x86/xvididct: Remove obsolete MMX(EXT) functionsAndreas Rheinhardt2022-06-221-4/+0
| | | | | | | | | | | x64 always has MMX, MMXEXT, SSE and SSE2 and this means that some functions for MMX, MMXEXT and 3dnow are always overridden by other functions (unless one e.g. explicitly disables SSE2) for x64. So given that the only systems that benefit from these functions are truely ancient 32bit x86s they are removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>