media/libvpx/vp8/encoder/lookahead.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp8/encoder/lookahead.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2011 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +#ifndef LOOKAHEAD_H
    1.14 +#define LOOKAHEAD_H
    1.15 +#include "vpx_scale/yv12config.h"
    1.16 +#include "vpx/vpx_integer.h"
    1.17 +
    1.18 +struct lookahead_entry
    1.19 +{
    1.20 +    YV12_BUFFER_CONFIG  img;
    1.21 +    int64_t             ts_start;
    1.22 +    int64_t             ts_end;
    1.23 +    unsigned int        flags;
    1.24 +};
    1.25 +
    1.26 +
    1.27 +struct lookahead_ctx;
    1.28 +
    1.29 +/**\brief Initializes the lookahead stage
    1.30 + *
    1.31 + * The lookahead stage is a queue of frame buffers on which some analysis
    1.32 + * may be done when buffers are enqueued.
    1.33 + *
    1.34 + *
    1.35 + */
    1.36 +struct lookahead_ctx* vp8_lookahead_init(unsigned int width,
    1.37 +                                         unsigned int height,
    1.38 +                                         unsigned int depth
    1.39 +                                         );
    1.40 +
    1.41 +
    1.42 +/**\brief Destroys the lookahead stage
    1.43 + *
    1.44 + */
    1.45 +void vp8_lookahead_destroy(struct lookahead_ctx *ctx);
    1.46 +
    1.47 +
    1.48 +/**\brief Enqueue a source buffer
    1.49 + *
    1.50 + * This function will copy the source image into a new framebuffer with
    1.51 + * the expected stride/border.
    1.52 + *
    1.53 + * If active_map is non-NULL and there is only one frame in the queue, then copy
    1.54 + * only active macroblocks.
    1.55 + *
    1.56 + * \param[in] ctx         Pointer to the lookahead context
    1.57 + * \param[in] src         Pointer to the image to enqueue
    1.58 + * \param[in] ts_start    Timestamp for the start of this frame
    1.59 + * \param[in] ts_end      Timestamp for the end of this frame
    1.60 + * \param[in] flags       Flags set on this frame
    1.61 + * \param[in] active_map  Map that specifies which macroblock is active
    1.62 + */
    1.63 +int
    1.64 +vp8_lookahead_push(struct lookahead_ctx *ctx,
    1.65 +                   YV12_BUFFER_CONFIG   *src,
    1.66 +                   int64_t               ts_start,
    1.67 +                   int64_t               ts_end,
    1.68 +                   unsigned int          flags,
    1.69 +                   unsigned char        *active_map);
    1.70 +
    1.71 +
    1.72 +/**\brief Get the next source buffer to encode
    1.73 + *
    1.74 + *
    1.75 + * \param[in] ctx       Pointer to the lookahead context
    1.76 + * \param[in] drain     Flag indicating the buffer should be drained
    1.77 + *                      (return a buffer regardless of the current queue depth)
    1.78 + *
    1.79 + * \retval NULL, if drain set and queue is empty
    1.80 + * \retval NULL, if drain not set and queue not of the configured depth
    1.81 + *
    1.82 + */
    1.83 +struct lookahead_entry*
    1.84 +vp8_lookahead_pop(struct lookahead_ctx *ctx,
    1.85 +                  int                   drain);
    1.86 +
    1.87 +
    1.88 +#define PEEK_FORWARD   1
    1.89 +#define PEEK_BACKWARD -1
    1.90 +/**\brief Get a future source buffer to encode
    1.91 + *
    1.92 + * \param[in] ctx       Pointer to the lookahead context
    1.93 + * \param[in] index     Index of the frame to be returned, 0 == next frame
    1.94 + *
    1.95 + * \retval NULL, if no buffer exists at the specified index
    1.96 + *
    1.97 + */
    1.98 +struct lookahead_entry*
    1.99 +vp8_lookahead_peek(struct lookahead_ctx *ctx,
   1.100 +                   unsigned int          index,
   1.101 +                   int                   direction);
   1.102 +
   1.103 +
   1.104 +/**\brief Get the number of frames currently in the lookahead queue
   1.105 + *
   1.106 + * \param[in] ctx       Pointer to the lookahead context
   1.107 + */
   1.108 +unsigned int
   1.109 +vp8_lookahead_depth(struct lookahead_ctx *ctx);
   1.110 +
   1.111 +
   1.112 +#endif

mercurial