




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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中對于鏈接器使用代碼是很復雜的,好多鏈接器的代碼實現(xiàn)功能的同時會大量占用內存管理的crp,同時產生crp磁盤碎片,對于這個的利用一直是一個難題,這里舉例一個小功能讓他實現(xiàn)的更加完善。#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代碼發(fā)展中的實現(xiàn)單鏈接做法,下面進行深入代碼分析,所以大家請看代碼
17、結構變化,注意下面列出了所有單鏈表的操作實例:文件 main.c 780B #include <stdlib.h>#include <string.h>#include "SingleLinkListOperator.h"int main(int argc, char *argv) /*,需要用個那個操作,請關閉其他無關的操作函數(shù)*/ int ret; SLIST *sList = NULL; /*創(chuàng)建單鏈表,輸出-1結束*/ sList = createSigLinkList(); /*打印單鏈表*/ ret = printSigLinkList(
18、sList); /*在值為20的節(jié)點后添加值為25的節(jié)點*/ ret = insertDataToList(sList,20,25); /*刪除值為20的節(jié)點,沒有就不刪*/ ret = deleteDataToList(sList,20); /*修改值為20的節(jié)點值為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/單鏈表的數(shù)據(jù)結構struct SLIST int data; struct SLIST *pNext; ;typedef struct SLIST SLIST; /新建單鏈表 SLIST * createSigLinkList(); /打印單鏈表 int printSigLinkList(SLIST *sList); /
20、插入,在x值的節(jié)點后面插入y的節(jié)點 int insertDataToList(SLIST *sList/*in and out*/,int x/*in*/,int y/*in*/); /刪除,刪除x值節(jié)點 int deleteDataToList(SLIST *sList/*in and out*/,int x/*in*/); /修改,將x值節(jié)點的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值節(jié)點 int deleteDataToList(SLIST *sList/*in and out*/,int x/*in*/); /修改,將x值節(jié)點的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值節(jié)點 int deleteDataToList(SLIST *sList/*in and out*/,int x/*in*/); /修改,將x值節(jié)點的data修改為y值 int modefyDataToList(SLIST *sList/*inq and out*/,int int data; SLIST *pCur =
24、NULL; /創(chuàng)建頭結點(空的單鏈表) SLIST *head = NULL; head = (SLIST *)malloc(sizeof(SLIST); head->data = 0; head->pNext = NULL; pCur = head; /接受用戶的輸入節(jié)點數(shù)據(jù) 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; /接受用戶的輸入節(jié)點數(shù)據(jù) 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值的節(jié)點后面插入y的節(jié)點 ,這些就是代碼ecshop單鏈接的表單處理方式,大家可以做個參考。使用libjpeg開源庫,采用apr的內存
27、管理,使用cJSON組裝json數(shù)據(jù),依賴opencv的函數(shù)庫,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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 文具愛心義賣活動方案
- 數(shù)字錢包活動策劃方案
- 春節(jié)活動送車活動方案
- 新生校隊選拔活動方案
- 整治咸魚活動方案
- 新年家宴活動方案
- 敬老院慰問員工活動方案
- 新中式插花活動方案
- 新品宣傳活動方案
- 春節(jié)活動乒乓球活動方案
- 特殊工時制管理制度
- 駐非洲員工管理制度
- 統(tǒng)編版三年級語文下冊同步高效課堂系列第一單元復習課件
- 2025年高考生物真題(安徽)含答案
- 2025年高考真題-政治(黑吉遼卷) 含答案(黑龍江、吉林、遼寧、內蒙古)
- T/QX 004-2020工業(yè)清洗作業(yè)人員呼吸防護用品選擇、管理、使用和維護指南
- 河北省石家莊市2025年七年級下學期語文期末考試卷及答案
- 四川省德陽市2025年七年級下學期語文期末試卷及答案
- 石獅子購銷合同協(xié)議
- 課題申報書:基于核心素養(yǎng)發(fā)展理念的小學數(shù)學跨學科主題學習設計的策略研究
- 模聯(lián)面試題及答案
評論
0/150
提交評論