Commit 6ec2b85b authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Added lpf level picking using partial frame

Change-Id: I599ab1bd22b5f3f10d5962c609952abdef8ff67a
parent 6a7a4ba7
......@@ -377,11 +377,23 @@ void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
}
void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
int frame_filter_level, int y_only) {
int frame_filter_level,
int y_only, int partial) {
int start_mi_row, end_mi_row, mi_rows_to_filter;
if (!frame_filter_level) return;
start_mi_row = 0;
mi_rows_to_filter = cm->mi_rows;
if (partial && cm->mi_rows > 8) {
start_mi_row = cm->mi_rows >> 1;
start_mi_row &= 0xfffffff8;
mi_rows_to_filter = MAX(cm->mi_rows / 8, 8);
}
end_mi_row = start_mi_row + mi_rows_to_filter;
vp9_loop_filter_frame_init(cm, xd, frame_filter_level);
vp9_loop_filter_rows(cm->frame_to_show, cm, xd,
0, cm->mi_rows, y_only);
start_mi_row, end_mi_row,
y_only);
}
int vp9_loop_filter_worker(void *arg1, void *arg2) {
......
......@@ -51,7 +51,7 @@ void vp9_loop_filter_frame_init(struct VP9Common *const cm,
void vp9_loop_filter_frame(struct VP9Common *cm,
struct macroblockd *mbd,
int filter_level,
int y_only);
int y_only, int partial);
// Apply the loop filter to [start, stop) macro block rows in frame_buffer.
void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
......
......@@ -359,7 +359,7 @@ int vp9_receive_compressed_data(VP9D_PTR ptr,
if (!pbi->do_loopfilter_inline) {
/* Apply the loop filter if appropriate. */
vp9_loop_filter_frame(cm, &pbi->mb, pbi->mb.lf.filter_level, 0);
vp9_loop_filter_frame(cm, &pbi->mb, pbi->mb.lf.filter_level, 0, 0);
}
#if WRITE_RECON_BUFFER == 2
......
......@@ -2436,10 +2436,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
vpx_usec_timer_start(&timer);
if (cpi->sf.use_fast_lpf_pick == 0)
vp9_pick_filter_level(cpi->Source, cpi);
else
vp9_pick_filter_level_fast(cpi->Source, cpi);
vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.use_fast_lpf_pick);
vpx_usec_timer_mark(&timer);
cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
......@@ -2447,7 +2444,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
if (lf->filter_level > 0) {
vp9_set_alt_lf_level(cpi, lf->filter_level);
vp9_loop_filter_frame(cm, xd, lf->filter_level, 0);
vp9_loop_filter_frame(cm, xd, lf->filter_level, 0, 0);
}
vp9_extend_frame_inner_borders(cm->frame_to_show,
......
......@@ -125,11 +125,7 @@ static int get_max_filter_level(VP9_COMP *cpi, int base_qindex) {
void vp9_set_alt_lf_level(VP9_COMP *cpi, int filt_val) {
}
void vp9_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
struct loopfilter *lf = &cpi->mb.e_mbd.lf;
lf->filter_level = 0;
}
void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, int partial) {
VP9_COMMON *cm = &cpi->common;
struct loopfilter *lf = &cpi->mb.e_mbd.lf;
......@@ -169,7 +165,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
// Get baseline error score
vp9_set_alt_lf_level(cpi, filt_mid);
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_mid, 1);
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_mid, 1, partial);
best_err = vp9_calc_ss_err(sd, cm->frame_to_show);
filt_best = filt_mid;
......@@ -194,7 +190,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
if ((filt_direction <= 0) && (filt_low != filt_mid)) {
// Get Low filter error score
vp9_set_alt_lf_level(cpi, filt_low);
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_low, 1);
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_low, 1, partial);
filt_err = vp9_calc_ss_err(sd, cm->frame_to_show);
......@@ -214,7 +210,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
// Now look at filt_high
if ((filt_direction >= 0) && (filt_high != filt_mid)) {
vp9_set_alt_lf_level(cpi, filt_high);
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_high, 1);
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_high, 1, partial);
filt_err = vp9_calc_ss_err(sd, cm->frame_to_show);
......@@ -240,3 +236,4 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
lf->filter_level = filt_best;
}
......@@ -18,8 +18,5 @@ struct VP9_COMP;
void vp9_set_alt_lf_level(struct VP9_COMP *cpi, int filt_val);
void vp9_pick_filter_level(struct yv12_buffer_config *sd,
struct VP9_COMP *cpi);
void vp9_pick_filter_level_fast(struct yv12_buffer_config *sd,
struct VP9_COMP *cpi);
struct VP9_COMP *cpi, int partial);
#endif // VP9_ENCODER_VP9_PICKLPF_H_
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