summaryrefslogtreecommitdiff
path: root/vp8/encoder/onyx_if.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-01-11 00:05:23 -0500
committerJohn Koleszar <jkoleszar@google.com>2011-01-11 00:05:27 -0500
commit4a3f592109477df381d1d9307fa4cbe747000b8c (patch)
tree32b6c966cb15cce5ee36ab6ba00603babd94f9af /vp8/encoder/onyx_if.c
parent3cb26b486490b4961fd5c7d897112b12a121a3e7 (diff)
parent3675b2291cac15e6bc5a9bde9a0da7e00f919aaa (diff)
downloadlibvpx-4a3f592109477df381d1d9307fa4cbe747000b8c.tar
libvpx-4a3f592109477df381d1d9307fa4cbe747000b8c.tar.gz
libvpx-4a3f592109477df381d1d9307fa4cbe747000b8c.tar.bz2
libvpx-4a3f592109477df381d1d9307fa4cbe747000b8c.zip
Merge remote branch 'origin/master' into experimental
Change-Id: I0ecbf2f417540d75435542182a661f5f6bb84ac0
Diffstat (limited to 'vp8/encoder/onyx_if.c')
-rw-r--r--vp8/encoder/onyx_if.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index ee461c610..2d9e8011b 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4442,30 +4442,38 @@ static void encode_frame_to_data_rate
{
cpi->ni_frames++;
- // Calculate the average Q for normal inter frames (not key or GFU frames)
- // This is used as a basis for setting active worst quality.
- if (cpi->ni_frames > 150)
+ // Calculate the average Q for normal inter frames (not key or GFU
+ // frames).
+ if ( cpi->pass == 2 )
{
cpi->ni_tot_qi += Q;
cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
}
- // Early in the clip ... average the current frame Q value with the default
- // entered by the user as a dampening measure
else
{
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = ((cpi->ni_tot_qi / cpi->ni_frames) + cpi->worst_quality + 1) / 2;
- }
-
- // If the average Q is higher than what was used in the last frame
- // (after going through the recode loop to keep the frame size within range)
- // then use the last frame value - 1.
- // The -1 is designed to stop Q and hence the data rate, from progressively
- // falling away during difficult sections, but at the same time reduce the number of
- // itterations around the recode loop.
- if (Q > cpi->ni_av_qi)
- cpi->ni_av_qi = Q - 1;
+ // Damp value for first few frames
+ if (cpi->ni_frames > 150 )
+ {
+ cpi->ni_tot_qi += Q;
+ cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
+ }
+ // For one pass, early in the clip ... average the current frame Q
+ // value with the worstq entered by the user as a dampening measure
+ else
+ {
+ cpi->ni_tot_qi += Q;
+ cpi->ni_av_qi = ((cpi->ni_tot_qi / cpi->ni_frames) + cpi->worst_quality + 1) / 2;
+ }
+ // If the average Q is higher than what was used in the last frame
+ // (after going through the recode loop to keep the frame size within range)
+ // then use the last frame value - 1.
+ // The -1 is designed to stop Q and hence the data rate, from progressively
+ // falling away during difficult sections, but at the same time reduce the number of
+ // itterations around the recode loop.
+ if (Q > cpi->ni_av_qi)
+ cpi->ni_av_qi = Q - 1;
+ }
}
#if 0
@@ -4559,7 +4567,7 @@ static void encode_frame_to_data_rate
if (cpi->total_coded_error_left != 0.0)
fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %6ld %6ld"
- "%6ld %6ld %5ld %5ld %5ld %8ld %8.2f %10d %10.3f"
+ "%6ld %6ld %6ld %5ld %5ld %5ld %8ld %8.2f %10d %10.3f"
"%10.3f %8ld\n",
cpi->common.current_video_frame, cpi->this_frame_target,
cpi->projected_frame_size,
@@ -4568,7 +4576,7 @@ static void encode_frame_to_data_rate
(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->cq_target_quality, cpi->zbin_over_quant,
+ cpi->ni_av_qi, 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,
cm->frame_type, cpi->gfu_boost,
@@ -4578,7 +4586,7 @@ static void encode_frame_to_data_rate
cpi->tot_recode_hits);
else
fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %6ld %6ld"
- "%6ld %6ld %5ld %5ld %5ld %8ld %8.2f %10d %10.3f"
+ "%6ld %6ld %6ld %5ld %5ld %5ld %8ld %8.2f %10d %10.3f"
"%8ld\n",
cpi->common.current_video_frame,
cpi->this_frame_target, cpi->projected_frame_size,
@@ -4587,7 +4595,7 @@ static void encode_frame_to_data_rate
(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->cq_target_quality, cpi->zbin_over_quant,
+ cpi->ni_av_qi, 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,
cm->frame_type, cpi->gfu_boost,