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