| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (c) 2011 The WebM project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 #ifndef LOOKAHEAD_H |
| 11 #define LOOKAHEAD_H |
| 12 #include "vpx_scale/yv12config.h" |
| 13 #include "vpx/vpx_integer.h" |
| 14 |
| 15 struct lookahead_entry |
| 16 { |
| 17 YV12_BUFFER_CONFIG img; |
| 18 int64_t ts_start; |
| 19 int64_t ts_end; |
| 20 unsigned int flags; |
| 21 }; |
| 22 |
| 23 |
| 24 struct lookahead_ctx; |
| 25 |
| 26 /**\brief Initializes the lookahead stage |
| 27 * |
| 28 * The lookahead stage is a queue of frame buffers on which some analysis |
| 29 * may be done when buffers are enqueued. |
| 30 * |
| 31 * |
| 32 */ |
| 33 struct lookahead_ctx* vp8_lookahead_init(unsigned int width, |
| 34 unsigned int height, |
| 35 unsigned int depth |
| 36 ); |
| 37 |
| 38 |
| 39 /**\brief Destroys the lookahead stage |
| 40 * |
| 41 */ |
| 42 void vp8_lookahead_destroy(struct lookahead_ctx *ctx); |
| 43 |
| 44 |
| 45 /**\brief Enqueue a source buffer |
| 46 * |
| 47 * This function will copy the source image into a new framebuffer with |
| 48 * the expected stride/border. |
| 49 * |
| 50 * \param[in] ctx Pointer to the lookahead context |
| 51 * \param[in] src Pointer to the image to enqueue |
| 52 * \param[in] ts_start Timestamp for the start of this frame |
| 53 * \param[in] ts_end Timestamp for the end of this frame |
| 54 * \param[in] flags Flags set on this frame |
| 55 */ |
| 56 int |
| 57 vp8_lookahead_push(struct lookahead_ctx *ctx, |
| 58 YV12_BUFFER_CONFIG *src, |
| 59 int64_t ts_start, |
| 60 int64_t ts_end, |
| 61 unsigned int flags); |
| 62 |
| 63 |
| 64 /**\brief Get the next source buffer to encode |
| 65 * |
| 66 * |
| 67 * \param[in] ctx Pointer to the lookahead context |
| 68 * \param[in] drain Flag indicating the buffer should be drained |
| 69 * (return a buffer regardless of the current queue depth) |
| 70 * |
| 71 * \retval NULL, if drain set and queue is empty |
| 72 * \retval NULL, if drain not set and queue not of the configured depth |
| 73 * |
| 74 */ |
| 75 struct lookahead_entry* |
| 76 vp8_lookahead_pop(struct lookahead_ctx *ctx, |
| 77 int drain); |
| 78 |
| 79 |
| 80 /**\brief Get a future source buffer to encode |
| 81 * |
| 82 * \param[in] ctx Pointer to the lookahead context |
| 83 * \param[in] index Index of the frame to be returned, 0 == next frame |
| 84 * |
| 85 * \retval NULL, if no buffer exists at the specified index |
| 86 * |
| 87 */ |
| 88 struct lookahead_entry* |
| 89 vp8_lookahead_peek(struct lookahead_ctx *ctx, |
| 90 int index); |
| 91 |
| 92 |
| 93 /**\brief Get the number of frames currently in the lookahead queue |
| 94 * |
| 95 * \param[in] ctx Pointer to the lookahead context |
| 96 */ |
| 97 unsigned int |
| 98 vp8_lookahead_depth(struct lookahead_ctx *ctx); |
| 99 |
| 100 |
| 101 #endif |
| OLD | NEW |