summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/mpegpicture: Move mb_var, mc_mb_var and mb_mean to MpegEncCtxAndreas Rheinhardt2022-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tables are only used by encoders and only for the current picture; ergo they need not be put into the picture at all, but rather into the encoder's context. They also don't need to be refcounted, because there is only one owner. In contrast to this, the earlier code refcounts them which incurs unnecessary overhead. These references are not unreferenced in ff_mpeg_unref_picture() (they are kept in order to have something like a buffer pool), so that several buffers are kept at the same time, although only one is needed, thereby wasting memory. The code also propagates references to other pictures not part of the pictures array (namely the copy of the current/next/last picture in the MpegEncContext which get references of their own). These references are not unreferenced in ff_mpeg_unref_picture() (the buffers are probably kept in order to have something like a pool), yet if the current picture is a B-frame, it gets unreferenced at the end of ff_mpv_encode_picture() and its slot in the picture array will therefore be reused the next time; but the copy of the current picture also still has its references and therefore these buffers will be made duplicated in order to make them writable in the next call to ff_mpv_encode_picture(). This is of course unnecessary. Finally, ff_find_unused_picture() is supposed to just return any unused picture and the code is supposed to work with it; yet for the vsynth*-mpeg4-adap tests the result depends upon the content of these buffers; given that this patchset changes the content of these buffers (the initial content is now the state of these buffers after encoding the last frame; before this patch the buffers used came from the last picture that occupied the same slot in the picture array) their ref-files needed to be changed. This points to a bug somewhere (if one removes the initialization, one gets uninitialized reads in adaptive_quantization in ratecontrol.c). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vaapi_encode: enable 8bit 4:4:4 encoding for HEVC and VP9Philip Langdale2022-08-09
| | | | | | | | | | Sufficiently recent Intel hardware is able to do encoding of 8bit 4:4:4 content in HEVC and VP9. The main requirement here is that the frames must be provided in the AYUV format. Enabling support is done by adding the appropriate encoding profiles and noting that AYUV is officially a four channel format with alpha so we must state that we expect all four channels.
* lavc/vaapi_decode: add missing flag when picking best pixel formatPhilip Langdale2022-08-09
| | | | | | | | | | | | | | | | | | | | | vaapi_decode_find_best_format currently does not set the VA_SURFACE_ATTRIB_SETTABLE flag on the pixel format attribute that it returns. Without this flag, the attribute will be ignored by vaCreateSurfaces, meaning that the driver's default logic for picking a pixel format will kick in. So far, this hasn't produced visible problems, but when trying to decode 4:4:4 content, at least on Intel, the driver will pick the 444P planar format, even though the decoder can only return the AYUV packed format. The hwcontext_vaapi code that sets surface attributes when picking formats does not have this bug. Applications may use their own logic for finding the best format, and so may not hit this bug. eg: mpv is unaffected.
* avcodec/nvdec: Use av_buffer_replace() where appropriateAndreas Rheinhardt2022-08-08
| | | | | Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/nvdec: Check av_buffer_ref()Andreas Rheinhardt2022-08-08
| | | | | | | It (unfortunately) involves an allocation and can therefore fail. Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libspeexdec: Fix use of uninitialized valueAndreas Rheinhardt2022-08-08
| | | | | | | Regression since 97d9a3293854eda84f05c22e2eaefae7406ac969. Fixes Coverity issue #1503072. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_h2645: Remove always-false checkAndreas Rheinhardt2022-08-08
| | | | | | | | | | The functions to replace parameter sets are only called after the respective parameter set has just been read or has just been written; all of these functions check that the id field is within the appropriate range. So the checks in the replace-functions can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Remove ff_cbs_alloc_unit_contentAndreas Rheinhardt2022-08-08
| | | | | | | It is no longer used. Also rename ff_cbs_alloc_unit_content2 to ff_cbs_alloc_unit_content. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_jpeg: Use table-based alloc/freeAndreas Rheinhardt2022-08-08
| | | | | | | cbs_jpeg was the last user of CBS that didn't use CodedBitstreamUnitTypeDescriptors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_internal: Use unions to shrink size of descriptorsAndreas Rheinhardt2022-08-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_internal, cbs_h2645: Add and use new descriptor macrosAndreas Rheinhardt2022-08-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Use smaller scope for variables, add constAndreas Rheinhardt2022-08-08
| | | | | | And also avoid an unnecessary indirection for src_buf. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Remove redundant assignmentAndreas Rheinhardt2022-08-08
| | | | | | | | | | | The code just creates new references without allocating new buffers for the subobjects; therefore the actual data pointer stays valid and need not be updated. Also remove an assert that ensured that the calculation for updating the pointer makes sense. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Avoid code duplication for making unit refcounted/writableAndreas Rheinhardt2022-08-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/error_resilience: Avoid overhead of AVBuffer APIAndreas Rheinhardt2022-08-08
| | | | | | These buffers are not shared in any way. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeg2000: Fast fail if HTJ2K codeblocks are present.caleb2022-08-07
| | | | | Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/riff: map AYUV fourcc to RAWVIDEO decoderJames Almer2022-08-07
| | | | | | There's no need to keep using a custom decoder for this pixel format. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: WBMP (Wireless Application Protocol Bitmap) image formatPeter Ross2022-08-07
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Peter Ross <pross@xvid.org>
* avcodec/nvenc: hardcode color characteristics for internal RGB2YUV conversionTimo Rothenpieler2022-08-06
| | | | | | | | nvenc does not appear to use these values as inputs for its built in RGB to YUV conversion, but instead sets them on the output as-is. Testing indicates the input is expected to be sRGB, with the output ending up as limited range bt.470.
* avcodec/nvdec_hevc: Fix off-by-one errorAndreas Rheinhardt2022-08-06
| | | | | | | Fixes Coverity issues #1442912, #1442913, #1442916 and #1442917. Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/acelp_*: Remove unnecessary headersAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Remove legacy cruftAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacenc_quantization: Deduplicate quantization functionsAndreas Rheinhardt2022-08-05
| | | | | | | | | | | | | | | | | | Up until now, there were four copies of quantize_and_encode_band_cost_(ZERO|[SU]QUAD|[SU]PAIR|ESC|NONE|NOISE|STEREO) (namely in aaccoder.o, aacenc_is.o, aacenc_ltp.o, aacenc_pred.o). As 43b378a0d321e3d01f196cec95e13acfac80d464 says, this is meant to enable more optimizations. Yet neither GCC nor Clang performed such optimizations: The functions in the aforementioned files are not optimized according to the specifics of the calls in the respective file. Therefore duplicating them is a waste of space; this commit therefore stops doing so. The remaining copy is placed into aaccoder.c (which is the only place where the "round to zero" variant of quantize_and_encode_band() is used, so that this can be completely internal to aaccoder.c). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacenc_tns: Remove unused headerAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacenc_quantization: Remove always-zero function parameterAndreas Rheinhardt2022-08-05
| | | | | | rtz is only ever nonzero for quantize_and_encode_band(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/sbrdsp: Remove unnecessary headersAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacenc: Move aac_pce_configs to its only userAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_thread_can_start_frame() to threadframe.hAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flacdsp: Split encoder-only parts into a ctx of its ownAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flacdsp: Remove unused function parameterAndreas Rheinhardt2022-08-05
| | | | | | Forgotten in e609cfd697f8eed7325591f767585041719807d1. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify frame->data pointers for encoders where possibleAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_motion: Constify ff_mpv_motionAndreas Rheinhardt2022-08-05
| | | | | | | | | | | | Also constify the corresponding code in mpegvideo.c that handles lowres. (Unfortunately, not everything that is const could be constified: ref_picture could be made const uint8_t* const* if C allowed the safe automatic conversion from uint8_t**; and pix_op, qpix_op could be made to point to const function pointers, but C's handling of const in pointers to arrays is broken.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevcdec: Constify src pointers of HEVC DSP functionsAndreas Rheinhardt2022-08-05
| | | | | | | | This is possible now that the HEVC DSP API treats them as const. Also constify the AVFrames whose data is used as source in such cases. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264chroma: Constify src in h264_chroma_mc_funcAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/loongarch/h264chroma, vc1dsp_lasx: Add wrapper for __lasx_xvldxAndreas Rheinhardt2022-08-05
| | | | | | | | | __lasx_xvldx does not accept a pointer to const (in fact, no function in lasxintrin.h does so), although it is not allowed to modify the pointed-to buffer. Therefore this commit adds a wrapper for it in order to constify the H264Chroma API in a later commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevcdsp: Constify src pointersAndreas Rheinhardt2022-08-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/loongarch: Add wrapper for __lsx_vldxAndreas Rheinhardt2022-08-05
| | | | | | | | | __lsx_vldx does not accept a pointer to const (in fact, no function in lsxintrin.h does so), although it is not allowed to modify the pointed-to buffer. Therefore this commit adds a wrapper for it in order to constify the HEVC DSP functions in a later commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/Makefile: fix make checkheaders failJun Zhao2022-08-05
| | | | | | | Fix the build break when used make checkheaders Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavc/vaapi: Declare support for decoding 8bit 4:4:4 contentPhilip Langdale2022-08-03
| | | | | | | | | | | Now that we have a combination of capable hardware (new enough Intel) and a mutually understood format ("AYUV"), we can declare support for decoding 8bit 4:4:4 content via VAAPI. This requires listing AYUV as a supported format, and then adding VAAPI as a supported hwaccel for the relevant codecs (HEVC and VP9). I also had to add VP9Profile1 to the set of supported profiles for VAAPI as it was never relevant before.
* avcodec/intrax8: Avoid indirection when accessing VLC tableAndreas Rheinhardt2022-08-03
| | | | | | | | | | To do so, store the pointer to the VLC table and not to the VLC. This is possible, because all the VLCs of the same type use the same number of bits. Also use a const VLCElem*, because the target is static and must therefore not be modified after its initialization. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Add msmpeg4(dec|enc) subsystemsAndreas Rheinhardt2022-08-03
| | | | | | | | | | The msmpeg4 decoders/encoders share a common set of prerequisites, ergo it makes sense to use common subsystems for them. This also allows to remove the CONFIG_MSMPEG4_DECODER/ENCODER ad-hoc defines (which violated the CONFIG_ namespace). Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure, avcodec/Makefile: Make IntraX8 select WMV2DSP, fix MIPS buildAndreas Rheinhardt2022-08-03
| | | | | | | | | | | IntraX8 uses WMV2DSP directly, so it should have a direct dependency on it. Also remove the indirect Makefile dependency of the VC-1 decoder on wmv2dsp.o. Notice that since the addition of the MIPS WMV2DSP implementation building only the VC-1 decoder would fail, because no Makefile dependency VC1->wmv2dsp_init_mips.o has been added. This is of course fixed by this commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/intrax8: Remove unused IDCTDSPContextAndreas Rheinhardt2022-08-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libaomenc: support AV_CODEC_CAP_ENCODER_RECON_FRAMEJames Almer2022-08-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/libx264: support AV_CODEC_CAP_ENCODER_RECON_FRAMEAnton Khirnov2022-08-02
| | | | Bump the version requirement to 122, which introduced b_full_recon.
* lavc: add API for exporting reconstructed frames from encodersAnton Khirnov2022-08-02
|
* avcodec/alpha/me_cmp_alpha: Remove commented-out functionAndreas Rheinhardt2022-08-02
| | | | | | | This function is bitrotten: It uses different parameters than the corresponding ASM functions which replaced it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/alpha/me_cmp_alpha: Use proper me_cmp_func typeAndreas Rheinhardt2022-08-02
| | | | | | | | | | | | | ea41e6d6373063c3a2a9bf48ce8e1c2e6340b694 forgot the int->ptrdiff_t switch for the stride. Libav didn't do it because Libav had already dropped support for Alpha at that point. Only compilation has been tested for this commit. (It might be that the ASM-versions of me_cmp_func functions need to be updated as well.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacdec_fixed: also clip samples on the second channel for stereo HE-AACJames Almer2022-08-01
| | | | | | | | | Fixes outputting silence on the second channel when decoding Parametic Stereo HE-AAC. Closes ticekt #3361. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/aacdec_fixed: add missing priv_classJames Almer2022-08-01
| | | | | | This enables the same input options as the float decoder. Signed-off-by: James Almer <jamrial@gmail.com>