From: Takashi Iwai <tiwai@suse.de>
To: "Daniel Glöckner" <dg@emlix.com>
Cc: Eliot Blennerhassett <linux@audioscience.com>,
alsa-devel@alsa-project.org
Subject: Re: Support for floating point controls?
Date: Tue, 02 Feb 2010 11:44:23 +0100 [thread overview]
Message-ID: <s5hvdefapdk.wl%tiwai@suse.de> (raw)
In-Reply-To: <4B67F98A.1000208@emlix.com>
At Tue, 02 Feb 2010 11:08:10 +0100,
Daniel Glöckner wrote:
>
> On 01/28/2010 12:12 AM, Eliot Blennerhassett wrote:
> > I wonder if a patch implementing float ctl elements would be accepted?
> > Note that the floats are not manipulated in the kernel at all, the
> > values are just passed through from the hardware to userspace (?)
> >
> > Adding something like:
> >
> > #define SNDRV_CTL_ELEM_TYPE_FLOAT ((__force snd_ctl_elem_type_t) 7)
> >
> > struct snd_ctl_elem_info {
> > ...
> > union {
> > struct {
> > float min; /* R: minimum value */
> > float max; /* R: maximum value */
> > float step; /* R: step (0 variable) */
> > } float;
> > ...
> > }
> >
> > struct snd_ctl_elem_value {
> > union {
> > union {
> > float value[128];
> > } float;
>
> I see several issues here.
> There might be some day an architecture where float is not the
> IEEE 754 single precision type. Or there might be a compiler that
> insists on using floating point instructions to read those values
> from memory. Therefore I prefer __s32 here instead of float.
>
> Drivers would have to check if a passed control value is in the
> range [min, max] and filter out INFs and NANs. So one needs to
> implement an in-kernel version of C99's fpclassify and isgreater
> working on floating point values kept in integer variables for
> all drivers to use.
>
> Alsa-lib may need to convert the IEEE floats to the native floats
> if they are not the same. Just look at the issues with double on
> ARM. There the order of the two 32 bit halves in memory depends on
> the ABI IIRC.
Well, I think you see way too far unnecessarily :)
In the kernel level, we won't handle any FP operations.
If any, the driver could, but it should be a specific way.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2010-02-02 10:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 23:12 Support for floating point controls? Eliot Blennerhassett
2010-02-01 16:43 ` Jaroslav Kysela
2010-02-01 16:57 ` Takashi Iwai
2010-02-01 18:13 ` James Courtier-Dutton
2010-02-01 19:42 ` Eliot Blennerhassett
2010-02-02 10:08 ` Daniel Glöckner
2010-02-02 10:44 ` Takashi Iwai [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-02-01 16:13 Tobias Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hvdefapdk.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=dg@emlix.com \
--cc=linux@audioscience.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).