Commit 2da90fdd authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Remove obselete code

The strategy to run fast loop filter picking for encoder speed-up
should be revisited at a later stage.

Change-Id: I3b75e06d767cff41be952a42e63b3292f4eab996
parent 1932828d
......@@ -389,112 +389,3 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
}
void vp9_loop_filter_partial_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
int default_filt_lvl) {
YV12_BUFFER_CONFIG *post = cm->frame_to_show;
uint8_t *y_ptr;
int mb_row;
int mb_col;
int mb_cols = post->y_width >> 4;
int linestocopy, i;
loop_filter_info_n *lfi_n = &cm->lf_info;
struct loop_filter_info lfi;
int filter_level;
int alt_flt_enabled = xd->segmentation_enabled;
FRAME_TYPE frame_type = cm->frame_type;
const MODE_INFO *mode_info_context;
int lvl_seg[MAX_MB_SEGMENTS];
mode_info_context = cm->mi + (post->y_height >> 5) * (mb_cols + 1);
/* 3 is a magic number. 4 is probably magic too */
linestocopy = (post->y_height >> (4 + 3));
if (linestocopy < 1)
linestocopy = 1;
linestocopy <<= 4;
/* Note the baseline filter values for each segment */
/* See vp9_loop_filter_frame_init. Rather than call that for each change
* to default_filt_lvl, copy the relevant calculation here.
*/
if (alt_flt_enabled) {
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
// Abs value
lvl_seg[i] = vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
} else {
// Delta Value
lvl_seg[i] = default_filt_lvl + vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
lvl_seg[i] = clamp(lvl_seg[i], 0, 63);
}
}
}
/* Set up the buffer pointers */
y_ptr = post->y_buffer + (post->y_height >> 5) * 16 * post->y_stride;
/* vp9_filter each macro block */
for (mb_row = 0; mb_row < (linestocopy >> 4); mb_row++) {
for (mb_col = 0; mb_col < mb_cols; mb_col++) {
int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
mode_info_context->mbmi.mode != I8X8_PRED &&
mode_info_context->mbmi.mode != SPLITMV &&
mode_info_context->mbmi.mb_skip_coeff);
if (alt_flt_enabled)
filter_level = lvl_seg[mode_info_context->mbmi.segment_id];
else
filter_level = default_filt_lvl;
if (filter_level) {
if (cm->filter_type == NORMAL_LOOPFILTER) {
const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
lfi.mblim = lfi_n->mblim[filter_level];
lfi.blim = lfi_n->blim[filter_level];
lfi.lim = lfi_n->lim[filter_level];
lfi.hev_thr = lfi_n->hev_thr[hev_index];
if (mb_col > 0)
vp9_loop_filter_mbv(y_ptr, 0, 0, post->y_stride, 0, &lfi);
if (!skip_lf)
vp9_loop_filter_bv(y_ptr, 0, 0, post->y_stride, 0, &lfi);
vp9_loop_filter_mbh(y_ptr, 0, 0, post->y_stride, 0, &lfi);
if (!skip_lf)
vp9_loop_filter_bh(y_ptr, 0, 0, post->y_stride, 0, &lfi);
} else {
if (mb_col > 0)
vp9_loop_filter_simple_mbv (y_ptr, post->y_stride,
lfi_n->mblim[filter_level]);
if (!skip_lf)
vp9_loop_filter_simple_bv(y_ptr, post->y_stride,
lfi_n->blim[filter_level]);
vp9_loop_filter_simple_mbh(y_ptr, post->y_stride,
lfi_n->mblim[filter_level]);
if (!skip_lf)
vp9_loop_filter_simple_bh(y_ptr, post->y_stride,
lfi_n->blim[filter_level]);
}
}
y_ptr += 16;
mode_info_context += 1; /* step to next MB */
}
y_ptr += post->y_stride * 16 - post->y_width;
mode_info_context += 1; /* Skip border mb */
}
}
......@@ -2456,10 +2456,8 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
vp9_clear_system_state();
vpx_usec_timer_start(&timer);
if (cpi->sf.auto_filter == 0)
vp9_pick_filter_level_fast(cpi->Source, cpi);
else
vp9_pick_filter_level(cpi->Source, cpi);
vp9_pick_filter_level(cpi->Source, cpi);
vpx_usec_timer_mark(&timer);
cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
......
......@@ -120,111 +120,6 @@ static int get_max_filter_level(VP9_COMP *cpi, int base_qindex) {
return max_filter_level;
}
void vp9_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
int best_err = 0;
int filt_err = 0;
int min_filter_level = get_min_filter_level(cpi, cm->base_qindex);
int max_filter_level = get_max_filter_level(cpi, cm->base_qindex);
int filt_val;
int best_filt_val = cm->filter_level;
// Make a copy of the unfiltered / processed recon buffer
vp9_yv12_copy_partial_frame(cm->frame_to_show, &cpi->last_frame_uf, 3);
if (cm->frame_type == KEY_FRAME)
cm->sharpness_level = 0;
else
cm->sharpness_level = cpi->oxcf.Sharpness;
if (cm->sharpness_level != cm->last_sharpness_level) {
vp9_loop_filter_update_sharpness(&cm->lf_info, cm->sharpness_level);
cm->last_sharpness_level = cm->sharpness_level;
}
// Start the search at the previous frame filter level unless it is now out of range.
if (cm->filter_level < min_filter_level)
cm->filter_level = min_filter_level;
else if (cm->filter_level > max_filter_level)
cm->filter_level = max_filter_level;
filt_val = cm->filter_level;
best_filt_val = filt_val;
// Get the err using the previous frame's filter value.
vp9_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
best_err = calc_partial_ssl_err(sd, cm->frame_to_show, 3);
// Re-instate the unfiltered frame
vp9_yv12_copy_partial_frame(&cpi->last_frame_uf, cm->frame_to_show, 3);
filt_val -= (1 + ((filt_val > 10) ? 1 : 0));
// Search lower filter levels
while (filt_val >= min_filter_level) {
// Apply the loop filter
vp9_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
// Get the err for filtered frame
filt_err = calc_partial_ssl_err(sd, cm->frame_to_show, 3);
// Re-instate the unfiltered frame
vp9_yv12_copy_partial_frame(&cpi->last_frame_uf, cm->frame_to_show, 3);
// Update the best case record or exit loop.
if (filt_err < best_err) {
best_err = filt_err;
best_filt_val = filt_val;
} else
break;
// Adjust filter level
filt_val -= (1 + ((filt_val > 10) ? 1 : 0));
}
// Search up (note that we have already done filt_val = cm->filter_level)
filt_val = cm->filter_level + (1 + ((filt_val > 10) ? 1 : 0));
if (best_filt_val == cm->filter_level) {
// Resist raising filter level for very small gains
best_err -= (best_err >> 10);
while (filt_val < max_filter_level) {
// Apply the loop filter
vp9_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
// Get the err for filtered frame
filt_err = calc_partial_ssl_err(sd, cm->frame_to_show, 3);
// Re-instate the unfiltered frame
vp9_yv12_copy_partial_frame(&cpi->last_frame_uf,
cm->frame_to_show, 3);
// Update the best case record or exit loop.
if (filt_err < best_err) {
// Do not raise filter level if improvement is < 1 part in 4096
best_err = filt_err - (filt_err >> 10);
best_filt_val = filt_val;
} else
break;
// Adjust filter level
filt_val += (1 + ((filt_val > 10) ? 1 : 0));
}
}
cm->filter_level = best_filt_val;
if (cm->filter_level < min_filter_level)
cm->filter_level = min_filter_level;
if (cm->filter_level > max_filter_level)
cm->filter_level = max_filter_level;
}
// Stub function for now Alt LF not used
void vp9_set_alt_lf_level(VP9_COMP *cpi, int filt_val) {
......
......@@ -15,9 +15,6 @@
struct yv12_buffer_config;
struct VP9_COMP;
void vp9_pick_filter_level_fast(struct yv12_buffer_config *sd,
struct VP9_COMP *cpi);
void vp9_set_alt_lf_level(struct VP9_COMP *cpi, int filt_val);
void vp9_pick_filter_level(struct yv12_buffer_config *sd,
......
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