media/libvpx/vp9/encoder/vp9_lookahead.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial