[Speex-dev] high-pass filter issues

Michael Jacobson Michael.Jacobson at ultratec.com
Wed Aug 29 08:05:16 PDT 2007


Hi, I am using 1.2beta2 on a C5416 doing narrowband
 
 
in the decode function I am having a problem with the execution of my
program vectoring off to random interrupts that are not used.  I have
tracked down the error to the highpass function called in nb_decode
-very close to the end of the function-context:
 
it is called here: ln 1719 for me
   if (st->highpass_enabled)
      highpass(out, out, st->frameSize,
(st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_OUTPUT,
st->mem_hp);
   /*for (i=0;i<st->frameSize;i++)
     printf ("%d\n", (int)st->frame[i]);*/
 
here's the function:
 
void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int
filtID, spx_mem_t *mem)
{
   int i;
#ifdef FIXED_POINT
   const spx_word16_t Pcoef[5][3] = {{16384, -31313, 14991}, {16384,
-31569, 15249}, {16384, -31677, 15328}, {16384, -32313, 15947}, {16384,
-22446, 6537}};
   const spx_word16_t Zcoef[5][3] = {{15672, -31344, 15672}, {15802,
-31601, 15802}, {15847, -31694, 15847}, {16162, -32322, 16162}, {14418,
-28836, 14418}};
#else
   const spx_word16_t Pcoef[5][3] = {{1.00000f, -1.91120f, 0.91498f},
{1.00000f, -1.92683f, 0.93071f}, {1.00000f, -1.93338f, 0.93553f},
{1.00000f, -1.97226f, 0.97332f}, {1.00000f, -1.37000f, 0.39900f}};
   const spx_word16_t Zcoef[5][3] = {{0.95654f, -1.91309f, 0.95654f},
{0.96446f, -1.92879f, 0.96446f}, {0.96723f, -1.93445f, 0.96723f},
{0.98645f, -1.97277f, 0.98645f}, {0.88000f, -1.76000f, 0.88000f}};
#endif
   const spx_word16_t *den, *num;
   if (filtID>4)
      filtID=4;
   
   den = Pcoef[filtID]; num = Zcoef[filtID];
   /*return;*/
   for (i=0;i<len;i++)
   {
      spx_word16_t yi;
      spx_word32_t vout = ADD32(MULT16_16(num[0], x[i]),mem[0]);
      yi = EXTRACT16(SATURATE(PSHR32(vout,14),32767));
      mem[0] = ADD32(MAC16_16(mem[1], num[1],x[i]),
SHL32(MULT16_32_Q15(-den[1],vout),1));
      mem[1] = ADD32(MULT16_16(num[2],x[i]),
SHL32(MULT16_32_Q15(-den[2],vout),1));
      y[i] = yi;
   }
}
 
 
I can step into the function just fine, but when I run it, even just
from the initial variable declarations to the top of that "for" loop I
vector off.  I am thinking this might have something to do with me
making the state parameters static instead of running off a heap.  these
are the sizes and parameters I used:
 
#ifdef STATIC_INIT
 #define ENC_WINBUF_SIZE 40
 #define ENC_EXCBUF_SIZE 306
 #define ENC_SWBUF_SIZE 306
 #define ENC_LAGWINDOW_SIZE 11
 #define ENC_OLD_LSP_SIZE 10
 #define ENC_OLD_QLSP_SIZE 10
 #define ENC_MEM_SP_SIZE 20
 #define ENC_MEM_SW_SIZE 20
 #define ENC_SW_WHOLE_SIZE 20
 #define ENC_MEM_EXC_SIZE 20
 #define ENC_MEM_EXC2_SIZE 20
 #define ENC_PI_GAIN_SIZE 8
 #define ENC_PITCH_SIZE 4
 
 #define DEC_EXCBUF_SIZE 500
 #define DEC_INTERP_QLPC_SIZE 10
 #define DEC_OLD_QLSP_SIZE 10
 #define DEC_MEM_SP_SIZE 20
 #define DEC_PI_GAIN_SIZE 8
 
 EncState   enc_state;
 char    enc_stack[NB_ENC_STACK];
 spx_word16_t  enc_winbuf[ENC_WINBUF_SIZE];
 spx_word16_t  enc_excbuf[ENC_EXCBUF_SIZE];
 spx_word16_t  enc_swbuf[ENC_SWBUF_SIZE];
 spx_word16_t  enc_lagwindow[ENC_LAGWINDOW_SIZE];
 spx_lsp_t   enc_old_lsp[ENC_OLD_LSP_SIZE];
 spx_lsp_t  enc_old_qlsp[ENC_OLD_QLSP_SIZE];
 spx_mem_t  enc_mem_sp[ENC_MEM_SP_SIZE];
 spx_mem_t  enc_mem_sw[ENC_MEM_SW_SIZE];
 spx_mem_t  enc_mem_sw_whole[ENC_SW_WHOLE_SIZE];
 spx_mem_t  enc_mem_exc[ENC_MEM_EXC_SIZE];
 spx_mem_t  enc_memexc2[ENC_MEM_EXC2_SIZE];
 spx_word32_t enc_pi_gain[ENC_PI_GAIN_SIZE];
 int    enc_pitch[ENC_PITCH_SIZE];
 
 DecState  dec_state;
 char   dec_stack[NB_DEC_STACK];
 spx_word16_t dec_excbuf[DEC_EXCBUF_SIZE];
 spx_coef_t  dec_interp_qlpc[DEC_INTERP_QLPC_SIZE];
 spx_lsp_t  dec_old_qlsp[DEC_OLD_QLSP_SIZE];
 spx_mem_t  dec_mem_sp[DEC_MEM_SP_SIZE];
 spx_word32_t dec_pi_gain[DEC_PI_GAIN_SIZE];
 
#endif 
 
I noticed that when inside the high pass function that len must be
greater that 160 because I single stepped through it and I got to be
greater than A0 and that I cannot read any of the variables passed as a
parameter, they always show up as FP + some value.  any thoughts on what
might be going on? (FIXED_POINT is defined)
 
-Mike
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20070829/8f9bbfd8/attachment.html


More information about the Speex-dev mailing list