diff options
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_ |