FFmpeg
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_CABAC_H
24 #define AVCODEC_VVC_CABAC_H
25 
26 #include "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_CABAC_H
ff_vvc_mmvd_merge_flag
int ff_vvc_mmvd_merge_flag(VVCLocalContext *lc)
Definition: cabac.c:1392
ff_vvc_intra_bdpcm_chroma_flag
int ff_vvc_intra_bdpcm_chroma_flag(VVCLocalContext *lc)
Definition: cabac.c:1232
ff_vvc_end_of_subset_one_bit
int ff_vvc_end_of_subset_one_bit(VVCLocalContext *lc)
Definition: cabac.c:2483
ff_vvc_end_of_slice_flag_decode
int ff_vvc_end_of_slice_flag_decode(VVCLocalContext *lc)
Definition: cabac.c:2473
ff_vvc_cu_chroma_qp_offset_idx
int ff_vvc_cu_chroma_qp_offset_idx(VVCLocalContext *lc)
Definition: cabac.c:1671
ff_vvc_ref_idx_lx
int ff_vvc_ref_idx_lx(VVCLocalContext *lc, uint8_t nb_refs)
Definition: cabac.c:1519
ff_vvc_cclm_mode_flag
int ff_vvc_cclm_mode_flag(VVCLocalContext *lc)
Definition: cabac.c:1335
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: cabac.c:1725
ff_vvc_bcw_idx
int ff_vvc_bcw_idx(VVCLocalContext *lc, int no_backward_pred_flag)
Definition: cabac.c:1598
ff_vvc_end_of_tile_one_bit
int ff_vvc_end_of_tile_one_bit(VVCLocalContext *lc)
Definition: cabac.c:2478
ff_vvc_cclm_mode_idx
int ff_vvc_cclm_mode_idx(VVCLocalContext *lc)
Definition: cabac.c:1340
ff_vvc_intra_subpartitions_mode_flag
int ff_vvc_intra_subpartitions_mode_flag(VVCLocalContext *lc)
Definition: cabac.c:1300
ff_vvc_pred_mode_flag
int ff_vvc_pred_mode_flag(VVCLocalContext *lc, int is_chroma)
Definition: cabac.c:1206
ff_vvc_sbt_quad_flag
int ff_vvc_sbt_quad_flag(VVCLocalContext *lc)
Definition: cabac.c:2436
ff_vvc_non_inter_flag
int ff_vvc_non_inter_flag(VVCLocalContext *lc, int x0, int y0, int ch_type)
Definition: cabac.c:1196
ff_vvc_regular_merge_flag
int ff_vvc_regular_merge_flag(VVCLocalContext *lc, int cu_skip_flag)
Definition: cabac.c:1386
VVCSplitMode
VVCSplitMode
Definition: ctu.h:124
ff_vvc_transform_skip_flag
int ff_vvc_transform_skip_flag(VVCLocalContext *lc, int ctx)
Definition: cabac.c:1730
ff_vvc_sao_eo_class_decode
int ff_vvc_sao_eo_class_decode(VVCLocalContext *lc)
Definition: cabac.c:1015
ff_vvc_intra_mip_flag
int ff_vvc_intra_mip_flag(VVCLocalContext *lc, const uint8_t *intra_mip_flag)
Definition: cabac.c:1268
ff_vvc_alf_use_aps_flag
int ff_vvc_alf_use_aps_flag(VVCLocalContext *lc)
Definition: cabac.c:1037
ff_vvc_isp_split_type
enum IspType ff_vvc_isp_split_type(VVCLocalContext *lc, int intra_subpartitions_mode_flag)
Definition: cabac.c:1305
ff_vvc_intra_luma_not_planar_flag
int ff_vvc_intra_luma_not_planar_flag(VVCLocalContext *lc, int intra_subpartitions_mode_flag)
Definition: cabac.c:1317
ff_vvc_tu_cb_coded_flag
int ff_vvc_tu_cb_coded_flag(VVCLocalContext *lc)
Definition: cabac.c:1609
ff_vvc_pred_mode_ibc_flag
int ff_vvc_pred_mode_ibc_flag(VVCLocalContext *lc, int ch_type)
Definition: cabac.c:1248
ff_vvc_intra_bdpcm_luma_dir_flag
int ff_vvc_intra_bdpcm_luma_dir_flag(VVCLocalContext *lc)
Definition: cabac.c:1227
ff_vvc_cu_qp_delta_abs
int ff_vvc_cu_qp_delta_abs(VVCLocalContext *lc)
Definition: cabac.c:1633
ff_vvc_intra_mip_transposed_flag
int ff_vvc_intra_mip_transposed_flag(VVCLocalContext *lc)
Definition: cabac.c:1276
ff_vvc_sbt_pos_flag
int ff_vvc_sbt_pos_flag(VVCLocalContext *lc)
Definition: cabac.c:2449
ff_vvc_alf_luma_fixed_filter_idx
int ff_vvc_alf_luma_fixed_filter_idx(VVCLocalContext *lc)
Definition: cabac.c:1047
ff_vvc_mvd_sign_flag
int ff_vvc_mvd_sign_flag(VVCLocalContext *lc)
Definition: cabac.c:1549
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: cabac.c:1062
ff_vvc_intra_mip_mode
int ff_vvc_intra_mip_mode(VVCLocalContext *lc)
Definition: cabac.c:1281
ff_vvc_cu_coded_flag
int ff_vvc_cu_coded_flag(VVCLocalContext *lc)
Definition: cabac.c:2423
ff_vvc_abs_mvd_greater0_flag
int ff_vvc_abs_mvd_greater0_flag(VVCLocalContext *lc)
Definition: cabac.c:1534
ff_vvc_cabac_init
int ff_vvc_cabac_init(VVCLocalContext *lc, int ctu_idx, int rx, int ry)
Definition: cabac.c:842
ff_vvc_general_merge_flag
int ff_vvc_general_merge_flag(VVCLocalContext *lc)
Definition: cabac.c:1354
ctx
AVFormatContext * ctx
Definition: movenc.c:49
ff_vvc_intra_chroma_pred_mode
int ff_vvc_intra_chroma_pred_mode(VVCLocalContext *lc)
Definition: cabac.c:1347
ff_vvc_tu_cr_coded_flag
int ff_vvc_tu_cr_coded_flag(VVCLocalContext *lc, int tu_cb_coded_flag)
Definition: cabac.c:1614
ff_vvc_inter_affine_flag
int ff_vvc_inter_affine_flag(VVCLocalContext *lc)
Definition: cabac.c:1503
ff_vvc_sbt_horizontal_flag
int ff_vvc_sbt_horizontal_flag(VVCLocalContext *lc)
Definition: cabac.c:2441
IspType
IspType
Definition: ctu.h:118
VVCLocalContext
Definition: ctu.h:373
ff_vvc_abs_mvd_minus2
int ff_vvc_abs_mvd_minus2(VVCLocalContext *lc)
Definition: cabac.c:1544
ff_vvc_residual_coding
int ff_vvc_residual_coding(VVCLocalContext *lc, TransformBlock *tb)
Definition: cabac.c:2415
ff_vvc_sao_type_idx_decode
int ff_vvc_sao_type_idx_decode(VVCLocalContext *lc)
Definition: cabac.c:981
ff_vvc_merge_idx
int ff_vvc_merge_idx(VVCLocalContext *lc)
Definition: cabac.c:1444
inc
static int inc(int num, int period)
Definition: perlin.c:34
ff_vvc_pred_flag
PredFlag ff_vvc_pred_flag(VVCLocalContext *lc, int is_b)
Definition: cabac.c:1488
ff_vvc_sao_offset_sign_decode
int ff_vvc_sao_offset_sign_decode(VVCLocalContext *lc)
Definition: cabac.c:1010
ff_vvc_mts_idx
int ff_vvc_mts_idx(VVCLocalContext *lc)
Definition: cabac.c:2463
ff_vvc_abs_mvd_greater1_flag
int ff_vvc_abs_mvd_greater1_flag(VVCLocalContext *lc)
Definition: cabac.c:1539
ff_vvc_merge_subblock_idx
int ff_vvc_merge_subblock_idx(VVCLocalContext *lc, int max_num_subblock_merge_cand)
Definition: cabac.c:1376
ff_vvc_alf_luma_prev_filter_idx
int ff_vvc_alf_luma_prev_filter_idx(VVCLocalContext *lc)
Definition: cabac.c:1042
ff_vvc_intra_luma_mpm_flag
int ff_vvc_intra_luma_mpm_flag(VVCLocalContext *lc)
Definition: cabac.c:1312
ff_vvc_intra_luma_mpm_remainder
int ff_vvc_intra_luma_mpm_remainder(VVCLocalContext *lc)
Definition: cabac.c:1330
ff_vvc_intra_luma_ref_idx
int ff_vvc_intra_luma_ref_idx(VVCLocalContext *lc)
Definition: cabac.c:1290
ff_vvc_intra_bdpcm_chroma_dir_flag
int ff_vvc_intra_bdpcm_chroma_dir_flag(VVCLocalContext *lc)
Definition: cabac.c:1237
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_cu_affine_type_flag
int ff_vvc_cu_affine_type_flag(VVCLocalContext *lc)
Definition: cabac.c:1509
ff_vvc_tu_y_coded_flag
int ff_vvc_tu_y_coded_flag(VVCLocalContext *lc)
Definition: cabac.c:1619
ff_vvc_intra_luma_mpm_idx
int ff_vvc_intra_luma_mpm_idx(VVCLocalContext *lc)
Definition: cabac.c:1322
VVCAllowedSplit
Definition: ctu.h:440
ff_vvc_amvr_shift
int ff_vvc_amvr_shift(VVCLocalContext *lc, int inter_affine_flag, PredMode pred_mode, int has_amvr_flag)
Definition: cabac.c:1575
ff_vvc_cu_skip_flag
int ff_vvc_cu_skip_flag(VVCLocalContext *lc, const uint8_t *cu_skip_flag)
Definition: cabac.c:1242
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: cabac.c:1052
ff_vvc_merge_gpm_partition_idx
int ff_vvc_merge_gpm_partition_idx(VVCLocalContext *lc)
Definition: cabac.c:1459
ff_vvc_cu_qp_delta_sign_flag
int ff_vvc_cu_qp_delta_sign_flag(VVCLocalContext *lc)
Definition: cabac.c:1661
ff_vvc_mvp_lx_flag
int ff_vvc_mvp_lx_flag(VVCLocalContext *lc)
Definition: cabac.c:1554
ff_vvc_intra_bdpcm_luma_flag
int ff_vvc_intra_bdpcm_luma_flag(VVCLocalContext *lc)
Definition: cabac.c:1222
PredMode
PredMode
Definition: hevcdec.h:103
TransformBlock
Definition: ctu.h:141
ff_vvc_merge_gpm_idx
int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, int idx)
Definition: cabac.c:1469
ff_vvc_alf_ctb_flag
int ff_vvc_alf_ctb_flag(VVCLocalContext *lc, int rx, int ry, int c_idx)
Definition: cabac.c:1022
ff_vvc_ciip_flag
int ff_vvc_ciip_flag(VVCLocalContext *lc)
Definition: cabac.c:1483
Mv
Definition: hevcdec.h:301
ff_vvc_sao_offset_abs_decode
int ff_vvc_sao_offset_abs_decode(VVCLocalContext *lc)
Definition: cabac.c:1000
ff_vvc_sbt_flag
int ff_vvc_sbt_flag(VVCLocalContext *lc)
Definition: cabac.c:2428
PredFlag
PredFlag
Definition: hevcdec.h:115
ff_vvc_sao_merge_flag_decode
int ff_vvc_sao_merge_flag_decode(VVCLocalContext *lc)
Definition: cabac.c:976
ff_vvc_sym_mvd_flag
int ff_vvc_sym_mvd_flag(VVCLocalContext *lc)
Definition: cabac.c:1514
ctu.h
ff_vvc_mmvd_offset_coding
void ff_vvc_mmvd_offset_coding(VVCLocalContext *lc, Mv *mvd_offset, int ph_mmvd_fullpel_only_flag)
Definition: cabac.c:1417
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: cabac.c:1084
ff_vvc_pred_mode_plt_flag
int ff_vvc_pred_mode_plt_flag(VVCLocalContext *lc)
Definition: cabac.c:1217
ff_vvc_lfnst_idx
int ff_vvc_lfnst_idx(VVCLocalContext *lc, int inc)
Definition: cabac.c:2454
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: cabac.c:1162
ff_vvc_sao_band_position_decode
int ff_vvc_sao_band_position_decode(VVCLocalContext *lc)
Definition: cabac.c:991
ff_vvc_mmvd_cand_flag
int ff_vvc_mmvd_cand_flag(VVCLocalContext *lc)
Definition: cabac.c:1397
ff_vvc_merge_subblock_flag
int ff_vvc_merge_subblock_flag(VVCLocalContext *lc)
Definition: cabac.c:1370
ff_vvc_cu_chroma_qp_offset_flag
int ff_vvc_cu_chroma_qp_offset_flag(VVCLocalContext *lc)
Definition: cabac.c:1666