From: Paul Wilkins Date: Tue, 26 Feb 2013 16:53:03 +0000 (+0000) Subject: Added stricter Q control flag. X-Git-Tag: v1.3.0~1151^2~84^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db6ad0138c811763d1fcf8e4082834dc92fa9071;p=platform%2Fupstream%2Flibvpx.git Added stricter Q control flag. Added a variant of the one shot maxQ flag for two pass that forces a fixed Q for the normal inter frames. Disabled by default. Also small adjustment to the Bits per MB estimation. Change-Id: I87efdfb2d094fe1340ca9ddae37470d7b278c8b8 --- diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index feb1e36..a8a7a4c 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -2751,7 +2751,15 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, cpi->active_best_quality * 15 / 16; } } else { +#ifdef ONE_SHOT_Q_ESTIMATE +#ifdef STRICT_ONE_SHOT_Q + cpi->active_best_quality = Q; +#else cpi->active_best_quality = inter_minq[Q]; +#endif +#else + cpi->active_best_quality = inter_minq[Q]; +#endif // For the constant/constrained quality mode we dont want // q to fall below the cq level. diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index 9b509ea..834ebf9 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -31,6 +31,7 @@ // Experimental rate control switches // #define ONE_SHOT_Q_ESTIMATE 1 +// #define STRICT_ONE_SHOT_Q 1 // #define DISABLE_RC_LONG_TERM_MEM 1 // #define SPEEDSTATS 1 diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index a2a7957..d679aaf 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -120,11 +120,14 @@ int vp9_bits_per_mb(FRAME_TYPE frame_type, int qindex, double q = vp9_convert_qindex_to_q(qindex); if (frame_type == KEY_FRAME) { - enumerator = 4500000; + enumerator = 4000000; } else { - enumerator = 2850000; + enumerator = 2500000; } + // Q based adjustment to baseline enumberator + enumerator += (int)(enumerator * q) >> 12; + return (int)(0.5 + (enumerator * correction_factor / q)); }