Exemplo n.º 1
0
static USC_Status MemAlloc(const USC_EC_Option *options, USC_MemBank *pBanks)
{
   unsigned int nbytes;
   IppPCMFrequency freq;
   int taptime_ms;

   if(options==NULL) return USC_BadDataPointer;
   if(pBanks==NULL) return USC_BadDataPointer;
   if(options->pcmType.bitPerSample != 16) return USC_UnsupportedPCMType;
   switch(options->pcmType.sample_frequency) {
     case 8000:  freq = IPP_PCM_FREQ_8000;  break;
     case 16000: freq = IPP_PCM_FREQ_16000; break;
     default: return USC_UnsupportedPCMType;
   }

   pBanks->pMem = NULL;
   if(options->algType == EC_SUBBAND) {
     if((options->echotail > 0) && (options->echotail <= SB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
     else return USC_UnsupportedEchoTail;
     ec_sb_GetSize(freq, taptime_ms, (int *)&nbytes);
   } else if(options->algType == EC_FULLBAND) {
     if((options->echotail > 0) && (options->echotail <= FB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
     else return USC_UnsupportedEchoTail;
     ec_fb_GetSize(freq, taptime_ms, (int *)&nbytes);
   } else {
     if((options->echotail > 0) && (options->echotail <= SB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
     else return USC_UnsupportedEchoTail;
     ec_sbf_GetSize(freq, taptime_ms, (int *)&nbytes);
   }
   pBanks->nbytes = nbytes + sizeof(ECFP_Handle_Header); /* room for USC header */
   return USC_NoError;
}
Exemplo n.º 2
0
static USC_Status MemAlloc(const USC_EC_Option *options, USC_MemBank *pBanks)
{
    Ipp32s nbytes,nbytes2,scratch_size,taptime_ms;
    IppPCMFrequency freq;

    if(options==NULL) return USC_BadDataPointer;
    if(pBanks==NULL) return USC_BadDataPointer;
    if(options->pcmType.bitPerSample != 16) return USC_UnsupportedPCMType;
    switch(options->pcmType.sample_frequency) {
     case 8000:  freq = IPP_PCM_FREQ_8000;  break;
     case 16000: freq = IPP_PCM_FREQ_16000; break;
     default: return USC_UnsupportedPCMType;
    }

    pBanks[0].pMem = NULL;
    pBanks[0].align = 32;
    pBanks[0].memType = USC_OBJECT;
    pBanks[0].memSpaceType = USC_NORMAL;

    pBanks[1].pMem = NULL;
    pBanks[1].align = 32;
    pBanks[1].memType = USC_OBJECT;
    pBanks[1].memSpaceType = USC_NORMAL;

    pBanks[2].pMem = NULL;
    pBanks[2].align = 32;
    pBanks[2].memType = USC_OBJECT;
    pBanks[2].memSpaceType = USC_NORMAL;

    pBanks[3].pMem = NULL;
    pBanks[3].align = 32;
    pBanks[3].memType = USC_OBJECT;
    pBanks[3].memSpaceType = USC_NORMAL;

    //if(options->algType == EC_AFFINESUBBAND) {
    //    if((options->echotail > 0) && (options->echotail <= ASB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
    //    else return USC_UnsupportedEchoTail;
    //    ec_asb_GetSize(freq, taptime_ms,&nbytes,&nbytes2,&scratch_size);
    //} else
        if(options->algType == EC_SUBBAND) {
        if((options->echotail > 0) && (options->echotail <= SB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
        else return USC_UnsupportedEchoTail;
        ec_sb_GetSize(freq, taptime_ms,&nbytes,&nbytes2,&scratch_size,options->modes.ap);
    } else if(options->algType == EC_FULLBAND) {
        if((options->echotail > 0) && (options->echotail <= FB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
        else return USC_UnsupportedEchoTail;
        ec_fb_GetSize(freq, taptime_ms,&nbytes,&nbytes2,&scratch_size,0);
    } else {
        if((options->echotail > 0) && (options->echotail <= SB_MAX_LEN_TAIL)) taptime_ms = options->echotail;
        else return USC_UnsupportedEchoTail;
        ec_sbf_GetSize(freq, taptime_ms,&nbytes,&nbytes2,&scratch_size,0);
    }
    pBanks[0].nbytes = nbytes + ALIGN(sizeof(ECFP_Handle_Header)); /* room for USC header */
    pBanks[1].nbytes = nbytes2;
    pBanks[2].nbytes = scratch_size;
    ippsFilterNoiseGetStateSize_EC_32f((IppPCMFrequency)freq,&pBanks[3].nbytes);
    return USC_NoError;
}