• Home
  • Raw
  • Download

Lines Matching refs:drc

17 static void set_default_parameters(struct drc *drc);
18 static void init_data_buffer(struct drc *drc);
19 static void init_emphasis_eq(struct drc *drc);
20 static void init_crossover(struct drc *drc);
21 static void init_kernel(struct drc *drc);
22 static void free_data_buffer(struct drc *drc);
23 static void free_emphasis_eq(struct drc *drc);
24 static void free_kernel(struct drc *drc);
26 struct drc *drc_new(float sample_rate) in drc_new()
28 struct drc *drc = (struct drc *)calloc(1, sizeof(struct drc)); in drc_new() local
29 drc->sample_rate = sample_rate; in drc_new()
30 set_default_parameters(drc); in drc_new()
31 return drc; in drc_new()
34 void drc_init(struct drc *drc) in drc_init() argument
36 init_data_buffer(drc); in drc_init()
37 init_emphasis_eq(drc); in drc_init()
38 init_crossover(drc); in drc_init()
39 init_kernel(drc); in drc_init()
42 void drc_free(struct drc *drc) in drc_free() argument
44 free_kernel(drc); in drc_free()
45 free_emphasis_eq(drc); in drc_free()
46 free_data_buffer(drc); in drc_free()
47 free(drc); in drc_free()
51 static void init_data_buffer(struct drc *drc) in init_data_buffer() argument
57 drc->data1[i] = (float *)calloc(1, size); in init_data_buffer()
58 drc->data2[i] = (float *)calloc(1, size); in init_data_buffer()
63 static void free_data_buffer(struct drc *drc) in free_data_buffer() argument
68 free(drc->data1[i]); in free_data_buffer()
69 free(drc->data2[i]); in free_data_buffer()
73 void drc_set_param(struct drc *drc, int index, unsigned paramID, float value) in drc_set_param() argument
77 drc->parameters[index][paramID] = value; in drc_set_param()
80 static float drc_get_param(struct drc *drc, int index, unsigned paramID) in drc_get_param() argument
83 return drc->parameters[index][paramID]; in drc_get_param()
87 static void set_default_parameters(struct drc *drc) in set_default_parameters() argument
89 float nyquist = drc->sample_rate / 2; in set_default_parameters()
93 float *param = drc->parameters[i]; in set_default_parameters()
113 drc->parameters[0][PARAM_CROSSOVER_LOWER_FREQ] = 0; in set_default_parameters()
114 drc->parameters[1][PARAM_CROSSOVER_LOWER_FREQ] = 200 / nyquist; in set_default_parameters()
115 drc->parameters[2][PARAM_CROSSOVER_LOWER_FREQ] = 2000 / nyquist; in set_default_parameters()
118 drc->parameters[0][PARAM_FILTER_STAGE_GAIN] = 4.4f; /* dB */ in set_default_parameters()
119 drc->parameters[0][PARAM_FILTER_STAGE_RATIO] = 2; in set_default_parameters()
120 drc->parameters[0][PARAM_FILTER_ANCHOR] = 15000 / nyquist; in set_default_parameters()
171 static void init_emphasis_eq(struct drc *drc) in init_emphasis_eq() argument
177 float stage_gain = drc_get_param(drc, 0, PARAM_FILTER_STAGE_GAIN); in init_emphasis_eq()
178 float stage_ratio = drc_get_param(drc, 0, PARAM_FILTER_STAGE_RATIO); in init_emphasis_eq()
179 float anchor_freq = drc_get_param(drc, 0, PARAM_FILTER_ANCHOR); in init_emphasis_eq()
181 drc->emphasis_eq = eq2_new(); in init_emphasis_eq()
182 drc->deemphasis_eq = eq2_new(); in init_emphasis_eq()
188 eq2_append_biquad_direct(drc->emphasis_eq, j, &e); in init_emphasis_eq()
189 eq2_append_biquad_direct(drc->deemphasis_eq, j, &d); in init_emphasis_eq()
196 static void free_emphasis_eq(struct drc *drc) in free_emphasis_eq() argument
198 eq2_free(drc->emphasis_eq); in free_emphasis_eq()
199 eq2_free(drc->deemphasis_eq); in free_emphasis_eq()
203 static void init_crossover(struct drc *drc) in init_crossover() argument
205 float freq1 = drc->parameters[1][PARAM_CROSSOVER_LOWER_FREQ]; in init_crossover()
206 float freq2 = drc->parameters[2][PARAM_CROSSOVER_LOWER_FREQ]; in init_crossover()
208 crossover2_init(&drc->xo2, freq1, freq2); in init_crossover()
212 static void init_kernel(struct drc *drc) in init_kernel() argument
217 dk_init(&drc->kernel[i], drc->sample_rate); in init_kernel()
219 float db_threshold = drc_get_param(drc, i, PARAM_THRESHOLD); in init_kernel()
220 float db_knee = drc_get_param(drc, i, PARAM_KNEE); in init_kernel()
221 float ratio = drc_get_param(drc, i, PARAM_RATIO); in init_kernel()
222 float attack_time = drc_get_param(drc, i, PARAM_ATTACK); in init_kernel()
223 float release_time = drc_get_param(drc, i, PARAM_RELEASE); in init_kernel()
224 float pre_delay_time = drc_get_param(drc, i, PARAM_PRE_DELAY); in init_kernel()
225 float releaseZone1 = drc_get_param(drc, i, PARAM_RELEASE_ZONE1); in init_kernel()
226 float releaseZone2 = drc_get_param(drc, i, PARAM_RELEASE_ZONE2); in init_kernel()
227 float releaseZone3 = drc_get_param(drc, i, PARAM_RELEASE_ZONE3); in init_kernel()
228 float releaseZone4 = drc_get_param(drc, i, PARAM_RELEASE_ZONE4); in init_kernel()
229 float db_post_gain = drc_get_param(drc, i, PARAM_POST_GAIN); in init_kernel()
230 int enabled = drc_get_param(drc, i, PARAM_ENABLED); in init_kernel()
232 dk_set_parameters(&drc->kernel[i], db_threshold, db_knee, ratio, in init_kernel()
237 dk_set_enabled(&drc->kernel[i], enabled); in init_kernel()
242 static void free_kernel(struct drc *drc) in free_kernel() argument
246 dk_free(&drc->kernel[i]); in free_kernel()
368 void drc_process(struct drc *drc, float **data, int frames) in drc_process() argument
371 float **data1 = drc->data1; in drc_process()
372 float **data2 = drc->data2; in drc_process()
375 if (!drc->emphasis_disabled) in drc_process()
376 eq2_process(drc->emphasis_eq, data[0], data[1], frames); in drc_process()
379 crossover2_process(&drc->xo2, frames, data[0], data[1], data1[0], in drc_process()
385 dk_process(&drc->kernel[0], data, frames); in drc_process()
386 dk_process(&drc->kernel[1], data1, frames); in drc_process()
387 dk_process(&drc->kernel[2], data2, frames); in drc_process()
394 if (!drc->emphasis_disabled) in drc_process()
395 eq2_process(drc->deemphasis_eq, data[0], data[1], frames); in drc_process()