1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00
Commit Graph

144 Commits

Author SHA1 Message Date
Frank Plowman
83b77990c6 lavc/vvc: Always set flags for the current picture
ff_vvc_frame_rpl uses the flags to detect whether a frame is in use.
Therefore, in the case of a CVSS AU (RASL/GDR with
NoOutputBeforeRecoveryFlag) with ph_non_ref_pic_flag = 1, the frame
would be freed before it is used.  Fix this by always marking the
current frame with VVC_FRAME_FLAG_SHORT_REF, as is done by the HEVC
decoder.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-28 21:37:40 +08:00
Zhao Zhili
6aeb084c39 avcodec/vvc: Don't create new thread when thread_count is 1
Make its behavior consistent with other decoders, e.g., H.264/H.265.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-06-27 20:54:42 +08:00
Frank Plowman
d79c926ab6 lavc/vvc: Validate IBC block vector
From H.266 (V3) (09/2023) p. 321:

It is a requirement of bitstream conformance that the luma block
vector bvL shall obey the following constraints:
- CtbSizeY is greater than or equal to
((yCb + (bvL[ 1 ] >> 4)) & (CtbSizeY − 1)) + cbHeight

This patch checks this is true, which fixes crashes on fuzzed
bitstreams.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-27 20:38:34 +08:00
Frank Plowman
c917c423e0 lavc/vvc: Don't discard return codes
Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-27 20:36:13 +08:00
Martin Storsjö
75e3b81f75 avcodec/vvcdec: Fix compiling with MSVC 2022 17.8 and older
Versions of MSVC older than 17.9 error out here with the following
error:

    src/libavcodec/vvc/filter.c(815): error C2059: syntax error: '}'
    src/libavcodec/vvc/filter.c(832): error C2065: 'all_zero_bs': undeclared identifier
    src/libavcodec/vvc/filter.c(836): error C2065: 'all_zero_bs': undeclared identifier

This was a regression from 5b9320b209.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-27 11:06:23 +03:00
Nuo Mi
23531c9776 avcodec/vvcdec: alf, support virtual boundaries
see https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9503377

passed files:
    GDR_A_ERICSSON_2.bit
    GDR_B_NOKIA_2.bit
    GDR_C_NOKIA_2.bit
    VIRTUAL_A_MediaTek_3.bit
    VIRTUAL_B_MediaTek_3.bit
2024-06-25 19:32:17 +08:00
Nuo Mi
3bac5ba861 avcodec/vvcdec: sao, support virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
17c8b63781 avcodec/vvcdec: deblock, support virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
80ded9cfe7 avcodec/vvcdec: ps, derive virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
fc731d8b39 avcodec/vvcdec: misc, constify ALFParams 2024-06-25 19:32:17 +08:00
Nuo Mi
9b532ace02 avcodec/vvcdec: misc, remove unused ALFParams.applied 2024-06-25 19:32:17 +08:00
Nuo Mi
98b6b90601 avcodec/vvcdec: refact out alf_get_edges 2024-06-25 19:32:17 +08:00
Nuo Mi
45d0ba8313 avcodec/vvcdec: misc, reformat ff_vvc_sao_filter 2024-06-25 19:32:17 +08:00
Nuo Mi
a69b07dc79 avcodec/vvcdec: refact, fix naming convention of x0, y0 for sao
it's mismatched with the ff_vvc_sao_filter function declaration
2024-06-25 19:32:17 +08:00
Nuo Mi
ccf1d4172c avcodec/vvcdec: refact out sao_extends_edges 2024-06-25 19:32:17 +08:00
Nuo Mi
200862b144 avcodec/vvcdec: refact out sao_get_edges 2024-06-25 19:32:17 +08:00
Nuo Mi
5b9320b209 avcodec/vvcdec: refact, unify ff_vvc_deblock_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
16e410aaac avcodec/vvcdec: misc, use POS to simplify filter code 2024-06-25 19:32:17 +08:00
Nuo Mi
a6ea542a34 avcodec/vvcdec: refact, unify {horizontal, vertical}_bs, {horizontal, vertical}_p, {horizontal, vertical}_q 2024-06-25 19:32:17 +08:00
Nuo Mi
cc89832d56 avcodec/vvcdec: refact, unify vvc_deblock_bs_chroma_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
0a5bbcf0f3 avcodec/vvcdec: refact, unify vvc_deblock_bs_luma_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
cb6538e9a1 avcodec/vvcdec: refact, unify vvc_deblock_subblock_bs_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
James Almer
1b9af306da avcodec: use the renamed av_zero_extend
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-13 20:36:09 -03:00
Frank Plowman
d72a5fe719 lavc/vvc: Prevent overflow in chroma QP derivation
On the top of p. 112 in VVC (09/2023):

It is a requirement of bitstream conformance that the values of
qpInVal[ i ][ j ] and qpOutVal[ i ][ j ] shall be in the range
of −QpBdOffset to 63, inclusive for i in the range of 0 to
numQpTables − 1, inclusive, and j in the range of 0 to
sps_num_points_in_qp_table_minus1[ i ] + 1, inclusive.

Additionally, don't discard the return code from sps_chroma_qp_table.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-12 20:48:08 +08:00
Andreas Rheinhardt
a0ff31e740 avcodec/vvc/inter: Don't return void
Returning a void is not allowed by the spec. Just return instead.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-11 02:43:14 +02:00
Nuo Mi
f68f40736f avcodec/vvcdec: support mv wraparound
A 360 video specific tool
see https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9503377

passed files:
    DMVR_A_Huawei_3.bit
    WRAP_D_InterDigital_4.bit
    WRAP_A_InterDigital_4.bit
    WRAP_B_InterDigital_4.bit
    WRAP_C_InterDigital_4.bit
    ERP_A_MediaTek_3.bit
2024-06-08 17:45:55 +08:00
Nuo Mi
685174069f avcodec/vvcdec: misc, reindent inter.c 2024-06-08 17:45:55 +08:00
Nuo Mi
a4013e748a avcodec/vvcdec: refact out emulated_edge_no_wrap
prepare for refrence wraparound
2024-06-08 17:45:55 +08:00
Nuo Mi
8abdf0a28e avcodec/vvcdec: misc, move src offset inside emulated_edge 2024-06-08 17:45:55 +08:00
Nuo Mi
2d98786fee avcodec/vvcdec: refact, remove emulated_edge_dmvr and emulated_edge_bilinear to simplify code 2024-06-08 17:45:55 +08:00
Frank Plowman
d866f49791 lavc/vvc: Reallocate pixel buffers if pixel shift changes
Allocations in the following lines depend on the pixel shift, and so
these buffers must be reallocated if the pixel shift changes.  Patch
fixes segmentation faults in fuzzed bitstreams.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-04 20:13:47 +08:00
Michael Niedermayer
2e5433dc12
avcodec/vvc/mvs: Initialize mvf
This might not be needed for correctness but it could
help general reproducability of issues

Related to: CID1560037 Uninitialized scalar variable
Related to: CID1560044 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-02 22:29:22 +02:00
Frank Plowman
49c3918c1a lavc/vvc: Validate temporal MVP references
Per VVCv3 p. 157, the collocated reference picture used in temporal
motion vector prediction must have RprConstraintsActiveFlag equal to
zero and the same CTU size as the current picture.  Add these checks,
fixing crashes decoding some fuzzed bitstreams.

Additionally, only set up the collocated reference picture if it is
actually going to be used (i.e. if ph_temporal_mvp_enabled_flag is 1),
else legal RPR bitstreams will fail the new checks.

Co-authored-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-05-27 20:24:21 +08:00
Nuo Mi
1b33c9a50a avcodec/vvcdec: support Reference Picture Resampling
passed clips:
    RPR_A_Alibaba_4.bit
    RPR_B_Alibaba_3.bit
    RPR_C_Alibaba_3.bit
    RPR_D_Qualcomm_1.bit
    VVC_HDR_UHDTV1_OpenGOP_Max3840x2160_50fps_HLG10_res_change_with_RPR.ts
2024-05-21 20:20:25 +08:00
Nuo Mi
cae0b01282 avcodec/vvcdec: increase edge_emu_buffer for RPR 2024-05-21 20:20:25 +08:00
Nuo Mi
7904ec2d34 avcodec/vvcdec: refact, remove hf_idx and vf_idx from mc_xxx's param list 2024-05-21 20:20:25 +08:00
Nuo Mi
77d971c348 avcodec/vvcdec: refact out luma_prof from luma_prof_bi 2024-05-21 20:20:25 +08:00
Nuo Mi
ac4575594f avcodec/vvcdec: fix dmvr, bdof, cb_prof for RPR 2024-05-21 20:20:25 +08:00
Nuo Mi
77acd0a0dd avcodec/vvcdec: inter, wait reference with a different resolution
For RPR, the current frame may reference a frame with a different resolution.
Therefore, we need to consider frame scaling when we wait for reference pixels.
2024-05-21 20:20:25 +08:00
Nuo Mi
deda59a996 avcodec/vvcdec: add RPR dsp 2024-05-21 20:20:25 +08:00
Nuo Mi
e70225e0a8 avcodec/vvcdec: emulated_edge, use reference frame's sps and pps
a preparation for Reference Picture Resampling
2024-05-21 20:20:25 +08:00
Nuo Mi
aa8d5c6e7e avcodec/vvcdec: add vvc inter filters for RPR 2024-05-21 20:20:25 +08:00
Nuo Mi
08ad51ece6 avcodec/vvcdec: refact, pred_get_refs return VVCRefPic instead of VVCFrame 2024-05-21 20:20:25 +08:00
Nuo Mi
66c6bee061 avcodec/vvcdec: refact out VVCRefPic from RefPicList 2024-05-21 20:20:25 +08:00
Nuo Mi
44bbafb69f avcodec/vvcdec: refact, unify pred_regular_{luma, chroma} to pred_regular 2024-05-21 20:20:25 +08:00
Nuo Mi
875fa9692c avcodec/vvcdec: misc, remove unused EMULATED_EDGE_{LUMA, CHROMA}, EMULATED_EDGE_DMVR_{LUAM, CHROMA} 2024-05-21 20:20:25 +08:00
Nuo Mi
84a93d91d1 avcodec/vvcdec: refact, unify {luma, chroma}_mc_bi to mc_bi 2024-05-21 20:20:25 +08:00
Nuo Mi
6769fe1614 avcodec/vvcdec: refact, unify {luma, chroma}_mc_uni to mc_uni 2024-05-21 20:20:25 +08:00
Nuo Mi
bc099afc8d avcodec/vvcdec: refact, unify {luma, chroma}_mc to mc 2024-05-21 20:20:25 +08:00
Nuo Mi
1289da9244 avcodec/vvcdec: misc, inter, use is_chroma instead of is_luma 2024-05-21 20:20:25 +08:00