summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/mpegvideoenc: Remove ineffective optionsAndreas Rheinhardt2022-05-24
| | | | | | | | | | | | | | | | This commit removes the ineffective FF_MPV_DEPRECATED_ options, namely mpeg_quant (this is only an option for MPEG-4), a53cc (this is only an option for MPEG-2), force_duplicated_matrix (applies only to MJPEG) and b_strategy, b_sensitivity and brd_scale (these options only make sense for encoders supporting B-frames, which currently means the MPEG-1/2 and MPEG-4 encoders). Given that these options never changed the outcome of encoding, they are removed at once. Notice that the options for the encoders for which it made sense are not affected by this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: Remove pointless motion-estimation optionsAndreas Rheinhardt2022-05-24
| | | | | | | | (M)JPEG does not use motion estimation/motion vectors at all. These options therefore don't affect the output at all. So remove them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideoenc: Remove ineffective [pb]bias optionsAndreas Rheinhardt2022-05-24
| | | | | | | | | | | The user-provided value is overwritten in ff_mpv_encode_init() without having ever been read. (This has been broken when making these options mpegvideo-specific in commits 910247f1720c6aae422723c05dac6d0b19f20bec and cf7d2f2d2134c0854edf2db91e7436ac2bc9874f. No one has ever complained, so this commit removes these fields.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pthread_frame: Don't update the first thread ctx before freeingAndreas Rheinhardt2022-05-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, ff_frame_thread_free() uses the last worker thread to updates the first worker thread via update_context_from_thread() immediately before freeing all these worker threads. This is a remnant of the time in which the first worker was special. (E.g. the first worker shared its AVCodecInternal with the public AVCodecContext.) But these times are over (none of the uses of is_copy matter for ff_frame_thread_free()); nowadays the only thing that update_context_from_thread() does is referencing a few buffers/frames and replacing them with other references instead. These new references will then be freed immediately thereafter when the first worker thread is freed. Ensuring that the code is free of double-frees is achieved by using reference-counted structures (or in case of AVChannelLayouts: by giving each worker its own copy). Some archaeology: a) Updating the first worker thread from the last one used has been done since frame-threading was added in 37b00b47cbeecd66bb34c5c7c534d016d6e8da24. b) The precursor to ff_mpv_common_end() checked for is_copy before freeing pictures (i.e. it only freed them for the first worker thread). c) Commits c2dfb1e37cc72bf144545c4410a4621cbff5c4b1 and e33811bd2686411233cb0eb4a4ee45eb99d7e736 modified the update_thread_context function of the H.264 decoder so that it could fail before calling ff_mpeg_update_thread_context(). d) This led to a double free/an assert violation with a H.264 sample for which ff_mpeg_update_thread_context() is not reached for the final update_context_from_thread(). Commit a6e4796fbf0aa9b13451a8ef917ecc4e80d1d272 added code to fix this sample. e) This issue was fixed (even with the last mentioned commit reverted) when the H.264 decoder was deMpegEncContextized in commit b7fe35c9e50e1701274364adf7280bf4a02b092b (merging commit 2c541554076cc8a72e7145d4da30389ca763f32f). f) mpegvideo.c stopped using is_copy when it was switched to refcounted frames in 759001c534287a96dc96d1e274665feb7059145d. g) 1f4cf92cfbd3accbae582ac63126ed5570ddfd37 removed the init_thread_copy callbacks; now no FFCodec.close callback checks for is_copy at all any more. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libdavs2: export has_b_frames infoZhao Zhili2022-05-24
| | | | | | | More precisely, we should use picture_reorder_delay, but it's unavailable yet. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/libuavs3d: use output_reorder_delay as has_b_framesZhao Zhili2022-05-24
| | | | | | | has_b_frames is more than a bool, it's the size of the frame reordering buffer in the decoder. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/avs3_parser: set has_b_frames properlyZhao Zhili2022-05-24
| | | | | | | | | has_b_frames should be output_reorder_delay field in AVS3 sequence header and larger than 1. The parser implementation doesn't parse that field. Decoder can set has_b_frames properly, so use FFMAX here to avoid resetting has_b_frames from output_reorder_delay to 1. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/dvdsubdec: use avpriv_fopen_utf8() instead of plain fopen()softworkz2022-05-24
| | | | | | | | Unify file access operations by replacing usages of direct calls to posix fopen() to prepare for long filename support on Windows. Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/libuavs3d: fix access uninitialized variable when drainingZhao Zhili2022-05-23
| | | | buf_ptr is uninitialized and accessed when function return.
* avcodec/mpegvideo: Move float.h inclusion to mpegvideoenc.hAndreas Rheinhardt2022-05-19
| | | | | | It is only needed for the options in mpegvideoenc.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mss2: Remove write-only QpelDSPContextAndreas Rheinhardt2022-05-19
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/error_resilience: Only keep what is needed from MECmpContextAndreas Rheinhardt2022-05-19
| | | | | | | | | ERContext currently has an embedded MECmpContext, despite only needing exactly one function from it. This is wasteful because MECmpContext is pretty large (135 pointers, 1080 B for eight byte pointers). So keep only what is needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dvdsubenc: return error if canvas_size is too small for subtitle renderLimin Wang2022-05-19
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/wrapped_avframe: Don't attach FrameDecodeData unnecessarilyAndreas Rheinhardt2022-05-15
| | | | | | It is unneeded, as this decoder does not call ff_get_buffer(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.hAndreas Rheinhardt2022-05-15
| | | | | | | | | | Move AC3HeaderInfo into ac3_parser_internal.h and the rest into a new header ac3defs.h. This also breaks an include cycle of ac3.h and ac3tab.h (the latter now only needs ac3defs.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3tab: Move some tables only used by ac3.c to itAndreas Rheinhardt2022-05-15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3: Remove declaration of inexistent functionAndreas Rheinhardt2022-05-15
| | | | | | Removed in 7b11eead1b4e08728561595e6b610cf8fe2b7122. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libaomenc: Add parameter for avif single image encodingVignesh Venkatasubramanian2022-05-13
| | | | | | | | | | | | | | Add a parameter to libaom-av1 encoder to enforce some of the single image constraints in the AV1 encoder. Setting this flag will limit the encoder to producing exactly one frame and the sequence header that is produced by the encoder will be conformant to the AVIF specification [1]. Part of Fixing Trac ticket #7621 [1] https://aomediacodec.github.io/av1-avif Signed-off-by:: Vignesh Venkatasubramanian <vigneshv@google.com>
* avcodec/vp9: ipred_vl_16x16_16 avx2 implementationSemen Belozerov2022-05-12
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* libavcodec/cinepakenc: Mark no-skip frames as keyframesTomas Härdin2022-05-12
| | | | | Reset curframe whenever we generate a keyframe. Use -g instead of -keyint_min.
* avcodec/internal: Hide stuff only used by the core decode APIAndreas Rheinhardt2022-05-12
| | | | | | | | | | | | | | | | | | | | | | The general decoding API uses bitstream filters and an AVFifo and therefore AVCodecInternal contains pointers to an AVBSFContext and to an AVFifo and lavc/internal.h includes lavc/bsf.h and lavu/fifo.h. Yet actually, only two files are supposed to use these, namely avcodec.c and (mainly) decode.c. For all the other files, it should be an opaque type that they should not touch and that they need not know anything about. This can be achieved by not including these headers and using the structs instead of the corresponding typedefs. This also forces translation units that really use the BSF and the FIFO APIs themselves to include the relevant headers directly instead of relying on indirect inclusions (up until now, even avcodec.c and decode.c relied on fifo.h to be included by internal.h). Of course, it also avoids unnecessary rebuilds when bsf.h or fifo.h change. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/texturedspenc: Fix invalid shiftAndreas Rheinhardt2022-05-12
| | | | | | | | Left shifts of signed types are UB unless the results fit into the type. (Furthermore the value to be shifted need to be nonnegative.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: drop a confusing message about "thread emulation"Anton Khirnov2022-05-11
| | | | There is no such thing.
* lavc/pthread_frame: do not copy AVCodecInternal contentsAnton Khirnov2022-05-11
| | | | | None of its fields have meaningful values at that point that would need to be copied to frame thread workers.
* lavc/avcodec: only allocate decoding packets for decodersAnton Khirnov2022-05-11
|
* lavc/encode: add an encoder-specific get_buffer() variantAnton Khirnov2022-05-11
| | | | | | | | | | | Several encoders (roqvideo, svq1, snow, and the mpegvideo family) currently call ff_get_buffer(). However this function is written assuming it is called by a decoder. Though nothing has been obviously broken by this until now, that may change in the future. To avoid potential future issues, introduce a simple encode-specific wrapper around avcodec_default_get_buffer2() and enforce its use in encoders.
* lavc/snow: only allocate mconly_picture for decodingAnton Khirnov2022-05-11
| | | | It is not used in the encoder.
* lavc/pgs_frame_merge_bsf: add bsf to merge PGS segmentsJohn Stebbins2022-05-10
| | | | | | | Required to remux m2ts to mkv Minor changes and porting to FFBitStreamFilter done by the committer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lib*/version: Move library version functions into files of their ownAndreas Rheinhardt2022-05-10
| | | | | | | This avoids having to rebuild big files every time FFMPEG_VERSION changes (which it does with every commit). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libsvtav1: signal CPB properties through side dataJan Ekström2022-05-09
| | | | | | | | | This way values such as maxrate/bufsize can be utilized further down the chain. First, syncs up the max_rate and buffer_size from SVT-AV1 back to avctx, and then in case at least one of the utilized values is nonzero, adds the CPB properties side data.
* avcodec/libsvtav1: update avctx bit rate according to RC modeJan Ekström2022-05-09
| | | | | | This way we can filter out the default value for this member, which is nonzero. Bases on the current affairs that bit rate based rate control is nonzero in SVT-AV1.
* lavc/cavsdec: Add profile checkJun Zhao2022-05-08
| | | | | | | Add profile check for cavs decoder, now cavs decoder only support JiZhun(0x20) profile Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavc/libuavs3d: fix incorrect commentsJun Zhao2022-05-08
| | | | | | fix incorrect comments Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec/libxavs2: Improve r redundancy in occuredMichael Niedermayer2022-05-06
| | | | | Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/v210enc: Move ff_v210enc_init into a headerAndreas Rheinhardt2022-05-06
| | | | | | | | | | | | | | | | | | | | | This removes a dependency of checkasm on lavc/v210_enc.o and also allows to inline ff_v210enc_init() irrespectively of interposing. This dependency pulled basically all of libavcodec into checkasm, in particular all codecs. This also makes checkasm work when using shared Windows builds: On Windows, it needs to be known to the compiler whether a data symbol is external to the library/executable or not; hence the need for av_export_avutil. checkasm needs access to the internals of the libraries it tests and is therefore linked statically to all the libraries. This means that the users of avpriv_cga_font and avpriv_vga16_font in libavcodec (namely ansi.o, bintext.o, tmv.o) end up in the same executable as the symbols, although they have been compiled as if these symbols were external, leading to linker errors. With this commit said files are discarded by the linker, bypassing this problem. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/v210_dec: Move ff_v210dec_init into a headerAndreas Rheinhardt2022-05-06
| | | | | | | | This removes a dependency of checkasm on lavc/v210_dec.o and also allows to inline ff_v210dec_init() irrespectively of interposing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pcm-blurayenc: fix flawed logic in previous changePaul B Mahol2022-05-02
|
* lavc/videotoolboxenc: Speed/Quality prioriry settingSimone Karin Lehmann2022-05-02
| | | | | | | | Add options to h264, hevc and prores encoders to prioritize speed. Speeds up encoding by 50% - 70% Signed-off-by: Simone Karin Lehmann <simone@lisanet.de> Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/x86/hevc_mc: Fix AVX-512-VNNI_hevc_qpel_filters_avx512iclFelix LeClair2022-05-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: On extremely new hardware using either IceLake or super sets of Intel IceLakes avx512 instructions, commit d4cd8830bdac3e26c8e75cd92e574c159fecc4f7 causes build issues. Specifically a NASM macro expansion of qpel_filter_v is never properly defined/initialized. The issue is the definition was erroneously placed inside a conditional which will not trigger unless the original definition failed (has to do with if PIC is defined, becomes a bit of a catch 22) Specifically the error is X86ASM libavcodec/x86/hevc_mc.o libavcodec/x86/hevc_mc.asm:1854: error: symbol `..@88472.table' not defined libavcodec/x86/hevc_mc.asm:1806: ... from macro `HEVC_PUT_HEVC_QPEL_HV_AVX512ICL' defined here libavcodec/x86/hevc_mc.asm:1730: ... from macro `QPEL_FILTER_V' defined here ... repeats a few times... ... make: *** [ffbuild/common.mak:100: libavcodec/x86/hevc_mc.o] Error 1 ``` Specific error was discussed by kurosu and myself (fclc) on the ffmpeg-devel irc. This commit fixes the above by swapping lines 1796 and 1795, moving the define out of the conditional Side note: It seems fate didn't pick up on this, may merit looking into (as mentioned by nevcairiel). Reviewed-by: Wu Jianhua <toqsxw@outlook.com> Signed-off-by: Felix LeClair (FCLC) <felix.leclair123@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* lavc/flacdec: Increase residual limit from INT_MAX to UINT_MAXMartijn van Beurden2022-04-30
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/Makefile: Add libjxl.h to SKIPHEADERS if necessaryAndreas Rheinhardt2022-04-29
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/xfacedec: Add AV_CODEC_CAP_DR1Andreas Rheinhardt2022-04-28
| | | | | | | | This decoder uses ff_get_buffer() and does nothing weird (it does not even rely on any alignment of the frame's data/linesize). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pgxdec: Use unsigned types for unsigned valuesAndreas Rheinhardt2022-04-28
| | | | | | | | | Both AV_PIX_FMT_GRAY8 and AV_PIX_FMT_GRAY16 use unsigned values, not signed ones. The fact that the input might be signed in some cases in the original format doesn't change this. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pgxdec: Hoist branch out of loopAndreas Rheinhardt2022-04-28
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pgxdec: Fix issue with negative linesizesAndreas Rheinhardt2022-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | The PGX decoder accesses the lines via code like (PIXEL*)frame->data[0] + i*frame->linesize[0]/sizeof(PIXEL) where PIXEL is a macro parameter. This code has issues with negative linesizes, because the type of sizeof(PIXEL) is size_t, so that on common systems i*linesize/sizeof(PIXEL) will always be an unsigned type that is very large in case linesize is negative. This happens to work*, but it is undefined behaviour and e.g. leads to "src/libavcodec/pgxdec.c:114:1: runtime error: addition of unsigned offset to 0x7efe9c2b7040 overflowed to 0x7efe9c2b6040" errors from UBSAN. Fix this by using (PIXEL*)(frame->data[0] + i*frame->linesize[0]). This is allowed because linesize has to be suitably aligned. *: Converting a negative int to size_t works by adding SIZE_MAX + 1 to the number, so that the result is off by (SIZE_MAX + 1) / sizeof(PIXEL). Converting the pointer arithmetic (performed on PIXELs) back to ordinary pointers is tantamount to multiplying by sizeof(PIXEL), so that the result is off by SIZE_MAX + 1; but SIZE_MAX + 1 == 0 for the underlying pointers. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pgxdec: Remove pointless checksAndreas Rheinhardt2022-04-28
| | | | | | | | | | | These checks were (most likely) added to check for overreads as the bytestream2_get_* functions return 0 in this case. Yet this is not necessary anymore as we now have an explicit check for the size. Should the input contain a real \0, pgx_get_number() will error out lateron. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pgxdec: Avoid always-false checksAndreas Rheinhardt2022-04-28
| | | | | | | We have already checked that there is data to be read. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pgxdec: Make better use of size checkAndreas Rheinhardt2022-04-28
| | | | | | | Each of the three calls to pgx_get_number() consumes at least two bytes. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* arm64: Fix wrong BTI landing padAndre Kempe2022-04-26
| | | | | | | | | | | | This patch fixes a wrong type of BTI landing pad when branching to functions instantiated via the fft*_neon macro. Although the previously employed paciasp instruction serves as a landing pad, for the ways that this function is invoked it is the wrong type, resulting in an unexpected termination of the running process. Signed-off-by: André Kempe <andre.kempe@arm.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/libsvtav1: add support for setting chroma sample locationJan Ekström2022-04-26
| | | | Support for configuring this was added with version 1.0.0.