OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 goto fail; | 147 goto fail; |
148 | 148 |
149 img->img_data = (uint8_t *)vpx_memalign(buf_align, (size_t)alloc_size); | 149 img->img_data = (uint8_t *)vpx_memalign(buf_align, (size_t)alloc_size); |
150 img->img_data_owner = 1; | 150 img->img_data_owner = 1; |
151 } | 151 } |
152 | 152 |
153 if (!img->img_data) | 153 if (!img->img_data) |
154 goto fail; | 154 goto fail; |
155 | 155 |
156 img->fmt = fmt; | 156 img->fmt = fmt; |
157 img->bit_depth = (fmt & VPX_IMG_FMT_HIGH) ? 16 : 8; | 157 img->bit_depth = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 16 : 8; |
158 img->w = w; | 158 img->w = w; |
159 img->h = h; | 159 img->h = h; |
160 img->x_chroma_shift = xcs; | 160 img->x_chroma_shift = xcs; |
161 img->y_chroma_shift = ycs; | 161 img->y_chroma_shift = ycs; |
162 img->bps = bps; | 162 img->bps = bps; |
163 | 163 |
164 /* Calculate strides */ | 164 /* Calculate strides */ |
165 img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s; | 165 img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s; |
166 img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs; | 166 img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs; |
167 | 167 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 void vpx_img_free(vpx_image_t *img) { | 270 void vpx_img_free(vpx_image_t *img) { |
271 if (img) { | 271 if (img) { |
272 if (img->img_data && img->img_data_owner) | 272 if (img->img_data && img->img_data_owner) |
273 vpx_free(img->img_data); | 273 vpx_free(img->img_data); |
274 | 274 |
275 if (img->self_allocd) | 275 if (img->self_allocd) |
276 free(img); | 276 free(img); |
277 } | 277 } |
278 } | 278 } |
OLD | NEW |