VP9: refactor read_switchable_interp_filter()
Change-Id: I8f88b7ff21a0991297860c4a744a014629b0fa05
This commit is contained in:
@@ -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(
|
static INLINE INTERP_FILTER read_switchable_interp_filter(
|
||||||
VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||||
vpx_reader *r) {
|
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 =
|
const INTERP_FILTER type =
|
||||||
(INTERP_FILTER)vpx_read_tree(r, vp9_switchable_interp_tree,
|
(INTERP_FILTER)vpx_read_tree(r, vp9_switchable_interp_tree,
|
||||||
cm->fc->switchable_interp_prob[ctx]);
|
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;
|
const BLOCK_SIZE bsize = mi->sb_type;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mi->ref_frame[0] = INTRA_FRAME;
|
|
||||||
mi->ref_frame[1] = NONE;
|
|
||||||
|
|
||||||
switch (bsize) {
|
switch (bsize) {
|
||||||
case BLOCK_4X4:
|
case BLOCK_4X4:
|
||||||
for (i = 0; i < 4; ++i)
|
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);
|
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) {
|
static INLINE int is_mv_valid(const MV *mv) {
|
||||||
|
Reference in New Issue
Block a user