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

📄 mp3dec_layer3_fp.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
📖 第 1 页 / 共 3 页
字号:
            for (sfb = 0; sfb < sfbEnd; sfb++)                sf_tmp[sfb] = scl * ScaleFactors[ch].l[sfb];            ippsCalcSF_16s32f(sf_tmp, 0, tmp13[0], sfbEnd);            ippsMulC_32f_I(xx, tmp13[0], sfbEnd);            ippsScale_32f_I((*smpl_xr)[ch], tmp13[0], sfb_long, sfbEnd);        }        ippsCalcSF_16s32f(si_pSubBlkGain[gr][ch], 0, tmpSF, 3);        for (wnd = 0; wnd < 3; wnd++) {            for (sfb = sfbStart; sfb <= 12; sfb++)                sf_tmp[sfb] = scl * ScaleFactors[ch].s[wnd][sfb];            ippsCalcSF_16s32f(sf_tmp, 0, tmp13[wnd], 13);            ippsMulC_32f_I(xx * tmpSF[wnd], tmp13[wnd], 13);        }        j = sfb_long[sfbEnd];        for (sfb = sfbStart; sfb <= 12; sfb++) {            n = sfb_short[sfb + 1] - sfb_short[sfb];            for (wnd = 0; wnd < 3; wnd++) {                ippsScale_32f_I(&((*smpl_xr)[ch][j]) - sfb_short[sfb], &tmp13[wnd][sfb], sfb_short + sfb, 1);                j += n;            }        } // for    }    while(count > 0 && ((int *)((*smpl_xr)[ch]))[count - 1] == 0)        count --;    state->com.non_zero[ch] = count;    ippsMulC_32f_I(32768, (*smpl_xr)[ch], count);    return 1;}/******************************************************************************//  Name://    Reordering////  Description:////////  Input Arguments://    DC - point to sDecoderContext structure//    gr - number of granule//    ch - number of channel////  Output Arguments://    smpl_ro - array of reordered samples////  Returns://    1 - all ok//******************************************************************************/static int mp3dec_Reordering(MP3Dec *state, int gr, int ch){    float   tmp_buf[576];    float   *dstPtr, *srcPtr;    int     i, sfb, shift, startSfb;    IppMP3FrameHeader *header = &(state->com.header);    unsigned int (*si_blockType)[2] = state->com.si_blockType;    unsigned int (*si_mixedBlock)[2] = state->com.si_mixedBlock;    unsigned int (*si_winSwitch)[2] = state->com.si_winSwitch;    samplefloat *smpl_xr = state->smpl_xr;       /* out of dequantizer */    if (si_winSwitch[gr][ch] && (si_blockType[gr][ch] == 2)) {        int *sfbShort = mp3dec_sfBandIndex[header->id][header->samplingFreq].s;        if (si_mixedBlock[gr][ch]) {            shift = sfbShort[3] * 3;            startSfb = 3;        } else {            shift = 0;            startSfb = 0;        }        srcPtr = (*smpl_xr)[ch] + shift;        dstPtr = tmp_buf;        for (sfb = startSfb; sfb < 13; sfb++) {            int w = sfbShort[sfb + 1] - sfbShort[sfb];            for (i = 0; i < w; i++) {                dstPtr[0] = srcPtr[0];                dstPtr[1] = srcPtr[w];                dstPtr[2] = srcPtr[2*w];                dstPtr += 3; srcPtr++;            }            srcPtr += 2*w;        }        ippsCopy_32f(tmp_buf, (*smpl_xr)[ch] + shift, 576 - shift);    }    return 1;}/******************************************************************************//  Name://    Antialiasing////  Description:////////  Input Arguments://    DC - point to sDecoderContext structure//    gr - number of granule//    ch - number of channel////  Output Arguments://    smpl_re - array of spectrum samples////  Returns://    1 - all ok//******************************************************************************/static int mp3dec_Antialiasing(MP3Dec *state, int gr, int ch) {    int     sblim, freqline, i, idx1, idx2;    float   bu, bd;    unsigned int (*si_blockType)[2] = state->com.si_blockType;    unsigned int (*si_mixedBlock)[2] = state->com.si_mixedBlock;    unsigned int (*si_winSwitch)[2] = state->com.si_winSwitch;    samplefloat *smpl_re = state->smpl_re;       // out of huffman    samplefloat *smpl_ro = state->smpl_ro;       // out of huffman    int nz, freqline_end;    if (si_winSwitch[gr][ch] && (si_blockType[gr][ch] == 2) &&        !si_mixedBlock[gr][ch])        return 1;    if (si_winSwitch[gr][ch] && (si_blockType[gr][ch] == 2) &&        si_mixedBlock[gr][ch])        return 1;    else        sblim = 31;    freqline_end = sblim * 18;    nz = state->com.non_zero[ch] - 10;    if (freqline_end > nz)        freqline_end = nz;    for (freqline = 0; freqline < freqline_end; freqline += 18) {        for (i = 0; i < 8; i++) {            idx1 = freqline + 17 - i;            idx2 = freqline + 18 + i;            bu = (*smpl_ro)[ch][idx1];            bd = (*smpl_ro)[ch][idx2];            (*smpl_re)[ch][idx1] = (bu * cs[i]) - (bd * ca[i]);            (*smpl_re)[ch][idx2] = (bd * cs[i]) + (bu * ca[i]);        }    }    return 1;}/******************************************************************************//  Name://    Joint stereo////  Description://    MS stereo & intensity streo implementation//////  Input Arguments://////  Output Arguments://////  Returns://    1 - all ok//******************************************************************************/static int mp3dec_JointStereo(MP3Dec *state, int gr){    const float mult = 0.7071067811865475244f;    int isPos[39], found[3];    int *width;    int *scalefPtr, *widthPtr;    float *ptrL, *ptrR;    float li, ri;    float k[2];    int illegal;    int numSfbLong, numSfbShort, numSfb;    int sfbStart, sfbEnd, numBlock;    int i, j, sfb, w;    int blocknumber = state->com.blocknumber;    int blocktypenumber = state->com.blocktypenumber;    IppMP3FrameHeader *header = &(state->com.header);    int     intensity = state->com.intensity;    int     ms_stereo = state->com.ms_stereo;    int *s_len = state->com.s_len;    unsigned int (*si_blockType)[2] = state->com.si_blockType;    unsigned int (*si_mixedBlock)[2] = state->com.si_mixedBlock;    unsigned int (*si_sfCompress)[2] = state->com.si_sfCompress;    sScaleFactors *ScaleFactors = state->com.ScaleFactors;    samplefloat *smpl_xr = state->smpl_xr; /* out of dequantizer */    int nz = state->com.non_zero[0];    if (!intensity) {        ptrL = &((*smpl_xr)[0][0]);        ptrR = &((*smpl_xr)[1][0]);        for (i = 0; i < nz; i++) {            li = mult * (ptrL[0] + ptrR[0]);            ri = mult * (ptrL[0] - ptrR[0]);            ptrL[0] = li;            ptrR[0] = ri;            ptrL++; ptrR++;        }        return 1;    }    scalefPtr = isPos;    if (si_blockType[gr][1] == 2) {        if (si_mixedBlock[gr][1]) {            numSfbLong = sfBandNum[header->id][2][0];            numSfbShort = sfBandNum[header->id][2][1];            width = sfBandWidths[header->id][header->samplingFreq].m;            for (sfb = 0; sfb < numSfbLong; sfb++) {                *scalefPtr = ScaleFactors[1].l[sfb];                scalefPtr++;            }            for (sfb = 3; sfb < 12; sfb++) {                for (i = 0; i < 3; i++) {                    *scalefPtr = ScaleFactors[1].s[i][sfb];                    scalefPtr++;                }            }        } else {            numSfbLong = sfBandNum[header->id][1][0];            numSfbShort = sfBandNum[header->id][1][1];            width = sfBandWidths[header->id][header->samplingFreq].s;            for (sfb = 0; sfb < 12; sfb++) {                for (i = 0; i < 3; i++) {                    *scalefPtr = ScaleFactors[1].s[i][sfb];                    scalefPtr++;                }            }        }        for (i = 0; i < 3; i++) {            *scalefPtr = 0;            scalefPtr++;        }    } else {        numSfbLong = sfBandNum[header->id][0][0];        numSfbShort = sfBandNum[header->id][0][1];        width = sfBandWidths[header->id][header->samplingFreq].l;        for (sfb = 0; sfb < 21; sfb++) {            *scalefPtr = ScaleFactors[1].l[sfb];            scalefPtr++;        }        *scalefPtr = 0;    }    if (header->id) {        illegal = 7;    } else {        illegal = 100;    }    numSfb = numSfbLong + numSfbShort * 3;    widthPtr = width + numSfb - 1;    ptrR = &((*smpl_xr)[1][576]);    found[0] = found[1] = found[2] = 0;    sfbStart = numSfb;    sfbEnd = numSfbLong;    numBlock = 3;    for (j = 0; j < 2; j++) {        for (sfb = sfbStart - 1; sfb >= sfbEnd; sfb-=numBlock) {            for (i = 0; i < numBlock; i++) {                float tmp;                w = *widthPtr;                widthPtr--;                ptrR -= w;                if (found[i] == 0) {                    ippsDotProd_32f(ptrR, ptrR, w, &tmp);                    if (tmp > 0) {                        isPos[sfb - i] = illegal;                        found[i] = 1;                    }                } else {                    isPos[sfb - i] = illegal;                }            }        }        found[0] += (found[1] + found[2]);        sfbStart = sfbEnd;        sfbEnd = 0;        numBlock = 1;    }    if (header->id == 0) {        unsigned char *ptr = mp3dec_nr_of_sfb[blocknumber][blocktypenumber];        scalefPtr = isPos;        for (i = 0; i < 4; i++) {            for (i = 0; i < 4; i++) {                int num = ptr[i];                int len = s_len[i];                if (len) {                    int tmp = (1 << len) - 1;                    for (sfb = 0; sfb < num; sfb++) {                        if (*scalefPtr == tmp) {

⌨️ 快捷键说明

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