Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: source/libvpx/vp8/encoder/onyx_int.h

Issue 7671004: Update libvpx snapshot to v0.9.7-p1 (Cayuga). (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp8/encoder/onyx_if.c ('k') | source/libvpx/vp8/encoder/parms.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 11 matching lines...) Expand all
22 #include "dct.h" 22 #include "dct.h"
23 #include "encodemb.h" 23 #include "encodemb.h"
24 #include "quantize.h" 24 #include "quantize.h"
25 #include "vp8/common/entropy.h" 25 #include "vp8/common/entropy.h"
26 #include "vp8/common/threading.h" 26 #include "vp8/common/threading.h"
27 #include "vpx_ports/mem.h" 27 #include "vpx_ports/mem.h"
28 #include "vpx/internal/vpx_codec_internal.h" 28 #include "vpx/internal/vpx_codec_internal.h"
29 #include "mcomp.h" 29 #include "mcomp.h"
30 #include "temporal_filter.h" 30 #include "temporal_filter.h"
31 #include "vp8/common/findnearmv.h" 31 #include "vp8/common/findnearmv.h"
32 #include "lookahead.h"
32 33
33 //#define SPEEDSTATS 1 34 //#define SPEEDSTATS 1
34 #define MIN_GF_INTERVAL 4 35 #define MIN_GF_INTERVAL 4
35 #define DEFAULT_GF_INTERVAL 7 36 #define DEFAULT_GF_INTERVAL 7
36 37
37 #define KEY_FRAME_CONTEXT 5 38 #define KEY_FRAME_CONTEXT 5
38 39
39 #define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25) 40 #define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)
40 41
41 #define AF_THRESH 25 42 #define AF_THRESH 25
42 #define AF_THRESH2 100 43 #define AF_THRESH2 100
43 #define ARF_DECAY_THRESH 12 44 #define ARF_DECAY_THRESH 12
44 #define MAX_MODES 20 45 #define MAX_MODES 20
45 46
46 #define MIN_THRESHMULT 32 47 #define MIN_THRESHMULT 32
47 #define MAX_THRESHMULT 512 48 #define MAX_THRESHMULT 512
48 49
49 #define GF_ZEROMV_ZBIN_BOOST 24 50 #define GF_ZEROMV_ZBIN_BOOST 12
50 #define LF_ZEROMV_ZBIN_BOOST 12 51 #define LF_ZEROMV_ZBIN_BOOST 6
51 #define MV_ZBIN_BOOST 4 52 #define MV_ZBIN_BOOST 4
52 #define ZBIN_OQ_MAX 192 53 #define ZBIN_OQ_MAX 192
53 54
54 #if !(CONFIG_REALTIME_ONLY) 55 #if !(CONFIG_REALTIME_ONLY)
55 #define VP8_TEMPORAL_ALT_REF 1 56 #define VP8_TEMPORAL_ALT_REF 1
56 #endif 57 #endif
57 58
58 typedef struct 59 typedef struct
59 { 60 {
60 int kf_indicated; 61 int kf_indicated;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 int RD; 173 int RD;
173 SEARCH_METHODS search_method; 174 SEARCH_METHODS search_method;
174 int improved_quant; 175 int improved_quant;
175 int improved_dct; 176 int improved_dct;
176 int auto_filter; 177 int auto_filter;
177 int recode_loop; 178 int recode_loop;
178 int iterative_sub_pixel; 179 int iterative_sub_pixel;
179 int half_pixel_search; 180 int half_pixel_search;
180 int quarter_pixel_search; 181 int quarter_pixel_search;
181 int thresh_mult[MAX_MODES]; 182 int thresh_mult[MAX_MODES];
182 int full_freq[2];
183 int min_fs_radius;
184 int max_fs_radius;
185 int max_step_search_steps; 183 int max_step_search_steps;
186 int first_step; 184 int first_step;
187 int optimize_coefficients; 185 int optimize_coefficients;
188 186
189 int use_fastquant_for_pick; 187 int use_fastquant_for_pick;
190 int no_skip_block4x4_search; 188 int no_skip_block4x4_search;
191 int improved_mv_pred; 189 int improved_mv_pred;
192 190
193 } SPEED_FEATURES; 191 } SPEED_FEATURES;
194 192
(...skipping 15 matching lines...) Expand all
210 int ithread; 208 int ithread;
211 void *ptr1; 209 void *ptr1;
212 void *ptr2; 210 void *ptr2;
213 } ENCODETHREAD_DATA; 211 } ENCODETHREAD_DATA;
214 typedef struct 212 typedef struct
215 { 213 {
216 int ithread; 214 int ithread;
217 void *ptr1; 215 void *ptr1;
218 } LPFTHREAD_DATA; 216 } LPFTHREAD_DATA;
219 217
220 typedef struct
221 {
222 INT64 source_time_stamp;
223 INT64 source_end_time_stamp;
224
225 DECLARE_ALIGNED(16, YV12_BUFFER_CONFIG, source_buffer);
226 unsigned int source_frame_flags;
227 } SOURCE_SAMPLE;
228 218
229 typedef struct VP8_ENCODER_RTCD 219 typedef struct VP8_ENCODER_RTCD
230 { 220 {
231 VP8_COMMON_RTCD *common; 221 VP8_COMMON_RTCD *common;
232 vp8_variance_rtcd_vtable_t variance; 222 vp8_variance_rtcd_vtable_t variance;
233 vp8_fdct_rtcd_vtable_t fdct; 223 vp8_fdct_rtcd_vtable_t fdct;
234 vp8_encodemb_rtcd_vtable_t encodemb; 224 vp8_encodemb_rtcd_vtable_t encodemb;
235 vp8_quantize_rtcd_vtable_t quantize; 225 vp8_quantize_rtcd_vtable_t quantize;
236 vp8_search_rtcd_vtable_t search; 226 vp8_search_rtcd_vtable_t search;
237 vp8_temporal_rtcd_vtable_t temporal; 227 vp8_temporal_rtcd_vtable_t temporal;
238 } VP8_ENCODER_RTCD; 228 } VP8_ENCODER_RTCD;
239 229
240 enum 230 enum
241 { 231 {
242 BLOCK_16X8, 232 BLOCK_16X8,
243 BLOCK_8X16, 233 BLOCK_8X16,
244 BLOCK_8X8, 234 BLOCK_8X8,
245 BLOCK_4X4, 235 BLOCK_4X4,
246 BLOCK_16X16, 236 BLOCK_16X16,
247 BLOCK_MAX_SEGMENTS 237 BLOCK_MAX_SEGMENTS
248 }; 238 };
249 239
250 typedef struct 240 typedef struct VP8_COMP
251 { 241 {
252 242
253 DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]); 243 DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]);
254 DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]); 244 DECLARE_ALIGNED(16, unsigned char, Y1quant_shift[QINDEX_RANGE][16]);
255 DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]); 245 DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]);
256 DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]); 246 DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]);
257 247
258 DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]); 248 DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]);
259 DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]); 249 DECLARE_ALIGNED(16, unsigned char, Y2quant_shift[QINDEX_RANGE][16]);
260 DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]); 250 DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]);
261 DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]); 251 DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]);
262 252
263 DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]); 253 DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]);
264 DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]); 254 DECLARE_ALIGNED(16, unsigned char, UVquant_shift[QINDEX_RANGE][16]);
265 DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]); 255 DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]);
266 DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]); 256 DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]);
267 257
268 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]); 258 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]);
269 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]); 259 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]);
270 DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]); 260 DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]);
271 DECLARE_ALIGNED(16, short, Y1quant_fast[QINDEX_RANGE][16]); 261 DECLARE_ALIGNED(16, short, Y1quant_fast[QINDEX_RANGE][16]);
272 DECLARE_ALIGNED(16, short, Y2quant_fast[QINDEX_RANGE][16]); 262 DECLARE_ALIGNED(16, short, Y2quant_fast[QINDEX_RANGE][16]);
273 DECLARE_ALIGNED(16, short, UVquant_fast[QINDEX_RANGE][16]); 263 DECLARE_ALIGNED(16, short, UVquant_fast[QINDEX_RANGE][16]);
274 264
275 265
276 MACROBLOCK mb; 266 MACROBLOCK mb;
277 VP8_COMMON common; 267 VP8_COMMON common;
278 vp8_writer bc, bc2; 268 vp8_writer bc, bc2;
279 // bool_writer *bc2; 269 // bool_writer *bc2;
280 270
281 VP8_CONFIG oxcf; 271 VP8_CONFIG oxcf;
282 272
273 struct lookahead_ctx *lookahead;
274 struct lookahead_entry *source;
275 struct lookahead_entry *alt_ref_source;
276
283 YV12_BUFFER_CONFIG *Source; 277 YV12_BUFFER_CONFIG *Source;
284 YV12_BUFFER_CONFIG *un_scaled_source; 278 YV12_BUFFER_CONFIG *un_scaled_source;
285 INT64 source_time_stamp;
286 INT64 source_end_time_stamp;
287 unsigned int source_frame_flags;
288 YV12_BUFFER_CONFIG scaled_source; 279 YV12_BUFFER_CONFIG scaled_source;
289 280
290 int source_buffer_count; // number of src_buffers in use for lagged encod ing
291 int source_encode_index; // index of buffer in src_buffer to encode
292 int source_alt_ref_pending; // frame in src_buffers has been identified to b e encoded as an alt ref 281 int source_alt_ref_pending; // frame in src_buffers has been identified to b e encoded as an alt ref
293 int source_alt_ref_active; // an alt ref frame has been encoded and is usab le 282 int source_alt_ref_active; // an alt ref frame has been encoded and is usab le
294 283
295 int last_alt_ref_sei; // index into src_buffers of frame used as alt r eference
296 int is_src_frame_alt_ref; // source of frame to encode is an exact copy of an alt ref frame 284 int is_src_frame_alt_ref; // source of frame to encode is an exact copy of an alt ref frame
297 int is_next_src_alt_ref; // source of next frame to encode is an exact co py of an alt ref frame
298 285
299 int gold_is_last; // golden frame same as last frame ( short circuit gold se arches) 286 int gold_is_last; // golden frame same as last frame ( short circuit gold se arches)
300 int alt_is_last; // Alt reference frame same as last ( short circuit altref search) 287 int alt_is_last; // Alt reference frame same as last ( short circuit altref search)
301 int gold_is_alt; // don't do both alt and gold search ( just do gold). 288 int gold_is_alt; // don't do both alt and gold search ( just do gold).
302 289
303 //int refresh_alt_ref_frame; 290 //int refresh_alt_ref_frame;
304 SOURCE_SAMPLE src_buffer[MAX_LAG_BUFFERS];
305
306 YV12_BUFFER_CONFIG last_frame_uf; 291 YV12_BUFFER_CONFIG last_frame_uf;
307 292
308 TOKENEXTRA *tok; 293 TOKENEXTRA *tok;
309 unsigned int tok_count; 294 unsigned int tok_count;
310 295
311 296
312 unsigned int frames_since_key; 297 unsigned int frames_since_key;
313 unsigned int key_frame_frequency; 298 unsigned int key_frame_frequency;
314 unsigned int this_key_frame_forced; 299 unsigned int this_key_frame_forced;
315 unsigned int next_key_frame_forced; 300 unsigned int next_key_frame_forced;
316 301
317 // Ambient reconstruction err target for force key frames 302 // Ambient reconstruction err target for force key frames
318 int ambient_err; 303 int ambient_err;
319 304
320 unsigned int mode_check_freq[MAX_MODES]; 305 unsigned int mode_check_freq[MAX_MODES];
321 unsigned int mode_test_hit_counts[MAX_MODES]; 306 unsigned int mode_test_hit_counts[MAX_MODES];
322 unsigned int mode_chosen_counts[MAX_MODES]; 307 unsigned int mode_chosen_counts[MAX_MODES];
323 unsigned int mbs_tested_so_far; 308 unsigned int mbs_tested_so_far;
324 309
325 unsigned int check_freq[2];
326 unsigned int do_full[2];
327
328 int rd_thresh_mult[MAX_MODES]; 310 int rd_thresh_mult[MAX_MODES];
329 int rd_baseline_thresh[MAX_MODES]; 311 int rd_baseline_thresh[MAX_MODES];
330 int rd_threshes[MAX_MODES]; 312 int rd_threshes[MAX_MODES];
331 int mvcostbase;
332 int mvcostmultiplier;
333 int subseqblockweight;
334 int errthresh;
335 unsigned int activity_avg;
336 313
337 int RDMULT; 314 int RDMULT;
338 int RDDIV ; 315 int RDDIV ;
339 316
340 CODING_CONTEXT coding_context; 317 CODING_CONTEXT coding_context;
341 318
342 // Rate targetting variables 319 // Rate targetting variables
343 long long prediction_error; 320 int64_t prediction_error;
344 long long last_prediction_error; 321 int64_t last_prediction_error;
345 long long intra_error; 322 int64_t intra_error;
346 long long last_intra_error; 323 int64_t last_intra_error;
347
348 #if 0
349 // Experimental RD code
350 long long frame_distortion;
351 long long last_frame_distortion;
352 #endif
353
354 int last_mb_distortion;
355
356 int frames_since_auto_filter;
357 324
358 int this_frame_target; 325 int this_frame_target;
359 int projected_frame_size; 326 int projected_frame_size;
360 int last_q[2]; // Separate values for Intra/Inter 327 int last_q[2]; // Separate values for Intra/Inter
361 328
362 double rate_correction_factor; 329 double rate_correction_factor;
363 double key_frame_rate_correction_factor; 330 double key_frame_rate_correction_factor;
364 double gf_rate_correction_factor; 331 double gf_rate_correction_factor;
365 double est_max_qcorrection_factor;
366 332
367 int frames_till_gf_update_due; // Count down till next GF 333 int frames_till_gf_update_due; // Count down till next GF
368 int current_gf_interval; // GF interval chosen when we coded the la st GF 334 int current_gf_interval; // GF interval chosen when we coded the la st GF
369 335
370 int gf_overspend_bits; // Total bits overspent becasue of GF boos t (cumulative) 336 int gf_overspend_bits; // Total bits overspent becasue of GF boos t (cumulative)
371 337
372 int gf_group_bits; // Projected Bits available for a group of frames including 1 GF or ARF
373 int gf_bits; // Bits for the golden frame or ARF - 2 pas s only
374 int mid_gf_extra_bits; // A few extra bits for the frame half wa y between two gfs.
375
376 // Projected total bits available for a key frame group of frames
377 long long kf_group_bits;
378
379 // Error score of frames still to be coded in kf group
380 long long kf_group_error_left;
381
382 // Bits for the key frame in a key frame group - 2 pass only
383 int kf_bits;
384
385 int non_gf_bitrate_adjustment; // Used in the few frames following a GF to recover the extra bits spent in that GF 338 int non_gf_bitrate_adjustment; // Used in the few frames following a GF to recover the extra bits spent in that GF
386 int initial_gf_use; // percentage use of gf 2 frames after gf
387
388 int gf_group_error_left; // Remaining error from uncoded frames in a gf group. Two pass use only
389 339
390 int kf_overspend_bits; // Extra bits spent on key frames that nee d to be recovered on inter frames 340 int kf_overspend_bits; // Extra bits spent on key frames that nee d to be recovered on inter frames
391 int kf_bitrate_adjustment; // Current number of bit s to try and reco ver on each inter frame. 341 int kf_bitrate_adjustment; // Current number of bit s to try and reco ver on each inter frame.
392 int max_gf_interval; 342 int max_gf_interval;
393 int static_scene_max_gf_interval;
394 int baseline_gf_interval; 343 int baseline_gf_interval;
395 int gf_decay_rate;
396 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames 344 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
397 345
398 INT64 key_frame_count; 346 int64_t key_frame_count;
399 INT64 tot_key_frame_bits;
400 int prior_key_frame_size[KEY_FRAME_CONTEXT];
401 int prior_key_frame_distance[KEY_FRAME_CONTEXT]; 347 int prior_key_frame_distance[KEY_FRAME_CONTEXT];
402 int per_frame_bandwidth; // Current section per frame bandwidth tar get 348 int per_frame_bandwidth; // Current section per frame bandwidth tar get
403 int av_per_frame_bandwidth; // Average frame size target for clip 349 int av_per_frame_bandwidth; // Average frame size target for clip
404 int min_frame_bandwidth; // Minimum allocation that should be used for any frame 350 int min_frame_bandwidth; // Minimum allocation that should be used for any frame
405 int last_key_frame_size;
406 int intra_frame_target;
407 int inter_frame_target; 351 int inter_frame_target;
408 double output_frame_rate; 352 double output_frame_rate;
409 long long last_time_stamp_seen; 353 int64_t last_time_stamp_seen;
410 long long last_end_time_stamp_seen; 354 int64_t last_end_time_stamp_seen;
411 long long first_time_stamp_ever; 355 int64_t first_time_stamp_ever;
412 356
413 int ni_av_qi; 357 int ni_av_qi;
414 int ni_tot_qi; 358 int ni_tot_qi;
415 int ni_frames; 359 int ni_frames;
416 int avg_frame_qindex; 360 int avg_frame_qindex;
417 361
418 int zbin_over_quant; 362 int zbin_over_quant;
419 int zbin_mode_boost; 363 int zbin_mode_boost;
420 int zbin_mode_boost_enabled; 364 int zbin_mode_boost_enabled;
421 365
422 INT64 total_byte_count; 366 int64_t total_byte_count;
423 367
424 int buffered_mode; 368 int buffered_mode;
425 369
426 int buffer_level; 370 int buffer_level;
427 int bits_off_target; 371 int bits_off_target;
428 372
429 int rolling_target_bits; 373 int rolling_target_bits;
430 int rolling_actual_bits; 374 int rolling_actual_bits;
431 375
432 int long_rolling_target_bits; 376 int long_rolling_target_bits;
433 int long_rolling_actual_bits; 377 int long_rolling_actual_bits;
434 378
435 long long total_actual_bits; 379 int64_t total_actual_bits;
436 int total_target_vs_actual; // debug stats 380 int total_target_vs_actual; // debug stats
437 381
438 int worst_quality; 382 int worst_quality;
439 int active_worst_quality; 383 int active_worst_quality;
440 int best_quality; 384 int best_quality;
441 int active_best_quality; 385 int active_best_quality;
442 386
443 int cq_target_quality; 387 int cq_target_quality;
444 int maxq_max_limit;
445 int maxq_min_limit;
446 388
447 int drop_frames_allowed; // Are we permitted to drop frames? 389 int drop_frames_allowed; // Are we permitted to drop frames?
448 int drop_frame; // Drop this frame? 390 int drop_frame; // Drop this frame?
449 int drop_count; // How many frames have we dropped? 391 int drop_count; // How many frames have we dropped?
450 int max_drop_count; // How many frames should we drop? 392 int max_drop_count; // How many frames should we drop?
451 int max_consec_dropped_frames; // Limit number of consecutive frames tha t can be dropped. 393 int max_consec_dropped_frames; // Limit number of consecutive frames tha t can be dropped.
452 394
453 395
454 int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */ 396 int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
455 int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */ 397 int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
456 398
457 unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */ 399 unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
458 400
459 unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp 8_coef_tokens]; /* for this frame */ 401 unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MA X_ENTROPY_TOKENS]; /* for this frame */
460 //DECLARE_ALIGNED(16, int, coef_counts_backup [BLOCK_TYPES] [COEF_BANDS] [PR EV_COEF_CONTEXTS] [vp8_coef_tokens]); //not used any more 402 //DECLARE_ALIGNED(16, int, coef_counts_backup [BLOCK_TYPES] [COEF_BANDS] [PR EV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]); //not used any more
461 //save vp8_tree_probs_from_distribution result for each frame to avoid repea t calculation 403 //save vp8_tree_probs_from_distribution result for each frame to avoid repea t calculation
462 vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [v p8_coef_tokens-1]; 404 vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [E NTROPY_NODES];
463 unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens-1][2]; 405 unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
464 406
465 /* Second compressed data partition contains coefficient data. */
466
467 unsigned char *output_partition2;
468 size_t output_partition2size;
469
470 int frames_to_key;
471 int gfu_boost; 407 int gfu_boost;
472 int kf_boost; 408 int kf_boost;
473 int last_boost; 409 int last_boost;
474 double total_error_left;
475 double total_intra_error_left;
476 double total_coded_error_left;
477 double start_tot_err_left;
478 double min_error;
479 double kf_intra_err_min;
480 double gf_intra_err_min;
481
482 double modified_error_total;
483 double modified_error_used;
484 double modified_error_left;
485 double clip_bpe;
486 double observed_bpe;
487
488 double avg_iiratio;
489 410
490 int target_bandwidth; 411 int target_bandwidth;
491 long long bits_left;
492 long long clip_bits_total;
493 FIRSTPASS_STATS *total_stats;
494 FIRSTPASS_STATS *this_frame_stats;
495 FIRSTPASS_STATS *stats_in, *stats_in_end;
496 struct vpx_codec_pkt_list *output_pkt_list; 412 struct vpx_codec_pkt_list *output_pkt_list;
497 int first_pass_done;
498 413
499 #if 0 414 #if 0
500 // Experimental code for lagged and one pass 415 // Experimental code for lagged and one pass
501 ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS]; 416 ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS];
502 int one_pass_frame_index; 417 int one_pass_frame_index;
503 #endif 418 #endif
504 419
505 int decimation_factor; 420 int decimation_factor;
506 int decimation_count; 421 int decimation_count;
507 422
508 // for real time encoding 423 // for real time encoding
509 int avg_encode_time; //microsecond 424 int avg_encode_time; //microsecond
510 int avg_pick_mode_time; //microsecond 425 int avg_pick_mode_time; //microsecond
511 int Speed; 426 int Speed;
512 unsigned int cpu_freq; //Mhz 427 unsigned int cpu_freq; //Mhz
513 int compressor_speed; 428 int compressor_speed;
514 429
515 int interquantizer; 430 int interquantizer;
516 int auto_gold; 431 int auto_gold;
517 int auto_adjust_gold_quantizer; 432 int auto_adjust_gold_quantizer;
518 int goldquantizer;
519 int goldfreq; 433 int goldfreq;
520 int auto_adjust_key_quantizer;
521 int keyquantizer;
522 int auto_worst_q; 434 int auto_worst_q;
523 int filter_type;
524 int cpu_used; 435 int cpu_used;
525 int chroma_boost;
526 int horiz_scale; 436 int horiz_scale;
527 int vert_scale; 437 int vert_scale;
528 int pass; 438 int pass;
529 439
530 440
531 int prob_intra_coded; 441 int prob_intra_coded;
532 int prob_last_coded; 442 int prob_last_coded;
533 int prob_gf_coded; 443 int prob_gf_coded;
534 int prob_skip_false; 444 int prob_skip_false;
535 int last_skip_false_probs[3]; 445 int last_skip_false_probs[3];
536 int last_skip_probs_q[3]; 446 int last_skip_probs_q[3];
537 int recent_ref_frame_usage[MAX_REF_FRAMES]; 447 int recent_ref_frame_usage[MAX_REF_FRAMES];
538 448
539 int count_mb_ref_frame_usage[MAX_REF_FRAMES]; 449 int count_mb_ref_frame_usage[MAX_REF_FRAMES];
540 int this_frame_percent_intra; 450 int this_frame_percent_intra;
541 int last_frame_percent_intra; 451 int last_frame_percent_intra;
542 452
543 int last_key_frame_q;
544 int last_kffilt_lvl;
545
546 int ref_frame_flags; 453 int ref_frame_flags;
547 454
548 SPEED_FEATURES sf; 455 SPEED_FEATURES sf;
549 int error_bins[1024]; 456 int error_bins[1024];
550 457
551 int inter_lvl;
552 int intra_lvl;
553 int motion_lvl;
554 int motion_speed;
555 int motion_var;
556 unsigned int next_iiratio;
557 unsigned int this_iiratio;
558 int this_frame_modified_error;
559
560 double norm_intra_err_per_mb;
561 double norm_inter_err_per_mb;
562 double norm_iidiff_per_mb;
563
564 int last_best_mode_index; // Record of mode index chosen for previo us macro block.
565 int last_auto_filt_val;
566 int last_auto_filt_q;
567
568 // Data used for real time conferencing mode to help determine if it would b e good to update the gf 458 // Data used for real time conferencing mode to help determine if it would b e good to update the gf
569 int inter_zz_count; 459 int inter_zz_count;
570 int gf_bad_count; 460 int gf_bad_count;
571 int gf_update_recommended; 461 int gf_update_recommended;
572 int skip_true_count; 462 int skip_true_count;
573 int skip_false_count; 463 int skip_false_count;
574 464
575 int alt_qcount;
576
577 int ready_for_new_frame;
578
579 unsigned char *segmentation_map; 465 unsigned char *segmentation_map;
580 signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; // Segment data (can be deltas or absolute values) 466 signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; // Segment data (can be deltas or absolute values)
581 int segment_encode_breakout[MAX_MB_SEGMENTS]; // segment threashold for encode breakout 467 int segment_encode_breakout[MAX_MB_SEGMENTS]; // segment threashold for encode breakout
582 468
583 unsigned char *active_map; 469 unsigned char *active_map;
584 unsigned int active_map_enabled; 470 unsigned int active_map_enabled;
585 // Video conferencing cyclic refresh mode flags etc 471 // Video conferencing cyclic refresh mode flags etc
586 // This is a mode designed to clean up the background over time in live enco ding scenarious. It uses segmentation 472 // This is a mode designed to clean up the background over time in live enco ding scenarious. It uses segmentation
587 int cyclic_refresh_mode_enabled; 473 int cyclic_refresh_mode_enabled;
588 int cyclic_refresh_mode_max_mbs_perframe; 474 int cyclic_refresh_mode_max_mbs_perframe;
589 int cyclic_refresh_mode_index; 475 int cyclic_refresh_mode_index;
590 int cyclic_refresh_q; 476 int cyclic_refresh_q;
591 signed char *cyclic_refresh_map; 477 signed char *cyclic_refresh_map;
592 478
593 #if CONFIG_MULTITHREAD 479 #if CONFIG_MULTITHREAD
594 // multithread data 480 // multithread data
595 int * mt_current_mb_col; 481 int * mt_current_mb_col;
596 int mt_sync_range; 482 int mt_sync_range;
597 int processor_core_count;
598 int b_multi_threaded; 483 int b_multi_threaded;
599 int encoding_thread_count; 484 int encoding_thread_count;
600 485
601 pthread_t *h_encoding_thread; 486 pthread_t *h_encoding_thread;
602 pthread_t h_filter_thread; 487 pthread_t h_filter_thread;
603 488
604 MB_ROW_COMP *mb_row_ei; 489 MB_ROW_COMP *mb_row_ei;
605 ENCODETHREAD_DATA *en_thread_data; 490 ENCODETHREAD_DATA *en_thread_data;
606 LPFTHREAD_DATA lpf_thread_data; 491 LPFTHREAD_DATA lpf_thread_data;
607 492
608 //events 493 //events
609 sem_t *h_event_start_encoding; 494 sem_t *h_event_start_encoding;
610 sem_t h_event_end_encoding; 495 sem_t h_event_end_encoding;
611 sem_t h_event_start_lpf; 496 sem_t h_event_start_lpf;
612 sem_t h_event_end_lpf; 497 sem_t h_event_end_lpf;
613 #endif 498 #endif
614 499
615 TOKENLIST *tplist; 500 TOKENLIST *tplist;
501 unsigned int partition_sz[MAX_PARTITIONS];
616 // end of multithread data 502 // end of multithread data
617 503
618 504
619 fractional_mv_step_fp *find_fractional_mv_step; 505 fractional_mv_step_fp *find_fractional_mv_step;
620 vp8_full_search_fn_t full_search_sad; 506 vp8_full_search_fn_t full_search_sad;
507 vp8_refining_search_fn_t refining_search_sad;
621 vp8_diamond_search_fn_t diamond_search_sad; 508 vp8_diamond_search_fn_t diamond_search_sad;
622 vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS]; 509 vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS];
623 unsigned int time_receive_data; 510 unsigned int time_receive_data;
624 unsigned int time_compress_data; 511 unsigned int time_compress_data;
625 unsigned int time_pick_lpf; 512 unsigned int time_pick_lpf;
626 unsigned int time_encode_mb_row; 513 unsigned int time_encode_mb_row;
627 514
628 unsigned int tempdata1; 515 int base_skip_false_prob[128];
629 unsigned int tempdata2;
630 516
631 int base_skip_false_prob[128]; 517 struct twopass_rc
632 unsigned int section_intra_rating; 518 {
519 unsigned int section_intra_rating;
520 double section_max_qfactor;
521 unsigned int next_iiratio;
522 unsigned int this_iiratio;
523 FIRSTPASS_STATS *total_stats;
524 FIRSTPASS_STATS *this_frame_stats;
525 FIRSTPASS_STATS *stats_in, *stats_in_end, *stats_in_start;
526 int first_pass_done;
527 int64_t bits_left;
528 int64_t clip_bits_total;
529 double avg_iiratio;
530 double modified_error_total;
531 double modified_error_used;
532 double modified_error_left;
533 double total_error_left;
534 double total_intra_error_left;
535 double total_coded_error_left;
536 double start_tot_err_left;
537 double kf_intra_err_min;
538 double gf_intra_err_min;
539 int frames_to_key;
540 int maxq_max_limit;
541 int maxq_min_limit;
542 int gf_decay_rate;
543 int static_scene_max_gf_interval;
544 int kf_bits;
545 int gf_group_error_left; // Remaining error from uncoded frame s in a gf group. Two pass use only
633 546
634 double section_max_qfactor; 547 // Projected total bits available for a key frame group of frames
548 int64_t kf_group_bits;
635 549
550 // Error score of frames still to be coded in kf group
551 int64_t kf_group_error_left;
552
553 int gf_group_bits; // Projected Bits available for a grou p of frames including 1 GF or ARF
554 int gf_bits; // Bits for the golden frame or ARF - 2 pass only
555 int mid_gf_extra_bits; // A few extra bits for the frame hal f way between two gfs.
556 double est_max_qcorrection_factor;
557 } twopass;
636 558
637 #if CONFIG_RUNTIME_CPU_DETECT 559 #if CONFIG_RUNTIME_CPU_DETECT
638 VP8_ENCODER_RTCD rtcd; 560 VP8_ENCODER_RTCD rtcd;
639 #endif 561 #endif
640 #if VP8_TEMPORAL_ALT_REF 562 #if VP8_TEMPORAL_ALT_REF
641 SOURCE_SAMPLE alt_ref_buffer; 563 YV12_BUFFER_CONFIG alt_ref_buffer;
642 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; 564 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
643 int fixed_divide[512]; 565 int fixed_divide[512];
644 #endif 566 #endif
645 567
646 #if CONFIG_PSNR 568 #if CONFIG_INTERNAL_STATS
647 int count; 569 int count;
648 double total_y; 570 double total_y;
649 double total_u; 571 double total_u;
650 double total_v; 572 double total_v;
651 double total ; 573 double total ;
652 double total_sq_error; 574 double total_sq_error;
653 double totalp_y; 575 double totalp_y;
654 double totalp_u; 576 double totalp_u;
655 double totalp_v; 577 double totalp_v;
656 double totalp; 578 double totalp;
657 double total_sq_error2; 579 double total_sq_error2;
658 int bytes; 580 int bytes;
659 double summed_quality; 581 double summed_quality;
660 double summed_weights; 582 double summed_weights;
661 unsigned int tot_recode_hits; 583 unsigned int tot_recode_hits;
662 584
663 585
664 double total_ssimg_y; 586 double total_ssimg_y;
665 double total_ssimg_u; 587 double total_ssimg_u;
666 double total_ssimg_v; 588 double total_ssimg_v;
667 double total_ssimg_all; 589 double total_ssimg_all;
668 590
669 int b_calculate_ssimg; 591 int b_calculate_ssimg;
670 #endif 592 #endif
671 int b_calculate_psnr; 593 int b_calculate_psnr;
672 594
595 // Per MB activity measurement
596 unsigned int activity_avg;
597 unsigned int * mb_activity_map;
598 int * mb_norm_activity_map;
673 599
674 unsigned char *gf_active_flags; // Record of which MBs still refer to last golden frame either directly or through 0,0 600 // Record of which MBs still refer to last golden frame either
601 // directly or through 0,0
602 unsigned char *gf_active_flags;
675 int gf_active_count; 603 int gf_active_count;
676 604
605 int output_partition;
606
677 //Store last frame's MV info for next frame MV prediction 607 //Store last frame's MV info for next frame MV prediction
678 int_mv *lfmv; 608 int_mv *lfmv;
679 int *lf_ref_frame_sign_bias; 609 int *lf_ref_frame_sign_bias;
680 int *lf_ref_frame; 610 int *lf_ref_frame;
681 611
682 #if CONFIG_REALTIME_ONLY 612 #if CONFIG_REALTIME_ONLY
683 int force_next_frame_intra; /* force next frame to intra when kf_auto says s o */ 613 int force_next_frame_intra; /* force next frame to intra when kf_auto says s o */
684 #endif 614 #endif
615 int droppable;
685 } VP8_COMP; 616 } VP8_COMP;
686 617
687 void control_data_rate(VP8_COMP *cpi); 618 void control_data_rate(VP8_COMP *cpi);
688 619
689 void vp8_encode_frame(VP8_COMP *cpi); 620 void vp8_encode_frame(VP8_COMP *cpi);
690 621
691 void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) ; 622 void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) ;
692 623
693 unsigned int vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x); 624 void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x);
694 625
695 int rd_cost_intra_mb(MACROBLOCKD *x); 626 int rd_cost_intra_mb(MACROBLOCKD *x);
696 627
697 void vp8_tokenize_mb(VP8_COMP *, MACROBLOCKD *, TOKENEXTRA **); 628 void vp8_tokenize_mb(VP8_COMP *, MACROBLOCKD *, TOKENEXTRA **);
698 629
699 void vp8_set_speed_features(VP8_COMP *cpi); 630 void vp8_set_speed_features(VP8_COMP *cpi);
700 631
701 #if CONFIG_DEBUG 632 #if CONFIG_DEBUG
702 #define CHECK_MEM_ERROR(lval,expr) do {\ 633 #define CHECK_MEM_ERROR(lval,expr) do {\
703 lval = (expr); \ 634 lval = (expr); \
704 if(!lval) \ 635 if(!lval) \
705 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\ 636 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\
706 "Failed to allocate "#lval" at %s:%d", \ 637 "Failed to allocate "#lval" at %s:%d", \
707 __FILE__,__LINE__);\ 638 __FILE__,__LINE__);\
708 } while(0) 639 } while(0)
709 #else 640 #else
710 #define CHECK_MEM_ERROR(lval,expr) do {\ 641 #define CHECK_MEM_ERROR(lval,expr) do {\
711 lval = (expr); \ 642 lval = (expr); \
712 if(!lval) \ 643 if(!lval) \
713 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\ 644 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\
714 "Failed to allocate "#lval);\ 645 "Failed to allocate "#lval);\
715 } while(0) 646 } while(0)
716 #endif 647 #endif
717 #endif 648 #endif
OLDNEW
« no previous file with comments | « source/libvpx/vp8/encoder/onyx_if.c ('k') | source/libvpx/vp8/encoder/parms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698