changeset 5743:8ce32ae71c01 libavcodec

div -> mul
author lorenm
date Mon, 01 Oct 2007 05:56:30 +0000
parents f8029206caa2
children 88dc8b291b54
files flacenc.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flacenc.c	Sun Sep 30 03:36:13 2007 +0000
+++ b/flacenc.c	Mon Oct 01 05:56:30 2007 +0000
@@ -770,7 +770,7 @@
         compute_lpc_coefs(autoc, max_order, lpc, ref);
     }else{
         LLSModel m[2];
-        double var[MAX_LPC_ORDER+1], eval, weight;
+        double var[MAX_LPC_ORDER+1], weight;
 
         for(pass=0; pass<use_lpc-1; pass++){
             av_init_lls(&m[pass&1], max_order);
@@ -781,11 +781,14 @@
                     var[j]= samples[i-j];
 
                 if(pass){
+                    double eval, inv, rinv;
                     eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1);
                     eval= (512>>pass) + fabs(eval - var[0]);
+                    inv = 1/eval;
+                    rinv = sqrt(inv);
                     for(j=0; j<=max_order; j++)
-                        var[j]/= sqrt(eval);
-                    weight += 1/eval;
+                        var[j] *= rinv;
+                    weight += inv;
                 }else
                     weight++;