[flac-dev] stream_encoder: 32 vs 64 bit accumulator

Miroslav Lichvar mlichvar at redhat.com
Fri Jun 20 08:02:31 PDT 2014


On Thu, Jun 19, 2014 at 09:22:46PM +0400, lvqcl wrote:
> Another interesting comment is inside src/libFLAC/include/private/fixed.h:
> 
> "The _wide() version uses 64-bit integers which is statistically necessary
> when bits-per-sample + log2(blocksize) > 30"
> 
> I mean the word "statistically".

I think it means "in most cases". It's possible that the total_error
variables used in the function overflow (and the returned order may
not be the best one), but it shouldn't happen very often.

> libFLAC uses FLAC__fixed_compute_best_predictor_wide()
> if "bits_per_sample + FLAC__bitmath_ilog2(blocksize)+1 > 30" is true
> (see encoder->private_->use_wide_by_block  variable in stream_encoder.c)

-- 
Miroslav Lichvar


More information about the flac-dev mailing list