summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorDeb Mukherjee <debargha@google.com>2012-10-22 14:43:01 -0700
committerDeb Mukherjee <debargha@google.com>2012-10-23 08:50:52 -0700
commit537311971348b1919de8b36266f900aa4657672f (patch)
tree0e6cf0972d087cb01b21fc4aeea42c5186ba7edf /vp8
parentf93d316e0c7121aca5857f3d6e1530dcd82e9d7f (diff)
downloadlibvpx-537311971348b1919de8b36266f900aa4657672f.tar
libvpx-537311971348b1919de8b36266f900aa4657672f.tar.gz
libvpx-537311971348b1919de8b36266f900aa4657672f.tar.bz2
libvpx-537311971348b1919de8b36266f900aa4657672f.zip
Merging in the Switchable interp experiment
There is a macro DEFAULT_INTERP_FILTER defined in encoder/onyx_if.c that is set as EIGHTTAP for now - so SWITCHABLE is not really used. Ideally, this should be SWITCHABLE but that would make the encoder quite a bit slower. We will change the default filter to SWITCHABLE once we find a faster way to search for switchable filters. Change-Id: Iee91832cdc07e6e14108d9b543130fdd12fc9874
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/blockd.h4
-rw-r--r--vp8/common/entropymode.c15
-rw-r--r--vp8/common/entropymode.h8
-rw-r--r--vp8/common/onyxc_int.h6
-rw-r--r--vp8/common/pred_common.c5
-rw-r--r--vp8/common/pred_common.h5
-rw-r--r--vp8/common/reconinter.c8
-rw-r--r--vp8/decoder/decodemv.c8
-rw-r--r--vp8/decoder/decodframe.c7
-rw-r--r--vp8/encoder/bitstream.c48
-rw-r--r--vp8/encoder/block.h7
-rw-r--r--vp8/encoder/encodeframe.c10
-rw-r--r--vp8/encoder/modecosts.c3
-rw-r--r--vp8/encoder/onyx_if.c20
-rw-r--r--vp8/encoder/onyx_int.h6
-rw-r--r--vp8/encoder/ratectrl.c4
-rw-r--r--vp8/encoder/rdopt.c17
17 files changed, 22 insertions, 159 deletions
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
index 7de58104e..cb546e74b 100644
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -86,9 +86,7 @@ typedef enum
BILINEAR = 1,
EIGHTTAP = 2,
EIGHTTAP_SHARP = 3,
-#if CONFIG_SWITCHABLE_INTERP
SWITCHABLE /* should be the last one */
-#endif
} INTERPOLATIONFILTERTYPE;
typedef enum
@@ -243,9 +241,7 @@ typedef struct {
// Flag to turn prediction signal filter on(1)/off(0 ) at the MB level
unsigned int pred_filter_enabled;
#endif
-#if CONFIG_SWITCHABLE_INTERP
INTERPOLATIONFILTERTYPE interp_filter;
-#endif
#if CONFIG_SUPERBLOCKS
// FIXME need a SB array of 4 MB_MODE_INFOs that
diff --git a/vp8/common/entropymode.c b/vp8/common/entropymode.c
index dd4be76fa..bcd9f3707 100644
--- a/vp8/common/entropymode.c
+++ b/vp8/common/entropymode.c
@@ -301,11 +301,8 @@ void vp8_init_mbmode_probs(VP8_COMMON *x) {
vpx_memcpy(x->fc.sub_mv_ref_prob, vp8_sub_mv_ref_prob2, sizeof(vp8_sub_mv_ref_prob2));
vpx_memcpy(x->fc.mbsplit_prob, vp8_mbsplit_probs, sizeof(vp8_mbsplit_probs));
-#if CONFIG_SWITCHABLE_INTERP
vpx_memcpy(x->fc.switchable_interp_prob, vp8_switchable_interp_prob,
sizeof(vp8_switchable_interp_prob));
-#endif
-
}
@@ -338,7 +335,6 @@ void vp8_kf_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES] [VP8_BINTRAMODES] [
} while (++i < VP8_BINTRAMODES);
}
-#if CONFIG_SWITCHABLE_INTERP
#if VP8_SWITCHABLE_FILTERS == 3
const vp8_tree_index vp8_switchable_interp_tree[VP8_SWITCHABLE_FILTERS*2-2] = {
-0, 2,
@@ -363,19 +359,10 @@ const vp8_prob vp8_switchable_interp_prob [VP8_SWITCHABLE_FILTERS+1]
{ 64},
{192},
};
-//#define SWITCHABLE_86
-#ifdef SWITCHABLE_86
-const INTERPOLATIONFILTERTYPE vp8_switchable_interp[VP8_SWITCHABLE_FILTERS] = {
- EIGHTTAP, SIXTAP};
-const int vp8_switchable_interp_map[SWITCHABLE+1] = {1, -1, 0, -1, -1}; //8, 6
-#else
const INTERPOLATIONFILTERTYPE vp8_switchable_interp[VP8_SWITCHABLE_FILTERS] = {
EIGHTTAP, EIGHTTAP_SHARP};
const int vp8_switchable_interp_map[SWITCHABLE+1] = {-1, -1, 0, 1, -1}; //8, 8s
#endif
-#endif
-#endif
-
void vp8_entropy_mode_init() {
vp8_tokens_from_tree(vp8_bmode_encodings, vp8_bmode_tree);
@@ -387,10 +374,8 @@ void vp8_entropy_mode_init() {
vp8_tokens_from_tree(vp8_uv_mode_encodings, vp8_uv_mode_tree);
vp8_tokens_from_tree(vp8_i8x8_mode_encodings, vp8_i8x8_mode_tree);
vp8_tokens_from_tree(vp8_mbsplit_encodings, vp8_mbsplit_tree);
-#if CONFIG_SWITCHABLE_INTERP
vp8_tokens_from_tree(vp8_switchable_interp_encodings,
vp8_switchable_interp_tree);
-#endif
vp8_tokens_from_tree_offset(vp8_mv_ref_encoding_array,
vp8_mv_ref_tree, NEARESTMV);
diff --git a/vp8/common/entropymode.h b/vp8/common/entropymode.h
index 430c949a6..debb5659e 100644
--- a/vp8/common/entropymode.h
+++ b/vp8/common/entropymode.h
@@ -76,16 +76,14 @@ void vp8_kf_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES] [VP8_BINTRAMODES
void vp8_adapt_mode_probs(struct VP8Common *);
-#if CONFIG_SWITCHABLE_INTERP
#define VP8_SWITCHABLE_FILTERS 2 /* number of switchable filters */
extern const INTERPOLATIONFILTERTYPE vp8_switchable_interp
[VP8_SWITCHABLE_FILTERS];
-extern const int vp8_switchable_interp_map[SWITCHABLE+1];
+extern const int vp8_switchable_interp_map[SWITCHABLE + 1];
extern const vp8_tree_index vp8_switchable_interp_tree
- [2*(VP8_SWITCHABLE_FILTERS-1)];
+ [2*(VP8_SWITCHABLE_FILTERS - 1)];
extern struct vp8_token_struct vp8_switchable_interp_encodings
[VP8_SWITCHABLE_FILTERS];
extern const vp8_prob vp8_switchable_interp_prob
- [VP8_SWITCHABLE_FILTERS+1][VP8_SWITCHABLE_FILTERS-1];
-#endif
+ [VP8_SWITCHABLE_FILTERS + 1][VP8_SWITCHABLE_FILTERS - 1];
#endif
diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h
index 646b7a08f..38df3500a 100644
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -103,10 +103,8 @@ typedef struct frame_contexts {
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
nmv_context_counts NMVcount;
-#if CONFIG_SWITCHABLE_INTERP
- vp8_prob switchable_interp_prob[VP8_SWITCHABLE_FILTERS+1]
- [VP8_SWITCHABLE_FILTERS-1];
-#endif
+ vp8_prob switchable_interp_prob[VP8_SWITCHABLE_FILTERS + 1]
+ [VP8_SWITCHABLE_FILTERS - 1];
int mode_context[6][4];
int mode_context_a[6][4];
diff --git a/vp8/common/pred_common.c b/vp8/common/pred_common.c
index a32389433..a97eed8e4 100644
--- a/vp8/common/pred_common.c
+++ b/vp8/common/pred_common.c
@@ -63,7 +63,6 @@ unsigned char get_pred_context(const VP8_COMMON *const cm,
(m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
break;
-#if CONFIG_SWITCHABLE_INTERP
case PRED_SWITCHABLE_INTERP:
{
int left_in_image = (m - 1)->mbmi.mb_in_image;
@@ -93,7 +92,6 @@ unsigned char get_pred_context(const VP8_COMMON *const cm,
pred_context = VP8_SWITCHABLE_FILTERS;
}
break;
-#endif
default:
// TODO *** add error trap code.
@@ -175,11 +173,10 @@ const vp8_prob *get_pred_probs(const VP8_COMMON *const cm,
pred_probability = &cm->mbskip_pred_probs[pred_context];
break;
-#if CONFIG_SWITCHABLE_INTERP
case PRED_SWITCHABLE_INTERP:
pred_probability = &cm->fc.switchable_interp_prob[pred_context][0];
break;
-#endif
+
default:
// TODO *** add error trap code.
pred_probability = NULL;
diff --git a/vp8/common/pred_common.h b/vp8/common/pred_common.h
index 402e0235f..2a9875dfe 100644
--- a/vp8/common/pred_common.h
+++ b/vp8/common/pred_common.h
@@ -22,12 +22,9 @@ typedef enum {
PRED_REF = 1,
PRED_COMP = 2,
PRED_MBSKIP = 3,
-#if CONFIG_SWITCHABLE_INTERP
- PRED_SWITCHABLE_INTERP = 4,
-#endif
+ PRED_SWITCHABLE_INTERP = 4
} PRED_ID;
-
extern unsigned char get_pred_context(const VP8_COMMON *const cm,
const MACROBLOCKD *const xd,
PRED_ID pred_id);
diff --git a/vp8/common/reconinter.c b/vp8/common/reconinter.c
index 869abb2d2..6c60845fb 100644
--- a/vp8/common/reconinter.c
+++ b/vp8/common/reconinter.c
@@ -36,13 +36,7 @@ void vp8_setup_interp_filters(MACROBLOCKD *xd,
&cm->rtcd.subpix, sixtap_avg8x8);
xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(
&cm->rtcd.subpix, sixtap_avg16x16);
- }
- else if (mcomp_filter_type == EIGHTTAP
-#if CONFIG_SWITCHABLE_INTERP
- ||
- mcomp_filter_type == SWITCHABLE
-#endif
- ) {
+ } else if (mcomp_filter_type == EIGHTTAP || mcomp_filter_type == SWITCHABLE) {
xd->subpixel_predict = SUBPIX_INVOKE(
&cm->rtcd.subpix, eighttap4x4);
xd->subpixel_predict8x4 = SUBPIX_INVOKE(
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index 83b899edf..0adc3333e 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -475,13 +475,11 @@ static const unsigned char mbsplit_fill_offset[4][16] = {
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
};
-#if CONFIG_SWITCHABLE_INTERP
static void read_switchable_interp_probs(VP8D_COMP* const pbi,
BOOL_DECODER* const bc) {
VP8_COMMON *const cm = &pbi->common;
int i, j;
for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
- //for (j = 0; j <= 0; ++j) {
for (i = 0; i < VP8_SWITCHABLE_FILTERS - 1; ++i) {
cm->fc.switchable_interp_prob[j][i] = vp8_read_literal(bc, 8);
}
@@ -489,7 +487,6 @@ static void read_switchable_interp_probs(VP8D_COMP* const pbi,
//printf("DECODER: %d %d\n", cm->fc.switchable_interp_prob[0],
//cm->fc.switchable_interp_prob[1]);
}
-#endif
static void mb_mode_mv_init(VP8D_COMP *pbi, vp8_reader *bc) {
VP8_COMMON *const cm = &pbi->common;
@@ -506,10 +503,8 @@ static void mb_mode_mv_init(VP8D_COMP *pbi, vp8_reader *bc) {
if (cm->pred_filter_mode == 2)
cm->prob_pred_filter_off = (vp8_prob)vp8_read_literal(bc, 8);
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (cm->mcomp_filter_type == SWITCHABLE)
read_switchable_interp_probs(pbi, bc);
-#endif
// Decode the baseline probabilities for decoding reference frame
cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8);
cm->prob_last_coded = (vp8_prob)vp8_read_literal(bc, 8);
@@ -756,19 +751,16 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mbmi->pred_filter_enabled = cm->pred_filter_mode;
}
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (mbmi->mode >= NEARESTMV && mbmi->mode <= SPLITMV)
{
if (cm->mcomp_filter_type == SWITCHABLE) {
mbmi->interp_filter = vp8_switchable_interp[
vp8_treed_read(bc, vp8_switchable_interp_tree,
get_pred_probs(cm, xd, PRED_SWITCHABLE_INTERP))];
- //printf("Reading: %d\n", mbmi->interp_filter);
} else {
mbmi->interp_filter = cm->mcomp_filter_type;
}
}
-#endif
if (cm->comp_pred_mode == COMP_PREDICTION_ONLY ||
(cm->comp_pred_mode == HYBRID_PREDICTION &&
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 8e1ebe35d..bc35b17dc 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -253,11 +253,9 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
}
//mode = xd->mode_info_context->mbmi.mode;
-#if CONFIG_SWITCHABLE_INTERP
if (pbi->common.frame_type != KEY_FRAME)
vp8_setup_interp_filters(xd, xd->mode_info_context->mbmi.interp_filter,
&pbi->common);
-#endif
if (eobtotal == 0 && mode != B_PRED && mode != SPLITMV
&& mode != I8X8_PRED
@@ -1298,12 +1296,9 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
/* Is high precision mv allowed */
xd->allow_high_precision_mv = (unsigned char)vp8_read_bit(&header_bc);
// Read the type of subpel filter to use
-#if CONFIG_SWITCHABLE_INTERP
if (vp8_read_bit(&header_bc)) {
pc->mcomp_filter_type = SWITCHABLE;
- } else
-#endif
- {
+ } else {
pc->mcomp_filter_type = vp8_read_literal(&header_bc, 2);
}
/* To enable choice of different interploation filters */
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index d66886561..36776ab21 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -259,57 +259,23 @@ void update_skip_probs(VP8_COMP *cpi) {
}
}
-#if CONFIG_SWITCHABLE_INTERP
void update_switchable_interp_probs(VP8_COMP *cpi, vp8_writer* const bc) {
VP8_COMMON *const pc = &cpi->common;
unsigned int branch_ct[32][2];
int i, j;
for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
- //for (j = 0; j <= 0; ++j) {
-/*
- if (!cpi->dummy_packing)
-#if VP8_SWITCHABLE_FILTERS == 3
- printf("HELLO %d %d %d\n", cpi->switchable_interp_count[j][0],
- cpi->switchable_interp_count[j][1], cpi->switchable_interp_count[j][2]);
-#else
- printf("HELLO %d %d\n", cpi->switchable_interp_count[j][0],
- cpi->switchable_interp_count[j][1]);
-#endif
-*/
vp8_tree_probs_from_distribution(
VP8_SWITCHABLE_FILTERS,
vp8_switchable_interp_encodings, vp8_switchable_interp_tree,
- pc->fc.switchable_interp_prob[j], branch_ct, cpi->switchable_interp_count[j],
- 256, 1
- );
+ pc->fc.switchable_interp_prob[j], branch_ct,
+ cpi->switchable_interp_count[j], 256, 1);
for (i = 0; i < VP8_SWITCHABLE_FILTERS - 1; ++i) {
if (pc->fc.switchable_interp_prob[j][i] < 1)
pc->fc.switchable_interp_prob[j][i] = 1;
vp8_write_literal(bc, pc->fc.switchable_interp_prob[j][i], 8);
-/*
- if (!cpi->dummy_packing)
-#if VP8_SWITCHABLE_FILTERS == 3
- printf("Probs %d %d [%d]\n",
- pc->fc.switchable_interp_prob[j][0],
- pc->fc.switchable_interp_prob[j][1], pc->frame_type);
-#else
- printf("Probs %d [%d]\n", pc->fc.switchable_interp_prob[j][0],
- pc->frame_type);
-#endif
-*/
}
}
- /*
- if (!cpi->dummy_packing)
-#if VP8_SWITCHABLE_FILTERS == 3
- printf("Probs %d %d [%d]\n",
- pc->fc.switchable_interp_prob[0], pc->fc.switchable_interp_prob[1], pc->frame_type);
-#else
- printf("Probs %d [%d]\n", pc->fc.switchable_interp_prob[0], pc->frame_type);
-#endif
- */
}
-#endif
// This function updates the reference frame prediction stats
static void update_refpred_stats(VP8_COMP *cpi) {
@@ -1005,21 +971,19 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
cpi->common.pred_filter_mode);
}
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (mode >= NEARESTMV && mode <= SPLITMV)
{
if (cpi->common.mcomp_filter_type == SWITCHABLE) {
vp8_write_token(bc, vp8_switchable_interp_tree,
- get_pred_probs(&cpi->common, xd, PRED_SWITCHABLE_INTERP),
+ get_pred_probs(&cpi->common, xd,
+ PRED_SWITCHABLE_INTERP),
vp8_switchable_interp_encodings +
vp8_switchable_interp_map[mi->interp_filter]);
- //if (!cpi->dummy_packing) printf("Reading: %d\n", mi->interp_filter);
} else {
assert (mi->interp_filter ==
cpi->common.mcomp_filter_type);
}
}
-#endif
if (mi->second_ref_frame &&
(mode == NEWMV || mode == SPLITMV)) {
int_mv n1, n2;
@@ -2590,7 +2554,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
// Signal whether to allow high MV precision
vp8_write_bit(&header_bc, (xd->allow_high_precision_mv) ? 1 : 0);
-#if CONFIG_SWITCHABLE_INTERP
if (pc->mcomp_filter_type == SWITCHABLE) {
/* Check to see if only one of the filters is actually used */
int count[VP8_SWITCHABLE_FILTERS];
@@ -2615,7 +2578,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
// Signal the type of subpel filter to use
vp8_write_bit(&header_bc, (pc->mcomp_filter_type == SWITCHABLE));
if (pc->mcomp_filter_type != SWITCHABLE)
-#endif /* CONFIG_SWITCHABLE_INTERP */
vp8_write_literal(&header_bc, (pc->mcomp_filter_type), 2);
}
@@ -2688,10 +2650,8 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
vp8_write_literal(&header_bc, pc->prob_pred_filter_off, 8);
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (pc->mcomp_filter_type == SWITCHABLE)
update_switchable_interp_probs(cpi, &header_bc);
-#endif
vp8_write_literal(&header_bc, pc->prob_intra_coded, 8);
vp8_write_literal(&header_bc, pc->prob_last_coded, 8);
diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h
index c18b64f2c..48623be8c 100644
--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -129,12 +129,11 @@ typedef struct {
int bmode_costs[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES];
int i8x8_mode_costs[MB_MODE_COUNT];
int inter_bmode_costs[B_MODE_COUNT];
-#if CONFIG_SWITCHABLE_INTERP
- int switchable_interp_costs[VP8_SWITCHABLE_FILTERS+1]
+ int switchable_interp_costs[VP8_SWITCHABLE_FILTERS + 1]
[VP8_SWITCHABLE_FILTERS];
-#endif
- // These define limits to motion vector components to prevent them from extending outside the UMV borders
+ // These define limits to motion vector components to prevent them
+ // from extending outside the UMV borders
int mv_col_min;
int mv_col_max;
int mv_row_min;
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 20e63725c..0910cfd35 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -1340,15 +1340,7 @@ static void encode_frame_internal(VP8_COMP *cpi) {
cpi->pred_filter_on_count = 0;
cpi->pred_filter_off_count = 0;
#endif
-#if CONFIG_SWITCHABLE_INTERP
vp8_zero(cpi->switchable_interp_count);
-#endif
-
-#if 0
- // Experimental code
- cpi->frame_distortion = 0;
- cpi->last_mb_distortion = 0;
-#endif
xd->mode_info_context = cm->mi;
xd->prev_mode_info_context = cm->prev_mi;
@@ -1980,9 +1972,7 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x,
assert(!xd->mode_info_context->mbmi.encoded_as_sb);
#endif
-#if CONFIG_SWITCHABLE_INTERP
vp8_setup_interp_filters(xd, mbmi->interp_filter, cm);
-#endif
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
// Adjust the zbin based on this MB rate.
adjust_act_zbin(cpi, x);
diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c
index b1abd1e2a..23b9973c3 100644
--- a/vp8/encoder/modecosts.c
+++ b/vp8/encoder/modecosts.c
@@ -46,14 +46,11 @@ void vp8_init_mode_costs(VP8_COMP *c) {
vp8_cost_tokens(c->mb.i8x8_mode_costs,
x->fc.i8x8_mode_prob, vp8_i8x8_mode_tree);
-#if CONFIG_SWITCHABLE_INTERP
{
int i;
for (i = 0; i <= VP8_SWITCHABLE_FILTERS; ++i)
- //for (i = 0; i <= 0; ++i)
vp8_cost_tokens((int *)c->mb.switchable_interp_costs[i],
x->fc.switchable_interp_prob[i],
vp8_switchable_interp_tree);
}
-#endif
}
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index ce0caf8e2..f11ff5936 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -85,6 +85,7 @@ static void set_default_lf_deltas(VP8_COMP *cpi);
extern const int vp8_gf_interval_table[101];
+#define DEFAULT_INTERP_FILTER EIGHTTAP /* SWITCHABLE for better performance */
#define SEARCH_BEST_FILTER 0 /* to search exhaustively for
best filter */
#define RESET_FOREACH_FILTER 0 /* whether to reset the encoder state
@@ -1617,7 +1618,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf) {
cpi->cq_target_quality = cpi->oxcf.cq_level;
if (!cm->use_bilinear_mc_filter)
- cm->mcomp_filter_type = EIGHTTAP;
+ cm->mcomp_filter_type = DEFAULT_INTERP_FILTER;
else
cm->mcomp_filter_type = BILINEAR;
@@ -2933,13 +2934,10 @@ static void encode_frame_to_data_rate
/* list of filters to search over */
int mcomp_filters_to_search[] = {
-#if CONFIG_SWITCHABLE_INTERP
EIGHTTAP, EIGHTTAP_SHARP, SIXTAP, SWITCHABLE
-#else
- EIGHTTAP, EIGHTTAP_SHARP, SIXTAP,
-#endif
};
- int mcomp_filters = sizeof(mcomp_filters_to_search) / sizeof(*mcomp_filters_to_search);
+ int mcomp_filters = sizeof(mcomp_filters_to_search) /
+ sizeof(*mcomp_filters_to_search);
int mcomp_filter_index = 0;
INT64 mcomp_filter_cost[4];
@@ -3164,12 +3162,7 @@ static void encode_frame_to_data_rate
cm->mcomp_filter_type = mcomp_filters_to_search[0];
mcomp_filter_index = 0;
} else {
-#if CONFIG_SWITCHABLE_INTERP
- cm->mcomp_filter_type = SWITCHABLE;
-#else
- cm->mcomp_filter_type =
- (Q < SHARP_FILTER_QTHRESH ? EIGHTTAP_SHARP : EIGHTTAP);
-#endif
+ cm->mcomp_filter_type = DEFAULT_INTERP_FILTER;
}
/* TODO: Decide this more intelligently */
xd->allow_high_precision_mv = (Q < HIGH_PRECISION_MV_QTHRESH);
@@ -3482,7 +3475,6 @@ static void encode_frame_to_data_rate
if (cpi->is_src_frame_alt_ref)
Loop = FALSE;
-#if CONFIG_SWITCHABLE_INTERP
if (cm->frame_type != KEY_FRAME &&
!sf->search_best_filter &&
cm->mcomp_filter_type == SWITCHABLE) {
@@ -3508,13 +3500,11 @@ static void encode_frame_to_data_rate
if (count[i]) {
cm->mcomp_filter_type = vp8_switchable_interp[i];
Loop = TRUE; /* Make sure to loop since the filter changed */
- //loop_count = -1;
break;
}
}
}
}
-#endif
if (Loop == FALSE && cm->frame_type != KEY_FRAME && sf->search_best_filter) {
if (mcomp_filter_index < mcomp_filters) {
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index ab1bb44ec..ab6802509 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -110,10 +110,8 @@ typedef struct {
vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1];
-#if CONFIG_SWITCHABLE_INTERP
vp8_prob switchable_interp_prob[VP8_SWITCHABLE_FILTERS + 1]
[VP8_SWITCHABLE_FILTERS - 1];
-#endif
int mv_ref_ct[6][4][2];
int mode_context[6][4];
@@ -753,10 +751,8 @@ typedef struct VP8_COMP {
int pred_filter_on_count;
int pred_filter_off_count;
#endif
-#if CONFIG_SWITCHABLE_INTERP
- unsigned int switchable_interp_count[VP8_SWITCHABLE_FILTERS+1]
+ unsigned int switchable_interp_count[VP8_SWITCHABLE_FILTERS + 1]
[VP8_SWITCHABLE_FILTERS];
-#endif
#if CONFIG_NEW_MVREF
unsigned int best_ref_index_counts[MAX_MV_REFS];
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index 85036e4c0..cc3c82e74 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -176,9 +176,7 @@ void vp8_save_coding_context(VP8_COMP *cpi) {
vp8_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8);
vp8_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16);
vp8_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16);
-#if CONFIG_SWITCHABLE_INTERP
vp8_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
-#endif
}
void vp8_restore_coding_context(VP8_COMP *cpi) {
@@ -234,9 +232,7 @@ void vp8_restore_coding_context(VP8_COMP *cpi) {
vp8_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8);
vp8_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16);
vp8_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16);
-#if CONFIG_SWITCHABLE_INTERP
vp8_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
-#endif
}
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 136151bef..e919de36f 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -60,10 +60,8 @@ extern void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x);
#define INVALID_MV 0x80008000
-#if CONFIG_SWITCHABLE_INTERP
/* Factor to weigh the rate for switchable interp filters */
#define SWITCHABLE_INTERP_RATE_FACTOR 1
-#endif
static const int auto_speed_thresh[17] = {
1000,
@@ -3385,9 +3383,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
int_mv ref_mv[MAX_REF_FRAMES] = {{0}};
#endif
-#if CONFIG_SWITCHABLE_INTERP
int switchable_filter_index = 0;
-#endif
MB_PREDICTION_MODE uv_intra_mode;
MB_PREDICTION_MODE uv_intra_mode_8x8 = 0;
@@ -3484,12 +3480,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
// that depend on the current prediction etc.
vp8_estimate_ref_frame_costs(cpi, segment_id, ref_costs);
-#if CONFIG_SWITCHABLE_INTERP
for (mode_index = 0; mode_index < MAX_MODES;
mode_index += (!switchable_filter_index)) {
-#else
- for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) {
-#endif
int64_t this_rd = INT64_MAX;
int is_comp_pred;
int disable_skip = 0, skippable = 0;
@@ -3517,19 +3509,16 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
#if CONFIG_PRED_FILTER
mbmi->pred_filter_enabled = 0;
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (cpi->common.mcomp_filter_type == SWITCHABLE &&
this_mode >= NEARESTMV && this_mode <= SPLITMV) {
mbmi->interp_filter =
vp8_switchable_interp[switchable_filter_index++];
if (switchable_filter_index == VP8_SWITCHABLE_FILTERS)
switchable_filter_index = 0;
- //printf("Searching %d (%d)\n", this_mode, switchable_filter_index);
} else {
mbmi->interp_filter = cpi->common.mcomp_filter_type;
}
vp8_setup_interp_filters(xd, mbmi->interp_filter, &cpi->common);
-#endif
// Test best rd so far against threshold for trying this mode.
if (best_rd <= cpi->rd_threshes[mode_index])
@@ -3788,12 +3777,10 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
rate2 += rate;
distortion2 += distortion;
-#if CONFIG_SWITCHABLE_INTERP
if (cpi->common.mcomp_filter_type == SWITCHABLE)
rate2 += SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs
[get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)]
[vp8_switchable_interp_map[mbmi->interp_filter]];
-#endif
// If even the 'Y' rd value of split is higher than best so far
// then dont bother looking at UV
if (tmp_rd < best_yrd) {
@@ -3931,13 +3918,11 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
rate2 += vp8_cost_bit(cpi->common.prob_pred_filter_off,
xd->mode_info_context->mbmi.pred_filter_enabled);
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (cpi->common.mcomp_filter_type == SWITCHABLE)
rate2 += SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs
[get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)]
[vp8_switchable_interp_map[
x->e_mbd.mode_info_context->mbmi.interp_filter]];
-#endif
/* We don't include the cost of the second reference here, because there are only
* three options: Last/Golden, ARF/Last or Golden/ARF, or in other words if you
@@ -4204,7 +4189,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
else
++cpi->pred_filter_off_count;
#endif
-#if CONFIG_SWITCHABLE_INTERP
if (cpi->common.mcomp_filter_type == SWITCHABLE &&
best_mbmode.mode >= NEARESTMV &&
best_mbmode.mode <= SPLITMV) {
@@ -4212,7 +4196,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
[get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)]
[vp8_switchable_interp_map[best_mbmode.interp_filter]];
}
-#endif
// Reduce the activation RD thresholds for the best choice mode
if ((cpi->rd_baseline_thresh[best_mode_index] > 0) &&