diff trunk/matlab/bmm/carfac/CARFAC_Init.m @ 665:d0ff15c36828

Turn the AGC coeffs inside out: array of structs instead of a struct of little arrays. In C++ use a vector<AGC_coeffs> for this; each of 4 stages has an entry; many fewer places need to do indexing by stage, and this removes the temptation to use little eigen arrays for the 4 stages. Also latest version of experimental log-lag SAI hacks.
author dicklyon@google.com
date Tue, 21 May 2013 04:24:05 +0000
parents 2767ce76a1b0
children
line wrap: on
line diff
--- a/trunk/matlab/bmm/carfac/CARFAC_Init.m	Fri May 17 19:52:45 2013 +0000
+++ b/trunk/matlab/bmm/carfac/CARFAC_Init.m	Tue May 21 04:24:05 2013 +0000
@@ -48,13 +48,15 @@
 
 
 function state = AGC_Init_State(coeffs)
-n_ch = coeffs.n_ch;
-n_AGC_stages = coeffs.n_AGC_stages;
-state = struct( ...
-  'AGC_memory', zeros(n_ch, n_AGC_stages), ...
-  'input_accum', zeros(n_ch, n_AGC_stages), ...
-  'decim_phase', zeros(n_AGC_stages, 1) ... % integer decimator phase
-  );
+n_ch = coeffs(1).n_ch;
+n_AGC_stages = coeffs(1).n_AGC_stages;
+state = struct([]);
+for stage = 1:n_AGC_stages
+  % Initialize state recursively...
+  state(stage).AGC_memory = zeros(n_ch, 1);
+  state(stage).input_accum = zeros(n_ch, 1);
+  state(stage).decim_phase = 0;  % integer decimator phase
+end
 
 
 function state = IHC_Init_State(coeffs)