How to save/read sc8 format to/from file and convert it to complex float 32?

Hi gurus,

  • Which is the simplest way, preferably directly in grc, to compactly
    save 8bit I/Q data (sc8) from an UHD source to a file instead the of the
    standard format complex float 32 (which is 4 times larger) ?

  • Then also, how to convert received and saved sc8 data to the normal
    complex float 32 in grc?

The reason is that I want to take advantage of the sc8 reduced precision
by reducing the file size when storing received data to file. That is,
not only halve the bandwidth “over the wire” (compared to sc16) but also
reduce the file size when storing.

Or is there alternative and better ways to accomplish this when
receiving and saving raw 8 bit I/Q data?

In GRC I see its possible to select the output format “complex int 16”,
instead of the standard “complex float 32”, but I don’t find how to
process or interpret this format further (e.g. saving, reading,
converting to complex float 32, etc).

Thanks,
Rickard

1 Like

On Thu, Jun 06, 2013 at 11:27:02AM -0400, Josh B. wrote:

A block that implements this conversion w/ a configurable scalar would
be ideal.

That would be very nice. I’ve been using (for input from sc8 file to a
complex flowgraph):

UChar to Float -> Deinterleave => Float to Complex

Since my samples are unsigned chars, this gives me an offset of
approximately 128 that I can correct with Add Const either before
Deinterleave or after Float to Complex (where it is 128+128j).

Unsigned sc8 is the primary data format used by HackRF, so this may be
interesting to other HackRF users. The conversion is handled by
gr-osmosdr when communicating with a HackRF directly from GNU Radio, but
files transmitted or received via the hackrf_transfer utility are in the
unsigned sc8 format.

Mike

On Thu, Jun 6, 2013 at 11:46 AM, Michael O. [email protected]
wrote:

Since my samples are unsigned chars, this gives me an offset of
approximately 128 that I can correct with Add Const either before
Deinterleave or after Float to Complex (where it is 128+128j).

Unsigned sc8 is the primary data format used by HackRF, so this may be
interesting to other HackRF users. The conversion is handled by
gr-osmosdr when communicating with a HackRF directly from GNU Radio, but
files transmitted or received via the hackrf_transfer utility are in the
unsigned sc8 format.

Mike

Most of our conversion blocks use Volk now, which also accepts a
scalar as part of the conversion process. Very efficient. The
uchar_to_float block doesn’t use Volk, probably because there’s no
currently existing Volk kernel for it.

It should be an easy mod to add the right kernel (if it doesn’t exist)
and then use it in the block. Should speed things up a lot.

Tom

On 06/06/2013 06:38 AM, Rickard wrote:

Hi gurus,

  • Which is the simplest way, preferably directly in grc, to compactly
    save 8bit I/Q data (sc8) from an UHD source to a file instead the of
    the standard format complex float 32 (which is 4 times larger) ?

  • Then also, how to convert received and saved sc8 data to the normal
    complex float 32 in grc?

A block that implements this conversion w/ a configurable scalar would
be ideal. But there may not be such a direct block: there are float to
char, char to float converters. And you can use this with complex
to/from float and vector to/from streams block to get the two lanes of
data into one.

-josh