[packages/lpcnetfreedv] - new, partially based on Fedora

qboosh qboosh at pld-linux.org
Mon Jul 6 06:24:11 CEST 2020


commit 34d543b2f58d9c24962b1adfcaa2fa39523b7e74
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Jul 6 06:25:22 2020 +0200

    - new, partially based on Fedora

 lpcnetfreedv-vector-updates.patch | 62 +++++++++++++++++++++++++++
 lpcnetfreedv.spec                 | 88 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 150 insertions(+)
---
diff --git a/lpcnetfreedv.spec b/lpcnetfreedv.spec
new file mode 100644
index 0000000..27d5edf
--- /dev/null
+++ b/lpcnetfreedv.spec
@@ -0,0 +1,88 @@
+#
+# Conditional build:
+%bcond_with	avx	# x86 AVX instructions
+%bcond_with	avx2	# x86 AVX2 instructions
+%bcond_with	armneon	# ARM NEON instructions
+
+Summary:	LPCNet for FreeDV
+Summary(pl.UTF-8):	LPCNet dla FreeDV
+Name:		lpcnetfreedv
+Version:	0.2
+Release:	1
+License:	BSD
+Group:		Libraries
+#Source0Download: https://github.com/drowe67/LPCNet/releases
+Source0:	https://github.com/drowe67/LPCNet/archive/v%{version}/LPCNet-%{version}.tar.gz
+# Source0-md5:	f4b87be1825bd3fd5936b481b0f93bac
+Source1:	http://rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz
+# Source1-md5:	a86894b209a1869b50454fe591f047a1
+# Fixes for aarch64 which has NEON instructions natively
+Patch0:		%{name}-vector-updates.patch
+URL:		https://github.com/drowe67/LPCNet
+BuildRequires:	cmake >= 3.0
+BuildRequires:	codec2-devel >= 0.9
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Experimental version of LPCNet that has been used to develop FreeDV
+2020 - a HF radio Digital Voice mode for over the air experimentation
+with Neural Net speech coding. Possibly the first use of Neural Net
+speech coding in real world operation.
+
+%description -l pl.UTF-8
+Eksperymentalna wersja LPCNet, używana przy tworzeniu FreeDV 2020 - 
+trybu radiowego dźwięku cyfrowego do eksperymentowania z kodowaniem
+mowy opartym na sieci neuronowej. Jest to prawdopodobnie pierwsze
+zastosowanie praktyczne kodowania mowy z użyciem sieci neuronowej.
+
+%package devel
+Summary:	Development files for LPCNet
+Summary(pl.UTF-8):	Pliki programistyczne LPCNet
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Development files for LPCNet.
+
+%description devel -l pl.UTF-8
+Pliki programistyczne LPCNet.
+
+%prep
+%setup -q -n LPCNet-%{version}
+%patch0 -p1
+
+%build
+install -d build
+cd build
+# Add model data archive to the build directory so CMake finds it.
+cp %{SOURCE1} .
+
+%cmake .. \
+	-DDISABLE_CPU_OPTIMIZATION=ON \
+	%{?with_avx:-DAVX=ON} \
+	%{?with_avx2:-DAVX2=ON} \
+	%{?with_armneon:-DNEON=ON}
+
+%{__make}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C build install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc COPYING README.md
+%attr(755,root,root) %{_bindir}/lpcnet_dec
+%attr(755,root,root) %{_bindir}/lpcnet_enc
+%attr(755,root,root) %{_libdir}/liblpcnetfreedv.so
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/lpcnet
+%{_libdir}/cmake/lpcnetfreedv
diff --git a/lpcnetfreedv-vector-updates.patch b/lpcnetfreedv-vector-updates.patch
new file mode 100644
index 0000000..6000514
--- /dev/null
+++ b/lpcnetfreedv-vector-updates.patch
@@ -0,0 +1,62 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 680f52c..e536f30 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -52,6 +52,9 @@ message(STATUS "LPCNet version: ${LPCNET_VERSION}")
+ # Set default flags
+ set(CMAKE_C_FLAGS "-Wall -W -Wextra -Wno-unused-function -O3 -g -I. -MD ${CMAKE_C_FLAGS} -DENABLE_ASSERTIONS")
+ 
++# Arch specific stuff here
++message(STATUS "Host system arch is: ${CMAKE_SYSTEM_PROCESSOR}")
++
+ # Detection of available CPU optimizations
+ if(NOT DISABLE_CPU_OPTIMIZATION)
+     if(UNIX AND NOT APPLE)
+@@ -87,7 +90,7 @@ elseif(${AVX} OR ${AVX} GREATER 0)
+     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
+ endif()
+ 
+-# RPi
++# RPi / ARM 32bit
+ if(${NEON} OR ${NEON} GREATER 0)
+     message(STATUS "neon processor flags found or enabled.")
+     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=armv8-a -mtune=cortex-a53")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 41a78dc..6c49f5e 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -49,7 +49,7 @@ target_link_libraries(dump_data lpcnetfreedv m codec2)
+ add_executable(test_lpcnet test_lpcnet.c)
+ target_link_libraries(test_lpcnet lpcnetfreedv m codec2)
+ 
+-if(AVX OR AVX2)
++if(AVX OR AVX2 OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+     add_executable(test_vec test_vec.c)
+     target_link_libraries(test_vec m)
+ else()
+diff --git a/src/nnet.c b/src/nnet.c
+index 8ad4a26..ccb9c94 100644
+--- a/src/nnet.c
++++ b/src/nnet.c
+@@ -43,7 +43,7 @@
+ 
+ #ifdef __AVX__
+ #include "vec_avx.h"
+-#elif __ARM_NEON__
++#elif __ARM_NEON__ || __aarch64__
+ #include "vec_neon.h"
+ #else
+ #warning Compiling without any vectorization. This code will be very slow
+diff --git a/src/test_vec.c b/src/test_vec.c
+index 09b51e7..254292b 100644
+--- a/src/test_vec.c
++++ b/src/test_vec.c
+@@ -26,7 +26,7 @@ const char simd[]="AVX2";
+ #else
+ const char simd[]="AVX";
+ #endif
+-#elif __ARM_NEON__
++#elif __ARM_NEON__ || __aarch64__
+ #include "vec_neon.h"
+ const char simd[]="NEON";
+ #else
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lpcnetfreedv.git/commitdiff/34d543b2f58d9c24962b1adfcaa2fa39523b7e74



More information about the pld-cvs-commit mailing list