2 * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
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.
10 #ifndef VP8_ENCODER_LOOKAHEAD_H_
11 #define VP8_ENCODER_LOOKAHEAD_H_
12 #include "vpx_scale/yv12config.h"
13 #include "vpx/vpx_integer.h"
19 struct lookahead_entry
21 YV12_BUFFER_CONFIG img;
30 /**\brief Initializes the lookahead stage
32 * The lookahead stage is a queue of frame buffers on which some analysis
33 * may be done when buffers are enqueued.
37 struct lookahead_ctx* vp8_lookahead_init(unsigned int width,
43 /**\brief Destroys the lookahead stage
46 void vp8_lookahead_destroy(struct lookahead_ctx *ctx);
49 /**\brief Enqueue a source buffer
51 * This function will copy the source image into a new framebuffer with
52 * the expected stride/border.
54 * If active_map is non-NULL and there is only one frame in the queue, then copy
55 * only active macroblocks.
57 * \param[in] ctx Pointer to the lookahead context
58 * \param[in] src Pointer to the image to enqueue
59 * \param[in] ts_start Timestamp for the start of this frame
60 * \param[in] ts_end Timestamp for the end of this frame
61 * \param[in] flags Flags set on this frame
62 * \param[in] active_map Map that specifies which macroblock is active
65 vp8_lookahead_push(struct lookahead_ctx *ctx,
66 YV12_BUFFER_CONFIG *src,
70 unsigned char *active_map);
73 /**\brief Get the next source buffer to encode
76 * \param[in] ctx Pointer to the lookahead context
77 * \param[in] drain Flag indicating the buffer should be drained
78 * (return a buffer regardless of the current queue depth)
80 * \retval NULL, if drain set and queue is empty
81 * \retval NULL, if drain not set and queue not of the configured depth
84 struct lookahead_entry*
85 vp8_lookahead_pop(struct lookahead_ctx *ctx,
89 #define PEEK_FORWARD 1
90 #define PEEK_BACKWARD -1
91 /**\brief Get a future source buffer to encode
93 * \param[in] ctx Pointer to the lookahead context
94 * \param[in] index Index of the frame to be returned, 0 == next frame
96 * \retval NULL, if no buffer exists at the specified index
99 struct lookahead_entry*
100 vp8_lookahead_peek(struct lookahead_ctx *ctx,
105 /**\brief Get the number of frames currently in the lookahead queue
107 * \param[in] ctx Pointer to the lookahead context
110 vp8_lookahead_depth(struct lookahead_ctx *ctx);
117 #endif // VP8_ENCODER_LOOKAHEAD_H_