/* * basic.h * * Created on: 2014-9-23 * Author: DELL */ #ifndef BASIC_H_ #define BASIC_H_ #include "config.h" #define MAX_FRAME_NUM 16 uvoid fgain_init(void); /*description: Get the max value of the audio data to the one frame. *@param1: the audio data buffer *@param2: the length of the data buffer. *return: none */ //float fpeak_data(const float* data,int n); /*description: Gain process *@param1: the audio data buffer *@param2: the old gain, hold last gain value. *@param3: the target gain. *@param4: the length of the data buffer. *return: none */ uvoid fgain_proc(const ufloat* data_in, ufloat* data_out, ufloat* old_gain, ufloat* new_gain, uint32_t smpl); /*description: Get max data of the data. *@param1: the data input *@param2: data length. *return: max data */ ufloat fpeak_data(const ufloat* data, uint32_t n); ufloat crms(const ufloat* data_in, uint32_t data_len, ufloat* nframe_data, uint32_t frame_num); /*description: Get N frame 's max level, unit db. *@param1: the audio data buffer *@param2: the samples of data *@param3: the recent sevaral frames max level. *@param4: the length of the nframe_db. *return: none */ ufloat alg_get_avg_value(const ufloat x, ufloat * frame_array, uint32_t number); ufloat alg_get_min_value(const ufloat x, ufloat * frame_array, uint32_t number); ufloat alg_get_max_value(const ufloat x, ufloat * frame_array, uint32_t number); ufloat frames_max_data(const ufloat* data_in, uint32_t data_len, ufloat* nframe_data, uint32_t frame_num); ufloat fgain_get_factor(ufloat gain); #define GF(g) fgain_get_factor(g) uvoid fgain_step(const ufloat* data_in, ufloat* data_out, ufloat* old_gain , const ufloat target_gain, const ufloat step, uint32_t smpl); #endif /* BASIC_H_ */