Commit 5ef013f8 authored by lorenm's avatar lorenm

was computing one more autocorrelation coefficient that was actually used


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10613 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent a2c34e40
...@@ -608,13 +608,14 @@ static void compute_autocorr(const int32_t *data, int len, int lag, ...@@ -608,13 +608,14 @@ static void compute_autocorr(const int32_t *data, int len, int lag,
double *autoc) double *autoc)
{ {
int i, j; int i, j;
double tmp[len + lag]; double tmp[len + lag + 1];
double *data1= tmp + lag; double *data1= tmp + lag;
apply_welch_window(data, len, data1); apply_welch_window(data, len, data1);
for(j=0; j<lag; j++) for(j=0; j<lag; j++)
data1[j-lag]= 0.0; data1[j-lag]= 0.0;
data1[len] = 0.0;
for(j=0; j<lag; j+=2){ for(j=0; j<lag; j+=2){
double sum0 = 1.0, sum1 = 1.0; double sum0 = 1.0, sum1 = 1.0;
...@@ -628,8 +629,10 @@ static void compute_autocorr(const int32_t *data, int len, int lag, ...@@ -628,8 +629,10 @@ static void compute_autocorr(const int32_t *data, int len, int lag,
if(j==lag){ if(j==lag){
double sum = 1.0; double sum = 1.0;
for(i=0; i<len; i++) for(i=0; i<len; i+=2){
sum += data1[i] * data1[i-j]; sum += data1[i ] * data1[i-j ]
+ data1[i+1] * data1[i-j+1];
}
autoc[j] = sum; autoc[j] = sum;
} }
} }
...@@ -757,7 +760,7 @@ static int lpc_calc_coefs(const int32_t *samples, int blocksize, int max_order, ...@@ -757,7 +760,7 @@ static int lpc_calc_coefs(const int32_t *samples, int blocksize, int max_order,
assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER); assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER);
if(use_lpc == 1){ if(use_lpc == 1){
compute_autocorr(samples, blocksize, max_order+1, autoc); compute_autocorr(samples, blocksize, max_order, autoc);
compute_lpc_coefs(autoc, max_order, lpc, ref); compute_lpc_coefs(autoc, max_order, lpc, ref);
}else{ }else{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment