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

📄 umc_mp3_encoder.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
字号:
/*//////////////////////////////////////////////////////////////////////////////////                  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) 2002-2005 Intel Corporation. All Rights Reserved.//*/#ifndef __UMC_MP3_ENCODER_H__#define __UMC_MP3_ENCODER_H__#include "ippac.h"#include "ippdc.h"#include "ipps.h"#include "umc_media_data.h"#include "umc_audio_codec.h"#include "vm_debug.h"#include "bstream.h"#include "mp3enc_psychoacoustic.h"#include "mp3enc_hufftables.h"#include "mp3enc_tables.h"#include <math.h>#define SI_MAX 10#ifndef PI#define PI 3.14159265359f#endifextern const float mp3enc_Ccoef[64][15];namespace UMC {/* ///////////////////////////////////////////////////////////////////////////////  Class:       MP3Encoder////  Notes:       Implementation of MPEG-I layer 3 encoder.//*/  class   MP3Encoder:public AudioCodec {  public:    Status  Init(BaseCodecParams * init);    Status  Close();    Status  GetFrame(MediaData * in, MediaData * out);    Status  GetInfo(BaseCodecParams * init);    Status  GetDuration(float *p_duration);            MP3Encoder(void);           ~MP3Encoder();    Status  SetParams(BaseCodecParams * params);    Status  Reset();    IppBool CheckBitRate(int br, int &idx);  protected:    struct _HuffmanTable {      void    *phuftable;      short   mav_value;      short   linbits;    };// protected internal functions    void    mdctInit();    int     huffamInit();    void    windowSubBandInit();    void    huffmanCodeBits(int gr, int ch);    void    encodeBigValues(short *pInput, int gr, int ch);    int     encodeSideInfo();    void    encodeMainData();    int     WriteFrame(int si_bits, int bits, unsigned char *pOutputData);    int     formatBitstream(unsigned char *pOutputData);    int     windowSubBand(float *input, float *output, int ch);    int     mdctInSubband(float *in, float *out, int block_type);    int     mdctBlock();    int     quantization();    int     chooseTableLong(int gr, int ch, short *pInput, int length,                            int table);    int     calcBitsLong(short *pInput, int gr, int ch);    int     calcBits(int gr, int ch, short *ipptmp0_576);    void    calcAvailableBits();    void    iterReset(int gr, int ch);    int     calcPart2Len(int gr, int ch);    int     scaleBitCount(int gr, int ch);    void main_loop(int gr, int ch,                   Ipp32f* mdct_scaled,                   short *ipptmp0_576);    void PsychoacousticInit();    void PsychoacousticFree();    void Psychoacoustic(float *input_data, int gr, int ch);    void psy_long_window(float *input_data,                        float* rsqr_long, int ch);    void psy_short_window(float *input_data,                        Ipp32f *s_en,                        Ipp32f* rsqr_short, int ch);    // data// filter_bank    VM_ALIGN16_DECL(float)   filter_bfr[2][64][8];    IppsDCTInvSpec_32f *pDCTSpec;// mdct    IppsMDCTFwdSpec_32f *pMDCTSpec12;    IppsMDCTFwdSpec_32f *pMDCTSpec36;    VM_ALIGN16_DECL(float) mdct_win[4][36];    float   ca[8], cs[8];    typedef float samplefbout[2][18][32];//  ------//-------    VM_ALIGN16_DECL(float) input_buffer[2][448 + 1152];    VM_ALIGN16_DECL(samplefbout) fbout_data[3];    VM_ALIGN16_DECL(float) mdct_out[2][2][576];//  Quantization    VM_ALIGN16_DECL(short) quant_ix[2][2][576];    VM_ALIGN16_DECL(unsigned short) scalefac_l[2][2][32];    VM_ALIGN16_DECL(unsigned short) scalefac_s[2][2][12][3];    samplefbout *fbout[3];    int fbout_prev;    int     max_bits[2][2];   // max bit for encode granule//  huffman tables    _HuffmanTable htables[32];    IppMP3FrameHeader header;// wav parameters    int     stereo;    int     frameSize;// SIDE INFO    unsigned int si_main_data_begin;    unsigned int si_private_bits;    unsigned int si_part23Len[2][2];    unsigned int si_bigVals[2][2];    unsigned int si_count1[2][2];    short   si_globGain[2][2];    unsigned int si_sfCompress[2][2];    unsigned int si_winSwitch[2][2];    unsigned int si_blockType[2][2];    unsigned int si_mixedBlock[2][2];    unsigned int si_pTableSelect[2][2][3];    short   si_pSubBlkGain[2][2][3];    unsigned int si_address[2][2][3];    unsigned int si_reg0Cnt[2][2];    unsigned int si_reg1Cnt[2][2];    unsigned int si_preFlag[2][2];    unsigned int si_sfScale[2][2];    unsigned int si_cnt1TabSel[2][2];    unsigned int si_scfsi[2][4];    unsigned int si_part2Len[2][2];    unsigned int sfb_lmax, sfb_smax;// END OF SIDE INFO    IppsFFTSpec_R_32f *pFFTSpecLong[2];    IppsFFTSpec_R_32f *pFFTSpecShort[2];    sBitsreamBuffer mainStream;    sBitsreamBuffer sideStream;    unsigned int     buffer_main_data[1024];    unsigned int     buffer_side_info[256];    int     slot_size;    int     main_data_ptr;    int     resr_bytes;    int     resr_mod_slot;    int     framesNum;    int     m_even[2];    int     m_line[2][2];    double  m_norm;    int     start_common_scalefac;    int     finish_common_scalefac;    int     common_scalefactor_update[2];    int     last_frame_common_scalefactor[2];    int quant_mode_fast;    int    pa_iblen_long; // = 512    int    pa_iblen_short;// = 128    VM_ALIGN16_DECL(float) pa_r[2][3][512];    VM_ALIGN16_DECL(float) pa_re[2][3][512];    VM_ALIGN16_DECL(float) pa_im[2][3][512];    VM_ALIGN16_DECL(float) pa_r_short[2][3][3][128];    VM_ALIGN16_DECL(float) pa_re_short[2][3][3][128];    VM_ALIGN16_DECL(float) pa_im_short[2][3][3][128];    int   pa_current_f_r_index[2];  // Can be 0, 1, 2    float pa_next_frame_PE[2];    float pa_curr_frame_PE[2];    float pa_curr_frame_PE_st[2][2];    int    pa_num_ptt_long;    int    pa_num_ptt_short;    VM_ALIGN16_DECL(float) pa_hann_window_long[512*2];    VM_ALIGN16_DECL(float) pa_hann_window_short[128*2];    float pa_sprdngf_long[MAX_PPT_LONG * MAX_PPT_LONG];    float pa_sprdngf_short[MAX_PPT_SHORT * MAX_PPT_SHORT];    float pa_rnorm_long[MAX_PPT_LONG];    float pa_rnorm_short[MAX_PPT_SHORT];    float  pa_nb_long[2][2][MAX_PPT_LONG];    float  pa_nb_short[2][2][8][MAX_PPT_SHORT];    int    pa_nb_curr_index[2];    int    pa_nb_prev_index[2];    int pa_block_type[2];    int pa_desired_block_type[2];    IppsFFTSpec_R_32f* pa_pFFTSpecShort;    Ipp8u* pa_pBufferShort;    IppsFFTSpec_R_32f* pa_pFFTSpecLong;    Ipp8u* pa_pBufferLong;    int lowpass_maxline;    unsigned char si_buf[SI_MAX][40];    int si_beg, si_new, si_num;  };};      // namespace UMC#endif /* __UMC_MP3_ENCODER_H__ */

⌨️ 快捷键说明

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