qipp
2025-11-07 744722688187eb4991c72464e2bb5e06b244fee7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * 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_ */