Beispiel #1
0
fb_info *filter_bank_init(uint16_t frame_len)
{
    uint16_t nshort = frame_len/8;
#ifdef LD_DEC
    uint16_t frame_len_ld = frame_len/2;
#endif

    fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
    memset(fb, 0, sizeof(fb_info));

    /* normal */
    fb->mdct256 = faad_mdct_init(2*nshort);
    fb->mdct2048 = faad_mdct_init(2*frame_len);
#ifdef LD_DEC
    /* LD */
    fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
#endif

#ifdef ALLOW_SMALL_FRAMELENGTH
    if (frame_len == 1024)
    {
#endif
        fb->long_window[0]  = sine_long_1024;
        fb->short_window[0] = sine_short_128;
        fb->long_window[1]  = kbd_long_1024;
        fb->short_window[1] = kbd_short_128;
#ifdef LD_DEC
        fb->ld_window[0] = sine_mid_512;
        fb->ld_window[1] = ld_mid_512;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
    } else /* (frame_len == 960) */ {
        fb->long_window[0]  = sine_long_960;
        fb->short_window[0] = sine_short_120;
        fb->long_window[1]  = kbd_long_960;
        fb->short_window[1] = kbd_short_120;
#ifdef LD_DEC
        fb->ld_window[0] = sine_mid_480;
        fb->ld_window[1] = ld_mid_480;
#endif
    }
#endif

#ifdef USE_SSE
    if (cpu_has_sse())
    {
        fb->if_func = ifilter_bank_sse;
    } else {
        fb->if_func = ifilter_bank;
    }
#endif

    return fb;
}
Beispiel #2
0
fb_info *ssr_filter_bank_init(uint16_t frame_len)
{
    uint16_t nshort = frame_len/8;

    fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
    memset(fb, 0, sizeof(fb_info));

    /* normal */
    fb->mdct256 = faad_mdct_init(2*nshort);
    fb->mdct2048 = faad_mdct_init(2*frame_len);

    fb->long_window[0]  = sine_long_256;
    fb->short_window[0] = sine_short_32;
    fb->long_window[1]  = kbd_long_256;
    fb->short_window[1] = kbd_short_32;

    return fb;
}
Beispiel #3
0
fb_info *filter_bank_init(uint16_t frame_len)
{
 int32_t nshort = frame_len/8,i,j;
#ifdef LD_DEC
 int32_t frame_len_ld = frame_len/2;
#endif
 double phaseInc;

 fb_info *fb = (fb_info*)malloc(sizeof(fb_info));
 if(!fb)
  return fb;

 memset(fb, 0, sizeof(fb_info));

#ifdef USE_VORBIS_MDCT
 if(!(nshort&31)){ // (nshort==64) || (nshort==128) || (nshort==256)
  fb->mdct256  = oggdec_mdct_init(2*nshort);
  if(!fb->mdct256)
   goto err_out;
  fb->mdct2048 = oggdec_mdct_init(2*frame_len);
  if(!fb->mdct2048)
   goto err_out;
 #ifdef LD_DEC
  fb->mdct1024 = oggdec_mdct_init(2*frame_len_ld);
  if(!fb->mdct1024)
   goto err_out;
 #endif
  fb->use_vorbis_mdct=1;
 }else{
#else
  fb->mdct256  = faad_mdct_init(2*nshort);
  if(!fb->mdct256)
   goto err_out;
  fb->mdct2048 = faad_mdct_init(2*frame_len);
  if(!fb->mdct2048)
   goto err_out;
 #ifdef LD_DEC
  fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
  if(!fb->mdct1024)
   goto err_out;
 #endif
#endif
#ifdef USE_VORBIS_MDCT
 }
#endif

 fb->long_window[0]=(real_t *)malloc(frame_len*sizeof(real_t));
 if(!fb->long_window[0])
  goto err_out;
 phaseInc = M_PI / (2.0f * frame_len);
 for(i=0;i<frame_len;i++)
  fb->long_window[0][i]=(real_t)sin(phaseInc * ((real_t)i + 0.5));

 fb->short_window[0]=(real_t *)malloc(nshort*sizeof(real_t));
 if(!fb->short_window[0])
  goto err_out;
 phaseInc = M_PI / (2.0f * nshort);
 for(i=0;i<nshort;i++)
  fb->short_window[0][i]=(real_t)sin(phaseInc * ((real_t)i + 0.5));

#ifdef LD_DEC
 fb->ld_window[0]=(real_t *)malloc(frame_len_ld*sizeof(real_t));
 if(!fb->ld_window[0])
  goto err_out;
 phaseInc = M_PI / (2.0f * frame_len_ld);
 for(i=0;i<frame_len_ld;i++)
  fb->ld_window[0][i]=(real_t)sin(phaseInc * ((real_t)i + 0.5));

 fb->ld_window[1]=(real_t *)malloc(frame_len_ld*sizeof(real_t));
 if(!fb->ld_window[1])
  goto err_out;
 j=0;
 for(i=0;i<nshort*3/2;i++,j++)
  fb->ld_window[1][j] = (real_t)0.0;
 for(i=0;i<nshort    ;i++,j++)
  fb->ld_window[1][j] = fb->short_window[0][i];
 for(i=0;i<nshort*3/2;i++,j++)
  fb->ld_window[1][j] = (real_t)1.0;
#endif

 if(frame_len == 1024){
  fb->long_window[1]  = kbd_long_1024;
  fb->short_window[1] = kbd_short_128;
 }else{ //(frame_len == 960)
  fb->long_window[1]  = kbd_long_960;
  fb->short_window[1] = kbd_short_120;
 }

 fb->tmp_buf = (real_t*)malloc(2*frame_len*sizeof(real_t));
 if(!fb->tmp_buf)
  goto err_out;

 return fb;

err_out:
 filter_bank_end(fb);
 free(fb);
 return NULL;
}