Mercurial > libavcodec.hg
comparison flacenc.c @ 5743:8ce32ae71c01 libavcodec
div -> mul
author | lorenm |
---|---|
date | Mon, 01 Oct 2007 05:56:30 +0000 |
parents | f8029206caa2 |
children | 66317285d195 |
comparison
equal
deleted
inserted
replaced
5742:f8029206caa2 | 5743:8ce32ae71c01 |
---|---|
768 s->dsp.flac_compute_autocorr(samples, blocksize, max_order, autoc); | 768 s->dsp.flac_compute_autocorr(samples, blocksize, max_order, autoc); |
769 | 769 |
770 compute_lpc_coefs(autoc, max_order, lpc, ref); | 770 compute_lpc_coefs(autoc, max_order, lpc, ref); |
771 }else{ | 771 }else{ |
772 LLSModel m[2]; | 772 LLSModel m[2]; |
773 double var[MAX_LPC_ORDER+1], eval, weight; | 773 double var[MAX_LPC_ORDER+1], weight; |
774 | 774 |
775 for(pass=0; pass<use_lpc-1; pass++){ | 775 for(pass=0; pass<use_lpc-1; pass++){ |
776 av_init_lls(&m[pass&1], max_order); | 776 av_init_lls(&m[pass&1], max_order); |
777 | 777 |
778 weight=0; | 778 weight=0; |
779 for(i=max_order; i<blocksize; i++){ | 779 for(i=max_order; i<blocksize; i++){ |
780 for(j=0; j<=max_order; j++) | 780 for(j=0; j<=max_order; j++) |
781 var[j]= samples[i-j]; | 781 var[j]= samples[i-j]; |
782 | 782 |
783 if(pass){ | 783 if(pass){ |
784 double eval, inv, rinv; | |
784 eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1); | 785 eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1); |
785 eval= (512>>pass) + fabs(eval - var[0]); | 786 eval= (512>>pass) + fabs(eval - var[0]); |
787 inv = 1/eval; | |
788 rinv = sqrt(inv); | |
786 for(j=0; j<=max_order; j++) | 789 for(j=0; j<=max_order; j++) |
787 var[j]/= sqrt(eval); | 790 var[j] *= rinv; |
788 weight += 1/eval; | 791 weight += inv; |
789 }else | 792 }else |
790 weight++; | 793 weight++; |
791 | 794 |
792 av_update_lls(&m[pass&1], var, 1.0); | 795 av_update_lls(&m[pass&1], var, 1.0); |
793 } | 796 } |