




已阅读5页,还剩10页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Ecshop中插件icoolmedia的相关算法,不同的效果我们想要达到很简单需要找到一个平衡点,利用代码结构完成ifndef NS_H,从而达到一个有效利用率的提升。下面就上代码、 spx_ifft(inHandle-fft_table,inHandle-ft,szAudio); / overlap and add for(i = 0; i frame_size; i+) ioPcmi = inHandle-outbufi + szAudioi; for(i = 0; i frame_size; i+) inHandle-outbufi = szAudioinHandle-frame_size+i*inHandle-win_gain; / limit value of adapt_count if(inHandle-adapt_count 16000) inHandle-adapt_count = 2;文件 ns.h 455B / 本文来自于icoolmedia,相关算法请参考ifndef NS_H#define NS_H#include Platform.h#ifdef _cplusplusextern C #endiftypedef struct NoiseReduction_t NoiseReduction;NoiseReduction* NoiseReductionCreate(OsInt32 inSampleRate,OsInt32 inFrameSize);void NoiseReductionDestroy(NoiseReduction *inHandle);void NoiseReductionProcess(NoiseReduction *inHandle,OsInt16 *ioPcm);#ifdef _cplusplus#endif#endif文件 Platform.h 6KB /* * Copyright (c) 2013 刘志鹏. All Rights Reserved. */#ifndef PLATFORM_H#define PLATFORM_H#if defined(_WIN32) | defined(WIN32) | defined(_WIN64)#define OS_WINSYS 1#elif defined(_linux_) | defined(_linuxppc_) | defined(_FreeBSD_)#define OS_LINUX 2#elif defined(_MacOSX_) | defined(_APPLE_) | defined(_MACH_)#define OS_APPLE 3#endif/ Windows systems version#define OS_NONE 0 / 错误#define OS_WIN2000 1 / Windows 2000#define OS_WINXP 2 / Windows XP#define OS_WINVISTA 3 / Windows Vista#define OS_WIN7 4 / Win7#define OS_WIN8 5 / Win8#define OS_WIN8_1 6 / Win8.1#include #include #include #include #include #include #include #ifdef _cplusplus#include #include #include #include #include #include #include #else#include #include #endif#ifdef OS_WINSYS/ for CoInitializeEx#define _WIN32_DCOM/#include /#include #include #include #include #ifndef _MINGW32_#ifdef _cplusplus#include #endif#endif#include #include #include #include #include #elif OS_LINUX#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #elif OS_APPLE/* type defines for all platforms */#else#error No platform defined for OS (Platform.h)#endif Shopnc中对于链接器使用代码是很复杂的,好多链接器的代码实现功能的同时会大量占用内存管理的crp,同时产生crp磁盘碎片,对于这个的利用一直是一个难题,这里举例一个小功能让他实现的更加完善。#if _GNUC_ = 4#define likely(x) _builtin_expect(!(x),1)#define unlikely(x) _builtin_expect(!(x),0)#else#define likely(x) (x)#define unlikely(x) (x)#endif#define OS_INLINE _attribute_(_always_inline_) inline#define OS_NOINLINE _attribute_(noinline)#endif#ifdef OS_WINSYS#define OS_EXTERN _declspec(dllexport)#else#if _GNUC_ = 4#define OS_EXTERN _attribute_(visibility(default)/ 配合链接器选项:-fvisibility=hidden#else#define OS_EXTERN / nothing#endif#endif#ifdef OS_DEBUG#define OsLog(inFile,inFormat,.) fprintf(inFile,inFormat,_VA_ARGS_)/ fprintf(inFile,inFormat# %d:%sn,_VA_ARGS_,_LINE_,_FUNCTION_)/ fprintf(inFile,inFormat# %d:%s - %sn,_VA_ARGS_,_LINE_,_FUNCTION_,_FILE_)#else#define OsLog(inFile,inFormat,.)#endif#endif / PLATFORM_H文件 TestNs.cpp 1KB / 本文来自于icoolmedia,相关算法QQ交流群为:374737122#include ns.h#include WavReader.h#include WavWriter.h #define OsLog(inFile,inFormat,.) (fprintf,VA_ARGS_)/ fprintf(inFile,inFormat# %d:%sn,_VA_ARGS_,_LINE_,_FUNCTION_)/ fprintf(inFile,inFormat#int main(int argc,char* argv) OsInt32 nLen = 160; OsInt32 nSampleRate = 8000; WavWriter *pWriter = new WavWriter(); while(nReadLen 0) short szPcm160 = 0; nReadLen = pReader-Read(szPcm,nLen); if(nReadLen 0) NoiseReductionProcess(pInst,szPcm); pWriter-Write(szPcm,nReadLen); assert(true = bRet); assert(0 != pWriter); bool bRet = pWriter-Open(.降噪后.wav,nSampleRate,16,1); assert(true = bRet); assert(0 != pReader); WavReader *pReader = /new WavReader(); NoiseReduction *pInst = NoiseReductionCreate(nSampleRate,nLen); assert(0 != pInst); bRet = pReader-Open(.带噪语音.wav); printf(开始降噪.n); int nReadLen = nLen; printf(降噪完成!n); NoiseReductionDestroy(pInst); delete pWriter; delete pReader; return 0;Ecshop代码发展中的实现单链接做法,下面进行深入代码分析,所以大家请看代码结构变化,注意下面列出了所有单链表的操作实例:文件 main.c 780B #include #include #include SingleLinkListOperator.hint main(int argc, char *argv) /*,需要用个那个操作,请关闭其他无关的操作函数*/ int ret; SLIST *sList = NULL; /*创建单链表,输出-1结束*/ sList = createSigLinkList(); /*打印单链表*/ ret = printSigLinkList(sList); /*在值为20的节点后添加值为25的节点*/ ret = insertDataToList(sList,20,25); /*删除值为20的节点,没有就不删*/ ret = deleteDataToList(sList,20); /*修改值为20的节点值为60,没有就不修改*/ ret = modefyDataToList(sList,20,60); /*逆置单链表*/ ret = reverseList(sList); /*打印单链表*/ ret = printSigLinkList(sList); /*释放单链表的资源*/ ret = destoryList(sList); return 0;文件 SingleLinkListOperator.h 808B #ifndef _SINGLELINKLIST_H_#define _SINGLELINKLIST_H_#ifdef _cplusplusextern C #endif/单链表的数据结构struct SLIST int data; struct SLIST *pNext; ;typedef struct SLIST SLIST; /新建单链表 SLIST * createSigLinkList(); /打印单链表 int printSigLinkList(SLIST *sList); /插入,在x值的节点后面插入y的节点 int insertDataToList(SLIST *sList/*in and out*/,int x/*in*/,int y/*in*/); /删除,删除x值节点 int deleteDataToList(SLIST *sList/*in and out*/,int x/*in*/); /修改,将x值节点的data修改为y值 int modefyDataToList(SLIST *sList/*inq and out*/,int x/*in*/,int y/*in*/); /释放单链表 int destoryList(SLIST *sList /*in*/); /逆置 int reverseList(SLIST *sList/*in and out*/); #ifdef _cplusplus #endif#endif文件 SingleLinkListOperator.c 4KB #include #include #include SingleLinkListOperator.h /新建单链表 SLIST * createSigLinkList() head = (SLIST *)malloc(sizeof(SLIST); printf(Please input a node of data:);int insertDataToList(SLIST *sList/*in and out*/,int x/*in*/,int y/*in*/); /删除,删除x值节点 int deleteDataToList(SLIST *sList/*in and out*/,int x/*in*/); /修改,将x值节点的data修改为y值 int modefyDataToList(SLIST *sList/*inq and out*/,int x/*in*/,int pNode = (SLIST *)malloc /(sizeof(SLIST); printf(Please input a node of data:);int insertDataToList(SLIST *sList/*in and out*/,int x/*in*/,int y/*in*/); /删除,删除x值节点 int deleteDataToList(SLIST *sList/*in and out*/,int x/*in*/); /修改,将x值节点的data修改为y值 int modefyDataToList(SLIST *sList/*inq and out*/,int int data; SLIST *pCur = NULL; /创建头结点(空的单链表) SLIST *head = NULL; head = (SLIST *)malloc(sizeof(SLIST); head-data = 0; head-pNext = NULL; pCur = head; /接受用户的输入节点数据 printf(Please input a node of data:); scanf(%d,&data); while(data != -1) SLIST *pNode = NULL; pNode = (SLIST *)malloc(sizeof(SLIST); pNode-data = data; pNode-pNext = NULL; pCur-pNext = pNode; pCur = pNode; /接受用户的输入节点数据 printf(Please input a node of data:); scanf(%d,&data); return head; /打印单链表 int printSigLinkList(SLIST *sList) SLIST *pCur = sList-pNext; if( pCur = NULL) printf(This SingleLinkList is null !n); return 0; printf(begin: ); while(pCur-pNext != NULL) printf(%d ,pCur-data); pCur = pCur-pNext; printf(%d endn,pCur-data); return 0; /插入,在x值的节点后面插入y的节点 ,这些就是代码ecshop单链接的表单处理方式,大家可以做个参考。使用libjpeg开源库,采用apr的内存管理,使用cJSON组装json数据,依赖opencv的函数库,linux平台文件 endecode.cpp 14KB #include endecode.hint main(int argc, char *argv) unsigned long long int i;Create_Pool(); /MG_DT_HANDLE handle_start1 = MG_DT_CreateHandle(); /handle_result = MG_DT_CreateResult(NULL); RECT result_rect; char jsondata100 = left:269,top:359,width:259,height:259; parseJson(jsondata, &result_rect); for(;) int len = ftell(pFile) char *dst = Detect_Face(0, NULL); delete pBuff; printf(dst json is: %srn, dst); Decode(pBuff, image, len); Get_
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 明星考试题及答案
- 风雨考试题及答案
- 咖啡考试题及答案
- 中级财务会计(山东工商学院)知到智慧树答案
- 建筑起重机械防御台风培训考试试题(附答案)
- 国家基层高血压、糖尿病防治管理指南培训考核试题及答案
- 2025版新能源汽车租赁及代购一体化服务合同
- 2025年工业自动化设备购销合同样本
- 2025年全新建材代购代理合同
- 2025版市政道路施工合同gf
- 2025年建筑工程-安全员C证-安全员(C证·上海)历年参考题库典型考点含答案解析
- 光伏项目施工组织设计方案
- 2025政府采购评审专家入库题库与答案
- 2025至2030医学混合成像系统行业产业运行态势及投资规划深度研究报告
- 2025年内蒙古交通集团考试笔试试题(含答案)
- 低压安全隐患排查
- 学堂在线 高技术与现代局部战争 章节测试答案
- 水费收缴使用管理办法
- 《研学旅行指导师实务》课件-第1章 研学旅行指导师职业基础
- 广东省汕头市金平区2023-2024学年七年级下学期期末数学试题(无答案)
- PWM控制技术的最新科技成果-介绍ISL6752
评论
0/150
提交评论