[FFmpeg-devel] [PATCH] do not hardcode filter order in ff_acelp_lspd2lpc()
Michael Niedermayer
michaelni
Fri Nov 6 14:50:38 CET 2009
On Thu, Nov 05, 2009 at 05:36:36AM +0100, Vitor Sessak wrote:
> Reynaldo H. Verdejo Pinochet wrote:
>> Hello Vitor
>> Vitor Sessak wrote:
>>> $subj. It is useful for SIPR but also it makes sense to make shared
>>> functions as general as possible.
>> QCELP part is ok but I'd make lp_half_order
>> a single-byte sized type.
>
> Fine for me (I suppose comparing uint8_t with int is not slower in any arch
> we support). New version attached.
>
> -Vitor
> lsp.c | 12 ++++++------
> lsp.h | 2 +-
> qcelpdec.c | 2 +-
> 3 files changed, 8 insertions(+), 8 deletions(-)
> 4c16615dbbd30c5ab006c8da8b879ea577097b39 lspd2lpc_2.diff
> Index: libavcodec/lsp.c
> ===================================================================
> --- libavcodec/lsp.c (revision 20450)
> +++ libavcodec/lsp.c (working copy)
> @@ -155,20 +155,20 @@
> }
> }
>
> -void ff_acelp_lspd2lpc(const double *lsp, float *lpc)
> +void ff_acelp_lspd2lpc(const double *lsp, float *lpc, uint8_t lp_half_order)
> {
> - double pa[6], qa[6];
> + double pa[lp_half_order+1], qa[lp_half_order+1];
> int i;
>
> - lsp2polyf(lsp, pa, 5);
> - lsp2polyf(lsp + 1, qa, 5);
> + lsp2polyf(lsp, pa, lp_half_order);
> + lsp2polyf(lsp + 1, qa, lp_half_order);
>
> - for (i=4; i>=0; i--)
> + for (i=lp_half_order-1; i>=0; i--)
> {
> double paf = pa[i+1] + pa[i];
> double qaf = qa[i+1] - qa[i];
>
> lpc[i ] = 0.5*(paf+qaf);
> - lpc[9-i] = 0.5*(paf-qaf);
> + lpc[(lp_half_order << 1) - 1 -i] = 0.5*(paf-qaf);
> }
i would
lpc2= lpc + (lp_half_order << 1) - 1;
and
lpc2[-i] = ...
that way lp_half_order and i also become redundant and one can be droped
about int8 vs. int, its possible that using int8 as index into an array
like lpc[int8_variable] could be slower in some archs (x86 being one)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091106/adcb0cc2/attachment.pgp>
More information about the ffmpeg-devel
mailing list