1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

46831 Commits

Author SHA1 Message Date
James Almer
db9fd78bd7 avcodec/aacdec_fixed: also clip samples on the second channel for stereo HE-AAC
Fixes outputting silence on the second channel when decoding Parametic Stereo
HE-AAC.

Closes ticekt #3361.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-01 20:25:09 -03:00
James Almer
9fb80bf760 avcodec/aacdec_fixed: add missing priv_class
This enables the same input options as the float decoder.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-01 20:25:09 -03:00
Andreas Rheinhardt
1368b5a725 avcodec/ttmlenc: Use string literal macro for default namespacing
Fixes -Werror=format-security build failures when building with
disabled optimizations and (according to fate.ffmpeg.org also with
several other old GCC versions).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 04:57:23 +02:00
Andreas Rheinhardt
e725c5e24e avcodec/exr: Constify slice threads' ptr to main context
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>
2022-07-31 04:38:55 +02:00
Andreas Rheinhardt
9ea03f5678 avcodec/diracdec: Constify slice threads' ptr to main context
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>
2022-07-31 04:38:37 +02:00
Andreas Rheinhardt
597dc96736 avcodec/dvdec: Constify slice threads' ptr to main context
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>
2022-07-31 04:38:20 +02:00
Andreas Rheinhardt
5ad29e1590 avcodec/dxv: Constify slice threads' ptr to main context
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>
2022-07-31 04:38:11 +02:00
Andreas Rheinhardt
a18c372390 avcodec/jpeg2000dec: Constify slice threads' ptr to main context
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>
2022-07-31 04:37:27 +02:00
Andreas Rheinhardt
0980d3801d avcodec/magicyuv: Constify slice threads' ptr to main context
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>
2022-07-31 04:37:12 +02:00
Andreas Rheinhardt
0eae123dbd avcodec/proresdec2: Constify slice threads' ptr to main context
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>
2022-07-31 04:22:53 +02:00
Andreas Rheinhardt
9c4f7d1e88 avcodec/vp8: Constify slice threads' ptr to main context
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.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 04:22:14 +02:00
Andreas Rheinhardt
94dd8f421e avcodec/wavpack: Constify slice threads' ptr to main context
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>
2022-07-31 04:21:51 +02:00
Andreas Rheinhardt
4368e86a02 avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target
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>
2022-07-31 04:18:26 +02:00
Andreas Rheinhardt
0eb399ac39 avcodec: Constify ThreadFrames if possible
This is possible now that ff_thread_await_progress() accepts
a const ThreadFrame*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-31 04:15:28 +02:00
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
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
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
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
Andreas Rheinhardt
6f7d3bde11 avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9
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>
2022-07-28 03:49:54 +02:00
Andreas Rheinhardt
7ab9b30800 avcodec/vp56: Move VP5-9 range coder functions to a header of their own
Also use a vpx prefix for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00
Andreas Rheinhardt
80ad06ab1b avcodec/vp56: Move VP8/9-only rac functions to a header of their own
Also rename these functions from vp8_rac_* to vp89_rac_*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-28 03:49:54 +02:00