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