[flac-dev] [PATCH] stream_encoder : Improve selection of residual accumulator width

lvqcl lvqcl.mail at gmail.com
Thu Jun 19 04:30:22 PDT 2014

Miroslav Lichvar wrote:

> In the precompute_partition_info_sums_ function, instead of selecting
> 64-bit accumulator when the signal bps is larger than 16, revert to the
> original approach based on partition size, but make room for few extra
> bits to not overflow with unusual signals where the average residual
> magnitude may be larger than bps.
> It slightly improves the performance with standard encoding levels and
> 16-bit files as the 17-bit side channel can still be processed with the
> 32-bit accumulator and correctly selects the 64-bit accumulator with
> very large 16-bit partitions.

BTW, what can you say about the following place in stream_decoder.c
in read_subframe_lpc_() function:

     /*@@@@@@ technically not pessimistic enough, should be more like
     if( (FLAC__uint64)order * ((((FLAC__uint64)1)<<bps)-1) * ((1<<subframe->qlp_coeff_precision)-1) < (((FLAC__uint64)-1) << 32) )
     if(bps + subframe->qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32)

Is it really "not pessimistic enough"? Can it be changed similarly to your patch
for stream_encoder.c?

More information about the flac-dev mailing list