Commit 95aff94a authored by Angie Chiang's avatar Angie Chiang

Add sharp2 and smooth2 interpolation filter

PSNR gain
hbd lowres dataset: 0.811%
lbd lowres dataset: 0.895%

Change-Id: Id6cc426883de725adf1a630f4151d5018c4b819b
parent 6d0152ea
......@@ -290,10 +290,18 @@ void av1_tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 };
#if CONFIG_EXT_INTERP
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 235, 192, 128, 128 }, { 36, 243, 208, 128 }, { 34, 16, 128, 128 },
{ 36, 243, 48, 128 }, { 34, 16, 128, 128 }, { 149, 160, 128, 128 },
};
#else // CONFIG_EXT_INTERP
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
};
#endif // CONFIG_EXT_INTERP
#if CONFIG_MISC_FIXES
// FIXME(someone) need real defaults here
......@@ -343,8 +351,22 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob);
}
#if CONFIG_EXT_INTERP
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{
-EIGHTTAP,
2,
4,
6,
-EIGHTTAP_SMOOTH,
-EIGHTTAP_SMOOTH2,
-MULTITAP_SHARP,
-MULTITAP_SHARP2,
};
#else // CONFIG_EXT_INTERP
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{ -EIGHTTAP, 2, -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP };
#endif // CONFIG_EXT_INTERP
void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
int i, j;
......
......@@ -25,21 +25,30 @@ extern "C" {
#define EIGHTTAP 0
#define EIGHTTAP_SMOOTH 1
#define EIGHTTAP_SHARP 2
#define MULTITAP_SHARP EIGHTTAP_SHARP
#define EIGHTTAP_SMOOTH2 3
#define MULTITAP_SHARP2 4
#define SWITCHABLE_FILTERS 5 /* Number of switchable filters */
// (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS
#define LOG_SWITCHABLE_FILTERS 3
#else
#define EIGHTTAP 0
#define EIGHTTAP_SMOOTH 1
#define EIGHTTAP_SHARP 2
#define SWITCHABLE_FILTERS 3 /* Number of switchable filters */
#endif // CONFIG_EXT_INTERP
// (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS
#define LOG_SWITCHABLE_FILTERS 2
#endif // CONFIG_EXT_INTERP
#define BILINEAR SWITCHABLE_FILTERS
// The codec can operate in four possible inter prediction filter mode:
// 8-tap, 8-tap-smooth, 8-tap-sharp, and switching between the three.
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
#define SWITCHABLE 4 /* should be the last one */
#define SWITCHABLE (SWITCHABLE_FILTERS + 1) /* should be the last one */
typedef uint8_t InterpFilter;
......
......@@ -896,7 +896,8 @@ static void setup_segmentation_dequant(AV1_COMMON *const cm) {
}
static InterpFilter read_interp_filter(struct aom_read_bit_buffer *rb) {
return aom_rb_read_bit(rb) ? SWITCHABLE : aom_rb_read_literal(rb, 2);
return aom_rb_read_bit(rb) ? SWITCHABLE
: aom_rb_read_literal(rb, LOG_SWITCHABLE_FILTERS);
}
static void setup_render_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
......
......@@ -1148,7 +1148,8 @@ static void update_txfm_probs(AV1_COMMON *cm, aom_writer *w,
static void write_interp_filter(InterpFilter filter,
struct aom_write_bit_buffer *wb) {
aom_wb_write_bit(wb, filter == SWITCHABLE);
if (filter != SWITCHABLE) aom_wb_write_literal(wb, filter, 2);
if (filter != SWITCHABLE)
aom_wb_write_literal(wb, filter, LOG_SWITCHABLE_FILTERS);
}
static void fix_interp_filter(AV1_COMMON *cm, FRAME_COUNTS *counts) {
......
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