summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/wavpack: Constify slice threads' ptr to main contextAndreas Rheinhardt2022-07-31
| | | | | | | | Modifying the main context from a slice thread is (usually) a data race, so it must not happen. So only use a pointer to const to access the main context. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp9dec: Constify VP9TileData->VP9Context pointer targetAndreas Rheinhardt2022-07-31
| | | | | | | | This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify ThreadFrames if possibleAndreas Rheinhardt2022-07-31
| | | | | | | This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/motion_est: Constify pointers to frame dataAndreas Rheinhardt2022-07-31
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideodsp: Constify src pointersAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideoencdsp: Allow pointers to const where possibleAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/me_cmp: Constify me_cmp_func buffer parametersAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cfhdencdsp: Constify input pointersAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/lossless_videoencdsp: Constify src sub_left_predictAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/videodsp: Constify buf in VideoDSPContext.prefetchAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/half2float: Constify arrays in half2float()Andreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Inline values in ff_update_block_index()Andreas Rheinhardt2022-07-31
| | | | | | | | | This is possible for most of the callers, because e.g. only the MPEG-4 decoder can have bits_per_raw_sample > 8. Also most mpegvideo-based codecs are 420 only. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pngenc: Don't cast const away unnecessarilyAndreas Rheinhardt2022-07-31
| | | | | | Possible since 529a9893d769f381b72785c500662be2020da5fe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/snow: Remove unused halfpel_planeAndreas Rheinhardt2022-07-31
| | | | | | | Committed in 5be3a818719d613e2f225cf1532fda01ba106b04 in an unfinished state; never used or finished and always disabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pnmdec: Fix indentationAndreas Rheinhardt2022-07-31
| | | | | | Forgotten after ff1450e449f848ad4b37b3cf448315ba4581364e. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pnmdec, pnm_parser: Improve const-correctnessAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ilbcdec: Move transient GetBitContext from ctx to stackAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ilbcdec: Fix const correctnessAndreas Rheinhardt2022-07-31
| | | | | | Also constify everything that can be constified. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cinepakenc: Avoid casting const awayAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dxv: Don't cast const away unnecessarilyAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/diracdsp: Don't cast const away unnecessarilyAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/fitsenc: Don't cast const away unnecessarilyAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/gif: Remove redundant castAndreas Rheinhardt2022-07-31
| | | | | | Possible since 529a9893d769f381b72785c500662be2020da5fe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/xwdenc: Don't modify input frameAndreas Rheinhardt2022-07-31
| | | | | | | | | These modifications were actually meant to be applied to the coded_frame, yet 08b31a72dbcf2935e871ef7c1ffa96ae200f78aa changed this and so this code has not been removed when coded_frame has been removed in 11bc79089378a5ec00547d0f85bc152afdf30dfa. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/threadframe: Constify the frame in ff_thread_await_progressAndreas Rheinhardt2022-07-30
| | | | | | It is safe to call it on a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/proresdata: Move data only used by ff_prores_ks_encoder to itAndreas Rheinhardt2022-07-30
| | | | | | | In this case, this allows to inline the initial run_cb and lev_cb values. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ttmlenc: Deduplicate ttml_default_namespacing stringAndreas Rheinhardt2022-07-30
| | | | | | | | | | | String literals are allowed to be deduplicated (and toolchains are already capable of doing so), yet the same is not allowed for named arrays (even when they contain strings). Therefore use a const char *const pointing to an unnamed string literal for ttml_default_namespacing. Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/alac: don't fail if channels aren't set during init() when extradata ↵James Almer2022-07-30
| | | | | | | | | | | is valid The decoder is meant to use it as a fallback if the value in extradata is invalid. Regression since d199099be. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/aacdec: print a log message when treating mono HE-AAC as stereoJames Almer2022-07-30
| | | | | | | Since this behavior is intentional, use the VERBOSE level instead of WARNING as it's nothing the user should worry about. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode:: generate ICC profilesNiklas Haas2022-07-30
| | | | | | | | | | | | | | | | Only if requested, and only if the codec signals support for ICC profiles. Implementation roughly matches the functionality of the existing vf_iccgen filter, albeit with some reduced flexibility and no caching. Ideally, we'd also only do this on the first frame (e.g. mjpeg, apng), but there's no meaningful way for us to distinguish between this case and e.g. somebody using the image2 muxer, in which case we'd want to attach ICC profiles to every frame in the stream. Closes: #9672 Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec/decode: parse ICC profilesNiklas Haas2022-07-30
| | | | | | | | | Implementation for the decode side of the ICC profile API, roughly matching the behavior of the existing vf_iccdetect filter. Closes: #9673 Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec: add common fflcms2 boilerplateNiklas Haas2022-07-30
| | | | | | | | | | | | | Handling this in general code makes more sense than handling it in individual codec files, because it would be a lot of unnecessary code duplication for the plenty of formats that support exporting ICC profiles (jpg, png, tiff, webp, jxl, ...). encode.c and decode.c will be in charge of initializing this state as needed, so we merely need to make sure to uninit it afterwards from the common destructor path. Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec: add API for automatic handling of icc profilesNiklas Haas2022-07-30
| | | | | | | | | | | | | | | This functionally already exists, but as pointed out in #9672 and #9673, requiring users to manually include filters is clumsy, error-prone and hard to use together with tools like ffplay. To streamline ICC profile support, add a new AVCodecContext flag to globally enable reading and writing ICC profiles, automatically, for all appropriate media types. Note that this commit only includes the new API. The implementation is split off to separate commits for readability. Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec/codec_internal: add cap for ICC profile supportNiklas Haas2022-07-30
| | | | | | | | | | | | | | | | | | | | | | Codecs that can read/write ICC profiles deserve a special capability so the common logic in encode.c/decode.c can decide whether or not there needs to be any special handling for ICC profiles. The motivation here is to be able to use it to decide whether or not an ICC profile needs to be generated in the encode path, but it might as well get added to decoders as well for purely informative reasons. It's not entirely clear to me whether the "thp" and "smvjpeg" variants of "mjpeg" should have this capability set or not, given that the code technically supports it but I somehow doubt these files may contain them. In either case, this cap is purely informative for decoders so it doesn't matter too much either way. It's also not entirely clear whether the "amv" encoder should signal ICC profile support, but again erring on the side of caution, we probably *shouldn't* be generating (and encoding!) ICC profiles for this type of media file. Signed-off-by: Niklas Haas <git@haasn.dev>
* fflcms2: move to libavcodecNiklas Haas2022-07-30
| | | | | | | | | | | | | | | We will need this helper inside libavcodec in the future, so move it there, leaving behind an #include to the raw source file in its old location in libvfilter. This approach is inspired by the handling of vulkan.c, and avoids us needing to expose any of it publicly (or semi-publicly) in e.g. libavutil, thus avoiding any ABI headaches. It's debatable whether the actual code belongs in libavcodec or libavfilter, but I decided to put it into libavcodec because it conceptually deals with encoding and decoding ICC profiles, and will be used to decode embedded ICC profiles in image files. Signed-off-by: Niklas Haas <git@haasn.dev>
* qsv: Update ffmpeg qsv_errors to recognize GPU hang and other statusesDmitry Rogozhkin2022-07-29
| | | | | | | | | | | | | | | | | | GPU hang is one of the most typical errors on Intel GPUs in case something goes wrong. It's important to recognize it explicitly for easier bugs triage. Also, this error code can be used to trigger GPU recovery path in self-written applications. There were 2 other statuses which MediaSDK can ppotentially return, MFX_ERR_NONE_PARTIAL_OUTPUT and MFX_ERR_REALLOC_SURFACE. Adding them as well. v2: move MFX_ERR_NONE_PARTIAL_OUTPUT next to MFX_WRN_* (Haihao) Signed-off-by: Hon Wai Chow <hon.wai.chow@intel.com> Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9Andreas Rheinhardt2022-07-28
| | | | | | | | | | | | | | | | | | | | | | | | Instead replace VP56mv by new and identical structures VP8mv and VP9mv. Also replace VP56Frame by VP8FrameType in vp8.h and use that in VP8 code. Also remove VP56_FRAME_GOLDEN2, as this has only been used by VP8, and use VP8_FRAME_ALTREF as replacement for its usage in VP8 as this is more in line with VP8 verbiage. This allows to remove all inclusions of vp56.h from everything that is not VP5/6. This also removes implicit inclusions of hpeldsp.h, h264chroma.h, vp3dsp.h and vp56dsp.h from all VP8/9 files. (This also fixes a build issue: If one compiles with -O0 and disables everything except the VP8-VAAPI encoder, the file containing ff_vpx_norm_shift is not compiled, yet this is used implicitly by vp56_rac_gets_nn() which is defined in vp56.h; it is unused by the VP8-VAAPI encoder and declared as av_unused, yet with -O0 unused noninline functions are not optimized away, leading to linking failures. With this patch, said function is not included in vaapi_encode_vp8.c any more.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp56: Move VP5-9 range coder functions to a header of their ownAndreas Rheinhardt2022-07-28
| | | | | | Also use a vpx prefix for them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp56: Move VP8/9-only rac functions to a header of their ownAndreas Rheinhardt2022-07-28
| | | | | | Also rename these functions from vp8_rac_* to vp89_rac_*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp56.h: Move VP8-only functions to vp8.cAndreas Rheinhardt2022-07-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hq_hqa: Remove transient GetByteContext from contextAndreas Rheinhardt2022-07-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/hevcdec: respect the value of no_output_of_prior_pics_flagXu Guangxin2022-07-27
| | | | | | | | Even resolution or number of picture stores changes, we still need follow no_output_of_prior_pics_flag in next IDR. Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* lavc/hevc_refs: exclude current frame from long term refsXu Guangxin2022-07-27
| | | | | | | | | | | | | suppose a. You have 3 frames, 0, 1, 4096. b. The ltMask is 0xfff and use_msb is 0. c. The 0, 1 are lt refs for 4096. d. you are decoding frame 4096, and get the 0 frame. Since 4096 & ltMask is 0 too, even you want get 0, find_ref_idx may give you 4096. add_candidate_ref will report an error for this Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* lavc/hevcdec: do not let missing ref frames invovled in dpb processXu Guangxin2022-07-27
| | | | | | | | | | We will generate a new frame for a missed reference. The frame can only be used for reference. We assign an invalid decode sequence to it, so it will not be involved in any dpb process. Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* lavc/hevc_refs: fix dpb logical for IRAPXu Guangxin2022-07-27
| | | | | | | | According to C.5.2.2, item 2. When we got an IRAP, and the NoOutputOfPriorPicsFlag = 0, we need bump all outputable frames. Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* avcodec/hevcdec: Avoid allocation of common CABAC stateAndreas Rheinhardt2022-07-25
| | | | | | | | | | | | | | It used to be allocated separately, so that the pointer to it is copied to all HEVCContexts, so that all slice-threads use the same. This is completely unnecessary now that there is only one HEVCContext any more. There is just one minor complication left: The slice-threads only get a pointer to const HEVCContext, but they need to modify the common CABAC state. Fix this by adding a pointer to the common CABAC state to HEVCLocalContext and document why it exists. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevcdec: Move allocation after error checksAndreas Rheinhardt2022-07-25
| | | | | | | While just at it, also use av_calloc() instead of zeroing the array ourselves in a loop. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pthread_slice: Reuse buffer if possibleAndreas Rheinhardt2022-07-25
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pthread_slice: Combine allocating and zeroing entriesAndreas Rheinhardt2022-07-25
| | | | | | | | | Actually, ff_slice_thread_allocz_entries() always already allocates zeroed entries, so ff_reset_entries() was already unnecessary. Make this more clear by renaming it to ff_slice_thread_allocz_entries(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevcdec: Check allocationAndreas Rheinhardt2022-07-25
| | | | | | Also postpone it after the checks for invalid input. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>