From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: alsa-lib and floating point support Date: Wed, 20 Sep 2017 13:26:13 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id ECA12266B21 for ; Wed, 20 Sep 2017 13:26:13 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Ricard Wanderlof Cc: alsa-devel , Mersad Jelacic List-Id: alsa-devel@alsa-project.org On Wed, 20 Sep 2017 12:55:30 +0200, Ricard Wanderlof wrote: > > > We recently came across an issue with the alsa-lib softvol plugin, which > requires hardware floating-point (i.e. --with-softfloat not enabled during > build) support in order to use anything but a set of default values (min > gain -51 dB, max 0 dB, and 256 gain steps). With no hardware floating > point support, the plugin just prints an error message when loaded. > > static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol, > ... > #ifndef HAVE_SOFT_FLOAT > ... > double v = (pow(10.0, db / 20.0) * (double)(1 << > VOL_SCALE_SHIFT)); > ... > #else > SNDERR("Cannot handle the given dB range and resolution"); > return -EINVAL; > #endif > } > ... > > I'm trying to understand why it is critical to have hardware floating > point support in this case. The pow() function is very resource hungry, > true, but the function is only called when the plugin is loaded, and not > for instance on every sample while the stream is running, so on the whole > I would expect the impact to be minimal. Is there some other rationale > that I'm missing? The softfloat option is to avoid calculation in float as much as possible, i.e. alsa-lib will be built without any usage of math library. Takashi