aboutsummaryrefslogtreecommitdiff
path: root/libvpx/vp9/vp9_iface_common.h
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2014-08-15 09:32:37 -0700
committerVignesh Venkatasubramanian <vigneshv@google.com>2014-08-15 09:32:37 -0700
commitba6c59e9d7d7013b3906b6f4230b663422681848 (patch)
treefd3686d3a1a5598e6ea35b0006cfeb5d40a9eaa3 /libvpx/vp9/vp9_iface_common.h
parentbbeabeb879e7fa51c6395ee7ad590617dfbd5299 (diff)
downloadlibvpx-ba6c59e9d7d7013b3906b6f4230b663422681848.tar.gz
libvpx: Pull from upstream
Upstream hash: d4a47a6cc0d869bea3071c15bc61da6836026d0b Pull latest libvpx from upstream. This fixes a few vp9 encoder bugs and includes some optimizations. Also fixes a couple of configure flags in x86 to be consistent with the rest. Change-Id: Ic58e0b03cce832571a35ec73eec559cdf881d1f5
Diffstat (limited to 'libvpx/vp9/vp9_iface_common.h')
-rw-r--r--libvpx/vp9/vp9_iface_common.h30
1 files changed, 11 insertions, 19 deletions
diff --git a/libvpx/vp9/vp9_iface_common.h b/libvpx/vp9/vp9_iface_common.h
index 58256b22b..fc98b62c5 100644
--- a/libvpx/vp9/vp9_iface_common.h
+++ b/libvpx/vp9/vp9_iface_common.h
@@ -16,9 +16,11 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12,
* the Y, U, and V planes, nor other alignment adjustments that
* might be representable by a YV12_BUFFER_CONFIG, so we just
* initialize all the fields.*/
- int bps = 12;
- if (yv12->uv_height == yv12->y_height) {
- if (yv12->uv_width == yv12->y_width) {
+ const int ss_x = yv12->uv_crop_width < yv12->y_crop_width;
+ const int ss_y = yv12->uv_crop_height < yv12->y_crop_height;
+ int bps;
+ if (!ss_y) {
+ if (!ss_x) {
img->fmt = VPX_IMG_FMT_I444;
bps = 24;
} else {
@@ -27,21 +29,23 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12,
}
} else {
img->fmt = VPX_IMG_FMT_I420;
+ bps = 12;
}
+ img->bit_depth = 8;
img->w = yv12->y_stride;
img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3);
img->d_w = yv12->y_crop_width;
img->d_h = yv12->y_crop_height;
- img->x_chroma_shift = yv12->uv_width < yv12->y_width;
- img->y_chroma_shift = yv12->uv_height < yv12->y_height;
+ img->x_chroma_shift = ss_x;
+ img->y_chroma_shift = ss_y;
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
img->planes[VPX_PLANE_U] = yv12->u_buffer;
img->planes[VPX_PLANE_V] = yv12->v_buffer;
- img->planes[VPX_PLANE_ALPHA] = yv12->alpha_buffer;
+ img->planes[VPX_PLANE_ALPHA] = NULL;
img->stride[VPX_PLANE_Y] = yv12->y_stride;
img->stride[VPX_PLANE_U] = yv12->uv_stride;
img->stride[VPX_PLANE_V] = yv12->uv_stride;
- img->stride[VPX_PLANE_ALPHA] = yv12->alpha_stride;
+ img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
img->bps = bps;
img->user_priv = user_priv;
img->img_data = yv12->buffer_alloc;
@@ -54,7 +58,6 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
yv12->y_buffer = img->planes[VPX_PLANE_Y];
yv12->u_buffer = img->planes[VPX_PLANE_U];
yv12->v_buffer = img->planes[VPX_PLANE_V];
- yv12->alpha_buffer = img->planes[VPX_PLANE_ALPHA];
yv12->y_crop_width = img->d_w;
yv12->y_crop_height = img->d_h;
@@ -66,21 +69,10 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2
: yv12->y_height;
- yv12->alpha_width = yv12->alpha_buffer ? img->d_w : 0;
- yv12->alpha_height = yv12->alpha_buffer ? img->d_h : 0;
-
yv12->y_stride = img->stride[VPX_PLANE_Y];
yv12->uv_stride = img->stride[VPX_PLANE_U];
- yv12->alpha_stride = yv12->alpha_buffer ? img->stride[VPX_PLANE_ALPHA] : 0;
yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
-#if CONFIG_ALPHA
- // For development purposes, force alpha to hold the same data as Y for now.
- yv12->alpha_buffer = yv12->y_buffer;
- yv12->alpha_width = yv12->y_width;
- yv12->alpha_height = yv12->y_height;
- yv12->alpha_stride = yv12->y_stride;
-#endif
return VPX_CODEC_OK;
}