| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #ifndef VP9_VP9_IFACE_COMMON_H_ | 10 #ifndef VP9_VP9_IFACE_COMMON_H_ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 img->bit_depth = 8; | 34 img->bit_depth = 8; |
| 35 img->w = yv12->y_stride; | 35 img->w = yv12->y_stride; |
| 36 img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3); | 36 img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3); |
| 37 img->d_w = yv12->y_crop_width; | 37 img->d_w = yv12->y_crop_width; |
| 38 img->d_h = yv12->y_crop_height; | 38 img->d_h = yv12->y_crop_height; |
| 39 img->x_chroma_shift = ss_x; | 39 img->x_chroma_shift = ss_x; |
| 40 img->y_chroma_shift = ss_y; | 40 img->y_chroma_shift = ss_y; |
| 41 img->planes[VPX_PLANE_Y] = yv12->y_buffer; | 41 img->planes[VPX_PLANE_Y] = yv12->y_buffer; |
| 42 img->planes[VPX_PLANE_U] = yv12->u_buffer; | 42 img->planes[VPX_PLANE_U] = yv12->u_buffer; |
| 43 img->planes[VPX_PLANE_V] = yv12->v_buffer; | 43 img->planes[VPX_PLANE_V] = yv12->v_buffer; |
| 44 img->planes[VPX_PLANE_ALPHA] = yv12->alpha_buffer; | 44 img->planes[VPX_PLANE_ALPHA] = NULL; |
| 45 img->stride[VPX_PLANE_Y] = yv12->y_stride; | 45 img->stride[VPX_PLANE_Y] = yv12->y_stride; |
| 46 img->stride[VPX_PLANE_U] = yv12->uv_stride; | 46 img->stride[VPX_PLANE_U] = yv12->uv_stride; |
| 47 img->stride[VPX_PLANE_V] = yv12->uv_stride; | 47 img->stride[VPX_PLANE_V] = yv12->uv_stride; |
| 48 img->stride[VPX_PLANE_ALPHA] = yv12->alpha_stride; | 48 img->stride[VPX_PLANE_ALPHA] = yv12->y_stride; |
| 49 img->bps = bps; | 49 img->bps = bps; |
| 50 img->user_priv = user_priv; | 50 img->user_priv = user_priv; |
| 51 img->img_data = yv12->buffer_alloc; | 51 img->img_data = yv12->buffer_alloc; |
| 52 img->img_data_owner = 0; | 52 img->img_data_owner = 0; |
| 53 img->self_allocd = 0; | 53 img->self_allocd = 0; |
| 54 } | 54 } |
| 55 | 55 |
| 56 static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, | 56 static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, |
| 57 YV12_BUFFER_CONFIG *yv12) { | 57 YV12_BUFFER_CONFIG *yv12) { |
| 58 yv12->y_buffer = img->planes[VPX_PLANE_Y]; | 58 yv12->y_buffer = img->planes[VPX_PLANE_Y]; |
| 59 yv12->u_buffer = img->planes[VPX_PLANE_U]; | 59 yv12->u_buffer = img->planes[VPX_PLANE_U]; |
| 60 yv12->v_buffer = img->planes[VPX_PLANE_V]; | 60 yv12->v_buffer = img->planes[VPX_PLANE_V]; |
| 61 yv12->alpha_buffer = img->planes[VPX_PLANE_ALPHA]; | |
| 62 | 61 |
| 63 yv12->y_crop_width = img->d_w; | 62 yv12->y_crop_width = img->d_w; |
| 64 yv12->y_crop_height = img->d_h; | 63 yv12->y_crop_height = img->d_h; |
| 65 yv12->y_width = img->d_w; | 64 yv12->y_width = img->d_w; |
| 66 yv12->y_height = img->d_h; | 65 yv12->y_height = img->d_h; |
| 67 | 66 |
| 68 yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 | 67 yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 |
| 69 : yv12->y_width; | 68 : yv12->y_width; |
| 70 yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 | 69 yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 |
| 71 : yv12->y_height; | 70 : yv12->y_height; |
| 72 | 71 |
| 73 yv12->alpha_width = yv12->alpha_buffer ? img->d_w : 0; | |
| 74 yv12->alpha_height = yv12->alpha_buffer ? img->d_h : 0; | |
| 75 | |
| 76 yv12->y_stride = img->stride[VPX_PLANE_Y]; | 72 yv12->y_stride = img->stride[VPX_PLANE_Y]; |
| 77 yv12->uv_stride = img->stride[VPX_PLANE_U]; | 73 yv12->uv_stride = img->stride[VPX_PLANE_U]; |
| 78 yv12->alpha_stride = yv12->alpha_buffer ? img->stride[VPX_PLANE_ALPHA] : 0; | |
| 79 | 74 |
| 80 yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2; | 75 yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2; |
| 81 #if CONFIG_ALPHA | |
| 82 // For development purposes, force alpha to hold the same data as Y for now. | |
| 83 yv12->alpha_buffer = yv12->y_buffer; | |
| 84 yv12->alpha_width = yv12->y_width; | |
| 85 yv12->alpha_height = yv12->y_height; | |
| 86 yv12->alpha_stride = yv12->y_stride; | |
| 87 #endif | |
| 88 return VPX_CODEC_OK; | 76 return VPX_CODEC_OK; |
| 89 } | 77 } |
| 90 | 78 |
| 91 #endif // VP9_VP9_IFACE_COMMON_H_ | 79 #endif // VP9_VP9_IFACE_COMMON_H_ |
| OLD | NEW |