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