bug fix in gain, sounding better on train120
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 29 Jun 2017 01:17:38 +0000 (01:17 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 29 Jun 2017 01:17:38 +0000 (01:17 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3264 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/newamp.m
codec2-dev/octave/newamp1_batch.m
codec2-dev/octave/newamp1_fbf.m

index e785b0c8e4d576423ec37c4d245f657e1bea63f6..b0e0e3c101b671ad6e27b26215adfe082fbc6231 100644 (file)
@@ -743,7 +743,7 @@ function [diff_weighted weights error g min_ind] = search_vq_weighted(target, vq
 
     % abs in dB is MSE in linear
 
-    error(i) = sum(abs(diff_weighted(i,:)));
+    error(i) = mean(abs(diff_weighted(i,:)));
   end
 
   [mn min_ind] = min(error);
index 43a199c4ac32f582ab2bec5d22ee84f3eaf08435..5eaddf1924098c3e58e9922958b59a98e055d874 100644 (file)
@@ -227,7 +227,6 @@ endfunction
 
 function [model_ rate_K_surface] = experiment_const_freq(model, fit_order, vq_type, vq_filename)
   melvq;
-
   [frames nc] = size(model);
   Fs = 8000;
   fg = 1;
@@ -278,7 +277,7 @@ function [model_ rate_K_surface] = experiment_const_freq(model, fit_order, vq_ty
   
   if quant_en
  
-    rate_K_surface_fit_ = zeros(frames, K);
+    rate_K_surface_fit_ = rate_K_surface_fit;
     res = zeros(frames,vq_cols); ind = [];
 
     for f=1:frames
@@ -286,12 +285,12 @@ function [model_ rate_K_surface] = experiment_const_freq(model, fit_order, vq_ty
 
       [diff_weighted weights error g mn_ind] = search_vq_weighted(target, vq);
       if (f>=73) && (f<=75)
-        printf("f: %d mn_ind: %d g: %3.2f sd: %3.2f\n", f, mn_ind, g(mn_ind), error(mn_ind));
+        printf("f: %d mn_ind: %d g: %3.2f sdK: %3.2f\n", f, mn_ind, g(mn_ind), error(mn_ind));
       end
-      rate_K_surfacurface_fit_(f, vq_st:vq_en) = vq(mn_ind,:) + g(mn_ind);
+      rate_K_surface_fit_(f, vq_st:vq_en) = vq(mn_ind,:) + g(mn_ind);
 
-      %res(f,vq_st:vq_en) = rate_K_surface_no_mean(f,vq_st:vq_en) - rate_K_surface_no_mean_(f,vq_st:vq_en);
-      res(f,vq_st:vq_en) = diff_weighted(mn_ind,:);
+      res(f,vq_st:vq_en) = rate_K_surface_fit(f,vq_st:vq_en) - rate_K_surface_fit_(f,vq_st:vq_en);
+      %res(f,vq_st:vq_en) = diff_weighted(mn_ind,:);
       ind = [ind mn_ind];
     end
     
@@ -321,14 +320,17 @@ function [model_ rate_K_surface] = experiment_const_freq(model, fit_order, vq_ty
     L = model(f,2);
     AmdB = 20*log10(model(f,3:(L+2)));
     sd(f) = std(AmdB(1:L) - AmdB_(f,1:L));
+    if (f>=73) && (f<=75)
+      printf("f: %d sdL: %3.2f\n", f, sd(f));
+    end
     if (sd(f) > plot_sd_thresh) && (fg < 10)
       printf("fg: %d f: %d\n", fg, f);
       figure(fg++); clf; plot((1:L)*Wo*4/pi, AmdB(1:L),'b+-'); hold on; plot((1:L)*Wo*4/pi, AmdB_(f,1:L),'r+-');
       plot(rate_K_sample_freqs_kHz, rate_K_surface_(f,:), 'c+-'); hold off;
-    end
+     end
   end
   printf("rate K resampling SD: %3.2f\n", mean(sd));
-  figure(fg++); clf; subplot(211); plot(energy); subplot(212); plot(sd);
+  figure(fg++); clf; subplot(211); plot(energy); subplot(212); plot(sd); title('sdL');
   figure(fg++); clf; hist(sd);
 endfunction
 
index 8e03a938b0d2e8ff64d145c0b2518d859e02b451..3b9d29d8a001be0e2903c0f12ea5dc42ead44d23 100644 (file)
@@ -100,7 +100,6 @@ function newamp1_fbf(samname, f=10, varargin)
       target = rate_K_vec_fit(vq_st:vq_en);
       
       [diff_weighted weights error g mn_ind] = search_vq_weighted(target, vq);
-      printf("f: %d mn_ind: %d g: %3.2f sd: %3.2f\n", f, mn_ind, g(mn_ind), error(mn_ind));
  
       rate_K_vec_fit_ = rate_K_vec_fit;
       rate_K_vec_fit_(vq_st:vq_en) = vq(mn_ind,:) + g(mn_ind);
@@ -108,6 +107,10 @@ function newamp1_fbf(samname, f=10, varargin)
       [model_ AmdB_] = resample_rate_L(model(f,:), rate_K_vec_, rate_K_sample_freqs_kHz, Fs);
       AmdB_ = AmdB_(1:L);
 
+      sdL = std(AmdB - AmdB_);
+      printf("f: %d mn_ind: %d g: %3.2f sdK: %3.2f sdL: %3.2f\n", 
+             f, mn_ind, g(mn_ind), error(mn_ind), sdL);
+
       plot(rate_K_sample_freqs_kHz(vq_st:vq_en)*1000, diff_weighted(mn_ind,:), ";diff;k+-");
       plot((1:L)*Wo*4000/pi, AmdB_,";AmdB bar;r+-");
       hold off;