]> granicus.if.org Git - libvpx/commitdiff
Added lpf level picking using partial frame
authorYaowu Xu <yaowu@google.com>
Wed, 7 Aug 2013 19:29:45 +0000 (12:29 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 9 Aug 2013 14:37:08 +0000 (07:37 -0700)
Change-Id: I599ab1bd22b5f3f10d5962c609952abdef8ff67a

vp9/common/vp9_loopfilter.c
vp9/common/vp9_loopfilter.h
vp9/decoder/vp9_onyxd_if.c
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_picklpf.c
vp9/encoder/vp9_picklpf.h

index 66df6275356f6c5b7d972d74205eb7932bfb1499..949d74d0dbc96fb572a619aaa6b2fc12ac8e3a71 100644 (file)
@@ -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) {
index 5fc909495aa47b61516f8b3a960e3838a72859dc..181afd5cc8b01941bcb6961bcb3d4497e2bf93a6 100644 (file)
@@ -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,
index b701fae2375a9d776417ae3ae490e2073f50ec9e..91e26ec3e9c97633ee4c75026348e4a2c357ba75 100644 (file)
@@ -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
index aff93fb885fa75627c01e52a1e3979cf433509eb..494247327b251a96f52697ec5e9aaacc5755f081 100644 (file)
@@ -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,
index 74abec6bdf381027a13339dd0075e04301b71553..b7a626cb38232eb90044fd5b0a9b93e76c5c65b9 100644 (file)
@@ -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;
 }
+
index da393525f741d91828259d16d77a381bd726e5cc..9de4cf849cc55e9d60fdb6139b0d559f17462d8d 100644 (file)
@@ -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_