ref: cf3d2c8d5a8438fd63ed739f11f1116e0f21d3a0
parent: b49e9fb433620dff5b3f7045901d2c874cd647da
author: Deb Mukherjee <[email protected]>
date: Fri Jan 3 10:41:57 EST 2014
Corerctly sets frame type in the 2 pass case This patch sets frame types correctly in the new vp9_get_second_pass_params() function called prior to encode_frame_to_data_rate() function, so that the latter function can just work with what is passed to it. This will allow multiple vp9_get_second_pass_params() to be created for various encode strategies without messing with the core encode function. There is no difference in derf and yt. stdhd/hd are pending. Change-Id: I70dfb97e9f497e9cee04052e0e8e0c2892eab0c3
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2114,6 +2114,8 @@
// Define next KF group and assign bits to it
this_frame_copy = this_frame;
find_next_key_frame(cpi, &this_frame_copy);
+ } else {
+ cpi->common.frame_type = INTER_FRAME;
}
// Is this a GF / ARF (Note that a KF is always also a GF)
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2913,19 +2913,6 @@
// Current default encoder behavior for the altref sign bias.
cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = cpi->rc.source_alt_ref_active;
- // Check to see if a key frame is signaled.
- // For two pass with auto key frame enabled cm->frame_type may already be
- // set, but not for one pass.
- if ((cm->current_video_frame == 0) ||
- (cm->frame_flags & FRAMEFLAGS_KEY) ||
- (cpi->oxcf.auto_key && (cpi->rc.frames_since_key %
- cpi->key_frame_frequency == 0))) {
- // Set frame type to key frame for the force key frame, if we exceed the
- // maximum distance in an automatic keyframe selection or for the first
- // frame.
- cm->frame_type = KEY_FRAME;
- }
-
// Set default state for segment based loop filter update flags.
cm->lf.mode_ref_delta_update = 0;
@@ -3165,7 +3152,6 @@
#endif
// As this frame is a key frame the next defaults to an inter frame.
- cm->frame_type = INTER_FRAME;
vp9_clear_system_state();
cpi->rc.frames_since_key = 0;
} else {
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -750,7 +750,6 @@
// Limit Q range for the adaptive loop.
if (cm->frame_type == KEY_FRAME && !cpi->rc.this_key_frame_forced) {
if (!(cpi->pass == 0 && cpi->common.current_video_frame == 0)) {
- *top_index = active_worst_quality;
*top_index =
(active_worst_quality + active_best_quality * 3) / 4;
}
@@ -790,6 +789,12 @@
printf("frame:%d q:%d\n", cm->current_video_frame, q);
}
#endif
+ assert(*top_index <= cpi->rc.worst_quality &&
+ *top_index >= cpi->rc.best_quality);
+ assert(*bottom_index <= cpi->rc.worst_quality &&
+ *bottom_index >= cpi->rc.best_quality);
+ assert(q <= cpi->rc.worst_quality &&
+ q >= cpi->rc.best_quality);
return q;
}