media/libvpx/vp9/encoder/vp9_lookahead.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial