Added a siso_combined block analogous to the viterbi_combined; useful for FSMs with...
[debian/gnuradio] / gr-trellis / src / lib / trellis_siso_f.cc
index df364fc659d1ef0086eac624ed01cc3438bad80b..6d8548194655aaa4918a8d76a97308434e5251b7 100644 (file)
@@ -62,9 +62,9 @@ trellis_siso_f::trellis_siso_f (
   d_SK (SK),
   d_POSTI (POSTI),
   d_POSTO (POSTO),
-  d_SISO_TYPE (SISO_TYPE),
-  d_alpha(FSM.S()*(K+1)),
-  d_beta(FSM.S()*(K+1))
+  d_SISO_TYPE (SISO_TYPE)//,
+  //d_alpha(FSM.S()*(K+1)),
+  //d_beta(FSM.S()*(K+1))
 {
     int multiple;
     if (d_POSTI && d_POSTO) 
@@ -77,10 +77,16 @@ trellis_siso_f::trellis_siso_f (
         throw std::runtime_error ("Not both POSTI and POSTO can be false.");
     //printf("constructor: Multiple = %d\n",multiple);
     set_output_multiple (d_K*multiple);
-    //what is the meaning of relative rate for this?
-    // it was suggested to use the one furthest from 1.0
-    // let's do it.
-    set_relative_rate ( multiple / ((double) d_FSM.I()) );
+    //what is the meaning of relative rate for a block with 2 inputs?
+    //set_relative_rate ( multiple / ((double) d_FSM.I()) );
+    // it turns out that the above gives problems in the scheduler, so 
+    // let's try (assumption O>I)
+    //set_relative_rate ( multiple / ((double) d_FSM.O()) );
+    // I am tempted to automate like this
+    if(d_FSM.I() <= d_FSM.O())
+      set_relative_rate ( multiple / ((double) d_FSM.O()) );
+    else
+      set_relative_rate ( multiple / ((double) d_FSM.I()) ); 
 }
 
 
@@ -129,11 +135,14 @@ void siso_algorithm(int I, int S, int O,
              int S0,int SK,
              bool POSTI, bool POSTO,
              float (*p2mymin)(float,float),
-             const float *priori, const float *prioro, float *post,
-             std::vector<float> &alpha,
-             std::vector<float> &beta) 
+             const float *priori, const float *prioro, float *post//,
+             //std::vector<float> &alpha,
+             //std::vector<float> &beta
+             ) 
 {
   float norm,mm,minm;
+  std::vector<float> alpha(S*(K+1));
+  std::vector<float> beta(S*(K+1));
 
 
   if(S0<0) { // initial state not specified
@@ -309,8 +318,9 @@ trellis_siso_f::general_work (int noutput_items,
         d_POSTI,d_POSTO,
         p2min,
         &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_FSM.O()]),
-        &(out[n*d_K*multiple]),
-        d_alpha,d_beta);
+        &(out[n*d_K*multiple])//,
+        //d_alpha,d_beta
+        );
     }
   }