Michael, Marcus,
Right now, the code is a work in progress so I
haven't made a git repository out of it. However, I have
it on dropbox. Here's the link to the source
folder(p1_detector_impl.cc is the source in question):
https://www.dropbox.com/sh/blfmxsaidrkh28t/AAArp8IHavzCGFlJs6E6-Hrca?dl=0
As for Marcus's question regarding why use a circular
buffer?
It isn't exactly a circular buffer now, but more of a
shift register. The reasons are as follows:
1. I needed running sums for correlations in B-Branch
and C-Branch correlators, and Power Sums (for average
power) to normalize them. Then, I also needed a finite
delay buffer to delay the C-Branch before it gets
multiplied with the B-Branch.
2. It
kind of carried over from the last implementation
attempt:
Assertion:
If a peak is detected after the multiplication, the
signal boundary is 1024 samples behind that index.
Once
the correlations crossed a threshold (the code entered
state=1), instead
of looking back, I then needed to look forward to
see if it were a false alarm or not.
So, I compute the correlations across all available
current inputs and try to find a peak. If a peak is
found, enter state=3 where we do a correlation with
the carrier distribution sequence after FFT of all
signals of interest. So, here, I not only needed just
the single value (the running sum), but the entire
state of the delay register and the B-Branch
correlator.
I
hope I am able to convey the reason for implementing
one myself.
In
the current implementation, I make an assumption that
the threshold is so high that only the desired signals
would cross it (100-150 times the average). So I skip
the state=1 logic and directly go into state=2 logic
of aggressively doing a FFT and correlation with the
CDS.
However,
I don't think this has a binding on the incoming
values. Use of buffers is internal to the
implementation, I am just printing out the current
values as they arrive.
For
example, when I use the test file in 'make test', the
values fed in are non-zero from t=1. However, when
using gnuradio-companion, t=56 line is where the file
source starts yielding proper inputs to my block. The
stdout prints of the initial values in both GRC and
make tests are attached. The gnuradio-companion
version has my first 55 samples zeroed and the 56th
input onward is then same for both.
P.S.: The source stream is a 1.2 Gigs file, so
haven't uploaded it. If you'd like I can do that too. It
was generated by using a DVB-T2 Tx block and writing the
output into a file sink.
_______________________________________________