| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (!ybf->buffer_alloc) { | 53 if (!ybf->buffer_alloc) { |
| 54 ybf->buffer_alloc = vpx_memalign(32, frame_size); | 54 ybf->buffer_alloc = vpx_memalign(32, frame_size); |
| 55 ybf->buffer_alloc_sz = frame_size; | 55 ybf->buffer_alloc_sz = frame_size; |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) | 58 if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) |
| 59 return -1; | 59 return -1; |
| 60 | 60 |
| 61 /* Only support allocating buffers that have a border that's a multiple | 61 /* Only support allocating buffers that have a border that's a multiple |
| 62 * of 32. The border restriction is required to get 16-byte alignment of | 62 * of 32. The border restriction is required to get 16-byte alignment of |
| 63 * the start of the chroma rows without intoducing an arbitrary gap | 63 * the start of the chroma rows without introducing an arbitrary gap |
| 64 * between planes, which would break the semantics of things like | 64 * between planes, which would break the semantics of things like |
| 65 * vpx_img_set_rect(). */ | 65 * vpx_img_set_rect(). */ |
| 66 if (border & 0x1f) | 66 if (border & 0x1f) |
| 67 return -3; | 67 return -3; |
| 68 | 68 |
| 69 ybf->y_crop_width = width; | 69 ybf->y_crop_width = width; |
| 70 ybf->y_crop_height = height; | 70 ybf->y_crop_height = height; |
| 71 ybf->y_width = aligned_width; | 71 ybf->y_width = aligned_width; |
| 72 ybf->y_height = aligned_height; | 72 ybf->y_height = aligned_height; |
| 73 ybf->y_stride = y_stride; | 73 ybf->y_stride = y_stride; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (!ybf->buffer_alloc) { | 151 if (!ybf->buffer_alloc) { |
| 152 ybf->buffer_alloc = vpx_memalign(32, frame_size); | 152 ybf->buffer_alloc = vpx_memalign(32, frame_size); |
| 153 ybf->buffer_alloc_sz = frame_size; | 153 ybf->buffer_alloc_sz = frame_size; |
| 154 } | 154 } |
| 155 | 155 |
| 156 if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) | 156 if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size) |
| 157 return -1; | 157 return -1; |
| 158 | 158 |
| 159 /* Only support allocating buffers that have a border that's a multiple | 159 /* Only support allocating buffers that have a border that's a multiple |
| 160 * of 32. The border restriction is required to get 16-byte alignment of | 160 * of 32. The border restriction is required to get 16-byte alignment of |
| 161 * the start of the chroma rows without intoducing an arbitrary gap | 161 * the start of the chroma rows without introducing an arbitrary gap |
| 162 * between planes, which would break the semantics of things like | 162 * between planes, which would break the semantics of things like |
| 163 * vpx_img_set_rect(). */ | 163 * vpx_img_set_rect(). */ |
| 164 if (border & 0x1f) | 164 if (border & 0x1f) |
| 165 return -3; | 165 return -3; |
| 166 | 166 |
| 167 ybf->y_crop_width = width; | 167 ybf->y_crop_width = width; |
| 168 ybf->y_crop_height = height; | 168 ybf->y_crop_height = height; |
| 169 ybf->y_width = aligned_width; | 169 ybf->y_width = aligned_width; |
| 170 ybf->y_height = aligned_height; | 170 ybf->y_height = aligned_height; |
| 171 ybf->y_stride = y_stride; | 171 ybf->y_stride = y_stride; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 185 ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + | 185 ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + |
| 186 (uv_border_h * uv_stride) + uv_border_w; | 186 (uv_border_h * uv_stride) + uv_border_w; |
| 187 | 187 |
| 188 #if CONFIG_ALPHA | 188 #if CONFIG_ALPHA |
| 189 ybf->alpha_width = alpha_width; | 189 ybf->alpha_width = alpha_width; |
| 190 ybf->alpha_height = alpha_height; | 190 ybf->alpha_height = alpha_height; |
| 191 ybf->alpha_stride = alpha_stride; | 191 ybf->alpha_stride = alpha_stride; |
| 192 ybf->alpha_buffer = ybf->buffer_alloc + yplane_size + 2 * uvplane_size + | 192 ybf->alpha_buffer = ybf->buffer_alloc + yplane_size + 2 * uvplane_size + |
| 193 (alpha_border_h * alpha_stride) + alpha_border_w; | 193 (alpha_border_h * alpha_stride) + alpha_border_w; |
| 194 #endif | 194 #endif |
| 195 ybf->corrupted = 0; /* assume not currupted by errors */ | 195 ybf->corrupted = 0; /* assume not corrupted by errors */ |
| 196 return 0; | 196 return 0; |
| 197 } | 197 } |
| 198 return -2; | 198 return -2; |
| 199 } | 199 } |
| 200 | 200 |
| 201 int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, | 201 int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, |
| 202 int width, int height, | 202 int width, int height, |
| 203 int ss_x, int ss_y, int border) { | 203 int ss_x, int ss_y, int border) { |
| 204 if (ybf) { | 204 if (ybf) { |
| 205 vp9_free_frame_buffer(ybf); | 205 vp9_free_frame_buffer(ybf); |
| 206 return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, border); | 206 return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, border); |
| 207 } | 207 } |
| 208 return -2; | 208 return -2; |
| 209 } | 209 } |
| 210 #endif | 210 #endif |
| OLD | NEW |