1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

119852 Commits

Author SHA1 Message Date
dbd2ca3580 avcodec/ac3{dec,enc}: Deduplicate gain levels table
(I don't know why the encoder only uses eight of the nine values.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 13:37:41 +02:00
11723b3526 avcodec/ac3: Move gain value defines to ac3defs.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 13:37:41 +02:00
20caa5cf2d avcodec/ac3dec: Deduplicate mantissas and their init code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 13:37:41 +02:00
9416ffd8b8 avcodec/ac3dec: Hardcode tables to save space
The code to initialize the ungrouped bap mantissa tables
(bap 3 or 5) takes more bytes of .text than the tables itself;
they have therefore been hardcoded.

For GCC (14, -O3, albeit in an av_cold function), the initialization
code takes 99B each for the fixed and floating point decoders
(the code is currently duplicated), whereas the hardcoded tables
only take 96B. For Clang 19 it were 374B each (I don't now what
Clang was doing there).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 13:37:41 +02:00
fa45e20029 tests/fate/mov: Fix fate-mov-mp4-frag-flush requirements
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 13:35:23 +02:00
688f3944ce fftools/graph/graphprint: Remove redundant avio_flush()
The AVIOContext will be automatically flushed upon closure.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:49:02 +02:00
e3b0320745 fftools/ffprobe: Fix indentation
Forgotten after d76b0c4a35.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:48:29 +02:00
5c5c7dff2b fftools/ffprobe: Factor writing common side data types out
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:48:18 +02:00
6f452ad1ac fftools/textformat/avtextformat: Fix races when initializing formatters
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:47:33 +02:00
4947e56974 fftools/resources/resman: Use proper logcontext
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:47:16 +02:00
6d5e18b2f3 fftools/resources/resman: Use assert for always-false condition
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:46:46 +02:00
06cd9086c3 fftools/resources/resman: Don't alloc ResourceManager, fix race
The resman_ctx pointer was accessed outside of its guarding
mutex.

Also make the ResourceManager static.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:45:18 +02:00
b4c5397642 fftools/textformat/avtextformat: Avoid relocations
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:45:13 +02:00
0742239289 fftools/graph/graphprint: Fix races when initializing graphprint
Setting print_graphs_format (in case no -print_graphs_format
option was specified) is racy, as is using av_strtok()
to split it. Both have been removed.

Notice that using av_strtok() was destructive: In the absence
of races the options would only have been applied for the
first initialization.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:44:44 +02:00
6ede1e3fbf fftools/ffmpeg_filter: make InputFilterPriv and OutputFilterPriv private again
As the names imply, they are structs meant to be internal and private to the
filter handling code. If a field is required in other modules, then it can
be moved to the public facing structs, which is done in this commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-01 14:12:50 -03:00
1f034714f6 fftools/ffmpeg_filter: make FilterGraphPriv private again
As the name implies, it's a struct meant to be internal and private to the
filter handling code. If a field is required in other modules, then it can
be moved to the public facing struct, which is done in this commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-01 14:12:50 -03:00
8ea2b993fd avformat/movenc: Reduce loop iterations in mov_flush_fragment
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:37:00 +08:00
56cf1c084d avformat/movenc: Fix flush fragment
The follow cmd output corrupted file before the patch:

ffmpeg -f lavfi -i color=blue,trim=duration=0.04 \
	-f lavfi -i anullsrc,atrim=duration=2 \
	-movflags +empty_moov+hybrid_fragmented \
	-frag_duration 1000000 \
	-frag_interleave 1 \
	output.mp4

1. first_track is the first track with track->entry != 0. As in the
command above, video track (track index 0) has a single frame. When
flush the second fragment, first_track is 1, the audio track.

2. write_moof = i == first_track, so write_moof is false for i = 0.

3. When mov->frag_interleave != 0, mov->mdat_buf != NULL, because
it contains audio data. So avio_write is called before write_moof,
that is, the data write before moof, and mov_finish_fragment
executed with wrong mdat_start.

4. With normal fmp4 output, the error isn't obvious. With
hybrid_fragmented, ffplay output.mp4 shows a lot of error messages.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:36:54 +08:00
3d9b284ad1 tests: Add fate-hevc-color-reserved
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
64116800be tests/fate/hevc: Fix dependancy for hevc-alpha
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
9a19ba4067 tests/fate/cbs: Add hevc metadata set color test
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
c80002aa81 avcodec/h2645_vui: Ensure color primaries/trc/space isn't reserved value
Fix error reported by swscaler:
Unsupported input (Operation not supported): fmt:yuv420p csp:unknown prim:reserved trc:bt709 -> fmt:yuv420p csp:bt709 prim:reserved trc:bt709

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
6c291232cf avformat/movenc: fix VVC encoding with leading pictures
The default behavior for VVenC (since v1.10.0) is to create an IDR with
leading pictures for the first picture in decoding order (POC 32). This
leads to FFmpeg generating an edit list with an empty entry, skipping
the leading pictures.

This patch fixes the calculation for the start_pts, while the DTS is
negative (as produced by vvenc).

Signed-off-by: Gabriel Hege <g+ffmpeg@hege.cc>
2025-05-31 09:47:50 +08:00
a02e880e35 avcodec/vvc/sei: add decode_mastering_display_colour_volume
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
f6d2f38530 avcodec/vvc/sei: add decode_ambient_viewing_environment
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
761f75db74 avcodec/vvc: support fields
passed files:
    FIELD_A_Panasonic_4.bit
    FIELD_B_Panasonic_2.bit

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
870fa133af avcodec/vvc/sei: add decode_frame_field_info
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
299544bd0c avcodec/h274: add H274SEIFrameFieldInfo struct
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
33d511b581 avcodec/cbs_sei_syntax_template: add sei message frame_field_information
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
97137e38c1 avcodec/vvc/sei: add decode_content_light_level_info
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
40bc5e119e avcodec/vvc/sei: add decode_display_orientation
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
d140648c31 avcodec/cbs_sei_syntax_template: add sei message sei_display_orientation
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
23e9912315 avcodec/vvcdec: verify picture hash
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
9620c95edb avcodec/h274: add ff_h274_hash functions
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
8dfc24cdce avcodec/vvc/sei: add decode_decoded_picture_hash
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
942cf59e9d avcodec/h274: add H274SEIPictureHash struct
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
312f8ef2ca avcodec/vvc/dec: support removing film grain params from side data
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
a8d949bd96 avcodec/vvc/dec: support applying film grain by the decoder
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
1608d60001 avcodec/vvc/dec: export sei to the frame when the frame starts
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
1c87e3625a avcodec/vvc/sei: add decode_film_grain_characteristics
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
ab5df96cef avcodec/vvc: support decoding prefix and suffix nal units
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
bf3a7291db avcodec/cbs_sei_syntax_template: add sei message film_grain_characteristics
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
e618f7d5cf avcodec/cbs_h2645: add cbs_sei_h274_types
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
848ceb1329 Revert "ogg/vorbis: implement header packet skip in chained ogg bitstreams."
non flat extradata is problematic and was missed by reviewers

Found-by: Andreas Rheinhardt
This reverts commit 574f634e49.
2025-05-31 03:18:26 +02:00
0435cd5a62 avfilter/x86/vf_spp: Remove permutation-specific code
The MMX requantize functions have the MMX permutation
(i.e. FF_IDCT_PERM_SIMPLE) hardcoded and therefore
check for the used permutation (namely via a CRC).
Yet this is very ugly and could even lead to misdetection;
furthermore, since d7246ea9f2
the permutation used here is de-facto and since
bfb28b5ce8 definitely
impossible on x64, making this code dead on x64.
So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:31:09 +02:00
23761c7acd avcodec/asvenc,dvenc: Optimize unaligned checks away if possible
For certain arches (AARCH64, x86, generic) get_pixels and
get_pixels_unaligned always coincide for 8 bit input.
In these cases it is possible to avoid checks for unaligned
input in asvenc, dvenc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:28:51 +02:00
fbf5cfaed5 avcodec/pixblockdsp: Fix get_pixels alignment documentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:28:35 +02:00
17d5f30dd5 avcodec/pixblockdsp: Pass bits_per_raw_sample directly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:27:09 +02:00
20ddada2a3 avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.

This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).

*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:25:27 +02:00
61a70e8e9e avcodec/dvenc: Check for unaligned pointers, strides
Fixes segfaults on systems where PixblockDSPContext.get_pixels
really requires to be properly aligned (e.g. ARMv7).
Before this commit input created by
-filter_complex nullsrc=s=740x576:r=25,format=yuv420p,crop=w=720:x=2
led to crashes.

(The unaligned strides are in violation of the AVFrame.linesize
documentation, unaligned pointers itself do not seem to be
prohibited for encoders.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:12:47 +02:00