summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/mpeg4video: Split off data in a header of its ownAndreas Rheinhardt2022-01-13
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/v4l2_context: remove reinit variableMing Qian2022-01-11
| | | | | | | | Cleanup after commit 3fc72c9fc16df3b7edc329ed9eeaaa1e65976c33. Fixes coverity ticket #1497095. Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Ming Qian <ming.qian@nxp.com>
* libavcodec/qsvdec.c: using queue count to unref frameChen,Wenbin2022-01-12
| | | | | | | | | | MSDK vc1 and av1 sometimes output frame into the same suface, but ffmpeg-qsv assume the surface will be used only once, so it will unref the frame when it receives the output surface. Now change it to unref frame according to queue count. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/av1dec: honor the requested skip_frame levelJames Almer2022-01-11
| | | | | | | This supports dropping non-intra, non-key, or all frames. Tested-by: nevcairiel Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libdav1d: explicitly set Dav1dSettings.apply_grainJames Almer2022-01-10
| | | | | | Don't depend on its default value being 1, as that could change anytime. Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/flac_parser: use a custom FIFO implementationAnton Khirnov2022-01-10
| | | | | | | | | | | FLAC parser currently uses AVFifoBuffer in a highly non-trivial manner, modifying its "internals" (the whole struct is currently public, but no other code touches its contents directly). E.g. it does not use any av_fifo functions for reading the FIFO contents, but implements its own. Reimplement the needed parts of the AVFifoBuffer API in the FLAC parser, making it completely self-contained. This will allow us to make AVFifoBuffer private.
* avcodec/nvenc: zero-initialize NV_ENC_REGISTER_RESOURCE structTimo Rothenpieler2022-01-10
|
* lavc/qsvenc: add return check for ff_qsv_map_pixfmtLinjie Fu2022-01-10
| | | | | | | | Return an error directly if pixfmt is not supported for encoding, otherwise it may be hidden until query/check in MSDK. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/v4l2_context: send start decode command after dynamic resolution ↵Ming Qian2022-01-09
| | | | | | | | | | | | | | | | | | | change event Fixes decoding of sample https://streams.videolan.org/ffmpeg/incoming/720p60.mp4 on RPi4 after kernel driver commit: staging: bcm2835-codec: Format changed should trigger drain Reference: linux/Documentation/userspace-api/media/v4l/dev-decoder.rst "A source change triggers an implicit decoder drain, similar to the explicit Drain sequence. The decoder is stopped after it completes. The decoding process must be resumed with either a pair of calls to VIDIOC_STREAMOFF and VIDIOC_STREAMON on the CAPTURE queue, or a call to VIDIOC_DECODER_CMD with the V4L2_DEC_CMD_START command." Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Ming Qian <ming.qian@nxp.com>
* avcodec/v4l2_context: don't reinit output queue on dynamic resolution change ↵Ming Qian2022-01-09
| | | | | | | | | | | | | | | | | event Reference: linux/Documentation/userspace-api/media/v4l/dev-decoder.rst "During the resolution change sequence, the OUTPUT queue must remain streaming. Calling VIDIOC_STREAMOFF() on the OUTPUT queue would abort the sequence and initiate a seek. In principle, the OUTPUT queue operates separately from the CAPTURE queue and this remains true for the duration of the entire resolution change sequence as well." Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Ming Qian <ming.qian@nxp.com>
* avcodec/avcodec: Remove outdated commentAndreas Rheinhardt2022-01-09
| | | | | | | | | avcodec_open2() is supposed to be thread-safe (those codecs whose init functions are not thread-safe are guarded by a global lock). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Remove unnecessary h263.h inclusionsAndreas Rheinhardt2022-01-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/bitstream: Don't pretend VLCs to be initialized concurrentlyAndreas Rheinhardt2022-01-09
| | | | | | | | | | Since the MPEG-4 parser no longer initializes some MPEG-4 VLCs, no VLC is initialized concurrently by multiple threads (initializing static VLCs is guarded by locks and nonstatic VLCs never posed an issue in this regard). So remove the code in bitstream.c that only exists because of this possibility. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/rl: Don't pretend ff_rl_init() initializes a RLTable twiceAndreas Rheinhardt2022-01-09
| | | | | | | | | | | | It can't any longer, because all users of ff_rl_init() are now behind ff_thread_once() or the global codec lock. Therefore the check for whether the RLTable is already initialized can be removed; as can the stack buffers that existed to make sure that nothing is ever set to a value different from its final value. Similarly, it is not necessary to check whether the VLCs associated with the RLTable are already initialized (they aren't). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg4videodec: Fix data race when initializing VLCsAndreas Rheinhardt2022-01-09
| | | | | | | | | | | | | | | | | Both the MPEG-4 parser as well as the decoder initialized several VLCs. There is a "static int done = 0;" in order to guard against initializing these multiple times, but this does not work when several threads try to initialize these VLCs concurrently, which can happen when initializing several parsers at the same time (they don't use the global lock that is used for codecs without the FF_CODEC_CAP_INIT_THREADSAFE cap; actually, they don't use any lock at all). Since ff_mpeg4_decode_picture_header() now aborts early when called from the parser, it no longer needs to have these VLCs initialized at all. This commit therefore does exactly this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg4video: Skip unneeded element when parsing picture headerAndreas Rheinhardt2022-01-09
| | | | | | | | | | Namely, skip some elements that are only useful for a decoder when calling ff_mpeg4_decode_picture_header() from the MPEG-4 parser. In particular, this ensures that the VLCs need no longer be initialized by the parser. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h263: Move functions only used once to their callerAndreas Rheinhardt2022-01-09
| | | | | | | In this case it means moving ff_h263_pred_dc() resp. ff_h263_pred_acdc() to ituh263enc.c resp. ituh263dec.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Avoid macro/av_calloc for ordinary allocationsAndreas Rheinhardt2022-01-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Don't unnecessarily allocate buffersAndreas Rheinhardt2022-01-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12dec: Don't set write-only variableAndreas Rheinhardt2022-01-09
| | | | | | MpegEncContext.picture_number is write-only for MPEG-1/2 decoding. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeglsdec: Avoid get_bits_long() where possibleAndreas Rheinhardt2022-01-08
| | | | | | | | It is possible here, because the values of ff_log2_run used here are actually in the range 0..15 given that run_index is in the range 0..31. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aarch64: Disable ff_hevc_sao_band_filter_8x8_8_neon out of precautionMartin Storsjö2022-01-07
| | | | | | | | | | While this function on its own passes all of fate-hevc, there's indications that the function might need to handle widths that aren't a multiple of 8 (noted in commit f63f9be37c799ddc835af358034630d31fb7db02, which later was reverted). Signed-off-by: Martin Storsjö <martin@martin.st>
* Revert "lavc/aarch64: add hevc sao edge 16x16"Martin Storsjö2022-01-07
| | | | | | | This reverts commit a9214a2ca31c9d54f893c5ac4004a5ff30a08d10, as it breaks fate-hevc. Signed-off-by: Martin Storsjö <martin@martin.st>
* Revert "lavc/aarch64: add hevc sao edge 8x8"Martin Storsjö2022-01-07
| | | | | | | This reverts commit c97ffc1a77ccaf901e642bd21ed26aaf75557745, as it breaks fate-hevc. Signed-off-by: Martin Storsjö <martin@martin.st>
* Revert "lavc/aarch64: add hevc sao band 8x8 tiling"Martin Storsjö2022-01-07
| | | | | | | This reverts commit f63f9be37c799ddc835af358034630d31fb7db02, as it breaks fate-hevc. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/apedec: Fix integer overflows in predictor_update_3930()Michael Niedermayer2022-01-07
| | | | | | | | Fixes: signed integer overflow: 1074134419 - -1075212485 cannot be represented in type 'int' Fixes: 43273/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4706880883130368 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/takdec: Don't initialize get_bits context to read one valueAndreas Rheinhardt2022-01-07
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/av1dec: use frame split bsfFei Wang2022-01-07
| | | | | | | | | Split packed data in case of its contains multiple show frame in some non-standard bitstream. This can benefit decoder which can decode continuously instead of interrupt with unexpected error. Signed-off-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/libdav1d: honor the requested strict_std_compliance level on ↵James Almer2022-01-06
| | | | | | supported builds Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/golomb: Factor writing golomb codes outAndreas Rheinhardt2022-01-06
| | | | | | | | Most users only want to either read or write golomb codes, not both. By splitting these headers one avoids having unnecesssary (get|put)_hits.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/Makefile: Add missing entry for ADPCM_IMA_AMV_ENCODERAndreas Rheinhardt2022-01-06
| | | | | | | Forgotten in 555f5c1fc5ae0c4e7b0431dc3166c3fcf3f4e979. Reviewed-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/Makefile: Only compile nvenc.o if neededAndreas Rheinhardt2022-01-05
| | | | | | | | | | | | This fixes compilation errors in case nvenc is enabled (e.g. autodected) with both nvenc-based encoders disabled because nvenc uses ff_alloc_a53_sei(), yet only the nvenc-based encoders require atsc_a53. (This error does not manifest itself in case of static linking (nothing pulls in nvenc.o), but it exists with shared builds.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/Makefile: Add missing HEVC decoder->h274.o dependencyAndreas Rheinhardt2022-01-05
| | | | | | Forgotten in 3cc3f5de2afda5b8f880c0817e9d67c2dafbfe1e. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/Makefile: Add missing mpegaudiodata.o dependency to MPEGAUDIOAndreas Rheinhardt2022-01-05
| | | | | | | | | | | | | | mpegaudiodec_template.c uses stuff from mpegaudiodata directly, yet this dependency was only indirectly fulfilled via mpegaudio-headers before 33e6d57f01dd4742a2e25ac5fa072b487d9d02ce. Since this commit, the latter only needs (and therefore provides) mpegaudiotabs, leading to compilation failures. This commit adds this missing direct dependency directly. (Sorry for not having checked indirect dependencies.) Found-by: Zane van Iperen <zane@zanevaniperen.com> Reviewed-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/qsvdec: needn't free the string for AV_OPT_TYPE_STRING AVOptionHaihao Xiang2022-01-05
| | | | | | | The string for AV_OPT_TYPE_STRING AVOption gets freed by av_opt_free() when closing the AVCodecContext Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: set base address for V planeHaihao Xiang2022-01-05
| | | | | | | | | | | | | The SDK checks Data.V when using system memory for VP9 encoding. This fixed the error below: $ ffmpeg -qsv_device /dev/dri/renderD129 -f lavfi -i yuvtestsrc -c:v vp9_qsv -f null - [vp9_qsv @ 0x55b8387cbe90] Error during encoding: NULL pointer (-2) Video encoding failed Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/videotoolbox: Fix undefined symbol with minimal configurationLimin Wang2022-01-05
| | | | | | | | | | | | | | | | | Please reproduced with the following minimal configure command: ./configure --enable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox You'll get below error: Undefined symbols for architecture x86_64: "_ff_videotoolbox_vpcc_extradata_create", referenced from: _videotoolbox_start in videotoolbox.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Reported-by: Cameron Gutman <aicommander@gmail.com> Tested-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpeg12enc: Inline constantsAndreas Rheinhardt2022-01-04
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Partially inline whether codec is MPEG-1Andreas Rheinhardt2022-01-04
| | | | | | | MPEG-1 only supports 4:2:0, so one can optimize away the checks for whether one encodes MPEG-1 in codepaths that encode 4:2:2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Also inline chroma subsamplingAndreas Rheinhardt2022-01-04
| | | | | | | | | | | ff_mpeg1_encode_mb() contains two inlined calls to mpeg1_encode_mb_internal(); these calls are supposed to inline the properties depending upon the color space used. Yet inlining vertical chroma subsampling (which allows to remove complete branches and blocks depending upon them) has been forgotten. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Remove dead code at compile timeAndreas Rheinhardt2022-01-04
| | | | | | There are no encoders for interlaced dct that support 4:4:4. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Improve inlining of chroma_formatAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | encode_mb() calls encode_mb_internal() three times, once for each supported chroma format. The reason for this is that some chroma format dependent parameters can then be inlined as encode_mb_internal() is marked as av_always_inline. Yet the most basic parameters based upon chroma format have not been inlined: The chroma format itself and the chroma subsampling parameters. This commit does so. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Add new mpegvideodec CONFIG_EXTRAAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | This allows to remove the spurious dependencies of mpegvideo encoders on error_resilience; some other components that do not use mpegvideo to its fullest turned out to not need it either. Adding a new CONFIG_EXTRA needs a reconfigure to take effect. In order to force this a few unnecessary headers from lavfi/allfilters.c have been removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move decoding-only code into a new fileAndreas Rheinhardt2022-01-04
| | | | | | | This will allow to disable this code altogether when all decoders are disabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Remove always-false checkAndreas Rheinhardt2022-01-04
| | | | | | | | | | An AVCodecContext's private data is always allocated in avcodec_open2() and calling avcodec_flush_buffers() on an unopened AVCodecContext (or an already closed one) is not allowed (and will crash before the decoder's flush function is even called). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Don't initialize error resilience context for encoderAndreas Rheinhardt2022-01-04
| | | | | | It is only used for decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Check for no_rounding at compile-time if possibleAndreas Rheinhardt2022-01-04
| | | | | | | | It is partially possible if it is inlined whether we deal with MPEG-1/2, because no_rounding is never set for MPEG-1/2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Remove always-true branchAndreas Rheinhardt2022-01-04
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Try to perform check for MPEG-1/2 at compile-timeAndreas Rheinhardt2022-01-04
| | | | | | This is possible if CONFIG_SMALL is not true. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Partially check for being encoder at compile-timeAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | Whether lowres is in use or not is inlined in mpv_reconstruct_mb_internal(), so one can use the fact that lowres is always zero during encoding to evaluate the checks for whether one is encoding or not at compile-time when one is in lowres mode. Also reorder the main check to check for whether it is an encoder first to shortcircuit it in the common case of a decoder. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>