Skip to content

Commit

Permalink
Copied from RNNoise directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jmvalin committed Mar 18, 2019
1 parent 089290d commit f96940b
Show file tree
Hide file tree
Showing 9 changed files with 701 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Jean-Marc Valin <[email protected]>
David Rowe <[email protected]>
129 changes: 129 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
ACLOCAL_AMFLAGS = -I m4

AM_CFLAGS = -I$(top_srcdir)/include $(DEPS_CFLAGS)

dist_doc_DATA = COPYING AUTHORS README

include_HEADERS = include/rnnoise.h

lib_LTLIBRARIES = librnnoise.la
noinst_HEADERS = src/arch.h \
src/celt_lpc.h \
src/common.h \
src/_kiss_fft_guts.h \
src/kiss_fft.h \
src/opus_types.h \
src/pitch.h \
src/rnn_data.h \
src/rnn.h \
src/tansig_table.h

librnnoise_la_SOURCES = \
src/denoise.c \
src/rnn.c \
src/rnn_data.c \
src/pitch.c \
src/kiss_fft.c \
src/celt_lpc.c

librnnoise_la_LIBADD = $(DEPS_LIBS) $(lrintf_lib) $(LIBM)
librnnoise_la_LDFLAGS = -no-undefined \
-version-info @OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@

if OP_ENABLE_EXAMPLES
noinst_PROGRAMS = examples/rnnoise_demo
endif

examples_rnnoise_demo_SOURCES = examples/rnnoise_demo.c
examples_rnnoise_demo_LDADD = librnnoise.la

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = rnnoise.pc

debug:
$(MAKE) CFLAGS="${CFLAGS} -O0 -ggdb -DOP_ENABLE_ASSERTIONS" all

EXTRA_DIST = \
rnnoise.pc.in \
rnnoise-uninstalled.pc.in \
doc/Doxyfile.in \
doc/Makefile

# Targets to build and install just the library without the docs
librnnoise install-librnnoise: NO_DOXYGEN = 1

rnnoise: all
install-rnnoise: install

# Or just the docs
docs: doc/doxygen-build.stamp

install-docs:
@if [ -z "$(NO_DOXYGEN)" ]; then \
( cd doc && \
echo "Installing documentation in $(DESTDIR)$(docdir)"; \
$(INSTALL) -d $(DESTDIR)$(docdir)/html/search; \
for f in `find html -type f \! -name "installdox"` ; do \
$(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f; \
done ) \
fi

doc/doxygen-build.stamp: doc/Doxyfile \
$(top_srcdir)/include/*.h
@[ -n "$(NO_DOXYGEN)" ] || ( cd doc && doxygen && touch $(@F) )


if HAVE_DOXYGEN

# Or everything (by default)
all-local: docs

install-data-local: install-docs

clean-local:
$(RM) -r doc/html
$(RM) -r doc/latex
$(RM) doc/doxygen-build.stamp

uninstall-local:
$(RM) -r $(DESTDIR)$(docdir)/html

endif

# We check this every time make is run, with configure.ac being touched to
# trigger an update of the build system files if update_version changes the
# current PACKAGE_VERSION (or if package_version was modified manually by a
# user with either AUTO_UPDATE=no or no update_version script present - the
# latter being the normal case for tarball releases).
#
# We can't just add the package_version file to CONFIGURE_DEPENDENCIES since
# simply running autoconf will not actually regenerate configure for us when
# the content of that file changes (due to autoconf dependency checking not
# knowing about that without us creating yet another file for it to include).
#
# The MAKECMDGOALS check is a gnu-make'ism, but will degrade 'gracefully' for
# makes that don't support it. The only loss of functionality is not forcing
# an update of package_version for `make dist` if AUTO_UPDATE=no, but that is
# unlikely to be a real problem for any real user.
$(top_srcdir)/configure.ac: force
@case "$(MAKECMDGOALS)" in \
dist-hook) exit 0 ;; \
dist-* | dist | distcheck | distclean) _arg=release ;; \
esac; \
if ! $(top_srcdir)/update_version $$_arg 2> /dev/null; then \
if [ ! -e $(top_srcdir)/package_version ]; then \
echo 'PACKAGE_VERSION="unknown"' > $(top_srcdir)/package_version; \
fi; \
. $(top_srcdir)/package_version || exit 1; \
[ "$(PACKAGE_VERSION)" != "$$PACKAGE_VERSION" ] || exit 0; \
fi; \
touch $@

force:

# Create a minimal package_version file when make dist is run.
dist-hook:
echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"' > $(top_distdir)/package_version


.PHONY: rnnoise install-rnnoise docs install-docs
10 changes: 10 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
set -e

srcdir=`dirname $0`
test -n "$srcdir" && cd "$srcdir"

echo "Updating build configuration files for rnnoise, please wait...."

autoreconf -isf
129 changes: 129 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# autoconf source script for generating configure

dnl The package_version file will be automatically synced to the git revision
dnl by the update_version script when configured in the repository, but will
dnl remain constant in tarball releases unless it is manually edited.
m4_define([CURRENT_VERSION],
m4_esyscmd([ ./update_version 2>/dev/null || true
if test -e package_version; then
. ./package_version
printf "$PACKAGE_VERSION"
else
printf "unknown"
fi ]))

AC_INIT([rnnoise],[CURRENT_VERSION],[[email protected]])
AC_CONFIG_SRCDIR([src/denoise.c])
AC_CONFIG_MACRO_DIR([m4])

AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE

AM_INIT_AUTOMAKE([1.11 foreign no-define dist-zip subdir-objects])
AM_MAINTAINER_MODE([enable])

AC_C_INLINE

LT_INIT

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_DEFINE([RNNOISE_BUILD], [], [This is a build of the library])

dnl Library versioning for libtool.
dnl Please update these for releases.
dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0

OP_LT_CURRENT=4
OP_LT_REVISION=1
OP_LT_AGE=4

AC_SUBST(OP_LT_CURRENT)
AC_SUBST(OP_LT_REVISION)
AC_SUBST(OP_LT_AGE)

CC_CHECK_CFLAGS_APPEND(
[-pedantic -Wall -Wextra -Wno-sign-compare -Wno-parentheses -Wno-long-long])

# Platform-specific tweaks
case $host in
*-mingw*)
# -std=c89 causes some warnings under mingw.
CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
# We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
# It's okay to define this even when HTTP support is disabled, as it only
# affects header declarations, not linking (unless we actually use some
# XP-only functions).
AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
[We need at least WindowsXP for getaddrinfo/freeaddrinfo])
host_mingw=true
;;
esac
AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true")

AC_ARG_ENABLE([assertions],
AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
enable_assertions=no)

AS_IF([test "$enable_assertions" = "yes"], [
AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
])

AC_ARG_ENABLE([examples],
AS_HELP_STRING([--disable-examples], [Do not build example applications]),,
enable_examples=yes)
AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])

AS_CASE(["$ac_cv_search_lrintf"],
["no"],[],
["none required"],[],
[lrintf_lib="$ac_cv_search_lrintf"])

LT_LIB_M

AC_SUBST([lrintf_lib])

CC_ATTRIBUTE_VISIBILITY([default], [
CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
])

dnl Check for doxygen
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
[enable_doc=yes]
)

AS_IF([test "$enable_doc" = "yes"], [
AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
AC_CHECK_PROG([HAVE_DOT], [dot], [yes], [no])
],[
HAVE_DOXYGEN=no
])

AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])

AC_CONFIG_FILES([
Makefile
rnnoise.pc
rnnoise-uninstalled.pc
doc/Doxyfile
])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT

AC_MSG_NOTICE([
------------------------------------------------------------------------
$PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
Assertions ................... ${enable_assertions}
Hidden visibility ............ ${cc_cv_flag_visibility}
API code examples ............ ${enable_examples}
API documentation ............ ${enable_doc}
------------------------------------------------------------------------
])
18 changes: 18 additions & 0 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Process with doxygen to generate API documentation

PROJECT_NAME = @PACKAGE_NAME@
PROJECT_NUMBER = @PACKAGE_VERSION@
PROJECT_BRIEF = "RNN-based noise suppressor."
INPUT = @top_srcdir@/include/rnnoise.h
OPTIMIZE_OUTPUT_FOR_C = YES

QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES

JAVADOC_AUTOBRIEF = YES
SORT_MEMBER_DOCS = NO

HAVE_DOT = @HAVE_DOT@
13 changes: 13 additions & 0 deletions lpcnet-uninstalled.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# rnnoise uninstalled pkg-config file

prefix=
exec_prefix=
libdir=${pcfiledir}/.libs
includedir=${pcfiledir}/@top_srcdir@/include

Name: rnnoise uninstalled
Description: RNN-based noise suppression (not installed)
Version: @PACKAGE_VERSION@
Conflicts:
Libs: ${libdir}/librnnoise.la @lrintf_lib@
Cflags: -I${includedir}
14 changes: 14 additions & 0 deletions lpcnet.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# rnnoise installed pkg-config file

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: rnnoise
Description: RNN-based noise suppression
Version: @PACKAGE_VERSION@
Conflicts:
Libs: -L${libdir} -lrnnoise
Libs.private: @lrintf_lib@
Cflags: -I${includedir}/
Loading

0 comments on commit f96940b

Please sign in to comment.