summaryrefslogtreecommitdiff
path: root/vp9/decoder
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2016-04-06 04:53:43 -0700
committerScott LaVarnway <slavarnway@google.com>2016-04-06 04:53:43 -0700
commit25920137ecf64dced3a5c78cdaf172b06d3b201c (patch)
tree48b7a4e2d6e72e85c8983f448cd5ccf910ea174e /vp9/decoder
parent89b1c9d4bec12e96307942a3dfb9a1397276141d (diff)
downloadlibvpx-25920137ecf64dced3a5c78cdaf172b06d3b201c.tar
libvpx-25920137ecf64dced3a5c78cdaf172b06d3b201c.tar.gz
libvpx-25920137ecf64dced3a5c78cdaf172b06d3b201c.tar.bz2
libvpx-25920137ecf64dced3a5c78cdaf172b06d3b201c.zip
VP9: refactor read_switchable_interp_filter()
Change-Id: I8f88b7ff21a0991297860c4a744a014629b0fa05
Diffstat (limited to 'vp9/decoder')
-rw-r--r--vp9/decoder/vp9_decodemv.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 596427c1e..f304de3da 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -353,11 +353,36 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
}
}
+// 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 @@ static void read_intra_block_mode_info(VP9_COMMON *const cm,
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 @@ static void read_intra_block_mode_info(VP9_COMMON *const cm,
}
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) {