diff options
author | Dmitry Kovalev <dkovalev@google.com> | 2013-05-15 16:29:20 -0700 |
---|---|---|
committer | Dmitry Kovalev <dkovalev@google.com> | 2013-05-15 16:29:20 -0700 |
commit | b7a4f8a6db9e83ef23e4d51341db2404d938e57e (patch) | |
tree | caaa4250a00a44a93f7ba5f8fd176bb34bb3edf0 /vp9/vp9_iface_common.h | |
parent | 1f26840fbfbef085ed53016bfc91705f148916fd (diff) | |
download | libvpx-b7a4f8a6db9e83ef23e4d51341db2404d938e57e.tar libvpx-b7a4f8a6db9e83ef23e4d51341db2404d938e57e.tar.gz libvpx-b7a4f8a6db9e83ef23e4d51341db2404d938e57e.tar.bz2 libvpx-b7a4f8a6db9e83ef23e4d51341db2404d938e57e.zip |
Adding alpha plane to YV12_BUFFER_CONFIG structure.
Change-Id: I8b2687138df636b2b78c8cc5156e3882b0009de0
Diffstat (limited to 'vp9/vp9_iface_common.h')
-rw-r--r-- | vp9/vp9_iface_common.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/vp9/vp9_iface_common.h b/vp9/vp9_iface_common.h index 96de5f548..84b4d398b 100644 --- a/vp9/vp9_iface_common.h +++ b/vp9/vp9_iface_common.h @@ -37,11 +37,11 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12, 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] = NULL; + img->planes[VPX_PLANE_ALPHA] = yv12->alpha_buffer; 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->y_stride; + img->stride[VPX_PLANE_ALPHA] = yv12->alpha_stride; img->bps = bps; img->user_priv = user_priv; img->img_data = yv12->buffer_alloc; @@ -49,4 +49,34 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12, img->self_allocd = 0; } +static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, + YV12_BUFFER_CONFIG *yv12) { + 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; + yv12->y_width = img->d_w; + yv12->y_height = img->d_h; + + yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 + : yv12->y_width; + 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; + yv12->clrtype = REG_YUV; + + return VPX_CODEC_OK; +} + #endif // VP9_VP9_IFACE_COMMON_H_ |