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