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 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 } else { | 28 } else { |
29 if (!yv12->subsampling_x) { | 29 if (!yv12->subsampling_x) { |
30 img->fmt = VPX_IMG_FMT_I440; | 30 img->fmt = VPX_IMG_FMT_I440; |
31 bps = 16; | 31 bps = 16; |
32 } else { | 32 } else { |
33 img->fmt = VPX_IMG_FMT_I420; | 33 img->fmt = VPX_IMG_FMT_I420; |
34 bps = 12; | 34 bps = 12; |
35 } | 35 } |
36 } | 36 } |
| 37 img->cs = yv12->color_space; |
37 img->bit_depth = 8; | 38 img->bit_depth = 8; |
38 img->w = yv12->y_stride; | 39 img->w = yv12->y_stride; |
39 img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3); | 40 img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3); |
40 img->d_w = yv12->y_crop_width; | 41 img->d_w = yv12->y_crop_width; |
41 img->d_h = yv12->y_crop_height; | 42 img->d_h = yv12->y_crop_height; |
42 img->x_chroma_shift = yv12->subsampling_x; | 43 img->x_chroma_shift = yv12->subsampling_x; |
43 img->y_chroma_shift = yv12->subsampling_y; | 44 img->y_chroma_shift = yv12->subsampling_y; |
44 img->planes[VPX_PLANE_Y] = yv12->y_buffer; | 45 img->planes[VPX_PLANE_Y] = yv12->y_buffer; |
45 img->planes[VPX_PLANE_U] = yv12->u_buffer; | 46 img->planes[VPX_PLANE_U] = yv12->u_buffer; |
46 img->planes[VPX_PLANE_V] = yv12->v_buffer; | 47 img->planes[VPX_PLANE_V] = yv12->v_buffer; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 86 |
86 yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 | 87 yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 |
87 : yv12->y_width; | 88 : yv12->y_width; |
88 yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 | 89 yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 |
89 : yv12->y_height; | 90 : yv12->y_height; |
90 yv12->uv_crop_width = yv12->uv_width; | 91 yv12->uv_crop_width = yv12->uv_width; |
91 yv12->uv_crop_height = yv12->uv_height; | 92 yv12->uv_crop_height = yv12->uv_height; |
92 | 93 |
93 yv12->y_stride = img->stride[VPX_PLANE_Y]; | 94 yv12->y_stride = img->stride[VPX_PLANE_Y]; |
94 yv12->uv_stride = img->stride[VPX_PLANE_U]; | 95 yv12->uv_stride = img->stride[VPX_PLANE_U]; |
| 96 yv12->color_space = img->cs; |
95 | 97 |
96 #if CONFIG_VP9_HIGHBITDEPTH | 98 #if CONFIG_VP9_HIGHBITDEPTH |
97 if (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) { | 99 if (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) { |
98 // In vpx_image_t | 100 // In vpx_image_t |
99 // planes point to uint8 address of start of data | 101 // planes point to uint8 address of start of data |
100 // stride counts uint8s to reach next row | 102 // stride counts uint8s to reach next row |
101 // In YV12_BUFFER_CONFIG | 103 // In YV12_BUFFER_CONFIG |
102 // y_buffer, u_buffer, v_buffer point to uint16 address of data | 104 // y_buffer, u_buffer, v_buffer point to uint16 address of data |
103 // stride and border counts in uint16s | 105 // stride and border counts in uint16s |
104 // This means that all the address calculations in the main body of code | 106 // This means that all the address calculations in the main body of code |
(...skipping 12 matching lines...) Expand all Loading... |
117 yv12->border = (yv12->y_stride - img->w) / 2; | 119 yv12->border = (yv12->y_stride - img->w) / 2; |
118 #else | 120 #else |
119 yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2; | 121 yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2; |
120 #endif // CONFIG_VP9_HIGHBITDEPTH | 122 #endif // CONFIG_VP9_HIGHBITDEPTH |
121 yv12->subsampling_x = img->x_chroma_shift; | 123 yv12->subsampling_x = img->x_chroma_shift; |
122 yv12->subsampling_y = img->y_chroma_shift; | 124 yv12->subsampling_y = img->y_chroma_shift; |
123 return VPX_CODEC_OK; | 125 return VPX_CODEC_OK; |
124 } | 126 } |
125 | 127 |
126 #endif // VP9_VP9_IFACE_COMMON_H_ | 128 #endif // VP9_VP9_IFACE_COMMON_H_ |
OLD | NEW |