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

📄 g723_oal_win32.h

📁 windows环境下利用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) 2000 Intel Corporation. All Rights Reserved.
//
//  VSS:
//		$Workfile: g723_oal_win32.h $
//      $Revision: 1 $
//      $Date: 05-05-24 17:57 $
//      $Archive: /ipp_sample/ipp5/ipp50/dev/src/arm_ppc/speech/g723/include/g723_oal_win32.h $
//
//  Description:
//      OS adaptation layer - provides interface to OS-dependent services
//      such as memory allocation, performance timer, file I/O, and audio I/O.
//
******************************************************************************/

/* OS-specific definitions */
#include <windows.h>
#include <winbase.h>
#include <stdio.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <string.h>
#include <malloc.h>
#include <stdafx.h>

#ifdef ARCH_XSC
#define sprintf swprintf
#define strcpy wcscpy
#define strlen wcslen
#define strncpy wcsncpy
#define fscanf fwscanf
#define strcmp wcscmp 
#define fgets fgetws
#define sprintf swprintf
#define strcat wcscat
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* String parameters */
#define	MAXFN					256			// Max filename len
#define	MAXSTR					256			// Max string length, in characters 
    										  
/* GUI parameters and constants */
#define MAX_LOADSTRING			100			// Max title bar len
#define PERF_TIMER_ID			777			// Performance display timer ID
#define PERF_TIMER_PERIOD		250			// Performance display update period, in ms
#define	TXT_LEFT				15
#define	IDM_SETTINGS_DTXON		1100	
#define	IDM_SETTINGS_DTXOFF		1101
#define	IDM_SETTINGS_53KBPS		1102
#define	IDM_SETTINGS_63KBPS		1103
#define	IDM_FILE_OPEN			1104
#define	IDM_FILE_EXIT			1105
#define IDM_TEST				1107

// Performance timer parameters
#define	TIMER_LABEL_MAX			256			/* maximum timer label length */
#define	TIMER_NUM_MAX			25			/* maximum possible number of timers */
#define	TIMER_NUM				2			/* number of timers */
#define	T_ENC					0			/* G.723 encoder timer ID */
#define	T_DEC					1			/* G.723 decoder timer ID */

/* Test vector compliance parameters */
#define	TV_ENCODER			100				/* Test vector type: Encoder */
#define	TV_DECODER			200				/* Test vector type: Decoder */
#define	TV_CRC_DECODER		300				/* Decoder with CRC test vector type */
#define	TV_MIX_ENCODER		400				/* Externally rate-controlled (5.3/6.3 mixed) encoder test vector */
#define	TV_PASS				0				/* Test result: PASS */
#define	TV_FAIL				-1				/* Test result: FAIL */
#define	TV_MISSING			-2				/* Test result: MISSING vector */
#define	ENCODER_TEST		0				/* Test type: Eencoder */				
#define	DECODER_TEST		1				/* Test type: Decoder */

/* PocketPC COLORREF text colors (00BBGGRR) */
#define	GREEN				0x0000ff00		/* Green defined in terms of COLORREF */
#define	RED					0x000000ff		/* Red		"			"		" */
#define	BLUE				0x00ff0000		/* Blue		"			"		" */
#define	YELLOW				0x007f7f00		/* Yellow	"			"		" */

// Performance timer state
typedef struct _performanceTimer
{
	TCHAR label[TIMER_LABEL_MAX];
	LARGE_INTEGER acc;
	LARGE_INTEGER tStart;
	LARGE_INTEGER tStop;
	LARGE_INTEGER freq;
	int blockCount;
	int blockSize;
} performanceTimer;

/* Performance timer API */
int					timerInit							(int n, char *label);
int					timerSetNum							(int numTimers);
int					timerGetNum							(int *numTimers);
int					timerReset							(int n);
int					timerStart							(int n);
int					timerStop							(int n);
int					timerDeltaAcc						(int n);
int					timerSetBlockSize					(int n, int size);
int					timerGetBlockSize					(int n, int *blockSize);
int					timerSetNumBlocks					(int n, int newBlockCount);
int					timerGetNumBlocks					(int n, int *blockCount);
int					timerGetAcc							(int n, int *timerAcc);
int					timerGetLabel						(int n, void *label);
int					timerSetFreq						(int n, int freq);
int					timerGetFreq						(int n, int *timerFreq);
float				getCpuUtilization					(int n, int sampleRate);

/* User interface */
LRESULT CALLBACK	GetFilePath							(HWND hWnd, TCHAR *path, TCHAR *filetypes, TCHAR *extensions);
VOID CALLBACK		PerfDisplayTimer					(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
int					dtxEnable							(HMENU h);
int					dtxDisable							(HMENU h);
int					setBitrate53kbps					(HMENU h);			
int					setBitrate63kbps					(HMENU h);			
void				ShowPerformance						(HWND hWnd);
void				ClearStreamProperties				();
void				DisplayStreamProperties				(TCHAR *InputFile, int dtxEnable, int bitrate);

/* Stream I/O */
int					openPcmStream						(IppPcmStream *s);
int					closePcmStream						(IppPcmStream *s);
int					readPcmStream						(IppPcmStream *s);

/* Audio I/O */
void				FillAudioOutputBuffer				(HWAVEOUT hWaveOut,LPWAVEHDR dw1);
void				DestroySound						(void);
void				InitAudioOutput						(int SampleRate, int Channels, int BitsPerSample);
void CALLBACK		WaveCallbackFunction				(HANDLE hdrvr, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
LPWAVEHDR			CreateAudioOutputBuffer				(DWORD dwUser);

/* Codec control */
void				initCodec_G723						( int pcmFrameLen, 
														  int compressedFrameLen, 
														  int framesPerBlk,
														  IppPcmStream *pcm, 
														  IppBitstream *bits, 
														  IppG723EncoderState *encState, 
														  IppG723DecoderState *decState );
void				destroyCodec_G723					( IppPcmStream *pcm, 
														  IppBitstream *bits);
void				startCodec_G723						(IppPcmStream *inputSpeech,
                                                         IppBitstream *outputBits,
                                                         IppG723EncoderState *encState, 
														 IppG723DecoderState *decState);

/* Test vector compliance testing */
LRESULT CALLBACK	GetTVPath_G723						(HWND hWnd, TCHAR *tvPath);
int					TestCodecCompliance_G723			(int testsel, TCHAR *tvPath, HWND hWnd);
int					RunTestVector_G723					(TCHAR *path, TCHAR *name, int type, IppSpchBitRate rate, int filterEnable, int vadEnable);
void				LogDecoderError_G723				(int frame, int byte, Ipp16s expected, Ipp16s actual);
void				LogEncoderError_G723				(int frame, int byte, Ipp8u expected, Ipp8u actual);
LRESULT CALLBACK	EncoderTest_G723					(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK	DecoderTest_G723					(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
int					ReadTestConfigFile_G723				(TCHAR *tvpath, int *NumVect, TCHAR ***tv, 
									                     int **type, int **hpf, int **postfilt, IppSpchBitRate **rate);
#ifdef __cplusplus
}
#endif


⌨️ 快捷键说明

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