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++)
int ff_hevc_abs_mvd_greater0_flag_decode(HEVCContext *s)
static av_unused const int8_t num_bins_in_se[]
number of bin by SyntaxElement.
unsigned int log2_min_cb_size
int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0, int y0)
int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth)
int ff_hevc_sao_offset_sign_decode(HEVCContext *s)
int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx)
int ff_hevc_merge_flag_decode(HEVCContext *s)
Macro definitions for various function/variable attributes.
#define LAST_SIG_COEFF(elem)
uint8_t entropy_coding_sync_enabled_flag
int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s)
int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size)
int ff_hevc_sao_merge_flag_decode(HEVCContext *s)
int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCContext *s)
int ff_hevc_mvd_sign_flag_decode(HEVCContext *s)
int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH)
int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size)
static void cabac_init_state(HEVCContext *s)
int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s)
int ff_hevc_coeff_sign_flag(HEVCContext *s, uint8_t nb)
static int get_bits_count(const GetBitContext *s)
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb)
int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth)
int ff_hevc_last_significant_coeff_y_prefix_decode(HEVCContext *s, int c_idx, int log2_size)
static av_unused const uint8_t * skip_bytes(CABACContext *c, int n)
Skip n bytes and reset the decoder.
void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)
static int get_bits_left(GetBitContext *gb)
int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
Clip a signed integer value into the amin-amax range.
int ff_hevc_abs_mvd_greater1_flag_decode(HEVCContext *s)
static const int elem_offset[sizeof(num_bins_in_se)]
Offset to ctxIdx 0 in init_values and states, indexed by SyntaxElement.
unsigned int log2_ctb_size
int ff_hevc_coeff_abs_level_greater2_flag_decode(HEVCContext *s, int c_idx, int inc)
void av_log(void *avcl, int level, const char *fmt,...)
int ff_hevc_last_significant_coeff_x_prefix_decode(HEVCContext *s, int c_idx, int log2_size)
int ff_hevc_sao_band_position_decode(HEVCContext *s)
uint8_t tiles_enabled_flag
int ff_hevc_sao_eo_class_decode(HEVCContext *s)
uint8_t cabac_state[HEVC_CONTEXTS]
int ff_hevc_mvd_decode(HEVCContext *s)
int ff_hevc_significant_coeff_group_flag_decode(HEVCContext *s, int c_idx, int ctx_cg)
Context Adaptive Binary Arithmetic Coder inline functions.
static int av_unused get_cabac_terminate(CABACContext *c)
if(ac->has_optimized_func)
int ff_hevc_merge_idx_decode(HEVCContext *s)
int * ctb_addr_rs_to_ts
CtbAddrRSToTS.
int ff_hevc_end_of_slice_flag_decode(HEVCContext *s)
int ff_hevc_coeff_abs_level_greater1_flag_decode(HEVCContext *s, int c_idx, int inc)
enum PredMode pred_mode
PredMode.
int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s)
static void skip_bits(GetBitContext *s, int n)
int ff_hevc_significant_coeff_flag_decode(HEVCContext *s, int c_idx, int x_c, int y_c, int log2_trafo_size, int scan_idx, int prev_sig)
void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts)
int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx)
int ff_hevc_coeff_abs_level_remaining(HEVCContext *s, int base_level, int rc_rice_param)
static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val)
static int av_unused get_cabac_bypass(CABACContext *c)
static void load_states(HEVCContext *s)
int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s)
common internal and external API header
uint8_t cabac_state[HEVC_CONTEXTS]
int ff_hevc_last_significant_coeff_suffix_decode(HEVCContext *s, int last_significant_coeff_prefix)
int ff_hevc_sao_type_idx_decode(HEVCContext *s)
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size)
int ff_hevc_pred_mode_decode(HEVCContext *s)
int ff_hevc_mpm_idx_decode(HEVCContext *s)
int ff_hevc_pcm_flag_decode(HEVCContext *s)
static const uint8_t * align_get_bits(GetBitContext *s)
static void cabac_init_decoder(HEVCContext *s)
static const uint8_t init_values[3][HEVC_CONTEXTS]
Indexed by init_type.
int ff_hevc_sao_offset_abs_decode(HEVCContext *s)
static void cabac_reinit(HEVCLocalContext *lc)
int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
int ff_hevc_mvp_lx_flag_decode(HEVCContext *s)
#define SAMPLE_CTB(tab, x, y)