diff matlab/bmm/carfac/SAI_BlendFrameIntoComposite.m @ 623:b3118c9ed67f

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 fc353426eaad
children
line wrap: on
line diff
--- a/matlab/bmm/carfac/SAI_BlendFrameIntoComposite.m	Fri May 17 19:52:45 2013 +0000
+++ b/matlab/bmm/carfac/SAI_BlendFrameIntoComposite.m	Tue May 21 04:24:05 2013 +0000
@@ -21,6 +21,21 @@
   layer_struct, composite_frame)
 
 new_frame = layer_struct.frame;
+n_ch = size(new_frame, 1);
+
+if layer_struct.right_overlap == 0  % A layer 1 hack only.
+  for row = 1:n_ch
+    % Taper new_frame down near zero lag for a nicer result...
+    taper_size = round(6 + 60*(row/n_ch)^2);  %  hack
+    zero_pos = layer_struct.frame_width - layer_struct.future_lags;
+    taper = [-taper_size:min(taper_size, layer_struct.future_lags)];
+    col_range = zero_pos + taper;
+    taper = (0.4 + 0.6*abs(taper) / taper_size) .^ 2;
+    taper(taper == 0) = 0.5;
+    new_frame(row, col_range) = new_frame(row, col_range) .* taper;
+  end
+end
+
 alpha = layer_struct.alpha;
 lag_curve = layer_struct.lag_curve;
 target_columns = layer_struct.target_indices;