Vincenzo,
what you want is already implemented in gnuradio.
Take a look at the following classes/blocks in gr-trellis:
interleaver.h/i/cc
trellis_permutation.h/i/cc
Brief summary:
1) generate a text file (see below) describing your permutation (or have
your favorite program generate it automatically)
2) Instantiate an "interleaver" object with this file
3) instantiate two "permutation" blocks (one for
the interleaver and one for the deinterleaver) in your code.
Eg,
----
interleaver=trellis.interleaver("myfile.txt")
inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,1)
deinter = trellis.permutation(interleaver.K(),interleaver.DEINTER(),1,1)
----
the meaning of the last two parameters can be seen from looking at
the above files/examples, but in your case (where you interleave bytes)
should be just 1 and 1.
the text file has the following format (in your case):
6048 (the size of the permutation)
3 1 0 5 .... (N numbers in {0,1,...,6047} describing what goes where)
eg, if I want to permute 5 items at a time you would generate the
following file:
5
4 3 2 1 0
(this will just reverse the order of incoming symbols, ie
the first becomes fifth, the second fourth, etc).
I hope this is clear. Let me know if you have any problems with this,
Achilleas
Vincenzo Pellegrini wrote:
Thanks Achilleas Thanks Eric,
Yes Achilleas, what you have described is right exactly what I need.
the constant permutation is indeed a vector hard coded in my block.
my problem is that I could neither set the step of the cycle
for (int i = 0; i < noutput_items; i+= STEP){
as far as 1512, nor as far as 6048.. (well'if I do it runs but the
output has no meaning)
another thing I've tried is to demultiplex my input stream into many
output streams in order to do interleaving among them, but I don't think
it's a good idea.. and actually works only as far as 1512.
Yesterday I realized how to do that by passing just big vectors to my
block but I'm still failing to get it to work on vectors longer than
1512 bytes.. :)
what I'm working upon is a dvbt transmitter, as described in
http://www.com-tech.it/downloads/en_300744.pdf
I'm (slowly, because I also have to keep up with my academic duties)
climbing up the functional block chain towards the aerial.. :D
so where I think I am now is the Inner Interleaver..
very many thank for listening
vincenzo
On Tue, 2007-05-29 at 10:48 -0400, Achilleas Anastasopoulos wrote:
vincenzo,
let me make sure I understand what you want to implement:
You want a block that processes N=6048 BYTES at a time.
The input is x1,x2,x3....,xN
and the output is another N=6048 bytes which are a
permutation of the input block, ie,
y1,y2,....,yN
such that
y(i)=x(permutation(i)).
Next time another block of N BYTES is input and permuted in the same
way, etc...
The "permutation" function is prespecified and constant
throughout the operation.
Is this correct?
If not, could you please specify exactly the functionality
you want to implement.
Achilleas