discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] unpack k bits block with a new created block


From: Johannes Demel
Subject: Re: [Discuss-gnuradio] unpack k bits block with a new created block
Date: Wed, 17 Jun 2015 09:22:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hey David,

you should be able to store your bits in a vector.
First of all, unpack_k_bits will yield bytes with the LSB carrying the
actual bit. All the others should be '0'.

Next, the error you get points in another direction. One of the
parameters 'work' gets is a vector with void pointers. It's up to you
to deal with them correctly. Most block's work functions start with
converting those void pointers to the actual data type they're
supposed to deal with.
e.g. const float* in = (const float*) input_items[0];

in your case the compiler complains that you don't do a conversion to
int. Be aware that 'unpack_k_bits' deals with char. Thus casting your
input buffer to int, will cause some unindented beaviour.

from 'pack_k_bits'
const unsigned char *in = (const unsigned char *)input_items[0];
and then do something like
vec[i] = (int) in[i];
in a loop.

Cheers
Johannes

On 17.06.2015 05:09, dcardona wrote:
> HI
> 
> I'm using the unpack k bits block (which is located at the output
> of a vector source), before the new block that I'm trying to
> create. I would want to save all the bits at the output of the
> unpacked k bits block, in a vector (inside the block), so I can
> manipulate them individually. Is it possible? I thought each bit at
> the unpack_k_bit block's output would be one of the input_items in
> my block, Is this right? I tried to do that defining a new integer
> type vector inside the block and save there all the input_items[i]
> and then use that vector in my code. But it is giving me this
> error: invalid conversion from ‘const void*’ to ‘int’ 
> [-fpermissive]
> 
> I don't know if I can do something like this.
> 
> Thank you very much.
> 
> David
> 
> 
> 
> -- View this message in context:
> http://gnuradio.4.n7.nabble.com/unpack-k-bits-block-with-a-new-created-block-tp54234.html
>
> 
Sent from the GnuRadio mailing list archive at Nabble.com.
> 
> _______________________________________________ Discuss-gnuradio
> mailing list address@hidden 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 



reply via email to

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