OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 #include <assert.h> | 10 #include <assert.h> |
(...skipping 20 matching lines...) Expand all Loading... |
31 return buf; | 31 return buf; |
32 } | 32 } |
33 | 33 |
34 | 34 |
35 void vp9_lookahead_destroy(struct lookahead_ctx *ctx) { | 35 void vp9_lookahead_destroy(struct lookahead_ctx *ctx) { |
36 if (ctx) { | 36 if (ctx) { |
37 if (ctx->buf) { | 37 if (ctx->buf) { |
38 unsigned int i; | 38 unsigned int i; |
39 | 39 |
40 for (i = 0; i < ctx->max_sz; i++) | 40 for (i = 0; i < ctx->max_sz; i++) |
41 vp9_free_frame_buffer(&ctx->buf[i].img); | 41 vpx_free_frame_buffer(&ctx->buf[i].img); |
42 free(ctx->buf); | 42 free(ctx->buf); |
43 } | 43 } |
44 free(ctx); | 44 free(ctx); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 struct lookahead_ctx *vp9_lookahead_init(unsigned int width, | 49 struct lookahead_ctx *vp9_lookahead_init(unsigned int width, |
50 unsigned int height, | 50 unsigned int height, |
51 unsigned int subsampling_x, | 51 unsigned int subsampling_x, |
(...skipping 13 matching lines...) Expand all Loading... |
65 // Allocate the lookahead structures | 65 // Allocate the lookahead structures |
66 ctx = calloc(1, sizeof(*ctx)); | 66 ctx = calloc(1, sizeof(*ctx)); |
67 if (ctx) { | 67 if (ctx) { |
68 const int legacy_byte_alignment = 0; | 68 const int legacy_byte_alignment = 0; |
69 unsigned int i; | 69 unsigned int i; |
70 ctx->max_sz = depth; | 70 ctx->max_sz = depth; |
71 ctx->buf = calloc(depth, sizeof(*ctx->buf)); | 71 ctx->buf = calloc(depth, sizeof(*ctx->buf)); |
72 if (!ctx->buf) | 72 if (!ctx->buf) |
73 goto bail; | 73 goto bail; |
74 for (i = 0; i < depth; i++) | 74 for (i = 0; i < depth; i++) |
75 if (vp9_alloc_frame_buffer(&ctx->buf[i].img, | 75 if (vpx_alloc_frame_buffer(&ctx->buf[i].img, |
76 width, height, subsampling_x, subsampling_y, | 76 width, height, subsampling_x, subsampling_y, |
77 #if CONFIG_VP9_HIGHBITDEPTH | 77 #if CONFIG_VP9_HIGHBITDEPTH |
78 use_highbitdepth, | 78 use_highbitdepth, |
79 #endif | 79 #endif |
80 VP9_ENC_BORDER_IN_PIXELS, | 80 VP9_ENC_BORDER_IN_PIXELS, |
81 legacy_byte_alignment)) | 81 legacy_byte_alignment)) |
82 goto bail; | 82 goto bail; |
83 } | 83 } |
84 return ctx; | 84 return ctx; |
85 bail: | 85 bail: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 col = active_end; | 165 col = active_end; |
166 } | 166 } |
167 | 167 |
168 active_map += mb_cols; | 168 active_map += mb_cols; |
169 } | 169 } |
170 } else { | 170 } else { |
171 #endif | 171 #endif |
172 if (larger_dimensions) { | 172 if (larger_dimensions) { |
173 YV12_BUFFER_CONFIG new_img; | 173 YV12_BUFFER_CONFIG new_img; |
174 memset(&new_img, 0, sizeof(new_img)); | 174 memset(&new_img, 0, sizeof(new_img)); |
175 if (vp9_alloc_frame_buffer(&new_img, | 175 if (vpx_alloc_frame_buffer(&new_img, |
176 width, height, subsampling_x, subsampling_y, | 176 width, height, subsampling_x, subsampling_y, |
177 #if CONFIG_VP9_HIGHBITDEPTH | 177 #if CONFIG_VP9_HIGHBITDEPTH |
178 use_highbitdepth, | 178 use_highbitdepth, |
179 #endif | 179 #endif |
180 VP9_ENC_BORDER_IN_PIXELS, | 180 VP9_ENC_BORDER_IN_PIXELS, |
181 0)) | 181 0)) |
182 return 1; | 182 return 1; |
183 vp9_free_frame_buffer(&buf->img); | 183 vpx_free_frame_buffer(&buf->img); |
184 buf->img = new_img; | 184 buf->img = new_img; |
185 } else if (new_dimensions) { | 185 } else if (new_dimensions) { |
186 buf->img.y_crop_width = src->y_crop_width; | 186 buf->img.y_crop_width = src->y_crop_width; |
187 buf->img.y_crop_height = src->y_crop_height; | 187 buf->img.y_crop_height = src->y_crop_height; |
188 buf->img.uv_crop_width = src->uv_crop_width; | 188 buf->img.uv_crop_width = src->uv_crop_width; |
189 buf->img.uv_crop_height = src->uv_crop_height; | 189 buf->img.uv_crop_height = src->uv_crop_height; |
190 buf->img.subsampling_x = src->subsampling_x; | 190 buf->img.subsampling_x = src->subsampling_x; |
191 buf->img.subsampling_y = src->subsampling_y; | 191 buf->img.subsampling_y = src->subsampling_y; |
192 } | 192 } |
193 // Partial copy not implemented yet | 193 // Partial copy not implemented yet |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 buf = ctx->buf + index; | 236 buf = ctx->buf + index; |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 return buf; | 240 return buf; |
241 } | 241 } |
242 | 242 |
243 unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) { | 243 unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) { |
244 return ctx->sz; | 244 return ctx->sz; |
245 } | 245 } |
OLD | NEW |