diff options
author | tracierenea <tracie.perez@mavs.uta.edu> | 2014-07-27 13:42:11 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-10-15 10:40:22 -0400 |
commit | bfefe873aacd7ddbb77dd375bb993e9aab2fa719 (patch) | |
tree | 9071886cd1d983d605178613d4cff9325584f195 | |
parent | 8e831a3c8bf76c25c542e7cbe8ced10d6dd35f09 (diff) |
fec: LDPC: Renaming class from ldpc_par_chk_mtrx to ldpc_R_U_mtrx
To indicate that this matrix has a specific format, designed for use
with the ldpc_R_U_encoder, renaming this class from ldpc_par_chk_mtrx
to ldpc_R_U_mtrx.
Also putting the memory free calls in the correct place in the bit
flip decoder.
-rw-r--r-- | gr-fec/examples/ber_curve_gen.grc | 22 | ||||
-rw-r--r-- | gr-fec/grc/fec_block_tree.xml | 1 | ||||
-rw-r--r-- | gr-fec/grc/variable_ldpc_R_U_mtrx_object.xml (renamed from gr-fec/grc/variable_parity_check_matrix_object.xml) | 4 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/ldpc_R_U_encoder.h | 4 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/ldpc_R_U_mtrx.h (renamed from gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h) | 14 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/ldpc_bit_flip_decoder.h | 4 | ||||
-rw-r--r-- | gr-fec/lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-fec/lib/ldpc_R_U_encoder_impl.cc | 4 | ||||
-rw-r--r-- | gr-fec/lib/ldpc_R_U_encoder_impl.h | 6 | ||||
-rw-r--r-- | gr-fec/lib/ldpc_R_U_mtrx.cc (renamed from gr-fec/lib/ldpc_par_chk_mtrx.cc) | 40 | ||||
-rw-r--r-- | gr-fec/lib/ldpc_bit_flip_decoder_impl.cc | 35 | ||||
-rw-r--r-- | gr-fec/lib/ldpc_bit_flip_decoder_impl.h | 10 | ||||
-rw-r--r-- | gr-fec/python/fec/qa_fecapi_ldpc.py | 27 | ||||
-rw-r--r-- | gr-fec/swig/fec_swig.i | 2 |
15 files changed, 88 insertions, 87 deletions
diff --git a/gr-fec/examples/ber_curve_gen.grc b/gr-fec/examples/ber_curve_gen.grc index a645954558..11c37a3d3f 100644 --- a/gr-fec/examples/ber_curve_gen.grc +++ b/gr-fec/examples/ber_curve_gen.grc @@ -23,7 +23,7 @@ <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="assets" href="https://assets-cdn.github.com/"> - <link rel="web-socket" href="wss://live.github.com/_sockets/NDA1MDE0OmM2YjIxZTc4MzIyZjM4YWNmNzQyMTFjZWI3ODk5ZjdhOjllMzBkNGEzZGZjNDRkOWY1YmZmNjNjMTA1NTEyNmYyYjQ3YjUzNGRlZDMzYTUwNTQ2OGM0YWM5MTAxMDk1Zjk=--f96c232ea983d05bc1412b92a981e4acb23ebdec"> + <link rel="web-socket" href="wss://live.github.com/_sockets/NDA1MDE0OmM2YjIxZTc4MzIyZjM4YWNmNzQyMTFjZWI3ODk5ZjdhOmJmOTNlNzRmYmRjZDhmMDM3ZTc5ZTdhYTI5YjhiMzQ2YjVhMWI2OGY3MDdmOTA4MTk3OTllZDFlMmU2MmI2ODg=--d8554a8686b58687e3e30b8575f82614c9fccc55"> <meta name="pjax-timeout" content="1000"> <link rel="sudo-modal" href="/sessions/sudo_modal"> @@ -32,7 +32,7 @@ <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-analytics" content="UA-3769691-2"> - <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="collector-cdn.github.com" name="octolytics-script-host" /><meta content="github" name="octolytics-app-id" /><meta content="AE3ED6D8:1F54:482308C:557EE415" name="octolytics-dimension-request_id" /><meta content="405014" name="octolytics-actor-id" /><meta content="trondeau" name="octolytics-actor-login" /><meta content="bfb4b7250d77e9e911f34bc59d03925ea14a0092b13bb0127da8aa349a9590c1" name="octolytics-actor-hash" /> + <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="collector-cdn.github.com" name="octolytics-script-host" /><meta content="github" name="octolytics-app-id" /><meta content="AE3ED6D8:678E:72AA9CD:557EE45F" name="octolytics-dimension-request_id" /><meta content="405014" name="octolytics-actor-id" /><meta content="trondeau" name="octolytics-actor-login" /><meta content="bfb4b7250d77e9e911f34bc59d03925ea14a0092b13bb0127da8aa349a9590c1" name="octolytics-actor-hash" /> <meta content="Rails, view, blob#show" name="analytics-event" /> <meta class="js-ga-set" name="dimension1" content="Logged In"> @@ -46,7 +46,7 @@ <meta content="authenticity_token" name="csrf-param" /> -<meta content="ce35Igs+FQwmM+fyZWjHBlotXlamGzyiEy7i68E+8u2+xcJ0KgAjZ/bCHo44o5pSV3je9ezbBDiW6QabMfu+hQ==" name="csrf-token" /> +<meta content="TOf5940q/gOhg+jK2WlzUhPMZKaRQpDkLHCaQDT4VR0wkwPnjb1lmscchDbX89MBqWz/XqJPTsToVQrTB557HQ==" name="csrf-token" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github/index-10789d1d56bfe8c960a6caf2954ab053c3fac748d581415395f986779781b4a7.css" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github2/index-8b4acc27f06d948d9a73d77849e0fe0b98d8636c85e2fe0e6c4b8762dec9fd3d.css" media="all" rel="stylesheet" /> @@ -187,7 +187,7 @@ Settings </a> - <form accept-charset="UTF-8" action="/logout" class="logout-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="l5ASEgsa17sfXvchs3nbjXSu8qbSllcJldSY4Iy/9eU/+yty9kZhRkht1OjVn7Ia5NTOOYJOaku/axkYbIiIOw==" /></div> + <form accept-charset="UTF-8" action="/logout" class="logout-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="u1z1bTTsArekytwRoOwhjExlEk86b0Qwg7GLZkIgYvrimu79HU7+ewPbE2qiOZyzUWFN/04G3Qzk06LwGmKSPg==" /></div> <button class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout"> Sign out </button> @@ -218,7 +218,7 @@ <ul class="pagehead-actions"> <li> - <form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="VDkyIRYuVBJyou8O+mQuGZuhusmxJOegdLVc+JHKsOBoqi7XZe9/fGlCBL8y8VWYKRekTJto0FN/ynjJScVnZw==" /></div> <input id="repository_id" name="repository_id" type="hidden" value="20425708" /> + <form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="A42Ic5KTOApaiv0bgvIwju5StAUxqeX5gfqeqVsgywiNvK2fHqOQePZZsEzJRUAQJUEmeEyRx9PscBaKx0jnYg==" /></div> <input id="repository_id" name="repository_id" type="hidden" value="20425708" /> <div class="select-menu js-menu-container js-select-menu"> <a href="/tracierenea/gnuradio/subscription" @@ -293,7 +293,7 @@ <div class="js-toggler-container js-social-container starring-container "> - <form accept-charset="UTF-8" action="/tracierenea/gnuradio/unstar" class="js-toggler-form starred js-unstar-button" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="7y2lJ4sOlGqKusoWIqZ9poygYWiIrBgu8P2e4HnNJ72gUJeDxbReMHwid0a+vF8yItPfKvLyQ8auN4roO/Kplw==" /></div> + <form accept-charset="UTF-8" action="/tracierenea/gnuradio/unstar" class="js-toggler-form starred js-unstar-button" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="pYAhR4bFovpaJ5DzL+erHn8oeKRjoGn8CIP6LTu+Qryr2YpPS9a6BFFUaYllBd3OMy7Yy16M2BZabtqku69bog==" /></div> <button class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this repository" title="Unstar tracierenea/gnuradio" @@ -305,7 +305,7 @@ 0 </a> </form> - <form accept-charset="UTF-8" action="/tracierenea/gnuradio/star" class="js-toggler-form unstarred js-star-button" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="mSXwmororCABYaDcECyx+DM6EdE+2PIzqF6bEyvxPs03zJ75AoNWEbuqz/mgTj2nJxCTVY06xVyibmUdQ6q1Zg==" /></div> + <form accept-charset="UTF-8" action="/tracierenea/gnuradio/star" class="js-toggler-form unstarred js-star-button" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="YV+ka/D8Pe3Ovn/2rVGsCh5lGs4XPrSp1KUgVE4idqs30UMIDNUtCdKltT7PxhofEBcVeDga4E+pD4hhUtcQqQ==" /></div> <button class="btn btn-sm btn-with-count js-toggler-target" aria-label="Star this repository" title="Star tracierenea/gnuradio" @@ -451,7 +451,7 @@ <div class="clone-options">You can clone with - <form accept-charset="UTF-8" action="/users/set_protocol?protocol_selector=http&protocol_type=clone" class="inline-form js-clone-selector-form is-enabled" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="LyAQbk93uAxXHA5Zm72ZrgpmnX7aa1FggzHN4/UMJ+WMvkqnmDmF7UIV0D1cciait+9i1emQCbo9lJbUQKMpWw==" /></div><button class="btn-link js-clone-selector" data-protocol="http" type="submit">HTTPS</button></form>, <form accept-charset="UTF-8" action="/users/set_protocol?protocol_selector=ssh&protocol_type=clone" class="inline-form js-clone-selector-form is-enabled" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="gNK1OxPeryI736DTfsyrEtOciCprLl7MRNT+8ksNq0/fXSJJWilP6S9iClhnjd2qhNgcPORSovvYG2V8A00i6g==" /></div><button class="btn-link js-clone-selector" data-protocol="ssh" type="submit">SSH</button></form>, or <form accept-charset="UTF-8" action="/users/set_protocol?protocol_selector=subversion&protocol_type=clone" class="inline-form js-clone-selector-form is-enabled" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="YEG8SvA8RHaDyQzJeitbHWTPC2ZONy1N6AqMeE7WxEEB/AZPKXCY4v13Si2pPcgKbE4aUBPdJNCvghspwy4KxQ==" /></div><button class="btn-link js-clone-selector" data-protocol="subversion" type="submit">Subversion</button></form>. + <form accept-charset="UTF-8" action="/users/set_protocol?protocol_selector=http&protocol_type=clone" class="inline-form js-clone-selector-form is-enabled" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="qZhIb8k+Rtg/9epjJZHB9t/AUs7MkVm56IxfGpPIYDNlfVooy8l61fste4cs0OJZokMqoRkPYKsANixchXX0AQ==" /></div><button class="btn-link js-clone-selector" data-protocol="http" type="submit">HTTPS</button></form>, <form accept-charset="UTF-8" action="/users/set_protocol?protocol_selector=ssh&protocol_type=clone" class="inline-form js-clone-selector-form is-enabled" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="3rNUjSHl9mT+102p7vM4X2fjdJ+OgJP1lpjvgX6BHGrFQh1qghqoTE3vDhCP/pAdtdk0yK2q6vQUWLJSvnUOOA==" /></div><button class="btn-link js-clone-selector" data-protocol="ssh" type="submit">SSH</button></form>, or <form accept-charset="UTF-8" action="/users/set_protocol?protocol_selector=subversion&protocol_type=clone" class="inline-form js-clone-selector-form is-enabled" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="pY4mQERqIQK34QKQDE9SKhOzjP3aqtG6lwHps/fTAs2kNYT5bH1CSrWAb9iXH7xYTObZjiAlGlalpIGKftwctg==" /></div><button class="btn-link js-clone-selector" data-protocol="subversion" type="submit">Subversion</button></form>. <a href="https://help.github.com/articles/which-remote-url-should-i-use" class="help tooltipped tooltipped-n" aria-label="Get help on which URL is right for you."> <span class="octicon octicon-question"></span> </a> @@ -1191,12 +1191,12 @@ </div> - <form accept-charset="UTF-8" action="/tracierenea/gnuradio/edit/fec/ldpc_methods/gr-fec/examples/ber_curve_gen.grc" class="inline-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="GQoG37mTfqCZ2GdqPXKQHPLC/JXEseK0DzqMtCU+gTDutVF28mNHk1nOUtFpM3zVpexkXsMyc5cUSexMhN9lmg==" /></div> + <form accept-charset="UTF-8" action="/tracierenea/gnuradio/edit/fec/ldpc_methods/gr-fec/examples/ber_curve_gen.grc" class="inline-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="pdMz6y3Qc+Xg4UiPTeILexuxC4zNGSStkVyOQURSGF+/DalsAyebe18YqW6ZYSKUXmeCyzcCWGaTJZed/B/8eg==" /></div> <button class="octicon-btn tooltipped tooltipped-n" type="submit" aria-label="Edit the file in your fork of this project" data-hotkey="e" data-disable-with> <span class="octicon octicon-pencil"></span> </button> </form> - <form accept-charset="UTF-8" action="/tracierenea/gnuradio/delete/fec/ldpc_methods/gr-fec/examples/ber_curve_gen.grc" class="inline-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="8DkZdBzfE4R+0w31Kf9ubE5pPoXol/gouz+SfAmMOs6GUogymS4RAqSFtIoccP5VmCDXUM1gV1V9wSjG6KznuA==" /></div> + <form accept-charset="UTF-8" action="/tracierenea/gnuradio/delete/fec/ldpc_methods/gr-fec/examples/ber_curve_gen.grc" class="inline-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="eW9TqN0SKYjmdn6bNUMiLdnISOYHcINtAYQ2Uw6hguvASzcFx6hvUVpZJIMd9C82Bt6aicFD7+PKp/WZkfQV/w==" /></div> <button class="octicon-btn octicon-btn-danger tooltipped tooltipped-n" type="submit" aria-label="Delete this file in your fork of this project" data-disable-with> <span class="octicon octicon-trashcan"></span> </button> @@ -11163,7 +11163,7 @@ <span class="mega-octicon octicon-mark-github" title="GitHub"></span> </a> <ul class="site-footer-links"> - <li>© 2015 <span title="0.25830s from github-fe131-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> + <li>© 2015 <span title="0.14614s from github-fe132-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml index 398ab8c468..d81d076162 100644 --- a/gr-fec/grc/fec_block_tree.xml +++ b/gr-fec/grc/fec_block_tree.xml @@ -49,5 +49,6 @@ <block>fec_bercurve_generator</block> <block>variable_polar_code_configurator</block> <block>variable_ldpc_par_chk_mtrx_def</block> + <block>variable_ldpc_R_U_mtrx_def</block> </cat> </cat> diff --git a/gr-fec/grc/variable_parity_check_matrix_object.xml b/gr-fec/grc/variable_ldpc_R_U_mtrx_object.xml index 11331af837..07edf86c8c 100644 --- a/gr-fec/grc/variable_parity_check_matrix_object.xml +++ b/gr-fec/grc/variable_ldpc_R_U_mtrx_object.xml @@ -6,9 +6,9 @@ --> <block> <name>LDPC Parity Check Matrix Object</name> - <key>variable_ldpc_par_chk_mtrx_def</key> + <key>variable_ldpc_R_U_mtrx_def</key> <import>from gnuradio import fec</import> - <var_make>self.$(id) = $(id) = fec.ldpc_par_chk_mtrx($filename, $gap)</var_make> + <var_make>self.$(id) = $(id) = fec.ldpc_R_U_mtrx($filename, $gap)</var_make> <make></make> diff --git a/gr-fec/include/gnuradio/fec/CMakeLists.txt b/gr-fec/include/gnuradio/fec/CMakeLists.txt index 861c4c2beb..cc5cee1b0c 100644 --- a/gr-fec/include/gnuradio/fec/CMakeLists.txt +++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt @@ -53,6 +53,7 @@ install(FILES polar_decoder_sc_list.h polar_decoder_common.h ldpc_par_chk_mtrx.h + ldpc_R_U_mtrx.h ldpc_bit_flip_decoder.h ldpc_R_U_encoder.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec diff --git a/gr-fec/include/gnuradio/fec/ldpc_R_U_encoder.h b/gr-fec/include/gnuradio/fec/ldpc_R_U_encoder.h index 90378d56c1..826bb6edd3 100644 --- a/gr-fec/include/gnuradio/fec/ldpc_R_U_encoder.h +++ b/gr-fec/include/gnuradio/fec/ldpc_R_U_encoder.h @@ -23,7 +23,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_encoder.h> -#include <gnuradio/fec/ldpc_par_chk_mtrx.h> +#include <gnuradio/fec/ldpc_R_U_mtrx.h> namespace gr { namespace fec { @@ -48,7 +48,7 @@ namespace gr { * for encoding. This is the same matrix used for * decoding. */ - static generic_encoder::sptr make(ldpc_par_chk_mtrx *H_obj); + static generic_encoder::sptr make(ldpc_R_U_mtrx *H_obj); /*! * Sets the uncoded frame size to \p frame_size. If \p diff --git a/gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h b/gr-fec/include/gnuradio/fec/ldpc_R_U_mtrx.h index 5b9efea771..216cc64431 100644 --- a/gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h +++ b/gr-fec/include/gnuradio/fec/ldpc_R_U_mtrx.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_ldpc_par_chk_mtrx_H -#define INCLUDED_ldpc_par_chk_mtrx_H +#ifndef INCLUDED_ldpc_R_U_mtrx_H +#define INCLUDED_ldpc_R_U_mtrx_H #include <gnuradio/fec/api.h> #include <string> @@ -33,7 +33,7 @@ namespace gr { namespace fec { namespace code { - class FEC_API ldpc_par_chk_mtrx + class FEC_API ldpc_R_U_mtrx { private: // Codeword length n (also the number of columns in the H @@ -63,9 +63,9 @@ namespace gr { void set_parameters_for_encoding(); public: - ldpc_par_chk_mtrx(const std::string filename, unsigned int gap); + ldpc_R_U_mtrx(const std::string filename, unsigned int gap); // Default constructor, should not be used - ldpc_par_chk_mtrx(); + ldpc_R_U_mtrx(); // Get the codeword length n unsigned int n(); // Get the information word length k @@ -88,10 +88,10 @@ namespace gr { // operations gsl_matrix *calc_inverse_mod2(const gsl_matrix *); // Destructor - ~ldpc_par_chk_mtrx(); + ~ldpc_R_U_mtrx(); }; } } } - #endif /* INCLUDED_ldpc_par_chk_mtrx_H */
\ No newline at end of file + #endif /* INCLUDED_ldpc_R_U_mtrx_H */
\ No newline at end of file diff --git a/gr-fec/include/gnuradio/fec/ldpc_bit_flip_decoder.h b/gr-fec/include/gnuradio/fec/ldpc_bit_flip_decoder.h index 628ec6afe2..05d47fc770 100644 --- a/gr-fec/include/gnuradio/fec/ldpc_bit_flip_decoder.h +++ b/gr-fec/include/gnuradio/fec/ldpc_bit_flip_decoder.h @@ -24,7 +24,7 @@ #include <gnuradio/fec/api.h> #include <gnuradio/fec/generic_decoder.h> -#include <gnuradio/fec/ldpc_par_chk_mtrx.h> +#include <gnuradio/fec/ldpc_R_U_mtrx.h> namespace gr { namespace fec { @@ -63,7 +63,7 @@ namespace gr { * \param n Number of bits in each transmitted codeword, * usually denoted "n" in the literature. */ - static generic_decoder::sptr make(ldpc_par_chk_mtrx *H_obj, + static generic_decoder::sptr make(ldpc_R_U_mtrx *H_obj, unsigned int max_iter=100); /*! * Sets the uncoded frame size to \p frame_size. If \p diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt index 5e4bf72b64..f7b45587ee 100644 --- a/gr-fec/lib/CMakeLists.txt +++ b/gr-fec/lib/CMakeLists.txt @@ -90,6 +90,7 @@ list(APPEND gnuradio_fec_sources scl_list.cc ldpc_par_chk_mtrx_impl.cc ldpc_par_chk_mtrx.cc + ldpc_R_U_mtrx.cc ldpc_bit_flip_decoder_impl.cc ldpc_R_U_encoder_impl.cc ) diff --git a/gr-fec/lib/ldpc_R_U_encoder_impl.cc b/gr-fec/lib/ldpc_R_U_encoder_impl.cc index 01ebfcac8d..37ec19281b 100644 --- a/gr-fec/lib/ldpc_R_U_encoder_impl.cc +++ b/gr-fec/lib/ldpc_R_U_encoder_impl.cc @@ -29,13 +29,13 @@ namespace gr { namespace fec { namespace code { generic_encoder::sptr - ldpc_R_U_encoder::make(ldpc_par_chk_mtrx *H_obj) + ldpc_R_U_encoder::make(ldpc_R_U_mtrx *H_obj) { return generic_encoder::sptr (new ldpc_R_U_encoder_impl(H_obj)); } - ldpc_R_U_encoder_impl::ldpc_R_U_encoder_impl(ldpc_par_chk_mtrx *H_obj) + ldpc_R_U_encoder_impl::ldpc_R_U_encoder_impl(ldpc_R_U_mtrx *H_obj) : generic_encoder("ldpc_R_U_encoder") { // LDPC parity check matrix to use for encoding diff --git a/gr-fec/lib/ldpc_R_U_encoder_impl.h b/gr-fec/lib/ldpc_R_U_encoder_impl.h index d2cacff718..6417380b59 100644 --- a/gr-fec/lib/ldpc_R_U_encoder_impl.h +++ b/gr-fec/lib/ldpc_R_U_encoder_impl.h @@ -24,7 +24,7 @@ #include <map> #include <string> #include <gnuradio/fec/ldpc_R_U_encoder.h> -#include <gnuradio/fec/ldpc_par_chk_mtrx.h> +#include <gnuradio/fec/ldpc_R_U_mtrx.h> namespace gr { namespace fec { @@ -39,10 +39,10 @@ namespace gr { // Number of bits in the information word unsigned int d_frame_size; // LDPC parity check matrix object to use for encoding - ldpc_par_chk_mtrx *d_H; + ldpc_R_U_mtrx *d_H; public: - ldpc_R_U_encoder_impl(ldpc_par_chk_mtrx *H_obj); + ldpc_R_U_encoder_impl(ldpc_R_U_mtrx *H_obj); ~ldpc_R_U_encoder_impl(); bool set_frame_size(unsigned int frame_size); diff --git a/gr-fec/lib/ldpc_par_chk_mtrx.cc b/gr-fec/lib/ldpc_R_U_mtrx.cc index 56c14d6d0c..a1e9116704 100644 --- a/gr-fec/lib/ldpc_par_chk_mtrx.cc +++ b/gr-fec/lib/ldpc_R_U_mtrx.cc @@ -21,7 +21,7 @@ #include "config.h" #endif -#include <gnuradio/fec/ldpc_par_chk_mtrx.h> +#include <gnuradio/fec/ldpc_R_U_mtrx.h> #include <math.h> #include <fstream> #include <vector> @@ -32,7 +32,7 @@ namespace gr { namespace fec { namespace code { - ldpc_par_chk_mtrx::ldpc_par_chk_mtrx(const std::string filename, unsigned int gap) + ldpc_R_U_mtrx::ldpc_R_U_mtrx(const std::string filename, unsigned int gap) { read_matrix_from_file(filename); d_gap = gap; @@ -40,77 +40,77 @@ namespace gr { } // Constructor // Default constructor, should not be used - ldpc_par_chk_mtrx::ldpc_par_chk_mtrx() + ldpc_R_U_mtrx::ldpc_R_U_mtrx() { - std::cout << "Error in ldpc_par_chk_mtrx(): Default " + std::cout << "Error in ldpc_R_U_mtrx(): Default " << "constructor called.\nMust provide filename for" << " parity check matrix. \n\n"; exit(1); } // Default constructor unsigned int - ldpc_par_chk_mtrx::n() + ldpc_R_U_mtrx::n() { return d_n; } unsigned int - ldpc_par_chk_mtrx::k() + ldpc_R_U_mtrx::k() { return d_k; } const gsl_matrix* - ldpc_par_chk_mtrx::H() + ldpc_R_U_mtrx::H() { const gsl_matrix *H_ptr = d_H_ptr; return H_ptr; } const gsl_matrix* - ldpc_par_chk_mtrx::A() + ldpc_R_U_mtrx::A() { const gsl_matrix *A_ptr = &d_A_view.matrix; return A_ptr; } const gsl_matrix* - ldpc_par_chk_mtrx::B() + ldpc_R_U_mtrx::B() { const gsl_matrix *B_ptr = &d_B_view.matrix; return B_ptr; } const gsl_matrix* - ldpc_par_chk_mtrx::D() + ldpc_R_U_mtrx::D() { const gsl_matrix *D_ptr = &d_D_view.matrix; return D_ptr; } const gsl_matrix* - ldpc_par_chk_mtrx::E() + ldpc_R_U_mtrx::E() { const gsl_matrix *E_ptr = &d_E_view.matrix; return E_ptr; } const gsl_matrix* - ldpc_par_chk_mtrx::T_inverse() + ldpc_R_U_mtrx::T_inverse() { const gsl_matrix *T_inverse_ptr = d_T_inverse_ptr; return T_inverse_ptr; } const gsl_matrix* - ldpc_par_chk_mtrx::phi_inverse() + ldpc_R_U_mtrx::phi_inverse() { const gsl_matrix *phi_inverse_ptr = d_phi_inverse_ptr; return phi_inverse_ptr; } void - ldpc_par_chk_mtrx::read_matrix_from_file(const std::string filename) + ldpc_R_U_mtrx::read_matrix_from_file(const std::string filename) { /* This function reads in an alist file and creates the corresponding parity check matrix. The format of alist @@ -176,7 +176,7 @@ namespace gr { } void - ldpc_par_chk_mtrx::set_parameters_for_encoding() + ldpc_R_U_mtrx::set_parameters_for_encoding() { // This function defines all of the submatrices that will be @@ -253,7 +253,7 @@ namespace gr { } gsl_matrix* - ldpc_par_chk_mtrx::add_matrices_mod2(const gsl_matrix *matrix1, const gsl_matrix *matrix2) + ldpc_R_U_mtrx::add_matrices_mod2(const gsl_matrix *matrix1, const gsl_matrix *matrix2) { // This function returns ((matrix1 + matrix2) % 2). // (same thing as ((matrix1 - matrix2) % 2) @@ -299,7 +299,7 @@ namespace gr { } gsl_matrix* - ldpc_par_chk_mtrx::mult_matrices_mod2(const gsl_matrix *matrix1, const gsl_matrix *matrix2) + ldpc_R_U_mtrx::mult_matrices_mod2(const gsl_matrix *matrix1, const gsl_matrix *matrix2) { // Verify that matrix sizes are appropriate unsigned int a = (*matrix1).size1; // # of rows @@ -308,7 +308,7 @@ namespace gr { unsigned int d = (*matrix2).size2; // # of columns if (b != c) { std::cout << "Error in " - << "ldpc_par_chk_mtrx::mult_matrices_mod2." + << "ldpc_R_U_mtrx::mult_matrices_mod2." << " Matrix dimensions do not allow for matrix " << "multiplication operation:\nmatrix1 is " << a << " x " << b << ", and matrix2 is " << c @@ -338,7 +338,7 @@ namespace gr { } gsl_matrix* - ldpc_par_chk_mtrx::calc_inverse_mod2(const gsl_matrix *original_matrix) + ldpc_R_U_mtrx::calc_inverse_mod2(const gsl_matrix *original_matrix) { // Let n represent the size of the n x n square matrix @@ -426,7 +426,7 @@ namespace gr { return matrix_inverse; } - ldpc_par_chk_mtrx::~ldpc_par_chk_mtrx() + ldpc_R_U_mtrx::~ldpc_R_U_mtrx() { // Call the gsl_matrix_free function to free memory. gsl_matrix_free (d_H_ptr); diff --git a/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc b/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc index dd5051df39..effc9ad56d 100644 --- a/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc +++ b/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc @@ -35,14 +35,14 @@ namespace gr { namespace code { generic_decoder::sptr - ldpc_bit_flip_decoder::make(ldpc_par_chk_mtrx *H_obj, + ldpc_bit_flip_decoder::make(ldpc_R_U_mtrx *H_obj, unsigned int max_iter) { return generic_decoder::sptr (new ldpc_bit_flip_decoder_impl(H_obj, max_iter)); } - ldpc_bit_flip_decoder_impl::ldpc_bit_flip_decoder_impl(ldpc_par_chk_mtrx *H_obj, unsigned int max_iter) + ldpc_bit_flip_decoder_impl::ldpc_bit_flip_decoder_impl(ldpc_R_U_mtrx *H_obj, unsigned int max_iter) : generic_decoder("ldpc_bit_flip_decoder") { // LDPC parity check matrix to use for decoding @@ -56,9 +56,6 @@ namespace gr { ldpc_bit_flip_decoder_impl::~ldpc_bit_flip_decoder_impl() { - // Free memory - gsl_matrix_free(d_syndrome); - gsl_matrix_free(d_x); } int @@ -102,24 +99,24 @@ namespace gr { const float *in = (const float*)inbuffer; unsigned int index, n = d_H->n(); - d_x = gsl_matrix_alloc(n, 1); + gsl_matrix *x = gsl_matrix_alloc(n, 1); for (index = 0; index < n; index++) { double value = in[index] > 0 ? 1.0 : 0.0; - gsl_matrix_set(d_x, index, 0, value); + gsl_matrix_set(x, index, 0, value); } // Initialize counter unsigned int count = 0; // Calculate syndrome - d_syndrome = d_H->mult_matrices_mod2(d_H->H(), d_x); + gsl_matrix *syndrome = d_H->mult_matrices_mod2(d_H->H(),x); // Flag for finding a valid codeword bool found_word = false; // If the syndrome is all 0s, then codeword is valid and we // don't need to loop; we're done. - if (gsl_matrix_isnull(d_syndrome)) { + if (gsl_matrix_isnull(syndrome)) { found_word = true; } @@ -132,8 +129,8 @@ namespace gr { // syndrome. The entry numbers correspond to the rows of // interest in H. std::vector<int> rows_of_interest_in_H; - for (index = 0; index < (*d_syndrome).size1; index++) { - if (gsl_matrix_get(d_syndrome, index, 0)) { + for (index = 0; index < (*syndrome).size1; index++) { + if (gsl_matrix_get(syndrome, index, 0)) { rows_of_interest_in_H.push_back(index); } } @@ -166,15 +163,15 @@ namespace gr { for (index = 0; index < n; index++) { if (counts[index] == max) { - unsigned int value = gsl_matrix_get(d_x, index, 0); + unsigned int value = gsl_matrix_get(x, index, 0); unsigned int new_value = value ^ 1; - gsl_matrix_set(d_x, index, 0, new_value); + gsl_matrix_set(x, index, 0, new_value); } } // Check the syndrome; see if valid codeword has been found - d_syndrome = d_H->mult_matrices_mod2(d_H->H(), d_x); - if (gsl_matrix_isnull(d_syndrome)) { + syndrome = d_H->mult_matrices_mod2(d_H->H(), x); + if (gsl_matrix_isnull(syndrome)) { found_word = true; break; } @@ -186,10 +183,14 @@ namespace gr { unsigned char *out = (unsigned char*) outbuffer; for (index = 0; index < d_frame_size; index++) { unsigned int i = index + n - d_frame_size; - int value = gsl_matrix_get(d_x, i, 0); + int value = gsl_matrix_get(x, i, 0); out[index] = value; - } + + // Free memory + gsl_matrix_free(syndrome); + gsl_matrix_free(x); + } /* ldpc_bit_flip_decoder_impl::generic_work() */ } /* namespace code */ } /* namespace fec */ diff --git a/gr-fec/lib/ldpc_bit_flip_decoder_impl.h b/gr-fec/lib/ldpc_bit_flip_decoder_impl.h index 8763750e1c..bbb4620888 100644 --- a/gr-fec/lib/ldpc_bit_flip_decoder_impl.h +++ b/gr-fec/lib/ldpc_bit_flip_decoder_impl.h @@ -22,7 +22,7 @@ #define INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_IMPL_H #include <gnuradio/fec/ldpc_bit_flip_decoder.h> -#include <gnuradio/fec/ldpc_par_chk_mtrx.h> +#include <gnuradio/fec/ldpc_R_U_mtrx.h> namespace gr { namespace fec { @@ -37,16 +37,12 @@ namespace gr { unsigned int d_frame_size; // LDPC parity check matrix object to use for decoding - ldpc_par_chk_mtrx *d_H; + ldpc_R_U_mtrx *d_H; // Maximum number of iterations to do in decoding algorithm unsigned int d_max_iterations; - // Syndrome for each codeword guess - gsl_matrix *d_syndrome; - // Codeword - gsl_matrix *d_x; public: - ldpc_bit_flip_decoder_impl(ldpc_par_chk_mtrx *H_obj, + ldpc_bit_flip_decoder_impl(ldpc_R_U_mtrx *H_obj, unsigned int max_iter=100); ~ldpc_bit_flip_decoder_impl(); diff --git a/gr-fec/python/fec/qa_fecapi_ldpc.py b/gr-fec/python/fec/qa_fecapi_ldpc.py index e731197952..08c7a836b7 100644 --- a/gr-fec/python/fec/qa_fecapi_ldpc.py +++ b/gr-fec/python/fec/qa_fecapi_ldpc.py @@ -38,7 +38,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): def test_parallelism0_00(self): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = fec.ldpc_R_U_encoder_make(LDPC_matrix_object) dec = fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object) @@ -55,7 +55,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): def test_parallelism0_01(self): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = fec.ldpc_R_U_encoder_make(LDPC_matrix_object) dec = fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object) @@ -72,7 +72,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): def test_parallelism0_02(self): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = fec.ldpc_R_U_encoder_make(LDPC_matrix_object) dec = fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object) @@ -86,11 +86,10 @@ class test_fecapi_ldpc(gr_unittest.TestCase): self.assertEqual(data_in, data_out) - def test_parallelism1_00(self): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,1)) dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,1)) @@ -107,7 +106,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): def test_parallelism1_01(self): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,1)) dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,1)) @@ -124,7 +123,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): def test_parallelism1_02(self): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,1)) dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,1)) @@ -142,7 +141,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 10 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,dims)) dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,dims)) @@ -160,7 +159,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 16 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,dims)) dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,dims)) @@ -178,7 +177,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 5 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,dims)) # dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,dims)) @@ -189,7 +188,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 5 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() # enc = map((lambda a: fec.ldpc_R_U_encoder_make(LDPC_matrix_object)), range(0,dims)) dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object)), range(0,dims)) @@ -200,7 +199,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 5 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() dims1 = 16 dims2 = 16 @@ -213,7 +212,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 5 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() dims1 = 16 dims2 = 16 @@ -226,7 +225,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase): filename = "LDPC/n_0100_k_0027_gap_04.alist" gap = 4 dims = 5 - LDPC_matrix_object = fec.ldpc_par_chk_mtrx(filename, gap) + LDPC_matrix_object = fec.ldpc_R_U_mtrx(filename, gap) k = LDPC_matrix_object.k() dims1 = 16 dims2 = 16 diff --git a/gr-fec/swig/fec_swig.i b/gr-fec/swig/fec_swig.i index 20fdc8af4e..64e6fa4caa 100644 --- a/gr-fec/swig/fec_swig.i +++ b/gr-fec/swig/fec_swig.i @@ -68,6 +68,7 @@ #include "gnuradio/fec/polar_decoder_sc_list.h" #include "gnuradio/fec/polar_decoder_common.h" #include "gnuradio/fec/ldpc_par_chk_mtrx.h" +#include "gnuradio/fec/ldpc_R_U_mtrx.h" #include "gnuradio/fec/ldpc_bit_flip_decoder.h" #include "gnuradio/fec/ldpc_R_U_encoder.h" %} @@ -99,6 +100,7 @@ %include "gnuradio/fec/tpc_encoder.h" %include "gnuradio/fec/tpc_decoder.h" %include "gnuradio/fec/ldpc_par_chk_mtrx.h" +%include "gnuradio/fec/ldpc_R_U_mtrx.h" %include "gnuradio/fec/ldpc_bit_flip_decoder.h" %include "gnuradio/fec/ldpc_R_U_encoder.h" |