Commit 15f6b863 authored by Cheng Chen's avatar Cheng Chen

Fix select filter level

Only use cm->mi, instead of cm->mi_grid_visible to get filter level.
The latter may not work for shifted grid loop filtering.

Change-Id: I55ed6a42f0abb19d6814e8c0cf8d64ce79bf6abc
parent f89ca3e1
......@@ -596,10 +596,13 @@ static uint8_t get_filter_level(const AV1_COMMON *cm,
const loop_filter_info_n *lfi_n,
#if CONFIG_LOOPFILTER_LEVEL
const int dir_idx,
#endif
#if CONFIG_LPF_SB
int mi_row, int mi_col,
#endif
const MB_MODE_INFO *mbmi) {
#if CONFIG_LPF_SB
return mbmi->filt_lvl;
return cm->mi[mi_row * cm->mi_stride + mi_col].mbmi.filt_lvl;
#endif
#if CONFIG_SUPERTX
......@@ -647,10 +650,6 @@ static uint8_t get_filter_level(const AV1_COMMON *cm,
#else
static uint8_t get_filter_level(const loop_filter_info_n *lfi_n,
const MB_MODE_INFO *mbmi) {
#if CONFIG_LPF_SB
return mbmi->filt_lvl;
#endif
#if CONFIG_SUPERTX
const int segment_id = AOMMIN(mbmi->segment_id, mbmi->segment_id_supertx);
assert(
......@@ -1460,8 +1459,12 @@ static void build_masks(AV1_COMMON *const cm,
#if CONFIG_EXT_DELTA_Q
#if CONFIG_LOOPFILTER_LEVEL
const int filter_level = get_filter_level(cm, lfi_n, 0, mbmi);
#else
#if CONFIG_LPF_SB
const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi);
#else
const int filter_level = get_filter_level(cm, lfi_n, mbmi);
#endif // CONFIG_LPF_SB
#endif
#else
const int filter_level = get_filter_level(lfi_n, mbmi);
......@@ -1558,8 +1561,12 @@ static void build_y_mask(AV1_COMMON *const cm,
#if CONFIG_EXT_DELTA_Q
#if CONFIG_LOOPFILTER_LEVEL
const int filter_level = get_filter_level(cm, lfi_n, 0, mbmi);
#else
#if CONFIG_LPF_SB
const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi);
#else
const int filter_level = get_filter_level(cm, lfi_n, mbmi);
#endif // CONFIG_LPF_SB
#endif
#else
const int filter_level = get_filter_level(lfi_n, mbmi);
......@@ -2168,8 +2175,14 @@ static void get_filter_level_and_masks_non420(
#if CONFIG_LOOPFILTER_LEVEL
if (!(lfl_r[c_step] = get_filter_level(cm, &cm->lf_info, 0, mbmi)))
continue;
#else
#if CONFIG_LPF_SB
if (!(lfl_r[c_step] =
get_filter_level(cm, &cm->lf_info, mi_row, mi_col, mbmi)))
continue;
#else
if (!(lfl_r[c_step] = get_filter_level(cm, &cm->lf_info, mbmi))) continue;
#endif // CONFIG_LPF_SB
#endif
#else
if (!(lfl_r[c_step] = get_filter_level(&cm->lf_info, mbmi))) continue;
......@@ -2866,8 +2879,13 @@ static void set_lpf_parameters(
#if CONFIG_LOOPFILTER_LEVEL
const uint32_t curr_level =
get_filter_level(cm, &cm->lf_info, edge_dir, mbmi);
#else
#if CONFIG_LPF_SB
const uint32_t curr_level =
get_filter_level(cm, &cm->lf_info, mi_row, mi_col, mbmi);
#else
const uint32_t curr_level = get_filter_level(cm, &cm->lf_info, mbmi);
#endif // CONFIG_LPF_SB
#endif
#else
const uint32_t curr_level = get_filter_level(&cm->lf_info, mbmi);
......@@ -2903,9 +2921,14 @@ static void set_lpf_parameters(
#if CONFIG_LOOPFILTER_LEVEL
const uint32_t pv_lvl =
get_filter_level(cm, &cm->lf_info, edge_dir, &mi_prev->mbmi);
#else
#if CONFIG_LPF_SB
const uint32_t pv_lvl = get_filter_level(cm, &cm->lf_info, pv_row,
pv_col, &mi_prev->mbmi);
#else
const uint32_t pv_lvl =
get_filter_level(cm, &cm->lf_info, &mi_prev->mbmi);
#endif // CONFIG_LPF_SB
#endif
#else
const uint32_t pv_lvl =
......
......@@ -232,6 +232,10 @@ static int search_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi,
filt_best = last_lvl;
}
// Compute rdcost to determine whether to reuse previous filter lvl
if (filt_best != last_lvl) {
}
if (best_cost_ret) *best_cost_ret = RDCOST_DBL(x->rdmult, 0, best_err);
return filt_best;
}
......
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