[x264-devel] commit: Use a gaussian window for cplxblur (Jason Garrett-Glaser )

git version control git at videolan.org
Thu Jun 5 05:30:49 CEST 2008


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Wed Jun  4 21:28:48 2008 -0600| [c98aab086a2d8f99c53b501ec165c2a804d49725]

Use a gaussian window for cplxblur
Cplxblur was originally intended to use a gaussian window, but in its current form did not.  This change provides a tiny improvement to 2pass ratecontrol.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=c98aab086a2d8f99c53b501ec165c2a804d49725
---

 encoder/ratecontrol.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index e071726..a049f74 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -1801,15 +1801,17 @@ static int init_pass2( x264_t *h )
             weight *= 1 - pow( (float)rcj->i_count / rcc->nmb, 2 );
             if(weight < .0001)
                 break;
-            weight_sum += weight;
-            cplx_sum += weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
+            double gaussian_weight = weight * exp(-j*j/200.0);
+            weight_sum += gaussian_weight;
+            cplx_sum += gaussian_weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
         }
         /* weighted average of cplx of past frames */
         weight = 1.0;
         for(j=0; j<=cplxblur*2 && j<=i; j++){
             ratecontrol_entry_t *rcj = &rcc->entry[i-j];
-            weight_sum += weight;
-            cplx_sum += weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
+            double gaussian_weight = weight * exp(-j*j/200.0);
+            weight_sum += gaussian_weight;
+            cplx_sum += gaussian_weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
             weight *= 1 - pow( (float)rcj->i_count / rcc->nmb, 2 );
             if(weight < .0001)
                 break;



More information about the x264-devel mailing list