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. */ _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio