[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] splitting bits
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] splitting bits |
Date: |
Thu, 10 Jan 2008 13:51:26 -0800 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
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.
*/