[xiph-commits] r12181 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Fri Dec 8 06:57:24 PST 2006
Author: jm
Date: 2006-12-08 06:57:20 -0800 (Fri, 08 Dec 2006)
New Revision: 12181
Modified:
trunk/speex/libspeex/filters.c
trunk/speex/libspeex/filters.h
trunk/speex/libspeex/filters_arm4.h
trunk/speex/libspeex/filters_bfin.h
trunk/speex/libspeex/filters_sse.h
Log:
Removed implementation of all the 32-bit filters now that everything is
computed with 16-bit filters.
Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c 2006-12-08 14:43:09 UTC (rev 12180)
+++ trunk/speex/libspeex/filters.c 2006-12-08 14:57:20 UTC (rev 12181)
@@ -297,53 +297,6 @@
-#ifndef OVERRIDE_FILTER_MEM2
-#ifdef PRECISION16
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_word16_t xi,yi,nyi;
-
- for (i=0;i<N;i++)
- {
- xi= EXTRACT16(PSHR32(SATURATE(x[i],536870911),SIG_SHIFT));
- yi = EXTRACT16(PSHR32(SATURATE(ADD32(x[i], SHL32(mem[0],1)),536870911),SIG_SHIFT));
- nyi = NEG16(yi);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_16(MAC16_16(mem[j+1], num[j],xi), den[j],nyi);
- }
- mem[ord-1] = ADD32(MULT16_16(num[ord-1],xi), MULT16_16(den[ord-1],nyi));
- y[i] = SHL32(EXTEND32(yi),SIG_SHIFT);
- }
-}
-#else
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_sig_t xi,yi,nyi;
-
- for (i=0;i<ord;i++)
- mem[i] = SHR32(mem[i],1);
- for (i=0;i<N;i++)
- {
- xi=SATURATE(x[i],805306368);
- yi = SATURATE(ADD32(xi, SHL32(mem[0],2)),805306368);
- nyi = NEG32(yi);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_32_Q15(MAC16_32_Q15(mem[j+1], num[j],xi), den[j],nyi);
- }
- mem[ord-1] = SUB32(MULT16_32_Q15(num[ord-1],xi), MULT16_32_Q15(den[ord-1],yi));
- y[i] = yi;
- }
- for (i=0;i<ord;i++)
- mem[i] = SHL32(mem[i],1);
-}
-#endif
-#endif
-
-#ifdef FIXED_POINT
#ifndef OVERRIDE_FILTER_MEM16
void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
{
@@ -363,60 +316,7 @@
}
}
#endif
-#else
-void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- filter_mem2(x, num, den, y, N, ord, mem);
-}
-#endif
-
-#ifndef OVERRIDE_IIR_MEM2
-#ifdef PRECISION16
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_word16_t yi,nyi;
-
- for (i=0;i<N;i++)
- {
- yi = EXTRACT16(PSHR32(SATURATE(x[i] + SHL32(mem[0],1),536870911),SIG_SHIFT));
- nyi = NEG16(yi);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_16(mem[j+1],den[j],nyi);
- }
- mem[ord-1] = MULT16_16(den[ord-1],nyi);
- y[i] = SHL32(EXTEND32(yi),SIG_SHIFT);
- }
-}
-#else
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_word32_t xi,yi,nyi;
-
- for (i=0;i<ord;i++)
- mem[i] = SHR32(mem[i],1);
- for (i=0;i<N;i++)
- {
- xi=SATURATE(x[i],805306368);
- yi = SATURATE(xi + SHL32(mem[0],2),805306368);
- nyi = NEG32(yi);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_32_Q15(mem[j+1],den[j],nyi);
- }
- mem[ord-1] = MULT16_32_Q15(den[ord-1],nyi);
- y[i] = yi;
- }
- for (i=0;i<ord;i++)
- mem[i] = SHL32(mem[i],1);
-}
-#endif
-#endif
-
-#ifdef FIXED_POINT
#ifndef OVERRIDE_IIR_MEM16
void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
{
@@ -436,59 +336,7 @@
}
}
#endif
-#else
-void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- iir_mem2(x, den, y, N, ord, mem);
-}
-#endif
-
-#ifndef OVERRIDE_FIR_MEM2
-#ifdef PRECISION16
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_word16_t xi,yi;
-
- for (i=0;i<N;i++)
- {
- xi= EXTRACT16(PSHR32(SATURATE(x[i],536870911),SIG_SHIFT));
- yi = EXTRACT16(PSHR32(SATURATE(x[i] + SHL32(mem[0],1),536870911),SIG_SHIFT));
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_16(mem[j+1], num[j],xi);
- }
- mem[ord-1] = MULT16_16(num[ord-1],xi);
- y[i] = SHL32(EXTEND32(yi),SIG_SHIFT);
- }
-}
-#else
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_word32_t xi,yi;
-
- for (i=0;i<ord;i++)
- mem[i] = SHR32(mem[i],1);
- for (i=0;i<N;i++)
- {
- xi=SATURATE(x[i],805306368);
- yi = xi + SHL32(mem[0],2);
- for (j=0;j<ord-1;j++)
- {
- mem[j] = MAC16_32_Q15(mem[j+1], num[j],xi);
- }
- mem[ord-1] = MULT16_32_Q15(num[ord-1],xi);
- y[i] = SATURATE(yi,805306368);
- }
- for (i=0;i<ord;i++)
- mem[i] = SHL32(mem[i],1);
-}
-#endif
-#endif
-
-#ifdef FIXED_POINT
#ifndef OVERRIDE_FIR_MEM16
void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
{
@@ -508,16 +356,8 @@
}
}
#endif
-#else
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
- fir_mem2(x, num, y, N, ord, mem);
-}
-#endif
-
-
void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
{
int i;
@@ -544,32 +384,6 @@
}
-void syn_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack)
-{
- int i;
- VARDECL(spx_mem_t *mem);
- ALLOC(mem, ord, spx_mem_t);
- for (i=0;i<ord;i++)
- mem[i]=0;
- iir_mem2(xx, ak, y, N, ord, mem);
- for (i=0;i<ord;i++)
- mem[i]=0;
- filter_mem2(y, awk1, awk2, y, N, ord, mem);
-}
-
-void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack)
-{
- int i;
- VARDECL(spx_mem_t *mem);
- ALLOC(mem, ord, spx_mem_t);
- for (i=0;i<ord;i++)
- mem[i]=0;
- filter_mem2(xx, ak, awk1, y, N, ord, mem);
- for (i=0;i<ord;i++)
- mem[i]=0;
- fir_mem2(y, awk2, y, N, ord, mem);
-}
-
#ifndef OVERRIDE_COMPUTE_IMPULSE_RESPONSE
void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
{
Modified: trunk/speex/libspeex/filters.h
===================================================================
--- trunk/speex/libspeex/filters.h 2006-12-08 14:43:09 UTC (rev 12180)
+++ trunk/speex/libspeex/filters.h 2006-12-08 14:57:20 UTC (rev 12181)
@@ -61,10 +61,6 @@
void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack);
void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word32_t *mem1, spx_word32_t *mem2, char *stack);
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem);
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem);
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem);
-
void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
@@ -76,10 +72,6 @@
void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-void syn_percep_zero(const spx_sig_t *x, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
-
-void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
-
void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
void multicomb(
Modified: trunk/speex/libspeex/filters_arm4.h
===================================================================
--- trunk/speex/libspeex/filters_arm4.h 2006-12-08 14:43:09 UTC (rev 12180)
+++ trunk/speex/libspeex/filters_arm4.h 2006-12-08 14:57:20 UTC (rev 12181)
@@ -95,295 +95,3 @@
return sig_shift;
}
-#define OVERRIDE_FILTER_MEM2
-void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_sig_t xi,yi,nyi;
-
- for (i=0;i<ord;i++)
- mem[i] = SHR32(mem[i],1);
- for (i=0;i<N;i++)
- {
- int deadm, deadn, deadd, deadidx, x1, y1, dead1, dead2, dead3, dead4, dead5, dead6;
- xi=SATURATE(x[i],805306368);
- yi = SATURATE(ADD32(xi, SHL(mem[0],2)),805306368);
- nyi = -yi;
- y[i] = yi;
- __asm__ __volatile__ (
- "\tldrsh %6, [%1], #2\n"
- "\tsmull %8, %9, %4, %6\n"
-#ifdef SHORTCUTS
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
-
-#else
- ".filterloop%=: \n"
- "\tldrsh %6, [%2], #2\n"
- "\tldr %10, [%0, #4]\n"
- "\tmov %8, %8, lsr #15\n"
- "\tsmull %7, %11, %5, %6\n"
- "\tadd %8, %8, %9, lsl #17\n"
- "\tldrsh %6, [%1], #2\n"
- "\tadd %10, %10, %8\n"
- "\tsmull %8, %9, %4, %6\n"
- "\tadd %10, %10, %7, lsr #15\n"
- "\tsubs %3, %3, #1\n"
- "\tadd %10, %10, %11, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
- "\t bne .filterloop%=\n"
-#endif
- "\tmov %8, %8, lsr #15\n"
- "\tadd %10, %8, %9, lsl #17\n"
- "\tldrsh %6, [%2], #2\n"
- "\tsmull %8, %9, %5, %6\n"
- "\tadd %10, %10, %8, lsr #15\n"
- "\tadd %10, %10, %9, lsl #17\n"
- "\tstr %10, [%0], #4 \n"
-
- : "=r" (deadm), "=r" (deadn), "=r" (deadd), "=r" (deadidx),
- "=r" (xi), "=r" (nyi), "=r" (dead1), "=r" (dead2),
- "=r" (dead3), "=r" (dead4), "=r" (dead5), "=r" (dead6)
- : "0" (mem), "1" (num), "2" (den), "3" (ord-1), "4" (xi), "5" (nyi)
- : "cc", "memory");
-
- }
- for (i=0;i<ord;i++)
- mem[i] = SHL32(mem[i],1);
-}
-
-#define OVERRIDE_IIR_MEM2
-void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i,j;
- spx_sig_t xi,yi,nyi;
-
- for (i=0;i<ord;i++)
- mem[i] = SHR32(mem[i],1);
-
- for (i=0;i<N;i++)
- {
- int deadm, deadd, deadidx, dead1, dead2, dead3, dead4, dead5, dead6;
- xi=SATURATE(x[i],805306368);
- yi = SATURATE(ADD32(xi, SHL(mem[0],2)),805306368);
- nyi = -yi;
- y[i] = yi;
- __asm__ __volatile__ (
- "\tldrsh %4, [%1], #2\n"
- "\tsmull %5, %6, %3, %4\n"
-
-#ifdef SHORTCUTS
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %7, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %7, %7, %8\n"
- "\tstr %7, [%0], #4 \n"
-
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %9, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %9, %9, %8\n"
- "\tstr %9, [%0], #4 \n"
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %7, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %7, %7, %8\n"
- "\tstr %7, [%0], #4 \n"
-
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %9, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %9, %9, %8\n"
- "\tstr %9, [%0], #4 \n"
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %7, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %7, %7, %8\n"
- "\tstr %7, [%0], #4 \n"
-
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %9, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %9, %9, %8\n"
- "\tstr %9, [%0], #4 \n"
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %7, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %7, %7, %8\n"
- "\tstr %7, [%0], #4 \n"
-
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %9, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %9, %9, %8\n"
- "\tstr %9, [%0], #4 \n"
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tldr %7, [%0, #4]\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %7, %7, %8\n"
- "\tstr %7, [%0], #4 \n"
-
-
-
-#else
- ".iirloop%=: \n"
- "\tldr %7, [%0, #4]\n"
-
- "\tldrsh %4, [%1], #2\n"
- "\tmov %5, %5, lsr #15\n"
- "\tadd %8, %5, %6, lsl #17\n"
- "\tsmull %5, %6, %3, %4\n"
- "\tadd %7, %7, %8\n"
- "\tstr %7, [%0], #4 \n"
- "\tsubs %2, %2, #1\n"
- "\t bne .iirloop%=\n"
-
-#endif
- "\tmov %5, %5, lsr #15\n"
- "\tadd %7, %5, %6, lsl #17\n"
- "\tstr %7, [%0], #4 \n"
-
- : "=r" (deadm), "=r" (deadd), "=r" (deadidx), "=r" (nyi),
- "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
- "=r" (dead5), "=r" (dead6)
- : "0" (mem), "1" (den), "2" (ord-1), "3" (nyi)
- : "cc", "memory");
-
- }
- for (i=0;i<ord;i++)
- mem[i] = SHL32(mem[i],1);
-
-}
Modified: trunk/speex/libspeex/filters_bfin.h
===================================================================
--- trunk/speex/libspeex/filters_bfin.h 2006-12-08 14:43:09 UTC (rev 12180)
+++ trunk/speex/libspeex/filters_bfin.h 2006-12-08 14:57:20 UTC (rev 12181)
@@ -79,145 +79,8 @@
return sig_shift;
}
-#define OVERRIDE_FILTER_MEM2
-void filter_mem2(const spx_sig_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
-{
- spx_word32_t xy2[N+1];
- spx_word32_t *xy = xy2+1;
- spx_word32_t numden_a[2*ord+2];
- spx_word16_t *numden = (spx_word16_t*) numden_a;
- int i;
- for (i=0;i<ord;i++)
- {
- numden[2*i] = num[i];
- numden[2*i+1] = den[i];
- }
- __asm__ __volatile__
- (
- /* Register setup */
- "R0 = %5;\n\t" /*ord */
-
- "P0 = %3;\n\t"
- "I0 = P0;\n\t"
- "B0 = P0;\n\t" /* numden */
- "L0 = 0;\n\t"
-
- "P2 = %0;\n\t" /* Fused xy */
- "I2 = P2;\n\t"
- "L2 = 0;\n\t"
-
- "P4 = %6;\n\t" /* mem */
- "P0 = %1;\n\t" /* _x */
- "P1 = %2;\n\t" /* _y */
-
- /* First sample */
- "R1 = [P4++];\n\t"
- "R1 <<= 1;\n\t" /* shift mem */
- "R2 = [P0++];\n\t" /* load x[0] */
- "R1 = R1 + R2;\n\t"
- "[P1++] = R1;\n\t" /* store y[0] */
- "R1 <<= 2;\n\t"
- "R2 <<= 2;\n\t"
- "R2 = PACK(R1.H, R2.H);\n\t" /* pack x16 and y16 */
- "[P2] = R2;\n\t"
-
- /* Samples 1 to ord-1 (using memory) */
- "R0 += -1;\n\t"
- "R3 = 0;\n\t"
- "LC0 = R0;\n\t"
- "LOOP filter_start%= LC0;\n\t"
- "LOOP_BEGIN filter_start%=;\n\t"
- "R3 += 1;\n\t"
- "LC1 = R3;\n\t"
-
- "R1 = [P4++];\n\t"
- "A1 = R1;\n\t"
- "A0 = 0;\n\t"
- "I0 = B0;\n\t"
- "I2 = P2;\n\t"
- "P2 += 4;\n\t"
- "R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP filter_start_inner%= LC1;\n\t"
- "LOOP_BEGIN filter_start_inner%=;\n\t"
- "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP_END filter_start_inner%=;\n\t"
- "A0 += A1;\n\t"
- "R4 = A0;\n\t"
- "R4 <<= 1;\n\t" /* shift mem */
- "R2 = [P0++];\n\t" /* load x */
- "R4 = R4 + R2;\n\t"
- "[P1++] = R4;\n\t" /* store y */
- "R4 <<= 2;\n\t"
- "R2 <<= 2;\n\t"
- "R2 = PACK(R4.H, R2.H);\n\t" /* pack x16 and y16 */
- "[P2] = R2;\n\t"
- "LOOP_END filter_start%=;\n\t"
- /* Samples ord to N*/
- "R0 = %5;\n\t"
- "R0 <<= 1;\n\t"
- "I0 = B0;\n\t" /* numden */
- "R0 <<= 1;\n\t"
- "L0 = R0;\n\t"
-
- "R0 = %5;\n\t" /* org */
- "R2 = %4;\n\t" /* N */
- "R2 = R2 - R0;\n\t"
- "R4 = [I0++];\n\t" /* numden */
- "LC0 = R2;\n\t"
- "P3 = R0;\n\t"
- "R0 <<= 2;\n\t"
- "R0 += 8;\n\t"
- "I2 = P2;\n\t"
- "M0 = R0;\n\t"
- "A1 = A0 = 0;\n\t"
- "R5 = [I2--];\n\t" /* load xy */
- "LOOP filter_mid%= LC0;\n\t"
- "LOOP_BEGIN filter_mid%=;\n\t"
- "LOOP filter_mid_inner%= LC1=P3;\n\t"
- "LOOP_BEGIN filter_mid_inner%=;\n\t"
- "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP_END filter_mid_inner%=;\n\t"
- "R0 = (A0 += A1) || I2 += M0;\n\t"
- "R0 = R0 << 1 || R5 = [P0++];\n\t" /* load x */
- "R0 = R0 + R5;\n\t"
- "R0 = R0 << 2 || [P1++] = R0;\n\t" /* shift y | store y */
- "R5 = R5 << 2;\n\t"
- "R5 = PACK(R0.H, R5.H);\n\t"
- "A1 = A0 = 0 || [I2--] = R5\n\t"
- "LOOP_END filter_mid%=;\n\t"
- "I2 += 4;\n\t"
- "P2 = I2;\n\t"
- /* Update memory */
- "P4 = %6;\n\t"
- "R0 = %5;\n\t"
- "LC0 = R0;\n\t"
- "P0 = B0;\n\t"
- "A1 = A0 = 0;\n\t"
- "LOOP mem_update%= LC0;\n\t"
- "LOOP_BEGIN mem_update%=;\n\t"
- "I2 = P2;\n\t"
- "I0 = P0;\n\t"
- "P0 += 4;\n\t"
- "R0 = LC0;\n\t"
- "LC1 = R0;\n\t"
- "R5 = [I2--] || R4 = [I0++];\n\t"
- "LOOP mem_accum%= LC1;\n\t"
- "LOOP_BEGIN mem_accum%=;\n\t"
- "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
- "LOOP_END mem_accum%=;\n\t"
- "R0 = (A0 += A1);\n\t"
- "A1 = A0 = 0 || [P4++] = R0;\n\t"
- "LOOP_END mem_update%=;\n\t"
- "L0 = 0;\n\t"
- : : "m" (xy), "m" (_x), "m" (_y), "m" (numden), "m" (N), "m" (ord), "m" (mem)
- : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B0", "I0", "I2", "L0", "L2", "M0", "memory"
- );
-
-}
-
-
#define OVERRIDE_FILTER_MEM16
void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
{
@@ -363,130 +226,6 @@
-
-#define OVERRIDE_IIR_MEM2
-void iir_mem2(const spx_sig_t *_x, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
-{
- spx_word16_t y[N+2];
- spx_word16_t *yy;
- yy = y+2;
- __asm__ __volatile__
- (
- /* Register setup */
- "R0 = %5;\n\t" /*ord */
-
- "P1 = %3;\n\t"
- "I1 = P1;\n\t"
- "B1 = P1;\n\t"
- "L1 = 0;\n\t"
-
- "P3 = %0;\n\t"
- "I3 = P3;\n\t"
- "L3 = 0;\n\t"
-
- "P4 = %6;\n\t"
- "P0 = %1;\n\t"
- "P1 = %2;\n\t"
-
- /* First sample */
- "R1 = [P4++];\n\t"
- "R1 <<= 1;\n\t"
- "R2 = [P0++];\n\t"
- "R1 = R1 + R2;\n\t"
- "[P1++] = R1;\n\t"
- "R1 <<= 2;\n\t"
- "W[P3] = R1.H;\n\t"
- "R2 <<= 2;\n\t"
-
- /* Samples 1 to ord-1 (using memory) */
- "R0 += -1;\n\t"
- "R3 = 0;\n\t"
- "LC0 = R0;\n\t"
- "LOOP filter_start%= LC0;\n\t"
- "LOOP_BEGIN filter_start%=;\n\t"
- "R3 += 1;\n\t"
- "LC1 = R3;\n\t"
-
- "R1 = [P4++];\n\t"
- "A1 = R1;\n\t"
- "I1 = B1;\n\t"
- "I3 = P3;\n\t"
- "P3 += 2;\n\t"
- "LOOP filter_start_inner%= LC1;\n\t"
- "LOOP_BEGIN filter_start_inner%=;\n\t"
- "R4.L = W[I1++];\n\t"
- "R5.L = W[I3--];\n\t"
- "A1 -= R4.L*R5.L (IS);\n\t"
- "LOOP_END filter_start_inner%=;\n\t"
-
- "R1 = A1;\n\t"
- "R1 <<= 1;\n\t"
- "R2 = [P0++];\n\t"
- "R1 = R1 + R2;\n\t"
- "[P1++] = R1;\n\t"
- "R1 <<= 2;\n\t"
- "W[P3] = R1.H;\n\t"
- "R2 <<= 2;\n\t"
- "LOOP_END filter_start%=;\n\t"
-
- /* Samples ord to N*/
- "R0 = %5;\n\t"
- "R0 <<= 1;\n\t"
- "I1 = B1;\n\t"
- "L1 = R0;\n\t"
-
- "R0 = %5;\n\t"
- "R2 = %4;\n\t"
- "R2 = R2 - R0;\n\t"
- "R4.L = W[I1++];\n\t"
- "LC0 = R2;\n\t"
- "LOOP filter_mid%= LC0;\n\t"
- "LOOP_BEGIN filter_mid%=;\n\t"
- "LC1 = R0;\n\t"
- "A1 = 0;\n\t"
- "I3 = P3;\n\t"
- "P3 += 2;\n\t"
- "R5.L = W[I3--];\n\t"
- "LOOP filter_mid_inner%= LC1;\n\t"
- "LOOP_BEGIN filter_mid_inner%=;\n\t"
- "A1 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
- "LOOP_END filter_mid_inner%=;\n\t"
- "R1 = A1;\n\t"
- "R1 = R1 << 1 || R2 = [P0++];\n\t"
- "R1 = R1 + R2;\n\t"
- "R1 = R1 << 2 || [P1++] = R1;\n\t"
- "W[P3] = R1.H;\n\t"
- "LOOP_END filter_mid%=;\n\t"
-
- /* Update memory */
- "P4 = %6;\n\t"
- "R0 = %5;\n\t"
- "LC0 = R0;\n\t"
- "P1 = B1;\n\t"
- "LOOP mem_update%= LC0;\n\t"
- "LOOP_BEGIN mem_update%=;\n\t"
- "A0 = 0;\n\t"
- "I3 = P3;\n\t"
- "I1 = P1;\n\t"
- "P1 += 2;\n\t"
- "R0 = LC0;\n\t"
- "LC1=R0;\n\t"
- "R5.L = W[I3--] || R4.L = W[I1++];\n\t"
- "LOOP mem_accum%= LC1;\n\t"
- "LOOP_BEGIN mem_accum%=;\n\t"
- "A0 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
- "LOOP_END mem_accum%=;\n\t"
- "R0 = A0;\n\t"
- "[P4++] = R0;\n\t"
- "LOOP_END mem_update%=;\n\t"
- "L1 = 0;\n\t"
- : : "m" (yy), "m" (_x), "m" (_y), "m" (den), "m" (N), "m" (ord), "m" (mem)
- : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B1", "I1", "I3", "L1", "L3", "memory"
- );
-
-}
-
-
#define OVERRIDE_IIR_MEM16
void iir_mem16(const spx_word16_t *_x, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
{
@@ -612,18 +351,6 @@
}
-#define OVERRIDE_FIR_MEM2
-void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
-{
- int i;
- spx_coef_t den2[12];
- spx_coef_t *den;
- den = (spx_coef_t*)((((int)den2)+4)&0xfffffffc);
- for (i=0;i<10;i++)
- den[i] = 0;
- filter_mem2(x, num, den, y, N, ord, mem);
-}
-
#define OVERRIDE_FIR_MEM16
void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
{
Modified: trunk/speex/libspeex/filters_sse.h
===================================================================
--- trunk/speex/libspeex/filters_sse.h 2006-12-08 14:43:09 UTC (rev 12180)
+++ trunk/speex/libspeex/filters_sse.h 2006-12-08 14:57:20 UTC (rev 12181)
@@ -34,7 +34,7 @@
#include <xmmintrin.h>
-void filter_mem2_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+void filter_mem16_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
{
__m128 num[3], den[3], mem[3];
@@ -87,7 +87,7 @@
_mm_store_ss(_mem+9, mem[2]);
}
-void filter_mem2_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+void filter_mem16_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
{
__m128 num[2], den[2], mem[2];
@@ -130,18 +130,18 @@
}
-#define OVERRIDE_FILTER_MEM2
-void filter_mem2(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+#define OVERRIDE_FILTER_MEM16
+void filter_mem16(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
{
if(ord==10)
- filter_mem2_10(x, _num, _den, y, N, ord, _mem);
+ filter_mem16_10(x, _num, _den, y, N, ord, _mem);
else if (ord==8)
- filter_mem2_8(x, _num, _den, y, N, ord, _mem);
+ filter_mem16_8(x, _num, _den, y, N, ord, _mem);
}
-void iir_mem2_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+void iir_mem16_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
{
__m128 den[3], mem[3];
@@ -190,7 +190,7 @@
}
-void iir_mem2_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+void iir_mem16_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
{
__m128 den[2], mem[2];
@@ -229,17 +229,17 @@
_mm_storeu_ps(_mem+4, mem[1]);
}
-#define OVERRIDE_IIR_MEM2
-void iir_mem2(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+#define OVERRIDE_IIR_MEM16
+void iir_mem16(const float *x, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
{
if(ord==10)
- iir_mem2_10(x, _den, y, N, ord, _mem);
+ iir_mem16_10(x, _den, y, N, ord, _mem);
else if (ord==8)
- iir_mem2_8(x, _den, y, N, ord, _mem);
+ iir_mem16_8(x, _den, y, N, ord, _mem);
}
-void fir_mem2_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+void fir_mem16_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
{
__m128 num[3], mem[3];
@@ -287,7 +287,7 @@
_mm_store_ss(_mem+9, mem[2]);
}
-void fir_mem2_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+void fir_mem16_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
{
__m128 num[2], mem[2];
@@ -326,11 +326,11 @@
_mm_storeu_ps(_mem+4, mem[1]);
}
-#define OVERRIDE_FIR_MEM2
-void fir_mem2(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+#define OVERRIDE_FIR_MEM16
+void fir_mem16(const float *x, const float *_num, float *y, int N, int ord, float *_mem, char *stack)
{
if(ord==10)
- fir_mem2_10(x, _num, y, N, ord, _mem);
+ fir_mem16_10(x, _num, y, N, ord, _mem);
else if (ord==8)
- fir_mem2_8(x, _num, y, N, ord, _mem);
+ fir_mem16_8(x, _num, y, N, ord, _mem);
}
More information about the commits
mailing list