media/libvpx/vp9/encoder/vp9_lookahead.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp9/encoder/vp9_lookahead.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     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 +
    1.14 +#ifndef VP9_ENCODER_VP9_LOOKAHEAD_H_
    1.15 +#define VP9_ENCODER_VP9_LOOKAHEAD_H_
    1.16 +
    1.17 +#include "vpx_scale/yv12config.h"
    1.18 +#include "vpx/vpx_integer.h"
    1.19 +
    1.20 +#define MAX_LAG_BUFFERS 25
    1.21 +
    1.22 +struct lookahead_entry {
    1.23 +  YV12_BUFFER_CONFIG  img;
    1.24 +  int64_t             ts_start;
    1.25 +  int64_t             ts_end;
    1.26 +  unsigned int        flags;
    1.27 +};
    1.28 +
    1.29 +
    1.30 +struct lookahead_ctx;
    1.31 +
    1.32 +/**\brief Initializes the lookahead stage
    1.33 + *
    1.34 + * The lookahead stage is a queue of frame buffers on which some analysis
    1.35 + * may be done when buffers are enqueued.
    1.36 + */
    1.37 +struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
    1.38 +                                         unsigned int height,
    1.39 +                                         unsigned int subsampling_x,
    1.40 +                                         unsigned int subsampling_y,
    1.41 +                                         unsigned int depth);
    1.42 +
    1.43 +
    1.44 +/**\brief Destroys the lookahead stage
    1.45 + */
    1.46 +void vp9_lookahead_destroy(struct lookahead_ctx *ctx);
    1.47 +
    1.48 +
    1.49 +/**\brief Enqueue a source buffer
    1.50 + *
    1.51 + * This function will copy the source image into a new framebuffer with
    1.52 + * the expected stride/border.
    1.53 + *
    1.54 + * If active_map is non-NULL and there is only one frame in the queue, then copy
    1.55 + * only active macroblocks.
    1.56 + *
    1.57 + * \param[in] ctx         Pointer to the lookahead context
    1.58 + * \param[in] src         Pointer to the image to enqueue
    1.59 + * \param[in] ts_start    Timestamp for the start of this frame
    1.60 + * \param[in] ts_end      Timestamp for the end of this frame
    1.61 + * \param[in] flags       Flags set on this frame
    1.62 + * \param[in] active_map  Map that specifies which macroblock is active
    1.63 + */
    1.64 +int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src,
    1.65 +                       int64_t ts_start, int64_t ts_end, unsigned int flags,
    1.66 +                       unsigned char *active_map);
    1.67 +
    1.68 +
    1.69 +/**\brief Get the next source buffer to encode
    1.70 + *
    1.71 + *
    1.72 + * \param[in] ctx       Pointer to the lookahead context
    1.73 + * \param[in] drain     Flag indicating the buffer should be drained
    1.74 + *                      (return a buffer regardless of the current queue depth)
    1.75 + *
    1.76 + * \retval NULL, if drain set and queue is empty
    1.77 + * \retval NULL, if drain not set and queue not of the configured depth
    1.78 + */
    1.79 +struct lookahead_entry *vp9_lookahead_pop(struct lookahead_ctx *ctx,
    1.80 +                                          int drain);
    1.81 +
    1.82 +
    1.83 +/**\brief Get a future source buffer to encode
    1.84 + *
    1.85 + * \param[in] ctx       Pointer to the lookahead context
    1.86 + * \param[in] index     Index of the frame to be returned, 0 == next frame
    1.87 + *
    1.88 + * \retval NULL, if no buffer exists at the specified index
    1.89 + */
    1.90 +struct lookahead_entry *vp9_lookahead_peek(struct lookahead_ctx *ctx,
    1.91 +                                           int index);
    1.92 +
    1.93 +
    1.94 +/**\brief Get the number of frames currently in the lookahead queue
    1.95 + *
    1.96 + * \param[in] ctx       Pointer to the lookahead context
    1.97 + */
    1.98 +unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx);
    1.99 +
   1.100 +#endif  // VP9_ENCODER_VP9_LOOKAHEAD_H_

mercurial