tweaked soem of the LSP scripts while working on dropping LSP bit rate
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 31 Oct 2011 03:55:28 +0000 (03:55 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 31 Oct 2011 03:55:28 +0000 (03:55 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@293 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/lsp_pdf.m
codec2-dev/octave/pllsp.m
codec2-dev/octave/pllspdt.m [new file with mode: 0644]

index b54127fd85baf89aa441b2026495ee1602e5ecb8..4fc1359a36e9ddf0bfca61d8a049d2c40a6e4534 100644 (file)
@@ -10,15 +10,16 @@ function lsp_pdf(lsp)
   figure(1);
   clf;
   [x,y] = hist(lsp(:,1),100);
-  plot(y*4000/pi,x,";1;");
+  plot(y*4000/pi,x,"+;1;");
   hold on;
-  for i=2:c
+  for i=2:5
+    [x,y] = hist(lsp(:,i),100);
+    legend = sprintf("+%d;%d;",i,i);
+    plot(y*4000/pi,x,legend);
+  endfor
+  for i=6:c
     [x,y] = hist(lsp(:,i),100);
-    if (mod(i,2))
-        legend = sprintf(";%d;",i);
-    else
-        legend = sprintf("1;%d;",i);
-    endif
+    legend = sprintf("+%d;%d;",i-5,i);
     plot(y*4000/pi,x,legend);
   endfor
   hold off;
@@ -83,4 +84,8 @@ function lsp_pdf(lsp)
   hold off;
   grid;
   axis([-200 200 0 16000]);
+
+  figure(4);
+  clf;
+  plot((4000/pi)*(lsp(2:r,3)-lsp(1:r-1,3)))
 endfunction
index f66e7ab2eabac978ba08296f5ab0271de50d14b3..7602fa3b3a0d15517e7789eaeaf30aba2402f125 100644 (file)
@@ -2,7 +2,7 @@
 % This program is distributed under the terms of the GNU General Public License 
 % Version 2
 %
-% Plots a bunch of information realted to LSP quantisation:
+% Plots a bunch of information related to LSP quantisation:
 %   - speech file 
 %   - LSPs before and after quantisation
 %   - SNR for each frame
 % Note: there is a 160 sample (two frame delay) from the when a sample
 % enters the input buffer until it is at the centre of the analysis window
 
-function pl(rawfile, 
-           dumpfile_prefix_lpc_only, 
-            dumpfile_prefix_lsp, 
-            start_f, end_f)
+function pllsp(rawfile, 
+              dumpfile_prefix_lpc_only, 
+               dumpfile_prefix_lsp, 
+               start_f, end_f)
   
   fs=fopen(rawfile,"rb");
   s=fread(fs,Inf,"short");
diff --git a/codec2-dev/octave/pllspdt.m b/codec2-dev/octave/pllspdt.m
new file mode 100644 (file)
index 0000000..c711aa4
--- /dev/null
@@ -0,0 +1,27 @@
+% pllspdt.m
+% Copyright David Rowe 2010
+% This program is distributed under the terms of the GNU General Public License 
+% Version 2
+%
+% Test script to plot differences in LSps between frames
+
+function pllspdt(rawfile,dumpfile_prefix_lsp,lspn, start_f, end_f)
+  
+  fs=fopen(rawfile,"rb");
+  s=fread(fs,Inf,"short");
+
+  lsp_name = strcat(dumpfile_prefix_lsp,"_lsp.txt");
+  lsps = load(lsp_name);
+  [m,n]=size(lsps);
+  lsp  = lsps(1:2:m,:);
+  lsp_ = lsps(2:2:m,:);
+  lspdt = lsp(2:m/2,:) - lsp(1:m/2-1,:);
+
+  figure(1);
+  clf;
+  sp = s((start_f-2)*80:(end_f-2)*80);
+  plot(sp);
+
+  figure(2);
+  plot((4000/pi)*lspdt((start_f+1):end_f,lspn));
+endfunction