}
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) {
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,
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
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);
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,
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;
// 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;
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);
// 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);
lf->filter_level = filt_best;
}
+
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_