]> granicus.if.org Git - libvpx/commitdiff
Change to extend full border only when needed
authorYaowu Xu <yaowu@google.com>
Mon, 15 Jul 2013 21:59:59 +0000 (14:59 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 16 Jul 2013 03:52:13 +0000 (20:52 -0700)
This is a short term optimization till we work out a decoder
implementation requiring no frame border extension.

Change-Id: I02d15bfde4d926b50a4e58b393d8c4062d1be70f

vp9/common/vp9_blockd.h
vp9/common/vp9_reconinter.c
vp9/decoder/vp9_onyxd_if.c
vp9/encoder/vp9_onyx_if.c
vpx_scale/generic/yv12extend.c
vpx_scale/vpx_scale_rtcd.sh
vpx_scale/yv12config.h

index c98ca90b912df544d0402a90df31c86c22018910..5d3d8f1a29238d6a0f2d6362f39860552b56e5a8 100644 (file)
@@ -167,6 +167,8 @@ enum mv_precision {
 };
 
 #define VP9_REF_SCALE_SHIFT 14
+#define VP9_REF_NO_SCALE 16384
+
 struct scale_factors {
   int x_scale_fp;   // horizontal fixed point scale factor
   int y_scale_fp;   // vertical fixed point scale factor
index c29fd147eb782a63f8d7ac73e5698d4c246de8b3..c1b64d87c5e440fff524010c707423868a021b9c 100644 (file)
@@ -16,6 +16,7 @@
 #include "vp9/common/vp9_filter.h"
 #include "vp9/common/vp9_reconinter.h"
 #include "vp9/common/vp9_reconintra.h"
+#include "./vpx_scale_rtcd.h"
 
 static int scale_value_x_with_scaling(int val,
                                       const struct scale_factors *scale) {
@@ -406,6 +407,10 @@ void vp9_setup_scale_factors(VP9_COMMON *cm, int i) {
     vp9_setup_scale_factors_for_frame(sf,
                                       fb->y_crop_width, fb->y_crop_height,
                                       cm->width, cm->height);
+
+    if (sf->x_scale_fp != VP9_REF_NO_SCALE ||
+        sf->y_scale_fp != VP9_REF_NO_SCALE)
+      vp9_extend_frame_borders(fb, cm->subsampling_x, cm->subsampling_y);
   }
 }
 
index 3cef88bcda5ac05bada8cd665f372a49de42eb9d..b9c7f302d3f2a26cf2e5e865c7aa224da259b555 100644 (file)
@@ -361,8 +361,9 @@ int vp9_receive_compressed_data(VP9D_PTR ptr,
                              cm->current_video_frame + 3000);
 #endif
 
-    vp9_extend_frame_borders(cm->frame_to_show,
-                             cm->subsampling_x, cm->subsampling_y);
+    vp9_extend_frame_inner_borders(cm->frame_to_show,
+                                   cm->subsampling_x,
+                                   cm->subsampling_y);
   }
 
 #if WRITE_RECON_BUFFER == 1
index 14d36bdf6888b25c60e18a48fd5666792eac7b1a..cbb9f87c6f516b2872eafd7ec81a2d608d5b95cc 100644 (file)
@@ -2402,7 +2402,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
     vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, cm->filter_level, 0);
   }
 
-  vp9_extend_frame_borders(cm->frame_to_show,
+  vp9_extend_frame_inner_borders(cm->frame_to_show,
                            cm->subsampling_x, cm->subsampling_y);
 
 }
index c38fb807a627379a1899ab275c3524ae675d978f..60df0af56f173ab0d27ced8ef112b4cc71273976 100644 (file)
@@ -96,12 +96,13 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
 }
 
 #if CONFIG_VP9
-void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
-                                int subsampling_x, int subsampling_y) {
+static void extend_frame(YV12_BUFFER_CONFIG *ybf,
+                        int subsampling_x, int subsampling_y,
+                        int ext_size) {
   const int c_w = (ybf->y_crop_width + subsampling_x) >> subsampling_x;
   const int c_h = (ybf->y_crop_height + subsampling_y) >> subsampling_y;
-  const int c_et = ybf->border >> subsampling_y;
-  const int c_el = ybf->border >> subsampling_x;
+  const int c_et = ext_size >> subsampling_y;
+  const int c_el = ext_size >> subsampling_x;
   const int c_eb = (ybf->border + ybf->y_height - ybf->y_crop_height +
                     subsampling_y) >> subsampling_y;
   const int c_er = (ybf->border + ybf->y_width - ybf->y_crop_width +
@@ -114,9 +115,9 @@ void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
 
   extend_plane(ybf->y_buffer, ybf->y_stride,
                ybf->y_crop_width, ybf->y_crop_height,
-               ybf->border, ybf->border,
-               ybf->border + ybf->y_height - ybf->y_crop_height,
-               ybf->border + ybf->y_width - ybf->y_crop_width);
+               ext_size, ext_size,
+               ext_size + ybf->y_height - ybf->y_crop_height,
+               ext_size + ybf->y_width - ybf->y_crop_width);
 
   extend_plane(ybf->u_buffer, ybf->uv_stride,
                c_w, c_h, c_et, c_el, c_eb, c_er);
@@ -124,6 +125,19 @@ void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
   extend_plane(ybf->v_buffer, ybf->uv_stride,
                c_w, c_h, c_et, c_el, c_eb, c_er);
 }
+
+
+void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
+                                int subsampling_x, int subsampling_y) {
+  extend_frame(ybf, subsampling_x, subsampling_y, ybf->border);
+}
+
+void vp9_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf,
+                                      int subsampling_x, int subsampling_y) {
+  const int inner_bw = ybf->border > VP9INNERBORDERINPIXLES ?
+                       VP9INNERBORDERINPIXLES : ybf->border;
+  extend_frame(ybf, subsampling_x, subsampling_y, inner_bw);
+}
 #endif
 
 /****************************************************************************
index b4f89077da074db9922f2754c20e733de15027c2..21d1e52d67e50441a3efe0a66106966dac23888c 100644 (file)
@@ -28,4 +28,7 @@ specialize vp8_yv12_copy_y neon
 if [ "$CONFIG_VP9" = "yes" ]; then
     prototype void vp9_extend_frame_borders "struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y"
     specialize vp9_extend_frame_borders
+
+    prototype void vp9_extend_frame_inner_borders "struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y"
+    specialize vp9_extend_frame_inner_borders_c
 fi
index a934a94bd5cd6edd289d0fcb4b54cb28772740c7..a919e493b901ab33865f0afe8e98efd70913adab 100644 (file)
@@ -18,7 +18,8 @@ extern "C" {
 #include "vpx/vpx_integer.h"
 
 #define VP8BORDERINPIXELS       32
-#define VP9BORDERINPIXELS       160
+#define VP9INNERBORDERINPIXLES  96
+#define VP9BORDERINPIXELS      160
 #define VP9_INTERP_EXTEND        4
 
   /*************************************