Commit f9f453ec authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Removing kf_{y, uv}_mode_prob arrays from VP9Common.

These arrays have constant values (no any updates). Removing two
corresponding memcpy calls. Making a little cleanup in vp9_entropymode.h
as well: removing redundant 'extern' keyword and moving all function
declarations at the end.

Change-Id: Ia16b38b46aec2e2500f5df29c40a297ae241dede
parent facecd80
......@@ -14,8 +14,8 @@
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_seg_common.h"
static const vp9_prob default_kf_uv_probs[VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1] = {
const vp9_prob vp9_kf_uv_mode_prob[VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1] = {
{ 144, 11, 54, 157, 195, 130, 46, 58, 108 } /* y = dc */,
{ 118, 15, 123, 148, 131, 101, 44, 93, 131 } /* y = v */,
{ 113, 12, 23, 188, 226, 142, 26, 32, 125 } /* y = h */,
......@@ -98,9 +98,9 @@ static const vp9_prob default_partition_probs[NUM_FRAME_TYPES]
}
};
static const vp9_prob default_kf_bmode_probs[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1] = {
const vp9_prob vp9_kf_y_mode_prob[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1] = {
{ /* above = dc */
{ 137, 30, 42, 148, 151, 207, 70, 52, 91 } /* left = dc */,
{ 92, 45, 102, 136, 116, 180, 74, 90, 100 } /* left = v */,
......@@ -328,7 +328,6 @@ static const vp9_prob default_switchable_interp_prob[VP9_SWITCHABLE_FILTERS+1]
void vp9_init_mbmode_probs(VP9_COMMON *cm) {
vp9_copy(cm->fc.uv_mode_prob, default_if_uv_probs);
vp9_copy(cm->kf_uv_mode_prob, default_kf_uv_probs);
vp9_copy(cm->fc.y_mode_prob, default_if_y_probs);
vp9_copy(cm->fc.switchable_interp_prob, default_switchable_interp_prob);
vp9_copy(cm->fc.partition_prob, default_partition_probs);
......@@ -583,8 +582,6 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
vp9_default_coef_probs(cm);
vp9_init_mbmode_probs(cm);
vp9_copy(cm->kf_y_mode_prob, default_kf_bmode_probs);
vp9_init_mv_probs(cm);
// To force update of the sharpness
......
......@@ -16,11 +16,13 @@
#define SUBMVREF_COUNT 5
#define TX_SIZE_CONTEXTS 2
#define VP9_MODE_UPDATE_PROB 252
#define VP9_SWITCHABLE_FILTERS 3 // number of switchable filters
// #define MODE_STATS
struct VP9Common;
struct tx_probs {
vp9_prob p32x32[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 1];
vp9_prob p16x16[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 2];
......@@ -33,58 +35,52 @@ struct tx_counts {
unsigned int p8x8[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 2];
};
int vp9_mv_cont(const int_mv *l, const int_mv *a);
extern const vp9_prob vp9_kf_uv_mode_prob[VP9_INTRA_MODES][VP9_INTRA_MODES - 1];
extern const vp9_prob vp9_kf_y_mode_prob[VP9_INTRA_MODES][VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1];
extern const vp9_tree_index vp9_intra_mode_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
extern struct vp9_token vp9_intra_mode_encodings[VP9_INTRA_MODES];
/* Inter mode values do not start at zero */
extern struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_INTER_MODES];
// probability models for partition information
extern const vp9_tree_index vp9_partition_tree[];
extern const vp9_tree_index vp9_partition_tree[];
extern struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
void vp9_entropy_mode_init(void);
extern const INTERPOLATIONFILTERTYPE vp9_switchable_interp
[VP9_SWITCHABLE_FILTERS];
struct VP9Common;
extern const int vp9_switchable_interp_map[SWITCHABLE + 1];
extern const int vp9_is_interpolating_filter[SWITCHABLE + 1];
/* sets up common features to forget past dependence */
void vp9_setup_past_independence(struct VP9Common *cm, MACROBLOCKD *xd);
extern const vp9_tree_index vp9_switchable_interp_tree
[2 * (VP9_SWITCHABLE_FILTERS - 1)];
void vp9_init_mbmode_probs(struct VP9Common *x);
extern void vp9_init_mode_contexts(struct VP9Common *pc);
extern struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
extern void vp9_adapt_mode_context(struct VP9Common *pc);
void vp9_entropy_mode_init();
extern void vp9_accum_mv_refs(struct VP9Common *pc,
MB_PREDICTION_MODE m,
const int context);
int vp9_mv_cont(const int_mv *l, const int_mv *a);
void vp9_adapt_mode_probs(struct VP9Common *);
void vp9_setup_past_independence(struct VP9Common *cm, MACROBLOCKD *xd);
#define VP9_SWITCHABLE_FILTERS 3 /* number of switchable filters */
void vp9_init_mbmode_probs(struct VP9Common *x);
extern const INTERPOLATIONFILTERTYPE vp9_switchable_interp
[VP9_SWITCHABLE_FILTERS];
void vp9_init_mode_contexts(struct VP9Common *pc);
extern const int vp9_switchable_interp_map[SWITCHABLE + 1];
void vp9_adapt_mode_context(struct VP9Common *pc);
extern const int vp9_is_interpolating_filter[SWITCHABLE + 1];
void vp9_adapt_mode_probs(struct VP9Common *);
extern const vp9_tree_index vp9_switchable_interp_tree
[2 * (VP9_SWITCHABLE_FILTERS - 1)];
void vp9_accum_mv_refs(struct VP9Common *pc, MB_PREDICTION_MODE m, int context);
extern struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p,
unsigned int (*ct_32x32p)[2]);
void tx_counts_to_branch_counts_16x16(unsigned int *tx_count_16x16p,
unsigned int (*ct_16x16p)[2]);
void tx_counts_to_branch_counts_8x8(unsigned int *tx_count_8x8p,
unsigned int (*ct_8x8p)[2]);
extern void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p,
unsigned int (*ct_32x32p)[2]);
extern void tx_counts_to_branch_counts_16x16(unsigned int *tx_count_16x16p,
unsigned int (*ct_16x16p)[2]);
extern void tx_counts_to_branch_counts_8x8(unsigned int *tx_count_8x8p,
unsigned int (*ct_8x8p)[2]);
#endif // VP9_COMMON_VP9_ENTROPYMODE_H_
......@@ -227,13 +227,6 @@ typedef struct VP9Common {
PARTITION_CONTEXT *above_seg_context;
PARTITION_CONTEXT left_seg_context[8];
/* keyframe block modes are predicted by their above, left neighbors */
vp9_prob kf_y_mode_prob[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1];
vp9_prob kf_uv_mode_prob[VP9_INTRA_MODES] [VP9_INTRA_MODES - 1];
// Context probabilities for reference frame prediction
int allow_comp_inter_inter;
MV_REFERENCE_FRAME comp_fixed_ref;
......
......@@ -169,7 +169,7 @@ static void read_intra_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
const MB_PREDICTION_MODE A = above_block_mode(m, 0, mis);
const MB_PREDICTION_MODE L = xd->left_available ?
left_block_mode(m, 0) : DC_PRED;
mbmi->mode = read_intra_mode(r, cm->kf_y_mode_prob[A][L]);
mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);
} else {
// Only 4x4, 4x8, 8x4 blocks
const int bw = 1 << b_width_log2(bsize);
......@@ -183,7 +183,7 @@ static void read_intra_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
const MB_PREDICTION_MODE L = (xd->left_available || idx) ?
left_block_mode(m, ib) : DC_PRED;
const MB_PREDICTION_MODE b_mode = read_intra_mode(r,
cm->kf_y_mode_prob[A][L]);
vp9_kf_y_mode_prob[A][L]);
m->bmi[ib].as_mode = b_mode;
if (bh == 2)
m->bmi[ib + 2].as_mode = b_mode;
......@@ -195,7 +195,7 @@ static void read_intra_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
mbmi->mode = m->bmi[3].as_mode;
}
mbmi->uv_mode = read_intra_mode(r, cm->kf_uv_mode_prob[mbmi->mode]);
mbmi->uv_mode = read_intra_mode(r, vp9_kf_uv_mode_prob[mbmi->mode]);
}
static int read_mv_component(vp9_reader *r,
......
......@@ -560,7 +560,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
const MB_PREDICTION_MODE A = above_block_mode(m, 0, mis);
const MB_PREDICTION_MODE L = xd->left_available ?
left_block_mode(m, 0) : DC_PRED;
write_intra_mode(bc, ym, c->kf_y_mode_prob[A][L]);
write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);
} else {
int idx, idy;
int bw = 1 << b_width_log2(m->mbmi.sb_type);
......@@ -575,12 +575,12 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
#ifdef ENTROPY_STATS
++intra_mode_stats[A][L][bm];
#endif
write_intra_mode(bc, bm, c->kf_y_mode_prob[A][L]);
write_intra_mode(bc, bm, vp9_kf_y_mode_prob[A][L]);
}
}
}
write_intra_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]);
write_intra_mode(bc, m->mbmi.uv_mode, vp9_kf_uv_mode_prob[ym]);
}
static void write_modes_b(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
......
......@@ -22,8 +22,8 @@ void vp9_init_mode_costs(VP9_COMP *c) {
for (i = 0; i < VP9_INTRA_MODES; i++) {
for (j = 0; j < VP9_INTRA_MODES; j++) {
vp9_cost_tokens((int *)c->mb.y_mode_costs[i][j],
x->kf_y_mode_prob[i][j], KT);
vp9_cost_tokens((int *)c->mb.y_mode_costs[i][j], vp9_kf_y_mode_prob[i][j],
KT);
}
}
......@@ -33,7 +33,8 @@ void vp9_init_mode_costs(VP9_COMP *c) {
vp9_cost_tokens(c->mb.intra_uv_mode_cost[1],
x->fc.uv_mode_prob[VP9_INTRA_MODES - 1], vp9_intra_mode_tree);
vp9_cost_tokens(c->mb.intra_uv_mode_cost[0],
x->kf_uv_mode_prob[VP9_INTRA_MODES - 1], vp9_intra_mode_tree);
vp9_kf_uv_mode_prob[VP9_INTRA_MODES - 1],
vp9_intra_mode_tree);
for (i = 0; i <= VP9_SWITCHABLE_FILTERS; ++i)
vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment