summaryrefslogtreecommitdiff
path: root/gr-digital/lib/digital_constellation.cc
diff options
context:
space:
mode:
authorTom Rondeau2011-06-03 17:56:27 -0400
committerTom Rondeau2011-06-03 17:56:27 -0400
commit6ffd5d207483b05b0137608a428563b3cead3d26 (patch)
tree28cb998ee52cddc291199b2ccc82d4dd231b7356 /gr-digital/lib/digital_constellation.cc
parent7d1d1902c54dc8feeb5742592e28403011602708 (diff)
downloadgnuradio-6ffd5d207483b05b0137608a428563b3cead3d26.tar.gz
gnuradio-6ffd5d207483b05b0137608a428563b3cead3d26.tar.bz2
gnuradio-6ffd5d207483b05b0137608a428563b3cead3d26.zip
digital: fixing 8psk constellation object to properly slice.
Diffstat (limited to 'gr-digital/lib/digital_constellation.cc')
-rw-r--r--gr-digital/lib/digital_constellation.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc
index bfed84320..edf0bda22 100644
--- a/gr-digital/lib/digital_constellation.cc
+++ b/gr-digital/lib/digital_constellation.cc
@@ -433,7 +433,7 @@ digital_constellation_8psk::digital_constellation_8psk ()
d_constellation.resize(8);
// Gray-coded
d_constellation[0] = gr_complex(cos( 1*angle), sin( 1*angle));
- d_constellation[1] = gr_complex(cos( 7*angle), sin( 3*angle));
+ d_constellation[1] = gr_complex(cos( 7*angle), sin( 7*angle));
d_constellation[2] = gr_complex(cos(15*angle), sin(15*angle));
d_constellation[3] = gr_complex(cos( 9*angle), sin( 9*angle));
d_constellation[4] = gr_complex(cos( 3*angle), sin( 3*angle));
@@ -448,17 +448,17 @@ digital_constellation_8psk::digital_constellation_8psk ()
unsigned int
digital_constellation_8psk::decision_maker(const gr_complex *sample)
{
- // Real component determines small bit.
- // Imag component determines big bit.
- return 2*(imag(*sample)>0) + (real(*sample)>0);
+ unsigned int ret = 0;
- unsigned int real, imag;
- imag = 2*(sample->imag()<=0);
- real = (sample->real()<=0);
- if(abs(sample->real()) >= abs(sample->imag())) {
- return 0 + imag + real;
- }
- else {
- return 4 + imag + real;
- }
+ float re = sample->real();
+ float im = sample->imag();
+
+ if(fabsf(re) <= fabsf(im))
+ ret = 4;
+ if(re <= 0)
+ ret |= 1;
+ if(im <= 0)
+ ret |= 2;
+
+ return ret;
}