Mercurial > hg > aimc
diff carfac/carfac_common.cc @ 626:586b0677aae8
Fourth revision of Alex Brandmeyer's C++ implementation. Fixed more style issues, changed AGC structures to vectors, replaced FloatArray2d with vector<FloatArray>, implemented first tests using GTest to verify coefficients and monaural output against Matlab values (stored in aimc/carfac/test_data/). To run tests, change the path stored in carfac_test.h in TEST_SRC_DIR. Added CARFAC_GenerateTestData to the Matlab branch, fixed stage indexing in CARFAC_Cross_Couple.m to reflect changes in AGCCoeffs and AGCState structs.
author | alexbrandmeyer |
---|---|
date | Wed, 22 May 2013 21:30:02 +0000 |
parents | 0fbaf443ec82 |
children | 27f2d9b76075 |
line wrap: on
line diff
--- a/carfac/carfac_common.cc Tue May 21 21:48:34 2013 +0000 +++ b/carfac/carfac_common.cc Wed May 22 21:30:02 2013 +0000 @@ -22,13 +22,14 @@ #include "carfac_common.h" -FPType ERBHz (FPType cf_hz, FPType erb_break_freq, FPType erb_q) { +FPType ERBHz (const FPType cf_hz, const FPType erb_break_freq, + const FPType erb_q) { FPType erb; erb = (erb_break_freq + cf_hz) / erb_q; return erb; } -FloatArray CARFACDetect (FloatArray x) { +FloatArray CARFACDetect (const FloatArray& x) { FloatArray conductance, z, set; FPType a = 0.175; // This offsets the low-end tail into negative x territory. @@ -36,6 +37,6 @@ // threshold at 0.1. z = x + a; // Zero is the final answer for many points. - conductance = (z < 0).select(0.0, (z * z * z) / (z * z * z + z * z + 0.1)); + conductance = (z < 0).select(0.0, (z*z*z) / (z*z*z + z*z + 0.1)); return conductance; } \ No newline at end of file