Re: [Discuss-gnuradio] volk float32->int8 kernel and thus float_to_char block round or floor, depending on VOLK machine

2018-06-09 Thread Paul Boven
Hi Marcus, I would prefer that when going from float to int, every 'bin' should have equal size. So I can think of two ways to do that: 1) zero corresponds to [-0.5 : 0.4999] or 2) zero corresponds to [0.0 : 0.99] whereas the 'generic' optimization does 3) zero corresponds to [-1 t

Re: [Discuss-gnuradio] volk float32->int8 kernel and thus float_to_char block round or floor, depending on VOLK machine

2018-06-09 Thread CEL
Hi Paul, I agree with everything you say. Float to char should behave *exactly* like float to int and short. Will fix it in that way. Will also have a truncating version, maybe. I've just added 3 lines of code to the current implementation to demonstrate it's trivial to change the rounding mode. X

Re: [Discuss-gnuradio] volk float32->int8 kernel and thus float_to_char block round or floor, depending on VOLK machine

2018-06-09 Thread CEL
Oh wait, it gets better: while the float->int16 does indeed use rintf, float->int32 doesn't… now we don't have a majority situation pro- rounding anymore… argh. On Sat, 2018-06-09 at 19:24 +, Müller, Marcus (CEL) wrote: > Hi Paul, > > I agree with everything you say. Float to char should behav

Re: [Discuss-gnuradio] volk float32->int8 kernel and thus float_to_char block round or floor, depending on VOLK machine

2018-06-09 Thread Paul Boven
Hi again, Ugh, you're right. When looking at the Volk libraries, I find: Int: int() for generic, like rintf() with acceleration Short: always rintf() Char: int() for generic, like rintf() with acceleration but occasionally int(). The thing that puzzled me is that I cannot get GnuRadio to show

Re: [Discuss-gnuradio] volk float32->int8 kernel and thus float_to_char block round or floor, depending on VOLK machine

2018-06-09 Thread Paul Boven
Hi again, I just realised an internal inconsistency in what I wrote, and had to dig a bit deeper still: In Volk, float to int has two behaviours, like described below. But the Float->Int block does not call the Volk routines. Instead, it calls float_array_to_int, which in turn calls llrintf(

[Discuss-gnuradio] volk float32->int8 kernel and thus float_to_char block round or floor, depending on VOLK machine (was: Re: Incorrect quantizations when converting from float to char)

2018-06-09 Thread CEL
Hi Paul, yes, this seems to be the case where the "naive" C implementation behaves differently from all the SIMD ones: As far as I know – but I'm desparately looking for any standards document that specifies that – doing a int8_t val = (int8_t) 8.8f; will always lead to 8, whereas int8_t val