History

avcodec/hevc_cabac: Let compiler count offsets

This is easily possible with an X macro. Using an enum for the offsets also allows to remove two arrays which are not really needed and will typically be optimized away by the compiler: The first just exists to count the number of syntax elements*, the second one exists to get offset[CONSTANT]. These constants were of type enum SyntaxElement and this enum was only used in hevc_cabac.c (although it was declared in hevcdec.h); it is now no longer needed at all and has therefore been removed. The first of these arrays led to a warning from Clang which is fixed by this commit: warning: variable 'num_bins_in_se' is not needed and will not be emitted [-Wunneeded-internal-declaration] *: One could also just added a trailing SYNTAX_ELEMENT_NB to the SyntaxElement enum for this purpose.

Andreas Rheinhardt committed 2 years ago

Commit c1cdaef1 parent 98a2ade2 files · +100 −200Browse files

Unified · Split

2 files
  1. libavcodec/hevc_cabac.c +100 −148
  2. libavcodec/hevcdec.h +0 −52
libavcodec/hevc_cabac.c+100−148
@@ -31,114 +31,66 @@ · 30 unmodified lines
3131
3232 #define CABAC_MAX_BIN 31
3333
34−/**
35− * number of bin by SyntaxElement.
36− */
37−static const int8_t num_bins_in_se[] = {
38− 1, // sao_merge_flag
39− 1, // sao_type_idx
40− 0, // sao_eo_class
41− 0, // sao_band_position
42− 0, // sao_offset_abs
43− 0, // sao_offset_sign
44− 0, // end_of_slice_flag
45− 3, // split_coding_unit_flag
46− 1, // cu_transquant_bypass_flag
47− 3, // skip_flag
48− 3, // cu_qp_delta
49− 1, // pred_mode
50− 4, // part_mode
51− 0, // pcm_flag
52− 1, // prev_intra_luma_pred_mode
53− 0, // mpm_idx
54− 0, // rem_intra_luma_pred_mode
55− 2, // intra_chroma_pred_mode
56− 1, // merge_flag
57− 1, // merge_idx
58− 5, // inter_pred_idc
59− 2, // ref_idx_l0
60− 2, // ref_idx_l1
61− 2, // abs_mvd_greater0_flag
62− 2, // abs_mvd_greater1_flag
63− 0, // abs_mvd_minus2
64− 0, // mvd_sign_flag
65− 1, // mvp_lx_flag
66− 1, // no_residual_data_flag
67− 3, // split_transform_flag
68− 2, // cbf_luma
69− 5, // cbf_cb, cbf_cr
70− 2, // transform_skip_flag[][]
71− 2, // explicit_rdpcm_flag[][]
72− 2, // explicit_rdpcm_dir_flag[][]
73− 18, // last_significant_coeff_x_prefix
74− 18, // last_significant_coeff_y_prefix
75− 0, // last_significant_coeff_x_suffix
76− 0, // last_significant_coeff_y_suffix
77− 4, // significant_coeff_group_flag
78− 44, // significant_coeff_flag
79− 24, // coeff_abs_level_greater1_flag
80− 6, // coeff_abs_level_greater2_flag
81− 0, // coeff_abs_level_remaining
82− 0, // coeff_sign_flag
83− 8, // log2_res_scale_abs
84− 2, // res_scale_sign_flag
85− 1, // cu_chroma_qp_offset_flag
86− 1, // cu_chroma_qp_offset_idx
87−};
34+// ELEM(NAME, NUM_BINS)
35+#define CABAC_ELEMS(ELEM) \
36+ ELEM(SAO_MERGE_FLAG, 1) \
37+ ELEM(SAO_TYPE_IDX, 1) \
38+ ELEM(SAO_EO_CLASS, 0) \
39+ ELEM(SAO_BAND_POSITION, 0) \
40+ ELEM(SAO_OFFSET_ABS, 0) \
41+ ELEM(SAO_OFFSET_SIGN, 0) \
42+ ELEM(END_OF_SLICE_FLAG, 0) \
43+ ELEM(SPLIT_CODING_UNIT_FLAG, 3) \
44+ ELEM(CU_TRANSQUANT_BYPASS_FLAG, 1) \
45+ ELEM(SKIP_FLAG, 3) \
46+ ELEM(CU_QP_DELTA, 3) \
47+ ELEM(PRED_MODE_FLAG, 1) \
48+ ELEM(PART_MODE, 4) \
49+ ELEM(PCM_FLAG, 0) \
50+ ELEM(PREV_INTRA_LUMA_PRED_FLAG, 1) \
51+ ELEM(MPM_IDX, 0) \
52+ ELEM(REM_INTRA_LUMA_PRED_MODE, 0) \
53+ ELEM(INTRA_CHROMA_PRED_MODE, 2) \
54+ ELEM(MERGE_FLAG, 1) \
55+ ELEM(MERGE_IDX, 1) \
56+ ELEM(INTER_PRED_IDC, 5) \
57+ ELEM(REF_IDX_L0, 2) \
58+ ELEM(REF_IDX_L1, 2) \
59+ ELEM(ABS_MVD_GREATER0_FLAG, 2) \
60+ ELEM(ABS_MVD_GREATER1_FLAG, 2) \
61+ ELEM(ABS_MVD_MINUS2, 0) \
62+ ELEM(MVD_SIGN_FLAG, 0) \
63+ ELEM(MVP_LX_FLAG, 1) \
64+ ELEM(NO_RESIDUAL_DATA_FLAG, 1) \
65+ ELEM(SPLIT_TRANSFORM_FLAG, 3) \
66+ ELEM(CBF_LUMA, 2) \
67+ ELEM(CBF_CB_CR, 5) \
68+ ELEM(TRANSFORM_SKIP_FLAG, 2) \
69+ ELEM(EXPLICIT_RDPCM_FLAG, 2) \
70+ ELEM(EXPLICIT_RDPCM_DIR_FLAG, 2) \
71+ ELEM(LAST_SIGNIFICANT_COEFF_X_PREFIX, 18) \
72+ ELEM(LAST_SIGNIFICANT_COEFF_Y_PREFIX, 18) \
73+ ELEM(LAST_SIGNIFICANT_COEFF_X_SUFFIX, 0) \
74+ ELEM(LAST_SIGNIFICANT_COEFF_Y_SUFFIX, 0) \
75+ ELEM(SIGNIFICANT_COEFF_GROUP_FLAG, 4) \
76+ ELEM(SIGNIFICANT_COEFF_FLAG, 44) \
77+ ELEM(COEFF_ABS_LEVEL_GREATER1_FLAG, 24) \
78+ ELEM(COEFF_ABS_LEVEL_GREATER2_FLAG, 6) \
79+ ELEM(COEFF_ABS_LEVEL_REMAINING, 0) \
80+ ELEM(COEFF_SIGN_FLAG, 0) \
81+ ELEM(LOG2_RES_SCALE_ABS, 8) \
82+ ELEM(RES_SCALE_SIGN_FLAG, 2) \
83+ ELEM(CU_CHROMA_QP_OFFSET_FLAG, 1) \
84+ ELEM(CU_CHROMA_QP_OFFSET_IDX, 1) \
8885
8986 /**
90− * Offset to ctxIdx 0 in init_values and states, indexed by SyntaxElement.
87+ * Offset to ctxIdx 0 in init_values and states.
9188 */
92−static const int elem_offset[sizeof(num_bins_in_se)] = {
93− 0, // sao_merge_flag
94− 1, // sao_type_idx
95− 2, // sao_eo_class
96− 2, // sao_band_position
97− 2, // sao_offset_abs
98− 2, // sao_offset_sign
99− 2, // end_of_slice_flag
100− 2, // split_coding_unit_flag
101− 5, // cu_transquant_bypass_flag
102− 6, // skip_flag
103− 9, // cu_qp_delta
104− 12, // pred_mode
105− 13, // part_mode
106− 17, // pcm_flag
107− 17, // prev_intra_luma_pred_mode
108− 18, // mpm_idx
109− 18, // rem_intra_luma_pred_mode
110− 18, // intra_chroma_pred_mode
111− 20, // merge_flag
112− 21, // merge_idx
113− 22, // inter_pred_idc
114− 27, // ref_idx_l0
115− 29, // ref_idx_l1
116− 31, // abs_mvd_greater0_flag
117− 33, // abs_mvd_greater1_flag
118− 35, // abs_mvd_minus2
119− 35, // mvd_sign_flag
120− 35, // mvp_lx_flag
121− 36, // no_residual_data_flag
122− 37, // split_transform_flag
123− 40, // cbf_luma
124− 42, // cbf_cb, cbf_cr
125− 47, // transform_skip_flag[][]
126− 49, // explicit_rdpcm_flag[][]
127− 51, // explicit_rdpcm_dir_flag[][]
128− 53, // last_significant_coeff_x_prefix
129− 71, // last_significant_coeff_y_prefix
130− 89, // last_significant_coeff_x_suffix
131− 89, // last_significant_coeff_y_suffix
132− 89, // significant_coeff_group_flag
133− 93, // significant_coeff_flag
134− 137, // coeff_abs_level_greater1_flag
135− 161, // coeff_abs_level_greater2_flag
136− 167, // coeff_abs_level_remaining
137− 167, // coeff_sign_flag
138− 167, // log2_res_scale_abs
139− 175, // res_scale_sign_flag
140− 177, // cu_chroma_qp_offset_flag
141− 178, // cu_chroma_qp_offset_idx
89+enum {
90+#define OFFSET(NAME, NUM_BINS) \
91+ NAME ## _OFFSET, \
92+ NAME ## _END = NAME ## _OFFSET + NUM_BINS - 1,
93+CABAC_ELEMS(OFFSET)
14294 };
14395
14496 #define CNU 154
@@ -570,12 +522,12 @@ int ff_hevc_cabac_init(HEVCLocalContext *lc, int ctb_addr_ts) · 425 unmodified lines
570522
571523 int ff_hevc_sao_merge_flag_decode(HEVCLocalContext *lc)
572524 {
573− return GET_CABAC(elem_offset[SAO_MERGE_FLAG]);
525+ return GET_CABAC(SAO_MERGE_FLAG_OFFSET);
574526 }
575527
576528 int ff_hevc_sao_type_idx_decode(HEVCLocalContext *lc)
577529 {
578− if (!GET_CABAC(elem_offset[SAO_TYPE_IDX]))
530+ if (!GET_CABAC(SAO_TYPE_IDX_OFFSET))
579531 return 0;
580532
581533 if (!get_cabac_bypass(&lc->cc))
@@ -622,7 +574,7 @@ int ff_hevc_end_of_slice_flag_decode(HEVCLocalContext *lc) · 40 unmodified lines
622574
623575 int ff_hevc_cu_transquant_bypass_flag_decode(HEVCLocalContext *lc)
624576 {
625− return GET_CABAC(elem_offset[CU_TRANSQUANT_BYPASS_FLAG]);
577+ return GET_CABAC(CU_TRANSQUANT_BYPASS_FLAG_OFFSET);
626578 }
627579
628580 int ff_hevc_skip_flag_decode(HEVCLocalContext *lc, int x0, int y0, int x_cb, int y_cb)
@@ -638,7 +590,7 @@ int ff_hevc_skip_flag_decode(HEVCLocalContext *lc, int x0, int y0, int x_cb, int · 9 unmodified lines
638590 if (lc->ctb_up_flag || y0b)
639591 inc += !!SAMPLE_CTB(s->skip_flag, x_cb, y_cb - 1);
640592
641− return GET_CABAC(elem_offset[SKIP_FLAG] + inc);
593+ return GET_CABAC(SKIP_FLAG_OFFSET + inc);
642594 }
643595
644596 int ff_hevc_cu_qp_delta_abs(HEVCLocalContext *lc)
@@ -647,7 +599,7 @@ int ff_hevc_cu_qp_delta_abs(HEVCLocalContext *lc) · 2 unmodified lines
647599 int suffix_val = 0;
648600 int inc = 0;
649601
650− while (prefix_val < 5 && GET_CABAC(elem_offset[CU_QP_DELTA] + inc)) {
602+ while (prefix_val < 5 && GET_CABAC(CU_QP_DELTA_OFFSET + inc)) {
651603 prefix_val++;
652604 inc = 1;
653605 }
@@ -675,7 +627,7 @@ int ff_hevc_cu_qp_delta_sign_flag(HEVCLocalContext *lc) · 21 unmodified lines
675627
676628 int ff_hevc_cu_chroma_qp_offset_flag(HEVCLocalContext *lc)
677629 {
678− return GET_CABAC(elem_offset[CU_CHROMA_QP_OFFSET_FLAG]);
630+ return GET_CABAC(CU_CHROMA_QP_OFFSET_FLAG_OFFSET);
679631 }
680632
681633 int ff_hevc_cu_chroma_qp_offset_idx(HEVCLocalContext *lc)
@@ -683,7 +635,7 @@ int ff_hevc_cu_chroma_qp_offset_idx(HEVCLocalContext *lc) · 1 unmodified line
683635 int c_max= FFMAX(5, lc->parent->ps.pps->chroma_qp_offset_list_len_minus1);
684636 int i = 0;
685637
686− while (i < c_max && GET_CABAC(elem_offset[CU_CHROMA_QP_OFFSET_IDX]))
638+ while (i < c_max && GET_CABAC(CU_CHROMA_QP_OFFSET_IDX_OFFSET))
687639 i++;
688640
689641 return i;
@@ -691,7 +643,7 @@ int ff_hevc_cu_chroma_qp_offset_idx(HEVCLocalContext *lc) · 1 unmodified line
691643
692644 int ff_hevc_pred_mode_decode(HEVCLocalContext *lc)
693645 {
694− return GET_CABAC(elem_offset[PRED_MODE_FLAG]);
646+ return GET_CABAC(PRED_MODE_FLAG_OFFSET);
695647 }
696648
697649 int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, int ct_depth, int x0, int y0)
@@ -712,40 +664,40 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, int ct_depth, in · 14 unmodified lines
712664 inc += (depth_left > ct_depth);
713665 inc += (depth_top > ct_depth);
714666
715− return GET_CABAC(elem_offset[SPLIT_CODING_UNIT_FLAG] + inc);
667+ return GET_CABAC(SPLIT_CODING_UNIT_FLAG_OFFSET + inc);
716668 }
717669
718670 int ff_hevc_part_mode_decode(HEVCLocalContext *lc, int log2_cb_size)
719671 {
720− if (GET_CABAC(elem_offset[PART_MODE])) // 1
672+ if (GET_CABAC(PART_MODE_OFFSET)) // 1
721673 return PART_2Nx2N;
722674 if (log2_cb_size == lc->parent->ps.sps->log2_min_cb_size) {
723675 if (lc->cu.pred_mode == MODE_INTRA) // 0
724676 return PART_NxN;
725− if (GET_CABAC(elem_offset[PART_MODE] + 1)) // 01
677+ if (GET_CABAC(PART_MODE_OFFSET + 1)) // 01
726678 return PART_2NxN;
727679 if (log2_cb_size == 3) // 00
728680 return PART_Nx2N;
729− if (GET_CABAC(elem_offset[PART_MODE] + 2)) // 001
681+ if (GET_CABAC(PART_MODE_OFFSET + 2)) // 001
730682 return PART_Nx2N;
731683 return PART_NxN; // 000
732684 }
733685
734686 if (!lc->parent->ps.sps->amp_enabled_flag) {
735− if (GET_CABAC(elem_offset[PART_MODE] + 1)) // 01
687+ if (GET_CABAC(PART_MODE_OFFSET + 1)) // 01
736688 return PART_2NxN;
737689 return PART_Nx2N;
738690 }
739691
740− if (GET_CABAC(elem_offset[PART_MODE] + 1)) { // 01X, 01XX
741− if (GET_CABAC(elem_offset[PART_MODE] + 3)) // 011
692+ if (GET_CABAC(PART_MODE_OFFSET + 1)) { // 01X, 01XX
693+ if (GET_CABAC(PART_MODE_OFFSET + 3)) // 011
742694 return PART_2NxN;
743695 if (get_cabac_bypass(&lc->cc)) // 0101
744696 return PART_2NxnD;
745697 return PART_2NxnU; // 0100
746698 }
747699
748− if (GET_CABAC(elem_offset[PART_MODE] + 3)) // 001
700+ if (GET_CABAC(PART_MODE_OFFSET + 3)) // 001
749701 return PART_Nx2N;
750702 if (get_cabac_bypass(&lc->cc)) // 0001
751703 return PART_nRx2N;
@@ -759,7 +711,7 @@ int ff_hevc_pcm_flag_decode(HEVCLocalContext *lc) · 7 unmodified lines
759711
760712 int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCLocalContext *lc)
761713 {
762− return GET_CABAC(elem_offset[PREV_INTRA_LUMA_PRED_FLAG]);
714+ return GET_CABAC(PREV_INTRA_LUMA_PRED_FLAG_OFFSET);
763715 }
764716
765717 int ff_hevc_mpm_idx_decode(HEVCLocalContext *lc)
@@ -783,7 +735,7 @@ int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCLocalContext *lc) · 17 unmodified lines
783735 int ff_hevc_intra_chroma_pred_mode_decode(HEVCLocalContext *lc)
784736 {
785737 int ret;
786− if (!GET_CABAC(elem_offset[INTRA_CHROMA_PRED_MODE]))
738+ if (!GET_CABAC(INTRA_CHROMA_PRED_MODE_OFFSET))
787739 return 4;
788740
789741 ret = get_cabac_bypass(&lc->cc) << 1;
@@ -793,7 +745,7 @@ int ff_hevc_intra_chroma_pred_mode_decode(HEVCLocalContext *lc) · 3 unmodified lines
793745
794746 int ff_hevc_merge_idx_decode(HEVCLocalContext *lc)
795747 {
796− int i = GET_CABAC(elem_offset[MERGE_IDX]);
748+ int i = GET_CABAC(MERGE_IDX_OFFSET);
797749
798750 if (i != 0) {
799751 while (i < lc->parent->sh.max_num_merge_cand-1 && get_cabac_bypass(&lc->cc))
@@ -804,17 +756,17 @@ int ff_hevc_merge_idx_decode(HEVCLocalContext *lc) · 4 unmodified lines
804756
805757 int ff_hevc_merge_flag_decode(HEVCLocalContext *lc)
806758 {
807− return GET_CABAC(elem_offset[MERGE_FLAG]);
759+ return GET_CABAC(MERGE_FLAG_OFFSET);
808760 }
809761
810762 int ff_hevc_inter_pred_idc_decode(HEVCLocalContext *lc, int nPbW, int nPbH)
811763 {
812764 if (nPbW + nPbH == 12)
813− return GET_CABAC(elem_offset[INTER_PRED_IDC] + 4);
814− if (GET_CABAC(elem_offset[INTER_PRED_IDC] + lc->ct_depth))
765+ return GET_CABAC(INTER_PRED_IDC_OFFSET + 4);
766+ if (GET_CABAC(INTER_PRED_IDC_OFFSET + lc->ct_depth))
815767 return PRED_BI;
816768
817− return GET_CABAC(elem_offset[INTER_PRED_IDC] + 4);
769+ return GET_CABAC(INTER_PRED_IDC_OFFSET + 4);
818770 }
819771
820772 int ff_hevc_ref_idx_lx_decode(HEVCLocalContext *lc, int num_ref_idx_lx)
@@ -823,7 +775,7 @@ int ff_hevc_ref_idx_lx_decode(HEVCLocalContext *lc, int num_ref_idx_lx) · 2 unmodified lines
823775 int max = num_ref_idx_lx - 1;
824776 int max_ctx = FFMIN(max, 2);
825777
826− while (i < max_ctx && GET_CABAC(elem_offset[REF_IDX_L0] + i))
778+ while (i < max_ctx && GET_CABAC(REF_IDX_L0_OFFSET + i))
827779 i++;
828780 if (i == 2) {
829781 while (i < max && get_cabac_bypass(&lc->cc))
@@ -835,22 +787,22 @@ int ff_hevc_ref_idx_lx_decode(HEVCLocalContext *lc, int num_ref_idx_lx) · 5 unmodified lines
835787
836788 int ff_hevc_mvp_lx_flag_decode(HEVCLocalContext *lc)
837789 {
838− return GET_CABAC(elem_offset[MVP_LX_FLAG]);
790+ return GET_CABAC(MVP_LX_FLAG_OFFSET);
839791 }
840792
841793 int ff_hevc_no_residual_syntax_flag_decode(HEVCLocalContext *lc)
842794 {
843− return GET_CABAC(elem_offset[NO_RESIDUAL_DATA_FLAG]);
795+ return GET_CABAC(NO_RESIDUAL_DATA_FLAG_OFFSET);
844796 }
845797
846798 static av_always_inline int abs_mvd_greater0_flag_decode(HEVCLocalContext *lc)
847799 {
848− return GET_CABAC(elem_offset[ABS_MVD_GREATER0_FLAG]);
800+ return GET_CABAC(ABS_MVD_GREATER0_FLAG_OFFSET);
849801 }
850802
851803 static av_always_inline int abs_mvd_greater1_flag_decode(HEVCLocalContext *lc)
852804 {
853− return GET_CABAC(elem_offset[ABS_MVD_GREATER1_FLAG] + 1);
805+ return GET_CABAC(ABS_MVD_GREATER1_FLAG_OFFSET + 1);
854806 }
855807
856808 static av_always_inline int mvd_decode(HEVCLocalContext *lc)
@@ -878,39 +830,39 @@ static av_always_inline int mvd_sign_flag_decode(HEVCLocalContext *lc) · 21 unmodified lines
878830
879831 int ff_hevc_split_transform_flag_decode(HEVCLocalContext *lc, int log2_trafo_size)
880832 {
881− return GET_CABAC(elem_offset[SPLIT_TRANSFORM_FLAG] + 5 - log2_trafo_size);
833+ return GET_CABAC(SPLIT_TRANSFORM_FLAG_OFFSET + 5 - log2_trafo_size);
882834 }
883835
884836 int ff_hevc_cbf_cb_cr_decode(HEVCLocalContext *lc, int trafo_depth)
885837 {
886− return GET_CABAC(elem_offset[CBF_CB_CR] + trafo_depth);
838+ return GET_CABAC(CBF_CB_CR_OFFSET + trafo_depth);
887839 }
888840
889841 int ff_hevc_cbf_luma_decode(HEVCLocalContext *lc, int trafo_depth)
890842 {
891− return GET_CABAC(elem_offset[CBF_LUMA] + !trafo_depth);
843+ return GET_CABAC(CBF_LUMA_OFFSET + !trafo_depth);
892844 }
893845
894846 static int hevc_transform_skip_flag_decode(HEVCLocalContext *lc, int c_idx)
895847 {
896− return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + !!c_idx);
848+ return GET_CABAC(TRANSFORM_SKIP_FLAG_OFFSET + !!c_idx);
897849 }
898850
899851 static int explicit_rdpcm_flag_decode(HEVCLocalContext *lc, int c_idx)
900852 {
901− return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + !!c_idx);
853+ return GET_CABAC(EXPLICIT_RDPCM_FLAG_OFFSET + !!c_idx);
902854 }
903855
904856 static int explicit_rdpcm_dir_flag_decode(HEVCLocalContext *lc, int c_idx)
905857 {
906− return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + !!c_idx);
858+ return GET_CABAC(EXPLICIT_RDPCM_DIR_FLAG_OFFSET + !!c_idx);
907859 }
908860
909861 int ff_hevc_log2_res_scale_abs(HEVCLocalContext *lc, int idx)
910862 {
911863 int i =0;
912864
913− while (i < 4 && GET_CABAC(elem_offset[LOG2_RES_SCALE_ABS] + 4 * idx + i))
865+ while (i < 4 && GET_CABAC(LOG2_RES_SCALE_ABS_OFFSET + 4 * idx + i))
914866 i++;
915867
916868 return i;
@@ -918,7 +870,7 @@ int ff_hevc_log2_res_scale_abs(HEVCLocalContext *lc, int idx) · 1 unmodified line
918870
919871 int ff_hevc_res_scale_sign_flag(HEVCLocalContext *lc, int idx)
920872 {
921− return GET_CABAC(elem_offset[RES_SCALE_SIGN_FLAG] + idx);
873+ return GET_CABAC(RES_SCALE_SIGN_FLAG_OFFSET + idx);
922874 }
923875
924876 static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCLocalContext *lc, int c_idx,
@@ -936,13 +888,13 @@ static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCLocalCo · 11 unmodified lines
936888 ctx_shift = log2_size - 2;
937889 }
938890 while (i < max &&
939− GET_CABAC(elem_offset[LAST_SIGNIFICANT_COEFF_X_PREFIX] + (i >> ctx_shift) + ctx_offset))
891+ GET_CABAC(LAST_SIGNIFICANT_COEFF_X_PREFIX_OFFSET + (i >> ctx_shift) + ctx_offset))
940892 i++;
941893 *last_scx_prefix = i;
942894
943895 i = 0;
944896 while (i < max &&
945− GET_CABAC(elem_offset[LAST_SIGNIFICANT_COEFF_Y_PREFIX] + (i >> ctx_shift) + ctx_offset))
897+ GET_CABAC(LAST_SIGNIFICANT_COEFF_Y_PREFIX_OFFSET + (i >> ctx_shift) + ctx_offset))
946898 i++;
947899 *last_scy_prefix = i;
948900 }
@@ -965,18 +917,18 @@ static av_always_inline int significant_coeff_group_flag_decode(HEVCLocalContext · 16 unmodified lines
965917
966918 inc = FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0);
967919
968− return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_GROUP_FLAG] + inc);
920+ return GET_CABAC(SIGNIFICANT_COEFF_GROUP_FLAG_OFFSET + inc);
969921 }
970922 static av_always_inline int significant_coeff_flag_decode(HEVCLocalContext *lc, int x_c, int y_c,
971923 int offset, const uint8_t *ctx_idx_map)
972924 {
973925 int inc = ctx_idx_map[(y_c << 2) + x_c] + offset;
974− return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + inc);
926+ return GET_CABAC(SIGNIFICANT_COEFF_FLAG_OFFSET + inc);
975927 }
976928
977929 static av_always_inline int significant_coeff_flag_decode_0(HEVCLocalContext *lc, int c_idx, int offset)
978930 {
979− return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + offset);
931+ return GET_CABAC(SIGNIFICANT_COEFF_FLAG_OFFSET + offset);
980932 }
981933
982934 static av_always_inline int coeff_abs_level_greater1_flag_decode(HEVCLocalContext *lc, int c_idx, int inc)
@@ -985,7 +937,7 @@ static av_always_inline int coeff_abs_level_greater1_flag_decode(HEVCLocalContex · 2 unmodified lines
985937 if (c_idx > 0)
986938 inc += 16;
987939
988− return GET_CABAC(elem_offset[COEFF_ABS_LEVEL_GREATER1_FLAG] + inc);
940+ return GET_CABAC(COEFF_ABS_LEVEL_GREATER1_FLAG_OFFSET + inc);
989941 }
990942
991943 static av_always_inline int coeff_abs_level_greater2_flag_decode(HEVCLocalContext *lc, int c_idx, int inc)
@@ -993,7 +945,7 @@ static av_always_inline int coeff_abs_level_greater2_flag_decode(HEVCLocalContex · 1 unmodified line
993945 if (c_idx > 0)
994946 inc += 4;
995947
996− return GET_CABAC(elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + inc);
948+ return GET_CABAC(COEFF_ABS_LEVEL_GREATER2_FLAG_OFFSET + inc);
997949 }
998950
999951 static av_always_inline int coeff_abs_level_remaining_decode(HEVCLocalContext *lc, int rc_rice_param)
libavcodec/hevcdec.h+0−52
@@ -86,58 +86,6 @@ enum RPSType { · 85 unmodified lines
8686 NB_RPS_TYPE,
8787 };
8888
89−enum SyntaxElement {
90− SAO_MERGE_FLAG = 0,
91− SAO_TYPE_IDX,
92− SAO_EO_CLASS,
93− SAO_BAND_POSITION,
94− SAO_OFFSET_ABS,
95− SAO_OFFSET_SIGN,
96− END_OF_SLICE_FLAG,
97− SPLIT_CODING_UNIT_FLAG,
98− CU_TRANSQUANT_BYPASS_FLAG,
99− SKIP_FLAG,
100− CU_QP_DELTA,
101− PRED_MODE_FLAG,
102− PART_MODE,
103− PCM_FLAG,
104− PREV_INTRA_LUMA_PRED_FLAG,
105− MPM_IDX,
106− REM_INTRA_LUMA_PRED_MODE,
107− INTRA_CHROMA_PRED_MODE,
108− MERGE_FLAG,
109− MERGE_IDX,
110− INTER_PRED_IDC,
111− REF_IDX_L0,
112− REF_IDX_L1,
113− ABS_MVD_GREATER0_FLAG,
114− ABS_MVD_GREATER1_FLAG,
115− ABS_MVD_MINUS2,
116− MVD_SIGN_FLAG,
117− MVP_LX_FLAG,
118− NO_RESIDUAL_DATA_FLAG,
119− SPLIT_TRANSFORM_FLAG,
120− CBF_LUMA,
121− CBF_CB_CR,
122− TRANSFORM_SKIP_FLAG,
123− EXPLICIT_RDPCM_FLAG,
124− EXPLICIT_RDPCM_DIR_FLAG,
125− LAST_SIGNIFICANT_COEFF_X_PREFIX,
126− LAST_SIGNIFICANT_COEFF_Y_PREFIX,
127− LAST_SIGNIFICANT_COEFF_X_SUFFIX,
128− LAST_SIGNIFICANT_COEFF_Y_SUFFIX,
129− SIGNIFICANT_COEFF_GROUP_FLAG,
130− SIGNIFICANT_COEFF_FLAG,
131− COEFF_ABS_LEVEL_GREATER1_FLAG,
132− COEFF_ABS_LEVEL_GREATER2_FLAG,
133− COEFF_ABS_LEVEL_REMAINING,
134− COEFF_SIGN_FLAG,
135− LOG2_RES_SCALE_ABS,
136− RES_SCALE_SIGN_FLAG,
137− CU_CHROMA_QP_OFFSET_FLAG,
138− CU_CHROMA_QP_OFFSET_IDX,
139−};
140−
14189 enum PartMode {
14290 PART_2Nx2N = 0,
14391 PART_2NxN = 1,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t