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

📄 mp3dec_layer1_int.c

📁 audio-video-codecs.rar语音编解码器
💻 C
字号:
/*//////////////////////////////////////////////////////////////////////////////
//
//                  INTEL CORPORATION PROPRIETARY INFORMATION
//     This software is supplied under the terms of a license agreement or
//     nondisclosure agreement with Intel Corporation and may not be copied
//     or disclosed except in accordance with the terms of that agreement.
//          Copyright(c) 2003-2006 Intel Corporation. All Rights Reserved.
//
*/

#include "mp3dec_own_int.h"

/* Q31 */
static Ipp32s mp3dec_l1_dequant_tabled[] = {
              0,
     1431655808,
     1227133571,
     1145324670,
     1108378624,
     1090785410,
     1082196483,
     1077952643,
     1075843072,
     1074791425,
     1074266369,
     1074004097,
     1073872895,
     1073807361,
     1073774590,
};

/* Q28 */
static Ipp32s scale_values_int[3] = {
      268435456,
      213057360,
      169103744,
};

Ipp32s mp3idec_decode_data_LayerI(MP3Dec *state)
{
    Ipp32s i, ch, sb;
    Ipp32s (*sample)[32][36] = state->com.sample;
    Ipp16s (*scalefactor)[32] = state->com.scalefactor_l1;
    Ipp16s (*allocation)[32] = state->com.allocation;
    sampleintrw *smpl_rw = state->smpl_rw;     // out of imdct
    Ipp32s stereo = state->com.stereo;
    Ipp16s *m_pOutSamples = state->com.m_pOutSamples;

    for (ch = 0; ch < stereo; ch++) {
        for (sb = 0; sb < 32; sb++) {
            if (allocation[ch][sb] != 0) {
                Ipp32s idx = allocation[ch][sb] + 1;
                Ipp32s xor_coef;
                Ipp32s *sample_ptr = &sample[ch][sb][0];
                Ipp32s scale_fact, scale_mul, scale_shift, scale_mod;

                xor_coef = (1 << (idx - 1));
                scale_fact = scalefactor[ch][sb];
                scale_shift = scale_fact / 3;
                scale_mod = scale_fact - scale_shift * 3;
                scale_mul = MUL32_MP3_32S(scale_values_int[scale_mod],
                    mp3dec_l1_dequant_tabled[allocation[ch][sb]]);

                for (i = 0; i < 12; i++) {
                    Ipp32s smpl = ((sample_ptr[i] ^ xor_coef) + 1) << (32 - idx) >> scale_shift;
                    (*smpl_rw)[ch][i][sb] =
                        MUL32_MP3_32S(smpl, scale_mul);
                }
            } else {
                for (i = 0; i < 12; i++) {
                    (*smpl_rw)[ch][i][sb] = 0;
                }
            }
        }  // for sb

        for (i = 0; i < 12; i++) {
            ippsSynthPQMF_MP3_32s16s((Ipp32s *)&((*(state->smpl_rw))[ch][i][0]),
                m_pOutSamples + 32 * stereo * i + ch,
                state->synth_buf + IPP_MP3_V_BUF_LEN * ch,
                &(state->synth_ind[ch]),
                stereo);
        }
    }    // for ch

    return 1;
}

⌨️ 快捷键说明

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