| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Clamp the lookahead queue depth | 59 // Clamp the lookahead queue depth |
| 60 depth = clamp(depth, 1, MAX_LAG_BUFFERS); | 60 depth = clamp(depth, 1, MAX_LAG_BUFFERS); |
| 61 | 61 |
| 62 // Allocate memory to keep previous source frames available. | 62 // Allocate memory to keep previous source frames available. |
| 63 depth += MAX_PRE_FRAMES; | 63 depth += MAX_PRE_FRAMES; |
| 64 | 64 |
| 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 unsigned int i; | 69 unsigned int i; |
| 69 ctx->max_sz = depth; | 70 ctx->max_sz = depth; |
| 70 ctx->buf = calloc(depth, sizeof(*ctx->buf)); | 71 ctx->buf = calloc(depth, sizeof(*ctx->buf)); |
| 71 if (!ctx->buf) | 72 if (!ctx->buf) |
| 72 goto bail; | 73 goto bail; |
| 73 for (i = 0; i < depth; i++) | 74 for (i = 0; i < depth; i++) |
| 74 if (vp9_alloc_frame_buffer(&ctx->buf[i].img, | 75 if (vp9_alloc_frame_buffer(&ctx->buf[i].img, |
| 75 width, height, subsampling_x, subsampling_y, | 76 width, height, subsampling_x, subsampling_y, |
| 76 #if CONFIG_VP9_HIGHBITDEPTH | 77 #if CONFIG_VP9_HIGHBITDEPTH |
| 77 use_highbitdepth, | 78 use_highbitdepth, |
| 78 #endif | 79 #endif |
| 79 VP9_ENC_BORDER_IN_PIXELS)) | 80 VP9_ENC_BORDER_IN_PIXELS, |
| 81 legacy_byte_alignment)) |
| 80 goto bail; | 82 goto bail; |
| 81 } | 83 } |
| 82 return ctx; | 84 return ctx; |
| 83 bail: | 85 bail: |
| 84 vp9_lookahead_destroy(ctx); | 86 vp9_lookahead_destroy(ctx); |
| 85 return NULL; | 87 return NULL; |
| 86 } | 88 } |
| 87 | 89 |
| 88 #define USE_PARTIAL_COPY 0 | 90 #define USE_PARTIAL_COPY 0 |
| 89 | 91 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 buf = ctx->buf + index; | 194 buf = ctx->buf + index; |
| 193 } | 195 } |
| 194 } | 196 } |
| 195 | 197 |
| 196 return buf; | 198 return buf; |
| 197 } | 199 } |
| 198 | 200 |
| 199 unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) { | 201 unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) { |
| 200 return ctx->sz; | 202 return ctx->sz; |
| 201 } | 203 } |
| OLD | NEW |