discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] splitting bits


From: Steven Clark
Subject: Re: [Discuss-gnuradio] splitting bits
Date: Thu, 10 Jan 2008 17:24:06 -0500

I had looked at those blocks, but can't figure out a way to get them to do what I want...
(2,3,1) into gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) gives:
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
rather than:
(1,0,1,1,0,1)

*bang head on keyboard in search of enlightenment*


On Jan 10, 2008 4:51 PM, Eric Blossom <address@hidden> wrote:
On Thu, Jan 10, 2008 at 04:43:17PM -0500, Steven Clark wrote:
> Hey folks-
>
> Let's say I have a stream of shorts whose values are one of [0,1,2,3] (in
> other words, the bottom 2 bits are active). I want to split these bits, so
> that:
> [2,3,3,1,0] -> [1,0,1,1,1,1,0,1,0,0], etc.
>
> What block(s) can help me achieve this?


gr_packed_to_unpacked or gr_chunks_to_symbols are probably close to
what you're looking for.

Eric


/*!
 * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts.
 * \ingroup block
 *
 * input: stream of @I_TYPE@; output: stream of @O_TYPE@
 *
 * This is the inverse of gr_unpacked_to_packed_XX.
 *
 * The bits in the bytes or shorts input stream are grouped into chunks of
 * \p bits_per_chunk bits and each resulting chunk is written right-
 * justified to the output stream of bytes or shorts.
 * All b or 16 bits of the each input bytes or short are processed.
 * The right thing is done if bits_per_chunk is not a power of two.
 *
 * The combination of gr_packed_to_unpacked_XX_ followed by
 * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the
 * general case of mapping from a stream of bytes or shorts into
 * arbitrary float or complex symbols.
 *
 * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
 * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss,
 * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
 * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc.
 */


reply via email to

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