Commit Graph

115102 Commits

Author SHA1 Message Date
Andreas Rheinhardt
ef16882e8f avcodec/aac/aacdec: Move channel number check out of init_dsp()
Also move initializing random_state.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-06 23:58:31 +02:00
Andreas Rheinhardt
e4e9144a5c avcodec/aac/aacdec: Remove unnecessary ff_thread_once()
ff_aacdec_common_init_once() already uses its own AVOnce.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-06 23:58:08 +02:00
Andreas Rheinhardt
44474dd7b9 avcodec/aacsbr: Fix type mismatch
ff_aac_sbr_apply() and ff_aac_sbr_apply_fixed() still used
pointers to INTFLOAT which is float or int depending upon
whether USE_FIXED is set or not; in particular, according
to these declarations both functions have the same type.
But that is wrong and given that aacdec.c sets USE_FIXED,
it sees the wrong type for ff_aac_sbr_apply().
This leads to a -Wlto-type-mismatch warning when using lto [1].
Fix this by avoiding INTFLOAT in aacsbr.h (which also means
that aac_defines.h need not be included there any more).

[1]: https://fate.ffmpeg.org/log.cgi?slot=x86_64-archlinux-gcc-lto&time=20240506022217&log=compile

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-06 23:57:41 +02:00
Andreas Rheinhardt
e6bf540048 avcodec/aactab: Provide ff_ltp_coef, ff_tns_tmp2_map unconditionally
The fixed point decoder needs it since
905fdb0601.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-06 23:56:40 +02:00
Mark Thompson
7b482815a0 vulkan_av1: Fix force_integer_mv value 2024-05-06 20:17:50 +01:00
Mark Thompson
b73e6af337 vaapi_av1: Fix force_integer_mv value 2024-05-06 20:17:50 +01:00
Mark Thompson
b62d385ecf nvdec_av1: Use av1dec force_integer_mv value 2024-05-06 20:17:50 +01:00
Mark Thompson
e5a5125bbe vdpau_av1: Use av1dec force_integer_mv value 2024-05-06 20:17:50 +01:00
Mark Thompson
5162247092 dxva2_av1: Use av1dec force_integer_mv value 2024-05-06 20:17:50 +01:00
Mark Thompson
6f56e0e7e5 av1dec: Add force_integer_mv derived field for decoder use
This is not the same as the syntax element value in the frame header
because the specification parsing tables override the value on intra
frames.
2024-05-06 20:17:50 +01:00
Rémi Denis-Courmont
9e77188cba lavc/ac3dsp: R-V Zbb ac3_exponent_min
SiFive U74:
ac3_exponent_min_reuse0_c:       10.0
ac3_exponent_min_reuse0_rvb_b:    8.0
ac3_exponent_min_reuse1_c:     2924.7
ac3_exponent_min_reuse1_rvb_b: 1803.0
ac3_exponent_min_reuse2_c:     5043.0
ac3_exponent_min_reuse2_rvb_b: 2827.5
ac3_exponent_min_reuse3_c:     7028.7
ac3_exponent_min_reuse3_rvb_b: 3872.0
ac3_exponent_min_reuse4_c:     8824.2
ac3_exponent_min_reuse4_rvb_b: 5122.2
ac3_exponent_min_reuse5_c:    10487.5
ac3_exponent_min_reuse5_rvb_b: 6412.2
2024-05-06 22:10:16 +03:00
Rémi Denis-Courmont
95d1052fba lavu/riscv: add hwprobe() for CPU detection
This adds the Linux-specific function call to detect CPU features. Unlike
the more portable auxillary vector, this supports extensions other than
single lettered ones. At this point, FFmpeg already needs this to detect
Zba and Zbb at run-time, and probably will need it for Zvbb in the near
future.

Support will be available in glibc 2.40 onward.
2024-05-06 22:09:41 +03:00
Rémi Denis-Courmont
d7333ba6f2 lavu/riscv: indent code
This reindents code to prepare for the next changeset.
No functional changes.
2024-05-06 22:09:41 +03:00
Andreas Rheinhardt
2f8bf90054 avcodec/allcodecs: Remove LIBX264_CONST
Possible since 71669f2ad5.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-06 14:51:56 +02:00
Nuo Mi
a9586a00df avcodec/vvcdec: ff_vvc_frame_submit, avoid initializing task twice.
For some error bitstreams, a CTU belongs to two slices/entry points.
If the decoder initializes and submmits the CTU task twice, it may crash the program
or cause it to enter an infinite loop.

Reported-by: Frank Plowman <post@frankplowman.com>
2024-05-06 20:22:42 +08:00
Michael Niedermayer
96449cfeae
avcodec/mpegvideo_enc: Fix 1 line and one column images
Fixes: Ticket10952
Fixes: poc21ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-06 03:00:41 +02:00
Michael Niedermayer
a3bb269db9
avcodec/amrwbdec: assert mode to be valid in decode_fixed_vector()
Inspired-by: CID1473499 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-06 03:00:41 +02:00
Michael Niedermayer
a2ec2bd493
avcodec/wavarc: fix integer overflow in decode_5elp() block type 2
Fixes: signed integer overflow: 2097152000 + 107142979 cannot be represented in type 'int'
Fixes: 67919/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5955101769400320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-06 03:00:41 +02:00
Michael Niedermayer
1330a73cca
swscale/output: Fix integer overflow in yuv2rgba64_full_1_c_template()
Fixes: signed integer overflow: -1082982400 + -1079364728 cannot be represented in type 'int'
Fixes: 67910/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5329011971522560
The input is 9bit in 16bit, the fuzzer fills all 16bit thus generating "invalid" input
No overflow should happen with valid input.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-06 03:00:40 +02:00
Michael Niedermayer
a56559e688
swscale/output: Fix integer overflow in yuv2rgba64_1_c_template
Fixes: signed integer overflow: -831176 * 9539 cannot be represented in type 'int'
Fixes: 67869/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5117342091640832

The input is 9bit in 16bit, the fuzzer fills all 16bit thus generating "invalid" input
No overflow should happen with valid input.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-06 03:00:40 +02:00
Michael Niedermayer
c7075cdb67
avcodec/dovi_rpuenc: Initialize bl_compat_id
Fixes: CID1596607 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-06 03:00:40 +02:00
James Almer
2e16285fe8 avformat/iamf_reader: split "if ((ret = ...) < 0)" line
Cosmetic change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
0ec8f3c55a avformat/mov: don't use stream duration to calculate bitrate with fragmented input
sc->data_size may contain the size of a single fragment after probing, and
using it alongside the duration of the entire stream to calculate bitrate
will result in a bogus small value.

Before:
  Duration: 00:00:05.00, start: 0.000000, bitrate: 586 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 112 kb/s, 60 fps, 60 tbr, 15360 tbn (default)

After:
  Duration: 00:00:05.00, start: 0.000000, bitrate: 586 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 561 kb/s, 60 fps, 60 tbr, 15360 tbn (default)

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
82397084a9 avfilter/vf_scale: properly reinitialize framesync
Fixes leaks as reported by ASAN and Valgrind.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
ccf395e8bd avfilter/framesync: reset nb_in on allocation failure
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
eb392e4100 avfilter/vf_scale: don't expose framesync options in vf_scale2ref
It doesn't use them.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
Derek Buitenhuis
f8a613d6a8 fftools/ffprobe: Avoid overflow when calculating DAR
Both the codecpar's width and height, and the SAR num and den are
ints, which can overflow. Cast to int64_t, which is what av_reduce
takes.

Without this, occasionally, display_aspect_ratio can be negative in
ffprobe's -show_stream output.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2024-05-05 11:56:29 +01:00
James Almer
088bf6e8c1 avutil/iamf: use AV_OPT_TYPE_UINT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-04 21:31:33 -03:00
James Almer
d6e877bbcd avutil/iamf: fix offsets for mix_gain options
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-04 21:20:35 -03:00
James Almer
d053290d8d avutil/opt: add an unsigned option type
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-04 21:17:40 -03:00
James Almer
9902fc550a avutil/tests/opt: test values > INT_MAX for INT64 type
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-04 21:11:47 -03:00
James Almer
72ac495960 avutil/tests/opt: test negative values for INT and INT64 types
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-04 21:11:47 -03:00
Andreas Rheinhardt
2c77dc5aad avformat/movenc: Avoid loop for writing array
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-04 16:30:22 +02:00
Andreas Rheinhardt
601873263e avformat/movenc: Check av_malloc()
Fixes Coverity issue #1596735.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-04 16:29:58 +02:00
Niklas Haas
df868bae23 doc/filters: mention scale2ref in replacement example
So ctrl+f "scale2ref" finds it.
2024-05-04 13:15:15 +02:00
Niklas Haas
8bf0a9c2ca doc/filters: move scale=ref_* to correct sectton
This was accidentally filed under scale_npp, instead of scale. (Why is
this entire section basically duplicated anyway?)
2024-05-04 13:15:11 +02:00
Niklas Haas
6a5b021e35 avfilter/vf_scale: fix input declaration
This filter needs to be marked as having only one input by default, with
AVFILTER_FLAG_DYNAMIC_INPUTS allowing the extra input to be added at
init() time.

Fixes: bb80445813
2024-05-04 13:07:27 +02:00
Rémi Denis-Courmont
38f67a32b3 lavc/ac3dsp: R-V V min_exponents
T-Head C908:
ac3_exponent_min_reuse0_c:         7.5
ac3_exponent_min_reuse0_rvv_i32:   7.5
ac3_exponent_min_reuse1_c:      1820.7
ac3_exponent_min_reuse1_rvv_i32: 102.5
ac3_exponent_min_reuse2_c:      3088.5
ac3_exponent_min_reuse2_rvv_i32: 138.7
ac3_exponent_min_reuse3_c:      5073.7
ac3_exponent_min_reuse3_rvv_i32: 174.7
ac3_exponent_min_reuse4_c:      4624.2
ac3_exponent_min_reuse4_rvv_i32: 204.2
ac3_exponent_min_reuse5_c:      5138.7
ac3_exponent_min_reuse5_rvv_i32: 238.0
2024-05-04 10:17:11 +03:00
Marcus B Spencer
5e7180864f
avutil/opt: Clarify type of integers
Clarify comment regarding type of integers regarding AV_OPT_TYPE_IMAGE_SIZE.

Signed-off-by: Marcus B Spencer <marcus@marcusspencer.xyz>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-04 01:15:05 +02:00
sunyuechi
5bc3b7f513 lavc/rv40dsp: R-V V chroma_mc
This is similar to h264, but here we use manual_avg instead of vaaddu
because rv40's OP differs from h264. If we use vaaddu,
rv40 would need to repeatedly switch between vxrm=0 and vxrm=2,
and switching vxrm is very slow.

C908:
avg_chroma_mc4_c: 2330.0
avg_chroma_mc4_rvv_i32: 602.7
avg_chroma_mc8_c: 1211.0
avg_chroma_mc8_rvv_i32: 602.7
put_chroma_mc4_c: 1825.0
put_chroma_mc4_rvv_i32: 414.7
put_chroma_mc8_c: 932.0
put_chroma_mc8_rvv_i32: 414.7

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-03 18:00:53 +03:00
sunyuechi
cfa8d2488d checkasm/rv40dsp: add chroma_mc test
This is similar to h264.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-03 18:00:53 +03:00
sunyuechi
7d0673db7e lavc/blockdsp: R-V V fill_block
C908:
blockdsp.fill_block_tab[0]_c: 549.7
blockdsp.fill_block_tab[0]_rvv_i64: 48.2
blockdsp.fill_block_tab[1]_c: 77.0
blockdsp.fill_block_tab[1]_rvv_i64: 19.7

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-03 17:49:23 +03:00
sunyuechi
b369c4d569 checkasm/blockdsp: add fill_block test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-03 17:49:23 +03:00
Rémi Denis-Courmont
6cd97cd797 lavc/ac3dsp: R-V V sum_square_butterfly_float
As we do not need to widen accumulators to 64 bits, we effectively get
double capacity for unrolling compared to the integer function. This
explains the slightly better performance gains.

ac3_sum_square_bufferfly_float_c:       65.2
ac3_sum_square_bufferfly_float_rvv_f32: 12.2
2024-05-03 17:48:46 +03:00
Rémi Denis-Courmont
6459966beb lavc/ac3dsp: R-V V sum_square_butterfly_int32
ac3_sum_square_bufferfly_int32_c:       61.0
ac3_sum_square_bufferfly_int32_rvv_i64: 14.7
2024-05-03 17:48:46 +03:00
Niklas Haas
95568c4e31 avfilter/scale2ref: deprecate in favor of scale=rw:rh
And remove it from the documentation.
2024-05-03 14:23:23 +02:00
Niklas Haas
5b5e692da6 fate/scale2ref_keep_aspect: switch to vf_scale ref_* 2024-05-03 14:23:23 +02:00
Niklas Haas
bb80445813 avfilter/vf_scale: add optional "ref" input
This is automatically enabled if the width/height expressions reference
any ref_* variable. This will ultimately serve as a more principled
replacement for the fundamentally broken scale2ref.

See-Also: https://trac.ffmpeg.org/ticket/10795
2024-05-03 14:23:23 +02:00
Niklas Haas
e82a3997cd avfilter/vf_scale: switch to FFFrameSync
Preliminary commit, in anticipation of adding support for multiple
inputs (with proper synchronization and activate() callback).
2024-05-03 14:23:23 +02:00
Niklas Haas
a5032dc12a avfilter/framesync: make framesync_class un-static
And rename to ff_framesync_class. More convenient for downstream users.
2024-05-03 14:23:22 +02:00