From 70ad66805608f711f493a31e19554992206a8f31 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Mon, 20 Jul 2015 14:04:21 -0700 Subject: [PATCH] vpx_dsp/prob.h: vp9_ -> vpx_ change prefix vp9_ to vpx_ for non codec specific functions and data structures. Change-Id: I97c7e6422eceea99212b93f4942bc2187763a07c --- vp9/common/vp9_entropy.c | 2 +- vp9/common/vp9_entropy.h | 4 ++-- vp9/common/vp9_entropymode.c | 18 ++++++++--------- vp9/common/vp9_entropymode.h | 8 ++++---- vp9/common/vp9_entropymv.c | 18 ++++++++--------- vp9/common/vp9_entropymv.h | 8 ++++---- vp9/common/vp9_seg_common.c | 2 +- vp9/common/vp9_seg_common.h | 2 +- vp9/encoder/vp9_bitstream.c | 2 +- vp9/encoder/vp9_cost.c | 8 ++++---- vp9/encoder/vp9_cost.h | 12 ++++++------ vp9/encoder/vp9_encodemv.c | 2 +- vp9/encoder/vp9_tokenize.c | 38 ++++++++++++++++++------------------ vp9/encoder/vp9_tokenize.h | 4 ++-- vp9/encoder/vp9_treewriter.c | 10 +++++----- vp9/encoder/vp9_treewriter.h | 10 +++++----- vpx_dsp/bitreader.h | 6 +++--- vpx_dsp/bitwriter.h | 2 +- vpx_dsp/prob.c | 6 +++--- vpx_dsp/prob.h | 12 ++++++------ 20 files changed, 87 insertions(+), 87 deletions(-) diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c index c5668bdcc..579857bc9 100644 --- a/vp9/common/vp9_entropy.c +++ b/vp9/common/vp9_entropy.c @@ -16,7 +16,7 @@ #include "vpx/vpx_integer.h" // Unconstrained Node Tree -const vp9_tree_index vp9_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)] = { +const vpx_tree_index vp9_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)] = { 2, 6, // 0 = LOW_VAL -TWO_TOKEN, 4, // 1 = TWO -THREE_TOKEN, -FOUR_TOKEN, // 2 = THREE diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h index 4e7b9f9c8..a1746bcef 100644 --- a/vp9/common/vp9_entropy.h +++ b/vp9/common/vp9_entropy.h @@ -76,7 +76,7 @@ DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat6_prob_high12[18]); #define EOB_MODEL_TOKEN 3 typedef struct { - const vp9_tree_index *tree; + const vpx_tree_index *tree; const vpx_prob *prob; int len; int base_val; @@ -160,7 +160,7 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) { #define PIVOT_NODE 2 // which node is pivot #define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES) -extern const vp9_tree_index vp9_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)]; +extern const vpx_tree_index vp9_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)]; extern const vpx_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES]; typedef vpx_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS] diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c index 9a1aaf836..670348baf 100644 --- a/vp9/common/vp9_entropymode.c +++ b/vp9/common/vp9_entropymode.c @@ -220,7 +220,7 @@ static const vpx_prob default_inter_mode_probs[INTER_MODE_CONTEXTS] }; /* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */ -const vp9_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = { +const vpx_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = { -DC_PRED, 2, /* 0 = DC_NODE */ -TM_PRED, 4, /* 1 = TM_NODE */ -V_PRED, 6, /* 2 = V_NODE */ @@ -232,13 +232,13 @@ const vp9_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = { -D153_PRED, -D207_PRED /* 8 = D153_NODE */ }; -const vp9_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)] = { +const vpx_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)] = { -INTER_OFFSET(ZEROMV), 2, -INTER_OFFSET(NEARESTMV), 4, -INTER_OFFSET(NEARMV), -INTER_OFFSET(NEWMV) }; -const vp9_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)] = { +const vpx_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)] = { -PARTITION_NONE, 2, -PARTITION_HORZ, 4, -PARTITION_VERT, -PARTITION_SPLIT @@ -328,7 +328,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { vp9_copy(fc->inter_mode_probs, default_inter_mode_probs); } -const vp9_tree_index vp9_switchable_interp_tree +const vpx_tree_index vp9_switchable_interp_tree [TREE_SIZE(SWITCHABLE_FILTERS)] = { -EIGHTTAP, 2, -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP @@ -355,24 +355,24 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) { pre_fc->single_ref_prob[i][j], counts->single_ref[i][j]); for (i = 0; i < INTER_MODE_CONTEXTS; i++) - vp9_tree_merge_probs(vp9_inter_mode_tree, pre_fc->inter_mode_probs[i], + vpx_tree_merge_probs(vp9_inter_mode_tree, pre_fc->inter_mode_probs[i], counts->inter_mode[i], fc->inter_mode_probs[i]); for (i = 0; i < BLOCK_SIZE_GROUPS; i++) - vp9_tree_merge_probs(vp9_intra_mode_tree, pre_fc->y_mode_prob[i], + vpx_tree_merge_probs(vp9_intra_mode_tree, pre_fc->y_mode_prob[i], counts->y_mode[i], fc->y_mode_prob[i]); for (i = 0; i < INTRA_MODES; ++i) - vp9_tree_merge_probs(vp9_intra_mode_tree, pre_fc->uv_mode_prob[i], + vpx_tree_merge_probs(vp9_intra_mode_tree, pre_fc->uv_mode_prob[i], counts->uv_mode[i], fc->uv_mode_prob[i]); for (i = 0; i < PARTITION_CONTEXTS; i++) - vp9_tree_merge_probs(vp9_partition_tree, pre_fc->partition_prob[i], + vpx_tree_merge_probs(vp9_partition_tree, pre_fc->partition_prob[i], counts->partition[i], fc->partition_prob[i]); if (cm->interp_filter == SWITCHABLE) { for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) - vp9_tree_merge_probs(vp9_switchable_interp_tree, + vpx_tree_merge_probs(vp9_switchable_interp_tree, pre_fc->switchable_interp_prob[i], counts->switchable_interp[i], fc->switchable_interp_prob[i]); diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h index 506bb6d64..371738aba 100644 --- a/vp9/common/vp9_entropymode.h +++ b/vp9/common/vp9_entropymode.h @@ -82,10 +82,10 @@ extern const vpx_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES] [INTRA_MODES - 1]; extern const vpx_prob vp9_kf_partition_probs[PARTITION_CONTEXTS] [PARTITION_TYPES - 1]; -extern const vp9_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)]; -extern const vp9_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)]; -extern const vp9_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)]; -extern const vp9_tree_index vp9_switchable_interp_tree +extern const vpx_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)]; +extern const vpx_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)]; +extern const vpx_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)]; +extern const vpx_tree_index vp9_switchable_interp_tree [TREE_SIZE(SWITCHABLE_FILTERS)]; void vp9_setup_past_independence(struct VP9Common *cm); diff --git a/vp9/common/vp9_entropymv.c b/vp9/common/vp9_entropymv.c index 76cdb05ce..3acfe1448 100644 --- a/vp9/common/vp9_entropymv.c +++ b/vp9/common/vp9_entropymv.c @@ -14,13 +14,13 @@ // Integer pel reference mv threshold for use of high-precision 1/8 mv #define COMPANDED_MVREF_THRESH 8 -const vp9_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = { +const vpx_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = { -MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ }; -const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = { +const vpx_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = { -MV_CLASS_0, 2, -MV_CLASS_1, 4, 6, 8, @@ -33,11 +33,11 @@ const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = { -MV_CLASS_9, -MV_CLASS_10, }; -const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = { +const vpx_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = { -0, -1, }; -const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { +const vpx_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1, 4, -2, -3 @@ -183,7 +183,7 @@ void vp9_adapt_mv_probs(VP9_COMMON *cm, int allow_hp) { const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc; const nmv_context_counts *counts = &cm->counts.mv; - vp9_tree_merge_probs(vp9_mv_joint_tree, pre_fc->joints, counts->joints, + vpx_tree_merge_probs(vp9_mv_joint_tree, pre_fc->joints, counts->joints, fc->joints); for (i = 0; i < 2; ++i) { @@ -192,19 +192,19 @@ void vp9_adapt_mv_probs(VP9_COMMON *cm, int allow_hp) { const nmv_component_counts *c = &counts->comps[i]; comp->sign = mode_mv_merge_probs(pre_comp->sign, c->sign); - vp9_tree_merge_probs(vp9_mv_class_tree, pre_comp->classes, c->classes, + vpx_tree_merge_probs(vp9_mv_class_tree, pre_comp->classes, c->classes, comp->classes); - vp9_tree_merge_probs(vp9_mv_class0_tree, pre_comp->class0, c->class0, + vpx_tree_merge_probs(vp9_mv_class0_tree, pre_comp->class0, c->class0, comp->class0); for (j = 0; j < MV_OFFSET_BITS; ++j) comp->bits[j] = mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]); for (j = 0; j < CLASS0_SIZE; ++j) - vp9_tree_merge_probs(vp9_mv_fp_tree, pre_comp->class0_fp[j], + vpx_tree_merge_probs(vp9_mv_fp_tree, pre_comp->class0_fp[j], c->class0_fp[j], comp->class0_fp[j]); - vp9_tree_merge_probs(vp9_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); + vpx_tree_merge_probs(vp9_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); if (allow_hp) { comp->class0_hp = mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h index 79daaf882..8c817bf7b 100644 --- a/vp9/common/vp9_entropymv.h +++ b/vp9/common/vp9_entropymv.h @@ -77,10 +77,10 @@ typedef enum { #define MV_UPP ((1 << MV_IN_USE_BITS) - 1) #define MV_LOW (-(1 << MV_IN_USE_BITS)) -extern const vp9_tree_index vp9_mv_joint_tree[]; -extern const vp9_tree_index vp9_mv_class_tree[]; -extern const vp9_tree_index vp9_mv_class0_tree[]; -extern const vp9_tree_index vp9_mv_fp_tree[]; +extern const vpx_tree_index vp9_mv_joint_tree[]; +extern const vpx_tree_index vp9_mv_class_tree[]; +extern const vpx_tree_index vp9_mv_class0_tree[]; +extern const vpx_tree_index vp9_mv_fp_tree[]; typedef struct { vpx_prob sign; diff --git a/vp9/common/vp9_seg_common.c b/vp9/common/vp9_seg_common.c index 471e238cc..c8ef618b7 100644 --- a/vp9/common/vp9_seg_common.c +++ b/vp9/common/vp9_seg_common.c @@ -54,7 +54,7 @@ void vp9_set_segdata(struct segmentation *seg, int segment_id, seg->feature_data[segment_id][feature_id] = seg_data; } -const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)] = { +const vpx_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)] = { 2, 4, 6, 8, 10, 12, 0, -1, -2, -3, -4, -5, -6, -7 }; diff --git a/vp9/common/vp9_seg_common.h b/vp9/common/vp9_seg_common.h index e8b45bc9a..5b75d8d4e 100644 --- a/vp9/common/vp9_seg_common.h +++ b/vp9/common/vp9_seg_common.h @@ -76,7 +76,7 @@ static INLINE int get_segdata(const struct segmentation *seg, int segment_id, return seg->feature_data[segment_id][feature_id]; } -extern const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)]; +extern const vpx_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)]; #ifdef __cplusplus } // extern "C" diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 06454a95a..b974eaefa 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -61,7 +61,7 @@ static void encode_unsigned_max(struct vp9_write_bit_buffer *wb, vp9_wb_write_literal(wb, data, get_unsigned_bits(max)); } -static void prob_diff_update(const vp9_tree_index *tree, +static void prob_diff_update(const vpx_tree_index *tree, vpx_prob probs[/*n - 1*/], const unsigned int counts[/*n - 1*/], int n, vp9_writer *w) { diff --git a/vp9/encoder/vp9_cost.c b/vp9/encoder/vp9_cost.c index 245df9a91..e2fbb34aa 100644 --- a/vp9/encoder/vp9_cost.c +++ b/vp9/encoder/vp9_cost.c @@ -35,14 +35,14 @@ const unsigned int vp9_prob_cost[256] = { 22, 21, 19, 18, 16, 15, 13, 12, 10, 9, 7, 6, 4, 3, 1, 1}; -static void cost(int *costs, vp9_tree tree, const vpx_prob *probs, +static void cost(int *costs, vpx_tree tree, const vpx_prob *probs, int i, int c) { const vpx_prob prob = probs[i / 2]; int b; for (b = 0; b <= 1; ++b) { const int cc = c + vp9_cost_bit(prob, b); - const vp9_tree_index ii = tree[i + b]; + const vpx_tree_index ii = tree[i + b]; if (ii <= 0) costs[-ii] = cc; @@ -51,11 +51,11 @@ static void cost(int *costs, vp9_tree tree, const vpx_prob *probs, } } -void vp9_cost_tokens(int *costs, const vpx_prob *probs, vp9_tree tree) { +void vp9_cost_tokens(int *costs, const vpx_prob *probs, vpx_tree tree) { cost(costs, tree, probs, 0, 0); } -void vp9_cost_tokens_skip(int *costs, const vpx_prob *probs, vp9_tree tree) { +void vp9_cost_tokens_skip(int *costs, const vpx_prob *probs, vpx_tree tree) { assert(tree[0] <= 0 && tree[1] > 0); costs[-tree[0]] = vp9_cost_bit(probs[0], 0); diff --git a/vp9/encoder/vp9_cost.h b/vp9/encoder/vp9_cost.h index 657f65f30..eac74c40b 100644 --- a/vp9/encoder/vp9_cost.h +++ b/vp9/encoder/vp9_cost.h @@ -21,9 +21,9 @@ extern const unsigned int vp9_prob_cost[256]; #define vp9_cost_zero(prob) (vp9_prob_cost[prob]) -#define vp9_cost_one(prob) vp9_cost_zero(vp9_complement(prob)) +#define vp9_cost_one(prob) vp9_cost_zero(vpx_complement(prob)) -#define vp9_cost_bit(prob, bit) vp9_cost_zero((bit) ? vp9_complement(prob) \ +#define vp9_cost_bit(prob, bit) vp9_cost_zero((bit) ? vpx_complement(prob) \ : (prob)) static INLINE unsigned int cost_branch256(const unsigned int ct[2], @@ -31,10 +31,10 @@ static INLINE unsigned int cost_branch256(const unsigned int ct[2], return ct[0] * vp9_cost_zero(p) + ct[1] * vp9_cost_one(p); } -static INLINE int treed_cost(vp9_tree tree, const vpx_prob *probs, +static INLINE int treed_cost(vpx_tree tree, const vpx_prob *probs, int bits, int len) { int cost = 0; - vp9_tree_index i = 0; + vpx_tree_index i = 0; do { const int bit = (bits >> --len) & 1; @@ -45,8 +45,8 @@ static INLINE int treed_cost(vp9_tree tree, const vpx_prob *probs, return cost; } -void vp9_cost_tokens(int *costs, const vpx_prob *probs, vp9_tree tree); -void vp9_cost_tokens_skip(int *costs, const vpx_prob *probs, vp9_tree tree); +void vp9_cost_tokens(int *costs, const vpx_prob *probs, vpx_tree tree); +void vp9_cost_tokens_skip(int *costs, const vpx_prob *probs, vpx_tree tree); #ifdef __cplusplus } // extern "C" diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index 2e106d22a..39129735f 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -146,7 +146,7 @@ static int update_mv(vp9_writer *w, const unsigned int ct[2], vpx_prob *cur_p, return update; } -static void write_mv_update(const vp9_tree_index *tree, +static void write_mv_update(const vpx_tree_index *tree, vpx_prob probs[/*n - 1*/], const unsigned int counts[/*n - 1*/], int n, vp9_writer *w) { diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 978311939..a1c076af5 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -52,7 +52,7 @@ const TOKENVALUE *vp9_dct_cat_lt_10_value_tokens = dct_cat_lt_10_value_tokens + / 2; // Array indices are identical to previously-existing CONTEXT_NODE indices -const vp9_tree_index vp9_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = { +const vpx_tree_index vp9_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = { -EOB_TOKEN, 2, // 0 = EOB -ZERO_TOKEN, 4, // 1 = ZERO -ONE_TOKEN, 6, // 2 = ONE @@ -66,12 +66,12 @@ const vp9_tree_index vp9_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = { -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 10 = CAT_FIVE }; -static const vp9_tree_index cat1[2] = {0, 0}; -static const vp9_tree_index cat2[4] = {2, 2, 0, 0}; -static const vp9_tree_index cat3[6] = {2, 2, 4, 4, 0, 0}; -static const vp9_tree_index cat4[8] = {2, 2, 4, 4, 6, 6, 0, 0}; -static const vp9_tree_index cat5[10] = {2, 2, 4, 4, 6, 6, 8, 8, 0, 0}; -static const vp9_tree_index cat6[28] = {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, +static const vpx_tree_index cat1[2] = {0, 0}; +static const vpx_tree_index cat2[4] = {2, 2, 0, 0}; +static const vpx_tree_index cat3[6] = {2, 2, 4, 4, 0, 0}; +static const vpx_tree_index cat4[8] = {2, 2, 4, 4, 6, 6, 0, 0}; +static const vpx_tree_index cat5[10] = {2, 2, 4, 4, 6, 6, 8, 8, 0, 0}; +static const vpx_tree_index cat6[28] = {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 0, 0}; static const int16_t zero_cost[] = {0}; @@ -367,20 +367,20 @@ const int16_t vp9_cat6_high12_high_cost[2048] = { #endif #if CONFIG_VP9_HIGHBITDEPTH -static const vp9_tree_index cat1_high10[2] = {0, 0}; -static const vp9_tree_index cat2_high10[4] = {2, 2, 0, 0}; -static const vp9_tree_index cat3_high10[6] = {2, 2, 4, 4, 0, 0}; -static const vp9_tree_index cat4_high10[8] = {2, 2, 4, 4, 6, 6, 0, 0}; -static const vp9_tree_index cat5_high10[10] = {2, 2, 4, 4, 6, 6, 8, 8, 0, 0}; -static const vp9_tree_index cat6_high10[32] = {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, +static const vpx_tree_index cat1_high10[2] = {0, 0}; +static const vpx_tree_index cat2_high10[4] = {2, 2, 0, 0}; +static const vpx_tree_index cat3_high10[6] = {2, 2, 4, 4, 0, 0}; +static const vpx_tree_index cat4_high10[8] = {2, 2, 4, 4, 6, 6, 0, 0}; +static const vpx_tree_index cat5_high10[10] = {2, 2, 4, 4, 6, 6, 8, 8, 0, 0}; +static const vpx_tree_index cat6_high10[32] = {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 0, 0}; -static const vp9_tree_index cat1_high12[2] = {0, 0}; -static const vp9_tree_index cat2_high12[4] = {2, 2, 0, 0}; -static const vp9_tree_index cat3_high12[6] = {2, 2, 4, 4, 0, 0}; -static const vp9_tree_index cat4_high12[8] = {2, 2, 4, 4, 6, 6, 0, 0}; -static const vp9_tree_index cat5_high12[10] = {2, 2, 4, 4, 6, 6, 8, 8, 0, 0}; -static const vp9_tree_index cat6_high12[36] = {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, +static const vpx_tree_index cat1_high12[2] = {0, 0}; +static const vpx_tree_index cat2_high12[4] = {2, 2, 0, 0}; +static const vpx_tree_index cat3_high12[6] = {2, 2, 4, 4, 0, 0}; +static const vpx_tree_index cat4_high12[8] = {2, 2, 4, 4, 6, 6, 0, 0}; +static const vpx_tree_index cat5_high12[10] = {2, 2, 4, 4, 6, 6, 8, 8, 0, 0}; +static const vpx_tree_index cat6_high12[36] = {2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 34, 0, 0}; #endif diff --git a/vp9/encoder/vp9_tokenize.h b/vp9/encoder/vp9_tokenize.h index 417ab2710..11b78ba33 100644 --- a/vp9/encoder/vp9_tokenize.h +++ b/vp9/encoder/vp9_tokenize.h @@ -41,8 +41,8 @@ typedef struct { uint8_t skip_eob_node; } TOKENEXTRA; -extern const vp9_tree_index vp9_coef_tree[]; -extern const vp9_tree_index vp9_coef_con_tree[]; +extern const vpx_tree_index vp9_coef_tree[]; +extern const vpx_tree_index vp9_coef_con_tree[]; extern const struct vp9_token vp9_coef_encodings[]; int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane); diff --git a/vp9/encoder/vp9_treewriter.c b/vp9/encoder/vp9_treewriter.c index bb04b4025..0fc078e0a 100644 --- a/vp9/encoder/vp9_treewriter.c +++ b/vp9/encoder/vp9_treewriter.c @@ -10,13 +10,13 @@ #include "vp9/encoder/vp9_treewriter.h" -static void tree2tok(struct vp9_token *tokens, const vp9_tree_index *tree, +static void tree2tok(struct vp9_token *tokens, const vpx_tree_index *tree, int i, int v, int l) { v += v; ++l; do { - const vp9_tree_index j = tree[i++]; + const vpx_tree_index j = tree[i++]; if (j <= 0) { tokens[-j].value = v; tokens[-j].len = l; @@ -27,11 +27,11 @@ static void tree2tok(struct vp9_token *tokens, const vp9_tree_index *tree, } void vp9_tokens_from_tree(struct vp9_token *tokens, - const vp9_tree_index *tree) { + const vpx_tree_index *tree) { tree2tok(tokens, tree, 0, 0, 0); } -static unsigned int convert_distribution(unsigned int i, vp9_tree tree, +static unsigned int convert_distribution(unsigned int i, vpx_tree tree, unsigned int branch_ct[][2], const unsigned int num_events[]) { unsigned int left, right; @@ -51,7 +51,7 @@ static unsigned int convert_distribution(unsigned int i, vp9_tree tree, return left + right; } -void vp9_tree_probs_from_distribution(vp9_tree tree, +void vp9_tree_probs_from_distribution(vpx_tree tree, unsigned int branch_ct[/* n-1 */][2], const unsigned int num_events[/* n */]) { convert_distribution(0, tree, branch_ct, num_events); diff --git a/vp9/encoder/vp9_treewriter.h b/vp9/encoder/vp9_treewriter.h index 5e7e087e2..883077c65 100644 --- a/vp9/encoder/vp9_treewriter.h +++ b/vp9/encoder/vp9_treewriter.h @@ -17,7 +17,7 @@ extern "C" { #endif -void vp9_tree_probs_from_distribution(vp9_tree tree, +void vp9_tree_probs_from_distribution(vpx_tree tree, unsigned int branch_ct[ /* n - 1 */ ][2], const unsigned int num_events[ /* n */ ]); @@ -26,11 +26,11 @@ struct vp9_token { int len; }; -void vp9_tokens_from_tree(struct vp9_token*, const vp9_tree_index *); +void vp9_tokens_from_tree(struct vp9_token*, const vpx_tree_index *); -static INLINE void vp9_write_tree(vp9_writer *w, const vp9_tree_index *tree, +static INLINE void vp9_write_tree(vp9_writer *w, const vpx_tree_index *tree, const vpx_prob *probs, int bits, int len, - vp9_tree_index i) { + vpx_tree_index i) { do { const int bit = (bits >> --len) & 1; vp9_write(w, bit, probs[i >> 1]); @@ -38,7 +38,7 @@ static INLINE void vp9_write_tree(vp9_writer *w, const vp9_tree_index *tree, } while (len); } -static INLINE void vp9_write_token(vp9_writer *w, const vp9_tree_index *tree, +static INLINE void vp9_write_token(vp9_writer *w, const vpx_tree_index *tree, const vpx_prob *probs, const struct vp9_token *token) { vp9_write_tree(w, tree, probs, token->value, token->len, 0); diff --git a/vpx_dsp/bitreader.h b/vpx_dsp/bitreader.h index 05af72da8..e817c8b0c 100644 --- a/vpx_dsp/bitreader.h +++ b/vpx_dsp/bitreader.h @@ -98,7 +98,7 @@ static INLINE int vpx_read(vpx_reader *r, int prob) { } { - register unsigned int shift = vp9_norm[range]; + register unsigned int shift = vpx_norm[range]; range <<= shift; value <<= shift; count -= shift; @@ -123,9 +123,9 @@ static INLINE int vpx_read_literal(vpx_reader *r, int bits) { return literal; } -static INLINE int vpx_read_tree(vpx_reader *r, const vp9_tree_index *tree, +static INLINE int vpx_read_tree(vpx_reader *r, const vpx_tree_index *tree, const vpx_prob *probs) { - vp9_tree_index i = 0; + vpx_tree_index i = 0; while ((i = tree[i + vpx_read(r, probs[i >> 1])]) > 0) continue; diff --git a/vpx_dsp/bitwriter.h b/vpx_dsp/bitwriter.h index f289bceba..a6a858997 100644 --- a/vpx_dsp/bitwriter.h +++ b/vpx_dsp/bitwriter.h @@ -46,7 +46,7 @@ static INLINE void vp9_write(vp9_writer *br, int bit, int probability) { range = br->range - split; } - shift = vp9_norm[range]; + shift = vpx_norm[range]; range <<= shift; count += shift; diff --git a/vpx_dsp/prob.c b/vpx_dsp/prob.c index b88f0e4cf..639d24dd2 100644 --- a/vpx_dsp/prob.c +++ b/vpx_dsp/prob.c @@ -10,7 +10,7 @@ #include "./prob.h" -const uint8_t vp9_norm[256] = { +const uint8_t vpx_norm[256] = { 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -30,7 +30,7 @@ const uint8_t vp9_norm[256] = { }; static unsigned int tree_merge_probs_impl(unsigned int i, - const vp9_tree_index *tree, + const vpx_tree_index *tree, const vpx_prob *pre_probs, const unsigned int *counts, vpx_prob *probs) { @@ -47,7 +47,7 @@ static unsigned int tree_merge_probs_impl(unsigned int i, return left_count + right_count; } -void vp9_tree_merge_probs(const vp9_tree_index *tree, const vpx_prob *pre_probs, +void vpx_tree_merge_probs(const vpx_tree_index *tree, const vpx_prob *pre_probs, const unsigned int *counts, vpx_prob *probs) { tree_merge_probs_impl(0, tree, pre_probs, counts, probs); } diff --git a/vpx_dsp/prob.h b/vpx_dsp/prob.h index 812d0f832..729f90a55 100644 --- a/vpx_dsp/prob.h +++ b/vpx_dsp/prob.h @@ -26,22 +26,22 @@ typedef uint8_t vpx_prob; #define vpx_prob_half ((vpx_prob) 128) -typedef int8_t vp9_tree_index; +typedef int8_t vpx_tree_index; #define TREE_SIZE(leaf_count) (2 * (leaf_count) - 2) -#define vp9_complement(x) (255 - x) +#define vpx_complement(x) (255 - x) #define MODE_MV_COUNT_SAT 20 /* We build coding trees compactly in arrays. - Each node of the tree is a pair of vp9_tree_indices. + Each node of the tree is a pair of vpx_tree_indices. Array index often references a corresponding probability table. Index <= 0 means done encoding/decoding and value = -Index, Index > 0 means need another bit, specification at index. Nonnegative indices are always even; processing begins at node 0. */ -typedef const vp9_tree_index vp9_tree[]; +typedef const vpx_tree_index vpx_tree[]; static INLINE vpx_prob clip_prob(int p) { return (p > 255) ? 255 : (p < 1) ? 1 : p; @@ -90,11 +90,11 @@ static INLINE vpx_prob mode_mv_merge_probs(vpx_prob pre_prob, } } -void vp9_tree_merge_probs(const vp9_tree_index *tree, const vpx_prob *pre_probs, +void vpx_tree_merge_probs(const vpx_tree_index *tree, const vpx_prob *pre_probs, const unsigned int *counts, vpx_prob *probs); -DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]); +DECLARE_ALIGNED(16, extern const uint8_t, vpx_norm[256]); #ifdef __cplusplus } // extern "C"