mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Attempt to fix differences between x86 FPU and SSE calculations.
The x86 FPU holds intermediate results in larger registers than what the SSE unit uses, resulting in slighlty different encodings of audio data. Attempt to fix this by modifying libFLAC/lpc.c to store calculation results in a FLAC__read before adding it to a sum. At the moment this works, but I could easily imagine a new version of the compiler optimising this store to the FLAC__real away leaving us in the same situation we have now. Patch-from: Oliver Stöneberg on sourceforge.net Closes: https://sourceforge.net/p/flac/bugs/409/
This commit is contained in:
@@ -99,7 +99,7 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le
|
|||||||
* this version tends to run faster because of better data locality
|
* this version tends to run faster because of better data locality
|
||||||
* ('data_len' is usually much larger than 'lag')
|
* ('data_len' is usually much larger than 'lag')
|
||||||
*/
|
*/
|
||||||
FLAC__real d;
|
FLAC__real d, tmp;
|
||||||
unsigned sample, coeff;
|
unsigned sample, coeff;
|
||||||
const unsigned limit = data_len - lag;
|
const unsigned limit = data_len - lag;
|
||||||
|
|
||||||
@@ -110,13 +110,17 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le
|
|||||||
autoc[coeff] = 0.0;
|
autoc[coeff] = 0.0;
|
||||||
for(sample = 0; sample <= limit; sample++) {
|
for(sample = 0; sample <= limit; sample++) {
|
||||||
d = data[sample];
|
d = data[sample];
|
||||||
for(coeff = 0; coeff < lag; coeff++)
|
for(coeff = 0; coeff < lag; coeff++) {
|
||||||
autoc[coeff] += d * data[sample+coeff];
|
tmp = d * data[sample+coeff];
|
||||||
|
autoc[coeff] += tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(; sample < data_len; sample++) {
|
for(; sample < data_len; sample++) {
|
||||||
d = data[sample];
|
d = data[sample];
|
||||||
for(coeff = 0; coeff < data_len - sample; coeff++)
|
for(coeff = 0; coeff < data_len - sample; coeff++) {
|
||||||
autoc[coeff] += d * data[sample+coeff];
|
tmp = d * data[sample+coeff];
|
||||||
|
autoc[coeff] += tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user