FFmpeg: libavcodec/vvc/ps.h Source File
Go to the documentation of this file. 1 /*
2 * VVC parameter set parser
3 *
4 * Copyright (C) 2023 Nuo Mi
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef AVCODEC_VVC_PS_H
24 #define AVCODEC_VVC_PS_H
25
28
29 #define IS_IDR(s) ((s)->vcl_unit_type == VVC_IDR_W_RADL || (s)->vcl_unit_type == VVC_IDR_N_LP)
30 #define IS_CRA(s) ((s)->vcl_unit_type == VVC_CRA_NUT)
31 #define IS_IRAP(s) (IS_IDR(s) || IS_CRA(s))
32 #define IS_GDR(s) ((s)->vcl_unit_type == VVC_GDR_NUT)
33 #define IS_CVSS(s) (IS_IRAP(s)|| IS_GDR(s))
34 #define IS_CLVSS(s) (IS_CVSS(s) && s->no_output_before_recovery_flag)
35 #define IS_RASL(s) ((s)->vcl_unit_type == VVC_RASL_NUT)
36 #define IS_RADL(s) ((s)->vcl_unit_type == VVC_RADL_NUT)
37
38 #define IS_I(rsh) ((rsh)->sh_slice_type == VVC_SLICE_TYPE_I)
39 #define IS_P(rsh) ((rsh)->sh_slice_type == VVC_SLICE_TYPE_P)
40 #define IS_B(rsh) ((rsh)->sh_slice_type == VVC_SLICE_TYPE_B)
41
42 #define INV_POC INT_MIN
43 #define GDR_IS_RECOVERED(s) (s->gdr_recovery_point_poc == INV_POC)
44 #define GDR_SET_RECOVERED(s) (s->gdr_recovery_point_poc = INV_POC)
45
46 #define LMCS_MAX_BIT_DEPTH 12
47 #define LMCS_MAX_LUT_SIZE (1 << LMCS_MAX_BIT_DEPTH)
48 #define LMCS_MAX_BIN_SIZE 16
49 #define LADF_MAX_INTERVAL 5
50
51 enum {
56 };
57
60
61 //derived values
65
68
86
91
94
95 //derived value;
96 int8_t
chroma_qp_offset[3];
///< pps_cb_qp_offset, pps_cr_qp_offset, pps_joint_cbcr_qp_offset_value
97 int8_t
chroma_qp_offset_list[6][3];
///< pps_cb_qp_offset_list, pps_cr_qp_offset_list, pps_joint_cbcr_qp_offset_list
98
101
104
107
111
116
122
127
129
135
136 #define MAX_WEIGHTS 15
138 uint8_t
log2_denom[2];
///< luma_log2_weight_denom, ChromaLog2WeightDenom
139
142 ///< luma_weight_l1_flag, chroma_weight_l1_flag,
146
149 void *
rref;
///< RefStruct reference, backing ph above
150
151 //derived values
154
159
162
163 #define ALF_NUM_FILTERS_LUMA 25
164 #define ALF_NUM_FILTERS_CHROMA 8
165 #define ALF_NUM_FILTERS_CC 4
166
167 #define ALF_NUM_COEFF_LUMA 12
168 #define ALF_NUM_COEFF_CHROMA 6
169 #define ALF_NUM_COEFF_CC 7
170
175
179
180 uint8_t
num_cc_filters[2];
///< alf_cc_cb_filters_signalled_minus1 + 1, alf_cc_cr_filters_signalled_minus1 + 1
183
184 enum {
192 };
193
194 #define SL_MAX_MATRIX_SIZE 8
195
200
204
205 union {
209
213
214 #define VVC_MAX_ALF_COUNT 8
215 #define VVC_MAX_LMCS_COUNT 4
216 #define VVC_MAX_SL_COUNT 8
217
224
225 // Bit field of SPS IDs used in the current CVS
228
237
240
241 // derived values
242 // ctu address
245
246 // inter
249
250 // qp_y
252
253 // deblock_offsets
255
256 // partition constrains
263
264 // entries
267
270
276
277 #endif /* AVCODEC_VVC_PS_H */
uint8_t num_hor_vbs
NumHorVirtualBoundaries.
uint8_t weight_flag[2][2][MAX_WEIGHTS]
luma_weight_l0_flag, chroma_weight_l0_flag, luma_weight_l1_flag, chroma_weight_l1_flag,
uint8_t cu_qp_delta_subdiv
CuQpDeltaSubdiv.
uint32_t num_ctus_in_curr_slice
NumCtusInCurrSlice.
AVPixelFormat
Pixel format.
uint8_t log2_transform_range
Log2TransformRange.
int ff_vvc_decode_frame_ps(struct VVCFrameContext *fc, struct VVCContext *s)
uint32_t entry_point_start_ctu[VVC_MAX_ENTRY_POINTS]
entry point start in ctu_addr
const H266RawPPS * r
RefStruct reference.
#define SL_MAX_MATRIX_SIZE
int8_t chroma_qp_table[3][VVC_MAX_POINTS_IN_QP_TABLE]
ChromaQpTable.
int ff_vvc_decode_aps(VVCParamSets *ps, const CodedBitstreamUnit *unit)
uint8_t cu_chroma_qp_offset_subdiv
CuChromaQpOffsetSubdiv.
#define LMCS_MAX_BIN_SIZE
const H266RawSliceHeader * r
RefStruct reference.
uint16_t vb_pos_x[VVC_MAX_VBS]
VirtualBoundaryPosX.
int16_t offset[2][VVC_MAX_SAMPLE_ARRAYS][MAX_WEIGHTS]
luma_offset_l0, luma_offset_l1, ChromaOffsetL0, ChromaOffsetL1
#define VVC_MAX_LMCS_COUNT
uint8_t num_chroma_filters
Coded bitstream unit structure.
uint8_t qp_bd_offset
QpBdOffset.
uint16_t vb_pos_y[VVC_MAX_VBS]
VirtualBoundaryPosY.
uint16_t chroma_scale_coeff[LMCS_MAX_BIN_SIZE]
uint16_t subpic_x[VVC_MAX_SLICES]
SubpicLeftBoundaryPos.
uint16_t subpic_y[VVC_MAX_SLICES]
SubpicTopBoundaryPos.
const VVCSPS * sps
RefStruct reference.
#define ALF_NUM_COEFF_CHROMA
uint16_t num_ctus_in_slice[VVC_MAX_SLICES]
uint8_t log2_denom[2]
luma_log2_weight_denom, ChromaLog2WeightDenom
uint8_t hshift[VVC_MAX_SAMPLE_ARRAYS]
const VVCPPS * pps_list[VVC_MAX_PPS_COUNT]
RefStruct reference.
int16_t cc_coeff[2][ALF_NUM_FILTERS_CC][ALF_NUM_COEFF_CC]
uint8_t max_num_merge_cand
MaxNumMergeCand.
const VVCScalingList * sl
RefStruct reference.
@ VVC_MAX_POINTS_IN_QP_TABLE
uint8_t chroma_clip_idx[ALF_NUM_FILTERS_CHROMA][ALF_NUM_COEFF_CHROMA]
#define VVC_MAX_ALF_COUNT
uint16_t width64
width in 64 pixels
#define LMCS_MAX_LUT_SIZE
uint16_t ref_wraparound_offset
PpsRefWraparoundOffset.
int16_t weight[2][VVC_MAX_SAMPLE_ARRAYS][MAX_WEIGHTS]
LumaWeightL0, LumaWeightL1, ChromaWeightL0, ChromaWeightL1.
#define fc(width, name, range_min, range_max)
uint32_t * ctb_addr_in_slice
CtbAddrInCurrSlice for entire picture.
uint16_t ctb_size_y
CtbSizeY.
uint16_t * ctb_to_row_bd
CtbToTileRowBd.
const VVCSPS * sps_list[VVC_MAX_SPS_COUNT]
RefStruct reference.
uint16_t slice_start_offset[VVC_MAX_SLICES]
uint8_t ctb_log2_size_y
CtbLog2SizeY.
int8_t ref_idx_sym[2]
RefIdxSymL0, RefIdxSymL1.
const VVCALF * alf_list[VVC_MAX_ALF_COUNT]
RefStruct reference.
uint8_t max_tt_size[2]
MaxTtSizeY, MaxTtSizeC.
const VVCScalingList * scaling_list[VVC_MAX_SL_COUNT]
RefStruct reference.
#define ALF_NUM_FILTERS_CC
uint8_t bit_depth
BitDepth.
int8_t chroma_qp_offset_list[6][3]
pps_cb_qp_offset_list, pps_cr_qp_offset_list, pps_joint_cbcr_qp_offset_list
const H266RawPictureHeader * r
int16_t luma_coeff[ALF_NUM_FILTERS_LUMA][ALF_NUM_COEFF_LUMA]
const VVCPPS * pps
RefStruct reference.
uint8_t max_mtt_depth[2]
MaxMttDepthY, MaxMttDepthC.
uint8_t max_num_ibc_merge_cand
MaxNumIbcMergeCand.
union VVCLMCS::@334 fwd_lut
int ff_vvc_decode_sh(VVCSH *sh, const VVCFrameParamSets *ps, const CodedBitstreamUnit *unit)
uint8_t num_ver_vbs
NumVerVirtualBoundaries.
uint8_t nb_weights[2]
num_l0_weights, num_l1_weights
uint32_t ladf_interval_lower_bound[LADF_MAX_INTERVAL]
SpsLadfIntervalLowerBound[].
#define LADF_MAX_INTERVAL
const uint32_t * ctb_addr_in_curr_slice
CtbAddrInCurrSlice.
uint8_t scaling_matrix_dc_rec[SL_MAX_ID - SL_START_16x16]
ScalingMatrixDcRec[refId − 14].
uint8_t log2_parallel_merge_level
sps_log2_parallel_merge_level_minus2 + 2;
int8_t chroma_qp_offset[3]
pps_cb_qp_offset, pps_cr_qp_offset, pps_joint_cbcr_qp_offset_value
enum AVPixelFormat pix_fmt
uint32_t max_num_subblock_merge_cand
MaxNumSubblockMergeCand.
uint16_t pivot[LMCS_MAX_BIN_SIZE+1]
uint8_t vshift[VVC_MAX_SAMPLE_ARRAYS]
uint16_t width32
width in 32 pixels
void * rref
RefStruct reference, backing ph above.
uint16_t subpic_height[VVC_MAX_SLICES]
int32_t poc
PicOrderCntVal.
uint16_t u16[LMCS_MAX_LUT_SIZE]
for high bit-depth
uint8_t num_ladf_intervals
sps_num_ladf_intervals_minus2 + 2;
uint8_t max_num_gpm_merge_cand
MaxNumGpmMergeCand.
uint8_t min_cb_log2_size_y
MinCbLog2SizeY.
void ff_vvc_ps_uninit(VVCParamSets *ps)
#define ALF_NUM_COEFF_LUMA
uint16_t subpic_width[VVC_MAX_SLICES]
uint16_t height32
height in 32 pixels
uint16_t * row_bd
TileRowBdVal.
const VVCALF * alf_list[VVC_MAX_ALF_COUNT]
RefStruct reference.
int8_t slice_qp_y
SliceQpY.
uint8_t max_tb_size_y
MaxTbSizeY.
uint16_t * col_bd
TileColBdVal.
uint8_t u8[LMCS_MAX_LUT_SIZE]
void ff_vvc_frame_ps_free(VVCFrameParamSets *fps)
union VVCLMCS::@334 inv_lut
uint8_t luma_clip_idx[ALF_NUM_FILTERS_LUMA][ALF_NUM_COEFF_LUMA]
uint8_t max_bt_size[2]
MaxBtSizeY, MaxBtSizeC.
const H266RawSPS * r
RefStruct reference.
uint8_t num_cc_filters[2]
alf_cc_cb_filters_signalled_minus1 + 1, alf_cc_cr_filters_signalled_minus1 + 1
#define ALF_NUM_FILTERS_LUMA
uint16_t * ctb_to_col_bd
CtbToTileColBd.
uint8_t min_qt_size[2]
MinQtSizeY, MinQtSizeC.
uint16_t height64
height in 64 pixels
uint32_t max_pic_order_cnt_lsb
MaxPicOrderCntLsb.
uint8_t min_cb_size_y
MinCbSizeY.
uint8_t max_ts_size
MaxTsSize.
int16_t chroma_coeff[ALF_NUM_FILTERS_CHROMA][ALF_NUM_COEFF_CHROMA]
#define ALF_NUM_FILTERS_CHROMA
const H266RawAPS * lmcs_list[VVC_MAX_LMCS_COUNT]
RefStruct reference.
uint8_t scaling_matrix_rec[SL_MAX_ID][SL_MAX_MATRIX_SIZE *SL_MAX_MATRIX_SIZE]
ScalingMatrixRec.
Generated on Tue Nov 18 2025 19:22:15 for FFmpeg by
doxygen
1.8.17