FFmpeg
Loading...
Searching...
No Matches
ctu.h File Reference
#include <stdbool.h>
#include "libavcodec/cabac.h"
#include "libavutil/mem_internal.h"
#include "dec.h"

Go to the source code of this file.

Data Structures

struct  NeighbourAvailable
 
struct  TransformBlock
 
struct  TransformUnit
 
struct  Mv
 
struct  MvField
 
struct  DMVRInfo
 
struct  MotionInfo
 
struct  PredictionUnit
 
struct  Palette
 
struct  CodingUnit
 
struct  CTU
 
struct  ReconstructedArea
 
struct  VVCCabacState
 
struct  EntryPoint
 
struct  VVCLocalContext
 
struct  VVCAllowedSplit
 
struct  SAOParams
 
struct  ALFParams
 
struct  VVCRect
 

Macros

#define MAX_CTU_SIZE   128
 
#define MAX_CU_SIZE   MAX_CTU_SIZE
 
#define MIN_CU_SIZE   4
 
#define MIN_CU_LOG2   2
 
#define MAX_CU_DEPTH   7
 
#define MAX_PALETTE_CU_SIZE   64
 
#define MAX_PARTS_IN_CTU   ((MAX_CTU_SIZE >> MIN_CU_LOG2) * (MAX_CTU_SIZE >> MIN_CU_LOG2))
 
#define MIN_PU_SIZE   4
 
#define MAX_TB_SIZE   64
 
#define MIN_TU_SIZE   4
 
#define MAX_TUS_IN_CU   64
 
#define MAX_QP   63
 
#define MAX_PB_SIZE   128
 
#define MAX_SCALING_RATIO   8
 
#define EDGE_EMU_BUFFER_STRIDE   ((MAX_PB_SIZE + 32) * MAX_SCALING_RATIO)
 
#define CHROMA_EXTRA_BEFORE   1
 
#define CHROMA_EXTRA_AFTER   2
 
#define CHROMA_EXTRA   3
 
#define LUMA_EXTRA_BEFORE   3
 
#define LUMA_EXTRA_AFTER   4
 
#define LUMA_EXTRA   7
 
#define BILINEAR_EXTRA_BEFORE   0
 
#define BILINEAR_EXTRA_AFTER   1
 
#define BILINEAR_EXTRA   1
 
#define SCALED_INT(pos)
 
#define MAX_CONTROL_POINTS   3
 
#define AFFINE_MIN_BLOCK_SIZE   4
 
#define MRG_MAX_NUM_CANDS   6
 
#define MAX_NUM_HMVP_CANDS   5
 
#define SAO_PADDING_SIZE   1
 
#define ALF_PADDING_SIZE   8
 
#define ALF_BLOCK_SIZE   4
 
#define ALF_BORDER_LUMA   3
 
#define ALF_BORDER_CHROMA   2
 
#define ALF_VB_POS_ABOVE_LUMA   4
 
#define ALF_VB_POS_ABOVE_CHROMA   2
 
#define ALF_GRADIENT_STEP   2
 
#define ALF_GRADIENT_BORDER   2
 
#define ALF_GRADIENT_SIZE   ((MAX_CU_SIZE + ALF_GRADIENT_BORDER * 2) / ALF_GRADIENT_STEP)
 
#define ALF_NUM_DIR   4
 
#define ALF_MAX_BLOCKS_IN_CTU   (MAX_CTU_SIZE * MAX_CTU_SIZE / ALF_BLOCK_SIZE / ALF_BLOCK_SIZE)
 
#define ALF_MAX_FILTER_SIZE   (ALF_MAX_BLOCKS_IN_CTU * ALF_NUM_COEFF_LUMA)
 
#define SAMPLE(tab, x, y)
 Value of the luma sample at position (x, y) in the 2D array tab.
 
#define SAMPLE_CTB(tab, x, y)
 
#define CTB(tab, x, y)
 
#define VVC_CONTEXTS   378
 
#define BOUNDARY_LEFT_SLICE   (1 << 0)
 
#define BOUNDARY_LEFT_TILE   (1 << 1)
 
#define BOUNDARY_LEFT_SUBPIC   (1 << 2)
 
#define BOUNDARY_UPPER_SLICE   (1 << 3)
 
#define BOUNDARY_UPPER_TILE   (1 << 4)
 
#define BOUNDARY_UPPER_SUBPIC   (1 << 5)
 

Enumerations

enum  SAOType { SAO_NOT_APPLIED = 0 , SAO_BAND , SAO_EDGE }
 
enum  SAOEOClass { SAO_EO_HORIZ = 0 , SAO_EO_VERT , SAO_EO_135D , SAO_EO_45D }
 
enum  IspType { ISP_NO_SPLIT , ISP_HOR_SPLIT , ISP_VER_SPLIT }
 
enum  VVCSplitMode {
  SPLIT_NONE , SPLIT_TT_HOR , SPLIT_BT_HOR , SPLIT_TT_VER ,
  SPLIT_BT_VER , SPLIT_QT
}
 
enum  MtsIdx {
  MTS_DCT2_DCT2 , MTS_DST7_DST7 , MTS_DST7_DCT8 , MTS_DCT8_DST7 ,
  MTS_DCT8_DCT8
}
 
enum  VVCTreeType { SINGLE_TREE , DUAL_TREE_LUMA , DUAL_TREE_CHROMA }
 
enum  PredMode {
  MODE_INTER , MODE_INTRA , MODE_SKIP , MODE_PLT ,
  MODE_IBC
}
 
enum  MotionModelIdc { MOTION_TRANSLATION , MOTION_4_PARAMS_AFFINE , MOTION_6_PARAMS_AFFINE }
 
enum  PredFlag {
  PF_INTRA = 0x0 , PF_L0 = 0x1 , PF_L1 = 0x2 , PF_BI = 0x3 ,
  PF_IBC = PF_L0 | 0x4 , PF_PLT = 0x8
}
 
enum  IntraPredMode {
  INTRA_INVALID = -1 , INTRA_PLANAR = 0 , INTRA_DC , INTRA_HORZ = 18 ,
  INTRA_DIAG = 34 , INTRA_VERT = 50 , INTRA_VDIAG = 66 , INTRA_LT_CCLM = 81 ,
  INTRA_L_CCLM , INTRA_T_CCLM
}
 

Functions

int ff_vvc_coding_tree_unit (VVCLocalContext *lc, int ctu_idx, int rs, int rx, int ry)
 parse a CTU
 
void ff_vvc_set_neighbour_available (VVCLocalContext *lc, int x0, int y0, int w, int h)
 
void ff_vvc_decode_neighbour (VVCLocalContext *lc, int x_ctb, int y_ctb, int rx, int ry, int rs)
 
void ff_vvc_ctu_free_cus (CodingUnit **cus)
 
int ff_vvc_get_qPy (const VVCFrameContext *fc, int xc, int yc)
 
void ff_vvc_ep_init_stat_coeff (EntryPoint *ep, int bit_depth, int persistent_rice_adaptation_enabled_flag)
 
void ff_vvc_channel_range (int *start, int *end, VVCTreeType tree_type, uint8_t chroma_format_idc)
 

Macro Definition Documentation

◆ MAX_CTU_SIZE

◆ MAX_CU_SIZE

#define MAX_CU_SIZE   MAX_CTU_SIZE

Definition at line 35 of file ctu.h.

◆ MIN_CU_SIZE

#define MIN_CU_SIZE   4

Definition at line 36 of file ctu.h.

◆ MIN_CU_LOG2

#define MIN_CU_LOG2   2

Definition at line 37 of file ctu.h.

Referenced by ff_vvc_store_sb_mvs().

◆ MAX_CU_DEPTH

#define MAX_CU_DEPTH   7

Definition at line 38 of file ctu.h.

Referenced by ff_vvc_store_sb_mvs(), and init_subblock_params().

◆ MAX_PALETTE_CU_SIZE

#define MAX_PALETTE_CU_SIZE   64

Definition at line 39 of file ctu.h.

Referenced by hls_palette_coding().

◆ MAX_PARTS_IN_CTU

#define MAX_PARTS_IN_CTU   ((MAX_CTU_SIZE >> MIN_CU_LOG2) * (MAX_CTU_SIZE >> MIN_CU_LOG2))

Definition at line 41 of file ctu.h.

◆ MIN_PU_SIZE

#define MIN_PU_SIZE   4

Definition at line 43 of file ctu.h.

Referenced by set_dmvr_info().

◆ MAX_TB_SIZE

#define MAX_TB_SIZE   64

Definition at line 45 of file ctu.h.

◆ MIN_TU_SIZE

#define MIN_TU_SIZE   4

Definition at line 46 of file ctu.h.

Referenced by intra_luma_pred_modes(), and set_tb_tab().

◆ MAX_TUS_IN_CU

#define MAX_TUS_IN_CU   64

Definition at line 47 of file ctu.h.

◆ MAX_QP

#define MAX_QP   63

Definition at line 49 of file ctu.h.

◆ MAX_PB_SIZE

#define MAX_PB_SIZE   128

Definition at line 51 of file ctu.h.

◆ MAX_SCALING_RATIO

#define MAX_SCALING_RATIO   8

Definition at line 52 of file ctu.h.

◆ EDGE_EMU_BUFFER_STRIDE

#define EDGE_EMU_BUFFER_STRIDE   ((MAX_PB_SIZE + 32) * MAX_SCALING_RATIO)

Definition at line 53 of file ctu.h.

◆ CHROMA_EXTRA_BEFORE

#define CHROMA_EXTRA_BEFORE   1

Definition at line 55 of file ctu.h.

◆ CHROMA_EXTRA_AFTER

#define CHROMA_EXTRA_AFTER   2

Definition at line 56 of file ctu.h.

◆ CHROMA_EXTRA

#define CHROMA_EXTRA   3

Definition at line 57 of file ctu.h.

◆ LUMA_EXTRA_BEFORE

#define LUMA_EXTRA_BEFORE   3

Definition at line 58 of file ctu.h.

◆ LUMA_EXTRA_AFTER

#define LUMA_EXTRA_AFTER   4

Definition at line 59 of file ctu.h.

Referenced by schedule_inter().

◆ LUMA_EXTRA

#define LUMA_EXTRA   7

Definition at line 60 of file ctu.h.

◆ BILINEAR_EXTRA_BEFORE

#define BILINEAR_EXTRA_BEFORE   0

Definition at line 61 of file ctu.h.

Referenced by dmvr_hv().

◆ BILINEAR_EXTRA_AFTER

#define BILINEAR_EXTRA_AFTER   1

Definition at line 62 of file ctu.h.

◆ BILINEAR_EXTRA

#define BILINEAR_EXTRA   1

Definition at line 63 of file ctu.h.

Referenced by dmvr_hv().

◆ SCALED_INT

#define SCALED_INT ( pos)
Value:
((pos) >> 10)
unsigned int pos
Definition spdifenc.c:431

Definition at line 65 of file ctu.h.

Referenced by emulated_edge_scaled(), put_scaled(), and put_uni_w_scaled().

◆ MAX_CONTROL_POINTS

#define MAX_CONTROL_POINTS   3

◆ AFFINE_MIN_BLOCK_SIZE

#define AFFINE_MIN_BLOCK_SIZE   4

◆ MRG_MAX_NUM_CANDS

#define MRG_MAX_NUM_CANDS   6

Definition at line 71 of file ctu.h.

◆ MAX_NUM_HMVP_CANDS

#define MAX_NUM_HMVP_CANDS   5

Definition at line 72 of file ctu.h.

Referenced by update_hmvp().

◆ SAO_PADDING_SIZE

#define SAO_PADDING_SIZE   1

Definition at line 74 of file ctu.h.

◆ ALF_PADDING_SIZE

#define ALF_PADDING_SIZE   8

Definition at line 76 of file ctu.h.

Referenced by ff_vvc_alf_filter(), and pixel_buffer_nz_tl_init().

◆ ALF_BLOCK_SIZE

#define ALF_BLOCK_SIZE   4

◆ ALF_BORDER_LUMA

#define ALF_BORDER_LUMA   3

Definition at line 79 of file ctu.h.

Referenced by alf_copy_ctb_to_hv(), alf_prepare_buffer(), and pixel_buffer_nz_tl_init().

◆ ALF_BORDER_CHROMA

#define ALF_BORDER_CHROMA   2

Definition at line 80 of file ctu.h.

Referenced by alf_copy_ctb_to_hv(), alf_prepare_buffer(), and pixel_buffer_nz_tl_init().

◆ ALF_VB_POS_ABOVE_LUMA

#define ALF_VB_POS_ABOVE_LUMA   4

Definition at line 82 of file ctu.h.

Referenced by check_alf_classify(), check_alf_filter(), and ff_vvc_alf_filter().

◆ ALF_VB_POS_ABOVE_CHROMA

#define ALF_VB_POS_ABOVE_CHROMA   2

Definition at line 83 of file ctu.h.

Referenced by check_alf_filter(), and ff_vvc_alf_filter().

◆ ALF_GRADIENT_STEP

#define ALF_GRADIENT_STEP   2

Definition at line 85 of file ctu.h.

Referenced by alf_classify(), and alf_classify().

◆ ALF_GRADIENT_BORDER

#define ALF_GRADIENT_BORDER   2

Definition at line 86 of file ctu.h.

Referenced by alf_classify(), and alf_classify().

◆ ALF_GRADIENT_SIZE

#define ALF_GRADIENT_SIZE   ((MAX_CU_SIZE + ALF_GRADIENT_BORDER * 2) / ALF_GRADIENT_STEP)

Definition at line 87 of file ctu.h.

Referenced by check_alf_classify().

◆ ALF_NUM_DIR

#define ALF_NUM_DIR   4

Definition at line 88 of file ctu.h.

Referenced by alf_classify(), alf_classify(), and check_alf_classify().

◆ ALF_MAX_BLOCKS_IN_CTU

#define ALF_MAX_BLOCKS_IN_CTU   (MAX_CTU_SIZE * MAX_CTU_SIZE / ALF_BLOCK_SIZE / ALF_BLOCK_SIZE)

Definition at line 90 of file ctu.h.

Referenced by alf_get_coeff_and_clip().

◆ ALF_MAX_FILTER_SIZE

#define ALF_MAX_FILTER_SIZE   (ALF_MAX_BLOCKS_IN_CTU * ALF_NUM_COEFF_LUMA)

Definition at line 91 of file ctu.h.

◆ SAMPLE

#define SAMPLE ( tab,
x,
y )
Value:
((tab)[(y) * s->pps->width + (x)])
#define s(width, name)
Definition cbs_vp9.c:198
static const struct twinvq_data tab

Value of the luma sample at position (x, y) in the 2D array tab.

Definition at line 96 of file ctu.h.

◆ SAMPLE_CTB

#define SAMPLE_CTB ( tab,
x,
y )
Value:
((tab)[(y) * min_cb_width + (x)])

Definition at line 97 of file ctu.h.

◆ CTB

#define CTB ( tab,
x,
y )
Value:
((tab)[(y) * fc->ps.pps->ctb_width + (x)])
static const uint16_t fc[]
Definition dcaenc.h:43

Definition at line 98 of file ctu.h.

◆ VVC_CONTEXTS

#define VVC_CONTEXTS   378

Definition at line 364 of file ctu.h.

Referenced by cabac_init_state().

◆ BOUNDARY_LEFT_SLICE

#define BOUNDARY_LEFT_SLICE   (1 << 0)

Definition at line 427 of file ctu.h.

◆ BOUNDARY_LEFT_TILE

#define BOUNDARY_LEFT_TILE   (1 << 1)

Definition at line 428 of file ctu.h.

◆ BOUNDARY_LEFT_SUBPIC

#define BOUNDARY_LEFT_SUBPIC   (1 << 2)

Definition at line 429 of file ctu.h.

Referenced by alf_get_edges(), deblock_is_boundary(), and ff_vvc_decode_neighbour().

◆ BOUNDARY_UPPER_SLICE

#define BOUNDARY_UPPER_SLICE   (1 << 3)

Definition at line 430 of file ctu.h.

◆ BOUNDARY_UPPER_TILE

#define BOUNDARY_UPPER_TILE   (1 << 4)

Definition at line 431 of file ctu.h.

◆ BOUNDARY_UPPER_SUBPIC

#define BOUNDARY_UPPER_SUBPIC   (1 << 5)

Definition at line 432 of file ctu.h.

Referenced by alf_get_edges(), deblock_is_boundary(), and ff_vvc_decode_neighbour().

Enumeration Type Documentation

◆ SAOType

enum SAOType
Enumerator
SAO_NOT_APPLIED 
SAO_BAND 
SAO_EDGE 

Definition at line 100 of file ctu.h.

◆ SAOEOClass

enum SAOEOClass
Enumerator
SAO_EO_HORIZ 
SAO_EO_VERT 
SAO_EO_135D 
SAO_EO_45D 

Definition at line 106 of file ctu.h.

◆ IspType

enum IspType
Enumerator
ISP_NO_SPLIT 
ISP_HOR_SPLIT 
ISP_VER_SPLIT 

Definition at line 121 of file ctu.h.

◆ VVCSplitMode

Enumerator
SPLIT_NONE 
SPLIT_TT_HOR 
SPLIT_BT_HOR 
SPLIT_TT_VER 
SPLIT_BT_VER 
SPLIT_QT 

Definition at line 127 of file ctu.h.

◆ MtsIdx

enum MtsIdx
Enumerator
MTS_DCT2_DCT2 
MTS_DST7_DST7 
MTS_DST7_DCT8 
MTS_DCT8_DST7 
MTS_DCT8_DCT8 

Definition at line 136 of file ctu.h.

◆ VVCTreeType

Enumerator
SINGLE_TREE 
DUAL_TREE_LUMA 
DUAL_TREE_CHROMA 

Definition at line 169 of file ctu.h.

◆ PredMode

enum PredMode
Enumerator
MODE_INTER 
MODE_INTRA 
MODE_SKIP 
MODE_PLT 
MODE_IBC 

Definition at line 191 of file ctu.h.

◆ MotionModelIdc

Enumerator
MOTION_TRANSLATION 
MOTION_4_PARAMS_AFFINE 
MOTION_6_PARAMS_AFFINE 

Definition at line 218 of file ctu.h.

◆ PredFlag

enum PredFlag
Enumerator
PF_INTRA 
PF_L0 
PF_L1 
PF_BI 
PF_IBC 
PF_PLT 

Definition at line 224 of file ctu.h.

◆ IntraPredMode

Enumerator
INTRA_INVALID 
INTRA_PLANAR 
INTRA_DC 
INTRA_HORZ 
INTRA_DIAG 
INTRA_VERT 
INTRA_VDIAG 
INTRA_LT_CCLM 
INTRA_L_CCLM 
INTRA_T_CCLM 

Definition at line 233 of file ctu.h.

Function Documentation

◆ 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

Parameters
lclocal context for CTU
ctb_idxCTB(CTU) address in the current slice
rsraster order for the CTU.
rxraster order x for the CTU.
ryraster order y for the CTU.
Returns
AVERROR

Definition at line 2808 of file ctu.c.

Referenced by run_parse().

◆ ff_vvc_set_neighbour_available()

void ff_vvc_set_neighbour_available ( VVCLocalContext * lc,
int x0,
int y0,
int w,
int h )

◆ ff_vvc_decode_neighbour()

void ff_vvc_decode_neighbour ( VVCLocalContext * lc,
int x_ctb,
int y_ctb,
int rx,
int ry,
int rs )

◆ ff_vvc_ctu_free_cus()

void ff_vvc_ctu_free_cus ( CodingUnit ** cus)

Definition at line 2887 of file ctu.c.

Referenced by ff_vvc_reconstruct(), and free_cus().

◆ ff_vvc_get_qPy()

int ff_vvc_get_qPy ( const VVCFrameContext * fc,
int xc,
int yc )

Definition at line 2906 of file ctu.c.

Referenced by get_qp_y(), and set_qp_c().

◆ 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 at line 2914 of file ctu.c.

Referenced by cabac_init_state(), and ep_init_wpp().

◆ ff_vvc_channel_range()

void ff_vvc_channel_range ( int * start,
int * end,
VVCTreeType tree_type,
uint8_t chroma_format_idc )

Definition at line 2923 of file ctu.c.

Referenced by hls_palette_coding(), ibc_fill_vir_buf(), and skipped_transform_tree().