[FFmpeg-devel] [PATCH] QCELP decoder
Kenan Gillet
kenan.gillet
Wed Nov 12 22:39:58 CET 2008
On Nov 11, 2008, at 10:08 AM, Michael Niedermayer wrote:
> On Sun, Nov 09, 2008 at 09:49:20PM -0800, Kenan Gillet wrote:
>> Hi,
>> On Nov 8, 2008, at 3:57 PM, Michael Niedermayer wrote:
> [...]
>
>> Index: libavcodec/qcelp_lsp.c
>> ===================================================================
>> --- libavcodec/qcelp_lsp.c (revision 0)
>> +++ libavcodec/qcelp_lsp.c (revision 0)
> [...]
>
>> +#include <string.h>
>> +
>> +#include "dsputil.h"
>
> why?
removed
it was a remaining part from the split of qcelpdec.c
>
>
>
>> +#include "libavutil/common.h"
>> +
>> +/**
>> + * Computes the Pa or Qa 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 v_in input vector, also used as a buffer
>> + * @param v_poly polynomial output as a vector
>> + *
>> + * TIA/EIA/IS-733 2.4.3.3.5-1/2
>> + */
>> +static void lsp2poly(const float *lspf,
>> + float *v_in,
>> + float *v_poly) {
>> + float *v1, *v2;
>> + float val;
>> + int len, i;
>> +
>> + for (i = 0; i < 10; i += 2) {
>> + v1 = v_poly + 1;
>> + v2 = v_in;
>> + val = -2 * cos(M_PI * *lspf);
>> + lspf += 2;
>> + len = FFMIN(4, i);
>> +
>
>> + *v1++ = v2[1] + *v2 * val;
>> + for (; len > 0; len--) {
>> + *v1++ = v2[2]
>> + + v2[1] * val
>> + + v2[0];
>
> *v2 and v2[0] are mixed and i think v2[0] is clearer in this context.
> also v1/v2 are redundant with v_poly/v_in and it should be possible to
> do this cleaner with 1 array instead of swaping 2 around, that is
> multiply the factors inplace into a polynom
done, much cleaner and faster :)
More information about the ffmpeg-devel
mailing list