FFmpeg
vvc_ctu.h
Go to the documentation of this file.
1 /*
2  * VVC CTU(Coding Tree Unit) parser
3  *
4  * Copyright (C) 2022 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_VVC_CTU_H
24 #define AVCODEC_VVC_VVC_CTU_H
25 
26 #include "libavcodec/cabac.h"
27 #include "libavutil/mem_internal.h"
28 
29 #include "vvcdec.h"
30 
31 #define MAX_CTU_SIZE 128
32 
33 #define MAX_CU_SIZE MAX_CTU_SIZE
34 #define MIN_CU_SIZE 4
35 #define MIN_CU_LOG2 2
36 #define MAX_CU_DEPTH 7
37 
38 #define MAX_PARTS_IN_CTU ((MAX_CTU_SIZE >> MIN_CU_LOG2) * (MAX_CTU_SIZE >> MIN_CU_LOG2))
39 
40 #define MIN_PU_SIZE 4
41 
42 #define MAX_TB_SIZE 64
43 #define MIN_TU_SIZE 4
44 #define MAX_TUS_IN_CU 64
45 
46 #define MAX_QP 63
47 
48 #define MAX_PB_SIZE 128
49 #define EDGE_EMU_BUFFER_STRIDE (MAX_PB_SIZE + 32)
50 
51 #define CHROMA_EXTRA_BEFORE 1
52 #define CHROMA_EXTRA_AFTER 2
53 #define CHROMA_EXTRA 3
54 #define LUMA_EXTRA_BEFORE 3
55 #define LUMA_EXTRA_AFTER 4
56 #define LUMA_EXTRA 7
57 #define BILINEAR_EXTRA_BEFORE 0
58 #define BILINEAR_EXTRA_AFTER 1
59 #define BILINEAR_EXTRA 1
60 
61 #define MAX_CONTROL_POINTS 3
62 
63 #define AFFINE_MIN_BLOCK_SIZE 4
64 
65 #define MRG_MAX_NUM_CANDS 6
66 #define MAX_NUM_HMVP_CANDS 5
67 
68 #define SAO_PADDING_SIZE 1
69 
70 #define ALF_PADDING_SIZE 8
71 #define ALF_BLOCK_SIZE 4
72 
73 #define ALF_BORDER_LUMA 3
74 #define ALF_BORDER_CHROMA 2
75 
76 #define ALF_VB_POS_ABOVE_LUMA 4
77 #define ALF_VB_POS_ABOVE_CHROMA 2
78 
79 #define ALF_GRADIENT_STEP 2
80 #define ALF_GRADIENT_BORDER 2
81 #define ALF_GRADIENT_SIZE ((MAX_CU_SIZE + ALF_GRADIENT_BORDER * 2) / ALF_GRADIENT_STEP)
82 #define ALF_NUM_DIR 4
83 
84 
85 /**
86  * Value of the luma sample at position (x, y) in the 2D array tab.
87  */
88 #define SAMPLE(tab, x, y) ((tab)[(y) * s->pps->width + (x)])
89 #define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
90 #define CTB(tab, x, y) ((tab)[(y) * fc->ps.pps->ctb_width + (x)])
91 
92 enum SAOType {
96 };
97 
98 enum SAOEOClass {
103 };
104 
105 typedef struct NeighbourAvailable {
106  int cand_left;
107  int cand_up;
108  int cand_up_left;
109  int cand_up_right;
110  int cand_up_right_sap;
112 
113 enum IspType{
117 };
118 
119 typedef enum VVCSplitMode {
126 } VVCSplitMode;
127 
128 typedef enum MtsIdx {
134 } MtsIdx;
135 
136 typedef struct TransformBlock {
137  uint8_t has_coeffs;
138  uint8_t c_idx;
139  uint8_t ts; ///< transform_skip_flag
140  int x0;
141  int y0;
142 
143  int tb_width;
147 
152 
153  int qp;
155  int bd_shift;
157 
158  int *coeffs;
160 
161 typedef enum VVCTreeType {
165 } VVCTreeType;
166 
167 typedef struct TransformUnit {
168  int x0;
169  int y0;
170  int width;
171  int height;
172 
173  uint8_t joint_cbcr_residual_flag; ///< tu_joint_cbcr_residual_flag
174 
175  uint8_t coded_flag[VVC_MAX_SAMPLE_ARRAYS]; ///< tu_y_coded_flag, tu_cb_coded_flag, tu_cr_coded_flag
176  uint8_t nb_tbs;
178 
179  struct TransformUnit *next; ///< RefStruct reference
180 } TransformUnit;
181 
182 typedef enum PredMode {
188 } PredMode;
189 
190 typedef struct Mv {
191  int x; ///< horizontal component of motion vector
192  int y; ///< vertical component of motion vector
193 } Mv;
194 
195 typedef struct MvField {
196  DECLARE_ALIGNED(8, Mv, mv)[2]; ///< mvL0, vvL1
197  int8_t ref_idx[2]; ///< refIdxL0, refIdxL1
198  uint8_t hpel_if_idx; ///< hpelIfIdx
199  uint8_t bcw_idx; ///< bcwIdx
200  uint8_t pred_flag;
201  uint8_t ciip_flag; ///< ciip_flag
202 } MvField;
203 
204 typedef struct DMVRInfo {
205  DECLARE_ALIGNED(8, Mv, mv)[2]; ///< mvL0, vvL1
206  uint8_t dmvr_enabled;
207 } DMVRInfo;
208 
209 typedef enum MotionModelIdc {
214 
215 typedef enum PredFlag {
216  PF_INTRA = 0x0,
217  PF_L0 = 0x1,
218  PF_L1 = 0x2,
219  PF_BI = 0x3,
220  PF_IBC = PF_L0 | 0x4,
221 } PredFlag;
222 
223 typedef enum IntraPredMode {
234 } IntraPredMode;
235 
236 typedef struct MotionInfo {
237  MotionModelIdc motion_model_idc; ///< MotionModelIdc
238  int8_t ref_idx[2]; ///< refIdxL0, refIdxL1
239  uint8_t hpel_if_idx; ///< hpelIfIdx
240  uint8_t bcw_idx; ///< bcwIdx
242 
244 
246 } MotionInfo;
247 
248 typedef struct PredictionUnit {
251  //InterPredIdc inter_pred_idc;
253 
254  //subblock predict
256 
257  uint8_t merge_gpm_flag;
260 
262 
264 
265  // for regular prediction only
266  uint8_t dmvr_flag;
267  uint8_t bdof_flag;
268 
271  int cb_prof_flag[2];
273 
274 typedef struct CodingUnit {
276  int x0;
277  int y0;
278  int cb_width;
280  int ch_type;
282 
283  uint8_t coded_flag;
284 
285  uint8_t sbt_flag;
287  uint8_t sbt_pos_flag;
288 
291 
293 
294  uint8_t intra_luma_ref_idx; ///< IntraLumaRefLineIdx[][]
295  uint8_t intra_mip_flag; ///< intra_mip_flag
296  uint8_t skip_flag; ///< cu_skip_flag;
297 
298  //inter
299  uint8_t ciip_flag;
300 
301  // Inferred parameters
302  enum IspType isp_split_type; ///< IntraSubPartitionsSplitType
303 
304  enum PredMode pred_mode; ///< PredMode
305 
307 
308  IntraPredMode intra_pred_mode_y; ///< IntraPredModeY
309  IntraPredMode intra_pred_mode_c; ///< IntraPredModeC
310  int mip_chroma_direct_flag; ///< MipChromaDirectFlag
311 
312  int bdpcm_flag[VVC_MAX_SAMPLE_ARRAYS]; ///< BdpcmFlag
313 
314  int apply_lfnst_flag[VVC_MAX_SAMPLE_ARRAYS]; ///< ApplyLfnstFlag[]
315 
316  struct {
317  TransformUnit *head; ///< RefStruct reference
318  TransformUnit *tail; ///< RefStruct reference
319  } tus;
320 
321  int8_t qp[4]; ///< QpY, Qp′Cb, Qp′Cr, Qp′CbCr
322 
324 
325  struct CodingUnit *next; ///< RefStruct reference
326 } CodingUnit;
327 
328 typedef struct CTU {
331  int max_y_idx[2];
332  int has_dmvr;
333 } CTU;
334 
335 typedef struct ReconstructedArea {
336  int x;
337  int y;
338  int w;
339  int h;
341 
342 typedef struct VVCCabacState {
343  uint16_t state[2];
344  uint8_t shift[2];
345 } VVCCabacState;
346 
347 // VVC_CONTEXTS matched with SYNTAX_ELEMENT_LAST, it's checked by cabac_init_state.
348 #define VVC_CONTEXTS 378
349 typedef struct EntryPoint {
350  int8_t qp_y; ///< QpY
351 
352  int stat_coeff[VVC_MAX_SAMPLE_ARRAYS]; ///< StatCoeff
353 
356 
358  int ctu_end;
359 
360  uint8_t is_first_qg; // first quantization group
361 
362  MvField hmvp[MAX_NUM_HMVP_CANDS]; ///< HmvpCandList
363  int num_hmvp; ///< NumHmvpCand
364  MvField hmvp_ibc[MAX_NUM_HMVP_CANDS]; ///< HmvpIbcCandList
365  int num_hmvp_ibc; ///< NumHmvpIbcCand
366 } EntryPoint;
367 
368 typedef struct VVCLocalContext {
369  uint8_t ctb_left_flag;
370  uint8_t ctb_up_flag;
375 
376  /* +7 is for subpixel interpolation, *2 for high bit depths */
378  /* The extended size between the new edge emu buffer is abused by SAO */
389 
390  struct {
391  int sbt_num_fourths_tb0; ///< SbtNumFourthsTb0
392 
393  uint8_t is_cu_qp_delta_coded; ///< IsCuQpDeltaCoded
394  int cu_qg_top_left_x; ///< CuQgTopLeftX
395  int cu_qg_top_left_y; ///< CuQgTopLeftY
396  int is_cu_chroma_qp_offset_coded; ///< IsCuChromaQpOffsetCoded
397  int chroma_qp_offset[3]; ///< CuQpOffsetCb, CuQpOffsetCr, CuQpOffsetCbCr
398 
399  int infer_tu_cbf_luma; ///< InferTuCbfLuma
400  int prev_tu_cbf_y; ///< prevTuCbfY;
401 
402  int lfnst_dc_only; ///< LfnstDcOnly
403  int lfnst_zero_out_sig_coeff_flag; ///< LfnstZeroOutSigCoeffFlag
404 
405  int mts_dc_only; ///< MtsDcOnly
406  int mts_zero_out_sig_coeff_flag; ///< MtsZeroOutSigCoeffFlag;
407  } parse;
408 
409  struct {
410  // lmcs cache, for recon only
412  int x_vpdu;
413  int y_vpdu;
414  } lmcs;
415 
418  int num_ras[2];
419 
421 
422 #define BOUNDARY_LEFT_SLICE (1 << 0)
423 #define BOUNDARY_LEFT_TILE (1 << 1)
424 #define BOUNDARY_LEFT_SUBPIC (1 << 2)
425 #define BOUNDARY_UPPER_SLICE (1 << 3)
426 #define BOUNDARY_UPPER_TILE (1 << 4)
427 #define BOUNDARY_UPPER_SUBPIC (1 << 5)
428  /* properties of the boundary of the current CTB for the purposes
429  * of the deblocking filter */
431 
435  int *coeffs;
437 
438 typedef struct VVCAllowedSplit {
439  int qt;
440  int btv;
441  int bth;
442  int ttv;
443  int tth;
445 
446 typedef struct SAOParams {
447  int offset_abs[3][4]; ///< sao_offset_abs
448  int offset_sign[3][4]; ///< sao_offset_sign
449 
450  uint8_t band_position[3]; ///< sao_band_position
451 
452  int eo_class[3]; ///< sao_eo_class
453 
454  int16_t offset_val[3][5]; ///< SaoOffsetVal
455 
456  uint8_t type_idx[3]; ///< sao_type_idx
457 } SAOParams;
458 
459 typedef struct ALFParams {
460  uint8_t ctb_flag[3]; ///< alf_ctb_flag[]
461  uint8_t ctb_filt_set_idx_y; ///< AlfCtbFiltSetIdxY
462  uint8_t alf_ctb_filter_alt_idx[2]; ///< alf_ctb_filter_alt_idx[]
463  uint8_t ctb_cc_idc[2]; ///< alf_ctb_cc_cb_idc, alf_ctb_cc_cr_idc
464 
465  uint8_t applied[3];
466 } ALFParams;
467 
468 /**
469  * parse a CTU
470  * @param lc local context for CTU
471  * @param ctb_idx CTB(CTU) address in the current slice
472  * @param rs raster order for the CTU.
473  * @param rx raster order x for the CTU.
474  * @param ry raster order y for the CTU.
475  * @return AVERROR
476  */
477 int ff_vvc_coding_tree_unit(VVCLocalContext *lc, int ctu_idx, int rs, int rx, int ry);
478 
479 //utils
480 void ff_vvc_set_neighbour_available(VVCLocalContext *lc, int x0, int y0, int w, int h);
481 void ff_vvc_decode_neighbour(VVCLocalContext *lc, int x_ctb, int y_ctb, int rx, int ry, int rs);
482 void ff_vvc_ctu_free_cus(CTU *ctu);
483 int ff_vvc_get_qPy(const VVCFrameContext *fc, int xc, int yc);
484 void ff_vvc_ep_init_stat_coeff(EntryPoint *ep, int bit_depth, int persistent_rice_adaptation_enabled_flag);
485 
486 #endif // AVCODEC_VVC_VVC_CTU_H
MODE_INTER
@ MODE_INTER
Definition: vvc_ctu.h:183
ALFParams::applied
uint8_t applied[3]
Definition: vvc_ctu.h:465
VVCCabacState
Definition: vvc_ctu.h:342
IntraPredMode
IntraPredMode
Definition: vvc_ctu.h:223
SAO_EO_135D
@ SAO_EO_135D
Definition: vvc_ctu.h:101
SAO_EO_VERT
@ SAO_EO_VERT
Definition: vvc_ctu.h:100
DMVRInfo
Definition: vvc_ctu.h:204
cabac.h
MtsIdx
MtsIdx
Definition: vvc_ctu.h:128
VVCLocalContext::mts_zero_out_sig_coeff_flag
int mts_zero_out_sig_coeff_flag
MtsZeroOutSigCoeffFlag;.
Definition: vvc_ctu.h:406
TransformBlock::tb_width
int tb_width
Definition: vvc_ctu.h:143
mem_internal.h
MotionInfo::mv
Mv mv[2][MAX_CONTROL_POINTS]
Definition: vvc_ctu.h:243
CTU::max_y_idx
int max_y_idx[2]
Definition: vvc_ctu.h:331
MotionInfo
Definition: vvc_ctu.h:236
TransformUnit::height
int height
Definition: vvc_ctu.h:171
ReconstructedArea::h
int h
Definition: vvc_ctu.h:339
SPLIT_NONE
@ SPLIT_NONE
Definition: vvc_ctu.h:120
MAX_CTU_SIZE
#define MAX_CTU_SIZE
Definition: vvc_ctu.h:31
SAO_NOT_APPLIED
@ SAO_NOT_APPLIED
Definition: vvc_ctu.h:93
SPLIT_TT_VER
@ SPLIT_TT_VER
Definition: vvc_ctu.h:123
CodingUnit
Definition: hevcdec.h:282
CodingUnit::act_enabled_flag
uint8_t act_enabled_flag
Definition: vvc_ctu.h:292
VVCLocalContext::alf_buffer_chroma
uint8_t alf_buffer_chroma[(MAX_CTU_SIZE+2 *ALF_PADDING_SIZE) *EDGE_EMU_BUFFER_STRIDE *2]
Definition: vvc_ctu.h:387
PredictionUnit::gpm_partition_idx
uint8_t gpm_partition_idx
Definition: vvc_ctu.h:258
CodingUnit::head
TransformUnit * head
RefStruct reference.
Definition: vvc_ctu.h:317
VVCLocalContext::tmp
int16_t tmp[MAX_PB_SIZE *MAX_PB_SIZE]
Definition: vvc_ctu.h:380
TransformUnit::nb_tbs
uint8_t nb_tbs
Definition: vvc_ctu.h:176
CodingUnit::bdpcm_flag
int bdpcm_flag[VVC_MAX_SAMPLE_ARRAYS]
BdpcmFlag.
Definition: vvc_ctu.h:312
TransformBlock::min_scan_y
int min_scan_y
Definition: vvc_ctu.h:151
w
uint8_t w
Definition: llviddspenc.c:38
VVCCabacState::state
uint16_t state[2]
Definition: vvc_ctu.h:343
VVCLocalContext::mts_dc_only
int mts_dc_only
MtsDcOnly.
Definition: vvc_ctu.h:405
NeighbourAvailable::cand_left
int cand_left
Definition: hevcdec.h:308
CodingUnit::intra_mip_flag
uint8_t intra_mip_flag
intra_mip_flag
Definition: vvc_ctu.h:295
NeighbourAvailable::cand_up
int cand_up
Definition: hevcdec.h:309
VVCLocalContext::sc
SliceContext * sc
Definition: vvc_ctu.h:432
SAOParams::offset_sign
int offset_sign[3][4]
sao_offset_sign
Definition: hevcdsp.h:36
NeighbourAvailable::cand_up_right
int cand_up_right
Definition: hevcdec.h:311
ff_vvc_get_qPy
int ff_vvc_get_qPy(const VVCFrameContext *fc, int xc, int yc)
Definition: vvc_ctu.c:2542
TransformUnit::x0
int x0
Definition: vvc_ctu.h:168
INTRA_L_CCLM
@ INTRA_L_CCLM
Definition: vvc_ctu.h:232
MTS_DST7_DCT8
@ MTS_DST7_DCT8
Definition: vvc_ctu.h:131
INTRA_DIAG
@ INTRA_DIAG
Definition: vvc_ctu.h:228
VVCLocalContext::edge_emu_buffer2
uint8_t edge_emu_buffer2[(MAX_PB_SIZE+7) *EDGE_EMU_BUFFER_STRIDE *2]
Definition: vvc_ctu.h:379
IspType
IspType
Definition: vvc_ctu.h:113
fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:464
TransformBlock::min_scan_x
int min_scan_x
Definition: vvc_ctu.h:150
SAO_EDGE
@ SAO_EDGE
Definition: vvc_ctu.h:95
ReconstructedArea
Definition: vvc_ctu.h:335
ALF_NUM_DIR
#define ALF_NUM_DIR
Definition: vvc_ctu.h:82
TransformBlock::max_scan_y
int max_scan_y
Definition: vvc_ctu.h:149
bit_depth
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition: af_astats.c:246
VVCLocalContext::ras
ReconstructedArea ras[2][MAX_PARTS_IN_CTU]
Definition: vvc_ctu.h:417
VVCLocalContext::ctb_up_right_flag
uint8_t ctb_up_right_flag
Definition: vvc_ctu.h:371
VVCLocalContext::coeffs
int * coeffs
Definition: vvc_ctu.h:435
VVCLocalContext::lfnst_zero_out_sig_coeff_flag
int lfnst_zero_out_sig_coeff_flag
LfnstZeroOutSigCoeffFlag.
Definition: vvc_ctu.h:403
TransformBlock::max_scan_x
int max_scan_x
Definition: vvc_ctu.h:148
Mv::y
int y
vertical component of motion vector
Definition: vvc_ctu.h:192
VVCAllowedSplit::btv
int btv
Definition: vvc_ctu.h:440
MTS_DCT8_DST7
@ MTS_DCT8_DST7
Definition: vvc_ctu.h:132
VVCLocalContext::lfnst_dc_only
int lfnst_dc_only
LfnstDcOnly.
Definition: vvc_ctu.h:402
SAOType
SAOType
Definition: hevcdec.h:157
VVCTreeType
VVCTreeType
Definition: vvc_ctu.h:161
CodingUnit::ch_type
int ch_type
Definition: vvc_ctu.h:280
ff_vvc_decode_neighbour
void ff_vvc_decode_neighbour(VVCLocalContext *lc, int x_ctb, int y_ctb, int rx, int ry, int rs)
Definition: vvc_ctu.c:2474
PredictionUnit::gpm_mv
MvField gpm_mv[2]
Definition: vvc_ctu.h:259
VVCLocalContext::sao_buffer
uint8_t sao_buffer[(MAX_CTU_SIZE+2 *SAO_PADDING_SIZE) *EDGE_EMU_BUFFER_STRIDE *2]
Definition: vvc_ctu.h:385
MTS_DST7_DST7
@ MTS_DST7_DST7
Definition: vvc_ctu.h:130
VVCLocalContext::fc
VVCFrameContext * fc
Definition: vvc_ctu.h:433
PredictionUnit
Definition: hevcdec.h:315
EntryPoint::stat_coeff
int stat_coeff[VVC_MAX_SAMPLE_ARRAYS]
StatCoeff.
Definition: vvc_ctu.h:352
INTRA_DC
@ INTRA_DC
Definition: vvc_ctu.h:226
CodingUnit::apply_lfnst_flag
int apply_lfnst_flag[VVC_MAX_SAMPLE_ARRAYS]
ApplyLfnstFlag[].
Definition: vvc_ctu.h:314
VVCLocalContext::tmp1
int16_t tmp1[MAX_PB_SIZE *MAX_PB_SIZE]
Definition: vvc_ctu.h:381
TransformBlock::c_idx
uint8_t c_idx
Definition: vvc_ctu.h:138
CodingUnit::sbt_pos_flag
uint8_t sbt_pos_flag
Definition: vvc_ctu.h:287
VVCLocalContext::ctb_up_left_flag
uint8_t ctb_up_left_flag
Definition: vvc_ctu.h:372
TransformBlock::x0
int x0
Definition: vvc_ctu.h:140
MotionModelIdc
MotionModelIdc
Definition: vvc_ctu.h:209
CodingUnit::cb_width
int cb_width
Definition: vvc_ctu.h:278
CodingUnit::pu
PredictionUnit pu
Definition: vvc_ctu.h:323
SINGLE_TREE
@ SINGLE_TREE
Definition: vvc_ctu.h:162
PF_BI
@ PF_BI
Definition: vvc_ctu.h:219
EntryPoint::cabac_state
VVCCabacState cabac_state[VVC_CONTEXTS]
Definition: vvc_ctu.h:354
INTRA_VDIAG
@ INTRA_VDIAG
Definition: vvc_ctu.h:230
TransformBlock::y0
int y0
Definition: vvc_ctu.h:141
TransformUnit::next
struct TransformUnit * next
RefStruct reference.
Definition: vvc_ctu.h:179
INTRA_HORZ
@ INTRA_HORZ
Definition: vvc_ctu.h:227
SPLIT_TT_HOR
@ SPLIT_TT_HOR
Definition: vvc_ctu.h:121
ReconstructedArea::x
int x
Definition: vvc_ctu.h:336
MODE_INTRA
@ MODE_INTRA
Definition: vvc_ctu.h:184
CodingUnit::cqt_depth
int cqt_depth
Definition: vvc_ctu.h:281
ALF_PADDING_SIZE
#define ALF_PADDING_SIZE
Definition: vvc_ctu.h:70
ISP_NO_SPLIT
@ ISP_NO_SPLIT
Definition: vvc_ctu.h:114
CodingUnit::tree_type
VVCTreeType tree_type
Definition: vvc_ctu.h:275
MAX_PB_SIZE
#define MAX_PB_SIZE
Definition: vvc_ctu.h:48
PredictionUnit::bdof_flag
uint8_t bdof_flag
Definition: vvc_ctu.h:267
vvcdec.h
CodingUnit::mts_idx
MtsIdx mts_idx
Definition: vvc_ctu.h:290
TransformUnit::coded_flag
uint8_t coded_flag[VVC_MAX_SAMPLE_ARRAYS]
tu_y_coded_flag, tu_cb_coded_flag, tu_cr_coded_flag
Definition: vvc_ctu.h:175
VVCLocalContext::num_ras
int num_ras[2]
Definition: vvc_ctu.h:418
NeighbourAvailable::cand_up_right_sap
int cand_up_right_sap
Definition: hevcdec.h:312
MAX_NUM_HMVP_CANDS
#define MAX_NUM_HMVP_CANDS
Definition: vvc_ctu.h:66
VVCLocalContext::alf_gradient_tmp
int32_t alf_gradient_tmp[ALF_GRADIENT_SIZE *ALF_GRADIENT_SIZE *ALF_NUM_DIR]
Definition: vvc_ctu.h:388
PF_L0
@ PF_L0
Definition: vvc_ctu.h:217
MOTION_6_PARAMS_AFFINE
@ MOTION_6_PARAMS_AFFINE
Definition: vvc_ctu.h:212
MAX_CONTROL_POINTS
#define MAX_CONTROL_POINTS
Definition: vvc_ctu.h:61
CTU
Definition: vvc_ctu.h:328
EntryPoint::is_first_qg
uint8_t is_first_qg
Definition: vvc_ctu.h:360
VVCLocalContext::alf_buffer_luma
uint8_t alf_buffer_luma[(MAX_CTU_SIZE+2 *ALF_PADDING_SIZE) *EDGE_EMU_BUFFER_STRIDE *2]
Definition: vvc_ctu.h:386
CodingUnit::sbt_flag
uint8_t sbt_flag
Definition: vvc_ctu.h:285
EDGE_EMU_BUFFER_STRIDE
#define EDGE_EMU_BUFFER_STRIDE
Definition: vvc_ctu.h:49
SAOParams::offset_abs
int offset_abs[3][4]
sao_offset_abs
Definition: hevcdsp.h:35
ISP_VER_SPLIT
@ ISP_VER_SPLIT
Definition: vvc_ctu.h:116
TransformBlock::rect_non_ts_flag
int rect_non_ts_flag
Definition: vvc_ctu.h:154
VVCLocalContext
Definition: vvc_ctu.h:368
MvField::pred_flag
uint8_t pred_flag
Definition: vvc_ctu.h:200
PredFlag
PredFlag
Definition: vvc_ctu.h:215
SPLIT_QT
@ SPLIT_QT
Definition: vvc_ctu.h:125
MOTION_TRANSLATION
@ MOTION_TRANSLATION
Definition: vvc_ctu.h:210
EntryPoint::qp_y
int8_t qp_y
QpY.
Definition: vvc_ctu.h:350
VVCLocalContext::parse
struct VVCLocalContext::@222 parse
TransformBlock::log2_tb_width
int log2_tb_width
Definition: vvc_ctu.h:145
CodingUnit::intra_luma_ref_idx
uint8_t intra_luma_ref_idx
IntraLumaRefLineIdx[][].
Definition: vvc_ctu.h:294
MotionInfo::motion_model_idc
MotionModelIdc motion_model_idc
MotionModelIdc.
Definition: vvc_ctu.h:237
MvField::ciip_flag
uint8_t ciip_flag
ciip_flag
Definition: vvc_ctu.h:201
VVCSplitMode
VVCSplitMode
Definition: vvc_ctu.h:119
MotionInfo::num_sb_y
int num_sb_y
Definition: vvc_ctu.h:245
MODE_SKIP
@ MODE_SKIP
Definition: vvc_ctu.h:185
TransformUnit
Definition: hevcdec.h:325
VVCAllowedSplit::bth
int bth
Definition: vvc_ctu.h:441
SliceContext
Definition: mss12.h:70
SAOParams::offset_val
int16_t offset_val[3][5]
SaoOffsetVal.
Definition: hevcdsp.h:42
PredictionUnit::mmvd_merge_flag
uint8_t mmvd_merge_flag
Definition: vvc_ctu.h:250
TransformBlock::bd_offset
int bd_offset
Definition: vvc_ctu.h:156
DUAL_TREE_CHROMA
@ DUAL_TREE_CHROMA
Definition: vvc_ctu.h:164
VVCAllowedSplit::qt
int qt
Definition: vvc_ctu.h:439
TransformBlock::tb_height
int tb_height
Definition: vvc_ctu.h:144
EntryPoint::num_hmvp_ibc
int num_hmvp_ibc
NumHmvpIbcCand.
Definition: vvc_ctu.h:365
TransformBlock::ts
uint8_t ts
transform_skip_flag
Definition: vvc_ctu.h:139
CodingUnit::intra_pred_mode_y
IntraPredMode intra_pred_mode_y
IntraPredModeY.
Definition: vvc_ctu.h:308
ff_vvc_coding_tree_unit
int ff_vvc_coding_tree_unit(VVCLocalContext *lc, int ctu_idx, int rs, int rx, int ry)
parse a CTU
Definition: vvc_ctu.c:2443
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
DMVRInfo::dmvr_enabled
uint8_t dmvr_enabled
Definition: vvc_ctu.h:206
MotionInfo::hpel_if_idx
uint8_t hpel_if_idx
hpelIfIdx
Definition: vvc_ctu.h:239
AFFINE_MIN_BLOCK_SIZE
#define AFFINE_MIN_BLOCK_SIZE
Definition: vvc_ctu.h:63
EntryPoint::cc
CABACContext cc
Definition: vvc_ctu.h:355
PF_L1
@ PF_L1
Definition: vvc_ctu.h:218
EntryPoint::ctu_end
int ctu_end
Definition: vvc_ctu.h:358
PredictionUnit::merge_gpm_flag
uint8_t merge_gpm_flag
Definition: vvc_ctu.h:257
PredictionUnit::cb_prof_flag
int cb_prof_flag[2]
Definition: vvc_ctu.h:271
SPLIT_BT_VER
@ SPLIT_BT_VER
Definition: vvc_ctu.h:124
CodingUnit::sbt_horizontal_flag
uint8_t sbt_horizontal_flag
Definition: vvc_ctu.h:286
VVCLocalContext::infer_tu_cbf_luma
int infer_tu_cbf_luma
InferTuCbfLuma.
Definition: vvc_ctu.h:399
MvField
Definition: hevcdec.h:300
VVCLocalContext::end_of_tiles_x
int end_of_tiles_x
Definition: vvc_ctu.h:373
CodingUnit::coded_flag
uint8_t coded_flag
Definition: vvc_ctu.h:283
VVCLocalContext::ctb_up_flag
uint8_t ctb_up_flag
Definition: vvc_ctu.h:370
PredictionUnit::diff_mv_x
int16_t diff_mv_x[2][AFFINE_MIN_BLOCK_SIZE *AFFINE_MIN_BLOCK_SIZE]
diffMvLX
Definition: vvc_ctu.h:269
VVCLocalContext::edge_emu_buffer
uint8_t edge_emu_buffer[(MAX_PB_SIZE+7) *EDGE_EMU_BUFFER_STRIDE *2]
Definition: vvc_ctu.h:377
CTU::has_dmvr
int has_dmvr
Definition: vvc_ctu.h:332
CodingUnit::lfnst_idx
int lfnst_idx
Definition: vvc_ctu.h:289
INTRA_VERT
@ INTRA_VERT
Definition: vvc_ctu.h:229
VVCLocalContext::na
NeighbourAvailable na
Definition: vvc_ctu.h:420
CodingUnit::intra_pred_mode_c
IntraPredMode intra_pred_mode_c
IntraPredModeC.
Definition: vvc_ctu.h:309
DUAL_TREE_LUMA
@ DUAL_TREE_LUMA
Definition: vvc_ctu.h:163
MvField::hpel_if_idx
uint8_t hpel_if_idx
hpelIfIdx
Definition: vvc_ctu.h:198
SAOParams::eo_class
int eo_class[3]
sao_eo_class
Definition: hevcdsp.h:40
PredMode
PredMode
Definition: vvc_ctu.h:182
ALFParams::ctb_cc_idc
uint8_t ctb_cc_idc[2]
alf_ctb_cc_cb_idc, alf_ctb_cc_cr_idc
Definition: vvc_ctu.h:463
VVCAllowedSplit::tth
int tth
Definition: vvc_ctu.h:443
VVCAllowedSplit::ttv
int ttv
Definition: vvc_ctu.h:442
CTU::max_y
int max_y[2][VVC_MAX_REF_ENTRIES]
Definition: vvc_ctu.h:330
VVCLocalContext::boundary_flags
int boundary_flags
Definition: vvc_ctu.h:430
PredictionUnit::mi
MotionInfo mi
Definition: vvc_ctu.h:263
Mv::x
int x
horizontal component of motion vector
Definition: vvc_ctu.h:191
VVCAllowedSplit
Definition: vvc_ctu.h:438
EntryPoint::hmvp
MvField hmvp[MAX_NUM_HMVP_CANDS]
HmvpCandList.
Definition: vvc_ctu.h:362
MODE_IBC
@ MODE_IBC
Definition: vvc_ctu.h:187
NeighbourAvailable::cand_up_left
int cand_up_left
Definition: hevcdec.h:310
VVC_MAX_REF_ENTRIES
@ VVC_MAX_REF_ENTRIES
Definition: vvc.h:115
INTRA_PLANAR
@ INTRA_PLANAR
Definition: vvc_ctu.h:225
VVCLocalContext::ciip_tmp2
uint8_t ciip_tmp2[MAX_PB_SIZE *MAX_PB_SIZE *2]
Definition: vvc_ctu.h:384
SAO_BAND
@ SAO_BAND
Definition: vvc_ctu.h:94
INTRA_T_CCLM
@ INTRA_T_CCLM
Definition: vvc_ctu.h:233
VVCLocalContext::prev_tu_cbf_y
int prev_tu_cbf_y
prevTuCbfY;
Definition: vvc_ctu.h:400
VVCLocalContext::cu_qg_top_left_x
int cu_qg_top_left_x
CuQgTopLeftX.
Definition: vvc_ctu.h:394
CodingUnit::x0
int x0
Definition: vvc_ctu.h:276
TransformUnit::tbs
TransformBlock tbs[VVC_MAX_SAMPLE_ARRAYS]
Definition: vvc_ctu.h:177
MTS_DCT2_DCT2
@ MTS_DCT2_DCT2
Definition: vvc_ctu.h:129
SAO_EO_45D
@ SAO_EO_45D
Definition: vvc_ctu.h:102
DMVRInfo::mv
Mv mv[2]
mvL0, vvL1
Definition: vvc_ctu.h:205
EntryPoint
Definition: vvc_ctu.h:349
ALF_GRADIENT_SIZE
#define ALF_GRADIENT_SIZE
Definition: vvc_ctu.h:81
TransformBlock::coeffs
int * coeffs
Definition: vvc_ctu.h:158
TransformBlock::bd_shift
int bd_shift
Definition: vvc_ctu.h:155
TransformUnit::width
int width
Definition: vvc_ctu.h:170
SAOEOClass
SAOEOClass
Definition: hevcdec.h:164
MTS_DCT8_DCT8
@ MTS_DCT8_DCT8
Definition: vvc_ctu.h:133
SAOParams
Definition: hevcdsp.h:34
VVCLocalContext::cu
CodingUnit * cu
Definition: vvc_ctu.h:416
MotionInfo::bcw_idx
uint8_t bcw_idx
bcwIdx
Definition: vvc_ctu.h:240
PredictionUnit::dmvr_flag
uint8_t dmvr_flag
Definition: vvc_ctu.h:266
VVCLocalContext::chroma_qp_offset
int chroma_qp_offset[3]
CuQpOffsetCb, CuQpOffsetCr, CuQpOffsetCbCr.
Definition: vvc_ctu.h:397
NeighbourAvailable
Definition: hevcdec.h:306
IntraPredMode
IntraPredMode
Definition: hevcdec.h:119
VVCLocalContext::sbt_num_fourths_tb0
int sbt_num_fourths_tb0
SbtNumFourthsTb0.
Definition: vvc_ctu.h:391
ALFParams::alf_ctb_filter_alt_idx
uint8_t alf_ctb_filter_alt_idx[2]
alf_ctb_filter_alt_idx[]
Definition: vvc_ctu.h:462
MAX_PARTS_IN_CTU
#define MAX_PARTS_IN_CTU
Definition: vvc_ctu.h:38
PredictionUnit::inter_affine_flag
uint8_t inter_affine_flag
Definition: vvc_ctu.h:252
MotionInfo::pred_flag
PredFlag pred_flag
Definition: vvc_ctu.h:241
CodingUnit::cb_height
int cb_height
Definition: vvc_ctu.h:279
TransformBlock::log2_tb_height
int log2_tb_height
Definition: vvc_ctu.h:146
ISP_HOR_SPLIT
@ ISP_HOR_SPLIT
Definition: vvc_ctu.h:115
PF_INTRA
@ PF_INTRA
Definition: vvc_ctu.h:216
CodingUnit::tail
TransformUnit * tail
RefStruct reference.
Definition: vvc_ctu.h:318
TransformBlock::has_coeffs
uint8_t has_coeffs
Definition: vvc_ctu.h:137
SAO_PADDING_SIZE
#define SAO_PADDING_SIZE
Definition: vvc_ctu.h:68
INTRA_LT_CCLM
@ INTRA_LT_CCLM
Definition: vvc_ctu.h:231
PredMode
PredMode
Definition: hevcdec.h:100
MotionInfo::num_sb_x
int num_sb_x
Definition: vvc_ctu.h:245
PredictionUnit::sym_mvd_flag
int sym_mvd_flag
Definition: vvc_ctu.h:261
TransformBlock
Definition: vvc_ctu.h:136
VVCLocalContext::lmcs
struct VVCLocalContext::@223 lmcs
CodingUnit::pred_mode
enum PredMode pred_mode
PredMode.
Definition: hevcdec.h:286
VVCCabacState::shift
uint8_t shift[2]
Definition: vvc_ctu.h:344
VVCLocalContext::tmp2
int16_t tmp2[MAX_PB_SIZE *MAX_PB_SIZE]
Definition: vvc_ctu.h:382
ALFParams::ctb_filt_set_idx_y
uint8_t ctb_filt_set_idx_y
AlfCtbFiltSetIdxY.
Definition: vvc_ctu.h:461
SAOParams::type_idx
uint8_t type_idx[3]
sao_type_idx
Definition: hevcdsp.h:44
VVCLocalContext::ciip_tmp1
uint8_t ciip_tmp1[MAX_PB_SIZE *MAX_PB_SIZE *2]
Definition: vvc_ctu.h:383
SAO_EO_HORIZ
@ SAO_EO_HORIZ
Definition: vvc_ctu.h:99
VVC_CONTEXTS
#define VVC_CONTEXTS
Definition: vvc_ctu.h:348
EntryPoint::num_hmvp
int num_hmvp
NumHmvpCand.
Definition: vvc_ctu.h:363
PredictionUnit::general_merge_flag
uint8_t general_merge_flag
Definition: vvc_ctu.h:249
VVCLocalContext::end_of_tiles_y
int end_of_tiles_y
Definition: vvc_ctu.h:374
TransformUnit::y0
int y0
Definition: vvc_ctu.h:169
PredictionUnit::diff_mv_y
int16_t diff_mv_y[2][AFFINE_MIN_BLOCK_SIZE *AFFINE_MIN_BLOCK_SIZE]
diffMvLX
Definition: vvc_ctu.h:270
CodingUnit::next
struct CodingUnit * next
RefStruct reference.
Definition: vvc_ctu.h:325
MvField::mv
Mv mv[2]
mvL0, vvL1
Definition: hevcdec.h:301
ALFParams
Definition: vvc_ctu.h:459
Mv
Definition: hevcdec.h:295
MOTION_4_PARAMS_AFFINE
@ MOTION_4_PARAMS_AFFINE
Definition: vvc_ctu.h:211
VVCLocalContext::chroma_scale
int chroma_scale
Definition: vvc_ctu.h:411
EntryPoint::hmvp_ibc
MvField hmvp_ibc[MAX_NUM_HMVP_CANDS]
HmvpIbcCandList.
Definition: vvc_ctu.h:364
MvField::ref_idx
int8_t ref_idx[2]
refIdxL0, refIdxL1
Definition: hevcdec.h:302
CTU::cus
CodingUnit * cus
Definition: vvc_ctu.h:329
VVCLocalContext::x_vpdu
int x_vpdu
Definition: vvc_ctu.h:412
ReconstructedArea::w
int w
Definition: vvc_ctu.h:338
VVC_MAX_SAMPLE_ARRAYS
@ VVC_MAX_SAMPLE_ARRAYS
Definition: vvc.h:77
VVCLocalContext::y_vpdu
int y_vpdu
Definition: vvc_ctu.h:413
PredFlag
PredFlag
Definition: hevcdec.h:112
MotionInfo::ref_idx
int8_t ref_idx[2]
refIdxL0, refIdxL1
Definition: vvc_ctu.h:238
SPLIT_BT_HOR
@ SPLIT_BT_HOR
Definition: vvc_ctu.h:122
TransformBlock::qp
int qp
Definition: vvc_ctu.h:153
CodingUnit::isp_split_type
enum IspType isp_split_type
IntraSubPartitionsSplitType.
Definition: vvc_ctu.h:302
ff_vvc_ep_init_stat_coeff
void ff_vvc_ep_init_stat_coeff(EntryPoint *ep, int bit_depth, int persistent_rice_adaptation_enabled_flag)
Definition: vvc_ctu.c:2550
VVCFrameContext
Definition: vvcdec.h:92
CodingUnit::mip_chroma_direct_flag
int mip_chroma_direct_flag
MipChromaDirectFlag.
Definition: vvc_ctu.h:310
ALFParams::ctb_flag
uint8_t ctb_flag[3]
alf_ctb_flag[]
Definition: vvc_ctu.h:460
MvField::bcw_idx
uint8_t bcw_idx
bcwIdx
Definition: vvc_ctu.h:199
int32_t
int32_t
Definition: audioconvert.c:56
CodingUnit::skip_flag
uint8_t skip_flag
cu_skip_flag;
Definition: vvc_ctu.h:296
EntryPoint::ctu_start
int ctu_start
Definition: vvc_ctu.h:357
TransformUnit::joint_cbcr_residual_flag
uint8_t joint_cbcr_residual_flag
tu_joint_cbcr_residual_flag
Definition: vvc_ctu.h:173
CodingUnit::tus
struct CodingUnit::@221 tus
ff_vvc_ctu_free_cus
void ff_vvc_ctu_free_cus(CTU *ctu)
Definition: vvc_ctu.c:2522
h
h
Definition: vp9dsp_template.c:2038
VVCLocalContext::ep
EntryPoint * ep
Definition: vvc_ctu.h:434
SAOParams::band_position
uint8_t band_position[3]
sao_band_position
Definition: hevcdsp.h:38
VVCLocalContext::cu_qg_top_left_y
int cu_qg_top_left_y
CuQgTopLeftY.
Definition: vvc_ctu.h:395
CodingUnit::ciip_flag
uint8_t ciip_flag
Definition: vvc_ctu.h:299
INTRA_INVALID
@ INTRA_INVALID
Definition: vvc_ctu.h:224
CABACContext
Definition: cabac.h:41
PredictionUnit::merge_subblock_flag
uint8_t merge_subblock_flag
Definition: vvc_ctu.h:255
CodingUnit::num_intra_subpartitions
int num_intra_subpartitions
Definition: vvc_ctu.h:306
VVCLocalContext::ctb_left_flag
uint8_t ctb_left_flag
Definition: vvc_ctu.h:369
VVCLocalContext::is_cu_chroma_qp_offset_coded
int is_cu_chroma_qp_offset_coded
IsCuChromaQpOffsetCoded.
Definition: vvc_ctu.h:396
ReconstructedArea::y
int y
Definition: vvc_ctu.h:337
VVCLocalContext::is_cu_qp_delta_coded
uint8_t is_cu_qp_delta_coded
IsCuQpDeltaCoded.
Definition: vvc_ctu.h:393
CodingUnit::y0
int y0
Definition: vvc_ctu.h:277
CodingUnit::qp
int8_t qp[4]
QpY, Qp′Cb, Qp′Cr, Qp′CbCr.
Definition: vvc_ctu.h:321
ff_vvc_set_neighbour_available
void ff_vvc_set_neighbour_available(VVCLocalContext *lc, int x0, int y0, int w, int h)
Definition: vvc_ctu.c:2507
MODE_PLT
@ MODE_PLT
Definition: vvc_ctu.h:186
PF_IBC
@ PF_IBC
Definition: vvc_ctu.h:220