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 VP8_ENCODER_ONYX_INT_H_ 12 #define VP8_ENCODER_ONYX_INT_H_ 13 14 #include <stdio.h> 15 #include "vpx_config.h" 16 #include "vp8/common/onyx.h" 17 #include "treewriter.h" 18 #include "tokenize.h" 19 #include "vp8/common/onyxc_int.h" 20 #include "vpx_dsp/variance.h" 21 #include "encodemb.h" 22 #include "vp8/encoder/quantize.h" 23 #include "vp8/common/entropy.h" 24 #include "vp8/common/threading.h" 25 #include "vpx_ports/mem.h" 26 #include "vpx/internal/vpx_codec_internal.h" 27 #include "vpx/vp8.h" 28 #include "mcomp.h" 29 #include "vp8/common/findnearmv.h" 30 #include "lookahead.h" 31 #if CONFIG_TEMPORAL_DENOISING 32 #include "vp8/encoder/denoising.h" 33 #endif 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 #define MIN_GF_INTERVAL 4 40 #define DEFAULT_GF_INTERVAL 7 41 42 #define KEY_FRAME_CONTEXT 5 43 44 #define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY ? 1 : 25) 45 46 #define AF_THRESH 25 47 #define AF_THRESH2 100 48 #define ARF_DECAY_THRESH 12 49 50 #define MIN_THRESHMULT 32 51 #define MAX_THRESHMULT 512 52 53 #define GF_ZEROMV_ZBIN_BOOST 12 54 #define LF_ZEROMV_ZBIN_BOOST 6 55 #define MV_ZBIN_BOOST 4 56 #define ZBIN_OQ_MAX 192 57 58 #define VP8_TEMPORAL_ALT_REF !CONFIG_REALTIME_ONLY 59 60 typedef struct { 61 int kf_indicated; 62 unsigned int frames_since_key; 63 unsigned int frames_since_golden; 64 int filter_level; 65 int frames_till_gf_update_due; 66 int recent_ref_frame_usage[MAX_REF_FRAMES]; 67 68 MV_CONTEXT mvc[2]; 69 int mvcosts[2][MVvals + 1]; 70 71 #ifdef MODE_STATS 72 int y_modes[5]; 73 int uv_modes[4]; 74 int b_modes[10]; 75 int inter_y_modes[10]; 76 int inter_uv_modes[4]; 77 int inter_b_modes[10]; 78 #endif 79 80 vp8_prob ymode_prob[4], uv_mode_prob[3]; /* interframe intra mode probs */ 81 vp8_prob kf_ymode_prob[4], kf_uv_mode_prob[3]; /* keyframe "" */ 82 83 int ymode_count[5], uv_mode_count[4]; /* intra MB type cts this frame */ 84 85 int count_mb_ref_frame_usage[MAX_REF_FRAMES]; 86 87 int this_frame_percent_intra; 88 int last_frame_percent_intra; 89 90 } CODING_CONTEXT; 91 92 typedef struct { 93 double frame; 94 double intra_error; 95 double coded_error; 96 double ssim_weighted_pred_err; 97 double pcnt_inter; 98 double pcnt_motion; 99 double pcnt_second_ref; 100 double pcnt_neutral; 101 double MVr; 102 double mvr_abs; 103 double MVc; 104 double mvc_abs; 105 double MVrv; 106 double MVcv; 107 double mv_in_out_count; 108 double new_mv_count; 109 double duration; 110 double count; 111 } FIRSTPASS_STATS; 112 113 typedef struct { 114 int frames_so_far; 115 double frame_intra_error; 116 double frame_coded_error; 117 double frame_pcnt_inter; 118 double frame_pcnt_motion; 119 double frame_mvr; 120 double frame_mvr_abs; 121 double frame_mvc; 122 double frame_mvc_abs; 123 124 } ONEPASS_FRAMESTATS; 125 126 typedef enum { 127 THR_ZERO1 = 0, 128 THR_DC = 1, 129 130 THR_NEAREST1 = 2, 131 THR_NEAR1 = 3, 132 133 THR_ZERO2 = 4, 134 THR_NEAREST2 = 5, 135 136 THR_ZERO3 = 6, 137 THR_NEAREST3 = 7, 138 139 THR_NEAR2 = 8, 140 THR_NEAR3 = 9, 141 142 THR_V_PRED = 10, 143 THR_H_PRED = 11, 144 THR_TM = 12, 145 146 THR_NEW1 = 13, 147 THR_NEW2 = 14, 148 THR_NEW3 = 15, 149 150 THR_SPLIT1 = 16, 151 THR_SPLIT2 = 17, 152 THR_SPLIT3 = 18, 153 154 THR_B_PRED = 19 155 } THR_MODES; 156 157 typedef enum { DIAMOND = 0, NSTEP = 1, HEX = 2 } SEARCH_METHODS; 158 159 typedef struct { 160 int RD; 161 SEARCH_METHODS search_method; 162 int improved_quant; 163 int improved_dct; 164 int auto_filter; 165 int recode_loop; 166 int iterative_sub_pixel; 167 int half_pixel_search; 168 int quarter_pixel_search; 169 int thresh_mult[MAX_MODES]; 170 int max_step_search_steps; 171 int first_step; 172 int optimize_coefficients; 173 174 int use_fastquant_for_pick; 175 int no_skip_block4x4_search; 176 int improved_mv_pred; 177 178 } SPEED_FEATURES; 179 180 typedef struct { 181 MACROBLOCK mb; 182 int segment_counts[MAX_MB_SEGMENTS]; 183 int totalrate; 184 } MB_ROW_COMP; 185 186 typedef struct { 187 TOKENEXTRA *start; 188 TOKENEXTRA *stop; 189 } TOKENLIST; 190 191 typedef struct { 192 int ithread; 193 void *ptr1; 194 void *ptr2; 195 } ENCODETHREAD_DATA; 196 typedef struct { 197 int ithread; 198 void *ptr1; 199 } LPFTHREAD_DATA; 200 201 enum { 202 BLOCK_16X8, 203 BLOCK_8X16, 204 BLOCK_8X8, 205 BLOCK_4X4, 206 BLOCK_16X16, 207 BLOCK_MAX_SEGMENTS 208 }; 209 210 typedef struct { 211 /* Layer configuration */ 212 double framerate; 213 int target_bandwidth; 214 215 /* Layer specific coding parameters */ 216 int64_t starting_buffer_level; 217 int64_t optimal_buffer_level; 218 int64_t maximum_buffer_size; 219 int64_t starting_buffer_level_in_ms; 220 int64_t optimal_buffer_level_in_ms; 221 int64_t maximum_buffer_size_in_ms; 222 223 int avg_frame_size_for_layer; 224 225 int64_t buffer_level; 226 int64_t bits_off_target; 227 228 int64_t total_actual_bits; 229 int total_target_vs_actual; 230 231 int worst_quality; 232 int active_worst_quality; 233 int best_quality; 234 int active_best_quality; 235 236 int ni_av_qi; 237 int ni_tot_qi; 238 int ni_frames; 239 int avg_frame_qindex; 240 241 double rate_correction_factor; 242 double key_frame_rate_correction_factor; 243 double gf_rate_correction_factor; 244 245 int zbin_over_quant; 246 247 int inter_frame_target; 248 int64_t total_byte_count; 249 250 int filter_level; 251 252 int last_frame_percent_intra; 253 254 int count_mb_ref_frame_usage[MAX_REF_FRAMES]; 255 256 } LAYER_CONTEXT; 257 258 typedef struct VP8_COMP { 259 DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]); 260 DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]); 261 DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]); 262 DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]); 263 264 DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]); 265 DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]); 266 DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]); 267 DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]); 268 269 DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]); 270 DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]); 271 DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]); 272 DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]); 273 274 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]); 275 DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]); 276 DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]); 277 DECLARE_ALIGNED(16, short, Y1quant_fast[QINDEX_RANGE][16]); 278 DECLARE_ALIGNED(16, short, Y2quant_fast[QINDEX_RANGE][16]); 279 DECLARE_ALIGNED(16, short, UVquant_fast[QINDEX_RANGE][16]); 280 281 MACROBLOCK mb; 282 VP8_COMMON common; 283 vp8_writer bc[9]; /* one boolcoder for each partition */ 284 285 VP8_CONFIG oxcf; 286 287 struct lookahead_ctx *lookahead; 288 struct lookahead_entry *source; 289 struct lookahead_entry *alt_ref_source; 290 struct lookahead_entry *last_source; 291 292 YV12_BUFFER_CONFIG *Source; 293 YV12_BUFFER_CONFIG *un_scaled_source; 294 YV12_BUFFER_CONFIG scaled_source; 295 YV12_BUFFER_CONFIG *last_frame_unscaled_source; 296 297 unsigned int frames_till_alt_ref_frame; 298 /* frame in src_buffers has been identified to be encoded as an alt ref */ 299 int source_alt_ref_pending; 300 /* an alt ref frame has been encoded and is usable */ 301 int source_alt_ref_active; 302 /* source of frame to encode is an exact copy of an alt ref frame */ 303 int is_src_frame_alt_ref; 304 305 /* golden frame same as last frame ( short circuit gold searches) */ 306 int gold_is_last; 307 /* Alt reference frame same as last ( short circuit altref search) */ 308 int alt_is_last; 309 /* don't do both alt and gold search ( just do gold). */ 310 int gold_is_alt; 311 312 YV12_BUFFER_CONFIG pick_lf_lvl_frame; 313 314 TOKENEXTRA *tok; 315 unsigned int tok_count; 316 317 unsigned int frames_since_key; 318 unsigned int key_frame_frequency; 319 unsigned int this_key_frame_forced; 320 unsigned int next_key_frame_forced; 321 322 /* Ambient reconstruction err target for force key frames */ 323 int ambient_err; 324 325 unsigned int mode_check_freq[MAX_MODES]; 326 327 int rd_baseline_thresh[MAX_MODES]; 328 329 int RDMULT; 330 int RDDIV; 331 332 CODING_CONTEXT coding_context; 333 334 /* Rate targetting variables */ 335 int64_t last_prediction_error; 336 int64_t last_intra_error; 337 338 int this_frame_target; 339 int projected_frame_size; 340 int last_q[2]; /* Separate values for Intra/Inter */ 341 342 double rate_correction_factor; 343 double key_frame_rate_correction_factor; 344 double gf_rate_correction_factor; 345 346 int frames_since_golden; 347 /* Count down till next GF */ 348 int frames_till_gf_update_due; 349 350 /* GF interval chosen when we coded the last GF */ 351 int current_gf_interval; 352 353 /* Total bits overspent becasue of GF boost (cumulative) */ 354 int gf_overspend_bits; 355 356 /* Used in the few frames following a GF to recover the extra bits 357 * spent in that GF 358 */ 359 int non_gf_bitrate_adjustment; 360 361 /* Extra bits spent on key frames that need to be recovered */ 362 int kf_overspend_bits; 363 364 /* Current number of bit s to try and recover on each inter frame. */ 365 int kf_bitrate_adjustment; 366 int max_gf_interval; 367 int baseline_gf_interval; 368 int active_arnr_frames; 369 370 int64_t key_frame_count; 371 int prior_key_frame_distance[KEY_FRAME_CONTEXT]; 372 /* Current section per frame bandwidth target */ 373 int per_frame_bandwidth; 374 /* Average frame size target for clip */ 375 int av_per_frame_bandwidth; 376 /* Minimum allocation that should be used for any frame */ 377 int min_frame_bandwidth; 378 int inter_frame_target; 379 double output_framerate; 380 int64_t last_time_stamp_seen; 381 int64_t last_end_time_stamp_seen; 382 int64_t first_time_stamp_ever; 383 384 int ni_av_qi; 385 int ni_tot_qi; 386 int ni_frames; 387 int avg_frame_qindex; 388 389 int64_t total_byte_count; 390 391 int buffered_mode; 392 393 double framerate; 394 double ref_framerate; 395 int64_t buffer_level; 396 int64_t bits_off_target; 397 398 int rolling_target_bits; 399 int rolling_actual_bits; 400 401 int long_rolling_target_bits; 402 int long_rolling_actual_bits; 403 404 int64_t total_actual_bits; 405 int total_target_vs_actual; /* debug stats */ 406 407 int worst_quality; 408 int active_worst_quality; 409 int best_quality; 410 int active_best_quality; 411 412 int cq_target_quality; 413 414 int drop_frames_allowed; /* Are we permitted to drop frames? */ 415 int drop_frame; /* Drop this frame? */ 416 #if defined(DROP_UNCODED_FRAMES) 417 int drop_frame_count; 418 #endif 419 420 vp8_prob frame_coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] 421 [ENTROPY_NODES]; 422 char update_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]; 423 424 unsigned int frame_branch_ct[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] 425 [ENTROPY_NODES][2]; 426 427 int gfu_boost; 428 int kf_boost; 429 int last_boost; 430 431 int target_bandwidth; 432 struct vpx_codec_pkt_list *output_pkt_list; 433 434 #if 0 435 /* Experimental code for lagged and one pass */ 436 ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS]; 437 int one_pass_frame_index; 438 #endif 439 440 int decimation_factor; 441 int decimation_count; 442 443 /* for real time encoding */ 444 int avg_encode_time; /* microsecond */ 445 int avg_pick_mode_time; /* microsecond */ 446 int Speed; 447 int compressor_speed; 448 449 int auto_gold; 450 int auto_adjust_gold_quantizer; 451 int auto_worst_q; 452 int cpu_used; 453 int pass; 454 455 int prob_intra_coded; 456 int prob_last_coded; 457 int prob_gf_coded; 458 int prob_skip_false; 459 int last_skip_false_probs[3]; 460 int last_skip_probs_q[3]; 461 int recent_ref_frame_usage[MAX_REF_FRAMES]; 462 463 int this_frame_percent_intra; 464 int last_frame_percent_intra; 465 466 int ref_frame_flags; 467 468 SPEED_FEATURES sf; 469 470 /* Count ZEROMV on all reference frames. */ 471 int zeromv_count; 472 int lf_zeromv_pct; 473 474 unsigned char *segmentation_map; 475 signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; 476 int segment_encode_breakout[MAX_MB_SEGMENTS]; 477 478 unsigned char *active_map; 479 unsigned int active_map_enabled; 480 481 /* Video conferencing cyclic refresh mode flags. This is a mode 482 * designed to clean up the background over time in live encoding 483 * scenarious. It uses segmentation. 484 */ 485 int cyclic_refresh_mode_enabled; 486 int cyclic_refresh_mode_max_mbs_perframe; 487 int cyclic_refresh_mode_index; 488 int cyclic_refresh_q; 489 signed char *cyclic_refresh_map; 490 // Count on how many (consecutive) times a macroblock uses ZER0MV_LAST. 491 unsigned char *consec_zero_last; 492 // Counter that is reset when a block is checked for a mode-bias against 493 // ZEROMV_LASTREF. 494 unsigned char *consec_zero_last_mvbias; 495 496 // Frame counter for the temporal pattern. Counter is rest when the temporal 497 // layers are changed dynamically (run-time change). 498 unsigned int temporal_pattern_counter; 499 // Temporal layer id. 500 int temporal_layer_id; 501 502 // Measure of average squared difference between source and denoised signal. 503 int mse_source_denoised; 504 505 int force_maxqp; 506 507 // GF update for 1 pass cbr. 508 int gf_update_onepass_cbr; 509 int gf_interval_onepass_cbr; 510 int gf_noboost_onepass_cbr; 511 512 #if CONFIG_MULTITHREAD 513 /* multithread data */ 514 pthread_mutex_t *pmutex; 515 pthread_mutex_t mt_mutex; /* mutex for b_multi_threaded */ 516 int *mt_current_mb_col; 517 int mt_sync_range; 518 int b_multi_threaded; 519 int encoding_thread_count; 520 int b_lpf_running; 521 522 pthread_t *h_encoding_thread; 523 pthread_t h_filter_thread; 524 525 MB_ROW_COMP *mb_row_ei; 526 ENCODETHREAD_DATA *en_thread_data; 527 LPFTHREAD_DATA lpf_thread_data; 528 529 /* events */ 530 sem_t *h_event_start_encoding; 531 sem_t *h_event_end_encoding; 532 sem_t h_event_start_lpf; 533 sem_t h_event_end_lpf; 534 #endif 535 536 TOKENLIST *tplist; 537 unsigned int partition_sz[MAX_PARTITIONS]; 538 unsigned char *partition_d[MAX_PARTITIONS]; 539 unsigned char *partition_d_end[MAX_PARTITIONS]; 540 541 fractional_mv_step_fp *find_fractional_mv_step; 542 vp8_full_search_fn_t full_search_sad; 543 vp8_refining_search_fn_t refining_search_sad; 544 vp8_diamond_search_fn_t diamond_search_sad; 545 vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS]; 546 uint64_t time_receive_data; 547 uint64_t time_compress_data; 548 uint64_t time_pick_lpf; 549 uint64_t time_encode_mb_row; 550 551 int base_skip_false_prob[128]; 552 553 FRAME_CONTEXT lfc_n; /* last frame entropy */ 554 FRAME_CONTEXT lfc_a; /* last alt ref entropy */ 555 FRAME_CONTEXT lfc_g; /* last gold ref entropy */ 556 557 struct twopass_rc { 558 unsigned int section_intra_rating; 559 double section_max_qfactor; 560 unsigned int next_iiratio; 561 unsigned int this_iiratio; 562 FIRSTPASS_STATS total_stats; 563 FIRSTPASS_STATS this_frame_stats; 564 FIRSTPASS_STATS *stats_in, *stats_in_end, *stats_in_start; 565 FIRSTPASS_STATS total_left_stats; 566 int first_pass_done; 567 int64_t bits_left; 568 int64_t clip_bits_total; 569 double avg_iiratio; 570 double modified_error_total; 571 double modified_error_used; 572 double modified_error_left; 573 double kf_intra_err_min; 574 double gf_intra_err_min; 575 int frames_to_key; 576 int maxq_max_limit; 577 int maxq_min_limit; 578 int gf_decay_rate; 579 int static_scene_max_gf_interval; 580 int kf_bits; 581 /* Remaining error from uncoded frames in a gf group. */ 582 int gf_group_error_left; 583 /* Projected total bits available for a key frame group of frames */ 584 int64_t kf_group_bits; 585 /* Error score of frames still to be coded in kf group */ 586 int64_t kf_group_error_left; 587 /* Projected Bits available for a group including 1 GF or ARF */ 588 int64_t gf_group_bits; 589 /* Bits for the golden frame or ARF */ 590 int gf_bits; 591 int alt_extra_bits; 592 double est_max_qcorrection_factor; 593 } twopass; 594 595 #if VP8_TEMPORAL_ALT_REF 596 YV12_BUFFER_CONFIG alt_ref_buffer; 597 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; 598 int fixed_divide[512]; 599 #endif 600 601 #if CONFIG_INTERNAL_STATS 602 int count; 603 double total_y; 604 double total_u; 605 double total_v; 606 double total; 607 double total_sq_error; 608 double totalp_y; 609 double totalp_u; 610 double totalp_v; 611 double totalp; 612 double total_sq_error2; 613 int bytes; 614 double summed_quality; 615 double summed_weights; 616 unsigned int tot_recode_hits; 617 618 int b_calculate_ssimg; 619 #endif 620 int b_calculate_psnr; 621 622 /* Per MB activity measurement */ 623 unsigned int activity_avg; 624 unsigned int *mb_activity_map; 625 626 /* Record of which MBs still refer to last golden frame either 627 * directly or through 0,0 628 */ 629 unsigned char *gf_active_flags; 630 int gf_active_count; 631 632 int output_partition; 633 634 /* Store last frame's MV info for next frame MV prediction */ 635 int_mv *lfmv; 636 int *lf_ref_frame_sign_bias; 637 int *lf_ref_frame; 638 639 /* force next frame to intra when kf_auto says so */ 640 int force_next_frame_intra; 641 642 int droppable; 643 644 int initial_width; 645 int initial_height; 646 647 #if CONFIG_TEMPORAL_DENOISING 648 VP8_DENOISER denoiser; 649 #endif 650 651 /* Coding layer state variables */ 652 unsigned int current_layer; 653 LAYER_CONTEXT layer_context[VPX_TS_MAX_LAYERS]; 654 655 int64_t frames_in_layer[VPX_TS_MAX_LAYERS]; 656 int64_t bytes_in_layer[VPX_TS_MAX_LAYERS]; 657 double sum_psnr[VPX_TS_MAX_LAYERS]; 658 double sum_psnr_p[VPX_TS_MAX_LAYERS]; 659 double total_error2[VPX_TS_MAX_LAYERS]; 660 double total_error2_p[VPX_TS_MAX_LAYERS]; 661 double sum_ssim[VPX_TS_MAX_LAYERS]; 662 double sum_weights[VPX_TS_MAX_LAYERS]; 663 664 double total_ssimg_y_in_layer[VPX_TS_MAX_LAYERS]; 665 double total_ssimg_u_in_layer[VPX_TS_MAX_LAYERS]; 666 double total_ssimg_v_in_layer[VPX_TS_MAX_LAYERS]; 667 double total_ssimg_all_in_layer[VPX_TS_MAX_LAYERS]; 668 669 #if CONFIG_MULTI_RES_ENCODING 670 /* Number of MBs per row at lower-resolution level */ 671 int mr_low_res_mb_cols; 672 /* Indicate if lower-res mv info is available */ 673 unsigned char mr_low_res_mv_avail; 674 #endif 675 /* The frame number of each reference frames */ 676 unsigned int current_ref_frames[MAX_REF_FRAMES]; 677 // Closest reference frame to current frame. 678 MV_REFERENCE_FRAME closest_reference_frame; 679 680 struct rd_costs_struct { 681 int mvcosts[2][MVvals + 1]; 682 int mvsadcosts[2][MVfpvals + 1]; 683 int mbmode_cost[2][MB_MODE_COUNT]; 684 int intra_uv_mode_cost[2][MB_MODE_COUNT]; 685 int bmode_costs[10][10][10]; 686 int inter_bmode_costs[B_MODE_COUNT]; 687 int token_costs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] 688 [MAX_ENTROPY_TOKENS]; 689 } rd_costs; 690 } VP8_COMP; 691 692 void vp8_initialize_enc(void); 693 694 void vp8_alloc_compressor_data(VP8_COMP *cpi); 695 int vp8_reverse_trans(int x); 696 void vp8_new_framerate(VP8_COMP *cpi, double framerate); 697 void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm); 698 699 void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, 700 unsigned char *dest_end, size_t *size); 701 702 void vp8_tokenize_mb(VP8_COMP *, MACROBLOCK *, TOKENEXTRA **); 703 704 void vp8_set_speed_features(VP8_COMP *cpi); 705 706 #if CONFIG_DEBUG 707 #define CHECK_MEM_ERROR(lval, expr) \ 708 do { \ 709 lval = (expr); \ 710 if (!lval) \ 711 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR, \ 712 "Failed to allocate " #lval " at %s:%d", __FILE__, \ 713 __LINE__); \ 714 } while (0) 715 #else 716 #define CHECK_MEM_ERROR(lval, expr) \ 717 do { \ 718 lval = (expr); \ 719 if (!lval) \ 720 vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR, \ 721 "Failed to allocate " #lval); \ 722 } while (0) 723 #endif 724 #ifdef __cplusplus 725 } // extern "C" 726 #endif 727 728 #endif // VP8_ENCODER_ONYX_INT_H_ 729