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

📄 aec_calibrate.h

📁 MTK 手机软件开发 META 源代码,开发环境: C++ Builder
💻 H
字号:
/*===========================================================*
 *                      define & variable                    *
 *===========================================================*/
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <malloc.h>
#include <time.h>

#define DLLEXPORT extern "C"  __declspec(dllexport)
//#define CALL_CONVENTION  __stdcall
#define CALL_CONVENTION

/*===========================================================*
 *                     structure declare                     *
 *===========================================================*/

typedef struct {
	double re;
	double im;
} Cmplx;

//----------------------------------------------------------//
typedef struct {

	short seg_sig[4000];

	int type;
	int aec_par;
	int fre_index[8];

	double ser;

	double ins_en[128];
	double linear_en[128];
	double nonlinear_en[128];

	//---- sub-band nonlinear distortion ----//
	double nonlinear_thd[8];
	double nonlinear_distortion[8];

	double energy[8];
	int echo_loss[8];


	Cmplx ins[256];

} echo_response;

//----------------------------------------------------------//
typedef struct {

	short coef[45];
	int flt_index;

} calresult;

//----------------------------------------------------------//
typedef struct {

	//---- sp parameter ----//
	unsigned short sp_enhace[8];
	unsigned short mechanism;

	//---- sp parameter 08A ----//
	unsigned short sp_enhace_08A[16];

} speresult;

//----------------------------------------------------------//
typedef struct {

	unsigned char cal_gain;
	unsigned char volume[7];

} spkgain;

//----------------------------------------------------------//
typedef struct {

	unsigned char cal_gain;
	unsigned char volume;

} micgain;

//----------------------------------------------------------//
typedef struct {

	unsigned char DG_gain;
	unsigned char volume;

} micresult;

/*===========================================================*
 *             Loudspeaker mode Function for 8k              *
 *===========================================================*/
void init_echo_response_struct ( echo_response *echo_res );

DLLEXPORT bool CALL_CONVENTION calibrate_spk ( spkgain *spk, int amp, int dac );
DLLEXPORT bool CALL_CONVENTION calibrate_mic ( micgain *mic, int amp, int type );

DLLEXPORT bool CALL_CONVENTION calibrate_step_1 ( calresult *calres, short *signal, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_2 ( calresult *calres, short *signal, int flt_index, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3 ( speresult *speres, short *signal, bool drc_index, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3_08A ( speresult *speres, short *signal, bool drc_index, bool debug_format );

/*===========================================================*
 *             Loudspeaker mode Function for 2k              *
 *===========================================================*/
DLLEXPORT bool CALL_CONVENTION calibrate_step_1_2k ( calresult *calres, short *signal, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_2_2k ( calresult *calres, short *signal, int flt_index, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3_2k ( speresult *speres, short *signal, bool drc_index, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3_2k_08A ( speresult *speres, short *signal, bool drc_index, bool debug_format );

/*===========================================================*
 *               Normal mode Function for 8k                 *
 *===========================================================*/
#ifdef Normal_8k
DLLEXPORT bool CALL_CONVENTION calibrate_step_1_normal ( micresult *micres, short *signal, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_2_normal ( micresult *micres, short *signal, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3_normal ( speresult *speres, short *signal, micresult *micres, bool drc_index, bool debug_format );
#endif

/*===========================================================*
 *               Normal mode Function for 2k                 *
 *===========================================================*/
DLLEXPORT bool CALL_CONVENTION load_mic ( micresult *mic, unsigned char volume );
DLLEXPORT bool CALL_CONVENTION calibrate_step_1_2k_normal ( micresult *micres, short *signal, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_2_2k_normal ( micresult *micres, short *signal, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3_2k_normal ( speresult *speres, short *signal, micresult *micres, bool drc_index, bool debug_format );
DLLEXPORT bool CALL_CONVENTION calibrate_step_3_2k_normal_08A ( speresult *speres, short *signal, micresult *micres, bool drc_index, bool debug_format );

/*===========================================================*
 *                        Variable                           *
 *===========================================================*/
extern double hanning_window[256];
extern double weight[8];

extern short h[8][45];
extern short hd_fre[8][6];
extern double Template_flt[8];

extern unsigned short aec_par_set[8][8];
extern unsigned short aec_par_set_normal[8][8];

extern unsigned short aec_par_set_08A[8][16];
extern unsigned short aec_par_set_normal_08A[8][16];

⌨️ 快捷键说明

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