| 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> |
| 11 #include <stdlib.h> | 11 #include <stdlib.h> |
| 12 | 12 |
| 13 #include "vpx_config.h" | 13 #include "./vpx_config.h" |
| 14 #include "vp9/common/vp9_common.h" | 14 #include "vp9/common/vp9_common.h" |
| 15 #include "vp9/encoder/vp9_lookahead.h" | 15 #include "vp9/encoder/vp9_lookahead.h" |
| 16 #include "vp9/common/vp9_extend.h" | 16 #include "vp9/common/vp9_extend.h" |
| 17 | 17 |
| 18 struct lookahead_ctx { | 18 struct lookahead_ctx { |
| 19 unsigned int max_sz; /* Absolute size of the queue */ | 19 unsigned int max_sz; /* Absolute size of the queue */ |
| 20 unsigned int sz; /* Number of buffers currently in the queue */ | 20 unsigned int sz; /* Number of buffers currently in the queue */ |
| 21 unsigned int read_idx; /* Read index */ | 21 unsigned int read_idx; /* Read index */ |
| 22 unsigned int write_idx; /* Write index */ | 22 unsigned int write_idx; /* Write index */ |
| 23 struct lookahead_entry *buf; /* Buffer list */ | 23 struct lookahead_entry *buf; /* Buffer list */ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 ctx->buf = calloc(depth, sizeof(*ctx->buf)); | 70 ctx->buf = calloc(depth, sizeof(*ctx->buf)); |
| 71 if (!ctx->buf) | 71 if (!ctx->buf) |
| 72 goto bail; | 72 goto bail; |
| 73 for (i = 0; i < depth; i++) | 73 for (i = 0; i < depth; i++) |
| 74 if (vp9_alloc_frame_buffer(&ctx->buf[i].img, | 74 if (vp9_alloc_frame_buffer(&ctx->buf[i].img, |
| 75 width, height, subsampling_x, subsampling_y, | 75 width, height, subsampling_x, subsampling_y, |
| 76 VP9BORDERINPIXELS)) | 76 VP9BORDERINPIXELS)) |
| 77 goto bail; | 77 goto bail; |
| 78 } | 78 } |
| 79 return ctx; | 79 return ctx; |
| 80 bail: | 80 bail: |
| 81 vp9_lookahead_destroy(ctx); | 81 vp9_lookahead_destroy(ctx); |
| 82 return NULL; | 82 return NULL; |
| 83 } | 83 } |
| 84 | 84 |
| 85 #define USE_PARTIAL_COPY 0 | 85 #define USE_PARTIAL_COPY 0 |
| 86 | 86 |
| 87 int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src, | 87 int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src, |
| 88 int64_t ts_start, int64_t ts_end, unsigned int flags, | 88 int64_t ts_start, int64_t ts_end, unsigned int flags, |
| 89 unsigned char *active_map) { | 89 unsigned char *active_map) { |
| 90 struct lookahead_entry *buf; | 90 struct lookahead_entry *buf; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (index >= (int)ctx->max_sz) | 179 if (index >= (int)ctx->max_sz) |
| 180 index -= ctx->max_sz; | 180 index -= ctx->max_sz; |
| 181 buf = ctx->buf + index; | 181 buf = ctx->buf + index; |
| 182 } | 182 } |
| 183 return buf; | 183 return buf; |
| 184 } | 184 } |
| 185 | 185 |
| 186 unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) { | 186 unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) { |
| 187 return ctx->sz; | 187 return ctx->sz; |
| 188 } | 188 } |
| OLD | NEW |