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

📄 umc_mp3_enc_int.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_ENC_INT_H__#define __UMC_MP3_ENC_INT_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#define MUL32_MP3_32S(x, y) \  (Ipp32s)(((Ipp64s)((Ipp64s)(x) * (Ipp64s)(y)))>>32)#define _IPPS_MUL32_MP3_32S MUL32_MP3_32Snamespace UMC {/* ///////////////////////////////////////////////////////////////////////////////  Class:       MP3EncoderInt////  Notes:       Implementation of MPEG-I layer 3 encoder.//*/  class   MP3EncoderInt:public AudioCodec {  public:    Status  Init(BaseCodecParams * init);    Status  Close();    Status  GetFrame(MediaData * in, MediaData * out);    Status  GetInfo(BaseCodecParams * init);    Status  GetDuration(float *p_duration);            MP3EncoderInt(void);           ~MP3EncoderInt();    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    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     mdctInSubband(int *in, int *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,                   Ipp16s* mdct_scaled_short,                   int pow34_scaleFact,                   short *ipptmp0_576);    void InitPsychoacoustic();    void InitPsychoacoustic_fp();    Status InitPsychoacousticCom();    void FreePsychoacoustic();    void FreePsychoacoustic_fp();    void Psychoacoustic(Ipp16s *input_data, int gr, int ch);    void psy_long_window(Ipp16s *input_data,                         Ipp32s* rsqr_long,                         Ipp32s* rsqr_longScale,                         int ch);    void psy_short_window(Ipp16s *input_data,                        Ipp32s* s_en,                        Ipp32s* rsqr_short,                        Ipp32s* rsqr_shortScale,                        int ch);    // data// mdct    int   ca_int[8], cs_int[8];    typedef int samplefbout[2][18][32];//  ------//-------    VM_ALIGN16_DECL(short) input_buffer_short[2][1152 + 224 + 576];    VM_ALIGN16_DECL(samplefbout) fbout_data[3];    VM_ALIGN16_DECL(int) mdct_out_int[2][2][576];//  Quantization    VM_ALIGN16_DECL(short) quant_ix[2][2][576];    VM_ALIGN16_DECL(unsigned short) scalefac_l[2][2][32];    unsigned short scalefac_s[2][2][12][3];    samplefbout *fbout_int[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    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];    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(short) ipa_r[2][3][512];    VM_ALIGN16_DECL(short) ipa_re[2][3][512];    VM_ALIGN16_DECL(short) ipa_im[2][3][512];    VM_ALIGN16_DECL(short) ipa_r_short[2][3][3][128];    VM_ALIGN16_DECL(short) ipa_re_short[2][3][3][128];    VM_ALIGN16_DECL(short) ipa_im_short[2][3][3][128];    int   pa_current_f_r_index[2];  // Can be 0, 1, 2    int   ipa_current_f_r_index[2];  // Can be 0, 1, 2    int ipa_next_frame_PE[2];    int ipa_curr_frame_PE[2];    int ipa_curr_frame_PE_st[2][2];    int    pa_num_ptt_long;    int    pa_num_ptt_short;    short ipa_sprdngf_long[MAX_PPT_LONG * MAX_PPT_LONG];    short ipa_sprdngf_short[MAX_PPT_SHORT * MAX_PPT_SHORT];    int  ipa_nb_long[2][2][MAX_PPT_LONG];    int  ipa_nb_short[2][2][8][MAX_PPT_SHORT];    int  pa_nb_curr_index[2];    int  pa_nb_prev_index[2];    int  ipa_nb_curr_index[2];    int  ipa_nb_prev_index[2];    int  pa_block_type[2];    int  pa_desired_block_type[2];    int  ipa_block_type[2];    int  ipa_desired_block_type[2];    int                 ipa_rScaleFactor[2][3];    int                 ipa_nb_longScaleFactor[2];    int                 ipa_longScale;    IppsFFTSpec_R_16s* ipa_pFFTSpecShort;    Ipp8u* ipa_pBuffer;    IppsFFTSpec_R_16s* ipa_pFFTSpecLong;    int lowpass_maxline;    unsigned char si_buf[SI_MAX][40];    int si_beg, si_new, si_num;  };};      // namespace UMC#endif /* __UMC_MP3_ENC_INT_H__ */

⌨️ 快捷键说明

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