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

119727 Commits

Author SHA1 Message Date
0105ff554b avcodec/libaribb24: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-17 21:27:29 +02:00
b5f26c4dd8 avcodec/utvideoenc: Don't advertise unsupported option
Also return an better error code if it is set numerically.
(This option was added in 2862b63783
when an AVCodecContext generic option was moved to
a codec private one without realizing that not every
generic one is valid for every encoder.)

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-17 15:06:00 +02:00
88f2ccdf16 cbs_apv: Fix memory leak on metadata parse failure
Buffers are allocated inside some metadata types, so we must ensure
that the object is visible to the free function before a parse failure.

Found by libFuzzer.
2025-05-17 11:23:36 +01:00
a65d028fb1 Changelog: VVC supports all content of SCC
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:24:01 +08:00
fd5d754b2a avcodec/vvc: add adaptive color transform support
passed files:
    ACT_A_Kwai_3.bit
    ACT_B_Kwai_3.bit

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
0e4c0db317 avcodec/vvc/intra: refact out lmcs_scale_chroma and add_residual
prepare for adaptive color transform

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
ff1ecc7eb3 avcodec/vvc/intra: make lmcs_scale_chroma inplace
prepare for adaptive color transform

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
d2e7ca684c avcodec/vvc/intra: refact, predict jcbcr to tb->coeffs
prepare for adaptive color transform

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
86e96a1c02 avcodec/vvc/intra: fix scaling process for transform coefficients
See 8.7.3 Scaling process for transform coefficients

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
fef573f30b avcodec/vvc/dsp: add adaptive_color_transform
See 8.7.4.6 Residual modification process for blocks using colour space conversion

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
8bdad76c00 avcodec/vvc/dsp: update the interface of pred_residual_joint for joint cbcr residual functionality
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
d00a249dbf avcodec/vvc/ctu: fix derive_chroma_intra_pred_mode
See 8.4.3 Derivation process for chroma intra prediction mode

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
c58357edc2 avcodec/vvc/ctu: read act_enabled_flag for adaptive color transform
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
b9c5fb0d00 avcodec/vvc/cabac: add ff_vvc_cu_act_enabled_flag
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
70a2d0d756 avcodec/vvc/intra: add palette coding decoder
Introduction at https://ieeexplore.ieee.org/document/9408666

passed files:
    10b422_G_Sony_5.bit
    10b422_H_Sony_5.bit
    10b422_I_Sony_5.bit
    10b422_J_Sony_5.bit
    10b422_K_Sony_5.bit
    10b422_L_Sony_5.bit
    8b422_G_Sony_5.bit
    8b422_H_Sony_5.bit
    8b422_I_Sony_5.bit
    8b422_J_Sony_5.bit
    8b422_K_Sony_5.bit
    8b422_L_Sony_5.bit
    8b444_A_Kwai_2.bit
    8b444_B_Kwai_2.bit
    PALETTE_A_Alibaba_2.bit
    PALETTE_B_Alibaba_2.bit
    PALETTE_C_Alibaba_2.bit
    PALETTE_D_Alibaba_2.bit
    PALETTE_E_Alibaba_2.bit

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
95473fae9b avcodec/vvc/filter: skip deblocking filter for palette
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
26215b8c83 avcodec/vvc/ctu: add palette support
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
fd85f83608 avcodec/vvc/intra: add ff_vvc_palette_derive_scale
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
3ecf8f8766 avcodec/vvc/ctu: refact out intra_data
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
d0f9151eb0 avcodec/vvc: refact, save pf and ciip_flag in ff_vvc_set_intra_mvf
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
75e5fb6e37 avcodec/vvc: refact out ep_init and ep_init_wpp
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
cfea9b88a5 avcodec/vvc/ctu: refact out ff_vvc_channel_range
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
d80041f123 avcodec/vvc: add VVC_MAX_NUM_PALETTE_PREDICTOR_SIZE
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
89ba1bb255 avcodec/vvc/cabac: add palette support
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
a7320efa2b avcodec/vvc/cabac: add 9.3.3.7 Fixed-length binarization process
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
02fe29fa39 avcodec/vvc/cabac: add 9.3.3.5 k-th order Exp - Golomb binarization process
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-17 09:22:40 +08:00
fe97bf8752 tests/fate/probe: add test for dts in wav
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-16 20:43:58 +02:00
a6a510c1d9 tests/fate/probe: add test for pcm misdetected as mp3 in wav
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-16 20:43:58 +02:00
0d6ef6f545 fftools/textformat: correctly propagate uninit error codes
This allows catching IO errors occuring at file close.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-16 20:43:58 +02:00
a124c9a580 Revert "fftools/textformat/avtextformat: Make close functions return void"
This reverts commit 7684243fbe and
a888975a3c.
2025-05-16 20:43:58 +02:00
87b0561c88 build: fix windows build issue introduced by 45bea45
We defined CR to 2 in libavcodec/vvc/dec.h, but the CR used by _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY winnt.h
reorder the header will avoid the issue.
2025-05-16 20:30:46 +08:00
45daaf2caa avcodec/mpeg12enc: Fix writing closed captions
Broken in 6e225123d8, because
ff_copy_bits() expects the amount of bits, not bytes to write.
And because it relies on the buffer to be padded, using
side_data->size * 8 is not possible. So partially revert
said commit.

Fixes ticket #11591.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 12:20:18 +02:00
79e2a845cd Revert "fftools/graphprint: Now, make it a Killer-Feature!"
This reverts commit 1f2b8d7238.
2025-05-16 10:37:29 +02:00
505510acda avcodec/mpegvideo: Move parent to MPVEncContext
This is more type-safe and avoids having parent contexts
when unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
bc81a797c4 avcodec/mpeg4videodec: Move setting has_b_frames to mpeg4video_parser.c
ff_h263_decode_frame() already does it generically for the decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
2865ebd1fb avcodec/mpeg4videodec,h263dec: Only set skipped_last_frame for !vop_coded
This is more in line with the spec and avoids a branch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
c37fb99abb avcodec/h263dec: Always output next, not current pic when flushing
It is the last picture in display order.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
2d4d7df10c avcodec/mpeg4videodec: Keep skipped_last_frame in sync between threads
Otherwise the output may depend upon the number of frame threads used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
dfb4477191 avcodec/mpeg4videodec: Don't set chroma matrices unnecessarily
Only the studio profile uses chroma_inter/intra matrices;
the ordinary profile has only inter/intra matrices.
And our code (namely the MPEG-2 unquantize functions)
only use these two matrices (the MPEG-2 decoder unquantizes
on its own while parsing).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
bd6e6495ae avcodec/mpegvideo: Move clear_context() to mpeg4videodec.c
There is only one source of dirty MpegEncContexts:
update_mpvctx() (which copies an MpegEncContext
over another one in order to initialize it). So only clear
these contexts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
839155324e avcodec/mpegvideo_dec: Move memcpy'ing ctx to mpeg4videodec.c
When the destination MpegEncContext in ff_mpeg_update_thread_context()
is not initialized, the source MpegEncContext is simply copied
over it before (potentially) calling ff_mpv_common_init().
This leads to data races when this code is executed which is why
it should be replaced with only copying the necessary fields
(this is for future commits).

Given that the RV30 and RV40 decoders always call said function
with an already initialized MpegEncContext (they use context_reinit
in case of frame size changes), they don't need this ugly
initialization (and are therefore race-free). This means that
this code can be moved to the only decoder that actually needs it:
MPEG-4. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
65015003f5 avcodec/svq1enc: Allocate buffers during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
88ce3dade6 avcodec/svq1enc: Remove always-false check
The pixel format has already been checked generically
via CODEC_PIXFMTS.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
53a012145a avcodec/mpeg12dec: Reinit upon chroma_format change
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
1f0af6b592 avcodec/mpeg12dec: Don't reinit upon aspect ratio change
The spec indeed does not allow the aspect ratio to change
within a video sequence, but this does not imply that we
must reinitialize the decoder if only the aspect ratio changes,
as this value does not affect the decoding process at all.
Moreover, our reinitialization is a bit buggy: If there is
frame reordering, then the not yet output next P-frame is
simply discarded upon reinit. With this patch this no longer
happens when only the aspect ratio changes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
554b52b1b3 avcodec/mpeg12dec: Remove disabled frame-threading code
The MPEG-1 decoder has an update_thread_context function set,
yet it was never enabled (missing AV_CODEC_CAP_FRAME_THREADS
flag). So remove it and also the ff_thread_finish_setup() call
as well as the progress reporting.

(Simply setting the flag would not be enough. The main problems
are:
a) The update_thread_context function relies on memcpy'ing
the whole context instead of only copying the necessary fields.
This leads to data races which is undefined behaviour.
(Btw: The check for whether the non-MpegEncContext fields
of Mpeg1Context should be copied has been broken in
7f0efe232475d7a704924a3cb308281973e8add3.)
b) Even an AVBufferRef* is simply copied, without creating a new
reference.
c) Copying the whole context happens only during init; when parameters
change lateron, the change is not propagated to the next thread.
This affects at least the quant matrix (for MPEG-1).
d) The MPEG-1/2 decoders are made to decode both MPEG-1 and MPEG-2.
When MPEG-2 is decoded, another complication arises: In case of
coded fields, both fields can be in one AVPacket or they can be
in separate AVPackets. One would need to parse enough of the data
to be able to determine whether the next thread needs to start
a new frame or decode the second field of the current frame;
for this one would need to either postpone calling
ff_thread_finish_setup() for coded slices altogether or implement
some form of ff_h2645_packet_split().
One would also need a second ThreadProgress to signal progress
of each field.
e) One would need to reenable waiting in ff_mpv_reconstruct_mb()
for MPEG-1/2 (and H.261).
f) Probably lots of other stuff for invalid input that I am currently
not thinking about.
If this were done, nothing from the current update_thread_context
would remain, so one can just nuke it altogether.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
763b7ceb31 avcodec/rv34: Simplify updating thread context
Call ff_mpeg_update_thread_context() first and
update the RV34 buffers if it indicates a reinitialization.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
1d5f660ff6 avcodec/mpegvideo_dec: Notify users of reinit
Namely of reinititialization performed by
ff_mpeg_update_thread_context(), so that they can simply
update their own dimension-based buffers accordingly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
2f971c7fda avcodec/ituh263dec: Fix indentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00
f82a75333a avcodec/mpegvideo: Move [fb]_code to Mpeg4Dec and MPVEncContext
It is only used by the MPEG-4 decoder and the encoders.
Notice that this field is a per-frame property and therefore
does not need to by synced in mpeg4_update_thread_context().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-16 01:37:35 +02:00