diff options
author | Paul Wilkins <paulwilkins@google.com> | 2011-11-24 18:25:03 +0000 |
---|---|---|
committer | Paul Wilkins <paulwilkins@google.com> | 2011-11-29 17:59:23 +0000 |
commit | 99df6bb62959bfda82c0d636105d8239f147715a (patch) | |
tree | 6ef2405da5d36d0350d3290bf01e3cfa9253bd07 /vp8/encoder | |
parent | 82733643ca27bd63de4ea8d696d971cec213e20b (diff) | |
download | libvpx-99df6bb62959bfda82c0d636105d8239f147715a.tar libvpx-99df6bb62959bfda82c0d636105d8239f147715a.tar.gz libvpx-99df6bb62959bfda82c0d636105d8239f147715a.tar.bz2 libvpx-99df6bb62959bfda82c0d636105d8239f147715a.zip |
Further work on extended Q range.
Fixed bug in firspass.c call to vp8_initialize_rd_consts()
This was passing in vp8_dc_quant(cm->base_qindex, cm->y1dc_delta_q)
instead of (cm->base_qindex + cm->y1dc_delta_q).
It just so happens that for the value 26 used for cm->base_qindex in the
unextended Q case, the two give similar results. However, when using
the extended Q range the two are very different.
Also added more stats output and partly disabled another broken feature.
Change-Id: Iddf6cf5ea8467c44b7c133f38e629f6ba6f2581e
Diffstat (limited to 'vp8/encoder')
-rw-r--r-- | vp8/encoder/firstpass.c | 12 | ||||
-rw-r--r-- | vp8/encoder/onyx_if.c | 38 | ||||
-rw-r--r-- | vp8/encoder/rdopt.c | 2 |
3 files changed, 35 insertions, 17 deletions
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c index 4f3b75ce2..81d3b3509 100644 --- a/vp8/encoder/firstpass.c +++ b/vp8/encoder/firstpass.c @@ -535,7 +535,7 @@ void vp8_first_pass(VP8_COMP *cpi) //if ( 0 ) { int flag[2] = {1, 1}; - vp8_initialize_rd_consts(cpi, vp8_dc_quant(cm->base_qindex, cm->y1dc_delta_q)); + vp8_initialize_rd_consts(cpi, cm->base_qindex + cm->y1dc_delta_q); vpx_memcpy(cm->fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context)); vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cm->fc.mvc, flag); } @@ -895,8 +895,8 @@ static double calc_correction_factor( double err_per_mb, double error_term = err_per_mb / err_devisor; double correction_factor; - // Adjustment based on Q to power term. - power_term = pt_low + (Q * 0.01); + // Adjustment based on actual quantizer to power term. + power_term = (vp8_convert_qindex_to_q(Q) * 0.01) + 0.36; power_term = (power_term > pt_high) ? pt_high : power_term; // Adjustments to error term @@ -973,6 +973,7 @@ static int estimate_max_q(VP8_COMP *cpi, // Estimate of overhead bits per mb // Correction to overhead bits for min allowed Q. + // PGW TODO.. This code is broken for the extended Q range overhead_bits_per_mb = overhead_bits / num_mbs; overhead_bits_per_mb *= pow( 0.98, (double)cpi->twopass.maxq_min_limit ); @@ -1013,7 +1014,8 @@ static int estimate_max_q(VP8_COMP *cpi, // Adjust maxq_min_limit and maxq_max_limit limits based on // averaga q observed in clip for non kf/gf.arf frames // Give average a chance to settle though. - if ( (cpi->ni_frames > + // PGW TODO.. This code is broken for the extended Q range + /*if ( (cpi->ni_frames > ((unsigned int)cpi->twopass.total_stats->count >> 8)) && (cpi->ni_frames > 150) ) { @@ -1021,7 +1023,7 @@ static int estimate_max_q(VP8_COMP *cpi, ? (cpi->ni_av_qi + 32) : cpi->worst_quality; cpi->twopass.maxq_min_limit = ((cpi->ni_av_qi - 32) > cpi->best_quality) ? (cpi->ni_av_qi - 32) : cpi->best_quality; - } + }*/ return Q; } diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index d44b69c9d..89c44269e 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -4645,17 +4645,26 @@ static void encode_frame_to_data_rate vp8_clear_system_state(); //__asm emms; if (cpi->twopass.total_left_stats->coded_error != 0.0) - fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %6d %6d" - "%6d %6d %6d %5d %5d %5d %8d %8.2f %10d %10.3f" + fprintf(f, "%10d %10d %10d %10d %10d %10d %10d" + "%6.2f %6.2f %6.2f %6.2f %6.2f %6.2f" + "%6d %5d %5d %5d %8d %8.2f %10d %10.3f" "%10.3f %8d\n", cpi->common.current_video_frame, cpi->this_frame_target, cpi->projected_frame_size, (cpi->projected_frame_size - cpi->this_frame_target), (int)cpi->total_target_vs_actual, (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), - (int)cpi->total_actual_bits, cm->base_qindex, - cpi->active_best_quality, cpi->active_worst_quality, - cpi->ni_av_qi, cpi->cq_target_quality, + (int)cpi->total_actual_bits, + vp8_convert_qindex_to_q(cm->base_qindex), +#if CONFIG_EXTEND_QRANGE + (double)vp8_dc_quant(cm->base_qindex,0)/4.0, +#else + (double)vp8_dc_quant(cm->base_qindex,0), +#endif + vp8_convert_qindex_to_q(cpi->active_best_quality), + vp8_convert_qindex_to_q(cpi->active_worst_quality), + vp8_convert_qindex_to_q(cpi->ni_av_qi), + vp8_convert_qindex_to_q(cpi->cq_target_quality), cpi->zbin_over_quant, //cpi->avg_frame_qindex, cpi->zbin_over_quant, cm->refresh_golden_frame, cm->refresh_alt_ref_frame, @@ -4667,17 +4676,26 @@ static void encode_frame_to_data_rate cpi->twopass.total_left_stats->coded_error, cpi->tot_recode_hits); else - fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %6d %6d" - "%6d %6d %6d %5d %5d %5d %8d %8.2f %10d %10.3f" + fprintf(f, "%10d %10d %10d %10d %10d %10d %10d" + "%6.2f %6.2f %6.2f %6.2f %6.2f %6.2f" + "%6d %5d %5d %5d %8d %8.2f %10d %10.3f" "%8d\n", cpi->common.current_video_frame, cpi->this_frame_target, cpi->projected_frame_size, (cpi->projected_frame_size - cpi->this_frame_target), (int)cpi->total_target_vs_actual, (cpi->oxcf.starting_buffer_level-cpi->bits_off_target), - (int)cpi->total_actual_bits, cm->base_qindex, - cpi->active_best_quality, cpi->active_worst_quality, - cpi->ni_av_qi, cpi->cq_target_quality, + (int)cpi->total_actual_bits, + vp8_convert_qindex_to_q(cm->base_qindex), +#if CONFIG_EXTEND_QRANGE + (double)vp8_dc_quant(cm->base_qindex,0)/4.0, +#else + (double)vp8_dc_quant(cm->base_qindex,0), +#endif + vp8_convert_qindex_to_q(cpi->active_best_quality), + vp8_convert_qindex_to_q(cpi->active_worst_quality), + vp8_convert_qindex_to_q(cpi->ni_av_qi), + vp8_convert_qindex_to_q(cpi->cq_target_quality), cpi->zbin_over_quant, //cpi->avg_frame_qindex, cpi->zbin_over_quant, cm->refresh_golden_frame, cm->refresh_alt_ref_frame, diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 76eec8a80..a3dab72f6 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -255,8 +255,6 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex) if (q < 8) q = 8; - - #if CONFIG_EXTEND_QRANGE cpi->RDMULT *= 16; #endif |