Commit Graph

107615 Commits

Author SHA1 Message Date
Andreas Rheinhardt
34276b815b avcodec/motion_est: Constify pointers to frame data
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:56:32 +02:00
Andreas Rheinhardt
209a11053f avcodec/mpegvideodsp: Constify src pointers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:44:16 +02:00
Andreas Rheinhardt
966fc1230a avcodec/mpegvideoencdsp: Allow pointers to const where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:32:40 +02:00
Andreas Rheinhardt
abb85429f3 avcodec/me_cmp: Constify me_cmp_func buffer parameters
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:31:53 +02:00
Andreas Rheinhardt
e7cb7c762a avcodec/cfhdencdsp: Constify input pointers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:18:19 +02:00
Andreas Rheinhardt
dc3e25e4d3 avcodec/lossless_videoencdsp: Constify src sub_left_predict
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:16:35 +02:00
Andreas Rheinhardt
af43da3e4d avcodec/videodsp: Constify buf in VideoDSPContext.prefetch
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:14:34 +02:00
Andreas Rheinhardt
2793e4353f avcodec/half2float: Constify arrays in half2float()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 03:12:55 +02:00
Andreas Rheinhardt
145236741d avcodec/mpegvideo: Inline values in ff_update_block_index()
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>
2022-07-31 01:53:19 +02:00
Andreas Rheinhardt
dd20ebb2ca avcodec/pngenc: Don't cast const away unnecessarily
Possible since 529a9893d7.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:17:18 +02:00
Andreas Rheinhardt
7e41f95dce avcodec/snow: Remove unused halfpel_plane
Committed in 5be3a81871 in
an unfinished state; never used or finished and always disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:16:54 +02:00
Andreas Rheinhardt
e4547c136a avcodec/pnmdec: Fix indentation
Forgotten after ff1450e449.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:14:36 +02:00
Andreas Rheinhardt
22ca2ef018 avcodec/pnmdec, pnm_parser: Improve const-correctness
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:14:05 +02:00
Andreas Rheinhardt
d8388e1b4e avcodec/ilbcdec: Move transient GetBitContext from ctx to stack
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:13:22 +02:00
Andreas Rheinhardt
86460b366c avcodec/ilbcdec: Fix const correctness
Also constify everything that can be constified.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:12:03 +02:00
Andreas Rheinhardt
e86b8ca7f1 avcodec/cinepakenc: Avoid casting const away
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:11:56 +02:00
Andreas Rheinhardt
941a82b57c avcodec/dxv: Don't cast const away unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:11:06 +02:00
Andreas Rheinhardt
e207f75ba8 avcodec/diracdsp: Don't cast const away unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:10:46 +02:00
Andreas Rheinhardt
0213363175 avcodec/fitsenc: Don't cast const away unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:10:17 +02:00
Andreas Rheinhardt
90c38612f8 avcodec/gif: Remove redundant cast
Possible since 529a9893d7.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:10:08 +02:00
Andreas Rheinhardt
da668fa7d2 swscale/rgb2rgb: Don't cast const away
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:09:52 +02:00
Andreas Rheinhardt
41e5555a00 avcodec/xwdenc: Don't modify input frame
These modifications were actually meant to be applied to
the coded_frame, yet 08b31a72db
changed this and so this code has not been removed when coded_frame
has been removed in 11bc790893.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 01:08:57 +02:00
Andreas Rheinhardt
f654aa8a09 tests/ref/fate/filter-metadata-cropdetect[12]: Fix ref file
Necessitated by 6ca43a9675
and 425b309fa4.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-30 22:29:10 +02:00
Andreas Rheinhardt
f0dd4ab055 avfilter/vf_cropdetect: Remove set-but-unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-30 22:14:26 +02:00
Andreas Rheinhardt
a2d7da01e8 avcodec/threadframe: Constify the frame in ff_thread_await_progress
It is safe to call it on a const ThreadFrame*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-30 22:09:59 +02:00
Andreas Rheinhardt
92e702863c avcodec/proresdata: Move data only used by ff_prores_ks_encoder to it
In this case, this allows to inline the initial run_cb and lev_cb
values.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-30 22:09:05 +02:00
Andreas Rheinhardt
879eed5555 avcodec/ttmlenc: Deduplicate ttml_default_namespacing string
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>
2022-07-30 22:08:57 +02:00
James Almer
6ca1690643 avcodec/alac: don't fail if channels aren't set during init() when extradata 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>
2022-07-30 09:21:19 -03:00
James Almer
6406d5e430 avcodec/aacdec: print a log message when treating mono HE-AAC as stereo
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>
2022-07-30 09:21:19 -03:00
Thilo Borgmann
665349c4c0 lavfi/vf_cropdetect: Reindent after last commit 2022-07-30 13:20:56 +02:00
Thilo Borgmann
cd8515eb70 Changelog: Update after last commit 2022-07-30 13:20:02 +02:00
Thilo Borgmann
9d66417cc5 lavfi/cropdetect: Add new mode to detect crop-area based on motion vectors and edges
This filter allows crop detection even if the video is embedded in non-black areas.
2022-07-30 13:17:28 +02:00
Thilo Borgmann
cf1f574431 lavfi/edge_common: Templatify ff_gaussian_blur and ff_sobel 2022-07-30 13:17:28 +02:00
Niklas Haas
1001bdc504 fate/png: add test for ICC profile parsing
This tests the new "-flags2 icc_profiles" option by making sure the
embedded ICC profile gets correctly detected as sRGB.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-07-30 11:42:06 +02:00
Niklas Haas
8377ef43f4 avcodec/encode:: generate ICC profiles
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>
2022-07-30 11:42:06 +02:00
Niklas Haas
77f8dcb265 avcodec/decode: parse ICC profiles
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>
2022-07-30 11:42:06 +02:00
Niklas Haas
c688ddc067 avcodec: add common fflcms2 boilerplate
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>
2022-07-30 11:42:06 +02:00
Niklas Haas
e1a0f2df3d avcodec: add API for automatic handling of icc profiles
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>
2022-07-30 11:42:06 +02:00
Niklas Haas
61ffa23c2e avcodec/codec_internal: add cap for ICC profile support
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>
2022-07-30 11:42:06 +02:00
Niklas Haas
1cbd4552fe fflcms2: move to libavcodec
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>
2022-07-30 11:42:06 +02:00
Dmitry Rogozhkin
e0691eab22 qsv: Update ffmpeg qsv_errors to recognize GPU hang and other statuses
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>
2022-07-29 12:30:34 +08:00
Anton Khirnov
6b12208646 fftools/ffmpeg_opt: reindent 2022-07-28 16:37:16 +02:00
Anton Khirnov
ac3e461348 fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov
753195944a fftools/ffmpeg_opt: reindent 2022-07-28 16:37:16 +02:00
Anton Khirnov
85692aeecb fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov
6bd98d9ed8 fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle()
Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
2022-07-28 16:37:16 +02:00
Anton Khirnov
6ab412ef9c fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov
ff40d9e8ed fftools/ffmpeg_opt: reduce indentation in map_auto_audio()
Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
2022-07-28 16:37:16 +02:00
Anton Khirnov
b898dc8934 fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov
74176f3cd6 fftools/ffmpeg_opt: reduce indentation in map_auto_video()
Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
2022-07-28 16:37:16 +02:00