diff options
author | michaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5> | 2006-10-14 18:40:03 +0000 |
---|---|---|
committer | michaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5> | 2006-10-14 18:40:03 +0000 |
commit | a8012b9695d4fca3eaed265c6fcb7db282c93557 (patch) | |
tree | 310356a96e1ae53258b1f0ab8da84a859d1ead76 /gr-error-correcting-codes/src | |
parent | 076fd769e77a757d582c50856be20b0f8f16c224 (diff) |
Fix for ticket:80 .
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3787 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-error-correcting-codes/src')
4 files changed, 48 insertions, 38 deletions
diff --git a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc index 23d172f300..bfe44f17a7 100644 --- a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc +++ b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc @@ -29,11 +29,11 @@ #include <assert.h> ecc_syms_to_metrics_sptr -ecc_make_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, +ecc_make_syms_to_metrics (gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision) { return ecc_syms_to_metrics_sptr @@ -46,29 +46,29 @@ ecc_make_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit, } /* - * dummy functions and variables to get the float(*)(float) function + * dummy functions and variables to get the double(*)(double) function * to work properly with the gr_feval_XX stuff. */ -static gr_feval_ff* l_pdf_fcn_0_bit; -static gr_feval_ff* l_pdf_fcn_1_bit; +static gr_feval_dd* l_pdf_fcn_0_bit; +static gr_feval_dd* l_pdf_fcn_1_bit; -static float pdf_fcn_0 (float x) +static double pdf_fcn_0 (double x) { return (l_pdf_fcn_0_bit->eval (x)); } -static float pdf_fcn_1 (float x) +static double pdf_fcn_1 (double x) { return (l_pdf_fcn_1_bit->eval (x)); } ecc_syms_to_metrics::ecc_syms_to_metrics -(gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, +(gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision) : gr_block ("syms_to_metrics", gr_make_io_signature (1, -1, sizeof (float)), @@ -84,7 +84,7 @@ ecc_syms_to_metrics::ecc_syms_to_metrics // use the static "create" member function to create the actual // code_metrics to use. - d_code_metrics_table = libecc_code_metrics_create_table<float> + d_code_metrics_table = libecc_code_metrics_create_table<double> (&pdf_fcn_0, &pdf_fcn_1, n_samples, @@ -132,7 +132,7 @@ ecc_syms_to_metrics::general_work size_t l_n_output_items = noutput_items; for (size_t n = 0; n < input_items.size(); n++) { - float* t_in_buf = (float*)(&input_items[n]); + double* t_in_buf = (double*)(&input_items[n]); void* t_out_buf_0_bit = (void*)(&(output_items[2*n])); void* t_out_buf_1_bit = (void*)(&(output_items[(2*n)+1])); d_code_metrics_table->convert (l_n_output_items, t_in_buf, diff --git a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h index 7818f4bee8..c5f853cd35 100644 --- a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h +++ b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h @@ -32,11 +32,11 @@ class ecc_syms_to_metrics; typedef boost::shared_ptr<ecc_syms_to_metrics> ecc_syms_to_metrics_sptr; ecc_syms_to_metrics_sptr ecc_make_syms_to_metrics -(gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, +(gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision); /*! @@ -53,11 +53,11 @@ class ecc_syms_to_metrics : public gr_block { protected: friend ecc_syms_to_metrics_sptr - ecc_make_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, + ecc_make_syms_to_metrics (gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision); /* @@ -70,10 +70,10 @@ protected: * faster processing. * * pdf_fcn_0_bit: point to a probability distribution function which - * takes a float and returns a float, for the 0-bit probabilities. + * takes a double and returns a double, for the 0-bit probabilities. * * pdf_fcn_1_bit: point to a probability distribution function which - * takes a float and returns a float, for the 1-bit probabilities. + * takes a double and returns a double, for the 1-bit probabilities. * * n_samples: the number of samples between min_sample and max_sample * to store in the lookup table. Must be at least 2, but @@ -98,15 +98,15 @@ protected: * */ - ecc_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, + ecc_syms_to_metrics (gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision); size_t d_out_item_size_bytes; - code_metrics_table<float>* d_code_metrics_table; + code_metrics_table<double>* d_code_metrics_table; public: ~ecc_syms_to_metrics() {delete d_code_metrics_table;}; diff --git a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.i b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.i index 60f2eea27e..32a8304738 100644 --- a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.i +++ b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.i @@ -23,19 +23,19 @@ GR_SWIG_BLOCK_MAGIC(ecc,syms_to_metrics); ecc_syms_to_metrics_sptr ecc_make_syms_to_metrics -(gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, +(gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision); class ecc_syms_to_metrics : public gr_block { - ecc_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit, - gr_feval_ff* pdf_fcn_1_bit, + ecc_syms_to_metrics (gr_feval_dd* pdf_fcn_0_bit, + gr_feval_dd* pdf_fcn_1_bit, int n_samples, - float min_sample, - float max_sample, + double min_sample, + double max_sample, int sample_precision); }; diff --git a/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc b/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc index 0cd43c5047..db402b3ebe 100644 --- a/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc +++ b/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc @@ -339,6 +339,16 @@ libecc_code_metrics_create_table<float> float max_sample, int sample_precision); +template +code_metrics_table<double>* +libecc_code_metrics_create_table<double> +(double (*pdf_fcn_0_bit) (double), + double (*pdf_fcn_1_bit) (double), + size_t n_samples, + double min_sample, + double max_sample, + int sample_precision); + #if 0 // for compute_all_outputs |