documented installation of CML library
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 3 Sep 2015 22:15:06 +0000 (22:15 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 3 Sep 2015 22:15:06 +0000 (22:15 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2294 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/cml.patch [new file with mode: 0644]
codec2-dev/octave/ldpc.m
codec2-dev/octave/ldpcut.m

diff --git a/codec2-dev/octave/cml.patch b/codec2-dev/octave/cml.patch
new file mode 100644 (file)
index 0000000..c7cadd0
--- /dev/null
@@ -0,0 +1,24 @@
+diff -ruN -x '*.o' -x '*.dll' -x '*.mex' -x '*.mat' cml-orig/CmlStartup.m cml/CmlStartup.m
+--- cml-orig/CmlStartup.m      2007-09-08 23:12:26.000000000 +0930
++++ cml/CmlStartup.m   2015-09-04 07:21:14.218455223 +0930
+@@ -41,7 +41,7 @@
+     addpath( strcat( cml_home, '/mex'), ...\r
+         strcat( cml_home, '/mat'), ...\r
+         strcat( cml_home, '/matalt' ), ...\r
+-        strcat( cml_home, '/mexhelp'), ...\r
++        %strcat( cml_home, '/mexhelp'), ...\r
+         strcat( cml_home, '/demos' ), ...\r
+         strcat( cml_home, '/scenarios'), ...\r
+         strcat( cml_home, '/localscenarios'),...\r
+@@ -59,4 +59,4 @@
+     save_directory = strcat( cml_home, '/scenarios/CmlHome.mat' );\r
+ end\r
\r
+-save( save_directory, save_flag, 'cml_home' );
+\ No newline at end of file
++save( save_directory, save_flag, 'cml_home' );\r
+diff -ruN -x '*.o' -x '*.dll' -x '*.mex' -x '*.mat' cml-orig/source/matrix.h cml/source/matrix.h
+--- cml-orig/source/matrix.h   1970-01-01 09:30:00.000000000 +0930
++++ cml/source/matrix.h        2015-09-04 07:06:46.907248420 +0930
+@@ -0,0 +1 @@
++#include <mex.h>
index 7ce4a87a28bba7cfb389bac95e2d681bdcce3a3d..9a10d93e1bc2aa191a0cf1359eb78927241c61fd 100644 (file)
@@ -1,5 +1,18 @@
 % ldpc.m\r
-% LDPC functions\r
+%\r
+% David Rowe 2013\r
+% Octave functions to help us use the CML LDPC code.\r
+%\r
+% Installing CML library\r
+% ----------------------\r
+%\r
+% $ sudo apt-get install liboctave-dev\r
+% $ wget http://www.iterativesolutions.com/user/image/cml.1.10.zip\r
+% $ unzip cml.1.10.zip\r
+% $ patch < ~/codec2-dev/octave/cml.patch\r
+% $ cd source\r
+% $ octave\r
+% octave:> make\r
 \r
 1;\r
 \r
index 9dfdc94e41cc9a3b84c34388ea0cd2b2d59bedd3..39843d8d7d373e7845121f46555af5a2a6cc2917 100644 (file)
@@ -1,13 +1,16 @@
-% LDPC unit test script\r
+% ldpcut.m\r
+%\r
 % David Rowe 18 Dec 2013\r
-% Based on siulation by Bill Cowley\r
+%\r
+% Octave LDPC unit test script, based on simulation by Bill Cowley VK5DSP\r
+%\r
 \r
-% Start CML library\r
+% Start CML library (see CML set up instructions in ldpc.m)\r
 \r
 currentdir = pwd;\r
 addpath '/home/david/tmp/cml/mat'    % assume the source files stored here\r
 cd /home/david/tmp/cml\r
-CmlStartup                            % note that this is not in the cml path!\r
+CmlStartup                           % note that this is not in the cml path!\r
 cd(currentdir)\r
 \r
 % Our LDPC library\r
@@ -30,7 +33,7 @@ max_iterations = 100;
 code_param = ldpc_init(rate, framesize, modulation, mod_order, mapping);\r
 \r
 Ntrials = 84;\r
-EsNo=10;\r
+EsNo = 10;\r
 \r
 Tbits = Terrs = Ferrs = 0;\r
     \r
@@ -59,11 +62,13 @@ for nn = 1: Ntrials
     error_positions = xor( detected_data(1:code_param.data_bits_per_frame), data(st:en) );\r
     Nerrs = sum( error_positions);\r
         \r
-    if Nerrs>0, fprintf(1,'x'),  else fprintf(1,'.'),  end\r
-    if (rem(nn, 50)==0),  fprintf(1,'\n'),  end    \r
+    % print "." if frame decoded without errors, 'x' if we can't decode\r
+\r
+    if Nerrs>0, fprintf(1,'x'),  else printf('.'),  end\r
+    if (rem(nn, 50)==0),  printf('\n'),  end    \r
     if Nerrs>0,  Ferrs = Ferrs +1;  end\r
     Terrs = Terrs + Nerrs;\r
     Tbits = Tbits + code_param.data_bits_per_frame;        \r
 end\r
-fprintf(1,'\n')\r
+printf("\nTbits: %d Terrs: %d Ferrs: %d\n", Tbits, Terrs,  Ferrs)\r
 \r