diff --git a/baselibs.conf b/baselibs.conf index 7599ddc..ff2b6d7 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1 +1 @@ -libcodec2-0_8 +libcodec2-0_9 diff --git a/codec2-0.8.1.tar.xz b/codec2-0.8.1.tar.xz deleted file mode 100644 index fb5e393..0000000 --- a/codec2-0.8.1.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a07cdaacf59c3f7dbb1c63b769d443af486c434b3bd031fb4edd568ce3e613d6 -size 8868212 diff --git a/codec2-0.9.2.tar.gz b/codec2-0.9.2.tar.gz new file mode 100644 index 0000000..1ebc995 --- /dev/null +++ b/codec2-0.9.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19181a446f4df3e6d616b50cabdac4485abb9cd3242cf312a0785f892ed4c76c +size 12244006 diff --git a/codec2-licensed-stuff.patch b/codec2-licensed-stuff.patch deleted file mode 100644 index d4cd461..0000000 --- a/codec2-licensed-stuff.patch +++ /dev/null @@ -1,495 +0,0 @@ -Index: src/CMakeLists.txt -=================================================================== ---- src/CMakeLists.txt.orig -+++ src/CMakeLists.txt -@@ -378,8 +378,8 @@ target_link_libraries(drs232 ${CMAKE_REQ - add_executable(drs232_ldpc drs232_ldpc.c) - target_link_libraries(drs232_ldpc ${CMAKE_REQUIRED_LIBRARIES} codec2) - --add_definitions(-DHORUS_L2_RX -DINTERLEAVER -DSCRAMBLER) --add_executable(horus_demod horus_demod.c horus_api.c horus_l2.c fsk.c kiss_fft.c) -+add_definitions(-DHORUS_L2_RX -DINTERLEAVER -DSCRAMBLER -DRUN_TIME_TABLES) -+add_executable(horus_demod horus_demod.c horus_api.c horus_l2.c golay23.c fsk.c kiss_fft.c) - target_link_libraries(horus_demod ${CMAKE_REQUIRED_LIBRARIES}) - - install(TARGETS codec2 EXPORT codec2-config -Index: src/golay23.c -=================================================================== ---- src/golay23.c.orig -+++ src/golay23.c -@@ -53,7 +53,7 @@ static int inited = 0; - //since we want to avoid bit-reversing inside syndrome() we bit-reverse the polynomial instead - #define GOLAY_POLYNOMIAL 0xC75 //AE3 reversed - --static int syndrome(int c) { -+int golay23_syndrome(int c) { - //could probably be done slightly smarter, but works - int x; - for (x = 11; x >= 0; x--) { -@@ -85,7 +85,7 @@ static int popcount(unsigned int c) { - #if defined(NO_TABLES) || defined(RUN_TIME_TABLES) - static int golay23_encode_no_tables(int c) { - c <<= 11; -- return syndrome(c) | c; -+ return golay23_syndrome(c) | c; - } - #endif - -@@ -101,7 +101,7 @@ static int golay23_decode_no_tables(int - - for (x = 0; x < 23; x++) { - int t; -- int s = syndrome(c); -+ int s = golay23_syndrome(c); - - if (popcount(s) <= 3) { - return unrotate(c ^ s, x) & 0xFFF; -@@ -109,7 +109,7 @@ static int golay23_decode_no_tables(int - - for (t = 0; t < 23; t++) { - int c2 = c ^ (1 << t); -- int s = syndrome(c2); -+ int s = golay23_syndrome(c2); - - if (popcount(s) <= 2) { - return unrotate(c2 ^ s, x) & 0xFFF; -@@ -138,13 +138,13 @@ void golay23_init(void) { - //1-bit errors - for (x = 0; x < 23; x++) { - int d = 1< - #include - #include "horus_l2.h" -+#include "golay23.h" -+ - - #ifdef HORUS_L2_UNITTEST - #define HORUS_L2_RX - #endif - --#define RUN_TIME_TABLES -- - static char uw[] = {'$','$'}; - - /* Function Prototypes ------------------------------------------------*/ - --int32_t get_syndrome(int32_t pattern); --void golay23_init(void); --int golay23_decode(int received_codeword); -+#ifdef INTERLEAVER - void interleave(unsigned char *inout, int nbytes, int dir); -+#endif -+#ifdef SCRAMBLER - void scramble(unsigned char *inout, int nbytes); -+#endif - - /* Functions ----------------------------------------------------------*/ - -@@ -177,7 +175,7 @@ int horus_l2_encode_tx_packet(unsigned c - #ifdef DEBUG0 - fprintf(stderr, " ningolay: %d ingolay: 0x%04x\n", ningolay, ingolay); - #endif -- golayparity = get_syndrome(ingolay<<11); -+ golayparity = golay23_syndrome(ingolay<<11); - ingolay = 0; - - #ifdef DEBUG0 -@@ -219,7 +217,7 @@ int horus_l2_encode_tx_packet(unsigned c - - if (ningolay % 12) { - ingolay >>= 1; -- golayparity = get_syndrome(ingolay<<12); -+ golayparity = golay23_syndrome(ingolay<<12); - #ifdef DEBUG0 - fprintf(stderr, " ningolay: %d ingolay: 0x%04x\n", ningolay, ingolay); - fprintf(stderr, " golayparity: 0x%04x\n", golayparity); -@@ -292,8 +290,10 @@ void horus_l2_decode_rx_packet(unsigned - unsigned char *pin = input_rx_data; - int ninbit, ingolay, ningolay, paritybyte, nparitybits; - int ninbyte, shift, inbit, golayparitybit, i, outbit, outbyte, noutbits, outdata; -+ #if defined(SCRAMBLER) || defined(INTERLEAVER) - int num_tx_data_bytes = horus_l2_get_num_tx_data_bytes(num_payload_data_bytes); -- -+ #endif -+ - /* optional scrambler and interleaver - we dont interleave UW */ - - #ifdef SCRAMBLER -@@ -878,291 +878,6 @@ int main(void) { - } - #endif - --/*---------------------------------------------------------------------------*\ -- -- GOLAY FUNCTIONS -- --\*---------------------------------------------------------------------------*/ -- --/* File: golay23.c -- * Title: Encoder/decoder for a binary (23,12,7) Golay code -- * Author: Robert Morelos-Zaragoza (robert@spectra.eng.hawaii.edu) -- * Date: August 1994 -- * -- * The binary (23,12,7) Golay code is an example of a perfect code, that is, -- * the number of syndromes equals the number of correctable error patterns. -- * The minimum distance is 7, so all error patterns of Hamming weight up to -- * 3 can be corrected. The total number of these error patterns is: -- * -- * Number of errors Number of patterns -- * ---------------- ------------------ -- * 0 1 -- * 1 23 -- * 2 253 -- * 3 1771 -- * ---- -- * Total number of error patterns = 2048 = 2^{11} = number of syndromes -- * -- -- * number of redundant bits -------^ -- * -- * Because of its relatively low length (23), dimension (12) and number of -- * redundant bits (11), the binary (23,12,7) Golay code can be encoded and -- * decoded simply by using look-up tables. The program below uses a 16K -- * encoding table and an 8K decoding table. -- * -- * For more information, suggestions, or other ideas on implementing error -- * correcting codes, please contact me at (I'm temporarily in Japan, but -- * below is my U.S. address): -- * -- * Robert Morelos-Zaragoza -- * 770 S. Post Oak Ln. #200 -- * Houston, Texas 77056 -- * -- * email: robert@spectra.eng.hawaii.edu -- * -- * Homework: Add an overall parity-check bit to get the (24,12,8) -- * extended Golay code. -- * -- * COPYRIGHT NOTICE: This computer program is free for non-commercial purposes. -- * You may implement this program for any non-commercial application. You may -- * also implement this program for commercial purposes, provided that you -- * obtain my written permission. Any modification of this program is covered -- * by this copyright. -- * -- * == Copyright (c) 1994 Robert Morelos-Zaragoza. All rights reserved. == -- */ -- --#include --#include --#include --#define X22 0x00400000 /* vector representation of X^{22} */ --#define X11 0x00000800 /* vector representation of X^{11} */ --#define MASK12 0xfffff800 /* auxiliary vector for testing */ --#define GENPOL 0x00000c75 /* generator polinomial, g(x) */ -- --/* Global variables: -- * -- * pattern = error pattern, or information, or received vector -- * encoding_table[] = encoding table -- * decoding_table[] = decoding table -- * data = information bits, i(x) -- * codeword = code bits = x^{11}i(x) + (x^{11}i(x) mod g(x)) -- * numerr = number of errors = Hamming weight of error polynomial e(x) -- * position[] = error positions in the vector representation of e(x) -- * recd = representation of corrupted received polynomial r(x) = c(x) + e(x) -- * decerror = number of decoding errors -- * a[] = auxiliary array to generate correctable error patterns -- */ -- --#ifdef HORUS_L2_RX --static int inited = 0; -- --#ifdef RUN_TIME_TABLES --static int encoding_table[4096], decoding_table[2048]; --#else --#include "golayenctable.h" --#include "golaydectable.h" --#endif -- --#ifdef RUN_TIME_TABLES --static int arr2int(int a[], int r) --/* -- * Convert a binary vector of Hamming weight r, and nonzero positions in -- * array a[1]...a[r], to a long integer \sum_{i=1}^r 2^{a[i]-1}. -- */ --{ -- int i; -- long mul, result = 0, temp; -- -- for (i=1; i<=r; i++) { -- mul = 1; -- temp = a[i]-1; -- while (temp--) -- mul = mul << 1; -- result += mul; -- } -- return(result); --} --#endif --#endif -- --#ifdef HORUS_L2_RX --void nextcomb(int n, int r, int a[]) --/* -- * Calculate next r-combination of an n-set. -- */ --{ -- int i, j; -- -- a[r]++; -- if (a[r] <= n) -- return; -- j = r - 1; -- while (a[j] == n - r + j) -- j--; -- for (i = r; i >= j; i--) -- a[i] = a[j] + i - j + 1; -- return; --} --#endif -- --int32_t get_syndrome(int32_t pattern) --/* -- * Compute the syndrome corresponding to the given pattern, i.e., the -- * remainder after dividing the pattern (when considering it as the vector -- * representation of a polynomial) by the generator polynomial, GENPOL. -- * In the program this pattern has several meanings: (1) pattern = infomation -- * bits, when constructing the encoding table; (2) pattern = error pattern, -- * when constructing the decoding table; and (3) pattern = received vector, to -- * obtain its syndrome in decoding. -- */ --{ -- int32_t aux = X22; -- -- if (pattern >= X11) -- while (pattern & MASK12) { -- while (!(aux & pattern)) -- aux = aux >> 1; -- pattern ^= (aux/X11) * GENPOL; -- } -- return(pattern); --} -- --#ifdef HORUS_L2_RX -- --/*---------------------------------------------------------------------------*\ -- -- FUNCTION....: golay23_init() -- AUTHOR......: David Rowe -- DATE CREATED: 3 March 2013 -- -- Call this once when you start your program to init the Golay tables. -- --\*---------------------------------------------------------------------------*/ -- --void golay23_init(void) { --#ifdef RUN_TIME_TABLES -- int i; -- long temp; -- int a[4]; -- int pattern; -- -- /* -- * --------------------------------------------------------------------- -- * Generate ENCODING TABLE -- * -- * An entry to the table is an information vector, a 32-bit integer, -- * whose 12 least significant positions are the information bits. The -- * resulting value is a codeword in the (23,12,7) Golay code: A 32-bit -- * integer whose 23 least significant bits are coded bits: Of these, the -- * 12 most significant bits are information bits and the 11 least -- * significant bits are redundant bits (systematic encoding). -- * --------------------------------------------------------------------- -- */ -- for (pattern = 0; pattern < 4096; pattern++) { -- temp = pattern << 11; /* multiply information by X^{11} */ -- encoding_table[pattern] = temp + get_syndrome(temp);/* add redundancy */ -- } -- -- /* -- * --------------------------------------------------------------------- -- * Generate DECODING TABLE -- * -- * An entry to the decoding table is a syndrome and the resulting value -- * is the most likely error pattern. First an error pattern is generated. -- * Then its syndrome is calculated and used as a pointer to the table -- * where the error pattern value is stored. -- * --------------------------------------------------------------------- -- * -- * (1) Error patterns of WEIGHT 1 (SINGLE ERRORS) -- */ -- decoding_table[0] = 0; -- decoding_table[1] = 1; -- temp = 1; -- for (i=2; i<= 23; i++) { -- temp *= 2; -- decoding_table[get_syndrome(temp)] = temp; -- } -- /* -- * (2) Error patterns of WEIGHT 2 (DOUBLE ERRORS) -- */ -- a[1] = 1; a[2] = 2; -- temp = arr2int(a,2); -- decoding_table[get_syndrome(temp)] = temp; -- for (i=1; i<253; i++) { -- nextcomb(23,2,a); -- temp = arr2int(a,2); -- decoding_table[get_syndrome(temp)] = temp; -- } -- /* -- * (3) Error patterns of WEIGHT 3 (TRIPLE ERRORS) -- */ -- a[1] = 1; a[2] = 2; a[3] = 3; -- temp = arr2int(a,3); -- decoding_table[get_syndrome(temp)] = temp; -- for (i=1; i<1771; i++) { -- nextcomb(23,3,a); -- temp = arr2int(a,3); -- decoding_table[get_syndrome(temp)] = temp; -- } --#endif -- inited = 1; --} -- --/*---------------------------------------------------------------------------*\ -- -- FUNCTION....: golay23_encode() -- AUTHOR......: David Rowe -- DATE CREATED: 3 March 2013 -- -- Given 12 bits of data retiurns a 23 bit codeword for transmission -- over the channel. -- --\*---------------------------------------------------------------------------*/ -- --int golay23_encode(int data) { -- assert(inited); -- assert(data <= 0xfff); -- -- //printf("data: 0x%x\n", data); -- return encoding_table[data]; --} -- --/*---------------------------------------------------------------------------*\ -- -- FUNCTION....: golay23_decode() -- AUTHOR......: David Rowe -- DATE CREATED: 3 March 2013 -- -- Given a 23 bit received codeword, returns the 12 bit corrected data. -- --\*---------------------------------------------------------------------------*/ -- --int golay23_decode(int received_codeword) { -- assert(inited); -- assert((received_codeword < (1<<23)) && (received_codeword >= 0)); -- -- //printf("syndrome: 0x%x\n", get_syndrome(received_codeword)); -- return received_codeword ^= decoding_table[get_syndrome(received_codeword)]; --} -- --int golay23_count_errors(int recd_codeword, int corrected_codeword) --{ -- int errors = 0; -- int diff, i; -- -- diff = recd_codeword ^ corrected_codeword; -- for(i=0; i<23; i++) { -- if (diff & 0x1) -- errors++; -- diff >>= 1; -- } -- -- return errors; --} -- --#endif -- - // from http://stackoverflow.com/questions/10564491/function-to-calculate-a-crc16-checksum - - unsigned short horus_l2_gen_crc16(unsigned char* data_p, unsigned char length) { diff --git a/codec2-no_return_random.patch b/codec2-no_return_random.patch index 597e794..fc9e53e 100644 --- a/codec2-no_return_random.patch +++ b/codec2-no_return_random.patch @@ -1,10 +1,10 @@ -Index: codec2-0.8.1/src/gp_interleaver.c +Index: codec2-0.9.2/src/gp_interleaver.c =================================================================== ---- codec2-0.8.1.orig/src/gp_interleaver.c -+++ codec2-0.8.1/src/gp_interleaver.c -@@ -74,6 +74,7 @@ int choose_interleaver_b(int Nbits) - /* if we get it means a Nbits we dont have in our table so choke */ +--- codec2-0.9.2.orig/src/gp_interleaver.c ++++ codec2-0.9.2/src/gp_interleaver.c +@@ -80,6 +80,7 @@ int choose_interleaver_b(int Nbits) + fprintf(stderr, "Nbits: %d, b not found!\n", Nbits); assert(0); + return(0); } diff --git a/codec2.changes b/codec2.changes index 997cc4f..0d7d3c4 100644 --- a/codec2.changes +++ b/codec2.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Mar 9 13:20:24 UTC 2020 - Martin Pluskal + +- Update to version 0.9.2: + * No upstream changelog available +- Drop no longer needed patches: + * codec2-licensed-stuff.patch + ------------------------------------------------------------------- Sat Aug 11 07:14:59 UTC 2018 - tchvatal@suse.com diff --git a/codec2.spec b/codec2.spec index f484faa..8bf8618 100644 --- a/codec2.spec +++ b/codec2.spec @@ -1,7 +1,7 @@ # # spec file for package codec2 # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,25 +12,24 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # -%define libname lib%{name}-0_8 +%define libname lib%{name}-0_9 Name: codec2 -Version: 0.8.1 +Version: 0.9.2 Release: 0 Summary: Low bit rate speech codec # octave and asterisk directories contain GPL-2.0 licensed code but its not # used build, only used in examples subpackage. License: LGPL-2.1-only Group: Productivity/Hamradio/Other -URL: http://rowetel.com/codec2.html -Source: https://hobbes1069.fedorapeople.org/freetel/codec2/codec2-%{version}.tar.xz +URL: https://rowetel.com/codec2.html +Source: https://github.com/drowe67/codec2/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: %{name}-rpmlintrc Source2: baselibs.conf Patch0: codec2-no_return_random.patch -Patch1: codec2-licensed-stuff.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig @@ -72,16 +71,14 @@ BuildArch: noarch Example code for Codec 2, including test voices and matlab/octave files. %prep -%setup -q -%patch0 -p1 -%patch1 -p0 +%autosetup -p1 %build %cmake \ -DINSTALL_EXAMPLES=TRUE \ -DUNITTEST=TRUE \ -Wno-dev -%make_jobs +%cmake_build %install %cmake_install @@ -107,20 +104,15 @@ EOF %files %license COPYING -%doc README README_fdmdv.txt +%doc README* %{_bindir}/c2dec -%{_bindir}/c2demo %{_bindir}/c2enc -%{_bindir}/c2sim %{_bindir}/drs232 %{_bindir}/drs232_ldpc %{_bindir}/fdmdv_demod %{_bindir}/fdmdv_get_test_bits -%{_bindir}/fdmdv_interleave %{_bindir}/fdmdv_mod %{_bindir}/fdmdv_put_test_bits -%{_bindir}/fec_dec -%{_bindir}/fec_enc %{_bindir}/fsk_mod %{_bindir}/fm_demod %{_bindir}/insert_errors @@ -130,6 +122,9 @@ EOF %files devel %{_includedir}/* +%dir %{_libdir}/cmake/codec2 +%{_libdir}/cmake/codec2/codec2-config-relwithdebinfo.cmake +%{_libdir}/cmake/codec2/codec2-config.cmake %{_libdir}/libcodec2.so %{_libdir}/pkgconfig/%{name}.pc