I'm 99% sure it's `(int16_t)(x * 32768)` which is what I found in the source code and I use it to save memory footprint. (Also the uhd library doesn't seem to take advantage of simd....)
On Wed, Jan 24, 2018 at 7:04 PM, Dario Fertonani via USRP-users <usrp-users@lists.ettus.com> wrote: > No luck. I'll look into these: > https://files.ettus.com/manual/convert__common_8hpp.html > > On Wed, Jan 24, 2018 at 2:58 PM, Jeff Long via USRP-users > <usrp-users@lists.ettus.com> wrote: >> >> Try (int16_t) round( x * 32767 ) >> >> On Wed, Jan 24, 2018 at 5:01 PM, Dario Fertonani via USRP-users >> <usrp-users@lists.ettus.com> wrote: >>> >>> Any pointer to a C/C++ function (maybe in the UHD source code, or a doc) >>> that converts IQ samples from format fc32 to sc16? I'm referring to "CPU >>> sample format", not "wire sample format". >>> >>> For C++ UHD, I know fc32 is complex< float > and sc16 is complex< int16_t >>> >. I'm tempted to assume that each component is obtained through some simple >>> conversion rule (for example, multiply the float value of the real/imag part >>> by 1024.0f and cast/round it to int16_t). Is this correct? If so, what is >>> the scaling factor? I know things are more complicated with wire sample >>> formats (especially sc12), so I wanted to get a confirmation. >>> >>> Thanks, >>> Dario >>> >>> _______________________________________________ >>> USRP-users mailing list >>> USRP-users@lists.ettus.com >>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com >>> >> >> >> _______________________________________________ >> USRP-users mailing list >> USRP-users@lists.ettus.com >> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com >> > > > _______________________________________________ > USRP-users mailing list > USRP-users@lists.ettus.com > http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com > _______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com