[FFmpeg-devel] Review request - ra288.{c,h} ra144.{c,h}
Vitor Sessak
vitor1001
Tue Aug 5 18:55:45 CEST 2008
M?ns Rullg?rd wrote:
> Diego Biurrun <diego at biurrun.de> writes:
>
>> On Tue, Aug 05, 2008 at 06:24:32AM +0200, Vitor Sessak wrote:
>>> Michael Niedermayer wrote:
>>>> On Tue, Jul 29, 2008 at 08:20:45PM +0200, Vitor Sessak wrote:
>>>>> /**
>>>>> * Converts autocorrelation coefficients to LPC coefficients using the
>>>>> * Levinson-Durbin algorithm. See blocks 37 and 50 of the G.728 specification.
>>>>> *
>>>>> * @return 0 if success, -1 if fail
>>>>> */
>>>>> static int eval_lpc_coeffs(const float *in, float *tgt, int n)
>>>>> {
>>>>> int i, j;
>>>>> double f0, f1, f2;
>>>>>
>>>>> if (in[n] == 0)
>>>>> return -1;
>>>>>
>>>>> if ((f0 = *in) <= 0)
>>>>> return -1;
>>>>>
>>>>> in--; // To avoid a -1 subtraction in the inner loop
>>>>>
>>>>> for (i=1; i <= n; i++) {
>>>>> f1 = in[i+1];
>>>>>
>>>>> for (j=0; j < i - 1; j++)
>>>>> f1 += in[i-j]*tgt[j];
>>>>>
>>>>> tgt[i-1] = f2 = -f1/f0;
>>>>> for (j=0; j < i >> 1; j++) {
>>>>> float temp = tgt[j] + tgt[i-j-2]*f2;
>>>>> tgt[i-j-2] += tgt[j]*f2;
>>>>> tgt[j] = temp;
>>>>> }
>>>>> if ((f0 += f1*f2) < 0)
>>>>> return -1;
>>>>> }
>>>>>
>>>>> return 0;
>>>>> }
>>>> duplicate of compute_lpc_coefs() ?
>>> Yes, the two functions are practically identical, but
>>> compute_lpc_coefs() use doubles and ra288 uses floats.
>> Would it be a problem for ra288 to use doubles?
>
> Doubles are *really* slow on ARM Cortex-A8, so avoiding them is good.
Not only on ARM, but I imagine it will be slower in practically all
archs due to worse cache usage.
-Vitor
More information about the ffmpeg-devel
mailing list