vpx/vp8/encoder/modecosts.c
Deb Mukherjee 5259744145 Adds support for switchable interpolation filters.
Allows for swtiching/setting interpolation filters at the MB
level. A frame level flag indicates whether to use a specifc
filter for the entire frame or to signal the interpolation
filter for each MB. When switchable filters are used, the
encoder chooses between 8-tap and 8-tap sharp filters. The
code currently has options to explore other variations as well,
which will be cleaned up subsequently.

One issue with the framework is that encoding is slow. I
tried to do some tricks to speed things up but it is still slow.
Decoding speed should not be affected since the number of
filter taps remain unchanged.

With the current version, we are up 0.5% on derf on average but
some videos city/mobile improve by close to 4 and 2% respectively.
If we did a full-search by turning the SEARCH_BEST_FILTER flag
on, the results are somewhat better.

The framework can be combined with filtered prediction, and I
seek feedback regarding that.

Rebased.

Change-Id: I8f632cb2c111e76284140a2bd480945d6d42b77a
2012-07-30 11:33:43 -07:00

60 lines
1.9 KiB
C

/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp8/common/blockd.h"
#include "onyx_int.h"
#include "treewriter.h"
#include "vp8/common/entropymode.h"
void vp8_init_mode_costs(VP8_COMP *c) {
VP8_COMMON *x = &c->common;
{
const vp8_tree_p T = vp8_bmode_tree;
int i = 0;
do {
int j = 0;
do {
vp8_cost_tokens((int *)c->mb.bmode_costs[i][j], x->kf_bmode_prob[i][j], T);
} while (++j < VP8_BINTRAMODES);
} while (++i < VP8_BINTRAMODES);
vp8_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.bmode_prob, T);
}
vp8_cost_tokens((int *)c->mb.inter_bmode_costs,
x->fc.sub_mv_ref_prob[0], vp8_sub_mv_ref_tree);
vp8_cost_tokens(c->mb.mbmode_cost[1], x->fc.ymode_prob, vp8_ymode_tree);
vp8_cost_tokens(c->mb.mbmode_cost[0],
x->kf_ymode_prob[c->common.kf_ymode_probs_index],
vp8_kf_ymode_tree);
vp8_cost_tokens(c->mb.intra_uv_mode_cost[1],
x->fc.uv_mode_prob[VP8_YMODES - 1], vp8_uv_mode_tree);
vp8_cost_tokens(c->mb.intra_uv_mode_cost[0],
x->kf_uv_mode_prob[VP8_YMODES - 1], vp8_uv_mode_tree);
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
}