aboutsummaryrefslogtreecommitdiff
path: root/multimedia/rnnoise
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/rnnoise')
-rw-r--r--multimedia/rnnoise/README9
-rw-r--r--multimedia/rnnoise/rnnoise.SlackBuild114
-rw-r--r--multimedia/rnnoise/rnnoise.info10
-rw-r--r--multimedia/rnnoise/rnnoise.patch118
-rw-r--r--multimedia/rnnoise/slack-desc19
5 files changed, 270 insertions, 0 deletions
diff --git a/multimedia/rnnoise/README b/multimedia/rnnoise/README
new file mode 100644
index 0000000000..82318e7128
--- /dev/null
+++ b/multimedia/rnnoise/README
@@ -0,0 +1,9 @@
+RNNoise is a noise suppression library based on a recurrent neural
+network.
+
+A description of the algorithm is provided in the following paper:
+
+J.-M. Valin, A Hybrid DSP/Deep Learning Approach to Real-Time
+Full-Band Speech Enhancement, Proceedings of IEEE Multimedia Signal
+Processing (MMSP) Workshop, arXiv:1709.08243, 2018.
+https://arxiv.org/pdf/1709.08243.pdf
diff --git a/multimedia/rnnoise/rnnoise.SlackBuild b/multimedia/rnnoise/rnnoise.SlackBuild
new file mode 100644
index 0000000000..c6c20a6b31
--- /dev/null
+++ b/multimedia/rnnoise/rnnoise.SlackBuild
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+# Slackware build script for rnnoise
+
+# Copyright 2025, Lockywolf
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=rnnoise
+VERSION=${VERSION:-0.2}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} + -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} +
+
+patch -p1 < $CWD/rnnoise.patch
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --disable-static \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+AUTHORS COPYING doc README \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/multimedia/rnnoise/rnnoise.info b/multimedia/rnnoise/rnnoise.info
new file mode 100644
index 0000000000..9347615c5f
--- /dev/null
+++ b/multimedia/rnnoise/rnnoise.info
@@ -0,0 +1,10 @@
+PRGNAM="rnnoise"
+VERSION="0.2"
+HOMEPAGE="https://github.com/xiph/rnnoise/"
+DOWNLOAD="https://github.com/xiph/rnnoise/releases/download/v0.2/rnnoise-0.2.tar.gz"
+MD5SUM="0e795b2d2b4730fc5ee6e38b77699e91"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Lockywolf"
+EMAIL="for_sbo.rnnoise_2025-07-11@lockywolf.net"
diff --git a/multimedia/rnnoise/rnnoise.patch b/multimedia/rnnoise/rnnoise.patch
new file mode 100644
index 0000000000..ecaef9cb7a
--- /dev/null
+++ b/multimedia/rnnoise/rnnoise.patch
@@ -0,0 +1,118 @@
+diff --git a/src/common.h b/src/common.h
+index 5005bff..f9095ca 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -43,6 +43,14 @@ static RNN_INLINE void rnnoise_free (void *ptr)
+ #define RNN_CLEAR(dst, n) (memset((dst), 0, (n)*sizeof(*(dst))))
+ #endif
+
++# if !defined(OPUS_GNUC_PREREQ)
++# if defined(__GNUC__)&&defined(__GNUC_MINOR__)
++# define OPUS_GNUC_PREREQ(_maj,_min) \
++ ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
++# else
++# define OPUS_GNUC_PREREQ(_maj,_min) 0
++# endif
++# endif
+
+
+ #endif
+diff --git a/src/vec.h b/src/vec.h
+index 8e96cbf..71b7afb 100644
+--- a/src/vec.h
++++ b/src/vec.h
+@@ -30,6 +30,7 @@
+ #define VEC_H
+
+ #include "opus_types.h"
++#include "common.h"
+ #include <math.h>
+ #include "arch.h"
+ #include "x86/x86_arch_macros.h"
+@@ -41,8 +42,6 @@
+ #include "vec_neon.h"
+ #else
+
+-#include "os_support.h"
+-
+ #define MAX_INPUTS (2048)
+
+ #define NO_OPTIMIZATIONS
+@@ -50,7 +49,7 @@
+ static inline void sgemv16x1(float *out, const float *weights, int rows, int cols, int col_stride, const float *x)
+ {
+ int i, j;
+- OPUS_CLEAR(out, rows);
++ RNN_CLEAR(out, rows);
+ for (i=0;i<rows;i+=16)
+ {
+ for (j=0;j<cols;j++)
+@@ -84,7 +83,7 @@ static inline void sgemv16x1(float *out, const float *weights, int rows, int col
+ static inline void sgemv8x1(float *out, const float *weights, int rows, int cols, int col_stride, const float *x)
+ {
+ int i, j;
+- OPUS_CLEAR(out, rows);
++ RNN_CLEAR(out, rows);
+ for (i=0;i<rows;i+=8)
+ {
+ for (j=0;j<cols;j++)
+@@ -124,7 +123,7 @@ static inline void sgemv(float *out, const float *weights, int rows, int cols, i
+ static inline void sparse_sgemv8x4(float *out, const float *w, const int *idx, int rows, const float *x)
+ {
+ int i, j;
+- OPUS_CLEAR(out, rows);
++ RNN_CLEAR(out, rows);
+ for (i=0;i<rows;i+=8)
+ {
+ int cols;
+diff --git a/src/vec_avx.h b/src/vec_avx.h
+index b73a353..a5040b4 100644
+--- a/src/vec_avx.h
++++ b/src/vec_avx.h
+@@ -34,7 +34,7 @@
+
+ #include <immintrin.h>
+ #include <math.h>
+-/*#include "celt/x86/x86cpu.h"*/
++#include "x86/x86cpu.h"
+
+ #define MAX_INPUTS (2048)
+
+diff --git a/src/vec_neon.h b/src/vec_neon.h
+index e6432e2..31b736c 100644
+--- a/src/vec_neon.h
++++ b/src/vec_neon.h
+@@ -32,7 +32,8 @@
+ #define VEC_NEON_H
+
+ #include <arm_neon.h>
+-#include "os_support.h"
++#include "opus_types.h"
++#include "common.h"
+
+ #if defined(__arm__) && !defined(__aarch64__) && (__ARM_ARCH < 8 || !defined(__clang__))
+ /* Emulate vcvtnq_s32_f32() for ARMv7 Neon. */
+@@ -302,7 +303,7 @@ static inline void sgemv(float *out, const float *weights, int rows, int cols, i
+ static inline void sparse_sgemv8x4(float *out, const float *w, const int *idx, int rows, const float *x)
+ {
+ int i, j;
+- OPUS_CLEAR(out, rows);
++ RNN_CLEAR(out, rows);
+ for (i=0;i<rows;i+=8)
+ {
+ int cols;
+diff --git a/src/x86/x86cpu.h b/src/x86/x86cpu.h
+index 97dcdbd..e214aba 100644
+--- a/src/x86/x86cpu.h
++++ b/src/x86/x86cpu.h
+@@ -36,8 +36,8 @@
+ int opus_select_arch(void);
+ # endif
+
+-# if defined(OPUS_X86_MAY_HAVE_SSE2)
+-# include "opus_defines.h"
++# if defined(__SSE2__)
++# include "common.h"
+
+ /*MOVD should not impose any alignment restrictions, but the C standard does,
+ and UBSan will report errors if we actually make unaligned accesses.
diff --git a/multimedia/rnnoise/slack-desc b/multimedia/rnnoise/slack-desc
new file mode 100644
index 0000000000..4b42fec2ff
--- /dev/null
+++ b/multimedia/rnnoise/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+rnnoise: rnnoise (RNNoise is a noise suppression library)
+rnnoise:
+rnnoise: RNNoise is a noise suppression library based on a recurrent neural
+rnnoise: network from XIPH.org.
+rnnoise:
+rnnoise:
+rnnoise:
+rnnoise:
+rnnoise:
+rnnoise:
+rnnoise: