comparison branches/carfac_cpp/src/AGC.cpp @ 586:f3dde307f4b8

some refactoring
author Ulf.Hammarqvist@gmail.com
date Thu, 11 Oct 2012 20:55:03 +0000
parents 9c4c3675c3f8
children
comparison
equal deleted inserted replaced
585:b8a961149499 586:f3dde307f4b8
1 #include "AGC.h" 1 #include "AGC.h"
2 #include <cmath> 2 #include <cmath>
3 #include <stdlib.h> 3 #include <stdlib.h>
4 #include <stdio.h> 4 #include <stdio.h>
5
6 AGC_parameters::AGC_parameters():
7 n_stages_(4),
8 time_constants_({0.002*1, 0.002*4, 0.002*16, 0.002*64}),
9 agc_stage_gain_(2),
10 decimation_({8, 2, 2, 2}),
11 agc1_scales_({1.0, 1.4, 2.0, 2.8}),
12 agc2_scales_({1.6, 2.25, 3.2, 4.5}),
13 detect_scale_(0.25),
14 agc_mix_coeff_(0.5)
15 {
16 // do nothing more
17 }
5 18
6 AGC_coefficients::AGC_coefficients(AGC_parameters* AGC_params_p, 19 AGC_coefficients::AGC_coefficients(AGC_parameters* AGC_params_p,
7 float fs, int n_ch){ 20 float fs, int n_ch){
8 float decim = 1.0; 21 float decim = 1.0;
9 float total_DC_gain = 0.0; 22 float total_DC_gain = 0.0;
57 agc_mix_coeffs_[stage] = AGC_params_p->agc_mix_coeff_/(tau * (fs/decim)); 70 agc_mix_coeffs_[stage] = AGC_params_p->agc_mix_coeff_/(tau * (fs/decim));
58 } 71 }
59 agc_gain_ = total_DC_gain; 72 agc_gain_ = total_DC_gain;
60 detect_scale_ = AGC_params_p->detect_scale_/total_DC_gain; 73 detect_scale_ = AGC_params_p->detect_scale_/total_DC_gain;
61 } 74 }
62 AGC_coefficients::~AGC_coefficients(){
63 // TODO Auto-generated destructor stub
64 }
65 75
66 FloatArray AGC_coefficients::Build_FIR_coeffs(float var, float mn, int* ptr_iters, int* ptr_taps){ 76 FloatArray AGC_coefficients::Build_FIR_coeffs(float var, float mn, int* ptr_iters, int* ptr_taps){
67 float a, b; 77 float a, b;
68 FloatArray FIR(3); 78 FloatArray FIR(3);
69 79