FFmpeg
vvc_cabac.h
Go to the documentation of this file.
1 /*
2  * VVC CABAC decoder
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_CABAC_H
24 #define AVCODEC_VVC_VVC_CABAC_H
25 
26 #include "vvc_ctu.h"
27 
28 int ff_vvc_cabac_init(VVCLocalContext *lc, int ctu_idx, int rx, int ry);
29 
30 //sao
37 
38 //alf
39 int ff_vvc_alf_ctb_flag(VVCLocalContext *lc, int rx, int ry, int c_idx);
43 int ff_vvc_alf_ctb_filter_alt_idx(VVCLocalContext *lc, int c_idx, int num_chroma_filters);
44 int ff_vvc_alf_ctb_cc_idc(VVCLocalContext *lc, int rx, int ry, int idx, int cc_filters_signalled);
45 
46 //coding_tree
47 int ff_vvc_split_cu_flag(VVCLocalContext* lc, int x0, int y0, int cb_width, int cb_height,
48  int ch_type, const VVCAllowedSplit *a);
49 VVCSplitMode ff_vvc_split_mode(VVCLocalContext *lc, int x0, int y0, int cb_width, int cb_height,
50  int cqt_depth, int mtt_depth, int ch_type, const VVCAllowedSplit *a);
51 int ff_vvc_non_inter_flag(VVCLocalContext *lc, int x0, int y0, int ch_type);
52 
53 //coding unit
54 int ff_vvc_pred_mode_flag(VVCLocalContext *lc, int is_chroma);
60 int ff_vvc_cu_skip_flag(VVCLocalContext *lc, const uint8_t *cu_skip_flag);
61 int ff_vvc_pred_mode_ibc_flag(VVCLocalContext *lc, int ch_type);
69 
70 //intra
71 int ff_vvc_intra_mip_flag(VVCLocalContext *lc, const uint8_t *intra_mip_flag);
76 enum IspType ff_vvc_isp_split_type(VVCLocalContext *lc, int intra_subpartitions_mode_flag);
78 int ff_vvc_intra_luma_not_planar_flag(VVCLocalContext *lc, int intra_subpartitions_mode_flag);
84 
85 //inter
88 int ff_vvc_merge_subblock_idx(VVCLocalContext *lc, int max_num_subblock_merge_cand);
89 int ff_vvc_regular_merge_flag(VVCLocalContext *lc, int cu_skip_flag);
93 void ff_vvc_mmvd_offset_coding(VVCLocalContext *lc, Mv *mvd_offset, int ph_mmvd_fullpel_only_flag);
96 int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, int idx);
101 int ff_vvc_ref_idx_lx(VVCLocalContext *lc, uint8_t nb_refs);
107 int ff_vvc_amvr_shift(VVCLocalContext *lc, int inter_affine_flag, PredMode pred_mode, int has_amvr_flag);
108 int ff_vvc_bcw_idx(VVCLocalContext *lc, int no_backward_pred_flag);
109 
110 //transform
112 int ff_vvc_tu_cr_coded_flag(VVCLocalContext *lc, int tu_cb_coded_flag);
116 int ff_vvc_tu_joint_cbcr_residual_flag(VVCLocalContext *lc, int tu_cb_coded_flag, int tu_cr_coded_flag);
119 int ff_vvc_lfnst_idx(VVCLocalContext *lc, int inc);
121 
125 
126 #endif //AVCODEC_VVC_VVC_CABAC_H
ff_vvc_cu_chroma_qp_offset_idx
int ff_vvc_cu_chroma_qp_offset_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1663
ff_vvc_cu_affine_type_flag
int ff_vvc_cu_affine_type_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1501
ff_vvc_mts_idx
int ff_vvc_mts_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:2455
ff_vvc_residual_coding
int ff_vvc_residual_coding(VVCLocalContext *lc, TransformBlock *tb)
Definition: vvc_cabac.c:2407
ff_vvc_split_mode
VVCSplitMode ff_vvc_split_mode(VVCLocalContext *lc, int x0, int y0, int cb_width, int cb_height, int cqt_depth, int mtt_depth, int ch_type, const VVCAllowedSplit *a)
Definition: vvc_cabac.c:1162
ff_vvc_non_inter_flag
int ff_vvc_non_inter_flag(VVCLocalContext *lc, int x0, int y0, int ch_type)
Definition: vvc_cabac.c:1196
ff_vvc_cu_skip_flag
int ff_vvc_cu_skip_flag(VVCLocalContext *lc, const uint8_t *cu_skip_flag)
Definition: vvc_cabac.c:1242
ff_vvc_tu_joint_cbcr_residual_flag
int ff_vvc_tu_joint_cbcr_residual_flag(VVCLocalContext *lc, int tu_cb_coded_flag, int tu_cr_coded_flag)
Definition: vvc_cabac.c:1717
ff_vvc_intra_luma_mpm_flag
int ff_vvc_intra_luma_mpm_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1304
ff_vvc_cu_chroma_qp_offset_flag
int ff_vvc_cu_chroma_qp_offset_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1658
ff_vvc_abs_mvd_greater1_flag
int ff_vvc_abs_mvd_greater1_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1531
ff_vvc_intra_luma_ref_idx
int ff_vvc_intra_luma_ref_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1282
ff_vvc_intra_luma_not_planar_flag
int ff_vvc_intra_luma_not_planar_flag(VVCLocalContext *lc, int intra_subpartitions_mode_flag)
Definition: vvc_cabac.c:1309
ff_vvc_sbt_pos_flag
int ff_vvc_sbt_pos_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:2441
ff_vvc_mvd_sign_flag
int ff_vvc_mvd_sign_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1541
IspType
IspType
Definition: vvc_ctu.h:113
ff_vvc_end_of_tile_one_bit
int ff_vvc_end_of_tile_one_bit(VVCLocalContext *lc)
Definition: vvc_cabac.c:2470
ff_vvc_cu_coded_flag
int ff_vvc_cu_coded_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:2415
ff_vvc_merge_subblock_idx
int ff_vvc_merge_subblock_idx(VVCLocalContext *lc, int max_num_subblock_merge_cand)
Definition: vvc_cabac.c:1368
ff_vvc_ciip_flag
int ff_vvc_ciip_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1475
ff_vvc_pred_mode_plt_flag
int ff_vvc_pred_mode_plt_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1217
ff_vvc_sao_merge_flag_decode
int ff_vvc_sao_merge_flag_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:976
ff_vvc_transform_skip_flag
int ff_vvc_transform_skip_flag(VVCLocalContext *lc, int ctx)
Definition: vvc_cabac.c:1722
ff_vvc_bcw_idx
int ff_vvc_bcw_idx(VVCLocalContext *lc, int no_backward_pred_flag)
Definition: vvc_cabac.c:1590
ff_vvc_cclm_mode_idx
int ff_vvc_cclm_mode_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1332
ff_vvc_intra_bdpcm_chroma_dir_flag
int ff_vvc_intra_bdpcm_chroma_dir_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1237
ff_vvc_intra_bdpcm_luma_flag
int ff_vvc_intra_bdpcm_luma_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1222
ff_vvc_alf_luma_prev_filter_idx
int ff_vvc_alf_luma_prev_filter_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1042
ff_vvc_cclm_mode_flag
int ff_vvc_cclm_mode_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1327
ff_vvc_intra_bdpcm_luma_dir_flag
int ff_vvc_intra_bdpcm_luma_dir_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1227
ff_vvc_intra_subpartitions_mode_flag
int ff_vvc_intra_subpartitions_mode_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1292
ctx
AVFormatContext * ctx
Definition: movenc.c:48
ff_vvc_split_cu_flag
int ff_vvc_split_cu_flag(VVCLocalContext *lc, int x0, int y0, int cb_width, int cb_height, int ch_type, const VVCAllowedSplit *a)
Definition: vvc_cabac.c:1084
ff_vvc_sao_type_idx_decode
int ff_vvc_sao_type_idx_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:981
ff_vvc_pred_mode_flag
int ff_vvc_pred_mode_flag(VVCLocalContext *lc, int is_chroma)
Definition: vvc_cabac.c:1206
ff_vvc_abs_mvd_minus2
int ff_vvc_abs_mvd_minus2(VVCLocalContext *lc)
Definition: vvc_cabac.c:1536
ff_vvc_sao_band_position_decode
int ff_vvc_sao_band_position_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:991
ff_vvc_intra_luma_mpm_idx
int ff_vvc_intra_luma_mpm_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1314
ff_vvc_mvp_lx_flag
int ff_vvc_mvp_lx_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1546
ff_vvc_ref_idx_lx
int ff_vvc_ref_idx_lx(VVCLocalContext *lc, uint8_t nb_refs)
Definition: vvc_cabac.c:1511
VVCLocalContext
Definition: vvc_ctu.h:368
ff_vvc_sao_offset_sign_decode
int ff_vvc_sao_offset_sign_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:1010
ff_vvc_merge_subblock_flag
int ff_vvc_merge_subblock_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1362
ff_vvc_sao_eo_class_decode
int ff_vvc_sao_eo_class_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:1015
ff_vvc_pred_mode_ibc_flag
int ff_vvc_pred_mode_ibc_flag(VVCLocalContext *lc, int ch_type)
Definition: vvc_cabac.c:1248
VVCSplitMode
VVCSplitMode
Definition: vvc_ctu.h:119
ff_vvc_mmvd_cand_flag
int ff_vvc_mmvd_cand_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1389
ff_vvc_regular_merge_flag
int ff_vvc_regular_merge_flag(VVCLocalContext *lc, int cu_skip_flag)
Definition: vvc_cabac.c:1378
ff_vvc_tu_cr_coded_flag
int ff_vvc_tu_cr_coded_flag(VVCLocalContext *lc, int tu_cb_coded_flag)
Definition: vvc_cabac.c:1606
ff_vvc_alf_luma_fixed_filter_idx
int ff_vvc_alf_luma_fixed_filter_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1047
ff_vvc_intra_mip_mode
int ff_vvc_intra_mip_mode(VVCLocalContext *lc)
Definition: vvc_cabac.c:1273
ff_vvc_intra_mip_transposed_flag
int ff_vvc_intra_mip_transposed_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1268
ff_vvc_merge_idx
int ff_vvc_merge_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1436
ff_vvc_pred_flag
PredFlag ff_vvc_pred_flag(VVCLocalContext *lc, int is_b)
Definition: vvc_cabac.c:1480
ff_vvc_cu_qp_delta_sign_flag
int ff_vvc_cu_qp_delta_sign_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1653
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
ff_vvc_sbt_flag
int ff_vvc_sbt_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:2420
ff_vvc_intra_chroma_pred_mode
int ff_vvc_intra_chroma_pred_mode(VVCLocalContext *lc)
Definition: vvc_cabac.c:1339
ff_vvc_mmvd_merge_flag
int ff_vvc_mmvd_merge_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1384
ff_vvc_alf_ctb_filter_alt_idx
int ff_vvc_alf_ctb_filter_alt_idx(VVCLocalContext *lc, int c_idx, int num_chroma_filters)
Definition: vvc_cabac.c:1052
ff_vvc_merge_gpm_partition_idx
int ff_vvc_merge_gpm_partition_idx(VVCLocalContext *lc)
Definition: vvc_cabac.c:1451
ff_vvc_intra_mip_flag
int ff_vvc_intra_mip_flag(VVCLocalContext *lc, const uint8_t *intra_mip_flag)
Definition: vvc_cabac.c:1260
VVCAllowedSplit
Definition: vvc_ctu.h:436
vvc_ctu.h
ff_vvc_sbt_horizontal_flag
int ff_vvc_sbt_horizontal_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:2433
ff_vvc_tu_y_coded_flag
int ff_vvc_tu_y_coded_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1611
tb
#define tb
Definition: regdef.h:68
ff_vvc_cu_qp_delta_abs
int ff_vvc_cu_qp_delta_abs(VVCLocalContext *lc)
Definition: vvc_cabac.c:1625
ff_vvc_alf_ctb_cc_idc
int ff_vvc_alf_ctb_cc_idc(VVCLocalContext *lc, int rx, int ry, int idx, int cc_filters_signalled)
Definition: vvc_cabac.c:1062
ff_vvc_intra_bdpcm_chroma_flag
int ff_vvc_intra_bdpcm_chroma_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1232
ff_vvc_end_of_slice_flag_decode
int ff_vvc_end_of_slice_flag_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:2465
ff_vvc_sao_offset_abs_decode
int ff_vvc_sao_offset_abs_decode(VVCLocalContext *lc)
Definition: vvc_cabac.c:1000
PredMode
PredMode
Definition: hevcdec.h:100
ff_vvc_amvr_shift
int ff_vvc_amvr_shift(VVCLocalContext *lc, int inter_affine_flag, PredMode pred_mode, int has_amvr_flag)
Definition: vvc_cabac.c:1567
ff_vvc_sym_mvd_flag
int ff_vvc_sym_mvd_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1506
TransformBlock
Definition: vvc_ctu.h:136
ff_vvc_mmvd_offset_coding
void ff_vvc_mmvd_offset_coding(VVCLocalContext *lc, Mv *mvd_offset, int ph_mmvd_fullpel_only_flag)
Definition: vvc_cabac.c:1409
ff_vvc_abs_mvd_greater0_flag
int ff_vvc_abs_mvd_greater0_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1526
ff_vvc_general_merge_flag
int ff_vvc_general_merge_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1346
ff_vvc_sbt_quad_flag
int ff_vvc_sbt_quad_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:2428
ff_vvc_alf_use_aps_flag
int ff_vvc_alf_use_aps_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1037
ff_vvc_isp_split_type
enum IspType ff_vvc_isp_split_type(VVCLocalContext *lc, int intra_subpartitions_mode_flag)
Definition: vvc_cabac.c:1297
ff_vvc_tu_cb_coded_flag
int ff_vvc_tu_cb_coded_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1601
Mv
Definition: hevcdec.h:295
ff_vvc_cabac_init
int ff_vvc_cabac_init(VVCLocalContext *lc, int ctu_idx, int rx, int ry)
Definition: vvc_cabac.c:842
ff_vvc_lfnst_idx
int ff_vvc_lfnst_idx(VVCLocalContext *lc, int inc)
Definition: vvc_cabac.c:2446
ff_vvc_merge_gpm_idx
int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, int idx)
Definition: vvc_cabac.c:1461
PredFlag
PredFlag
Definition: hevcdec.h:112
ff_vvc_alf_ctb_flag
int ff_vvc_alf_ctb_flag(VVCLocalContext *lc, int rx, int ry, int c_idx)
Definition: vvc_cabac.c:1022
ff_vvc_intra_luma_mpm_remainder
int ff_vvc_intra_luma_mpm_remainder(VVCLocalContext *lc)
Definition: vvc_cabac.c:1322
ff_vvc_inter_affine_flag
int ff_vvc_inter_affine_flag(VVCLocalContext *lc)
Definition: vvc_cabac.c:1495
ff_vvc_end_of_subset_one_bit
int ff_vvc_end_of_subset_one_bit(VVCLocalContext *lc)
Definition: vvc_cabac.c:2475