discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Bug in block::declare_sample_delay


From: Eugene Grayver
Subject: [Discuss-gnuradio] Bug in block::declare_sample_delay
Date: Wed, 19 Aug 2015 22:25:29 +0000

Hello,

I think that the declare_sample_delay (and/or the way it is used) is implemented incorrectly for interpolator blocks.  Using GR 3.7.6.

 

The delay should be added **after** scaling the offset by the interpolation ratio, not before.  For example, using the filter.interp_fir_filter(4,[1,2,3,4]):

If a tag is on sample2, and the sample_delay is declared as one, the output tag should be on sample 2*4+1=9.  However, it falls on sample 12 = (2+1)*4.

 

Here’s an example to demonstrate the error:

 

 

from gnuradio import gr, blocks, filter

import pmt

 

top = gr.top_block()

tag = gr.tag_utils.python_to_tag((2,

                                  pmt.to_pmt('A'),

                                  pmt.PMT_NIL,

                                  pmt.PMT_NIL))

 

src = "" 50, 10), tags=[tag])

dut = filter.interp_fir_filter_fff(4, [1, 2, 3, 4])

dut.declare_sample_delay(1)

snk = blocks.vector_sink_f()

 

top.connect(src, dut, snk)

top.run()

 

result = snk.data()

tags = snk.tags()

print tags[0].offset

 

Regards.

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]