summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* 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/hapdec: Remove always-false checkAndreas Rheinhardt2022-02-09
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pthread_frame: Don't prematurily presume frame-threadingAndreas Rheinhardt2022-02-09
| | | | | | | | | | | Several of our decoders support both frame- as well as slice-threading; in case of the latter avctx->internal->thread_ctx points to a SliceThreadContext, not to a frame-thread PerThreadContext. So only treat avctx->internal->thread_ctx as the latter after having checked that frame-threading is active. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/motion_est: fix indention of ff_get_best_fcode()Michael Niedermayer2022-02-09
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/motion_est: Fix xy indexing on range violation in ff_get_best_fcode()Michael Niedermayer2022-02-09
| | | | | | | This codepath seems untested, no testcases change Found-by: <mkver> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/jpeglsdec: Increase range for N in ls_get_code_runterm() by using ↵Michael Niedermayer2022-02-09
| | | | | | | | | | | | unsigned Fixes: left shift of 32768 by 16 places cannot be represented in type 'int' Fixes: Timeout Fixes: 44219/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMVJPEG_fuzzer-4679455379947520 Fixes: 44088/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMVJPEG_fuzzer-4885976600674304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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/hcadec: Mark decoder as init-threadsafeAndreas Rheinhardt2022-02-09
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hcadec: Fix memleak upon allocation errorAndreas Rheinhardt2022-02-09
| | | | | | | An AVFloatDSPContext would leak upon av_tx_init() failure. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_mpeg2: Use smaller scope for variablesAndreas Rheinhardt2022-02-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal.h: Move avpriv_find_start_code() to startcode.hAndreas Rheinhardt2022-02-08
| | | | | | | | This is by definition the appropriate place for it. Remove all the now unnecessary libavcodec/internal.h inclusions; also remove other unnecessary headers from the affected files. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_mpeg2: Simplify splitting fragmentAndreas Rheinhardt2022-02-08
| | | | | | | | | | | | | | | | | | | | | | avpriv_find_start_code() supports non-contiguous buffers by maintaining a state that allows to find start codes that span across multiple buffers; a consequence thereof is that avpriv_find_start_code() is given a zero-sized buffer, it does not modify this state, so that it appears as if a start code was found if the state contained a start code. This can e.g. happen with Sequence End units in MPEG-2 and to counter this, cbs_mpeg2_split_fragment() reset the state when it has already encountered the end of the fragment in order to add the last unit (if it is only of the form 00 00 01 xy) only once; it also used a flag to set whether this is the final unit. Yet this can be improved by simply resetting state unconditionally (thereby avoiding a branch); the flag can be removed by just checking whether we have a valid start code (of the next unit to add) at the end. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Make ff_cbs_insert_unit_data() always append the new unitAndreas Rheinhardt2022-02-08
| | | | | | | All split functions (the only users of this function) only append units. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_jpeg: Remove redundant counterAndreas Rheinhardt2022-02-08
| | | | | | | | | | Use -1 as the position in ff_cbs_insert_unit_data() which implicitly reuses frag->nb_units as the counter. Also switch to a do-while-loop, as it is more natural than a for-loop now that the counter is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_mpeg2: Remove redundant counterAndreas Rheinhardt2022-02-08
| | | | | | | | | | Use -1 as the position in ff_cbs_insert_unit_data() which implicitly reuses frag->nb_units as the counter. Also switch to a do-while-loop, as it is more natural than a for-loop now that the counter is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Reindent after the previous commitAndreas Rheinhardt2022-02-07
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/qsvenc: switch to new FIFO APIAnton Khirnov2022-02-07
|
* lavc/qsvdec: switch to the new FIFO APIAnton Khirnov2022-02-07
|
* lavc/nvenc: switch to the new FIFO APIAnton Khirnov2022-02-07
|
* lavc/libvpxenc: remove unneeded context variableAnton Khirnov2022-02-07
| | | | | discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test for the latter and avoid an extra variable.
* lavc/libvpxenc: switch to the new FIFO APIAnton Khirnov2022-02-07
|
* lavc/libvorbisenc: switch to new FIFO APIAnton Khirnov2022-02-07
|
* lavc/cuviddec: convert to the new FIFO APIAnton Khirnov2022-02-07
|
* lavc/cuviddec: do not reallocate the fifo unnecessarilyAnton Khirnov2022-02-07
|
* lavc/amfenc: switch to new FIFO APIAnton Khirnov2022-02-07
|
* lavc/avcodec: switch to new FIFO APIAnton Khirnov2022-02-07
|
* avcodec/decode: ignore unsupported skip samples packet side data valuesJames Almer2022-02-05
| | | | | | | Same as in the AV_FRAME_FLAG_DISCARD codepath, ensure avci->skip_samples is not negative. Signed-off-by: James Almer <jamrial@gmail.com>
* libfdk-aacdec: Flush delayed samples at the endMartin Storsjö2022-02-03
| | | | | | | | | | | | | | The fdk-aac decoder can return decoded audio data with a delay. (Whether it does this or not depends on the options set; by default it does add some delay.) Previously, this delay was handled by adjusting the timestamps of the decoded frames, but the last delayed samples weren't returned. Set the AV_CODEC_CAP_DELAY flag to indicate that the caller should flush remaining samples at the end. Also trim off the corresponding amount of samples at the start instead of adjusting timestamps. Signed-off-by: Martin Storsjö <martin@martin.st>
* libfdk-aacdec: Add an option for setting the decoder's DRC album modeMartin Storsjö2022-02-03
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/libdav1d: free the Dav1dData packet on dav1d_send_data() failureJames Almer2022-02-01
| | | | | | | | | We still own it on failure, and there's no point trying to feed it again. This should address the issue reported in dav1d #383 and part of VLC #26259. Signed-off-by: James Almer <jamrial@gmail.com> Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
* avcodec/cfhd: Avoid signed integer overflow in coeffMichael Niedermayer2022-02-01
| | | | | | | | Fixes: signed integer overflow: 15244032 * 256 cannot be represented in type 'int' Fixes: 43504/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4865014842916864 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264_ps: Remove ALLOW_INTERLACED cruftAndreas Rheinhardt2022-01-29
| | | | | | | | | | | | | | | | Since e1027aba680c4382c103fd1100cc5567a1530abc, ALLOW_INTERLACED is no longer defined in h264_ps.c, leading to a warning when encountering an SPS compatible with MBAFF. This warning was always nonsense, because ff_h264_decode_seq_parameter_set() is also used by the parser and it makes no sense for the parser to warn about missing decoder features; after all, it is not a parser's job to warn when a feature is unsupported by a decoder (and in this case it is even weirder, because even if the H.264 decoder is disabled, the warning will only be shown for MBAFF sequence parameter sets). So remove the warning in h264_ps.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libxvid: Don't set AVCodecContext.codec_idAndreas Rheinhardt2022-01-29
| | | | | | | Unnecessary since 2325bdad7b67b1c8539ef6beebb99d3247f08669 (and crazy even before then). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg4videodec: Move use_intra_dc_vlc to stack, fix data raceAndreas Rheinhardt2022-01-29
| | | | | | | | | | | | | | | | | | | | | | | use_intra_dc_vlc is currently kept in sync between frame threads in mpeg4_update_thread_context(), yet it is set when decoding blocks, i.e. after ff_thread_finish_setup(). This is a data race and therefore undefined behaviour. This race can be fixed easily by moving the variable from the context to the stack: use_intra_dc_vlc is only read in mpeg4_decode_block() and only if one is decoding an intra block. There are three callsites for this function: One in mpeg4_decode_partitioned_mb() which always sets use_intra_dc_vlc before the call and two in mpeg4_decode_mb(). One of these callsites is for intra blocks and use_intra_dc_vlc is set before it; the last callsite is for non-intra blocks, where use_intra_dc_vlc is ignored. So if it is used, it always uses a new value and can therefore be moved to the stack. The above also explains why this data race did not lead to FATE-test failures. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Use offset instead of pointer for vbv_delayAndreas Rheinhardt2022-01-29
| | | | | | | | | | An offset has the advantage of not needing to be updated when the buffer is reallocated. Furthermore, the way the pointer is currently updated is undefined behaviour in case the pointer is not already set (i.e. when not encoding MPEG-1/2), because it calculates the nonsense NULL - s->pb.buf. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Add function to completely free MPEG-PictureAndreas Rheinhardt2022-01-29
| | | | | | | | | Also use said function in mpegvideo.c and mpegvideo_enc.c; and make ff_free_picture_tables() static as it isn't needed anymore outside of mpegpicture.c. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Let ff_mpeg_unref_picture() free picture tablesAndreas Rheinhardt2022-01-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move MPEG-4 Simple Studio Profile fields to mpeg4videoAndreas Rheinhardt2022-01-29
| | | | | | | | | | This is possible now that dealing with the Simple Studio Profile has been moved to mpeg4videodec.c. It also allows to avoid allocations, because one can simply put the required buffers on the context (if one made these buffers part of MpegEncContext, the memory would be wasted for every codec other than MPEG-4). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move handling Simple Studio Profile to mpeg4videodecAndreas Rheinhardt2022-01-29
| | | | | | This is its only user. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Fix crash when using lowres with 10bit MPEG-4Andreas Rheinhardt2022-01-29
| | | | | | | | | | | | | | In this case the macroblocks written to are smaller, yet the MPEG-4 Simple Studio Profile code for 10bit DPCM ignored this; e.g. in case of lowres = 2 or = 3, the sample mpeg4_sstp_dpcm.m4v from the FATE-suite reads beyond the end of the buffer. This commit fixes this by taking lowres into account. The DPCM macroblocks of the aforementioned sample look as good as can be expected after this patch; yet the non-DPCM coded macroblocks are simply corrupt. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Fix off-by-one error when decoding >8 bit MPEG-4Andreas Rheinhardt2022-01-29
| | | | | | | | Fixes visual corruptions on two macroblocks from two frames from https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4447/A003C003_SR_422_23.98p.mxf Reviewed-by: Kieran Kunhya <kierank@obe.tv> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Don't hardcode list of codecs supporting bframesAndreas Rheinhardt2022-01-29
| | | | | | Check for the encoder's AV_CODEC_CAP_DELAY instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Localize check for invalid number of b-framesAndreas Rheinhardt2022-01-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move frame_rate_index to (Mpeg1|MPEG12Enc)ContextAndreas Rheinhardt2022-01-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Move H.263p? encoders to ituh263enc.cAndreas Rheinhardt2022-01-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Move msmpeg4/wmv1 encoders to msmpeg4enc.cAndreas Rheinhardt2022-01-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContextAndreas Rheinhardt2022-01-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Don't sync gop_picture_number among slice threadsAndreas Rheinhardt2022-01-29
| | | | | | It is only used by the main thread. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>