media/libvpx/vp9/common/vp9_onyx.h

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

mercurial