summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h10
-rw-r--r--vp9/common/vp9_entropymode.c7
-rw-r--r--vp9/common/vp9_entropymode.h5
-rw-r--r--vp9/common/vp9_pred_common.c14
-rw-r--r--vp9/decoder/vp9_decodemv.c6
-rw-r--r--vp9/decoder/vp9_decodframe.c7
-rw-r--r--vp9/encoder/vp9_bitstream.c9
-rw-r--r--vp9/encoder/vp9_encodeframe.c9
-rw-r--r--vp9/encoder/vp9_rdopt.c13
9 files changed, 35 insertions, 45 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index f68c5c6ea..aab47e472 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -56,11 +56,11 @@ typedef enum {
} FRAME_TYPE;
typedef enum {
- EIGHTTAP_SMOOTH,
- EIGHTTAP,
- EIGHTTAP_SHARP,
- BILINEAR,
- SWITCHABLE /* should be the last one */
+ EIGHTTAP = 0,
+ EIGHTTAP_SMOOTH = 1,
+ EIGHTTAP_SHARP = 2,
+ BILINEAR = 3,
+ SWITCHABLE = 4 /* should be the last one */
} INTERPOLATIONFILTERTYPE;
typedef enum {
diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c
index 768e5f523..c84b9e393 100644
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -339,13 +339,10 @@ void vp9_init_mbmode_probs(VP9_COMMON *cm) {
}
const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
- -0, 2,
- -1, -2
+ -EIGHTTAP, 2,
+ -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP
};
struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
-const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
- EIGHTTAP, EIGHTTAP_SMOOTH, EIGHTTAP_SHARP};
-const int vp9_switchable_interp_map[SWITCHABLE + 1] = {1, 0, 2, -1, -1};
void vp9_entropy_mode_init() {
vp9_tokens_from_tree(vp9_intra_mode_encodings, vp9_intra_mode_tree);
diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h
index 17a7c2634..645d9f985 100644
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -49,11 +49,6 @@ extern struct vp9_token vp9_inter_mode_encodings[VP9_INTER_MODES];
extern const vp9_tree_index vp9_partition_tree[];
extern struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
-extern const INTERPOLATIONFILTERTYPE vp9_switchable_interp
- [VP9_SWITCHABLE_FILTERS];
-
-extern const int vp9_switchable_interp_map[SWITCHABLE + 1];
-
extern const vp9_tree_index vp9_switchable_interp_tree
[2 * (VP9_SWITCHABLE_FILTERS - 1)];
diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c
index 795962a71..1d776715a 100644
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -29,18 +29,16 @@ unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
// The prediction flags in these dummy entries are initialised to 0.
// left
const int left_mv_pred = is_inter_mode(left_mbmi->mode);
- const int left_interp = left_in_image && left_mv_pred ?
- vp9_switchable_interp_map[left_mbmi->interp_filter] :
- VP9_SWITCHABLE_FILTERS;
+ const int left_interp = left_in_image && left_mv_pred
+ ? left_mbmi->interp_filter
+ : VP9_SWITCHABLE_FILTERS;
// above
const int above_mv_pred = is_inter_mode(above_mbmi->mode);
- const int above_interp = above_in_image && above_mv_pred ?
- vp9_switchable_interp_map[above_mbmi->interp_filter] :
- VP9_SWITCHABLE_FILTERS;
+ const int above_interp = above_in_image && above_mv_pred
+ ? above_mbmi->interp_filter
+ : VP9_SWITCHABLE_FILTERS;
- assert(left_interp != -1);
- assert(above_interp != -1);
if (left_interp == above_interp)
return left_interp;
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index a3e2ad39d..6a6bc7256 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -371,10 +371,10 @@ static INLINE INTERPOLATIONFILTERTYPE read_switchable_filter_type(
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
const vp9_prob *probs = vp9_get_pred_probs_switchable_interp(cm, xd);
- const int index = treed_read(r, vp9_switchable_interp_tree, probs);
+ const int type = treed_read(r, vp9_switchable_interp_tree, probs);
const int ctx = vp9_get_pred_context_switchable_interp(xd);
- ++cm->counts.switchable_interp[ctx][index];
- return vp9_switchable_interp[index];
+ ++cm->counts.switchable_interp[ctx][type];
+ return type;
}
static void read_intra_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index de76d4ee0..a115842b5 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -497,8 +497,11 @@ static void setup_quantization(VP9D_COMP *pbi, struct vp9_read_bit_buffer *rb) {
static INTERPOLATIONFILTERTYPE read_interp_filter_type(
struct vp9_read_bit_buffer *rb) {
+ const INTERPOLATIONFILTERTYPE literal_to_type[] = { EIGHTTAP_SMOOTH,
+ EIGHTTAP,
+ EIGHTTAP_SHARP };
return vp9_rb_read_bit(rb) ? SWITCHABLE
- : vp9_rb_read_literal(rb, 2);
+ : literal_to_type[vp9_rb_read_literal(rb, 2)];
}
static void read_frame_size(struct vp9_read_bit_buffer *rb,
@@ -836,7 +839,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, NUM_REF_FRAMES);
setup_frame_size(pbi, rb);
} else {
- pbi->refresh_frame_flags = vp9_rb_read_literal(rb, NUM_REF_FRAMES);
+ pbi->refresh_frame_flags = vp9_rb_read_literal(rb, NUM_REF_FRAMES);
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
const int ref = vp9_rb_read_literal(rb, NUM_REF_FRAMES_LOG2);
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index a866024e8..f84e9a309 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -479,8 +479,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
if (cpi->common.mcomp_filter_type == SWITCHABLE) {
write_token(bc, vp9_switchable_interp_tree,
vp9_get_pred_probs_switchable_interp(&cpi->common, xd),
- vp9_switchable_interp_encodings +
- vp9_switchable_interp_map[mi->interp_filter]);
+ &vp9_switchable_interp_encodings[mi->interp_filter]);
} else {
assert(mi->interp_filter == cpi->common.mcomp_filter_type);
}
@@ -1072,9 +1071,11 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) {
static void write_interp_filter_type(INTERPOLATIONFILTERTYPE type,
struct vp9_write_bit_buffer *wb) {
+ const int type_to_literal[] = { 1, 0, 2 };
+
vp9_wb_write_bit(wb, type == SWITCHABLE);
if (type != SWITCHABLE)
- vp9_wb_write_literal(wb, type, 2);
+ vp9_wb_write_literal(wb, type_to_literal[type], 2);
}
static void fix_mcomp_filter_type(VP9_COMP *cpi) {
@@ -1094,7 +1095,7 @@ static void fix_mcomp_filter_type(VP9_COMP *cpi) {
// Only one filter is used. So set the filter at frame level
for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
if (count[i]) {
- cm->mcomp_filter_type = vp9_switchable_interp[i];
+ cm->mcomp_filter_type = i;
break;
}
}
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index a8f01c56a..0fae7b3ec 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -439,8 +439,7 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
if (cpi->common.mcomp_filter_type == SWITCHABLE
&& is_inter_mode(mbmi->mode)) {
++cpi->common.counts.switchable_interp[
- vp9_get_pred_context_switchable_interp(xd)]
- [vp9_switchable_interp_map[mbmi->interp_filter]];
+ vp9_get_pred_context_switchable_interp(xd)][mbmi->interp_filter];
}
cpi->rd_comp_pred_diff[SINGLE_PREDICTION_ONLY] += ctx->single_pred_diff;
@@ -2385,15 +2384,15 @@ void vp9_encode_frame(VP9_COMP *cpi) {
cpi->rd_filter_threshes[frame_type][2] &&
cpi->rd_filter_threshes[frame_type][1] >
cpi->rd_filter_threshes[frame_type][VP9_SWITCHABLE_FILTERS]) {
- filter_type = vp9_switchable_interp[1];
+ filter_type = EIGHTTAP_SMOOTH;
} else if (cpi->rd_filter_threshes[frame_type][2] >
cpi->rd_filter_threshes[frame_type][0] &&
cpi->rd_filter_threshes[frame_type][2] >
cpi->rd_filter_threshes[frame_type][VP9_SWITCHABLE_FILTERS]) {
- filter_type = vp9_switchable_interp[2];
+ filter_type = EIGHTTAP_SHARP;
} else if (cpi->rd_filter_threshes[frame_type][0] >
cpi->rd_filter_threshes[frame_type][VP9_SWITCHABLE_FILTERS]) {
- filter_type = vp9_switchable_interp[0];
+ filter_type = EIGHTTAP;
} else {
filter_type = SWITCHABLE;
}
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 61ced9baf..639f6ead2 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2003,7 +2003,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
}
if (mbmi->ref_frame[1] > 0 && this_mode == NEWMV &&
- mbmi->interp_filter == vp9_switchable_interp[0]) {
+ mbmi->interp_filter == EIGHTTAP) {
if (seg_mvs[i][mbmi->ref_frame[1]].as_int == INVALID_MV ||
seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV)
continue;
@@ -2456,7 +2456,7 @@ static INLINE int get_switchable_rate(MACROBLOCK *x) {
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
const int c = vp9_get_pred_context_switchable_interp(xd);
- const int m = vp9_switchable_interp_map[mbmi->interp_filter];
+ const int m = mbmi->interp_filter;
return SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs[c][m];
}
@@ -2882,9 +2882,8 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
for (i = 0; i < VP9_SWITCHABLE_FILTERS; ++i) {
int j;
int64_t rs_rd;
- const INTERPOLATIONFILTERTYPE filter = vp9_switchable_interp[i];
const int is_intpel_interp = intpel_mv;
- mbmi->interp_filter = filter;
+ mbmi->interp_filter = i;
vp9_setup_interp_filters(xd, mbmi->interp_filter, cm);
rs = get_switchable_rate(x);
rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0);
@@ -3593,8 +3592,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
++switchable_filter_index) {
int newbest, rs;
int64_t rs_rd;
- mbmi->interp_filter =
- vp9_switchable_interp[switchable_filter_index];
+ mbmi->interp_filter = switchable_filter_index;
vp9_setup_interp_filters(xd, mbmi->interp_filter, &cpi->common);
tmp_rd = rd_pick_best_mbsegmentation(cpi, x,
@@ -3927,8 +3925,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (!mode_excluded && !disable_skip && ref_frame != INTRA_FRAME &&
cm->mcomp_filter_type != BILINEAR) {
int64_t ref = cpi->rd_filter_cache[cm->mcomp_filter_type == SWITCHABLE ?
- VP9_SWITCHABLE_FILTERS :
- vp9_switchable_interp_map[cm->mcomp_filter_type]];
+ VP9_SWITCHABLE_FILTERS : cm->mcomp_filter_type];
for (i = 0; i <= VP9_SWITCHABLE_FILTERS; i++) {
int64_t adj_rd;
// In cases of poor prediction, filter_cache[] can contain really big