summaryrefslogtreecommitdiff
path: root/vpx_scale
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-05-15 17:55:08 -0700
committerJohn Koleszar <jkoleszar@google.com>2013-05-16 22:21:09 -0700
commit679e4abdd5f733ab544689ce210b42d37e7ce164 (patch)
treeb2afbb63f8dc55e5f3ba974617bdce10b5ab34e1 /vpx_scale
parent16ac5a5cde0472fc29719aab7ad0958d1492df43 (diff)
downloadlibvpx-679e4abdd5f733ab544689ce210b42d37e7ce164.tar.gz
libvpx-679e4abdd5f733ab544689ce210b42d37e7ce164.tar.bz2
libvpx-679e4abdd5f733ab544689ce210b42d37e7ce164.zip
Initial version of alpha channel support
This is a mostly-working implementation of an extra channel in the bitstream. Configure with --enable-alpha to test. Notable TODOs: - Add extra channel to all mismatch tests, PSNR, SSIM, etc - Configurable subsampling - Variable number of planes (currently always uses all 4) - Loop filtering - Per-plane lossless quantizer - ARNR support This implementation just uses the same contents as the Y channel for the A channel, due to lack of content and general pain in playing back 4 channel content. A later patch will use the actual alpha channel passed in from outside the codec. Change-Id: Ibf81f023b1c570bd84b3064e9b4b8ae52e087592
Diffstat (limited to 'vpx_scale')
-rw-r--r--vpx_scale/generic/yv12config.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
index 99e3543ac..632ff71f4 100644
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -135,8 +135,19 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
const int uv_border_w = border >> ss_x;
const int uv_border_h = border >> ss_y;
const int uvplane_size = (uv_height + 2 * uv_border_h) * uv_stride;
+#if CONFIG_ALPHA
+ const int alpha_width = aligned_width;
+ const int alpha_height = aligned_height;
+ const int alpha_stride = y_stride;
+ const int alpha_border_w = border;
+ const int alpha_border_h = border;
+ const int alpha_plane_size = (alpha_height + 2 * alpha_border_h) *
+ alpha_stride;
+ const int frame_size = yplane_size + 2 * uvplane_size +
+ alpha_plane_size;
+#else
const int frame_size = yplane_size + 2 * uvplane_size;
-
+#endif
if (!ybf->buffer_alloc) {
ybf->buffer_alloc = vpx_memalign(32, frame_size);
ybf->buffer_alloc_sz = frame_size;
@@ -172,6 +183,13 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size +
(uv_border_h * uv_stride) + uv_border_w;
+#if CONFIG_ALPHA
+ ybf->alpha_width = alpha_width;
+ ybf->alpha_height = alpha_height;
+ ybf->alpha_stride = alpha_stride;
+ ybf->alpha_buffer = ybf->buffer_alloc + yplane_size + 2 * uvplane_size +
+ (alpha_border_h * alpha_stride) + alpha_border_w;
+#endif
ybf->corrupted = 0; /* assume not currupted by errors */
return 0;
}