Re: [flac-dev] PATCH for rice_parameter calculation

2013-10-14 Thread Brian Willoughby
D'oh! Now I see the problem. My 'n' would have to be calculated based on log2(), I think, to get the right value. Subtracting as I did will not work. I suppose calling any sort of logarithm calculation might be expensive, but it seems like there has to be a smarter way to determine 'n' On

Re: [flac-dev] PATCH for rice_parameter calculation

2013-10-11 Thread Brian Willoughby
Or, I was originally thinking: rice_parameter = 0; k = partition_samples; if (k < mean) { int n = mean - k; rice_parameter += n; k <<= n; } (sorry for the hasty post) On Oct 11, 2013, at 10:34, Brian Willoughby wrote: > Hmm

Re: [flac-dev] PATCH for rice_parameter calculation

2013-10-11 Thread Brian Willoughby
Hmm, maybe I'm missing something, but what about this: rice_parameter = 0; k = partition_samples; int n = mean - k; if (n > 0) { rice_parameter += n; k <<= n; } I've not looked at this code in its context within stream_encoder.c, s

Re: [flac-dev] PATCH for rice_parameter calculation

2013-10-11 Thread Erik de Castro Lopo
lvqcl wrote: > MSVS profiler shows that the following code in stream_encoder.c takes > several percent of CPU time: This has been applied. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ __

[flac-dev] PATCH for rice_parameter calculation

2013-10-09 Thread lvqcl
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) {