Lines Matching refs:cpi

216 void vp8_save_coding_context(VP8_COMP *cpi)
218 CODING_CONTEXT *const cc = & cpi->coding_context;
226 cc->frames_since_key = cpi->frames_since_key;
227 cc->filter_level = cpi->common.filter_level;
228 cc->frames_till_gf_update_due = cpi->frames_till_gf_update_due;
229 cc->frames_since_golden = cpi->frames_since_golden;
231 vp8_copy(cc->mvc, cpi->common.fc.mvc);
232 vp8_copy(cc->mvcosts, cpi->rd_costs.mvcosts);
234 vp8_copy(cc->ymode_prob, cpi->common.fc.ymode_prob);
235 vp8_copy(cc->uv_mode_prob, cpi->common.fc.uv_mode_prob);
237 vp8_copy(cc->ymode_count, cpi->mb.ymode_count);
238 vp8_copy(cc->uv_mode_count, cpi->mb.uv_mode_count);
251 cc->this_frame_percent_intra = cpi->this_frame_percent_intra;
255 void vp8_restore_coding_context(VP8_COMP *cpi)
257 CODING_CONTEXT *const cc = & cpi->coding_context;
263 cpi->frames_since_key = cc->frames_since_key;
264 cpi->common.filter_level = cc->filter_level;
265 cpi->frames_till_gf_update_due = cc->frames_till_gf_update_due;
266 cpi->frames_since_golden = cc->frames_since_golden;
268 vp8_copy(cpi->common.fc.mvc, cc->mvc);
270 vp8_copy(cpi->rd_costs.mvcosts, cc->mvcosts);
272 vp8_copy(cpi->common.fc.ymode_prob, cc->ymode_prob);
273 vp8_copy(cpi->common.fc.uv_mode_prob, cc->uv_mode_prob);
275 vp8_copy(cpi->mb.ymode_count, cc->ymode_count);
276 vp8_copy(cpi->mb.uv_mode_count, cc->uv_mode_count);
289 cpi->this_frame_percent_intra = cc->this_frame_percent_intra;
293 void vp8_setup_key_frame(VP8_COMP *cpi)
297 vp8_default_coef_probs(& cpi->common);
299 vpx_memcpy(cpi->common.fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
302 vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cpi->common.fc.mvc, flag);
308 vpx_memcpy(&cpi->lfc_a, &cpi->common.fc, sizeof(cpi->common.fc));
309 vpx_memcpy(&cpi->lfc_g, &cpi->common.fc, sizeof(cpi->common.fc));
310 vpx_memcpy(&cpi->lfc_n, &cpi->common.fc, sizeof(cpi->common.fc));
312 cpi->common.filter_level = cpi->common.base_qindex * 3 / 8 ;
315 if (cpi->auto_gold)
316 cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
318 cpi->frames_till_gf_update_due = DEFAULT_GF_INTERVAL;
320 cpi->common.refresh_golden_frame = 1;
321 cpi->common.refresh_alt_ref_frame = 1;
341 static void calc_iframe_target_size(VP8_COMP *cpi)
350 if (cpi->oxcf.fixed_q >= 0)
352 int Q = cpi->oxcf.key_q;
354 target = estimate_bits_at_q(INTRA_FRAME, Q, cpi->common.MBs,
355 cpi->key_frame_rate_correction_factor);
357 else if (cpi->pass == 2)
360 target = cpi->per_frame_bandwidth;
363 else if (cpi->common.current_video_frame == 0)
369 target = cpi->oxcf.starting_buffer_level / 2;
371 if(target > cpi->oxcf.target_bandwidth * 3 / 2)
372 target = cpi->oxcf.target_bandwidth * 3 / 2;
377 int Q = (cpi->common.frame_flags & FRAMEFLAGS_KEY)
378 ? cpi->avg_frame_qindex : cpi->ni_av_qi;
382 if (cpi->oxcf.number_of_layers == 1) {
383 kf_boost = MAX(initial_boost, (int)(2 * cpi->output_framerate - 16));
394 if (cpi->frames_since_key < cpi->output_framerate / 2)
396 * cpi->frames_since_key / (cpi->output_framerate / 2));
402 target = ((16 + kf_boost) * cpi->per_frame_bandwidth) >> 4;
406 if (cpi->oxcf.rc_max_intra_bitrate_pct)
408 unsigned int max_rate = cpi->per_frame_bandwidth
409 * cpi->oxcf.rc_max_intra_bitrate_pct / 100;
415 cpi->this_frame_target = (int)target;
420 if (cpi->pass != 2)
421 cpi->active_worst_quality = cpi->worst_quality;
429 cpi->common.current_video_frame, cpi->gfu_boost, cpi->baseline_gf_interval, cpi->source_alt_ref_pending);
440 static void calc_gf_params(VP8_COMP *cpi)
442 int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
446 int tot_mbs = cpi->recent_ref_frame_usage[INTRA_FRAME] +
447 cpi->recent_ref_frame_usage[LAST_FRAME] +
448 cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
449 cpi->recent_ref_frame_usage[ALTREF_FRAME];
451 int pct_gf_active = (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
454 gf_frame_useage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] + cpi->recent_ref_frame_usage[ALTREF_FRAME]) * 100 / tot_mbs;
460 if (cpi->pass != 2)
472 int index = cpi->one_pass_frame_index;
473 int frames_to_scan = (cpi->max_gf_interval <= MAX_LAG_BUFFERS) ? cpi->max_gf_interval : MAX_LAG_BUFFERS;
482 cpi->one_pass_frame_index = cpi->common.current_video_frame%MAX_LAG_BUFFERS;
490 if ( cpi->one_pass_frame_stats[index].frame_coded_error > 0.0 )
492 IIRatio = cpi->one_pass_frame_stats[index].frame_intra_error / cpi->one_pass_frame_stats[index].frame_coded_error;
502 decay_val = decay_val * cpi->one_pass_frame_stats[index].frame_pcnt_inter;
513 cpi->baseline_gf_interval = i;
525 Boost = Boost * gf_intra_usage_adjustment[(cpi->this_frame_percent_intra < 15) ? cpi->this_frame_percent_intra : 14] / 100;
535 if (!cpi->sf.recode_loop)
537 if (cpi->compressor_speed == 2)
542 if (Boost > kf_gf_boost_qlimits[Q] && (cpi->pass == 0))
550 cpi->last_boost = Boost;
557 if (cpi->oxcf.fixed_q == -1)
559 if (cpi->pass == 2) /* 2 Pass */
561 cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
565 cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
567 if (cpi->last_boost > 750)
568 cpi->frames_till_gf_update_due++;
570 if (cpi->last_boost > 1000)
571 cpi->frames_till_gf_update_due++;
573 if (cpi->last_boost > 1250)
574 cpi->frames_till_gf_update_due++;
576 if (cpi->last_boost >= 1500)
577 cpi->frames_till_gf_update_due ++;
579 if (gf_interval_table[gf_frame_useage] > cpi->frames_till_gf_update_due)
580 cpi->frames_till_gf_update_due = gf_interval_table[gf_frame_useage];
582 if (cpi->frames_till_gf_update_due > cpi->max_gf_interval)
583 cpi->frames_till_gf_update_due = cpi->max_gf_interval;
587 cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
590 if (cpi->pass != 2)
593 cpi->source_alt_ref_pending = 0;
595 /*if ( cpi->oxcf.fixed_q == -1)
597 if ( cpi->oxcf.play_alternate && (cpi->last_boost > (100 + (AF_THRESH*cpi->frames_till_gf_update_due)) ) )
598 cpi->source_alt_ref_pending = 1;
600 cpi->source_alt_ref_pending = 0;
606 static void calc_pframe_target_size(VP8_COMP *cpi)
609 int old_per_frame_bandwidth = cpi->per_frame_bandwidth;
611 if ( cpi->current_layer > 0)
612 cpi->per_frame_bandwidth =
613 cpi->layer_context[cpi->current_layer].avg_frame_size_for_layer;
617 if (cpi->pass == 2)
619 min_frame_target = cpi->min_frame_bandwidth;
621 if (min_frame_target < (cpi->av_per_frame_bandwidth >> 5))
622 min_frame_target = cpi->av_per_frame_bandwidth >> 5;
624 else if (min_frame_target < cpi->per_frame_bandwidth / 4)
625 min_frame_target = cpi->per_frame_bandwidth / 4;
629 if((cpi->common.refresh_alt_ref_frame) && (cpi->oxcf.number_of_layers == 1))
631 if (cpi->pass == 2)
634 cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
635 cpi->this_frame_target = cpi->per_frame_bandwidth;
645 if (cpi->pass == 2)
647 cpi->this_frame_target = cpi->per_frame_bandwidth;
657 if (cpi->kf_overspend_bits > 0)
659 Adjustment = (cpi->kf_bitrate_adjustment <= cpi->kf_overspend_bits) ? cpi->kf_bitrate_adjustment : cpi->kf_overspend_bits;
661 if (Adjustment > (cpi->per_frame_bandwidth - min_frame_target))
662 Adjustment = (cpi->per_frame_bandwidth - min_frame_target);
664 cpi->kf_overspend_bits -= Adjustment;
670 cpi->this_frame_target = cpi->per_frame_bandwidth - Adjustment;
672 if (cpi->this_frame_target < min_frame_target)
673 cpi->this_frame_target = min_frame_target;
676 cpi->this_frame_target = cpi->per_frame_bandwidth;
681 if ((cpi->gf_overspend_bits > 0) && (cpi->this_frame_target > min_frame_target))
683 Adjustment = (cpi->non_gf_bitrate_adjustment <= cpi->gf_overspend_bits) ? cpi->non_gf_bitrate_adjustment : cpi->gf_overspend_bits;
685 if (Adjustment > (cpi->this_frame_target - min_frame_target))
686 Adjustment = (cpi->this_frame_target - min_frame_target);
688 cpi->gf_overspend_bits -= Adjustment;
689 cpi->this_frame_target -= Adjustment;
693 if ((cpi->last_boost > 150) && (cpi->frames_till_gf_update_due > 0) &&
694 (cpi->current_gf_interval >= (MIN_GF_INTERVAL << 1)))
697 Adjustment = (cpi->last_boost - 100) >> 5;
705 Adjustment = (cpi->this_frame_target * Adjustment) / 100;
707 if (Adjustment > (cpi->this_frame_target - min_frame_target))
708 Adjustment = (cpi->this_frame_target - min_frame_target);
710 if (cpi->frames_since_golden == (cpi->current_gf_interval >> 1))
711 cpi->this_frame_target += ((cpi->current_gf_interval - 1) * Adjustment);
713 cpi->this_frame_target -= Adjustment;
726 if (cpi->this_frame_target < min_frame_target)
727 cpi->this_frame_target = min_frame_target;
729 if (!cpi->common.refresh_alt_ref_frame)
731 cpi->inter_frame_target = cpi->this_frame_target;
734 if (cpi->pass == 0)
737 if (cpi->buffered_mode)
740 (1 + cpi->oxcf.optimal_buffer_level / 100);
742 if ((cpi->buffer_level < cpi->oxcf.optimal_buffer_level) ||
743 (cpi->bits_off_target < cpi->oxcf.optimal_buffer_level))
754 if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
755 (cpi->buffer_level < cpi->oxcf.optimal_buffer_level))
758 ((cpi->oxcf.optimal_buffer_level - cpi->buffer_level) /
762 else if (cpi->bits_off_target < 0)
765 percent_low = (int)(100 * -cpi->bits_off_target /
766 (cpi->total_byte_count * 8));
769 if (percent_low > cpi->oxcf.under_shoot_pct)
770 percent_low = cpi->oxcf.under_shoot_pct;
775 cpi->this_frame_target -=
776 (cpi->this_frame_target * percent_low) / 200;
781 if (cpi->auto_worst_q && cpi->ni_frames > 150)
786 * cpi->buffer_level as this takes into account the
791 if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
793 /* Take the smaller of cpi->buffer_level and
794 * cpi->bits_off_target
797 (cpi->buffer_level < cpi->bits_off_target)
798 ? cpi->buffer_level : cpi->bits_off_target;
808 critical_buffer_level = cpi->bits_off_target;
814 if (critical_buffer_level < cpi->oxcf.optimal_buffer_level)
817 (cpi->oxcf.optimal_buffer_level >> 2) )
820 cpi->worst_quality - cpi->ni_av_qi;
823 (cpi->oxcf.optimal_buffer_level >> 2));
826 * cpi->ni_av_qi when (critical_buffer_level ==
827 * cpi->optimal_buffer_level) to
828 * cpi->worst_quality when
830 * cpi->optimal_buffer_level >> 2)
832 cpi->active_worst_quality =
833 cpi->worst_quality -
835 (cpi->oxcf.optimal_buffer_level*3>>2));
839 cpi->active_worst_quality = cpi->worst_quality;
844 cpi->active_worst_quality = cpi->ni_av_qi;
849 cpi->active_worst_quality = cpi->worst_quality;
856 if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
857 && (cpi->buffer_level > cpi->oxcf.optimal_buffer_level))
859 percent_high = (int)((cpi->buffer_level
860 - cpi->oxcf.optimal_buffer_level)
863 else if (cpi->bits_off_target > cpi->oxcf.optimal_buffer_level)
865 percent_high = (int)((100 * cpi->bits_off_target)
866 / (cpi->total_byte_count * 8));
869 if (percent_high > cpi->oxcf.over_shoot_pct)
870 percent_high = cpi->oxcf.over_shoot_pct;
874 cpi->this_frame_target += (cpi->this_frame_target *
880 if (cpi->auto_worst_q && cpi->ni_frames > 150)
885 cpi->active_worst_quality = cpi->ni_av_qi;
889 cpi->active_worst_quality = cpi->worst_quality;
894 cpi->active_best_quality = cpi->best_quality;
897 if (cpi->active_worst_quality <= cpi->active_best_quality)
898 cpi->active_worst_quality = cpi->active_best_quality + 1;
900 if(cpi->active_worst_quality > 127)
901 cpi->active_worst_quality = 127;
907 cpi->active_worst_quality = cpi->worst_quality;
914 if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY &&
915 cpi->active_worst_quality < cpi->cq_target_quality)
917 cpi->active_worst_quality = cpi->cq_target_quality;
927 if (cpi->drop_frames_allowed &&
928 (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
929 ((cpi->common.frame_type != KEY_FRAME)))
934 if ((cpi->buffer_level < 0))
939 (int) cpi->common.current_video_frame,
940 cpi->decimation_factor, cpi->common.horiz_scale,
941 (cpi->buffer_level * 100) / cpi->oxcf.optimal_buffer_level);
944 cpi->drop_frame = 1;
947 cpi->bits_off_target += cpi->av_per_frame_bandwidth;
948 if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size)
949 cpi->bits_off_target = (int)cpi->oxcf.maximum_buffer_size;
950 cpi->buffer_level = cpi->bits_off_target;
952 if (cpi->oxcf.number_of_layers > 1) {
956 for (i = cpi->current_layer + 1; i < cpi->oxcf.number_of_layers;
958 LAYER_CONTEXT *lc = &cpi->layer_context[i];
970 if (cpi->oxcf.error_resilient_mode == 0 &&
971 (cpi->frames_till_gf_update_due == 0) && !cpi->drop_frame)
973 int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
976 int tot_mbs = cpi->recent_ref_frame_usage[INTRA_FRAME] +
977 cpi->recent_ref_frame_usage[LAST_FRAME] +
978 cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
979 cpi->recent_ref_frame_usage[ALTREF_FRAME];
981 int pct_gf_active = (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
984 gf_frame_useage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] + cpi->recent_ref_frame_usage[ALTREF_FRAME]) * 100 / tot_mbs;
990 if (cpi->auto_gold)
995 if ((cpi->pass == 0) && (cpi->this_frame_percent_intra < 15 || gf_frame_useage >= 5))
996 cpi->common.refresh_golden_frame = 1;
999 else if (cpi->pass == 2)
1000 cpi->common.refresh_golden_frame = 1;
1012 cpi->common.current_video_frame, cpi->gfu_boost, GFQ_ADJUSTMENT, cpi->gfu_boost, gf_frame_useage);
1018 if (cpi->common.refresh_golden_frame == 1)
1027 fprintf(f, "%8ld GF coded\n", cpi->common.current_video_frame);
1033 if (cpi->auto_adjust_gold_quantizer)
1035 calc_gf_params(cpi);
1042 if (!cpi->source_alt_ref_active)
1044 if (cpi->oxcf.fixed_q < 0)
1046 if (cpi->pass == 2)
1051 cpi->this_frame_target = cpi->per_frame_bandwidth;
1055 int Boost = cpi->last_boost;
1056 int frames_in_section = cpi->frames_till_gf_update_due + 1;
1058 int bits_in_section = cpi->inter_frame_target * frames_in_section;
1071 cpi->this_frame_target = Boost * (bits_in_section / allocation_chunks);
1073 cpi->this_frame_target = (Boost * bits_in_section) / allocation_chunks;
1077 cpi->this_frame_target =
1078 (estimate_bits_at_q(1, Q, cpi->common.MBs, 1.0)
1079 * cpi->last_boost) / 100;
1089 cpi->this_frame_target = 0;
1092 cpi->current_gf_interval = cpi->frames_till_gf_update_due;
1097 cpi->per_frame_bandwidth = old_per_frame_bandwidth;
1101 void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var)
1103 int Q = cpi->common.base_qindex;
1113 if (cpi->common.frame_type == KEY_FRAME)
1115 rate_correction_factor = cpi->key_frame_rate_correction_factor;
1119 if (cpi->oxcf.number_of_layers == 1 &&
1120 (cpi->common.refresh_alt_ref_frame ||
1121 cpi->common.refresh_golden_frame))
1122 rate_correction_factor = cpi->gf_rate_correction_factor;
1124 rate_correction_factor = cpi->rate_correction_factor;
1131 projected_size_based_on_q = (int)(((.5 + rate_correction_factor * vp8_bits_per_mb[cpi->common.frame_type][Q]) * cpi->common.MBs) / (1 << BPER_MB_NORMBITS));
1133 /* Make some allowance for cpi->zbin_over_quant */
1134 if (cpi->mb.zbin_over_quant > 0)
1136 int Z = cpi->mb.zbin_over_quant;
1154 correction_factor = (100 * cpi->projected_frame_size) / projected_size_based_on_q;
1194 if (cpi->common.frame_type == KEY_FRAME)
1195 cpi->key_frame_rate_correction_factor = rate_correction_factor;
1198 if (cpi->oxcf.number_of_layers == 1 &&
1199 (cpi->common.refresh_alt_ref_frame ||
1200 cpi->common.refresh_golden_frame))
1201 cpi->gf_rate_correction_factor = rate_correction_factor;
1203 cpi->rate_correction_factor = rate_correction_factor;
1208 int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame)
1210 int Q = cpi->active_worst_quality;
1213 cpi->mb.zbin_over_quant = 0;
1215 if (cpi->oxcf.fixed_q >= 0)
1217 Q = cpi->oxcf.fixed_q;
1219 if (cpi->common.frame_type == KEY_FRAME)
1221 Q = cpi->oxcf.key_q;
1223 else if (cpi->oxcf.number_of_layers == 1 &&
1224 cpi->common.refresh_alt_ref_frame)
1226 Q = cpi->oxcf.alt_q;
1228 else if (cpi->oxcf.number_of_layers == 1 &&
1229 cpi->common.refresh_golden_frame)
1231 Q = cpi->oxcf.gold_q;
1243 if (cpi->common.frame_type == KEY_FRAME)
1244 correction_factor = cpi->key_frame_rate_correction_factor;
1247 if (cpi->oxcf.number_of_layers == 1 &&
1248 (cpi->common.refresh_alt_ref_frame ||
1249 cpi->common.refresh_golden_frame))
1250 correction_factor = cpi->gf_rate_correction_factor;
1252 correction_factor = cpi->rate_correction_factor;
1260 target_bits_per_mb = (target_bits_per_frame / cpi->common.MBs) << BPER_MB_NORMBITS;
1262 target_bits_per_mb = (target_bits_per_frame << BPER_MB_NORMBITS) / cpi->common.MBs;
1264 i = cpi->active_best_quality;
1268 bits_per_mb_at_this_q = (int)(.5 + correction_factor * vp8_bits_per_mb[cpi->common.frame_type][i]);
1282 while (++i <= cpi->active_worst_quality);
1296 if (cpi->common.frame_type == KEY_FRAME)
1298 else if (cpi->oxcf.number_of_layers == 1 &&
1299 (cpi->common.refresh_alt_ref_frame ||
1300 (cpi->common.refresh_golden_frame &&
1301 !cpi->source_alt_ref_active)))
1317 cpi->zbin_over_quant = (int)Oq;
1327 while (cpi->mb.zbin_over_quant < zbin_oqmax)
1329 cpi->mb.zbin_over_quant ++;
1331 if (cpi->mb.zbin_over_quant > zbin_oqmax)
1332 cpi->mb.zbin_over_quant = zbin_oqmax;
1353 static int estimate_keyframe_frequency(VP8_COMP *cpi)
1363 if (cpi->key_frame_count == 1)
1368 int key_freq = cpi->oxcf.key_freq>0 ? cpi->oxcf.key_freq : 1;
1369 av_key_frame_frequency = 1 + (int)cpi->output_framerate * 2;
1371 if (cpi->oxcf.auto_key && av_key_frame_frequency > key_freq)
1374 cpi->prior_key_frame_distance[KEY_FRAME_CONTEXT - 1]
1381 (cpi->frames_since_key > 0) ? cpi->frames_since_key : 1;
1389 cpi->prior_key_frame_distance[i]
1390 = cpi->prior_key_frame_distance[i+1];
1392 cpi->prior_key_frame_distance[i] = last_kf_interval;
1395 * cpi->prior_key_frame_distance[i];
1410 void vp8_adjust_key_frame_context(VP8_COMP *cpi)
1417 if ((cpi->pass != 2)
1418 && (cpi->projected_frame_size > cpi->per_frame_bandwidth))
1428 overspend = (cpi->projected_frame_size - cpi->per_frame_bandwidth);
1430 if (cpi->oxcf.number_of_layers > 1)
1431 cpi->kf_overspend_bits += overspend;
1434 cpi->kf_overspend_bits += overspend * 7 / 8;
1435 cpi->gf_overspend_bits += overspend * 1 / 8;
1439 cpi->kf_bitrate_adjustment = cpi->kf_overspend_bits
1440 / estimate_keyframe_frequency(cpi);
1443 cpi->frames_since_key = 0;
1444 cpi->key_frame_count++;
1448 void vp8_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit, int *frame_over_shoot_limit)
1451 if (cpi->oxcf.fixed_q >= 0)
1461 if (cpi->common.frame_type == KEY_FRAME)
1463 *frame_over_shoot_limit = cpi->this_frame_target * 9 / 8;
1464 *frame_under_shoot_limit = cpi->this_frame_target * 7 / 8;
1468 if (cpi->oxcf.number_of_layers > 1 ||
1469 cpi->common.refresh_alt_ref_frame ||
1470 cpi->common.refresh_golden_frame)
1472 *frame_over_shoot_limit = cpi->this_frame_target * 9 / 8;
1473 *frame_under_shoot_limit = cpi->this_frame_target * 7 / 8;
1478 if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
1480 if (cpi->buffer_level >= ((cpi->oxcf.optimal_buffer_level + cpi->oxcf.maximum_buffer_size) >> 1))
1485 *frame_over_shoot_limit = cpi->this_frame_target * 12 / 8;
1486 *frame_under_shoot_limit = cpi->this_frame_target * 6 / 8;
1488 else if (cpi->buffer_level <= (cpi->oxcf.optimal_buffer_level >> 1))
1493 *frame_over_shoot_limit = cpi->this_frame_target * 10 / 8;
1494 *frame_under_shoot_limit = cpi->this_frame_target * 4 / 8;
1498 *frame_over_shoot_limit = cpi->this_frame_target * 11 / 8;
1499 *frame_under_shoot_limit = cpi->this_frame_target * 5 / 8;
1509 if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
1511 *frame_over_shoot_limit = cpi->this_frame_target * 11 / 8;
1512 *frame_under_shoot_limit = cpi->this_frame_target * 2 / 8;
1516 *frame_over_shoot_limit = cpi->this_frame_target * 11 / 8;
1517 *frame_under_shoot_limit = cpi->this_frame_target * 5 / 8;
1537 int vp8_pick_frame_size(VP8_COMP *cpi)
1539 VP8_COMMON *cm = &cpi->common;
1542 calc_iframe_target_size(cpi);
1545 calc_pframe_target_size(cpi);
1548 if (cpi->drop_frame)
1550 cpi->drop_frame = 0;