summaryrefslogtreecommitdiff
path: root/vpx_scale
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-05-08 16:18:44 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-05-15 20:58:26 -0700
commit418564e7d0b4e70611f41b81d9c09f72d2697cfc (patch)
tree75553bb0bc92750ecceec0be927756c676aee423 /vpx_scale
parent7addafb5b15be973e81ec408b34c9ab1d812afab (diff)
downloadlibvpx-418564e7d0b4e70611f41b81d9c09f72d2697cfc.tar.gz
libvpx-418564e7d0b4e70611f41b81d9c09f72d2697cfc.tar.bz2
libvpx-418564e7d0b4e70611f41b81d9c09f72d2697cfc.zip
Add vp9_extend_frame_borders
Adds a subsampling aware border extension function. This may be reworked soon to support more than 3 planes. Change-Id: I76b81901ad10bb1e678dd4f0d22740ca6c76c43b
Diffstat (limited to 'vpx_scale')
-rw-r--r--vpx_scale/generic/yv12extend.c31
-rw-r--r--vpx_scale/vpx_scale_rtcd.sh5
2 files changed, 36 insertions, 0 deletions
diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c
index a322e0a2c..c38fb807a 100644
--- a/vpx_scale/generic/yv12extend.c
+++ b/vpx_scale/generic/yv12extend.c
@@ -9,6 +9,7 @@
*/
#include <assert.h>
+#include "./vpx_config.h"
#include "vpx_scale/yv12config.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_scale/vpx_scale.h"
@@ -94,6 +95,36 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
(ybf->border + ybf->y_width - ybf->y_crop_width + 1) / 2);
}
+#if CONFIG_VP9
+void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
+ int subsampling_x, int subsampling_y) {
+ 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_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 +
+ subsampling_x) >> subsampling_x;
+
+ assert(ybf->y_height - ybf->y_crop_height < 16);
+ assert(ybf->y_width - ybf->y_crop_width < 16);
+ assert(ybf->y_height - ybf->y_crop_height >= 0);
+ assert(ybf->y_width - ybf->y_crop_width >= 0);
+
+ 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);
+
+ extend_plane(ybf->u_buffer, ybf->uv_stride,
+ c_w, c_h, c_et, c_el, c_eb, c_er);
+
+ extend_plane(ybf->v_buffer, ybf->uv_stride,
+ c_w, c_h, c_et, c_el, c_eb, c_er);
+}
+#endif
/****************************************************************************
*
diff --git a/vpx_scale/vpx_scale_rtcd.sh b/vpx_scale/vpx_scale_rtcd.sh
index e2bade077..b4f89077d 100644
--- a/vpx_scale/vpx_scale_rtcd.sh
+++ b/vpx_scale/vpx_scale_rtcd.sh
@@ -24,3 +24,8 @@ specialize vp8_yv12_copy_frame neon
prototype void vp8_yv12_copy_y "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc"
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
+fi