Commit 1502d9e4 authored by Geza Lore's avatar Geza Lore
Browse files

Fix mismatch with ext-interp.

The encoder signals the interp filter type in the frame header if all
blocks use the same filter (see bitstream.c:fix_interp_filter). This
decision is made based on the counts, but with ext-interp, the counts
are actually only incremented for blocks that fail vp10_is_interp_needed
(see for example encodeframe.c:update_state), otherwise a default value
is used (EIGHTTAP_REGULAR). The decoder however first checks if the
interp filter is signaled at the frame level, and uses that filter type
for all blocks, even if the default value should have been used.

This patch makes the decoder first check with vp10_is_interp_needed
to see if the default value should be used and then checks the frame
level signaling, which reconciles the difference between encoder and
decoder.

Change-Id: I87857ade42dea06b0d5ec2a029e9219268334dbb
parent c9cb346e
......@@ -864,20 +864,24 @@ static int read_is_obmc_block(VP10_COMMON *const cm, MACROBLOCKD *const xd,
}
#endif // CONFIG_OBMC
static INLINE INTERP_FILTER read_switchable_interp_filter(
static INLINE INTERP_FILTER read_interp_filter(
VP10_COMMON *const cm, MACROBLOCKD *const xd,
vp10_reader *r) {
const int ctx = vp10_get_pred_context_switchable_interp(xd);
FRAME_COUNTS *counts = xd->counts;
INTERP_FILTER type;
#if CONFIG_EXT_INTERP
if (!vp10_is_interp_needed(xd)) return EIGHTTAP_REGULAR;
#endif
type = (INTERP_FILTER)vp10_read_tree(r, vp10_switchable_interp_tree,
cm->fc->switchable_interp_prob[ctx]);
if (counts)
++counts->switchable_interp[ctx][type];
return type;
if (cm->interp_filter != SWITCHABLE) {
return cm->interp_filter;
} else {
const int ctx = vp10_get_pred_context_switchable_interp(xd);
FRAME_COUNTS *counts = xd->counts;
const INTERP_FILTER type =
(INTERP_FILTER)vp10_read_tree(r, vp10_switchable_interp_tree,
cm->fc->switchable_interp_prob[ctx]);
if (counts)
++counts->switchable_interp[ctx][type];
return type;
}
}
static void read_intra_block_mode_info(VP10_COMMON *const cm,
......@@ -1381,9 +1385,7 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
#endif
#if !CONFIG_EXT_INTERP
mbmi->interp_filter = (cm->interp_filter == SWITCHABLE)
? read_switchable_interp_filter(cm, xd, r)
: cm->interp_filter;
mbmi->interp_filter = read_interp_filter(cm, xd, r);
#endif // !CONFIG_EXT_INTERP
if (bsize < BLOCK_8X8) {
......@@ -1605,9 +1607,7 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_INTERP
mbmi->interp_filter = (cm->interp_filter == SWITCHABLE)
? read_switchable_interp_filter(cm, xd, r)
: cm->interp_filter;
mbmi->interp_filter = read_interp_filter(cm, xd, r);
#endif // CONFIG_EXT_INTERP
}
......
......@@ -1073,13 +1073,13 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_EXT_INTRA
if (mode != DC_PRED && mode != TM_PRED) {
int p_angle;
const int intra_filter_ctx = vp10_get_pred_context_intra_interp(xd);
write_uniform(w, 2 * MAX_ANGLE_DELTAS + 1,
MAX_ANGLE_DELTAS + mbmi->angle_delta[0]);
p_angle = mode_to_angle_map[mode] + mbmi->angle_delta[0] * ANGLE_STEP;
if (pick_intra_filter(p_angle)) {
const int ctx = vp10_get_pred_context_intra_interp(xd);
vp10_write_token(w, vp10_intra_filter_tree,
cm->fc->intra_filter_probs[intra_filter_ctx],
cm->fc->intra_filter_probs[ctx],
&intra_filter_encodings[mbmi->intra_filter]);
}
}
......
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