Forum: GNU Radio "Variable" bit rate output block

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Johnathan C. (Guest)
on 2006-06-07 07:46
(Received via mailing list)
I'd like to write a block that has a variable output rate for a given
fixed input rate.

What I have in mind is something like gr.simple_squelch_cc, but instead
of outputting zeros when the average power is below the threshold,
doesn't output anything at all.

The How to Write A Block document says "Adroit use of forecast and
consume allows variable rate blocks to be built..."

Are there any examples to study?  Perhaps a pseudo code explanation of
what to do?

Thanks,

-Johnathan
Johnathan C. (Guest)
on 2006-06-07 09:12
(Received via mailing list)
Johnathan C. wrote:

> What I have in mind is something like gr.simple_squelch_cc, but instead
> of outputting zeros when the average power is below the threshold,
> doesn't output anything at all.

After further reading, it seems like the strategy here would be to have
the general_work() method the block:

1) Only copy data from input to output when the power threshold is met.

2) When the power threshold is not met, skip over the input items but
don't advance the output index.

2) Call consume() for the entire input buffer.

3) Return from general_work() with the actual number of items copied,
which will always be equal or less than the input buffer size.

Would this work?

-Johnathan, AE6HO
Eric B. (Guest)
on 2006-06-07 10:01
(Received via mailing list)
On Tue, Jun 06, 2006 at 10:10:40PM -0700, Johnathan C. wrote:
>
> 2) When the power threshold is not met, skip over the input items but
> don't advance the output index.
>
> 2) Call consume() for the entire input buffer.
>
> 3) Return from general_work() with the actual number of items copied,
> which will always be equal or less than the input buffer size.
>
> Would this work?

In general, yes.

Eric
Johnathan C. (Guest)
on 2006-06-07 23:48
(Received via mailing list)
Johnathan C. wrote:

>> What I have in mind is something like gr.simple_squelch_cc, but instead
>> of outputting zeros when the average power is below the threshold,
>> doesn't output anything at all.

A patch to gr.simple_squelch_cc, implementing this functionality, has
been sent to the patch-gnuradio mailing list.

-Johnathan, AE6HO
This topic is locked and can not be replied to.