--- Chris Csanady <[EMAIL PROTECTED]> wrote:
> Well, hopefully this isn't too late to be included in the next
> release.
> In any case, I have been
> sitting on it for far too long, so here it is.
[...]
wow, this looks really promising. unfortunately it's a little
too late for this release (being packaged up now, set for
saturday). changes to the encoder require a lot of scrutiny,
but I'll take a look ASAP.
> I'm not entirely certain about the "bitness" of the wider lpc
> functions, though the tests do complete.
> Perhaps someone could shed some light on how much precision is
> expected
> of them, and when
> the 64 bit functions are used instead.
yeah, it's tricky.
in FLAC__lpc_restore_signal*, the danger of overflow comes from
the convolution of the filter kernel with the audio. basically
a prediction of each sample is computed via the dot product of
the qlp_coeff vector and a slice of previously seen data:
sum = 0;
history = data;
for(j = 0; j < order; j++)
sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
so to be safe the width of 'sum' in bits W(sum) must be:
W(sum) >= W(qlp_coeff) + W(data) + ceil(log2(order))
W(qlp_coeff) comes from the subframe header, W(data) comes
from the frame header, and order comes from the subframe
header. W(sum) sometimes has to be larger that W(data)
because the dot product can get larger before it is shifted
back down in the next line:
*(data++) = *(residual++) + (FLAC__int32)(sum >> lp_quantization);
you can see the selection logic at the end of
stream_decoder.c:read_subframe_lpc_()
the same is true in FLAC__lpc_compute_residual_from_qlp_coefficients*
Josh
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
_______________________________________________
Flac-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/flac-dev