ref: c93946bbc3a69d66d0940ca543a2daf52b965c65
parent: 99211b0263968c102a9c81b2d051f1ceadfad93a
parent: 25920137ecf64dced3a5c78cdaf172b06d3b201c
author: Scott LaVarnway <[email protected]>
date: Wed Apr 6 16:51:26 EDT 2016
Merge "VP9: refactor read_switchable_interp_filter()"
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -353,11 +353,36 @@
}
}
+// TODO(slavarnway): Move this decoder version of
+// vp9_get_pred_context_switchable_interp() to vp9_pred_common.h and update the
+// encoder.
+//
+// Returns a context number for the given MB prediction signal
+static int dec_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
+ // Note:
+ // The mode info data structure has a one element border above and to the
+ // left of the entries corresponding to real macroblocks.
+ // The prediction flags in these dummy entries are initialized to 0.
+ const MODE_INFO *const left_mi = xd->left_mi;
+ const int left_type = left_mi ? left_mi->interp_filter : SWITCHABLE_FILTERS;
+ const MODE_INFO *const above_mi = xd->above_mi;
+ const int above_type = above_mi ? above_mi->interp_filter
+ : SWITCHABLE_FILTERS;
+ if (left_type == above_type)
+ return left_type;
+ else if (left_type == SWITCHABLE_FILTERS && above_type != SWITCHABLE_FILTERS)
+ return above_type;
+ else if (left_type != SWITCHABLE_FILTERS && above_type == SWITCHABLE_FILTERS)
+ return left_type;
+ else
+ return SWITCHABLE_FILTERS;
+}
+
static INLINE INTERP_FILTER read_switchable_interp_filter(
VP9_COMMON *const cm, MACROBLOCKD *const xd,
vpx_reader *r) {
- const int ctx = vp9_get_pred_context_switchable_interp(xd);
+ const int ctx = dec_get_pred_context_switchable_interp(xd);
const INTERP_FILTER type =
(INTERP_FILTER)vpx_read_tree(r, vp9_switchable_interp_tree,
cm->fc->switchable_interp_prob[ctx]);
@@ -373,9 +398,6 @@
const BLOCK_SIZE bsize = mi->sb_type;
int i;
- mi->ref_frame[0] = INTRA_FRAME;
- mi->ref_frame[1] = NONE;
-
switch (bsize) {
case BLOCK_4X4:
for (i = 0; i < 4; ++i)
@@ -399,6 +421,13 @@
}
mi->uv_mode = read_intra_mode_uv(cm, xd, r, mi->mode);
+
+ // Initialize interp_filter here so we do not have to check for inter block
+ // modes in dec_get_pred_context_switchable_interp()
+ mi->interp_filter = SWITCHABLE_FILTERS;
+
+ mi->ref_frame[0] = INTRA_FRAME;
+ mi->ref_frame[1] = NONE;
}
static INLINE int is_mv_valid(const MV *mv) {