# [FFmpeg-devel] [PATCH] ALS decoder

Justin Ruggles justin.ruggles
Sun Aug 23 00:29:52 CEST 2009

```Thilo Borgmann wrote:

>>> +    int rlslms;               ///< use RLS-LMS predictor: 1 = on, 0 = off
>> RLSMLS?
>> no i did not read the spec ...
> It is correct as it is.

I think he means, what is rlslms?

So your comment should say Recursive Least Square-Least Mean Square

>>> +/** Converts PARCOR coefficient k to direct filter coefficient.
>>> + */
>>> +static void parcor_to_lpc(unsigned int k, int64_t *par, int64_t *cof)
>>> +{
>>> +    int i;
>>> +    int64_t tmp1, tmp2;
>>> +
>>> +    for (i = 0; i < (k+1) >> 1; i++) {
>>> +        tmp1 = cof[    i    ] + ((par[k] * cof[k - i - 1] + (1 << 19)) >> 20);
>>> +        tmp2 = cof[k - i - 1] + ((par[k] * cof[    i    ] + (1 << 19)) >> 20);
>>> +        cof[k - i - 1] = tmp2;
>>> +        cof[    i    ] = tmp1;
>>> +    }
>>> +
>>> +    cof[k] = par[k];
>>> +}
>> doesnt look entirely unfamiliar, dont some of our other audio codecs have
>> something that can be used? (no i dont know which, i would have to RTFS too)
> RTFS for me too and RTFM about other audio codecs... anyone?

The only thing I could find is a function in ra144.c that converts
reflection coefficients to lpc coefficients, but it seems to be very
codec-specific.  This function is also very codec-specific because the
ALS spec defines a bit-exact transformation between the 20-bit quantized
PARCOR and LPC coefficients.  This is required in order for it to be
lossless.

>>> +
>>> +    if (const_block) {
>>> +        unsigned int const_val_bits;
>>> +
>>> +        if (sconf->resolution == 2 || sconf->floating)
>>> +            const_val_bits = 24;
>>> +        else
>>> +            const_val_bits = avctx->bits_per_raw_sample;
>> why would const_val_bits != avctx->bits_per_raw_sample ?
> bits_per_raw_sample = 32 for floating sconf->floating.

To explain this further... The way floating-point in ALS works is that
it has a 24-bit integer part and a floating-point difference part.  So
the final output is 32-bit, even though the integer part decoded here is
only 24-bit.

-Justin

```