OLD | NEW |
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 3556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3567 if (cpi->oxcf.number_of_layers > 1) | 3567 if (cpi->oxcf.number_of_layers > 1) |
3568 { | 3568 { |
3569 unsigned int i; | 3569 unsigned int i; |
3570 | 3570 |
3571 /* Propagate bits saved by dropping the frame to higher | 3571 /* Propagate bits saved by dropping the frame to higher |
3572 * layers | 3572 * layers |
3573 */ | 3573 */ |
3574 for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++) | 3574 for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++) |
3575 { | 3575 { |
3576 LAYER_CONTEXT *lc = &cpi->layer_context[i]; | 3576 LAYER_CONTEXT *lc = &cpi->layer_context[i]; |
3577 lc->bits_off_target += cpi->av_per_frame_bandwidth; | 3577 lc->bits_off_target += (int)(lc->target_bandwidth / |
| 3578 lc->framerate); |
3578 if (lc->bits_off_target > lc->maximum_buffer_size) | 3579 if (lc->bits_off_target > lc->maximum_buffer_size) |
3579 lc->bits_off_target = lc->maximum_buffer_size; | 3580 lc->bits_off_target = lc->maximum_buffer_size; |
3580 lc->buffer_level = lc->bits_off_target; | 3581 lc->buffer_level = lc->bits_off_target; |
3581 } | 3582 } |
3582 } | 3583 } |
3583 | 3584 |
3584 return; | 3585 return; |
3585 } | 3586 } |
3586 else | 3587 else |
3587 cpi->decimation_count = cpi->decimation_factor; | 3588 cpi->decimation_count = cpi->decimation_factor; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 (cm->refresh_golden_frame && !cpi->source_alt_ref_active)))) | 3801 (cm->refresh_golden_frame && !cpi->source_alt_ref_active)))) |
3801 { | 3802 { |
3802 zbin_oq_high = 16; | 3803 zbin_oq_high = 16; |
3803 } | 3804 } |
3804 else | 3805 else |
3805 zbin_oq_high = ZBIN_OQ_MAX; | 3806 zbin_oq_high = ZBIN_OQ_MAX; |
3806 #endif | 3807 #endif |
3807 | 3808 |
3808 /* Setup background Q adjustment for error resilient mode. | 3809 /* Setup background Q adjustment for error resilient mode. |
3809 * For multi-layer encodes only enable this for the base layer. | 3810 * For multi-layer encodes only enable this for the base layer. |
3810 */ | 3811 */ |
3811 if (cpi->cyclic_refresh_mode_enabled) | 3812 if (cpi->cyclic_refresh_mode_enabled) |
3812 { | 3813 { |
3813 if (cpi->current_layer==0) | 3814 if (cpi->current_layer==0) |
3814 cyclic_background_refresh(cpi, Q, 0); | 3815 cyclic_background_refresh(cpi, Q, 0); |
3815 else | 3816 else |
3816 disable_segmentation(cpi); | 3817 disable_segmentation(cpi); |
3817 } | 3818 } |
3818 | 3819 |
3819 vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_sho
ot_limit); | 3820 vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_sho
ot_limit); |
3820 | 3821 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 } | 4614 } |
4614 } | 4615 } |
4615 | 4616 |
4616 #if 0 && CONFIG_INTERNAL_STATS | 4617 #if 0 && CONFIG_INTERNAL_STATS |
4617 { | 4618 { |
4618 FILE *f = fopen("tmp.stt", "a"); | 4619 FILE *f = fopen("tmp.stt", "a"); |
4619 | 4620 |
4620 vp8_clear_system_state(); | 4621 vp8_clear_system_state(); |
4621 | 4622 |
4622 if (cpi->twopass.total_left_stats.coded_error != 0.0) | 4623 if (cpi->twopass.total_left_stats.coded_error != 0.0) |
4623 fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %10d %6d %6d" | 4624 fprintf(f, "%10d %10d %10d %10d %10d %10"PRId64" %10"PRId64 |
4624 "%6d %6d %6d %5d %5d %5d %8d %8.2f %10d %10.3f" | 4625 "%10"PRId64" %10d %6d %6d %6d %6d %5d %5d %5d %8d " |
4625 "%10.3f %8d\n", | 4626 "%8.2lf %"PRId64" %10.3lf %10"PRId64" %8d\n", |
4626 cpi->common.current_video_frame, cpi->this_frame_target, | 4627 cpi->common.current_video_frame, cpi->this_frame_target, |
4627 cpi->projected_frame_size, | 4628 cpi->projected_frame_size, |
4628 (cpi->projected_frame_size - cpi->this_frame_target), | 4629 (cpi->projected_frame_size - cpi->this_frame_target), |
4629 (int)cpi->total_target_vs_actual, | 4630 cpi->total_target_vs_actual, |
4630 cpi->buffer_level, | 4631 cpi->buffer_level, |
4631 (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), | 4632 (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), |
4632 (int)cpi->total_actual_bits, cm->base_qindex, | 4633 cpi->total_actual_bits, cm->base_qindex, |
4633 cpi->active_best_quality, cpi->active_worst_quality, | 4634 cpi->active_best_quality, cpi->active_worst_quality, |
4634 cpi->ni_av_qi, cpi->cq_target_quality, | 4635 cpi->ni_av_qi, cpi->cq_target_quality, |
4635 cpi->zbin_over_quant, | |
4636 cm->refresh_golden_frame, cm->refresh_alt_ref_frame, | 4636 cm->refresh_golden_frame, cm->refresh_alt_ref_frame, |
4637 cm->frame_type, cpi->gfu_boost, | 4637 cm->frame_type, cpi->gfu_boost, |
4638 cpi->twopass.est_max_qcorrection_factor, | 4638 cpi->twopass.est_max_qcorrection_factor, |
4639 (int)cpi->twopass.bits_left, | 4639 cpi->twopass.bits_left, |
4640 cpi->twopass.total_left_stats.coded_error, | 4640 cpi->twopass.total_left_stats.coded_error, |
4641 (double)cpi->twopass.bits_left / | 4641 (double)cpi->twopass.bits_left / |
4642 cpi->twopass.total_left_stats.coded_error, | 4642 cpi->twopass.total_left_stats.coded_error, |
4643 cpi->tot_recode_hits); | 4643 cpi->tot_recode_hits); |
4644 else | 4644 else |
4645 fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %10d %6d %6d" | 4645 fprintf(f, "%10d %10d %10d %10d %10d %10"PRId64" %10"PRId64 |
4646 "%6d %6d %6d %5d %5d %5d %8d %8.2f %10d %10.3f" | 4646 "%10"PRId64" %10d %6d %6d %6d %6d %5d %5d %5d %8d " |
4647 "%8d\n", | 4647 "%8.2lf %"PRId64" %10.3lf %8d\n", |
4648 cpi->common.current_video_frame, | 4648 cpi->common.current_video_frame, cpi->this_frame_target, |
4649 cpi->this_frame_target, cpi->projected_frame_size, | 4649 cpi->projected_frame_size, |
4650 (cpi->projected_frame_size - cpi->this_frame_target), | 4650 (cpi->projected_frame_size - cpi->this_frame_target), |
4651 (int)cpi->total_target_vs_actual, | 4651 cpi->total_target_vs_actual, |
4652 cpi->buffer_level, | 4652 cpi->buffer_level, |
4653 (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), | 4653 (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), |
4654 (int)cpi->total_actual_bits, cm->base_qindex, | 4654 cpi->total_actual_bits, cm->base_qindex, |
4655 cpi->active_best_quality, cpi->active_worst_quality, | 4655 cpi->active_best_quality, cpi->active_worst_quality, |
4656 cpi->ni_av_qi, cpi->cq_target_quality, | 4656 cpi->ni_av_qi, cpi->cq_target_quality, |
4657 cpi->zbin_over_quant, | |
4658 cm->refresh_golden_frame, cm->refresh_alt_ref_frame, | 4657 cm->refresh_golden_frame, cm->refresh_alt_ref_frame, |
4659 cm->frame_type, cpi->gfu_boost, | 4658 cm->frame_type, cpi->gfu_boost, |
4660 cpi->twopass.est_max_qcorrection_factor, | 4659 cpi->twopass.est_max_qcorrection_factor, |
4661 (int)cpi->twopass.bits_left, | 4660 cpi->twopass.bits_left, |
4662 cpi->twopass.total_left_stats.coded_error, | 4661 cpi->twopass.total_left_stats.coded_error, |
4663 cpi->tot_recode_hits); | 4662 cpi->tot_recode_hits); |
4664 | 4663 |
4665 fclose(f); | 4664 fclose(f); |
4666 | 4665 |
4667 { | 4666 { |
4668 FILE *fmodes = fopen("Modes.stt", "a"); | 4667 FILE *fmodes = fopen("Modes.stt", "a"); |
4669 int i; | |
4670 | 4668 |
4671 fprintf(fmodes, "%6d:%1d:%1d:%1d ", | 4669 fprintf(fmodes, "%6d:%1d:%1d:%1d ", |
4672 cpi->common.current_video_frame, | 4670 cpi->common.current_video_frame, |
4673 cm->frame_type, cm->refresh_golden_frame, | 4671 cm->frame_type, cm->refresh_golden_frame, |
4674 cm->refresh_alt_ref_frame); | 4672 cm->refresh_alt_ref_frame); |
4675 | 4673 |
4676 fprintf(fmodes, "\n"); | 4674 fprintf(fmodes, "\n"); |
4677 | 4675 |
4678 fclose(fmodes); | 4676 fclose(fmodes); |
4679 } | 4677 } |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5586 } | 5584 } |
5587 | 5585 |
5588 return Total; | 5586 return Total; |
5589 } | 5587 } |
5590 | 5588 |
5591 | 5589 |
5592 int vp8_get_quantizer(VP8_COMP *cpi) | 5590 int vp8_get_quantizer(VP8_COMP *cpi) |
5593 { | 5591 { |
5594 return cpi->common.base_qindex; | 5592 return cpi->common.base_qindex; |
5595 } | 5593 } |
OLD | NEW |