mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Andreas Pretzsch <apr@cn-eng.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH 1/2] libsamplerate: add package
Date: Sat, 18 Apr 2015 00:22:16 +0200	[thread overview]
Message-ID: <1429309336.18974.63.camel@ws-apr.office.loc> (raw)
In-Reply-To: <20130909084405.GB31967@pengutronix.de>

On Mo, 2013-09-09 at 10:44 +0200, Michael Olbrich wrote:
> On Fri, Aug 23, 2013 at 06:04:47PM +0200, Andreas Pretzsch wrote:
> > Secret Rabbit Code (aka libsamplerate) is a Sample Rate Converter for audio.
> > It is used e.g. by alsaloop from alsa-utils.
> > More information, source and docs: http://www.mega-nerd.com/SRC/
> > 
> > Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
> > ---
> >  rules/libsamplerate.in   |    7 +++++
> >  rules/libsamplerate.make |   71 ++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 78 insertions(+)
> >  create mode 100644 rules/libsamplerate.in
> >  create mode 100644 rules/libsamplerate.make
> > 
> > diff --git a/rules/libsamplerate.in b/rules/libsamplerate.in
> > new file mode 100644
> > index 0000000..4bdc265
> > --- /dev/null
> > +++ b/rules/libsamplerate.in
> > @@ -0,0 +1,7 @@
> > +## SECTION=multimedia_libs
> > +
> > +config LIBSAMPLERATE
> > +	bool
> > +	prompt "libsamplerate"
> > +	help
> > +	  Secret Rabbit Code (aka libsamplerate) is a Sample Rate Converter for audio.
> > diff --git a/rules/libsamplerate.make b/rules/libsamplerate.make
> > new file mode 100644
> > index 0000000..a1ccf60
> > --- /dev/null
> > +++ b/rules/libsamplerate.make
> > @@ -0,0 +1,71 @@
> > +# -*-makefile-*-
> > +#
> > +# Copyright (C) 2013 by Andreas Pretzsch <apr@cn-eng.de>
> > +#
> > +# See CREDITS for details about who has contributed to this project.
> > +#
> > +# For further information about the PTXdist project and license conditions
> > +# see the README file.
> > +#
> > +
> > +#
> > +# We provide this package
> > +#
> > +PACKAGES-$(PTXCONF_LIBSAMPLERATE) += libsamplerate
> > +
> > +#
> > +# Paths and names
> > +#
> > +LIBSAMPLERATE_VERSION	:= 0.1.8
> > +LIBSAMPLERATE_MD5	:= 1c7fb25191b4e6e3628d198a66a84f47
> > +LIBSAMPLERATE		:= libsamplerate-$(LIBSAMPLERATE_VERSION)
> > +LIBSAMPLERATE_SUFFIX	:= tar.gz
> > +LIBSAMPLERATE_URL	:= http://www.mega-nerd.com/SRC/$(LIBSAMPLERATE).$(LIBSAMPLERATE_SUFFIX)
> > +LIBSAMPLERATE_SOURCE	:= $(SRCDIR)/$(LIBSAMPLERATE).$(LIBSAMPLERATE_SUFFIX)
> > +LIBSAMPLERATE_DIR	:= $(BUILDDIR)/$(LIBSAMPLERATE)
> > +LIBSAMPLERATE_LICENSE	:= GPLv2+
> > +
> > +# ----------------------------------------------------------------------------
> > +# Extract
> > +# ----------------------------------------------------------------------------
> > +
> > +$(STATEDIR)/libsamplerate.extract:
> > +	@$(call targetinfo)
> > +	@$(call clean, $(LIBSAMPLERATE_DIR))
> > +	@$(call extract, LIBSAMPLERATE)
> > +	cd $(LIBSAMPLERATE_DIR) && [ -f configure ] || sh autogen.sh
> > +	@$(call patchin, LIBSAMPLERATE)
> > +	@$(call touch)
> 
> remove this.

Will do in v2.


> > +
> > +# ----------------------------------------------------------------------------
> > +# Prepare
> > +# ----------------------------------------------------------------------------
> > +
> > +#LIBSAMPLERATE_CONF_ENV	:= $(CROSS_ENV)
> 
> remove

Will do in v2.

> > +#
> > +# autoconf
> > +#
> > +LIBSAMPLERATE_CONF_TOOL	:= autoconf
> > +#LIBSAMPLERATE_CONF_OPT	:= $(CROSS_AUTOCONF_USR)
> 
> Add some defaults, for fftw and sndfile at least.

Finally took the time to look into this.
Compiled and tested without sndfile and fftw, with sndfile enabled, and
with sndfile and fftw enabled.
Result: The autodetect of libsamplerate configure works well here.

All we have here from configure is:
  --disable-fftw          disable usage of FFTW
  --disable-sndfile       disable support for sndfile
[...]
  SNDFILE_CFLAGS
              C compiler flags for SNDFILE, overriding pkg-config
  SNDFILE_LIBS
              linker flags for SNDFILE, overriding pkg-config
  FFTW3_CFLAGS
              C compiler flags for FFTW3, overriding pkg-config
  FFTW3_LIBS  linker flags for FFTW3, overriding pkg-config


build with both disabled:
[...]
checking for SNDFILE... no
checking for FFTW3... no
[...]
  Extra tools required for testing and examples :
    Use FFTW : .................... no
    Have libsndfile : ............. no
[...]

build with sndfile enabled:
[...]
checking for SNDFILE... yes
checking for FFTW3... no
[...]
  Extra tools required for testing and examples :
    Use FFTW : .................... no
    Have libsndfile : ............. yes
[...]

build with sndfile and fftw enabled:
[...]
checking for SNDFILE... yes
checking for FFTW3... yes
[...]
  Extra tools required for testing and examples :
    Use FFTW : .................... yes
    Have libsndfile : ............. yes
[...]

Now, libsamplerate-0.1.8/INSTALL states that sndfile are fftw are only
required for some examples and some tests. None of which are installed
here. By sure some sweet pieces of code, for everyone interessted in
using libsamplerate in an own project. But at least for my usage
(alsaloop), this is not the case.

Same applies for fixing pkg-config troubles by passing flags.

Last, forcefully disabling one or both with a configure option - despite
being enabled in ptxconfig and hence found - won't buy us much.
Just, libsamplerate won't link against them.
Not worth a ptx option, in my opinion.

Bottom line: I don't see any sensible defaults resp. options here.


One thing that _might_ be worth looking into is the clipping option
"--disable-cpu-clip". If enabled, src_float_to_short_array() omits
overflow/underflow checks. Might be a nice optimization.
Just, the autodetect of configure for this runs some test code on the
build host. Which here on my machine (x86_64 (Intel Core2)) results in
no, so it is implicitly disabled. No idea for other build hosts.
But point is, the check runs not on the target, so it might end in a
false-positive. And there is no enable-counterpart of this option (resp.
won't change anything, just tested). And I'm not in the mood to hack
this in...

Bottom line: Always disable it, to be safe, without option.


Final result: I'll send a v2 with:
LIBSAMPLERATE_CONF_OPT  := \
    $(CROSS_AUTOCONF_USR) \
    --disable-cpu-clip

Anything else can be added by those who need it.

-- 

carpe noctem engineering
Ingenieurbuero fuer Hard- & Software-Entwicklung Andreas Pretzsch
Dipl.-Ing. (FH) Andreas Pretzsch          Tel. +49-(0)731-5521572
Hahnengasse 3                             Fax: +49-(0)731-5521571
89073 Ulm, Germany                        email: apr@cn-eng.de


-- 
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2015-04-17 22:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 16:04 [ptxdist] [PATCH 0/2] new package libsamplerate, used by alsaloop from alsa-utils Andreas Pretzsch
2013-08-23 16:04 ` [ptxdist] [PATCH 1/2] libsamplerate: add package Andreas Pretzsch
2013-09-09  8:44   ` Michael Olbrich
2015-04-17 22:22     ` Andreas Pretzsch [this message]
2015-04-17 22:48   ` [ptxdist] [PATCH v2] libsamplerate: new package for libsamplerate 0.1.8 Andreas Pretzsch
2013-08-23 16:04 ` [ptxdist] [PATCH 2/2] package alsa-utils: alsaloop requires libsamplerate, so autoselect it Andreas Pretzsch
2013-09-09  8:45   ` Michael Olbrich
2015-04-17 22:20     ` Andreas Pretzsch
2015-04-17 22:49   ` [ptxdist] [PATCH v2] alsa-utils: autoselect libsamplerate for alsaloop Andreas Pretzsch

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=1429309336.18974.63.camel@ws-apr.office.loc \
    --to=apr@cn-eng.de \
    --cc=ptxdist@pengutronix.de \
    /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