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

116859 Commits

Author SHA1 Message Date
Nuo Mi
93b0d5f9ce avcodec/vvcdec: refact out is_available from is_a0_available 2024-08-15 20:33:57 +08:00
Nuo Mi
e8ac761293 avcodec/vvcdec: split ctu table to zero init and no zero init parts
cus need to init to zero, other parts are not
2024-08-15 20:19:45 +08:00
Nuo Mi
4f60961498 avcodec/vvcdec: remove unnecessary perframe initializations
deblock, sao, alf
skip, imtf, ipm, cqt_depth, cb_pos_x, cb_pos_y, cb_height, cp_mv,
tb_pos_x0, tb_pos_y0, tb_width, tb_height
2024-08-15 20:19:45 +08:00
Nuo Mi
210bf1b154 avcodec/vvcdec: refact, combine bs tab with tu tab 2024-08-15 20:19:45 +08:00
Nuo Mi
bdb79fe60a avcodec/vvcdec: thread, ensure the parse stage gets the highest priority
The parser stage is not parallelizable.
We need to schedule it as soon as possible to create later stages, which are more parallelizable

clips                                       | before | after | delta
--------------------------------------------|--------|-------|------
RitualDance_1920x1080_60_10_420_37_RA.266   | 342.7  | 365.3 |  6.59%
NovosobornayaSquare_1920x1080.bin           | 321.7  | 400   | 24.34%
Tango2_3840x2160_60_10_420_27_LD.266        |  82.3  |  91.7 | 11.42%
RitualDance_1920x1080_60_10_420_32_LD.266   | 323.7  | 319.3 | -1.36%
Chimera_8bit_1080P_1000_frames.vvc          | 364    | 411.3 | 12.99%
BQTerrace_1920x1080_60_10_420_22_RA.vvc     | 162.7  | 185.7 | 14.14%
2024-08-15 20:19:45 +08:00
Nuo Mi
7eb1df44ae checkasm: add tests for vvc dmvr
dmvr_8_12x20_c: 186.2
dmvr_8_12x20_avx2: 25.7
dmvr_8_20x12_c: 181.7
dmvr_8_20x12_avx2: 25.2
dmvr_8_20x20_c: 283.2
dmvr_8_20x20_avx2: 32.0
dmvr_10_12x20_c: 90.0
dmvr_10_12x20_avx2: 15.7
dmvr_10_20x12_c: 41.0
dmvr_10_20x12_avx2: 14.7
dmvr_10_20x20_c: 81.5
dmvr_10_20x20_avx2: 26.7
dmvr_12_12x20_c: 190.7
dmvr_12_12x20_avx2: 20.2
dmvr_12_20x12_c: 187.2
dmvr_12_20x12_avx2: 20.2
dmvr_12_20x20_c: 292.7
dmvr_12_20x20_avx2: 27.2
dmvr_h_8_12x20_c: 317.0
dmvr_h_8_12x20_avx2: 37.0
dmvr_h_8_20x12_c: 340.0
dmvr_h_8_20x12_avx2: 41.0
dmvr_h_8_20x20_c: 540.7
dmvr_h_8_20x20_avx2: 64.0
dmvr_h_10_12x20_c: 322.7
dmvr_h_10_12x20_avx2: 30.7
dmvr_h_10_20x12_c: 344.2
dmvr_h_10_20x12_avx2: 34.0
dmvr_h_10_20x20_c: 529.0
dmvr_h_10_20x20_avx2: 51.5
dmvr_h_12_12x20_c: 326.7
dmvr_h_12_12x20_avx2: 33.5
dmvr_h_12_20x12_c: 331.7
dmvr_h_12_20x12_avx2: 51.2
dmvr_h_12_20x20_c: 534.0
dmvr_h_12_20x20_avx2: 62.7
dmvr_hv_8_12x20_c: 650.0
dmvr_hv_8_12x20_avx2: 57.2
dmvr_hv_8_20x12_c: 676.2
dmvr_hv_8_20x12_avx2: 70.0
dmvr_hv_8_20x20_c: 1068.5
dmvr_hv_8_20x20_avx2: 103.2
dmvr_hv_10_12x20_c: 649.0
dmvr_hv_10_12x20_avx2: 48.2
dmvr_hv_10_20x12_c: 677.7
dmvr_hv_10_20x12_avx2: 59.7
dmvr_hv_10_20x20_c: 1093.5
dmvr_hv_10_20x20_avx2: 91.7
dmvr_hv_12_12x20_c: 660.0
dmvr_hv_12_12x20_avx2: 58.7
dmvr_hv_12_20x12_c: 682.7
dmvr_hv_12_20x12_avx2: 72.0
dmvr_hv_12_20x20_c: 1094.0
dmvr_hv_12_20x20_avx2: 113.2
dmvr_v_8_12x20_c: 325.7
dmvr_v_8_12x20_avx2: 31.2
dmvr_v_8_20x12_c: 326.2
dmvr_v_8_20x12_avx2: 38.5
dmvr_v_8_20x20_c: 538.5
dmvr_v_8_20x20_avx2: 54.2
dmvr_v_10_12x20_c: 318.5
dmvr_v_10_12x20_avx2: 23.7
dmvr_v_10_20x12_c: 330.7
dmvr_v_10_20x12_avx2: 40.5
dmvr_v_10_20x20_c: 567.5
dmvr_v_10_20x20_avx2: 48.0
dmvr_v_12_12x20_c: 335.2
dmvr_v_12_12x20_avx2: 30.0
dmvr_v_12_20x12_c: 330.2
dmvr_v_12_20x12_avx2: 39.5
dmvr_v_12_20x20_c: 535.2
dmvr_v_12_20x20_avx2: 60.0
2024-08-15 20:19:45 +08:00
Nuo Mi
6464c157d5 x86/vvcdec: add dmvr avx2 code
Decoder-Side Motion Vector Refinement is about 4~8% CPU usage for some clips

here is the test result for one time
clips                                     | before| after | delta
------------------------------------------|-------|-------|------
RitualDance_1920x1080_60_10_420_37_RA.266 | 338.7 | 354.3 |4.61%
NovosobornayaSquare_1920x1080.bin         | 320.3 | 329.3 |2.81%
Tango2_3840x2160_60_10_420_27_LD.266      | 83.3  | 83.7  |0.48%
RitualDance_1920x1080_60_10_420_32_LD.266 | 320.7 | 327.3 |2.06%
Chimera_8bit_1080P_1000_frames.vvc        | 360.7 | 381.0 |5.63%
BQTerrace_1920x1080_60_10_420_22_RA.vvc   | 161.7 | 163.0 |0.80%
2024-08-15 20:19:45 +08:00
Nuo Mi
1c17520e79 avcodec/vvcdec: Use av_image_copy_plane for DMVR 10-bit integer pixels
It's no need to shift and interpolate for 10-bit integer pixels,
av_image_copy_plane is enough
2024-08-15 20:19:45 +08:00
eaphone
7897b0beed libavdevice/gdigrab: change hwnd tail check fail logic to !=null
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-08-15 20:10:33 +08:00
gnattu
a1976e963f avutil/hwcontext_videotoolbox: silence warning for RGB
Hardware frames with RGB colorspace will not have a YCbCrMatrixKey.
Currently, it will spam the console with warning if rgb frame is
uploaded.

Signed-off-by: Gnattu OC <gnattuoc@me.com>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-08-15 20:10:33 +08:00
Araz Iusubov
42a40538f3 avcodec/amfenc: new encoder features support
Implemented:
New usage modes for AV1 encoder.
Latency mode for H264, HEVC and AV1 encoders.
Adaptive Quantization (AQ) mode in AV1 encoder.
Signed-off-by: Dmitrii Ovchinnikov <ovchinnikov.dmitrii@gmail.com>
2024-08-15 14:01:07 +02:00
Gyan Doshi
1f801dfdb5 lavc/libx265: unbreak build for X265_BUILD >= 210
x265 added support for alpha starting with build 210.
While doing so, x265_encoder_encode() changed its fifth arg to
an array of pointers to x265_picture. This broke building lavc/libx265.c

This patch simply unbreaks the build and maintains existing single-layer
non-alpha encoding support.

Fixes #11130
2024-08-15 15:17:14 +05:30
James Almer
66c05dc031 avformat/iamf_parse: ignore Audio Elements with an unsupported type
Better fix for the NULL pointer dereference from d7f83fc2f4.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-14 23:55:40 -03:00
James Almer
9880fea930 avcodec/snowenc: sign extend a variable before shifting
Fixes "libavcodec/snowenc.c:718:27: runtime error: left shift of 8509032 by 8 places cannot be represented in type 'int'"
as seen in fate-vsynth2-snow-hpel under ubsan.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-14 14:52:46 -03:00
Michael Niedermayer
7ad937f0c8
avformat/av1dec: Better fix for 70872/clusterfuzz-testcase-minimized-ffmpeg_dem_OBU_fuzzer-6005782487826432
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 19:05:17 +02:00
Michael Niedermayer
45ee6b1e3d
avcodec/apac: Fix discards ‘const’ qualifier
Found-by: courmisch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:49:52 +02:00
vipyne
fc07062a47 doc/mailing-list-faq: remove dead link
https://ffmpeg-archive.org/ is no longer "Nabble"
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:25:37 +02:00
Michael Niedermayer
db843c8910
avcodec/alsdec: clear last_acf_mantissa
Fixes: use-of-uninitialized-value
Fixes: 70869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5476567461986304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:02 +02:00
Michael Niedermayer
de3f6c8888
avcodec/aic: Clear slice_data
Fixes: use-of-uninitialized-value
Fixes: 70865/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AIC_fuzzer-4874102695854080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:01 +02:00
Michael Niedermayer
50471f96c4
avcodec/vc1dec: Clear mb_type_base and ttblk_base
Fixes: two use-of-uninitialized-value
Fixes: 70856/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5539349918187520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:01 +02:00
Michael Niedermayer
e44349ee88
avcodec/shorten: clear padding
Fixes: use-of-uninitialized-value
Fixes: 70854/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5533480570650624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:01 +02:00
Michael Niedermayer
66ee75d76c
avformat/mpeg: Check an avio_read() for failure
Fixes: use-of-uninitialized-value
Fixes: 70849/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGPS_fuzzer-4684401009557504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:00 +02:00
Michael Niedermayer
8ca072a373
avcodec/apac: Clean padding space
Fixes: use-of-uninitialized-value
Fixes: 70842/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-5758325067677696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:00 +02:00
Michael Niedermayer
cba4e2e40d
avcodec/mvha: Clear remaining space after inflate()
Fixes: use-of-uninitialized-value
Fixes: 70838/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVHA_fuzzer-4878509466517504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:21:00 +02:00
Michael Niedermayer
a0f22218f7
bsf/media100_to_mjpegb: Clear output buffer padding
Fixes: use-of-uninitialized-value
Fixes: 70855/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MEDIA100_fuzzer-5537446610141184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:20:59 +02:00
Michael Niedermayer
d7f83fc2f4
avformat/iamfdec: Check nb_layers before dereferencing layer
Fixes: dereferencing pointers near NULL
Fixes: 70432/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5255672845893632
Fixes: 70877/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5348547432611840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:20:59 +02:00
Michael Niedermayer
6996e1238e
avformat/av1dec: Check bits left before get_leb128()
Fixes: use of uninitialized value
Fixes: 70872/clusterfuzz-testcase-minimized-ffmpeg_dem_OBU_fuzzer-6005782487826432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:20:58 +02:00
Michael Niedermayer
4dc7dfe65a
avformat/segafilm: Set keyframe
Fixes: use of uninitialized value
Fixes: 70871/clusterfuzz-testcase-minimized-ffmpeg_dem_SEGAFILM_fuzzer-5883617752973312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:20:58 +02:00
Michael Niedermayer
0f4524f07a
avcodec/sga: av_assert1 check init_get_bits8()
Related: CID1473562 Unchecked return value
Related: CID1473592 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:20:58 +02:00
Michael Niedermayer
e40b23c52a
tools/target_dec_fuzzer: Check that FFv1 doesnt leave uninitialized memory in its buffers
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-14 18:20:57 +02:00
Jan Garcia via ffmpeg-devel
598f541ba4 fftools/ffmpeg: show video stats in progress output without filters
Since ffmpeg 6.1 video stats are accidentally hidden from streamcopy progress output.
This patch re-enables video stats (like frames=) in the progress output.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-08-14 15:17:58 +02:00
Josh Allmann
374824cbc7 avcodec/h264_mp4toannexb: Prepend SPS/PPS to buffering period SEI
Encoders may emit a buffering period SEI without a corresponding
SPS/PPS if the SPS/PPS is carried out-of-band, eg with avcc.

During Annex B conversion, this may result in the SPS/PPS being
inserted *after* the buffering period SEI but before the IDR NAL.

Since the buffering period SEI references the SPS, the SPS/PPS
needs to come first.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-08-14 13:20:56 +02:00
Ross Burton
654bd47716 libavcodec/arm/mlpdsp_armv5te: fix label format to work with binutils 2.43
binutils 2.43 has stricter validation for labels[1] and results in errors
when building ffmpeg for armv5:

src/libavcodec/arm/mlpdsp_armv5te.S:232: Error: junk at end of line, first unrecognized character is `0'

Remove the leading zero in the "01" label to resolve this error.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=226749d5a6ff0d5c607d6428d6c81e1e7e7a994b

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-13 23:24:13 +03:00
Stephen Hutchinson
ea7375c9e9 avformat/avisynth: move avs_planes* consts into relevant function
These consts are only used in the switch(planar) case located in
avisynth_create_stream_video and nowhere else in the demuxer,
so move them into that function directly.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2024-08-13 15:09:53 -04:00
Stephen Hutchinson
48d6cd35a2 avformat/avisynth: remove library allocation from global state
As part of this, the mutexes are no longer necessary, and
avisynth_read_close needs to check that avs->avs_library.library
still exists before it attempts to call avisynth_context_destroy
and dlclose.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2024-08-13 15:09:53 -04:00
Stephen Hutchinson
8f01ce2898 avformat/avisynth: remove mutex lock from avisynth_read_close
Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2024-08-13 15:09:53 -04:00
Stephen Hutchinson
c0fddbae79 avformat/avisynth: remove atexit() handler
The atexit() handler in the avisynth demuxer was added because
there was a conflict in AvxSynth that arose due to their use
of C++ global objects, particularly in relation to having
added a logging function relying on log4cpp.

This conflict was responsible for causing a segfault on exit.
It did not affect Windows with the (at the time) upstream
AviSynth 2.5 and 2.6, nor does it affect AviSynth+.

Unfortunately, none of this was actually shielded by ifdefs
indicating the fact it was only needed for AvxSynth, so four
years ago when AviSynth+ replaced AvxSynth as the handler
for AviSynth scripts on Unix-like OSes, the fact that the
atexit handler was no longer necessary was overlooked.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2024-08-13 15:09:53 -04:00
James Almer
66592e8b10 swscale/output: don't leave the alpha channel undefined in vuyx and xv36le
It's non-determistic, as shown by poisoning avfilter buffers instead of zeroing them.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-13 14:49:41 -03:00
James Almer
ed618b288f avcodec/rpzaenc: don't use buffer data beyond the end of a row
Fixes use of uninitized data (masked by the default zeroing of image buffers).

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-13 14:49:41 -03:00
James Almer
2b349f2d73 avcodec/adpcm: adpcm_dtk is stereo only
Fixes ticket #11133

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-13 14:49:41 -03:00
Lynne
d138d7a595
vulkan: make sure descriptor buffers are always DEVICE_LOCAL
Implementations are required to list memory heaps in the most optimal
order. But its better to be explicit for this particular allocation.
2024-08-13 19:05:20 +02:00
Anton Khirnov
9e3b5b8a26 fftools/ffmpeg: switch -map parsing to new stream specifier API
Makes optional map handling less hacky, fixes combining optional maps
with metadata matching on tags/values containing the '?' character/

Forward errors from stream specifier parsing, previously the code would
ignore them.
2024-08-13 10:28:54 +02:00
Anton Khirnov
d1bdd89c2f fftools/ffmpeg: use new stream specifier API in opt_match_per_stream*()
Removes a lot of error checking code, as matching cannot fail.
2024-08-13 10:28:54 +02:00
Anton Khirnov
46cbe4ab5c fftools/cmdutils: split stream specifier parsing and matching
This approach has the major advantage that only parsing can fail (due to
a malformed specifier or memory allocation failure). Since parsing is
done generically, while matching is per-option, this will allow to
remove substantial amounts of error checking code in following commits.

The new code also explicitly allows stream specifiers to be followed by
additional characters, which should allow cleaner handling of optional
maps, i.e. -map <stream_specifier>?, which is currently implemented in a
hacky way that breaks when the stream specifier itself contains the '?'
character (this can happen when matching metadata). It will also allow
further extending the syntax, which will be useful in following commits.

This introduces some minor behaviour changes:
* Matching metadata tags now requires the ':' character in keys or
  values to be escaped. Previously it could not be present in keys, and
  would be used verbatim in values. The change is required in order to
  know where the value terminates.
* Multiple stream types in a single specifier are now rejected - such a
  specifier makes no sense.
* Non-existent stream group ID or index is now ignored with a warning
  rather than causing a failure. This is consistent with program
  handling and is required to make matching fail-free.
2024-08-13 10:28:54 +02:00
Anton Khirnov
e1b38680b7 fftools/cmdutils: put stream specifier handling back into cmdutils
Stream specifiers were originally designed exclusively for CLI use and
were not intended to be public API. Handling them in avformat places
major restrictions on how they are used. E.g. if ffmpeg CLI wishes to
override some stream parameters, it has to change the demuxer fields
(since avformat_match_stream_specifier() does not have access to
anything else). However, such fields are supposed to be read-only for
the caller.

Furthermore having this code in avformat restricts extending the
specifier syntax. An example of such an extension will be added in
following commits.
2024-08-13 10:28:54 +02:00
Anton Khirnov
93227a68f1 fftools/ffmpeg: replace remaining uses of MATCH_PER_STREAM_OPT() 2024-08-13 10:28:54 +02:00
Anton Khirnov
e218bde9f9 fftools/ffmpeg: replace MATCH_PER_STREAM_OPT(.., str, ..) with a function
This has multiple advantages:
* The macro has multiple parameters that often have similar or identical
  values, yet very different meanings (one is the name of the
  OptionsContext member where the parsed options are stored, the other
  the name of the variable into which the result is written); this
  change makes each of these explicit.

* The macro returns on failure, which may cause leaks - this was the
  reason for adding MATCH_PER_STREAM_OPT_CLEAN(), also ost_add()
  currently leaks encoder_opts. The new function returns failure to its
  caller, which decides how to deal with it. While that adds a lot of
  error checks/forwards for now, those will be reduced in following
  commits.

* new code is type- and const- correct

Invocations of MATCH_PER_STREAM_OPT() with other types will be converted
in following commits.
2024-08-13 10:28:54 +02:00
James Almer
82085a3e0a avcodec/avcodec_internal: fix type definition for the new functions
Fixes make checkheaders.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-12 23:10:48 -03:00
James Almer
472fbee812 avformat/movenc: don't look at previous track_id as it may not be set
Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-12 11:41:38 -03:00
James Almer
41307ff3e9 avfilter/video: don't zero allocated buffers if memory poisoning is used
Same as in avcodec/get_buffer.c
Should help in debugging use of uninitialized memory.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-12 11:41:38 -03:00