[x264-devel] [PATCH] 2-pass ratecontrol
Loren Merritt
lorenm at u.washington.edu
Sun Aug 29 05:29:07 CEST 2004
Use average qp instead of last qp in the frame for 2pass rc.
(Improves quality and rate accuracy if the first pass was cbr.)
--Loren Merritt
-------------- next part --------------
Index: encoder/ratecontrol.c
===================================================================
--- encoder/ratecontrol.c (revision 44)
+++ encoder/ratecontrol.c (working copy)
@@ -6,7 +6,7 @@
*
* Authors: M?ns Rullg?rd <mru at mru.ath.cx>
* 2 pass code: Michael Niedermayer <michaelni at gmx.at>
- * Loren Merritt
+ * Loren Merritt <lorenm at u.washington.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -101,7 +101,7 @@
double last_qscale;
double last_qscale_for[5]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */
int last_non_b_pict_type;
- double lmin[5]; /* min qscale by frame type */
+ double lmin[5]; /* min qscale by frame type */
double lmax[5];
double i_cplx_sum[5]; /* estimated total texture bits in intra MBs at qscale=1 */
double p_cplx_sum[5];
@@ -115,7 +115,7 @@
/* Terminology:
* qp = h.264's quantizer
- * qscale = an arbitrary linear scale, mappable to qp
+ * qscale = linearized quantizer = Lagrange multiplier
*/
static inline double qp2qscale(double qp)
{
@@ -551,7 +551,7 @@
fprintf( rc->p_stat_file_out,
"in:%d out:%d type:%d q:%.3f itex:%d ptex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d;\n",
h->fenc->i_frame, h->i_frame-1,
- rc->slice_type, (float)rc->qpm,
+ rc->slice_type, (float)rc->qpa,
h->stat.frame.i_itex_bits, h->stat.frame.i_ptex_bits,
h->stat.frame.i_hdr_bits, h->stat.frame.i_misc_bits,
h->stat.frame.i_mb_count[I_4x4] + h->stat.frame.i_mb_count[I_16x16],
@@ -613,8 +613,6 @@
x264_cpu_restore( h->param.cpu );
- //avg_cplx = (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / rcc->frame_count[pict_type];
-
double const_values[]={
rce->i_tex_bits * rce->qscale,
rce->p_tex_bits * rce->qscale,
More information about the x264-devel
mailing list