diff carfac/carfac_output.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_output.cc	Tue May 21 21:48:34 2013 +0000
+++ b/carfac/carfac_output.cc	Wed May 22 21:30:02 2013 +0000
@@ -22,36 +22,31 @@
 
 #include "carfac_output.h"
 
-void CARFACOutput::InitOutput(int n_ears, int n_ch, int32_t n_tp) {
+void CARFACOutput::InitOutput(const int n_ears, const int n_ch,
+                              const int32_t n_timepoints) {
   n_ears_ = n_ears;
   ears_.resize(n_ears_);
-  for (int i = 0; i < n_ears_; i++) {
-    ears_.at(i).InitOutput(n_ch, n_tp);
+  for (int i = 0; i < n_ears_; ++i) {
+    ears_[i].InitOutput(n_ch, n_timepoints);
   }
 }
 
-void CARFACOutput::MergeOutput(CARFACOutput output, int32_t start, int32_t length) {
-  for (int i = 0; i < n_ears_; i++){
-    ears_.at(i).MergeOutput(output.ears_[i], start, length);
-  }
+void CARFACOutput::StoreNAPOutput(const int32_t timepoint, const int ear,
+                                  const FloatArray& nap) {
+  ears_[ear].StoreNAPOutput(timepoint, nap);
 }
 
-void CARFACOutput::StoreNAPOutput(int32_t timepoint, int ear, int n_ch,
-                               FloatArray nap) {
-  ears_.at(ear).StoreNAPOutput(timepoint, n_ch, nap);
+void CARFACOutput::StoreBMOutput(const int32_t timepoint, const int ear,
+                                 const FloatArray& bm) {
+  ears_[ear].StoreBMOutput(timepoint, bm);
 }
 
-void CARFACOutput::StoreBMOutput(int32_t timepoint, int ear, int n_ch,
-                                  FloatArray nap) {
-  ears_.at(ear).StoreBMOutput(timepoint, n_ch, nap);
+void CARFACOutput::StoreOHCOutput(const int32_t timepoint, const int ear,
+                                  const FloatArray& ohc) {
+  ears_[ear].StoreOHCOutput(timepoint, ohc);
 }
 
-void CARFACOutput::StoreOHCOutput(int32_t timepoint, int ear, int n_ch,
-                                  FloatArray nap) {
-  ears_.at(ear).StoreOHCOutput(timepoint, n_ch, nap);
-}
-
-void CARFACOutput::StoreAGCOutput(int32_t timepoint, int ear, int n_ch,
-                                  FloatArray nap) {
-  ears_.at(ear).StoreNAPOutput(timepoint, n_ch, nap);
+void CARFACOutput::StoreAGCOutput(const int32_t timepoint, const int ear,
+                                  const FloatArray& agc) {
+  ears_[ear].StoreNAPOutput(timepoint, agc);
 }
\ No newline at end of file