summaryrefslogtreecommitdiff
path: root/vp8/encoder/onyx_if.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-01-13 11:35:00 -0500
committerJohn Koleszar <jkoleszar@google.com>2011-01-13 11:35:00 -0500
commit9b9ecb38de0ce0a4b81506799217619d166c61b1 (patch)
tree622fab22ba5c6fcac80f89532083fb0b898e670e /vp8/encoder/onyx_if.c
parent05be0987486d02f9b104270896ea77b60849c3e0 (diff)
parentb082790c7d1e16dde329f1baea153c0fe86112d5 (diff)
downloadlibvpx-9b9ecb38de0ce0a4b81506799217619d166c61b1.tar
libvpx-9b9ecb38de0ce0a4b81506799217619d166c61b1.tar.gz
libvpx-9b9ecb38de0ce0a4b81506799217619d166c61b1.tar.bz2
libvpx-9b9ecb38de0ce0a4b81506799217619d166c61b1.zip
Merge remote branch 'internal/upstream' into HEAD
Diffstat (limited to 'vp8/encoder/onyx_if.c')
-rw-r--r--vp8/encoder/onyx_if.c68
1 files changed, 37 insertions, 31 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 0fca39037..decb017df 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3793,49 +3793,56 @@ static void encode_frame_to_data_rate
}
// Set an active best quality and if necessary active worst quality
- if (cpi->pass == 2 || (cm->current_video_frame > 150))
+ // There is some odd behaviour for one pass here that needs attention.
+ if ( (cpi->pass == 2) || (cpi->ni_frames > 150))
{
- int Q;
- //int tmp;
-
vp8_clear_system_state();
Q = cpi->active_worst_quality;
- if ((cm->frame_type == KEY_FRAME) || cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame)
+ if ( cm->frame_type == KEY_FRAME )
{
- if (cm->frame_type != KEY_FRAME)
+ // Special case for key frames forced because we have reached
+ // the maximum key frame interval. Here force the Q to a range
+ // close to but just below the ambient Q to minimize the risk
+ // of popping
+ if ( cpi->this_key_frame_forced )
{
- if (cpi->avg_frame_qindex < cpi->active_worst_quality)
- Q = cpi->avg_frame_qindex;
+ cpi->active_worst_quality = cpi->avg_frame_qindex * 7/8;
+ cpi->active_best_quality = cpi->avg_frame_qindex * 2/3;
+ }
+ else
+ {
+ if ( cpi->pass == 2 )
+ {
+ if (cpi->gfu_boost > 600)
+ cpi->active_best_quality = kf_low_motion_minq[Q];
+ else
+ cpi->active_best_quality = kf_high_motion_minq[Q];
+ }
+ // One pass more conservative
+ else
+ cpi->active_best_quality = kf_high_motion_minq[Q];
+ }
+ }
- if ( cpi->gfu_boost > 1000 )
+ else if (cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame)
+ {
+ if (cpi->avg_frame_qindex < cpi->active_worst_quality)
+ Q = cpi->avg_frame_qindex;
+
+ if ( cpi->pass == 2 )
+ {
+ if ( cpi->gfu_boost > 1000 )
cpi->active_best_quality = gf_low_motion_minq[Q];
else if ( cpi->gfu_boost < 400 )
cpi->active_best_quality = gf_high_motion_minq[Q];
else
cpi->active_best_quality = gf_mid_motion_minq[Q];
- }
- // KEY FRAMES
- else
- {
- // Special case for key frames forced because we have reached
- // the maximum key frame interval. Here force the Q to a range
- // close to but just below the ambient Q to reduce the risk
- // of popping
- if ( cpi->this_key_frame_forced )
- {
- cpi->active_worst_quality = cpi->avg_frame_qindex * 7/8;
- cpi->active_best_quality = cpi->avg_frame_qindex * 2/3;
- }
- else
- {
- if (cpi->gfu_boost > 600)
- cpi->active_best_quality = kf_low_motion_minq[Q];
- else
- cpi->active_best_quality = kf_high_motion_minq[Q];
- }
- }
+ }
+ // One pass more conservative
+ else
+ cpi->active_best_quality = gf_high_motion_minq[Q];
}
else
{
@@ -3865,7 +3872,6 @@ static void encode_frame_to_data_rate
cpi->active_best_quality -= min_qadjustment;
}
-
}
}