Skip to contentSkip to conversation

About integer64

DISCUSSION Abramo Bagnara 3 participants 5 messages May 9, 2002

lore
Share & tools
lore
#0 lore raw

I don't think that's a bad thing to have support for 64 bit integers (perhaps for future use, who knows), but I think that to use this to store a fixed point float is a big mistake.

If you think for it you realize that it's *not* an integer and applications are betrayed in their expectation.

I see two possible solutions:
1) convert internal representation to float (or double) and add support for this type of data
2) use SNDRV_CTL_ELEM_TYPE_BYTES

As I've already said I prefer 1) but too 2) is far better that to have a wrong use of a data type.

Signature · 13 lines
Abramo Bagnara                       mailto:[email protected]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy

ALSA project               http://www.alsa-project.org
It sounds good!

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [email protected]
#1 lore raw
Quoted 8 lines · Abramo Bagnara

I don't think that's a bad thing to have support for 64 bit integers (perhaps for future use, who knows), but I think that to use this to store a fixed point float is a big mistake.

If you think for it you realize that it's *not* an integer and applications are betrayed in their expectation.

Quoted 7 lines

I see two possible solutions:
1) convert internal representation to float (or double) and add support for this type of data
2) use SNDRV_CTL_ELEM_TYPE_BYTES

As I've already said I prefer 1) but too 2) is far better that to have a wrong use of a data type.

I fully agree. We can add a float type when necessary, but only when it follows IEEE-754. Hardware specific formats should be encapsulated into more generic types...

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [email protected]

#2 lore raw
In reply to Abramo Bagnara
Quoted 7 lines

I don't think that's a bad thing to have support for 64 bit integers (perhaps for future use, who knows), but I think that to use this to store a fixed point float is a big mistake.

If you think for it you realize that it's *not* an integer and applications are betrayed in their expectation.

in this case, it *is* an integer. your original question was about why its 64 bits - i think that comes from the fixed point internal arithmetic. but the end result is a straightforward 64 bit little endian integer that needs scaling to get the actual RMS value.

which actually creates another problem that i've noticed with the control API. INTEGER and INTEGER64 assume that the control value is signed. there is no way to infer from the control element info that its unsigned. this isn't a "deep" problem, but it will mess up user interfaces that present a large unsigned value and end up displaying it as a negative number.

--p

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [email protected]

#3 lore raw
Quoted 13 lines · Paul Davis
Quoted 8 lines

I don't think that's a bad thing to have support for 64 bit integers (perhaps for future use, who knows), but I think that to use this to store a fixed point float is a big mistake.

If you think for it you realize that it's *not* an integer and applications are betrayed in their expectation.

in this case, it *is* an integer. your original question was about why its 64 bits - i think that comes from the fixed point internal arithmetic. but the end result is a straightforward 64 bit little endian integer that needs scaling to get the actual RMS value.

Quoted 8 lines · You

It seems that the 64 bit-ness comes from it being some
kind of fixed point representation - the value that you read from the registers need scaling (in user space, presumably) by a floating point transformation to actually become true RMS values. so its not so much they they need 64 bits of precision, more that the hardware needs to do the math with this type of data format. keep in mind the computation is all being done on a Xilinx FPGA, not a DSP chip, so the arithmetic options are (at this time) a bit limited.

What I'm misunderstanding? I tend to interpret the former and the latter statements in a contradictory way.

Signature · 13 lines
Abramo Bagnara                       mailto:[email protected]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy

ALSA project               http://www.alsa-project.org
It sounds good!

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [email protected]
#4 lore raw
Quoted 2 lines

What I'm misunderstanding? I tend to interpret the former and the latter statements in a contradictory way.

my reading of the "docs" (the Mac OS X driver and utilities) is that RME haven't figured out a way to truncate the 64 bit fixed point representation to a 32 bit integer using the Xilinx FPGA. they have figured out how to render it as a 64 bit integer. so, they do the math using a fixed point representation, then transform to 64 bit integer when storing it in the register. the final part of the transform is done by the host CPU, in our case up in user space since we can't do float math conveniently in the kernel.

does that make it clearer?

--p

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [email protected]