Use reconstructed pixels for intra prediction
authorJingning Han <jingning@google.com>
Sat, 8 Nov 2014 01:50:55 +0000 (17:50 -0800)
committerJingning Han <jingning@google.com>
Tue, 11 Nov 2014 18:04:43 +0000 (10:04 -0800)
This commit makes the speed -6 and above use the reconstructed
boundary pixels for precise intra prediction. This allows more
intra prediction modes to be tested in the non-RD coding process.

Enabling horizontal and vertical intra prediction modes can
improve the speed -6 compression performance for rtc set
by 0.331%.

Change-Id: I3a99f9d12c6af54de2bdbf28c76eab8e0905f744

vp9/encoder/vp9_pickmode.c
vp9/encoder/vp9_speed_features.c

index f53c078..af67328 100644 (file)
@@ -441,7 +441,8 @@ static void estimate_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
   vp9_predict_intra_block(xd, block >> (2 * tx_size),
                           b_width_log2_lookup[plane_bsize],
                           tx_size, args->mode,
-                          p->src.buf, src_stride,
+                          x->skip_encode ? p->src.buf : pd->dst.buf,
+                          x->skip_encode ? src_stride : dst_stride,
                           pd->dst.buf, dst_stride,
                           i, j, 0);
   // This procedure assumes zero offset from p->src.buf and pd->dst.buf.
@@ -780,25 +781,6 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
     assert(best_rdc.rdcost < INT64_MAX);
   }
 
-  // If best prediction is not in dst buf, then copy the prediction block from
-  // temp buf to dst buf.
-  if (best_pred != NULL && reuse_inter_pred &&
-      best_pred->data != orig_dst.buf) {
-    pd->dst = orig_dst;
-#if CONFIG_VP9_HIGHBITDEPTH
-    if (cm->use_highbitdepth) {
-      vp9_highbd_convolve_copy(best_pred->data, bw, pd->dst.buf, pd->dst.stride,
-                               NULL, 0, NULL, 0, bw, bh, xd->bd);
-    } else {
-      vp9_convolve_copy(best_pred->data, bw, pd->dst.buf, pd->dst.stride,
-                        NULL, 0, NULL, 0, bw, bh);
-    }
-#else
-    vp9_convolve_copy(best_pred->data, bw, pd->dst.buf, pd->dst.stride, NULL, 0,
-                      NULL, 0, bw, bh);
-#endif  // CONFIG_VP9_HIGHBITDEPTH
-  }
-
   mbmi->mode          = best_mode;
   mbmi->interp_filter = best_pred_filter;
   mbmi->tx_size       = best_tx_size;
@@ -817,11 +799,18 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
         MIN(max_txsize_lookup[bsize],
             tx_mode_to_biggest_tx_size[cpi->common.tx_mode]);
 
-    if (reuse_inter_pred) {
-      pd->dst.buf = tmp[0].data;
-      pd->dst.stride = bw;
+    if (best_pred != NULL && reuse_inter_pred &&
+        best_pred->data == orig_dst.buf) {
+      this_mode_pred = &tmp[get_pred_buffer(tmp, 3)];
+      vp9_convolve_copy(best_pred->data, best_pred->stride,
+                        this_mode_pred->data, this_mode_pred->stride,
+                        NULL, 0, NULL, 0, bw, bh);
+      best_pred = this_mode_pred;
     }
+    pd->dst = orig_dst;
 
+    // Change the limit of this loop to add other intra prediction
+    // mode tests.
     for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) {
       const TX_SIZE saved_tx_size = mbmi->tx_size;
       args.mode = this_mode;
@@ -849,8 +838,25 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
         x->skip_txfm[0] = skip_txfm;
       }
     }
-    if (reuse_inter_pred)
-      pd->dst = orig_dst;
+  }
+
+  pd->dst = orig_dst;
+  if (reuse_inter_pred && best_pred->data != orig_dst.buf &&
+      is_inter_mode(mbmi->mode)) {
+#if CONFIG_VP9_HIGHBITDEPTH
+    if (cm->use_highbitdepth)
+      vp9_highbd_convolve_copy(best_pred->data, best_pred->stride,
+                               pd->dst.buf, pd->dst.stride, NULL, 0,
+                               NULL, 0, bw, bh, xd->bd);
+    else
+      vp9_convolve_copy(best_pred->data, best_pred->stride,
+                        pd->dst.buf, pd->dst.stride, NULL, 0,
+                        NULL, 0, bw, bh);
+#else
+    vp9_convolve_copy(best_pred->data, best_pred->stride,
+                      pd->dst.buf, pd->dst.stride, NULL, 0,
+                      NULL, 0, bw, bh);
+#endif
   }
 
   if (is_inter_block(mbmi))
index 7a1b0cc..f9165c7 100644 (file)
@@ -292,6 +292,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
     sf->mv.search_method = NSTEP;
     sf->tx_size_search_method = is_keyframe ? USE_LARGESTALL : USE_TX_8X8;
     sf->mv.reduce_first_step_size = 1;
+    sf->skip_encode_sb = 0;
   }
 
   if (speed >= 7) {