media/libvpx/vp9/common/vp9_onyx.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.

michael@0 1 /*
michael@0 2 * Copyright (c) 2010 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_COMMON_VP9_ONYX_H_
michael@0 12 #define VP9_COMMON_VP9_ONYX_H_
michael@0 13
michael@0 14 #ifdef __cplusplus
michael@0 15 extern "C"
michael@0 16 { // NOLINT
michael@0 17 #endif
michael@0 18
michael@0 19 #include "./vpx_config.h"
michael@0 20 #include "vpx/internal/vpx_codec_internal.h"
michael@0 21 #include "vpx/vp8cx.h"
michael@0 22 #include "vpx_scale/yv12config.h"
michael@0 23 #include "vp9/common/vp9_ppflags.h"
michael@0 24
michael@0 25 #define MAX_SEGMENTS 8
michael@0 26
michael@0 27 typedef int *VP9_PTR;
michael@0 28
michael@0 29 /* Create/destroy static data structures. */
michael@0 30
michael@0 31 typedef enum {
michael@0 32 NORMAL = 0,
michael@0 33 FOURFIVE = 1,
michael@0 34 THREEFIVE = 2,
michael@0 35 ONETWO = 3
michael@0 36 } VPX_SCALING;
michael@0 37
michael@0 38 typedef enum {
michael@0 39 VP9_LAST_FLAG = 1,
michael@0 40 VP9_GOLD_FLAG = 2,
michael@0 41 VP9_ALT_FLAG = 4
michael@0 42 } VP9_REFFRAME;
michael@0 43
michael@0 44
michael@0 45 typedef enum {
michael@0 46 USAGE_STREAM_FROM_SERVER = 0x0,
michael@0 47 USAGE_LOCAL_FILE_PLAYBACK = 0x1,
michael@0 48 USAGE_CONSTRAINED_QUALITY = 0x2,
michael@0 49 USAGE_CONSTANT_QUALITY = 0x3,
michael@0 50 } END_USAGE;
michael@0 51
michael@0 52
michael@0 53 typedef enum {
michael@0 54 MODE_GOODQUALITY = 0x1,
michael@0 55 MODE_BESTQUALITY = 0x2,
michael@0 56 MODE_FIRSTPASS = 0x3,
michael@0 57 MODE_SECONDPASS = 0x4,
michael@0 58 MODE_SECONDPASS_BEST = 0x5,
michael@0 59 } MODE;
michael@0 60
michael@0 61 typedef enum {
michael@0 62 FRAMEFLAGS_KEY = 1,
michael@0 63 FRAMEFLAGS_GOLDEN = 2,
michael@0 64 FRAMEFLAGS_ALTREF = 4,
michael@0 65 } FRAMETYPE_FLAGS;
michael@0 66
michael@0 67 typedef enum {
michael@0 68 NO_AQ = 0,
michael@0 69 VARIANCE_AQ = 1,
michael@0 70 AQ_MODES_COUNT // This should always be the last member of the enum
michael@0 71 } AQ_MODES;
michael@0 72
michael@0 73 typedef struct {
michael@0 74 int version; // 4 versions of bitstream defined:
michael@0 75 // 0 - best quality/slowest decode,
michael@0 76 // 3 - lowest quality/fastest decode
michael@0 77 int width; // width of data passed to the compressor
michael@0 78 int height; // height of data passed to the compressor
michael@0 79 double framerate; // set to passed in framerate
michael@0 80 int64_t target_bandwidth; // bandwidth to be used in kilobits per second
michael@0 81
michael@0 82 int noise_sensitivity; // pre processing blur: recommendation 0
michael@0 83 int Sharpness; // sharpening output: recommendation 0:
michael@0 84 int cpu_used;
michael@0 85 unsigned int rc_max_intra_bitrate_pct;
michael@0 86
michael@0 87 // mode ->
michael@0 88 // (0)=Realtime/Live Encoding. This mode is optimized for realtime
michael@0 89 // encoding (for example, capturing a television signal or feed from
michael@0 90 // a live camera). ( speed setting controls how fast )
michael@0 91 // (1)=Good Quality Fast Encoding. The encoder balances quality with the
michael@0 92 // amount of time it takes to encode the output. ( speed setting
michael@0 93 // controls how fast )
michael@0 94 // (2)=One Pass - Best Quality. The encoder places priority on the
michael@0 95 // quality of the output over encoding speed. The output is compressed
michael@0 96 // at the highest possible quality. This option takes the longest
michael@0 97 // amount of time to encode. ( speed setting ignored )
michael@0 98 // (3)=Two Pass - First Pass. The encoder generates a file of statistics
michael@0 99 // for use in the second encoding pass. ( speed setting controls how
michael@0 100 // fast )
michael@0 101 // (4)=Two Pass - Second Pass. The encoder uses the statistics that were
michael@0 102 // generated in the first encoding pass to create the compressed
michael@0 103 // output. ( speed setting controls how fast )
michael@0 104 // (5)=Two Pass - Second Pass Best. The encoder uses the statistics that
michael@0 105 // were generated in the first encoding pass to create the compressed
michael@0 106 // output using the highest possible quality, and taking a
michael@0 107 // longer amount of time to encode.. ( speed setting ignored )
michael@0 108 int Mode;
michael@0 109
michael@0 110 // Key Framing Operations
michael@0 111 int auto_key; // autodetect cut scenes and set the keyframes
michael@0 112 int key_freq; // maximum distance to key frame.
michael@0 113
michael@0 114 int allow_lag; // allow lagged compression (if 0 lagin frames is ignored)
michael@0 115 int lag_in_frames; // how many frames lag before we start encoding
michael@0 116
michael@0 117 // ----------------------------------------------------------------
michael@0 118 // DATARATE CONTROL OPTIONS
michael@0 119
michael@0 120 int end_usage; // vbr or cbr
michael@0 121
michael@0 122 // buffer targeting aggressiveness
michael@0 123 int under_shoot_pct;
michael@0 124 int over_shoot_pct;
michael@0 125
michael@0 126 // buffering parameters
michael@0 127 int64_t starting_buffer_level; // in seconds
michael@0 128 int64_t optimal_buffer_level;
michael@0 129 int64_t maximum_buffer_size;
michael@0 130
michael@0 131 // controlling quality
michael@0 132 int fixed_q;
michael@0 133 int worst_allowed_q;
michael@0 134 int best_allowed_q;
michael@0 135 int cq_level;
michael@0 136 int lossless;
michael@0 137 int aq_mode; // Adaptive Quantization mode
michael@0 138
michael@0 139 // two pass datarate control
michael@0 140 int two_pass_vbrbias; // two pass datarate control tweaks
michael@0 141 int two_pass_vbrmin_section;
michael@0 142 int two_pass_vbrmax_section;
michael@0 143 // END DATARATE CONTROL OPTIONS
michael@0 144 // ----------------------------------------------------------------
michael@0 145
michael@0 146 // Spatial scalability
michael@0 147 int ss_number_layers;
michael@0 148
michael@0 149 // these parameters aren't to be used in final build don't use!!!
michael@0 150 int play_alternate;
michael@0 151 int alt_freq;
michael@0 152
michael@0 153 int encode_breakout; // early breakout : for video conf recommend 800
michael@0 154
michael@0 155 /* Bitfield defining the error resiliency features to enable.
michael@0 156 * Can provide decodable frames after losses in previous
michael@0 157 * frames and decodable partitions after losses in the same frame.
michael@0 158 */
michael@0 159 unsigned int error_resilient_mode;
michael@0 160
michael@0 161 /* Bitfield defining the parallel decoding mode where the
michael@0 162 * decoding in successive frames may be conducted in parallel
michael@0 163 * just by decoding the frame headers.
michael@0 164 */
michael@0 165 unsigned int frame_parallel_decoding_mode;
michael@0 166
michael@0 167 int arnr_max_frames;
michael@0 168 int arnr_strength;
michael@0 169 int arnr_type;
michael@0 170
michael@0 171 int tile_columns;
michael@0 172 int tile_rows;
michael@0 173
michael@0 174 struct vpx_fixed_buf two_pass_stats_in;
michael@0 175 struct vpx_codec_pkt_list *output_pkt_list;
michael@0 176
michael@0 177 vp8e_tuning tuning;
michael@0 178 } VP9_CONFIG;
michael@0 179
michael@0 180
michael@0 181 void vp9_initialize_enc();
michael@0 182
michael@0 183 VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf);
michael@0 184 void vp9_remove_compressor(VP9_PTR *comp);
michael@0 185
michael@0 186 void vp9_change_config(VP9_PTR onyx, VP9_CONFIG *oxcf);
michael@0 187
michael@0 188 // receive a frames worth of data. caller can assume that a copy of this
michael@0 189 // frame is made and not just a copy of the pointer..
michael@0 190 int vp9_receive_raw_frame(VP9_PTR comp, unsigned int frame_flags,
michael@0 191 YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
michael@0 192 int64_t end_time_stamp);
michael@0 193
michael@0 194 int vp9_get_compressed_data(VP9_PTR comp, unsigned int *frame_flags,
michael@0 195 unsigned long *size, unsigned char *dest,
michael@0 196 int64_t *time_stamp, int64_t *time_end,
michael@0 197 int flush);
michael@0 198
michael@0 199 int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
michael@0 200 vp9_ppflags_t *flags);
michael@0 201
michael@0 202 int vp9_use_as_reference(VP9_PTR comp, int ref_frame_flags);
michael@0 203
michael@0 204 int vp9_update_reference(VP9_PTR comp, int ref_frame_flags);
michael@0 205
michael@0 206 int vp9_copy_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
michael@0 207 YV12_BUFFER_CONFIG *sd);
michael@0 208
michael@0 209 int vp9_get_reference_enc(VP9_PTR ptr, int index, YV12_BUFFER_CONFIG **fb);
michael@0 210
michael@0 211 int vp9_set_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
michael@0 212 YV12_BUFFER_CONFIG *sd);
michael@0 213
michael@0 214 int vp9_update_entropy(VP9_PTR comp, int update);
michael@0 215
michael@0 216 int vp9_set_roimap(VP9_PTR comp, unsigned char *map,
michael@0 217 unsigned int rows, unsigned int cols,
michael@0 218 int delta_q[MAX_SEGMENTS],
michael@0 219 int delta_lf[MAX_SEGMENTS],
michael@0 220 unsigned int threshold[MAX_SEGMENTS]);
michael@0 221
michael@0 222 int vp9_set_active_map(VP9_PTR comp, unsigned char *map,
michael@0 223 unsigned int rows, unsigned int cols);
michael@0 224
michael@0 225 int vp9_set_internal_size(VP9_PTR comp,
michael@0 226 VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
michael@0 227
michael@0 228 int vp9_set_size_literal(VP9_PTR comp, unsigned int width,
michael@0 229 unsigned int height);
michael@0 230
michael@0 231 void vp9_set_svc(VP9_PTR comp, int use_svc);
michael@0 232
michael@0 233 int vp9_get_quantizer(VP9_PTR c);
michael@0 234
michael@0 235 #ifdef __cplusplus
michael@0 236 }
michael@0 237 #endif
michael@0 238
michael@0 239 #endif // VP9_COMMON_VP9_ONYX_H_

mercurial