欢迎来到天天文库
浏览记录
ID:57650370
大小:30.50 KB
页数:5页
时间:2020-08-30
《silk音频编解码C++类.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、/*silkcodec头文件*//**QQ:617242746*Developer:yu*Time:2013.4.16*/#ifndef_SILKCODEC_H_#define_SILKCODEC_H_#include"interface/SKP_Silk_SDK_API.h"#include#include#pragmacomment(lib,"silk.lib")#defineMAX_BYTES_PRE_FRAME250#defineMAX_INPUT_FRAME5#defineMAX
2、_API_FS_KHZ48#defineFRAME_LENGTH_MS20#defineSAFE_DELETE_ELEMENT(hp)if(hp!=NULL){deletehp;hp=NULL;}classSilkEncoder{public:SilkEncoder();~SilkEncoder();voidInitEncoder();voidSetEncoderParameter();voidCreateEncoder();voidStartEncoder(constSKP_int16*samplesIn,SKP_intco
3、unter,SKP_uint8**samplesOut,SKP_int16*bytesOut);private:SKP_SILK_SDK_EncControlStructm_encControl;SKP_SILK_SDK_EncControlStructm_encStatus;char*m_psEnc;SKP_int32m_enSizeBytesEncode;//SKP_int16in[FRAME_LENGTH_MS*MAX_API_FS_KHZ*MAX_INPUT_FRAME];SKP_uint8*m_payloadEnco
4、de;SKP_int16m_nBytesEncode;/*param*/SKP_intm_packetSize_ms;SKP_intm_API_fs_Hz;SKP_intm_bitRate;SKP_intm_complexity;};classSilkDecoder{public:SilkDecoder();~SilkDecoder();voidInitDecoder();voidSetDecoderParameter();voidCreateDecoder();voidStartDecoder(SKP_uint8*inDat
5、a,SKP_intnBytesIn,SKP_int16**samplesOutDec,SKP_int16*nSamplesOutDec);private:SKP_SILK_SDK_DecControlStructm_decControl;SKP_int32m_enSizeBytesDecode;char*m_psDec;SKP_int16*m_samplesOutDecode;SKP_int16m_nSamplesOutDecode;/*param*/SKP_intm_packetSize_ms;SKP_intm_API_sa
6、mpleRate;SKP_intm_framesPerPacket;};#endif/*silkcodec源文件*/#include"silkcodec.h"SilkEncoder::SilkEncoder(){m_packetSize_ms=20;m_API_fs_Hz=16000;m_bitRate=24000;m_complexity=2;m_nBytesEncode=MAX_BYTES_PRE_FRAME*MAX_INPUT_FRAME;m_payloadEncode=newunsignedchar[MAX_BYTES
7、_PRE_FRAME*MAX_INPUT_FRAME];memset(m_payloadEncode,0,MAX_BYTES_PRE_FRAME*MAX_INPUT_FRAME);m_psEnc=NULL;}SilkEncoder::~SilkEncoder(){/*if(m_payloadEncode!=NULL){deletem_payloadEncode;m_payloadEncode=NULL;}*/SAFE_DELETE_ELEMENT(m_payloadEncode);/*if(m_psEnc!=NULL){del
8、etem_psEnc;m_psEnc=NULL;}*/SAFE_DELETE_ELEMENT(m_psEnc);}voidSilkEncoder::SetEncoderParameter(){m_encControl.API_sampleRate=m_API_fs_Hz;m_
此文档下载收益归作者所有