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 VP9_ENCODER_VP9_LOOKAHEAD_H_ |
| 11 #define VP9_ENCODER_VP9_LOOKAHEAD_H_ |
| 12 #include "vpx_scale/yv12config.h" |
| 13 #include "vpx/vpx_integer.h" |
| 14 |
| 15 struct lookahead_entry { |
| 16 YV12_BUFFER_CONFIG img; |
| 17 int64_t ts_start; |
| 18 int64_t ts_end; |
| 19 unsigned int flags; |
| 20 }; |
| 21 |
| 22 |
| 23 struct lookahead_ctx; |
| 24 |
| 25 /**\brief Initializes the lookahead stage |
| 26 * |
| 27 * The lookahead stage is a queue of frame buffers on which some analysis |
| 28 * may be done when buffers are enqueued. |
| 29 * |
| 30 * |
| 31 */ |
| 32 struct lookahead_ctx *vp9_lookahead_init(unsigned int width, |
| 33 unsigned int height, |
| 34 unsigned int depth |
| 35 ); |
| 36 |
| 37 |
| 38 /**\brief Destroys the lookahead stage |
| 39 * |
| 40 */ |
| 41 void vp9_lookahead_destroy(struct lookahead_ctx *ctx); |
| 42 |
| 43 |
| 44 /**\brief Enqueue a source buffer |
| 45 * |
| 46 * This function will copy the source image into a new framebuffer with |
| 47 * the expected stride/border. |
| 48 * |
| 49 * If active_map is non-NULL and there is only one frame in the queue, then copy |
| 50 * only active macroblocks. |
| 51 * |
| 52 * \param[in] ctx Pointer to the lookahead context |
| 53 * \param[in] src Pointer to the image to enqueue |
| 54 * \param[in] ts_start Timestamp for the start of this frame |
| 55 * \param[in] ts_end Timestamp for the end of this frame |
| 56 * \param[in] flags Flags set on this frame |
| 57 * \param[in] active_map Map that specifies which macroblock is active |
| 58 */ |
| 59 int |
| 60 vp9_lookahead_push(struct lookahead_ctx *ctx, |
| 61 YV12_BUFFER_CONFIG *src, |
| 62 int64_t ts_start, |
| 63 int64_t ts_end, |
| 64 unsigned int flags, |
| 65 unsigned char *active_map); |
| 66 |
| 67 |
| 68 /**\brief Get the next source buffer to encode |
| 69 * |
| 70 * |
| 71 * \param[in] ctx Pointer to the lookahead context |
| 72 * \param[in] drain Flag indicating the buffer should be drained |
| 73 * (return a buffer regardless of the current queue depth) |
| 74 * |
| 75 * \retval NULL, if drain set and queue is empty |
| 76 * \retval NULL, if drain not set and queue not of the configured depth |
| 77 * |
| 78 */ |
| 79 struct lookahead_entry * |
| 80 vp9_lookahead_pop(struct lookahead_ctx *ctx, |
| 81 int drain); |
| 82 |
| 83 |
| 84 /**\brief Get a future source buffer to encode |
| 85 * |
| 86 * \param[in] ctx Pointer to the lookahead context |
| 87 * \param[in] index Index of the frame to be returned, 0 == next frame |
| 88 * |
| 89 * \retval NULL, if no buffer exists at the specified index |
| 90 * |
| 91 */ |
| 92 struct lookahead_entry * |
| 93 vp9_lookahead_peek(struct lookahead_ctx *ctx, |
| 94 int index); |
| 95 |
| 96 |
| 97 /**\brief Get the number of frames currently in the lookahead queue |
| 98 * |
| 99 * \param[in] ctx Pointer to the lookahead context |
| 100 */ |
| 101 unsigned int |
| 102 vp9_lookahead_depth(struct lookahead_ctx *ctx); |
| 103 |
| 104 |
| 105 #endif |
OLD | NEW |