diff options
author | anastas | 2006-08-23 05:18:04 +0000 |
---|---|---|
committer | anastas | 2006-08-23 05:18:04 +0000 |
commit | 979ae071d508762513981a063961551b59199081 (patch) | |
tree | 672f7711baf0404b3304c86f93f76fd263afe80c /gr-trellis/src | |
parent | 180347e40854f865a1592af729a00236f061d039 (diff) | |
download | gnuradio-979ae071d508762513981a063961551b59199081.tar.gz gnuradio-979ae071d508762513981a063961551b59199081.tar.bz2 gnuradio-979ae071d508762513981a063961551b59199081.zip |
clean-up of Viterbi blocks: d_trace is not a private variable anymore but a local variable
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3382 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/src')
20 files changed, 156 insertions, 148 deletions
diff --git a/gr-trellis/src/lib/trellis_viterbi_X.cc.t b/gr-trellis/src/lib/trellis_viterbi_X.cc.t index 8f02320d6..01a05ef14 100644 --- a/gr-trellis/src/lib/trellis_viterbi_X.cc.t +++ b/gr-trellis/src/lib/trellis_viterbi_X.cc.t @@ -52,8 +52,8 @@ trellis_make_@BASE_NAME@ ( d_FSM (FSM), d_K (K), d_S0 (S0), - d_SK (SK), - d_trace(FSM.S()*K) + d_SK (SK)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_FSM.O())); set_output_multiple (d_K); @@ -81,9 +81,10 @@ void viterbi_algorithm(int I, int S, int O, const std::vector<int> &PI, int K, int S0,int SK, - const float *in, @TYPE@ *out, - std::vector<int> &trace) + const float *in, @TYPE@ *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); int alphai; float norm,mm,minm; @@ -158,7 +159,7 @@ int const float *in = (const float *) input_items[m]; @TYPE@ *out = (@TYPE@ *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]),d_trace); + viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_X.h.t b/gr-trellis/src/lib/trellis_viterbi_X.h.t index f06fdfdcd..05926851a 100644 --- a/gr-trellis/src/lib/trellis_viterbi_X.h.t +++ b/gr-trellis/src/lib/trellis_viterbi_X.h.t @@ -45,7 +45,7 @@ class @NAME@ : public gr_block int d_K; int d_S0; int d_SK; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, diff --git a/gr-trellis/src/lib/trellis_viterbi_b.cc b/gr-trellis/src/lib/trellis_viterbi_b.cc index ce2778aff..a9fc0bfab 100644 --- a/gr-trellis/src/lib/trellis_viterbi_b.cc +++ b/gr-trellis/src/lib/trellis_viterbi_b.cc @@ -52,8 +52,8 @@ trellis_viterbi_b::trellis_viterbi_b ( d_FSM (FSM), d_K (K), d_S0 (S0), - d_SK (SK), - d_trace(FSM.S()*K) + d_SK (SK)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_FSM.O())); set_output_multiple (d_K); @@ -81,9 +81,10 @@ void viterbi_algorithm(int I, int S, int O, const std::vector<int> &PI, int K, int S0,int SK, - const float *in, unsigned char *out, - std::vector<int> &trace) + const float *in, unsigned char *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); int alphai; float norm,mm,minm; @@ -158,7 +159,7 @@ trellis_viterbi_b::general_work (int noutput_items, const float *in = (const float *) input_items[m]; unsigned char *out = (unsigned char *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]),d_trace); + viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_b.h b/gr-trellis/src/lib/trellis_viterbi_b.h index c1c359b12..c2e2070bf 100644 --- a/gr-trellis/src/lib/trellis_viterbi_b.h +++ b/gr-trellis/src/lib/trellis_viterbi_b.h @@ -45,7 +45,7 @@ class trellis_viterbi_b : public gr_block int d_K; int d_S0; int d_SK; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend trellis_viterbi_b_sptr trellis_make_viterbi_b ( const fsm &FSM, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t b/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t index de2079ad0..76b7fb38a 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_X.cc.t @@ -34,35 +34,35 @@ static const float INF = 1.0e9; @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) { - return @SPTR_NAME@ (new @NAME@ (FSM,D,TABLE,K,S0,SK,TYPE)); + return @SPTR_NAME@ (new @NAME@ (FSM,K,S0,SK,D,TABLE,TYPE)); } @NAME@::@NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) : gr_block ("@BASE_NAME@", gr_make_io_signature (1, -1, sizeof (float)), gr_make_io_signature (1, -1, sizeof (@TYPE@))), d_FSM (FSM), - d_D (D), - d_TABLE (TABLE), d_K (K), d_S0 (S0), d_SK (SK), - d_TYPE (TYPE), - d_trace(FSM.S()*K) + d_D (D), + d_TABLE (TABLE), + d_TYPE (TYPE)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_D)); set_output_multiple (d_K); @@ -88,14 +88,15 @@ void viterbi_algorithm_combined(int I, int S, int O, const std::vector<int> &OS, const std::vector<int> &PS, const std::vector<int> &PI, - int D, - const std::vector<float> &TABLE, int K, int S0,int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE, - const float *in, @TYPE@ *out, - std::vector<int> &trace) + const float *in, @TYPE@ *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); float *metric = new float[O]; int alphai; @@ -173,7 +174,7 @@ int const float *in = (const float *) input_items[m]; @TYPE@ *out = (@TYPE@ *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace); + viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t b/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t index 14f565202..172a710d7 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_X.h.t @@ -34,52 +34,52 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); class @NAME@ : public gr_block { fsm d_FSM; - int d_D; - std::vector<float> d_TABLE; int d_K; int d_S0; int d_SK; + int d_D; + std::vector<float> d_TABLE; trellis_metric_type_t d_TYPE; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); @NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<int> trace () const { return d_trace; } void forecast (int noutput_items, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t b/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t index e4b68402c..d54aba4f1 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_X.i.t @@ -26,11 +26,11 @@ GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); @SPTR_NAME@ trellis_make_@BASE_NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); @@ -39,20 +39,20 @@ class @NAME@ : public gr_block private: @NAME@ ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<short> trace () const { return d_trace; } }; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_b.cc b/gr-trellis/src/lib/trellis_viterbi_combined_b.cc index 2d245f58b..86501ac76 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_b.cc +++ b/gr-trellis/src/lib/trellis_viterbi_combined_b.cc @@ -34,35 +34,35 @@ static const float INF = 1.0e9; trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) { - return trellis_viterbi_combined_b_sptr (new trellis_viterbi_combined_b (FSM,D,TABLE,K,S0,SK,TYPE)); + return trellis_viterbi_combined_b_sptr (new trellis_viterbi_combined_b (FSM,K,S0,SK,D,TABLE,TYPE)); } trellis_viterbi_combined_b::trellis_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) : gr_block ("viterbi_combined_b", gr_make_io_signature (1, -1, sizeof (float)), gr_make_io_signature (1, -1, sizeof (unsigned char))), d_FSM (FSM), - d_D (D), - d_TABLE (TABLE), d_K (K), d_S0 (S0), d_SK (SK), - d_TYPE (TYPE), - d_trace(FSM.S()*K) + d_D (D), + d_TABLE (TABLE), + d_TYPE (TYPE)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_D)); set_output_multiple (d_K); @@ -88,14 +88,15 @@ void viterbi_algorithm_combined(int I, int S, int O, const std::vector<int> &OS, const std::vector<int> &PS, const std::vector<int> &PI, - int D, - const std::vector<float> &TABLE, int K, int S0,int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE, - const float *in, unsigned char *out, - std::vector<int> &trace) + const float *in, unsigned char *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); float *metric = new float[O]; int alphai; @@ -173,7 +174,7 @@ trellis_viterbi_combined_b::general_work (int noutput_items, const float *in = (const float *) input_items[m]; unsigned char *out = (unsigned char *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace); + viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_b.h b/gr-trellis/src/lib/trellis_viterbi_combined_b.h index 5de0924d7..87792a562 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_b.h +++ b/gr-trellis/src/lib/trellis_viterbi_combined_b.h @@ -34,52 +34,52 @@ typedef boost::shared_ptr<trellis_viterbi_combined_b> trellis_viterbi_combined_b trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); class trellis_viterbi_combined_b : public gr_block { fsm d_FSM; - int d_D; - std::vector<float> d_TABLE; int d_K; int d_S0; int d_SK; + int d_D; + std::vector<float> d_TABLE; trellis_metric_type_t d_TYPE; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); trellis_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<int> trace () const { return d_trace; } void forecast (int noutput_items, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_b.i b/gr-trellis/src/lib/trellis_viterbi_combined_b.i index 069860893..ec58c62ba 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_b.i +++ b/gr-trellis/src/lib/trellis_viterbi_combined_b.i @@ -26,11 +26,11 @@ GR_SWIG_BLOCK_MAGIC(trellis,viterbi_combined_b); trellis_viterbi_combined_b_sptr trellis_make_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); @@ -39,20 +39,20 @@ class trellis_viterbi_combined_b : public gr_block private: trellis_viterbi_combined_b ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<short> trace () const { return d_trace; } }; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_i.cc b/gr-trellis/src/lib/trellis_viterbi_combined_i.cc index 4506fd127..a92e7b35d 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_i.cc +++ b/gr-trellis/src/lib/trellis_viterbi_combined_i.cc @@ -34,35 +34,35 @@ static const float INF = 1.0e9; trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) { - return trellis_viterbi_combined_i_sptr (new trellis_viterbi_combined_i (FSM,D,TABLE,K,S0,SK,TYPE)); + return trellis_viterbi_combined_i_sptr (new trellis_viterbi_combined_i (FSM,K,S0,SK,D,TABLE,TYPE)); } trellis_viterbi_combined_i::trellis_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) : gr_block ("viterbi_combined_i", gr_make_io_signature (1, -1, sizeof (float)), gr_make_io_signature (1, -1, sizeof (int))), d_FSM (FSM), - d_D (D), - d_TABLE (TABLE), d_K (K), d_S0 (S0), d_SK (SK), - d_TYPE (TYPE), - d_trace(FSM.S()*K) + d_D (D), + d_TABLE (TABLE), + d_TYPE (TYPE)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_D)); set_output_multiple (d_K); @@ -88,14 +88,15 @@ void viterbi_algorithm_combined(int I, int S, int O, const std::vector<int> &OS, const std::vector<int> &PS, const std::vector<int> &PI, - int D, - const std::vector<float> &TABLE, int K, int S0,int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE, - const float *in, int *out, - std::vector<int> &trace) + const float *in, int *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); float *metric = new float[O]; int alphai; @@ -173,7 +174,7 @@ trellis_viterbi_combined_i::general_work (int noutput_items, const float *in = (const float *) input_items[m]; int *out = (int *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace); + viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_i.h b/gr-trellis/src/lib/trellis_viterbi_combined_i.h index 1ac5d7d1d..39287eb91 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_i.h +++ b/gr-trellis/src/lib/trellis_viterbi_combined_i.h @@ -34,52 +34,52 @@ typedef boost::shared_ptr<trellis_viterbi_combined_i> trellis_viterbi_combined_i trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); class trellis_viterbi_combined_i : public gr_block { fsm d_FSM; - int d_D; - std::vector<float> d_TABLE; int d_K; int d_S0; int d_SK; + int d_D; + std::vector<float> d_TABLE; trellis_metric_type_t d_TYPE; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); trellis_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<int> trace () const { return d_trace; } void forecast (int noutput_items, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_i.i b/gr-trellis/src/lib/trellis_viterbi_combined_i.i index 05d68d580..47bea54e2 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_i.i +++ b/gr-trellis/src/lib/trellis_viterbi_combined_i.i @@ -26,11 +26,11 @@ GR_SWIG_BLOCK_MAGIC(trellis,viterbi_combined_i); trellis_viterbi_combined_i_sptr trellis_make_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); @@ -39,20 +39,20 @@ class trellis_viterbi_combined_i : public gr_block private: trellis_viterbi_combined_i ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<short> trace () const { return d_trace; } }; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_s.cc b/gr-trellis/src/lib/trellis_viterbi_combined_s.cc index f103db229..b664f6e95 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_s.cc +++ b/gr-trellis/src/lib/trellis_viterbi_combined_s.cc @@ -34,35 +34,35 @@ static const float INF = 1.0e9; trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) { - return trellis_viterbi_combined_s_sptr (new trellis_viterbi_combined_s (FSM,D,TABLE,K,S0,SK,TYPE)); + return trellis_viterbi_combined_s_sptr (new trellis_viterbi_combined_s (FSM,K,S0,SK,D,TABLE,TYPE)); } trellis_viterbi_combined_s::trellis_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE) : gr_block ("viterbi_combined_s", gr_make_io_signature (1, -1, sizeof (float)), gr_make_io_signature (1, -1, sizeof (short))), d_FSM (FSM), - d_D (D), - d_TABLE (TABLE), d_K (K), d_S0 (S0), d_SK (SK), - d_TYPE (TYPE), - d_trace(FSM.S()*K) + d_D (D), + d_TABLE (TABLE), + d_TYPE (TYPE)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_D)); set_output_multiple (d_K); @@ -88,14 +88,15 @@ void viterbi_algorithm_combined(int I, int S, int O, const std::vector<int> &OS, const std::vector<int> &PS, const std::vector<int> &PI, - int D, - const std::vector<float> &TABLE, int K, int S0,int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE, - const float *in, short *out, - std::vector<int> &trace) + const float *in, short *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); float *metric = new float[O]; int alphai; @@ -173,7 +174,7 @@ trellis_viterbi_combined_s::general_work (int noutput_items, const float *in = (const float *) input_items[m]; short *out = (short *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_D,d_TABLE,d_K,d_S0,d_SK,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]),d_trace); + viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_s.h b/gr-trellis/src/lib/trellis_viterbi_combined_s.h index c174c5f01..f4448e40c 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_s.h +++ b/gr-trellis/src/lib/trellis_viterbi_combined_s.h @@ -34,52 +34,52 @@ typedef boost::shared_ptr<trellis_viterbi_combined_s> trellis_viterbi_combined_s trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); class trellis_viterbi_combined_s : public gr_block { fsm d_FSM; - int d_D; - std::vector<float> d_TABLE; int d_K; int d_S0; int d_SK; + int d_D; + std::vector<float> d_TABLE; trellis_metric_type_t d_TYPE; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); trellis_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<int> trace () const { return d_trace; } void forecast (int noutput_items, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_s.i b/gr-trellis/src/lib/trellis_viterbi_combined_s.i index c1d5693a2..e6c8d2ff8 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_s.i +++ b/gr-trellis/src/lib/trellis_viterbi_combined_s.i @@ -26,11 +26,11 @@ GR_SWIG_BLOCK_MAGIC(trellis,viterbi_combined_s); trellis_viterbi_combined_s_sptr trellis_make_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); @@ -39,20 +39,20 @@ class trellis_viterbi_combined_s : public gr_block private: trellis_viterbi_combined_s ( const fsm &FSM, - int D, - const std::vector<float> &TABLE, int K, int S0, int SK, + int D, + const std::vector<float> &TABLE, trellis_metric_type_t TYPE); public: fsm FSM () const { return d_FSM; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } int K () const { return d_K; } int S0 () const { return d_S0; } int SK () const { return d_SK; } + int D () const { return d_D; } + std::vector<float> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<short> trace () const { return d_trace; } }; diff --git a/gr-trellis/src/lib/trellis_viterbi_i.cc b/gr-trellis/src/lib/trellis_viterbi_i.cc index 2ff304ebb..8119f816b 100644 --- a/gr-trellis/src/lib/trellis_viterbi_i.cc +++ b/gr-trellis/src/lib/trellis_viterbi_i.cc @@ -52,8 +52,8 @@ trellis_viterbi_i::trellis_viterbi_i ( d_FSM (FSM), d_K (K), d_S0 (S0), - d_SK (SK), - d_trace(FSM.S()*K) + d_SK (SK)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_FSM.O())); set_output_multiple (d_K); @@ -81,9 +81,10 @@ void viterbi_algorithm(int I, int S, int O, const std::vector<int> &PI, int K, int S0,int SK, - const float *in, int *out, - std::vector<int> &trace) + const float *in, int *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); int alphai; float norm,mm,minm; @@ -158,7 +159,7 @@ trellis_viterbi_i::general_work (int noutput_items, const float *in = (const float *) input_items[m]; int *out = (int *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]),d_trace); + viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_i.h b/gr-trellis/src/lib/trellis_viterbi_i.h index 86ac89876..2379a8590 100644 --- a/gr-trellis/src/lib/trellis_viterbi_i.h +++ b/gr-trellis/src/lib/trellis_viterbi_i.h @@ -45,7 +45,7 @@ class trellis_viterbi_i : public gr_block int d_K; int d_S0; int d_SK; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend trellis_viterbi_i_sptr trellis_make_viterbi_i ( const fsm &FSM, diff --git a/gr-trellis/src/lib/trellis_viterbi_s.cc b/gr-trellis/src/lib/trellis_viterbi_s.cc index bb3dafa61..be8fd37b0 100644 --- a/gr-trellis/src/lib/trellis_viterbi_s.cc +++ b/gr-trellis/src/lib/trellis_viterbi_s.cc @@ -52,8 +52,8 @@ trellis_viterbi_s::trellis_viterbi_s ( d_FSM (FSM), d_K (K), d_S0 (S0), - d_SK (SK), - d_trace(FSM.S()*K) + d_SK (SK)//, + //d_trace(FSM.S()*K) { set_relative_rate (1.0 / ((double) d_FSM.O())); set_output_multiple (d_K); @@ -81,9 +81,10 @@ void viterbi_algorithm(int I, int S, int O, const std::vector<int> &PI, int K, int S0,int SK, - const float *in, short *out, - std::vector<int> &trace) + const float *in, short *out)//, + //std::vector<int> &trace) { + std::vector<int> trace(S*K); std::vector<float> alpha(S*2); int alphai; float norm,mm,minm; @@ -158,7 +159,7 @@ trellis_viterbi_s::general_work (int noutput_items, const float *in = (const float *) input_items[m]; short *out = (short *) output_items[m]; for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]),d_trace); + viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); } } diff --git a/gr-trellis/src/lib/trellis_viterbi_s.h b/gr-trellis/src/lib/trellis_viterbi_s.h index 6232ce5bf..e4cee1cd9 100644 --- a/gr-trellis/src/lib/trellis_viterbi_s.h +++ b/gr-trellis/src/lib/trellis_viterbi_s.h @@ -45,7 +45,7 @@ class trellis_viterbi_s : public gr_block int d_K; int d_S0; int d_SK; - std::vector<int> d_trace; + //std::vector<int> d_trace; friend trellis_viterbi_s_sptr trellis_make_viterbi_s ( const fsm &FSM, |