⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dspop.cc

📁 各种工程计算的库函数
💻 CC
📖 第 1 页 / 共 5 页
字号:
{    #ifdef DSP_IPP    ippsSet_32f(fSrc, fpDest, lCount);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        fpDest[lLoopCntr] = fSrc;    }    #endif}void clDSPOp::Set (double *dpDest, double dSrc, long lCount){    #ifdef DSP_IPP    ippsSet_64f(dSrc, dpDest, lCount);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        dpDest[lLoopCntr] = dSrc;    }    #endif}void clDSPOp::Set (stpSCplx spCplxDest, stSCplx sCplxSrc, long lCount){    #ifdef DSP_IPP    ippsSet_32fc(*((Ipp32fc *) &sCplxSrc), (Ipp32fc *) spCplxDest, lCount);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        spCplxDest[lLoopCntr].R = sCplxSrc.R;        spCplxDest[lLoopCntr].I = sCplxSrc.I;    }    #endif}void clDSPOp::Set (stpDCplx spCplxDest, stDCplx sCplxSrc, long lCount){    #ifdef DSP_IPP    ippsSet_64fc(*((Ipp64fc *) &sCplxSrc), (Ipp64fc *) spCplxDest, lCount);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        spCplxDest[lLoopCntr].R = sCplxSrc.R;        spCplxDest[lLoopCntr].I = sCplxSrc.I;    }    #endif}void clDSPOp::Set (float *fpDest, float fSrc, long lStart, long lCount,    long lLength){    #ifdef DSP_IPP    ippsSet_32f(fSrc, &fpDest[lStart],        ((lStart + lCount) > lLength) ? lLength - lStart : lCount);    #else    long lLoopCntr;    long lEnd;    lEnd = ((lStart + lCount) > lLength) ? lLength : (lStart + lCount);    for (lLoopCntr = 0L; lLoopCntr < lEnd; lLoopCntr++)    {        fpDest[lLoopCntr] = fSrc;    }    #endif}void clDSPOp::Set (double *dpDest, double dSrc, long lStart, long lCount,    long lLength){    #ifdef DSP_IPP    ippsSet_64f(dSrc, &dpDest[lStart],        ((lStart + lCount) > lLength) ? lLength - lStart : lCount);    #else    long lLoopCntr;    long lEnd;    lEnd = ((lStart + lCount) > lLength) ? lLength : (lStart + lCount);    for (lLoopCntr = 0L; lLoopCntr < lEnd; lLoopCntr++)    {        dpDest[lLoopCntr] = dSrc;    }    #endif}void clDSPOp::Set (stpSCplx spCplxDest, stSCplx sCplxSrc, long lStart,     long lCount, long lLength){    #ifdef DSP_IPP    ippsSet_32fc(*((Ipp32fc *) &sCplxSrc), (Ipp32fc *) spCplxDest,        ((lStart + lCount) > lLength) ? lLength - lStart : lCount);    #else    long lLoopCntr;    long lEnd;    lEnd = ((lStart + lCount) > lLength) ? lLength : (lStart + lCount);    for (lLoopCntr = 0L; lLoopCntr < lEnd; lLoopCntr++)    {        spCplxDest[lLoopCntr].R = sCplxSrc.R;        spCplxDest[lLoopCntr].I = sCplxSrc.I;    }    #endif}void clDSPOp::Set (stpDCplx spCplxDest, stDCplx sCplxSrc, long lStart,    long lCount, long lLength){    #ifdef DSP_IPP    ippsSet_64fc(*((Ipp64fc *) &sCplxSrc), (Ipp64fc *) spCplxDest,        ((lStart + lCount) > lLength) ? lLength - lStart : lCount);    #else    long lLoopCntr;    long lEnd;    lEnd = ((lStart + lCount) > lLength) ? lLength : (lStart + lCount);    for (lLoopCntr = 0L; lLoopCntr < lEnd; lLoopCntr++)    {        spCplxDest[lLoopCntr].R = sCplxSrc.R;        spCplxDest[lLoopCntr].I = sCplxSrc.I;    }    #endif}void clDSPOp::Clip (float *fpVect, float fValue, long lCount){    #ifdef DSP_IPP    ippsThreshold_GT_32f_I(fpVect, lCount, fValue);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (fpVect[lLoopCntr] > fValue)        {            fpVect[lLoopCntr] = fValue;        }        #else        if (isgreater(fpVect[lLoopCntr], fValue))        {            fpVect[lLoopCntr] = fValue;        }        #endif    }    #endif}void clDSPOp::Clip (double *dpVect, double dValue, long lCount){    #ifdef DSP_IPP    ippsThreshold_GT_64f_I(dpVect, lCount, dValue);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (dpVect[lLoopCntr] > dValue)        {            dpVect[lLoopCntr] = dValue;        }        #else        if (isgreater(dpVect[lLoopCntr], dValue))        {            dpVect[lLoopCntr] = dValue;        }        #endif    }    #endif}void clDSPOp::Clip (float *fpDest, const float *fpSrc, float fValue,     long lCount){    #ifdef DSP_IPP    ippsThreshold_GT_32f(fpSrc, fpDest, lCount, fValue);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        fpDest[lLoopCntr] = (fpSrc[lLoopCntr] > fValue) ?             fValue : fpSrc[lLoopCntr];        #else        fpDest[lLoopCntr] = (isgreater(fpSrc[lLoopCntr], fValue)) ?            fValue : fpSrc[lLoopCntr];        #endif    }    #endif}void clDSPOp::Clip (double *dpDest, const double *dpSrc, double dValue,    long lCount){    #ifdef DSP_IPP    ippsThreshold_GT_64f(dpSrc, dpDest, lCount, dValue);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        dpDest[lLoopCntr] = (dpSrc[lLoopCntr] > dValue) ?            dValue : dpSrc[lLoopCntr];        #else        dpDest[lLoopCntr] = (isgreater(dpSrc[lLoopCntr], dValue)) ?            dValue : dpSrc[lLoopCntr];        #endif    }    #endif}void clDSPOp::Clip (float *fpVect, float fMin, float fMax, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_32f_I(fpVect, lCount, fMin);    ippsThreshold_GT_32f_I(fpVect, lCount, fMax);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (fpVect[lLoopCntr] < fMin)        {            fpVect[lLoopCntr] = fMin;        }        else if (fpVect[lLoopCntr] > fMax)        {            fpVect[lLoopCntr] = fMax;        }        #else        if (isless(fpVect[lLoopCntr], fMin))        {            fpVect[lLoopCntr] = fMin;        }        else if (isgreater(fpVect[lLoopCntr], fMax))        {            fpVect[lLoopCntr] = fMax;        }        #endif    }    #endif}void clDSPOp::Clip (double *dpVect, double dMin, double dMax, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_64f_I(dpVect, lCount, dMin);    ippsThreshold_GT_64f_I(dpVect, lCount, dMax);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (dpVect[lLoopCntr] < dMin)        {            dpVect[lLoopCntr] = dMin;        }        else if (dpVect[lLoopCntr] > dMax)        {            dpVect[lLoopCntr] = dMax;        }        #else        if (isless(dpVect[lLoopCntr], dMin))        {            dpVect[lLoopCntr] = dMin;        }        else if (isgreater(dpVect[lLoopCntr], dMax))        {            dpVect[lLoopCntr] = dMax;        }        #endif    }    #endif}void clDSPOp::Clip (float *fpDest, const float *fpSrc, float fMin,     float fMax, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_32f(fpSrc, fpDest, lCount, fMin);    ippsThreshold_GT_32f_I(fpDest, lCount, fMax);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (fpSrc[lLoopCntr] < fMin)        {            fpDest[lLoopCntr] = fMin;        }        else if (fpSrc[lLoopCntr] > fMax)        {            fpDest[lLoopCntr] = fMax;        }        else        {            fpDest[lLoopCntr] = fpSrc[lLoopCntr];        }        #else        if (isless(fpSrc[lLoopCntr], fMin))        {            fpDest[lLoopCntr] = fMin;        }        else if (isgreater(fpSrc[lLoopCntr], fMax))        {            fpDest[lLoopCntr] = fMax;        }        else        {            fpDest[lLoopCntr] = fpSrc[lLoopCntr];        }        #endif    }    #endif}void clDSPOp::Clip (double *dpDest, const double *dpSrc, double dMin,     double dMax, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_64f(dpSrc, dpDest, lCount, dMin);    ippsThreshold_GT_64f_I(dpDest, lCount, dMin);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (dpSrc[lLoopCntr] < dMin)        {            dpDest[lLoopCntr] = dMin;        }        else if (dpSrc[lLoopCntr] > dMax)        {            dpDest[lLoopCntr] = dMax;        }        else        {            dpDest[lLoopCntr] = dpSrc[lLoopCntr];        }        #else        if (isless(dpSrc[lLoopCntr], dMin))        {            dpDest[lLoopCntr] = dMin;        }        else if (isgreater(dpSrc[lLoopCntr], dMax))        {            dpDest[lLoopCntr] = dMax;        }        else        {           dpDest[lLoopCntr] = dpSrc[lLoopCntr];        }        #endif    }    #endif}void clDSPOp::ClipZero (float *fpVect, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_32f_I(fpVect, lCount, 0.0f);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (fpVect[lLoopCntr] < 0.0F)        {            fpVect[lLoopCntr] = 0.0F;        }        #else        if (isless(fpVect[lLoopCntr], 0.0F))        {            fpVect[lLoopCntr] = 0.0F;        }        #endif    }    #endif}void clDSPOp::ClipZero (double *dpVect, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_64f_I(dpVect, lCount, 0.0);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        if (dpVect[lLoopCntr] < 0.0)        {            dpVect[lLoopCntr] = 0.0;        }        #else        if (isless(dpVect[lLoopCntr], 0.0))        {            dpVect[lLoopCntr] = 0.0;        }        #endif    }    #endif}void clDSPOp::ClipZero (float *fpDest, const float *fpSrc, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_32f(fpSrc, fpDest, lCount, 0.0f);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        fpDest[lLoopCntr] = (fpSrc[lLoopCntr] < 0.0F) ?             0.0F : fpSrc[lLoopCntr];        #else        fpDest[lLoopCntr] = (isless(fpSrc[lLoopCntr], 0.0F)) ?            0.0F : fpSrc[lLoopCntr];        #endif    }    #endif}void clDSPOp::ClipZero (double *dpDest, const double *dpSrc, long lCount){    #ifdef DSP_IPP    ippsThreshold_LT_64f(dpSrc, dpDest, lCount, 0.0);    #else    long lLoopCntr;    for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)    {        #if (!defined(_ISOC9X_SOURCE) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)))        dpDest[lLoopCntr] = (dpSrc[lLoopCntr] < 0.0) ?            0.0 : dpSrc[lLoopCntr];        #else        dpDest[lLoopCntr] = (isless(dpSrc[lLoopCntr], 0.0)) ?            0.0 : dpSrc[lLoopCntr];        #endif    }    #endif}void clDSPOp::Copy (float *fpDest, const float *fpSrc, long lCount){    #ifdef DSP_IPP    ippsMove_32f(fpSrc, fpDest, lCount);    #else    #ifndef USE_MEMMOVE    long lLoopCntr;    #ifdef DSP_X86    if (bHave3DNow)    {        if (likely(fpDest <= fpSrc || abs(fpDest - fpSrc) > lCount))        {            dsp_x86_3dnow_copyf(fpDest, fpSrc, lCount);        }        else        {            for (lLoopCntr = lCount - 1L; lLoopCntr >= 0L; lLoopCntr--)            {                fpDest[lLoopCntr] = fpSrc[lLoopCntr];            }        }    }    else    #endif    {        if (likely(fpDest <= fpSrc || abs(fpDest - fpSrc) > lCount))        {            for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)            {                fpDest[lLoopCntr] = fpSrc[lLoopCntr];            }        }        else        {            for (lLoopCntr = lCount - 1L; lLoopCntr >= 0L; lLoopCntr--)            {                fpDest[lLoopCntr] = fpSrc[lLoopCntr];            }        }    }    #else    #ifndef DSP_X86    memmove(fpDest, fpSrc, lCount * sizeof(float));    #else    memmove(fpDest, fpSrc, (lCount << 2));    #endif    #endif    #endif}void clDSPOp::Copy (double *dpDest, const double *dpSrc, long lCount){    #ifdef DSP_IPP    ippsMove_64f(dpSrc, dpDest, lCount);    #else    #ifndef USE_MEMMOVE    long lLoopCntr;    #ifdef DSP_X86    if (bHave3DNow)    {        if (likely(dpDest <= dpSrc || abs(dpDest - dpSrc) > lCount))        {            dsp_x86_3dnow_copyd(dpDest, dpSrc, lCount);        }        else        {            for (lLoopCntr = lCount - 1L; lLoopCntr >= 0L; lLoopCntr--)            {                dpDest[lLoopCntr] = dpSrc[lLoopCntr];            }        }    }    else    #endif    {        if (likely(dpDest <= dpSrc || abs(dpDest - dpSrc) > lCount))        {            for (lLoopCntr = 0L; lLoopCntr < lCount; lLoopCntr++)            {                dpDest[lLoopCntr] = dpSrc[lLoopCntr];            }        }        else        {            for (lLoopCntr = lCount - 1L; lLoopCntr >= 0L; lLoopCntr--)            {                dpDest[lLoopCntr] = dpSrc[lLoopCntr];            }        }    }    #else    #ifndef DSP_X86    memmove(dpDest, dpSrc, lCount * sizeof(double));    #else    memmove(dpDest, dpSrc, (lCount << 3));    #endif    #endif    #endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -