[FFmpeg-devel] [PATCH] QCELP decoder

Kenan Gillet kenan.gillet
Tue Dec 2 00:00:49 CET 2008


On Dec 1, 2008, at 2:05 PM, Michael Niedermayer wrote:

> On Mon, Dec 01, 2008 at 12:45:09PM -0800, Kenan Gillet wrote:
>> Hi,
>> On Mon, Dec 1, 2008 at 8:24 AM, Michael Niedermayer  
>> <michaelni at gmx.at> wrote:
>>> On Mon, Dec 01, 2008 at 08:17:52AM -0800, Kenan Gillet wrote:
>>>>
>>>> On Dec 1, 2008, at 4:52 AM, Michael Niedermayer wrote:
>>>>
>>>>> On Sun, Nov 30, 2008 at 05:04:07PM -0800, Kenan Gillet wrote:
>>>>>> Hi,
>>>>>> On Nov 30, 2008, at 7:50 AM, Michael Niedermayer wrote:
>>>>>>
>>>>>>> On Sat, Nov 29, 2008 at 10:39:58AM -0800, Kenan Gillet wrote:
>>> [...]
>>>>> [...]
>>>>>>>> +    /**
>>>>>>>> +     * reserved bits on all bitrate but bitrate 1/2 packets
>>>>>>>
>>>>>>> this is unclear, field that is on all but ... , vs. field that
>>>>>>> exists always but
>>>>>>> is reserved on all but .....
>>>>>>>
>>>>>>
>>>>>> is "reserved bits only set for bitrate 1, 1/4 and 1/8" better ?
>>>>>
>>>>> no, because setting them means error IIRC
>>>>> also IIRC there is no indication of the existence of other fields
>>>>> for the
>>>>> other rates ...
>>>>>
>>>>
>>>> reserved bits only present in bitrate 1, 1/4 and 1/8 packets
>>>>
>>>> ?
>>>
>>> ok
>>>
>>> [...]
>>
>> here is an updated round 14 of the patches,
>> which is getting smaller and smaller :)
>>
>> Kenan
>
> [...]
>
>> +/**
>> + * initial coefficient to perform bandwidth expansion on LPC
>> + *
>> + * TIA/EIA/IS-733 2.4.3.3.6 6
>> + */
>
>> +#define QCELP_BANDWITH_EXPANSION_COEFF 0.9883
>
> i suspect that is supposed to be an approximation of 253/256

probably but in specs and reference code it is 0.9883 not 0.98828125.
do you want to replace 0.9883 by 253/256 ?


>
>> +
>> +/**
>> + * Computes the Pa / (1 + z(-1)) or Qa / (1 - z(-1)) coefficients
>> + * needed for LSP to LPC conversion.
>> + * We only need to calculate the 6 first elements of the polynomial.
>> + *
>> + * @param lspf line spectral pair frequencies
>> + * @param f [out] polynomial input/output as a vector
>> + *
>> + * TIA/EIA/IS-733 2.4.3.3.5-1/2
>> + */
>> +static void lsp2polyf(const float *lspf, double *f, int  
>> lp_half_order)
>> +{
>> +    int i, j;
>> +
>> +    f[0] = 1.0;
>> +    f[1] = -2 * cos(M_PI * lspf[0]);
>> +    lspf -= 2;
>> +    for(i=2; i<=lp_half_order; i++)
>> +    {
>> +        double val = -2 * cos(M_PI * lspf[2*i]);
>> +        f[i] = val * f[i-1] + 2*f[i-2];
>> +        for(j=i-1; j>1; j--)
>
>> +            f[j] = f[j] + f[j-1] * val + f[j-2];
>
> f[j] += f[j-1] * val + f[j-2];

done


>
>> +        f[1] += val;
>> +    }
>> +}
>> +
>> +/**
>> + * Reconstructs LPC coefficients from the line spectral pair  
>> frequencies
>> + * and performs bandwidth expansion.
>> + *
>> + * @param lspf line spectral pair frequencies
>> + * @param lpc linear predictive coding coefficients
>> + *
>> + * @note: bandwith_expansion_coeff could be precalculated into a  
>> table
>> + *        but it seems to be slower on x86
>> + *
>> + * TIA/EIA/IS-733 2.4.3.3.5
>> + */
>
>> +void qcelp_lspf2lpc(const float *lspf, float *lpc)
>
> missing ff_ prefix againt name clashes

done

also I am interested to know if u had any comments on the benchmarks [1]
between old double vs old float
and new double vs new float

[1] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-December/056795.html





More information about the ffmpeg-devel mailing list