Commit 936ed080 authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review
Browse files

Merge "Account sub8x8 block reference filter type for prob context" into nextgenv2

parents 300083da 9161464f
......@@ -11,18 +11,20 @@
#include "vp10/common/common.h"
#include "vp10/common/pred_common.h"
#include "vp10/common/reconinter.h"
#include "vp10/common/seg_common.h"
// Returns a context number for the given MB prediction signal
#if CONFIG_DUAL_FILTER
static INTERP_FILTER get_ref_filter_type(const MB_MODE_INFO *ref_mbmi,
static INTERP_FILTER get_ref_filter_type(const MODE_INFO *mi,
const MACROBLOCKD *xd,
int dir,
MV_REFERENCE_FRAME ref_frame) {
INTERP_FILTER ref_type = SWITCHABLE_FILTERS;
const MV tmp_mv[2] = {ref_mbmi->mv[0].as_mv, ref_mbmi->mv[1].as_mv};
const int use_subpel[2] = {
((dir & 0x01) ? tmp_mv[0].col : tmp_mv[0].row) & SUBPEL_MASK,
((dir & 0x01) ? tmp_mv[1].col : tmp_mv[1].row) & SUBPEL_MASK,
const MB_MODE_INFO *ref_mbmi = &mi->mbmi;
int use_subpel[2] = {
has_subpel_mv_component(mi, xd, dir),
has_subpel_mv_component(mi, xd, dir + 2),
};
if (ref_mbmi->ref_frame[0] == ref_frame && use_subpel[0])
......@@ -43,17 +45,16 @@ int vp10_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir) {
// 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 MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
int filter_type_ctx = ctx_offset + (dir & 0x01) * INTER_FILTER_DIR_OFFSET;
int left_type = SWITCHABLE_FILTERS;
int above_type = SWITCHABLE_FILTERS;
if (xd->left_available)
left_type = get_ref_filter_type(left_mbmi, dir, ref_frame);
left_type = get_ref_filter_type(xd->mi[-1], xd, dir, ref_frame);
if (xd->up_available)
above_type = get_ref_filter_type(above_mbmi, dir, ref_frame);
above_type = get_ref_filter_type(xd->mi[-xd->mi_stride], xd,
dir, ref_frame);
if (left_type == above_type)
filter_type_ctx += left_type;
......
......@@ -434,10 +434,10 @@ void vp10_setup_pre_planes(MACROBLOCKD *xd, int idx,
#if CONFIG_DUAL_FILTER
// Detect if the block have sub-pixel level motion vectors
// per component.
static INLINE int has_subpel_mv_component(const MACROBLOCKD *const xd,
static INLINE int has_subpel_mv_component(const MODE_INFO *const mi,
const MACROBLOCKD *const xd,
int dir) {
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
int plane;
int ref = (dir >> 1);
......
......@@ -1621,9 +1621,9 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
mbmi->interp_filter[ref] = (cm->interp_filter == SWITCHABLE) ?
EIGHTTAP_REGULAR : cm->interp_filter;
if (has_subpel_mv_component(xd, ref) ||
if (has_subpel_mv_component(xd->mi[0], xd, ref) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd, ref + 2)))
has_subpel_mv_component(xd->mi[0], xd, ref + 2)))
mbmi->interp_filter[ref] = read_interp_filter(cm, xd, ref, r);
}
// The index system worsk as:
......
......@@ -939,9 +939,9 @@ static void write_switchable_interp_filter(VP10_COMP *cpi,
#endif // CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd, dir) ||
if (has_subpel_mv_component(xd->mi[0], xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir + 2))) {
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
vp10_write_token(w, vp10_switchable_interp_tree,
cm->fc->switchable_interp_prob[ctx],
......
......@@ -1024,9 +1024,9 @@ static void reset_intmv_filter_type(VP10_COMMON *cm,
MACROBLOCKD *xd, MB_MODE_INFO *mbmi) {
int dir;
for (dir = 0; dir < 2; ++dir) {
if (!has_subpel_mv_component(xd, dir) &&
if (!has_subpel_mv_component(xd->mi[0], xd, dir) &&
(mbmi->ref_frame[1] == NONE ||
!has_subpel_mv_component(xd, dir + 2)))
!has_subpel_mv_component(xd->mi[0], xd, dir + 2)))
mbmi->interp_filter[dir] = (cm->interp_filter == SWITCHABLE) ?
EIGHTTAP_REGULAR : cm->interp_filter;
mbmi->interp_filter[dir + 2] = mbmi->interp_filter[dir];
......@@ -1038,9 +1038,9 @@ static void update_filter_type_count(FRAME_COUNTS *counts,
const MB_MODE_INFO *mbmi) {
int dir;
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd, dir) ||
if (has_subpel_mv_component(xd->mi[0], xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir + 2))) {
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
++counts->switchable_interp[ctx][mbmi->interp_filter[dir]];
}
......
......@@ -730,9 +730,9 @@ int vp10_get_switchable_rate(const VP10_COMP *cpi,
int dir;
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd, dir) ||
if (has_subpel_mv_component(xd->mi[0], xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir + 2))) {
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
inter_filter_cost +=
cpi->switchable_interp_costs[ctx][mbmi->interp_filter[dir]];
......
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