Ecshop中插件icoolmedia的相关算法_第1页
Ecshop中插件icoolmedia的相关算法_第2页
Ecshop中插件icoolmedia的相关算法_第3页
Ecshop中插件icoolmedia的相关算法_第4页
Ecshop中插件icoolmedia的相关算法_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Ecshop中插件icoolmedia的相关算法,不同的效果我们想要达到很简单需要找到一个平衡点,利用代码结构完成ifndef NS_H,从而达到一个有效利用率的提升。下面就上代码、 spx_ifft(inHandle->fft_table,inHandle->ft,szAudio); / overlap and add for(i = 0; i < inHandle->frame_size; i+) ioPcmi = inHandle->outbufi + szAudioi; for(i = 0; i < inHandle->frame_size;

2、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 &qu

3、ot;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文件 Plat

4、form.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_) |

5、defined(_MACH_)#define OS_APPLE 3#endif/ Windows system's 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 <stdio.h>#inclu

6、de <stdlib.h>#include <math.h>#include <memory.h>#include <assert.h>#include <errno.h>#include <stdarg.h>#ifdef _cplusplus#include <string>#include <vector>#include <map>#include <list>#include <deque>#include <algorithm>#includ

7、e <functional>#else#include <string.h>#include <ctype.h>#endif#ifdef OS_WINSYS/ for CoInitializeEx#define _WIN32_DCOM/#include <WinSock2.h>/#include <MSWSock.h>#include <windows.h>#include <mmsystem.h>#include <conio.h>#ifndef _MINGW32_#ifdef _cplusplu

8、s#include <atlbase.h>#endif#endif#include <time.h>#include <io.h>#include <sys/timeb.h>#include <sys/stat.h>#include <fcntl.h>#elif OS_LINUX#include <unistd.h>#include <sys/types.h>#include <semaphore.h>#include <pthread.h>#include <arpa

9、/inet.h>#include <net/if.h>#include <sys/ioctl.h>#include <sys/time.h>#include <sys/socket.h>#include <netinet/in.h>#include <fcntl.h>#include <linux/rtc.h>#include <sys/uio.h>#include <netinet/tcp.h>#include <netdb.h>#include <dlfcn.

10、h>#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)

11、 _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(&qu

12、ot;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"

13、,_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_)/ fpr

14、intf(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);

15、 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 = WavReader(); NoiseReduction *pIn

16、st = 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代码发展中的实现单链接做法,下面进行深入代码分析,所以大家请看代码

17、结构变化,注意下面列出了所有单链表的操作实例:文件 main.c 780B #include <stdlib.h>#include <string.h>#include "SingleLinkListOperator.h"int main(int argc, char *argv) /*,需要用个那个操作,请关闭其他无关的操作函数*/ int ret; SLIST *sList = NULL; /*创建单链表,输出-1结束*/ sList = createSigLinkList(); /*打印单链表*/ ret = printSigLinkList(

18、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);

19、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); /

20、插入,在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

21、*/); /逆置 int reverseList(SLIST *sList/*in and out*/); #ifdef _cplusplus #endif#endif文件 SingleLinkListOperator.c 4KB #include <stdlib.h>#include <string.h>#include "SingleLinkListOperator.h" /新建单链表 SLIST * createSigLinkList() head = (SLIST *)malloc(sizeof(SLIST); printf("Pl

22、ease 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(S

23、LIST); 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 =

24、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(S

25、LIST); 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(&q

26、uot;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的内存

27、管理,使用cJSON组装json数据,依赖opencv的函数库,linux平台文件 endecode.cpp 14KB #include "endecode.h"int 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(p

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论