MSVS profiler shows that the following code in stream_encoder.c takes several percent of CPU time:
for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k
<<= 1)
;
this code is equivalent to:
rice_parameter = 0; k = partition_samples;
while(k < mean) {
rice_parameter++; k <<= 1;
}
The idea was to accelerate it:
rice_parameter = 0; k = partition_samples;
while(k*2 < mean) {
rice_parameter+=2; k <<= 2;
}
while(k < mean) {
rice_parameter++; k <<= 1;
}
or:
rice_parameter = 0; k = partition_samples;
while(k*4 < mean) {
rice_parameter+=3; k <<= 3;
}
while(k < mean) {
rice_parameter++; k <<= 1;
}
After tuning the code for 16-/24-bit WAV and 32-/64-bit compiles
I wrote more complex code (see attach). It doesn't look pretty but
it's faster than the current version. For highest compression preset,
24-bit input and 32-bit exe the encoding speed increases by 6..7%.
rice_parameter.patch
Description: Binary data
_______________________________________________ flac-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/flac-dev
