Commit Graph

112637 Commits

Author SHA1 Message Date
Paul B Mahol
98857ece48 avcodec/mlpenc: use ctx->num_substreams when writing headers 2023-10-20 17:07:23 +02:00
Paul B Mahol
94abb4df32 avcodec/mlpenc: add helper function to derive TrueHD ch map from ch_layout 2023-10-20 17:07:22 +02:00
Niklas Haas
2d1aeba8f2 avfilter/vf_scale: fix interlaced chroma for other formats
This logic only covers the case of yuv420p. Extend this logic to cover
*all* vertically subsampled YUV formats, which require the same
interlaced scaling logic.

Fortunately, we can get away with re-using the same code for both JPEG
and MPEG range YUV, because the only difference here is the horizontal
alignment. (Which I omit touching for now, to avoid introducing possibly
unintended changes in default behavior)
2023-10-20 15:20:09 +02:00
Sean McGovern
d799ad2404
libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined
It was not introduced until glibc 2.18.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:46:55 +02:00
Michael Niedermayer
5feceed008
avcodec/hevc_ps: Check cpb_cnt_minus1 before storing it
Fixes: index 32 out of bounds for type 'uint32_t [32]'
Fixes: 63003/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4685160840560640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:46:55 +02:00
Michael Niedermayer
70f5fa6325
avformat/mxfdec: Check klv offset
Fixes: Assertion klv_offset >= mxf->run_in failed at libavformat/mxfdec.c:736
Fixes: 62936/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5778404366221312.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:44:56 +02:00
Elias Carotti
644b2235c5 avcodec/libx264: Add the SSE computation for libx264.
Since libx264 only provides a per-frame per-channel PSNR, this is
inverted to get back the SSE.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-10-19 13:34:37 +02:00
Paul B Mahol
e7a6bba51a avcodec/mlp*: merge flags used by encoder and decoder 2023-10-18 23:01:40 +02:00
Paul B Mahol
be2bbfe71d avcodec/mlpenc: cleanup filtering 2023-10-18 23:01:39 +02:00
Paul B Mahol
c1053e2e35 avcodec/mlpenc: allow smaller shift for LPC 2023-10-18 23:01:38 +02:00
Paul B Mahol
b206056c82 avcodec/mlpenc: implement advanced stereo rematrix 2023-10-18 23:01:37 +02:00
Paul B Mahol
727ee32da7 avcodec/mlpenc: remove TODO comment, sample rate is always fixed 2023-10-18 23:01:36 +02:00
Paul B Mahol
9adc5d8bfe avcodec/mlpenc: restructure code even more
Implement lsb_bypass for lossless rematrix.
2023-10-18 23:01:35 +02:00
Zhao Zhili
2361970880 avcodec/videotoolboxenc: Check and set hevc profile
1. If user don't specify the profile, set it to main10 when pixel
   format is 10 bits. Before the patch, videotoolbox output main
   profile bitstream with 10 bit input, which can be confusing.
2. Warning when user set profile to main explicitly with 10 bit
   input. It works, but not the best choice.
3. Reject main 10 profile with 8 bit input, it doesn't work.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:05:14 +08:00
Zhao Zhili
cbb6199ff8 avcodec/videotoolboxenc: add hw_configs
Will be used in the following patch. With hw_config we can get
avctx->hw_frames_ctx, and with avctx->hw_frames_ctx we get
sw_pix_fmt. Otherwise sw_pix_fmt is none. I need sw_pix_fmt
before get the first frame to set hevc encoder profile.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:02:12 +08:00
Zhao Zhili
ade0612cfb fate/screen: workaround test failure on mac M1
The last frame is corrupted. It has different results on different
platform.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:01:51 +08:00
Michael Riedl
721857483f avformat/mxfenc: fix static building
MXF muxer requires rangecoder otherwise static linking fails.

Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
2023-10-17 14:46:34 +02:00
Leo Izen
95fbb6cce8
MAINTAINERS: add entry for jpegxl*
Adding myself for jpegxl* in avcodec as I'm the maintainer of this
parser.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-17 08:44:23 -04:00
Leo Izen
bf814387f4
avcodec/jpegxl_parser: fix OOB read regression
In f7ac3512f5 the size of the dynamically
allocated buffer was shrunk, but it was made too small for very small
alphabet sizes. This patch restores the size to prevent an OOB read.

Reported-by: Cole Dilorenzo <coolkingcole@gmail.com>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-17 08:40:49 -04:00
Michael Niedermayer
5ddab49d48
avcodec/h2645_parse: Avoid EAGAIN
EAGAIN causes an assertion failure when it is returned from the decoder

Fixes: Assertion consumed != (-(11)) failed at libavcodec/decode.c:462
Fixes: assertion_IOT_instruction_decode_c_462/poc

Found-by: Hardik Shah of Vehere (Dawn Treaders team)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:16:19 +02:00
Michael Niedermayer
f7e5537dc1
avcodec/xvididct: Make c* unsigned to avoid undefined overflows
Fixes: signed integer overflow: 1496950099 + 728014168 cannot be represented in type 'int'
Fixes: 62667/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6511785170305024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:10 +02:00
Michael Niedermayer
61b86add52
avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_se_golomb()
Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62618/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5145745046765568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:09 +02:00
Michael Niedermayer
75eb698bdc
avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_ue_golomb()
Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62617/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5156555663998976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:08 +02:00
Michael Niedermayer
fff875a7f4
avformat/usmdec: do not return 0 when no packet was produced
Fixes: Assertion pkt->stream_index < (unsigned)s->nb_streams && "Invalid stream index.\n" failed at libavformat/demux.c:617
Fixes: 62498/clusterfuzz-testcase-minimized-ffmpeg_dem_USM_fuzzer-4734740995112960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:09:09 +02:00
Michael Niedermayer
cd66606a8f
avcodec/bonk: Fix undefined overflow in predictor_calc_error()
Fixes: signed integer overflow: -2146469728 - 1488954 cannot be represented in type 'int'
Fixes: 62490/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5612782399389696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:05:07 +02:00
Michael Niedermayer
ef3b42738b
avcodec/evc_ps: Check chroma_format_idc
Fixes: out of array access
Fixes: 62678/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4858264984354816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 00:54:37 +02:00
Michael Niedermayer
b79fc70596
avformat/tmv: Check video chunk size
This check matches the audio chunk check

Fixes: Timeout
Fixes: 62681/clusterfuzz-testcase-minimized-ffmpeg_dem_TMV_fuzzer-5299107876700160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-15 18:54:37 +02:00
Lynne
fec6e84b18
configure: disable libglslang/libshaderc if the vulkan is disabled
Fixes build failures when the Vulkan headers are too old and libglslang
or libshaderc are enabled.
2023-10-15 17:11:47 +02:00
Leo Izen
1e888462a1
configure: improve libmfx deprecation warning
The libmfx deprecation warning tells you to build against libmfx 1.x,
but the actual solution is to use --enable-libvpl instead of using
--enable-libmfx. Update the warning message to reflect this.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-14 20:55:23 -04:00
Andreas Rheinhardt
66908a43e2 avcodec/h261dec: Don't set write-only macroblock dimensions
They are generally set in ff_mpv_init_context_frame()
(mostly called by ff_mpv_common_init()); setting them
somewhere else should be avoided.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-14 23:36:46 +02:00
Niklas Haas
90d327d607 avfilter/vf_showinfo: also print chroma loc
Curiously absent.
2023-10-14 00:16:57 +02:00
Andreas Rheinhardt
4e6cf5e52b avcodec/h264dec: Constify H.264 decoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-13 14:35:07 +02:00
Andreas Rheinhardt
8e1bb594fb avcodec/h264idct_template: Don't include h264dec.h
It is only needed for scan8 which is in h264_parse.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-13 14:35:07 +02:00
Andreas Rheinhardt
a7663c9604 avcodec/error_resilience: Constify ThreadFrame*
Forgotten in 0eb399ac39.
While just at it, also use a forward declaration.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-12 22:50:34 +02:00
Timo Rothenpieler
68f9dfa5cc avcodec/nvdec_hevc: fail to initialize on unsupported profiles 2023-10-12 20:57:35 +02:00
Kyle Swanson
2e33f5ced0 avfilter/libvmaf: update pix_fmts
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-10-12 10:37:36 -07:00
Andreas Rheinhardt
ab95338a20 avcodec/mpeg4video_parser: Don't set write-only current_picture_ptr
It is unused by ff_mpeg4_decode_picture_header() (unsurprisingly given
that when decoding this function is called before the context has been
initialized).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-11 22:28:24 +02:00
Andreas Rheinhardt
b561dafd56 avcodec/h261dec: Discard whole packet when discarding
(The return value doesn't really matter: For video decoders
every return value >= 0 is treated as "consumed all of the input".)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-11 22:28:24 +02:00
Andreas Rheinhardt
c995311bcf avcodec/h261dec: Don't set write-only picture_number
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-11 22:28:24 +02:00
John Mather
a2175ca861 avcodec/libkvazaar: Respect codec context color settings.
This patch makes the libkvazaar encoder respect color settings that are
present on the codec context, including color range, primaries, transfer
function and colorspace.
2023-10-11 21:50:47 +03:00
John Mather
7251dfdcee avcodec/libkvazaar: Bump minimum version to 2.0.0
0cd8769207 utilized the rc_algorithm member of the kvz_config struct, which
was introduced in Kvazaar 2.0.0. This patch bumps the minimum version of
Kvazaar to 2.0.0 so that FFmpeg compiles successfully.

Signed-off-by: John Mather <johnmather@sidefx.com>
2023-10-11 21:26:52 +03:00
Lynne
f31d0f1141
nlmeans_vulkan: parallelize workgroup invocations 2023-10-11 16:53:06 +02:00
Lynne
658b01b5ee
nlmeans_vulkan: reduce dispatches by parallelizing the planes 2023-10-11 16:53:04 +02:00
Lynne
6bc8ff7d93
nlmeans_vulkan: fix width/height for chroma plane weights calculation 2023-10-11 16:53:00 +02:00
Kyle Swanson
6028728bb8 avfilter/libvmaf: remove deprecated options 2023-10-10 11:00:20 -07:00
Andreas Rheinhardt
c06d3d2404 fftools/ffmpeg_demux: Fix leak on error
An AVFormatContext leaks on errors that happen before it is attached
to its permanent place (an InputFile). Fix this by attaching
it earlier.

Given that it is not documented that avformat_close_input() is usable
with an AVFormatContext that has only been allocated with
avformat_alloc_context() and not opened with avformat_open_input(),
one error path before avformat_open_input() had to be treated
specially: It uses avformat_free_context().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 14:30:07 +02:00
Andreas Rheinhardt
d98dfcecad fftools/ffmpeg_demux: Don't use fake object with av_opt_eval
The av_opt_eval family of functions emits errors messages on error
and can therefore not be used with fake objects when the AVClass
has a custom item_name callback. The AVClass for AVCodecContext
has such a custom callback (it searches whether an AVCodec is set
to use its name). In practice it means that whatever is directly
after the "cc" pointer to the AVClass for AVCodec in the stack frame
of ist_add() will be treated as a pointer to an AVCodec with
unpredictable consequences.

Fix this by using an actual AVCodecContext instead of a fake object.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 14:29:54 +02:00
Paul B Mahol
44dc42e4ac avcodec/mlpenc: export lpc_coeff_precision option
Change default precision from 11 to 15, improves compression.
2023-10-10 13:53:11 +02:00
Anton Khirnov
33f058f2ec fftools/ffmpeg_enc: constify the frame passed to enc_open() 2023-10-10 12:41:31 +02:00
Anton Khirnov
2ef50c17ab fftools/ffmpeg_filter: fail on filtering errors
These should be considered serious errors - don't just print a log
message and continue as if nothing happened.
2023-10-10 12:41:31 +02:00