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

49499 Commits

Author SHA1 Message Date
Andreas Rheinhardt
0c92c8e6e3 avcodec/libxevd: Improve included headers a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
ec0bd89297 avcodec/libxevd: Use CODEC_LONG_NAME()
Brings the length of the line down to less than 80 chars.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
9209350f8d avcodec/libxevd: Remove useless AVClass
This decoder does not have options.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
c4dceb8354 avcodec/libxevd: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
cb9fb80c7f avcodec/libxevd: Deduplicate code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
85fc5a0c3f avcodec/libxevd: Avoid cloning AVPacket
Cloning a packet whose source is going to be unreferenced
immediately afterwards is wasteful.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
4e14a8e6be avcodec/libxevd: Set AV_CODEC_CAP_DR1
This decoder uses av_image_copy() to copy decoded images
to buffers obtained via ff_get_buffer(); ergo it can handle
user-provided buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt
bbeee3339f avcodec/libxevd: Remove FF_CODEC_CAP_SETS_PKT_DTS cap
This decoder implements the receive_frame API; such decoders
always have to set the pkt_dts field themselves and the avcodec
test checks for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:19 +01:00
Andreas Rheinhardt
5a4702cba9 avcodec/Makefile: Add missing AV1 decoder->av1_parse.o dependency
Needed for ff_av1_framerate().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:33:03 +01:00
James Almer
194414f62d avcodec/av1dec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Fixes errors when opening streams with no extradata (like those from raw OBU
sources). It also calls get_format() on new Sequence Headers when required.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-29 14:48:00 -03:00
Andreas Rheinhardt
4a134eb14a avcodec/intrax8: Fix assert
Commit 900ce6f8c3 replaced
IntraX8Context.ac_vlc by IntraX8Context.ac_vlc_table,
but forgot to update an av_assert2()*.
cf7ed01938 then
replaced this with a check for j_ac_vlc[mode],
but this makes no sense as j_ac_vlc is of type
const VLCElem [2][2][8][].

Worse yet, mode can be up to three and then
j_ac_vlc[mode] is undefined behaviour. This happened
during the wmv8-x8intra FATE test.

*: Since 84f16bb5e6
config.h was no longer auto-included in avassert.h
and this disabled av_assert1() and av_assert2()
in files where config.h has not been included before
the inclusion of avassert.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-29 10:30:16 +01:00
Haihao Xiang
d263fce2b2 lavc/qsvenc: update the selection of bitrate control method
The default method is changed to CQP

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-02-29 13:36:41 +08:00
Fei Wang
57fbe929f3 avcodec/av1dec: Return error for unsupported tile list OBU
Otherwise decoding maybe successful but output result is incorrect.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-29 13:36:41 +08:00
Fei Wang
3f7e50f539 avcodec/av1dec: Move message of OBU info back to the beginning
So that can show OBU info even it doesn't have decomposed content. And
add OBU content status into the message.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-29 13:36:41 +08:00
J. Dekker
570052cd2a avcodec/aarch64/hevc: add luma deblock NEON
Benched using single-threaded full decode on an Ampere Altra.

Bpp Before  After  Speedup
8   73,3s   65,2s  1.124x
10  114,2s  104,0s 1.098x
12  125,8s  115,7s 1.087x

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:14:58 +01:00
Cosmin Stejerean
69dd1ce610 avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode
Co-authored-by: Amir Naghdinezhad <amir.naghdinezhad@intel.com>
Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-27 19:38:23 -03:00
Andreas Rheinhardt
0c204ce9f6 avcodec/dxvenc: Use proper alignment, write endian-independent output
Fixes the dxv3enc-dxt1 FATE test with UBSan and on big-endian
hardware.

Reviewed-by: James Almer <jamrial@gmail.com>
Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 23:05:26 +01:00
sunyuechi
40911bc1a1 lavc/dnxhdenc: add ff_dnxhdenc_init
This is for clarity and use in testing, consistent with other parts of the code.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:32:37 +02:00
sunyuechi
a7ad76fbbf lavc/me_cmp: R-V V nsse
C908:
nsse_0_c: 1990.0
nsse_0_rvv_i32: 572.0
nsse_1_c: 910.0
nsse_1_rvv_i32: 456.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:31:30 +02:00
Andreas Rheinhardt
a6aa043baa avcodec/aac: Split ChannelElement in decoder and encoder structs
The AAC decoders share no common code with the AAC encoder,
so they are not restricted to using the same structures.
This implies that one can use different structs for each
component and remove elements not used by the decoders/
the encoder. This leads to quite sizeable savings:
sizeof(ChannelElement) for the encoder went down to 134432B
here from 547552B; for the decoder it went down to 512800B.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt
6c92347ab9 avcodec/sbr: Remove unused AACDecContext* parameter from sbr_lf_gen_mips
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt
80eca6ec99 avcodec/aacps: Inline ff_ps_ctx_init()
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt
1ecc906536 avcodec/aacdec: Rename AACContext to AACDecContext
It is decoder-only; furthermore, there is already
an AACContext in use by libfdk-aacenc.
Also make aacdec.h provide the typedef for AACContext;
up until now, this has been done by sbr.h.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt
1b048dd443 avcodec/aacsbr: Remove unused parameter from sbr_gain_calc
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt
a0fa6b6030 avocdec/aac: Move decoder-only stuff to new header aacdec.h
AACContext is not used by the encoder at all.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt
c6cf253c98 avcodec/aacdec_template: Don't use intermediate void*
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Ronald S. Bultje
d6083f503d avcodec/x86/hevc: fix luma 12b overflow
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-26 12:29:58 +01:00
Zhao Zhili
a3ca4beeaa avcodec/evc: Remove redefine of HEVC_MAX_ENTRY_POINT_OFFSETS
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-26 16:28:37 +08:00
Tong Wu
cfa802bdc3 avcodec/vaapi_encode: remove a duplicate av_freep
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-26 14:52:06 +08:00
Frank Plowman
8b6219a99d lavc/vvc: Read subpic ID when only one subpicture is present
Previously, the following syntax elements were not read in the case
sps_num_subpics_minus is 0:
* sps_subpic_id_len_minus1
* sps_subpic_id_mapping_explicitly_signalled_flag
* sps_subpic_id_mapping_present_flag
* sps_subpic_id[i]
This was causing failures to decode bitstreams, for example the DVB's
"VVC HDR UHDTV1 OpenGOP 3840x2160 50fps HLG10 PiP" V&V bitstream.

Patch fixes this by moving the reads for these syntax elements out a
scope.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-25 19:55:01 -03:00
Frank Plowman
53ab7ff67e lavc/vvc: Correct sps_num_subpics_minus1 minimum
The spec says "the value of sps_num_subpics_minus1 shall be in the
range of 0 to MaxSlicesPerAu − 1, inclusive."

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-25 18:52:18 -03:00
Frank Plowman
248a1f9d00 lavc/vvc: Increase VVC_MAX_* definitions for level 6.3
Reported-by: James Almer <jamrial@gmail.com>
Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-25 18:30:34 -03:00
Andreas Rheinhardt
ab2173c0a5 avcodec/cbs_h2645: Avoid function pointer casts, fix UB
The SEI message read/write functions are called
via function pointers where the SEI message-specific
context is passed as void*. But the actual function
definitions use a pointer to their proper context
in place of void*, making the calls undefined behaviour.
Clang UBSan 17 warns about this.

This commit fixes this by adding wrapper functions
(created via macros) that have the right type that
call the actual functions. This reduced the number of failing
FATE tests with UBSan from 164 to 85 here.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 13:42:47 +01:00
sunyuechi
9b90d0d36a lavc/me_cmp: R-V V vsse vsad intra
C908:
vsad_4_c: 681.0
vsad_4_rvv_i32: 182.2
vsad_5_c: 278.0
vsad_5_rvv_i32: 145.2
vsse_4_c: 595.0
vsse_4_rvv_i32: 125.2
vsse_5_c: 281.0
vsse_5_rvv_i32: 101.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-25 11:05:25 +02:00
sunyuechi
925b55a5e8 lavc/me_cmp: R-V V vsse vsad
C908:
vsad_0_c: 936.0
vsad_0_rvv_i32: 236.2
vsad_1_c: 424.0
vsad_1_rvv_i32: 190.2
vsse_0_c: 877.0
vsse_0_rvv_i32: 204.2
vsse_1_c: 439.0
vsse_1_rvv_i32: 140.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-25 11:05:25 +02:00
Andreas Rheinhardt
484e7716bc avcodec/cbs_h266_syntax_template: Don't omit unused function parameter
The calls to the sei_decoded_picture_hash read and write functions
are performed with four pointer arguments; just because one
of them is unused by the callees does not mean that they
can be omitted: This is undefined behaviour.
(This was not recognized because the SEI_MESSAGE_RW macro
contains casts.)

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Wu Jianhua
6c83cd5cb3 avcodec/vvcdec: add Intra Block Copy decoder
Introduction at https://ieeexplore.ieee.org/document/9408666

passed files:
    10b444_A_Kwai_3.bit
    10b444_B_Kwai_3.bit
    CodingToolsSets_D_Tencent_2.bit
    IBC_A_Tencent_2.bit
    IBC_B_Tencent_2.bit
    IBC_C_Tencent_2.bit
    IBC_D_Tencent_2.bit
    IBC_E_Tencent_1.bit
    LOSSLESS_B_HHI_3.bit

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Nuo Mi <nuomi2021@gmail.com>
2024-02-24 20:24:56 +08:00
Wu Jianhua
9481887755 avcodec/vvcdec: add Intra Block Copy parser
Co-authored-by: Nuo Mi <nuomi2021@gmail.com>
2024-02-24 20:24:56 +08:00
Nuo Mi
422e8a877b avcodec/vvcdec: refact, rename !is_mvp to check_mer
For IBC, we'll utilize the check_available function.
However, neither MVP nor merge mode need to check the motion estimation region.
Let's rename it to avoid confusion.
2024-02-24 20:24:56 +08:00
Nuo Mi
1ffeeb8a26 avcodec/vvcdec: fix dual tree for skipped transform tree/unit
fix IBC_E_Tencent_1.bit
2024-02-24 20:24:55 +08:00
Nuo Mi
c503c0b33e avcodec/vvcdec: ff_vvc_set_intra_mvf, refact to support dmvr tab 2024-02-24 20:24:55 +08:00
Nuo Mi
3241aa26d1 avcodec/vvcdec: skip inter prediction for IBC blocks
Intra Block Copy relies on reconstructed pixels from the current frame.
We skip IBC during the inter prediction stage and handle it during the reconstruction stage.
2024-02-24 20:24:55 +08:00
Wu Jianhua
09946dc40b avcodec/vvcdec: implement update_hmvp for IBC
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Nuo Mi <nuomi2021@gmail.com>
2024-02-24 20:24:55 +08:00
Nuo Mi
5a388d2cc6 avcodec/vvcdec: cabac, fix non_inter_flag, pred_mode_flag, amvr_shift for IBC 2024-02-24 20:24:55 +08:00
Nuo Mi
dd3650cada avcodec/vvcdec: deblock_bs, fix intra check for IBC
An Intra Block Copy clip may use different modes for luma and chroma.
For example, MODE_IBC for luma and MODE_INTRA for chroma.
We have to check luma and chroma CuPredMode (cpm) separately.
2024-02-24 20:24:55 +08:00
Nuo Mi
37ebebd055 avcodec/vvcdec: set CuPredMode table for chroma
follow the spec
2024-02-24 20:24:55 +08:00
Nuo Mi
ab2c9dfb26 avcodec/vvcdec: refact out deblock_bs to reduce duplicate code 2024-02-24 20:24:55 +08:00
Fei Wang
7d82daf31d lavc/vvc_ps: Correct vaule of ALF_NUM_FILTERS_CC
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-23 22:08:56 +08:00
Zhao Zhili
80cd6e655b avcodec/audiotoolboxenc: Ensure frame_size isn't zero
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-22 19:13:13 +08:00
Zhao Zhili
338e33b084 avcodec/audiotoolboxenc: remove CAP_VARIABLE_FRAME_SIZE from alac
AV_CODEC_CAP_VARIABLE_FRAME_SIZE has been set for alac_at encoder,
which means avctx->frame_size should be zero. However, alac_at
encoder also set avctx->frame_size. This leading to assert failure
in ffmpeg_sched.c
	av_assert0(enc->sq_idx[0] >= 0);

Actually, the implementation of audiotoolboxenc.c doesn't support
frame_size been zero.

Fix #10720.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-22 19:13:02 +08:00
Andreas Rheinhardt
4179c121c3 avcodec/movtextenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
e9a587af25 avcodec/srtenc, webvttenc: Use av_printf_format
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
ed9de6d2d8 avcodec/ttmlenc: Remove always-true check
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
253a8340f5 avcodec/ttmlenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
abea3749b3 avcodec/webvttenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice). It also ensures that the data is always
0-terminated.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
686af4578c avcodec/srtenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice). It also ensures that the data is always
0-terminated, whereas the current code never does this
and returns success in case the length of the
string to write and the size of the buffer coincide.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
b8a00a1f73 avcodec/assenc: Use size_t for length of string
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt
fe08058f24 avcodec/cbs_vp8: Don't leave out ... in calls to variadic macros
It is undefined behaviour (see C11, 6.10.3 (4); see also
14dd0a9057).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:42:28 +01:00
Andreas Rheinhardt
76b4151175 avcodec/h264dec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:42:28 +01:00
Andreas Rheinhardt
b550dd670a avcodec/h264dec: Return early in ff_h264_draw_horiz_band()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:42:28 +01:00
Andreas Rheinhardt
4d86e64d33 avcodec/cbs_vp8: Remove empty flush callback
This callback is optional and should therefore only be set
if it actually does something.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 19:24:19 +01:00
sunyuechi
9cb8f262f2 lavc/me_cmp: R-V V sse
C908:
sse_0_c: 614.7
sse_0_rvv_i32: 138.2
sse_1_c: 302.7
sse_1_rvv_i32: 107.2
sse_2_c: 175.7
sse_2_rvv_i32: 104.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:55 +02:00
sunyuechi
37463d7979 lavc/me_cmp: R-V V pix_abs_y2
C908:
pix_abs_0_2_c: 904.0
pix_abs_0_2_rvv_i32: 172.2
pix_abs_1_2_c: 460.0
pix_abs_1_2_rvv_i32: 168.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:25 +02:00
sunyuechi
f1ec475f66 lavc/me_cmp: R-V V pix_abs_x2
C908:
pix_abs_0_1_c: 767.0
pix_abs_0_1_rvv_i32: 196.2
pix_abs_1_1_c: 388.0
pix_abs_1_1_rvv_i32: 185.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:25 +02:00
sunyuechi
b41e115dde lavc/me_cmp: R-V V pix_abs
C908:
pix_abs_0_0_c: 534.0
pix_abs_0_0_rvv_i32: 136.2
pix_abs_1_0_c: 287.7
pix_abs_1_0_rvv_i32: 125.2
sad_0_c: 534.0
sad_0_rvv_i32: 136.2
sad_1_c: 287.7
sad_1_rvv_i32: 125.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:25 +02:00
Andreas Rheinhardt
39b4b5aad7 avcodec: Remove superfluous ';' outside of functions
Inside a function an extra ';' is a null statement;
but outside of it it simply must not happen.
So remove them.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:06:29 +01:00
Andreas Rheinhardt
48612de63c avcodec/vvc/vvcdsp: Remove pointless wrappers
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:06:22 +01:00
Andreas Rheinhardt
ef04737e18 avcodec/vvc/vvc_ps: Use union for luts to avoid unaligned accesses
These arrays are currently accessed via uint16_t* pointers
although nothing guarantees their alignment. Furthermore,
this is problematic wrt the effective-type rules.
Fix this by using a union of arrays of uint8_t and uint16_t.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:06:10 +01:00
Andreas Rheinhardt
1eafbc27e2 avcodec/vvc/vvc_ps: Check before access
max_bin_idx can be at most LMCS_MAX_BIN_SIZE - 1 here,
so pivot[LCMS_MAX_BIN_SIZE + 1] may be accessed,
but pivot has only LCMS_MAX_BIN_SIZE + 1 elements
(unless the values of pivot were so that it is always
assured that pivot[LCMS_MAX_BIN_SIZE] is always < sample
(which it is iff it is always < 2^bit_depth - 1)).
So reorder the checks.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:04:28 +01:00
Andreas Rheinhardt
1d66a122df avcodec/avcodec: Deprecate AV_INPUT_BUFFER_MIN_SIZE
It used to be used with preallocated packet buffers with
the old encode API, but said API is no more and therefore
there is no reason for this to be public any more.
So deprecate it and use an internal replacement
for the encoders using it as an upper bound for the
size of their headers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 00:24:44 +01:00
Jan Ekström
37936b09ce avcodec/av1dec: fix matrix coefficients exposed by codec context
`colorspace` in avcodec terms means `matrix coefficients`.

Reviewed-by: James Almer <jamrial@gmail.com>
2024-02-20 20:54:17 +02:00
Peter Ross
37702e2066 avcodec/lead: support format 0x0
Fixes ticket #10660.
2024-02-20 17:31:40 +11:00
Peter Ross
db975ff00d avcodec/lead: support unaligned blocks
Fixed ticket #10656.
2024-02-20 16:40:35 +11:00
Andreas Rheinhardt
8d17ab607f avcodec/internal: Move ff_exp2fi() to aacsbr.c
Only used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
42f6dfc42e avcodec/jpeg2000: Simplify exp2fi for numbers used here
The call to ff_exp2fi() here always uses arguments in the normal
range, so that the branches in ff_exp2fi() are unnecessary.
This is so because JPEG2000 itself only supports up to
128 bits per component per pixel (we only support far less);
furthermore, expn is always 0..31 for the decoder and also
sane for the encoder, so that the difference between these
two values is always in the normal range of -126..128.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
271d6709cf avcodec/jpeg2000dec: Avoid using GetByteContext.buffer directly
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
b48b3250ca avcodec/jpeg2000dec, j2kenc: Constify where appropriate
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
32178c2f28 avcodec/x86/h264_qpel: Remove put_h264_qpel[48]_mmxext
These functions are not faster than the C versions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
4d45093f9e avcodec/h264qpel_template: Mark pointers as non-aliasing
It allows the compiler to combine two reads and writes of adjacent
32bit memory locations into 64bit read-writes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
7cad4dba50 avcodec/x86/hpeldsp_init: Avoid using ff_avg_pixels16_mmx
Use ff_avg_pixels16_mmxext or ff_avg_pixels16_sse2
(for users with SSE2_FAST) instead.
This also allows to remove ff_avg_pixels16_mmx,
as this was its last remaining user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt
8a349bb02f avcodec/x86/fpel: Remove declarations of inexistent functions
Forgotten in 50a8cbb23e and
a51279bbde.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Jan Ekström
e06ce6d2b4 {avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers
This together with adjusting the inclusion define allows for the
build to not fail with latest Vulkan-Headers that contain the
stabilized Vulkan AV1 decoding definitions.

Compilation fails currently as the AV1 header is getting included
via hwcontext_vulkan.h -> <vulkan/vulkan.h> -> vulkan_core.h, which
finally includes vk_video/vulkan_video_codec_av1std.h and the decode
header, leading to the bundled header to never defining anything
due to the inclusion define being the same.

This fix is imperfect, as it leads to additional re-definition
warnings for things such as
VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is
not clear how to otherwise have the bundled version trump the
actually standardized one for a short-term compilation fix.
2024-02-18 13:16:37 +02:00
Mattias Wadman
78812cd147 avcodec/h2645_parse: Don't treat 0x000002 as a start code and truncate
According to ITU-T H.265 7.4.2.1 this byte sequence should not appear in a
NAL unit but in practice in rare cases it seems it does, possibly due to buggy
encoders. Other players like VLC and Quicktime seem to be fine with it.

Currently when this sequence is found it is treated as if the next start code
has been found and the NAL unit gets truncated.

This change limits the code to only look for first start code 0x0000001 or
first escape 0x000003.

Sadly i can't share the original source file with the issue but the first
80 bytes of the NAL unit looks like this:

       │00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
0x00000│00 00 00 01 02 01 d0 bc 57 a1 b8 44 70 01 00 0b│........W..Dp...│
0x00010│80 2e 00 c2 6c ec 3e b9 e3 03 fb 91 2e d2 43 cb│....l.>.......C.│
0x00020│1d 2c 00 00 02 00 02 00 5c 93 72 6f 31 76 18 00│.,......\.ro1v..│
0x00030│08 38 aa b1 4c 33 3f fd 08 cb 77 9b d4 3c db 02│.8..L3?...w..<..│
0x00040│a2 04 73 15 75 de 3b c4 67 c0 8f ca ad 31 f1 99│..s.u.;.g....1..│

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-18 07:33:27 +01:00
Connor Worley
a4f019e44e lavc/dxv: assume DXV2 files use premultiplied alpha
I generated a DXV2 file with an interesting alpha channel using
Adobe Media Encoder 2015 and compared decoding it using Resolume Alley
and ffmpeg. Similarly to DXV3 files, Alley expects premultiplied alpha
and ffmpeg matches its decoding more closely when it does the same.

Reference file: https://connorworley.com/dxv2-dxt5.mov

Existing FATE tests for DXV2 files do not cover this change.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-18 07:33:27 +01:00
Connor Worley
1487f6198c lavc/texturedsp: require explicitly-set frame dimensions
This change decouples the frame dimensions from avctx, which is useful
for DXV decoding, and fixes incorrect behavior in the existing
implementation.

Tested with `make fate THREADS=7` and
`make fate THREADS=7 THREAD_TYPE=slice`.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-18 07:30:01 +01:00
James Almer
0895ef0d6d avcodec/speexdec: further check for sane frame_size values
Prevent potential integer overflows.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-17 09:51:23 -03:00
sunyuechi
d897bbb48d lavc/vp8dsp: R-V V vp8_idct_dc_add4uv
c908:
vp8_idct_dc_add4uv_c: 387.7
vp8_idct_dc_add4uv_rvv_i32: 134.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:45:49 +02:00
sunyuechi
e74e18cae4 lavc/vp8dsp: R-V V vp8_idct_dc_add4y
c908:
vp8_idct_dc_add4y_c: 368.5
vp8_idct_dc_add4y_rvv_i32: 134.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:45:49 +02:00
sunyuechi
c12053cefc lavc/vp8dsp: R-V V vp8_idct_dc_add
c908:
vp8_idct_dc_add_c: 102.2
vp8_idct_dc_add_rvv_i32: 42.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:45:49 +02:00
sunyuechi
89189dd9e7 lavc/rv34dsp: R-V V rv34_idct_dc_add
C908:
rv34_idct_dc_add_c: 134.7
rv34_idct_dc_add_rvv_i32: 45.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:33:35 +02:00
sunyuechi
ee08974f90 lavc/rv34dsp: R-V V rv34_inv_transform_dc
C908:
rv34_inv_transform_dc_c: 35.5
rv34_inv_transform_dc_rvv_i32: 27.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:33:35 +02:00
James Almer
66b50445cb avcodec/speexdec: check for sane frame_size values
Regression since ab39cc36c7.

Fixes heap buffer overflows
Fixes ticket #10866

Reported-by: sploitem <sploitem@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-16 15:21:52 -03:00
Andreas Rheinhardt
7ed1e806e7 avcodec/x86/simple_idct: Empty MMX state in ff_simple_idct_mmx
We currently mostly do not empty the MMX state in our MMX
DSP functions; instead we only do so before code that might
be using x87 code. This is a violation of the System V i386 ABI
(and maybe of other ABIs, too):
"The CPU shall be in x87 mode upon entry to a function. Therefore,
every function that uses the MMX registers is required to issue an
emms or femms instruction after using MMX registers, before returning
or calling another function." (See 2.2.1 in [1])
This patch does not intend to change all these functions to abide
by the ABI; it only does so for ff_simple_idct_mmx, as this
function can by called by external users, because it is exported
via the avdct API. Without this, the following fragment will
assert (on x86_32, as ff_simple_idct_mmx is not used on x64):
    int16_t __attribute__ ((aligned (16))) block[64];
    AVDCT *dct = avcodec_dct_alloc();
    dct->idct_algo = FF_IDCT_AUTO;
    avcodec_dct_init(dct);
    dct->idct(block);
    av_assert0_fpu();

[1]: https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/intel386-psABI-1.1.pdf

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-16 14:58:12 +01:00
Frank Plowman
acacf8a313 lavc/vvc: Use pps->{width, height} over sps->{width, height}
The PPS should be used instead of the SPS to get the current picture's
dimensions.  Using the SPS can cause issues if the resolution changes
mid-sequence.  In particular, it was leading to invalid memory accesses
if the resolution decreased.

Patch replaces sps->{width,height} with pps->{width,height}.  It also
removes sps->{width,height}, as these are no longer used anywhere.

Fixes crash when decoding DVB V&V test sequence
VVC_HDR_UHDTV1_ClosedGOP_Max3840x2160_50fps_HLG10_res_change_without_RPR

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-16 12:05:03 +08:00
Dariusz Marcinkiewicz
86367be5ef lavc/libvpxenc: add screen-content-mode option
This exposes VP8E_SET_SCREEN_CONTENT_MODE option from libvpx.

Co-authored-by: Erik Språng <sprang@webrtc.org>
Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Signed-off-by: James Zern <jzern@google.com>
2024-02-15 19:09:05 -08:00
Anton Khirnov
1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Andreas Rheinhardt
80666fdd2f avcodec/cri, tdsc, tiff: Don't forward AVCodecContext.dct_algo
It is unused for decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:18:42 +01:00
Nuo Mi
1e174120d4 avcodec/vvcdec: frame_context_setup, set fc->ref to NULL
fc->ref points to an old VVCFrame, which cannot be used after frame_context_setup.
This prevents crashes in decode_nal_units-->ff_vvc_report_frame_finished.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-14 10:09:06 +08:00
James Almer
eb5b4e60c9 avcodec/avcodec: don't print coded dimensions if not set
The avctx passed to avcodec_string() may have unset coded dimensions, as is the
case when called by av_dump_format() where the streams had all the needed
information at the container level, and as such no frames were decoded
internally.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-13 20:32:48 -03:00
Andreas Rheinhardt
6106fb2b4c avcodec/hevcdsp: Offset ff_hevc_.pel_filters to simplify addressing
Besides simplifying address computations (it saves 432B of .text
in hevcdsp.o alone here) it also fixes undefined behaviour that
occurs if mx or my are 0 (happens when the filters are unused)
because they lead to an array index of -1 in the old code.
This happens in the checkasm-hevc_pel FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-13 20:25:49 -03:00