Commit 4677e1a7 authored by Jingning Han's avatar Jingning Han

Unify the per directional filter type system for compound modes

For the current stage, we assume a single prediction filter type
per direction in the settings of compound inter prediction modes.

Change-Id: I12a1afdd364b93fcee870bd11ad01fc40ab48cff
parent d567e14e
......@@ -1617,15 +1617,20 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
#endif // CONFIG_EXT_INTER
#if CONFIG_DUAL_FILTER
for (ref = 0; ref < 4; ++ref) {
const int frame_idx = (ref >> 1);
for (ref = 0; ref < 2; ++ref) {
mbmi->interp_filter[ref] = (cm->interp_filter == SWITCHABLE) ?
EIGHTTAP_REGULAR : cm->interp_filter;
if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
has_subpel_mv_component(xd, ref))
if (has_subpel_mv_component(xd, ref) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd, ref + 2)))
mbmi->interp_filter[ref] = read_interp_filter(cm, xd, ref, r);
}
// The index system worsk as:
// (0, 1) -> (vertical, horizontal) filter types for the first ref frame.
// (2, 3) -> (vertical, horizontal) filter types for the second ref frame.
mbmi->interp_filter[2] = mbmi->interp_filter[0];
mbmi->interp_filter[3] = mbmi->interp_filter[1];
#else
#if CONFIG_EXT_INTERP
mbmi->interp_filter = read_interp_filter(cm, xd, r);
......
......@@ -938,10 +938,10 @@ static void write_switchable_interp_filter(VP10_COMP *cpi,
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
for (dir = 0; dir < 4; ++dir) {
const int frame_idx = (dir >> 1);
if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir)) {
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(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],
......
......@@ -1023,12 +1023,13 @@ static void choose_partitioning(VP10_COMP *const cpi,
static void reset_intmv_filter_type(VP10_COMMON *cm,
MACROBLOCKD *xd, MB_MODE_INFO *mbmi) {
int dir;
for (dir = 0; dir < 4; ++dir) {
const int frame_idx = (dir >> 1);
if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
!has_subpel_mv_component(xd, dir))
for (dir = 0; dir < 2; ++dir) {
if (!has_subpel_mv_component(xd, dir) &&
(mbmi->ref_frame[1] == NONE ||
!has_subpel_mv_component(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];
}
}
......@@ -1036,10 +1037,10 @@ static void update_filter_type_count(FRAME_COUNTS *counts,
const MACROBLOCKD *xd,
const MB_MODE_INFO *mbmi) {
int dir;
for (dir = 0; dir < 4; ++dir) {
const int frame_idx = (dir >> 1);
if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir)) {
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir + 2))) {
const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
++counts->switchable_interp[ctx][mbmi->interp_filter[dir]];
}
......
......@@ -729,10 +729,10 @@ int vp10_get_switchable_rate(const VP10_COMP *cpi,
int inter_filter_cost = 0;
int dir;
for (dir = 0; dir < 4; ++dir) {
const int frame_idx = (dir >> 1);
if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
has_subpel_mv_component(xd, dir)) {
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(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]];
......
......@@ -10116,6 +10116,9 @@ void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi,
if (cm->interp_filter != BILINEAR) {
#if CONFIG_DUAL_FILTER
tmp_best_filter[0] = EIGHTTAP_REGULAR;
tmp_best_filter[1] = EIGHTTAP_REGULAR;
tmp_best_filter[2] = EIGHTTAP_REGULAR;
tmp_best_filter[3] = EIGHTTAP_REGULAR;
#else
tmp_best_filter = EIGHTTAP_REGULAR;
#endif
......
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