shithub: libvpx

Download patch

ref: 6c714bdbcdc17342a32896d76c0e2c5085963f41
parent: b27207cf638863eb5fb9ecfb823aadcc8425ae73
parent: d66a63f02b4fe6c4ba310b8dff384c00f3dcd5ce
author: Yaowu Xu <yaowu@google.com>
date: Thu Feb 20 16:11:10 EST 2014

Merge "Enable reduced set of intra modes in rtc coding"

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -194,6 +194,9 @@
   int64_t this_rd;
   int64_t cost[4]= { 0, 50, 75, 100 };
 
+  const int64_t inter_mode_thresh = 300;
+  const int64_t intra_mode_cost = 50;
+
   x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
 
   x->skip = 0;
@@ -264,6 +267,31 @@
     }
   }
 
+  // Perform intra prediction search, if the best SAD is above a certain
+  // threshold.
+  if (best_rd > inter_mode_thresh) {
+    struct macroblock_plane *const p = &x->plane[0];
+    struct macroblockd_plane *const pd = &xd->plane[0];
+    for (this_mode = DC_PRED; this_mode <= H_PRED; ++this_mode) {
+      vp9_predict_intra_block(xd, 0, b_width_log2(bsize),
+                              mbmi->tx_size, this_mode,
+                              &p->src.buf[0], p->src.stride,
+                              &pd->dst.buf[0], pd->dst.stride, 0, 0, 0);
+
+      this_rd = cpi->fn_ptr[bsize].sdf(p->src.buf,
+                                       p->src.stride,
+                                       pd->dst.buf,
+                                       pd->dst.stride, INT_MAX);
+
+      if (this_rd + intra_mode_cost < best_rd) {
+        best_rd = this_rd;
+        mbmi->mode = this_mode;
+        mbmi->ref_frame[0] = INTRA_FRAME;
+        mbmi->uv_mode = this_mode;
+      }
+    }
+  }
+
   // Perform sub-pixel motion search, if NEWMV is chosen
   if (mbmi->mode == NEWMV) {
     ref_frame = mbmi->ref_frame[0];
@@ -272,9 +300,6 @@
     mbmi->mv[0].as_int = frame_mv[NEWMV][ref_frame].as_int;
     xd->mi_8x8[0]->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int;
   }
-
-  // TODO(jingning) intra prediction search, if the best SAD is above a certain
-  // threshold.
 
   return INT64_MAX;
 }
--