30 #define CABAC_MAX_BIN 100
182 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111,
185 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111,
190 111, 111, 125, 110, 110, 94, 124, 108, 124, 107, 125, 141, 179, 153,
191 125, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 140,
192 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111,
194 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107,
195 122, 152, 140, 179, 166, 182, 140, 227, 122, 197,
197 138, 153, 136, 167, 152, 152, },
245 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95,
248 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95,
253 155, 154, 139, 153, 139, 123, 123, 63, 153, 166, 183, 140, 136, 153,
254 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 170,
255 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140,
257 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
258 136, 137, 169, 194, 166, 167, 154, 167, 137, 182,
260 107, 167, 91, 122, 107, 167, },
308 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111,
311 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111,
316 170, 154, 139, 153, 139, 123, 123, 63, 124, 166, 183, 140, 136, 153,
317 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 170,
318 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140,
320 154, 196, 167, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
321 136, 122, 169, 208, 166, 167, 154, 152, 167, 182,
323 107, 167, 91, 107, 107, 167, },
366 int m = (init_value >> 4) * 5 - 45;
367 int n = ((init_value & 15) << 3) - 16;
372 pre = 124 + (pre & 1);
415 #define GET_CABAC(ctx) get_cabac(&s->HEVClc.cc, &s->HEVClc.cabac_state[ctx])
437 for (i = 0; i < 4; i++)
499 if (prefix_val >= 5) {
502 suffix_val += 1 << k;
511 return prefix_val + suffix_val;
526 int inc = 0, depth_left = 0, depth_top = 0;
537 inc += (depth_left > ct_depth);
538 inc += (depth_top > ct_depth);
552 if (log2_cb_size == 3)
603 for (i = 0; i < 4; i++)
637 if (nPbW + nPbH == 12)
648 int max = num_ref_idx_lx - 1;
649 int max_ctx =
FFMIN(max, 2);
722 #define LAST_SIG_COEFF(elem) \
724 int max = (log2_size << 1) - 1; \
725 int ctx_offset, ctx_shift; \
728 ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2); \
729 ctx_shift = (log2_size + 1) >> 2; \
732 ctx_shift = log2_size - 2; \
735 GET_CABAC(elem_offset[elem] + (i >> ctx_shift) + ctx_offset)) \
752 int last_significant_coeff_prefix)
755 int length = (last_significant_coeff_prefix >> 1) - 1;
758 for (i = 1; i < length; i++)
767 inc =
FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0);
773 int log2_trafo_size,
int scan_idx,
int prev_sig)
775 static const uint8_t ctx_idx_map[] = {
776 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8
782 if (x_c + y_c == 0) {
784 }
else if (log2_trafo_size == 2) {
785 sig_ctx = ctx_idx_map[(y_c << 2) + x_c];
791 sig_ctx = ((x_off + y_off) == 0) ? 2 : ((x_off + y_off) <= 2) ? 1 : 0;
795 sig_ctx = 2 -
FFMIN(y_c & 3, 2);
798 sig_ctx = 2 -
FFMIN(x_c & 3, 2);
804 if (c_idx == 0 && (x_cg > 0 || y_cg > 0))
807 if (log2_trafo_size == 3) {
808 sig_ctx += (scan_idx ==
SCAN_DIAG) ? 9 : 15;
810 sig_ctx += c_idx ? 12 : 21;
843 int last_coeff_abs_level_remaining;
851 for (i = 0; i < rc_rice_param; i++)
853 last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix;
855 int prefix_minus3 = prefix - 3;
856 for (i = 0; i < prefix_minus3 + rc_rice_param; i++)
858 last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1)
859 << rc_rice_param) + suffix;
861 return last_coeff_abs_level_remaining;
869 for (i = 0; i < nb; i++)