| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, | 108 int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, |
| 109 int width, int height, int border) { | 109 int width, int height, int border) { |
| 110 if (ybf) { | 110 if (ybf) { |
| 111 vp8_yv12_de_alloc_frame_buffer(ybf); | 111 vp8_yv12_de_alloc_frame_buffer(ybf); |
| 112 return vp8_yv12_realloc_frame_buffer(ybf, width, height, border); | 112 return vp8_yv12_realloc_frame_buffer(ybf, width, height, border); |
| 113 } | 113 } |
| 114 return -2; | 114 return -2; |
| 115 } | 115 } |
| 116 | 116 |
| 117 #if CONFIG_VP9 | 117 #if CONFIG_VP9 || CONFIG_VP10 |
| 118 // TODO(jkoleszar): Maybe replace this with struct vpx_image | 118 // TODO(jkoleszar): Maybe replace this with struct vpx_image |
| 119 | 119 |
| 120 int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) { | 120 int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) { |
| 121 if (ybf) { | 121 if (ybf) { |
| 122 if (ybf->buffer_alloc_sz > 0) { | 122 if (ybf->buffer_alloc_sz > 0) { |
| 123 vpx_free(ybf->buffer_alloc); | 123 vpx_free(ybf->buffer_alloc); |
| 124 } | 124 } |
| 125 | 125 |
| 126 /* buffer_alloc isn't accessed by most functions. Rather y_buffer, | 126 /* buffer_alloc isn't accessed by most functions. Rather y_buffer, |
| 127 u_buffer and v_buffer point to buffer_alloc and are used. Clear out | 127 u_buffer and v_buffer point to buffer_alloc and are used. Clear out |
| 128 all of this so that a freed pointer isn't inadvertently used */ | 128 all of this so that a freed pointer isn't inadvertently used */ |
| 129 memset(ybf, 0, sizeof(YV12_BUFFER_CONFIG)); | 129 memset(ybf, 0, sizeof(YV12_BUFFER_CONFIG)); |
| 130 } else { | 130 } else { |
| 131 return -1; | 131 return -1; |
| 132 } | 132 } |
| 133 | 133 |
| 134 return 0; | 134 return 0; |
| 135 } | 135 } |
| 136 | 136 |
| 137 int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, | 137 int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, |
| 138 int width, int height, | 138 int width, int height, |
| 139 int ss_x, int ss_y, | 139 int ss_x, int ss_y, |
| 140 #if CONFIG_VP9_HIGHBITDEPTH | 140 #if CONFIG_VP9_HIGHBITDEPTH |
| 141 int use_highbitdepth, | 141 int use_highbitdepth, |
| 142 #endif | 142 #endif |
| 143 int border, | 143 int border, |
| 144 int byte_alignment, | 144 int byte_alignment, |
| 145 vpx_codec_frame_buffer_t *fb, | 145 vpx_codec_frame_buffer_t *fb, |
| 146 vpx_get_frame_buffer_cb_fn_t cb, | 146 vpx_get_frame_buffer_cb_fn_t cb, |
| 147 void *cb_priv) { | 147 void *cb_priv) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 ybf->alpha_buffer = (uint8_t *)yv12_align_addr( | 275 ybf->alpha_buffer = (uint8_t *)yv12_align_addr( |
| 276 buf + yplane_size + 2 * uvplane_size + | 276 buf + yplane_size + 2 * uvplane_size + |
| 277 (alpha_border_h * alpha_stride) + alpha_border_w, vp9_byte_align); | 277 (alpha_border_h * alpha_stride) + alpha_border_w, vp9_byte_align); |
| 278 #endif | 278 #endif |
| 279 ybf->corrupted = 0; /* assume not corrupted by errors */ | 279 ybf->corrupted = 0; /* assume not corrupted by errors */ |
| 280 return 0; | 280 return 0; |
| 281 } | 281 } |
| 282 return -2; | 282 return -2; |
| 283 } | 283 } |
| 284 | 284 |
| 285 int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, | 285 int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, |
| 286 int width, int height, | 286 int width, int height, |
| 287 int ss_x, int ss_y, | 287 int ss_x, int ss_y, |
| 288 #if CONFIG_VP9_HIGHBITDEPTH | 288 #if CONFIG_VP9_HIGHBITDEPTH |
| 289 int use_highbitdepth, | 289 int use_highbitdepth, |
| 290 #endif | 290 #endif |
| 291 int border, | 291 int border, |
| 292 int byte_alignment) { | 292 int byte_alignment) { |
| 293 if (ybf) { | 293 if (ybf) { |
| 294 vp9_free_frame_buffer(ybf); | 294 vpx_free_frame_buffer(ybf); |
| 295 return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, | 295 return vpx_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, |
| 296 #if CONFIG_VP9_HIGHBITDEPTH | 296 #if CONFIG_VP9_HIGHBITDEPTH |
| 297 use_highbitdepth, | 297 use_highbitdepth, |
| 298 #endif | 298 #endif |
| 299 border, byte_alignment, NULL, NULL, NULL); | 299 border, byte_alignment, NULL, NULL, NULL); |
| 300 } | 300 } |
| 301 return -2; | 301 return -2; |
| 302 } | 302 } |
| 303 #endif | 303 #endif |
| OLD | NEW |