From f01ad926d0b2b5c7f79f39f05168d6837cfd54a7 Mon Sep 17 00:00:00 2001
From: Jingning Han <jingning@google.com>
Date: Mon, 2 Dec 2013 18:44:08 -0800
Subject: [PATCH] Fix intra prediction ref selection in skip_encode

This commit fixes the intra prediction reference source selection
in the settings of skip_encode. Use original boundary pixels as
prediction reference, when the inverse transform and reconstruction
are skipped in the per block size rate-distortion optimization loop.

Change-Id: I36081aa30aa46e203e0e6f4e8a420fd08269469a
---
 vp9/encoder/vp9_encodemb.c | 17 ++++++++++++-----
 vp9/encoder/vp9_onyx_if.c  |  4 ++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 83f87b0665..3691e7a7b8 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -559,8 +559,9 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
       mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
       block >>= 6;
       vp9_predict_intra_block(xd, block, bwl, TX_32X32, mode,
-                              dst, pd->dst.stride, dst, pd->dst.stride);
-
+                              x->skip_encode ? src : dst,
+                              x->skip_encode ? p->src.stride : pd->dst.stride,
+                              dst, pd->dst.stride);
       if (!x->skip_recode) {
         vp9_subtract_block(32, 32, src_diff, diff_stride,
                            src, p->src.stride, dst, pd->dst.stride);
@@ -582,7 +583,9 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
       mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
       block >>= 4;
       vp9_predict_intra_block(xd, block, bwl, TX_16X16, mode,
-                              dst, pd->dst.stride, dst, pd->dst.stride);
+                              x->skip_encode ? src : dst,
+                              x->skip_encode ? p->src.stride : pd->dst.stride,
+                              dst, pd->dst.stride);
       if (!x->skip_recode) {
         vp9_subtract_block(16, 16, src_diff, diff_stride,
                            src, p->src.stride, dst, pd->dst.stride);
@@ -600,7 +603,9 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
       mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
       block >>= 2;
       vp9_predict_intra_block(xd, block, bwl, TX_8X8, mode,
-                              dst, pd->dst.stride, dst, pd->dst.stride);
+                              x->skip_encode ? src : dst,
+                              x->skip_encode ? p->src.stride : pd->dst.stride,
+                              dst, pd->dst.stride);
       if (!x->skip_recode) {
         vp9_subtract_block(8, 8, src_diff, diff_stride,
                            src, p->src.stride, dst, pd->dst.stride);
@@ -621,7 +626,9 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
         mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
 
       vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
-                              dst, pd->dst.stride, dst, pd->dst.stride);
+                              x->skip_encode ? src : dst,
+                              x->skip_encode ? p->src.stride : pd->dst.stride,
+                              dst, pd->dst.stride);
 
       if (!x->skip_recode) {
         vp9_subtract_block(4, 4, src_diff, diff_stride,
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index fbe05941d7..b0314475f2 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -786,7 +786,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
         sf->last_partitioning_redo_frequency = 3;
 
         sf->use_uv_intra_rd_estimate = 1;
-        sf->skip_encode_sb = 0;
+        sf->skip_encode_sb = 1;
         sf->use_lp32x32fdct = 1;
         sf->subpel_iters_per_step = 1;
         sf->use_fast_coef_updates = 2;
@@ -819,7 +819,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
         sf->last_partitioning_redo_frequency = 3;
 
         sf->use_uv_intra_rd_estimate = 1;
-        sf->skip_encode_sb = 0;
+        sf->skip_encode_sb = 1;
         sf->use_lp32x32fdct = 1;
         sf->subpel_iters_per_step = 1;
         sf->use_fast_coef_updates = 2;
-- 
GitLab