blob: 134e03075b67db79d0a8d3deff684ef71c9c81ff [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * 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
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
10
11
12#ifndef __INC_VP8_INT_H
13#define __INC_VP8_INT_H
14
15#include <stdio.h>
16#include "vpx_ports/config.h"
17#include "onyx.h"
18#include "treewriter.h"
19#include "tokenize.h"
20#include "onyxc_int.h"
21#include "preproc.h"
22#include "variance.h"
23#include "dct.h"
24#include "encodemb.h"
25#include "quantize.h"
26#include "entropy.h"
27#include "threading.h"
28#include "vpx_ports/mem.h"
John Koleszarb7492342010-05-24 11:39:59 -040029#include "vpx/internal/vpx_codec_internal.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -040030#include "mcomp.h"
31
John Koleszar0ea50ce2010-05-18 11:58:33 -040032//#define SPEEDSTATS 1
33#define MIN_GF_INTERVAL 4
34#define DEFAULT_GF_INTERVAL 7
35
36#define KEY_FRAME_CONTEXT 5
37
38#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)
39
40#define AF_THRESH 25
41#define AF_THRESH2 100
42#define ARF_DECAY_THRESH 12
43#define MAX_MODES 20
44
45#define MIN_THRESHMULT 32
46#define MAX_THRESHMULT 512
47
48#define GF_ZEROMV_ZBIN_BOOST 24
49#define ZBIN_OQ_MAX 192
50
51#define VP8_TEMPORAL_ALT_REF 1
52
53typedef struct
54{
55 int kf_indicated;
56 unsigned int frames_since_key;
57 unsigned int frames_since_golden;
58 int filter_level;
59 int frames_till_gf_update_due;
60 int recent_ref_frame_usage[MAX_REF_FRAMES];
61
62 MV_CONTEXT mvc[2];
63 int mvcosts[2][MVvals+1];
64
65#ifdef MODE_STATS
66 // Stats
67 int y_modes[5];
68 int uv_modes[4];
69 int b_modes[10];
70 int inter_y_modes[10];
71 int inter_uv_modes[4];
72 int inter_b_modes[10];
73#endif
74
75 vp8_prob ymode_prob[4], uv_mode_prob[3]; /* interframe intra mode probs */
76 vp8_prob kf_ymode_prob[4], kf_uv_mode_prob[3]; /* keyframe "" */
77
78 int ymode_count[5], uv_mode_count[4]; /* intra MB type cts this frame */
79
80 int count_mb_ref_frame_usage[MAX_REF_FRAMES];
81
82 int this_frame_percent_intra;
83 int last_frame_percent_intra;
84
85
86} CODING_CONTEXT;
87
88typedef struct
89{
90 double frame;
91 double intra_error;
92 double coded_error;
93 double ssim_weighted_pred_err;
94 double pcnt_inter;
95 double pcnt_motion;
96 double pcnt_second_ref;
97 double MVr;
98 double mvr_abs;
99 double MVc;
100 double mvc_abs;
101 double MVrv;
102 double MVcv;
103 double mv_in_out_count;
104 double duration;
105 double count;
106}
107FIRSTPASS_STATS;
108
109typedef struct
110{
111 int frames_so_far;
112 double frame_intra_error;
113 double frame_coded_error;
114 double frame_pcnt_inter;
115 double frame_pcnt_motion;
116 double frame_mvr;
117 double frame_mvr_abs;
118 double frame_mvc;
119 double frame_mvc_abs;
120
121} ONEPASS_FRAMESTATS;
122
123
124typedef enum
125{
126 THR_ZEROMV = 0,
127 THR_DC = 1,
128
129 THR_NEARESTMV = 2,
130 THR_NEARMV = 3,
131
132 THR_ZEROG = 4,
133 THR_NEARESTG = 5,
134
135 THR_ZEROA = 6,
136 THR_NEARESTA = 7,
137
138 THR_NEARG = 8,
139 THR_NEARA = 9,
140
141 THR_V_PRED = 10,
142 THR_H_PRED = 11,
143 THR_TM = 12,
144
145 THR_NEWMV = 13,
146 THR_NEWG = 14,
147 THR_NEWA = 15,
148
149 THR_SPLITMV = 16,
150 THR_SPLITG = 17,
151 THR_SPLITA = 18,
152
153 THR_B_PRED = 19,
154}
155THR_MODES;
156
157typedef enum
158{
159 DIAMOND = 0,
160 NSTEP = 1,
161 HEX = 2
162} SEARCH_METHODS;
163
164typedef struct
165{
166 int RD;
167 SEARCH_METHODS search_method;
168 int improved_quant;
169 int improved_dct;
170 int auto_filter;
171 int recode_loop;
172 int iterative_sub_pixel;
173 int half_pixel_search;
174 int quarter_pixel_search;
175 int thresh_mult[MAX_MODES];
176 int full_freq[2];
177 int min_fs_radius;
178 int max_fs_radius;
179 int max_step_search_steps;
180 int first_step;
181 int optimize_coefficients;
182
183} SPEED_FEATURES;
184
185typedef struct
186{
187 MACROBLOCK mb;
188 int mb_row;
189 TOKENEXTRA *tp;
190 int segment_counts[MAX_MB_SEGMENTS];
191 int totalrate;
192 int current_mb_col;
193} MB_ROW_COMP;
194
195typedef struct
196{
197 TOKENEXTRA *start;
198 TOKENEXTRA *stop;
199} TOKENLIST;
200
201typedef struct
202{
203 int ithread;
204 void *ptr1;
205 void *ptr2;
206} ENCODETHREAD_DATA;
207typedef struct
208{
209 int ithread;
210 void *ptr1;
211} LPFTHREAD_DATA;
212
213typedef struct
214{
215 INT64 source_time_stamp;
216 INT64 source_end_time_stamp;
217
218 DECLARE_ALIGNED(16, YV12_BUFFER_CONFIG, source_buffer);
219 unsigned int source_frame_flags;
220} SOURCE_SAMPLE;
221
222typedef struct VP8_ENCODER_RTCD
223{
224 VP8_COMMON_RTCD *common;
225 vp8_variance_rtcd_vtable_t variance;
226 vp8_fdct_rtcd_vtable_t fdct;
227 vp8_encodemb_rtcd_vtable_t encodemb;
228 vp8_quantize_rtcd_vtable_t quantize;
229 vp8_search_rtcd_vtable_t search;
230} VP8_ENCODER_RTCD;
231
John Koleszar209d82a2010-10-26 15:34:16 -0400232enum
233{
234 BLOCK_16X8,
235 BLOCK_8X16,
236 BLOCK_8X8,
237 BLOCK_4X4,
238 BLOCK_16X16,
239 BLOCK_MAX_SEGMENTS
240};
241
John Koleszar0ea50ce2010-05-18 11:58:33 -0400242typedef struct
243{
244
Timothy B. Terriberry8f75ea62010-10-21 17:04:30 -0700245 DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]);
246 DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]);
247 DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]);
248 DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]);
John Koleszar0ea50ce2010-05-18 11:58:33 -0400249
Timothy B. Terriberry8f75ea62010-10-21 17:04:30 -0700250 DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]);
251 DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]);
252 DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]);
253 DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]);
John Koleszar0ea50ce2010-05-18 11:58:33 -0400254
Timothy B. Terriberry8f75ea62010-10-21 17:04:30 -0700255 DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]);
256 DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]);
257 DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]);
258 DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]);
John Koleszar0ea50ce2010-05-18 11:58:33 -0400259
260 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]);
261 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]);
262 DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]);
263
264
265 MACROBLOCK mb;
266 VP8_COMMON common;
267 vp8_writer bc, bc2;
268 // bool_writer *bc2;
269
270 VP8_CONFIG oxcf;
271
272 YV12_BUFFER_CONFIG *Source;
273 YV12_BUFFER_CONFIG *un_scaled_source;
274 INT64 source_time_stamp;
275 INT64 source_end_time_stamp;
276 unsigned int source_frame_flags;
277 YV12_BUFFER_CONFIG scaled_source;
278
279 int source_buffer_count;
280 int source_encode_index;
281 int source_alt_ref_pending;
282 int source_alt_ref_active;
283
284 int last_alt_ref_sei;
285 int is_src_frame_alt_ref;
Yaowu Xu2e53e9e2010-10-14 18:58:34 -0700286 int is_next_src_alt_ref;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400287
288 int gold_is_last; // golden frame same as last frame ( short circuit gold searches)
289 int alt_is_last; // Alt reference frame same as last ( short circuit altref search)
290 int gold_is_alt; // don't do both alt and gold search ( just do gold).
291
292 //int refresh_alt_ref_frame;
293 SOURCE_SAMPLE src_buffer[MAX_LAG_BUFFERS];
294
295 YV12_BUFFER_CONFIG last_frame_uf;
296
297 char *Dest;
298
299 TOKENEXTRA *tok;
300 unsigned int tok_count;
301
302
303 unsigned int frames_since_key;
304 unsigned int key_frame_frequency;
305 unsigned int next_key;
306
307 unsigned int mode_check_freq[MAX_MODES];
308 unsigned int mode_test_hit_counts[MAX_MODES];
309 unsigned int mode_chosen_counts[MAX_MODES];
310 unsigned int mbs_tested_so_far;
311
312 unsigned int check_freq[2];
313 unsigned int do_full[2];
314
315 int rd_thresh_mult[MAX_MODES];
316 int rd_baseline_thresh[MAX_MODES];
317 int rd_threshes[MAX_MODES];
318 int mvcostbase;
319 int mvcostmultiplier;
320 int subseqblockweight;
321 int errthresh;
322
John Koleszar0ea50ce2010-05-18 11:58:33 -0400323 int RDMULT;
324 int RDDIV ;
325
326 TOKENEXTRA *rdtok;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400327 vp8_writer rdbc;
328 int intra_mode_costs[10];
John Koleszar0ea50ce2010-05-18 11:58:33 -0400329
330
331 CODING_CONTEXT coding_context;
332
333 // Rate targetting variables
334 long long prediction_error;
335 long long last_prediction_error;
336 long long intra_error;
337 long long last_intra_error;
338 long long last_auto_filter_prediction_error;
339
340#if 0
341 // Experimental RD code
342 long long frame_distortion;
343 long long last_frame_distortion;
344#endif
345
346 int last_mb_distortion;
347
348 int frames_since_auto_filter;
349
350 int this_frame_target;
351 int projected_frame_size;
352 int last_q[2]; // Separate values for Intra/Inter
353 int target_bits_per_mb;
354
355 double rate_correction_factor;
356 double key_frame_rate_correction_factor;
357 double gf_rate_correction_factor;
358 double est_max_qcorrection_factor;
359
360 int frames_till_gf_update_due; // Count down till next GF
361 int current_gf_interval; // GF interval chosen when we coded the last GF
362
363 int gf_overspend_bits; // Total bits overspent becasue of GF boost (cumulative)
364
365 int gf_group_bits; // Projected Bits available for a group of frames including 1 GF or ARF
366 int gf_bits; // Bits for the golden frame or ARF - 2 pass only
367 int mid_gf_extra_bits; // A few extra bits for the frame half way between two gfs.
368
Paul Wilkins9404c7d2010-07-23 17:01:12 +0100369 // Projected total bits available for a key frame group of frames
370 long long kf_group_bits;
371
372 // Error score of frames still to be coded in kf group
373 long long kf_group_error_left;
374
375 // Bits for the key frame in a key frame group - 2 pass only
376 int kf_bits;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400377
378 int non_gf_bitrate_adjustment; // Used in the few frames following a GF to recover the extra bits spent in that GF
379 int initial_gf_use; // percentage use of gf 2 frames after gf
380
381 int gf_group_error_left; // Remaining error from uncoded frames in a gf group. Two pass use only
382
383 int kf_overspend_bits; // Extra bits spent on key frames that need to be recovered on inter frames
384 int kf_bitrate_adjustment; // Current number of bit s to try and recover on each inter frame.
385 int max_gf_interval;
386 int baseline_gf_interval;
387 int gf_decay_rate;
Adrian Grange1b2f8302010-09-28 15:23:41 +0100388 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
John Koleszar0ea50ce2010-05-18 11:58:33 -0400389
390 INT64 key_frame_count;
391 INT64 tot_key_frame_bits;
392 int prior_key_frame_size[KEY_FRAME_CONTEXT];
393 int prior_key_frame_distance[KEY_FRAME_CONTEXT];
394 int per_frame_bandwidth; // Current section per frame bandwidth target
395 int av_per_frame_bandwidth; // Average frame size target for clip
396 int min_frame_bandwidth; // Minimum allocation that should be used for any frame
397 int last_key_frame_size;
398 int intra_frame_target;
399 int inter_frame_target;
400 double output_frame_rate;
401 long long last_time_stamp_seen;
John Koleszarf7e187d2010-11-04 15:05:45 -0400402 long long last_end_time_stamp_seen;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400403 long long first_time_stamp_ever;
404
405 int ni_av_qi;
406 int ni_tot_qi;
407 int ni_frames;
408 int avg_frame_qindex;
409
410 int zbin_over_quant;
411 int zbin_mode_boost;
412 int zbin_mode_boost_enabled;
413
414 INT64 total_byte_count;
415
416 int buffered_mode;
417
418 int buffer_level;
419 int bits_off_target;
420
421 int rolling_target_bits;
422 int rolling_actual_bits;
423
424 int long_rolling_target_bits;
425 int long_rolling_actual_bits;
426
427 long long total_actual_bits;
428 int total_target_vs_actual; // debug stats
429
430 int worst_quality;
431 int active_worst_quality;
432 int best_quality;
433 int active_best_quality;
434
435 int drop_frames_allowed; // Are we permitted to drop frames?
436 int drop_frame; // Drop this frame?
437 int drop_count; // How many frames have we dropped?
438 int max_drop_count; // How many frames should we drop?
439 int max_consec_dropped_frames; // Limit number of consecutive frames that can be dropped.
440
441
442 int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
443 int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
444
445 unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
446
447 unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens]; /* for this frame */
448 //DECLARE_ALIGNED(16, int, coef_counts_backup [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens]); //not used any more
449 //save vp8_tree_probs_from_distribution result for each frame to avoid repeat calculation
450 vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens-1];
451 unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens-1][2];
452
453 /* Second compressed data partition contains coefficient data. */
454
455 unsigned char *output_partition2;
456 size_t output_partition2size;
457
458 pre_proc_instance ppi;
459
460 int frames_to_key;
461 int gfu_boost;
462 int kf_boost;
463 int last_boost;
464 double total_error_left;
465 double total_intra_error_left;
466 double total_coded_error_left;
467 double start_tot_err_left;
468 double min_error;
469
470 double modified_total_error_left;
471 double avg_iiratio;
472
473 int target_bandwidth;
474 long long bits_left;
John Koleszarbb7dd5b2010-10-14 16:40:12 -0400475 FIRSTPASS_STATS *total_stats;
476 FIRSTPASS_STATS *this_frame_stats;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400477 FIRSTPASS_STATS *stats_in, *stats_in_end;
478 struct vpx_codec_pkt_list *output_pkt_list;
479 int first_pass_done;
480 unsigned char *fp_motion_map;
John Koleszarbb7dd5b2010-10-14 16:40:12 -0400481
482 unsigned char *fp_motion_map_stats, *fp_motion_map_stats_save;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400483
484#if 0
485 // Experimental code for lagged and one pass
486 ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS];
487 int one_pass_frame_index;
488#endif
489
490 int decimation_factor;
491 int decimation_count;
492
493 // for real time encoding
494 int avg_encode_time; //microsecond
495 int avg_pick_mode_time; //microsecond
496 int Speed;
497 unsigned int cpu_freq; //Mhz
498 int compressor_speed;
499
500 int interquantizer;
501 int auto_gold;
502 int auto_adjust_gold_quantizer;
503 int goldquantizer;
504 int goldfreq;
505 int auto_adjust_key_quantizer;
506 int keyquantizer;
507 int auto_worst_q;
508 int filter_type;
509 int cpu_used;
510 int chroma_boost;
511 int horiz_scale;
512 int vert_scale;
513 int pass;
514
515
516 int prob_intra_coded;
517 int prob_last_coded;
518 int prob_gf_coded;
519 int prob_skip_false;
520 int last_skip_false_probs[3];
521 int last_skip_probs_q[3];
522 int recent_ref_frame_usage[MAX_REF_FRAMES];
523
524 int count_mb_ref_frame_usage[MAX_REF_FRAMES];
525 int this_frame_percent_intra;
526 int last_frame_percent_intra;
527
528 int last_key_frame_q;
529 int last_kffilt_lvl;
530
531 int ref_frame_flags;
532
533 int exp[512];
534
535 SPEED_FEATURES sf;
536 int error_bins[1024];
537
538 int inter_lvl;
539 int intra_lvl;
540 int motion_lvl;
541 int motion_speed;
542 int motion_var;
John Koleszarcd475da2010-06-12 14:11:51 -0400543 unsigned int next_iiratio;
544 unsigned int this_iiratio;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400545 int this_frame_modified_error;
546
547 double norm_intra_err_per_mb;
548 double norm_inter_err_per_mb;
549 double norm_iidiff_per_mb;
550
551 int last_best_mode_index; // Record of mode index chosen for previous macro block.
552 int last_auto_filt_val;
553 int last_auto_filt_q;
554
555 // Data used for real time conferencing mode to help determine if it would be good to update the gf
556 int inter_zz_count;
557 int gf_bad_count;
558 int gf_update_recommended;
559 int skip_true_count;
560 int skip_false_count;
561
562 int alt_qcount;
563
564 int ready_for_new_frame;
565
566 unsigned char *segmentation_map;
567 signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; // Segment data (can be deltas or absolute values)
568 int segment_encode_breakout[MAX_MB_SEGMENTS]; // segment threashold for encode breakout
569
570 unsigned char *active_map;
571 unsigned int active_map_enabled;
572 // Video conferencing cyclic refresh mode flags etc
573 // This is a mode designed to clean up the background over time in live encoding scenarious. It uses segmentation
574 int cyclic_refresh_mode_enabled;
575 int cyclic_refresh_mode_max_mbs_perframe;
576 int cyclic_refresh_mode_index;
577 int cyclic_refresh_q;
578 signed char *cyclic_refresh_map;
579
580 // multithread data
581 int current_mb_col_main;
582 int processor_core_count;
583 int b_multi_threaded;
584 int encoding_thread_count;
585
586#if CONFIG_MULTITHREAD
587 pthread_t *h_encoding_thread;
588#endif
589 MB_ROW_COMP *mb_row_ei;
590 ENCODETHREAD_DATA *en_thread_data;
591
592#if CONFIG_MULTITHREAD
593 //events
594 sem_t *h_event_mbrencoding;
595 sem_t h_event_main;
596#endif
597
598 TOKENLIST *tplist;
599 // end of multithread data
600
601
602 fractional_mv_step_fp *find_fractional_mv_step;
603 vp8_full_search_fn_t full_search_sad;
604 vp8_diamond_search_fn_t diamond_search_sad;
John Koleszar209d82a2010-10-26 15:34:16 -0400605 vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS];
John Koleszar0ea50ce2010-05-18 11:58:33 -0400606 unsigned int time_receive_data;
607 unsigned int time_compress_data;
608 unsigned int time_pick_lpf;
609 unsigned int time_encode_mb_row;
610
611 unsigned int tempdata1;
612 unsigned int tempdata2;
613
614 int base_skip_false_prob[128];
615 unsigned int section_is_low_motion;
616 unsigned int section_benefits_from_aggresive_q;
617 unsigned int section_is_fast_motion;
618 unsigned int section_intra_rating;
619
620 double section_max_qfactor;
621
622
623#if CONFIG_RUNTIME_CPU_DETECT
624 VP8_ENCODER_RTCD rtcd;
625#endif
626#if VP8_TEMPORAL_ALT_REF
627 SOURCE_SAMPLE alt_ref_buffer;
Adrian Grange1b2f8302010-09-28 15:23:41 +0100628 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
629 int fixed_divide[512];
John Koleszar0ea50ce2010-05-18 11:58:33 -0400630#endif
Adrian Grange1b2f8302010-09-28 15:23:41 +0100631 // Flag to indicate temporal filter method
632 int use_weighted_temporal_filter;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400633
634#if CONFIG_PSNR
635 int count;
636 double total_y;
637 double total_u;
638 double total_v;
639 double total ;
640 double total_sq_error;
641 double totalp_y;
642 double totalp_u;
643 double totalp_v;
644 double totalp;
645 double total_sq_error2;
646 int bytes;
647 double summed_quality;
648 double summed_weights;
649 unsigned int tot_recode_hits;
650
651
652 double total_ssimg_y;
653 double total_ssimg_u;
654 double total_ssimg_v;
655 double total_ssimg_all;
656
657 int b_calculate_ssimg;
658#endif
659 int b_calculate_psnr;
Scott LaVarnway99f46d62010-08-11 11:02:31 -0400660
661
662 unsigned char *gf_active_flags; // Record of which MBs still refer to last golden frame either directly or through 0,0
663 int gf_active_count;
664
665
John Koleszar0ea50ce2010-05-18 11:58:33 -0400666} VP8_COMP;
667
668void control_data_rate(VP8_COMP *cpi);
669
670void vp8_encode_frame(VP8_COMP *cpi);
671
672void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size);
673
674int rd_cost_intra_mb(MACROBLOCKD *x);
675
676void vp8_tokenize_mb(VP8_COMP *, MACROBLOCKD *, TOKENEXTRA **);
677
678void vp8_set_speed_features(VP8_COMP *cpi);
679
680#if CONFIG_DEBUG
681#define CHECK_MEM_ERROR(lval,expr) do {\
682 lval = (expr); \
683 if(!lval) \
684 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\
685 "Failed to allocate "#lval" at %s:%d", \
686 __FILE__,__LINE__);\
687 } while(0)
688#else
689#define CHECK_MEM_ERROR(lval,expr) do {\
690 lval = (expr); \
691 if(!lval) \
692 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\
693 "Failed to allocate "#lval);\
694 } while(0)
695#endif
696#endif