From: drowe67 Date: Thu, 29 Jun 2017 01:17:38 +0000 (+0000) Subject: bug fix in gain, sounding better on train120 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=fcabd889b419b35381e360d3ced0ec2e92f31400;p=freetel-svn-tracking.git bug fix in gain, sounding better on train120 git-svn-id: https://svn.code.sf.net/p/freetel/code@3264 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/octave/newamp.m b/codec2-dev/octave/newamp.m index e785b0c8..b0e0e3c1 100644 --- a/codec2-dev/octave/newamp.m +++ b/codec2-dev/octave/newamp.m @@ -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); diff --git a/codec2-dev/octave/newamp1_batch.m b/codec2-dev/octave/newamp1_batch.m index 43a199c4..5eaddf19 100644 --- a/codec2-dev/octave/newamp1_batch.m +++ b/codec2-dev/octave/newamp1_batch.m @@ -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 diff --git a/codec2-dev/octave/newamp1_fbf.m b/codec2-dev/octave/newamp1_fbf.m index 8e03a938..3b9d29d8 100644 --- a/codec2-dev/octave/newamp1_fbf.m +++ b/codec2-dev/octave/newamp1_fbf.m @@ -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;