From 89078c09a29449c6edf032eca99cf21d95f598a5 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Thu, 2 Feb 2012 20:36:26 +0100 Subject: [PATCH] 3rdparty/libsamplerate: updated to version 0.1.8 Updated 3rdparty libsamplerate to version 0.1.8 and bumped requirement to system's libsamplerate to version 0.1.8. --- CMakeLists.txt | 2 +- src/3rdparty/samplerate/common.h | 16 ++++++++++-- src/3rdparty/samplerate/fastest_coeffs.h | 4 +-- src/3rdparty/samplerate/float_cast.h | 30 ++++++++++++++++++++-- src/3rdparty/samplerate/high_qual_coeffs.h | 4 +-- src/3rdparty/samplerate/mid_qual_coeffs.h | 4 +-- src/3rdparty/samplerate/samplerate.c | 4 +-- src/3rdparty/samplerate/samplerate.h | 4 +-- src/3rdparty/samplerate/src_linear.c | 7 +++-- src/3rdparty/samplerate/src_sinc.c | 9 ++++--- src/3rdparty/samplerate/src_zoh.c | 7 +++-- 11 files changed, 69 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ace487a2c..168f27a15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,7 +322,7 @@ ENDIF(LMMS_BUILD_WIN32) # check for libsamplerate IF(WANT_SYSTEM_SR) - PKG_CHECK_MODULES(SAMPLERATE samplerate>=0.1.7) + PKG_CHECK_MODULES(SAMPLERATE samplerate>=0.1.8) IF(SAMPLERATE_FOUND) SET(LMMS_HAVE_SAMPLERATE TRUE) ENDIF(SAMPLERATE_FOUND) diff --git a/src/3rdparty/samplerate/common.h b/src/3rdparty/samplerate/common.h index ed2198b11..a8d4e9887 100644 --- a/src/3rdparty/samplerate/common.h +++ b/src/3rdparty/samplerate/common.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ @@ -46,6 +46,18 @@ typedef long int32_t ; #define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20)) +/* +** Inspiration : http://sourcefrog.net/weblog/software/languages/C/unused.html +*/ +#ifdef UNUSED +#elif defined (__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__ ((unused)) +#elif defined (__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + #ifdef __GNUC__ # define WARN_UNUSED __attribute__ ((warn_unused_result)) #else diff --git a/src/3rdparty/samplerate/fastest_coeffs.h b/src/3rdparty/samplerate/fastest_coeffs.h index dd68871de..49b839928 100644 --- a/src/3rdparty/samplerate/fastest_coeffs.h +++ b/src/3rdparty/samplerate/fastest_coeffs.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ diff --git a/src/3rdparty/samplerate/float_cast.h b/src/3rdparty/samplerate/float_cast.h index ee981c5e4..6a45495b5 100644 --- a/src/3rdparty/samplerate/float_cast.h +++ b/src/3rdparty/samplerate/float_cast.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2001-2008 Erik de Castro Lopo +** Copyright (C) 2001-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU Lesser General Public License as published by @@ -16,7 +16,7 @@ ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Version 1.4 */ +/* Version 1.5 */ #ifndef FLOAT_CAST_HEADER #define FLOAT_CAST_HEADER @@ -121,6 +121,32 @@ return retval ; } /* float2int */ +#elif (defined (WIN64) || defined(_WIN64)) + + /* Win64 section should be places before Win32 one, because + ** most likely both WIN32 and WIN64 will be defined in 64-bit case. + */ + + #include + + /* Win64 doesn't seem to have these functions, nor inline assembly. + ** Therefore implement inline versions of these functions here. + */ + #include + #include + + __inline long int + lrint(double flt) + { + return _mm_cvtsd_si32(_mm_load_sd(&flt)); + } + + __inline long int + lrintf(float flt) + { + return _mm_cvtss_si32(_mm_load_ss(&flt)); + } + #elif (defined (WIN32) || defined (_WIN32)) #undef HAVE_LRINT_REPLACEMENT diff --git a/src/3rdparty/samplerate/high_qual_coeffs.h b/src/3rdparty/samplerate/high_qual_coeffs.h index ad90f3873..bc7302cc7 100644 --- a/src/3rdparty/samplerate/high_qual_coeffs.h +++ b/src/3rdparty/samplerate/high_qual_coeffs.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2007-2008 Erik de Castro Lopo +** Copyright (C) 2007-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ diff --git a/src/3rdparty/samplerate/mid_qual_coeffs.h b/src/3rdparty/samplerate/mid_qual_coeffs.h index 2b6bc5a73..e54ec7507 100644 --- a/src/3rdparty/samplerate/mid_qual_coeffs.h +++ b/src/3rdparty/samplerate/mid_qual_coeffs.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2007-2008 Erik de Castro Lopo +** Copyright (C) 2007-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ diff --git a/src/3rdparty/samplerate/samplerate.c b/src/3rdparty/samplerate/samplerate.c index b41555f16..9cd901c6a 100644 --- a/src/3rdparty/samplerate/samplerate.c +++ b/src/3rdparty/samplerate/samplerate.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ diff --git a/src/3rdparty/samplerate/samplerate.h b/src/3rdparty/samplerate/samplerate.h index 160b8bd59..a6f5aaa33 100644 --- a/src/3rdparty/samplerate/samplerate.h +++ b/src/3rdparty/samplerate/samplerate.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ diff --git a/src/3rdparty/samplerate/src_linear.c b/src/3rdparty/samplerate/src_linear.c index cfd585a3e..85ff20707 100644 --- a/src/3rdparty/samplerate/src_linear.c +++ b/src/3rdparty/samplerate/src_linear.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ @@ -58,6 +58,9 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) double src_ratio, input_index, rem ; int ch ; + if (data->input_frames <= 0) + return SRC_ERR_NO_ERROR ; + if (psrc->private_data == NULL) return SRC_ERR_NO_PRIVATE ; diff --git a/src/3rdparty/samplerate/src_sinc.c b/src/3rdparty/samplerate/src_sinc.c index 846e30a57..5e013b666 100644 --- a/src/3rdparty/samplerate/src_sinc.c +++ b/src/3rdparty/samplerate/src_sinc.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ @@ -1166,7 +1166,7 @@ prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len) len = MIN (filter->in_count - filter->in_used, len) ; len -= (len % filter->channels) ; - if (len < 0 || filter->b_end + len > filter->b_len) + if (len < 0 || filter->b_end + len > filter->b_len) return SRC_ERR_SINC_PREPARE_DATA_BAD_LEN ; memcpy (filter->buffer + filter->b_end, data->data_in + filter->in_used, @@ -1194,6 +1194,9 @@ prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len) filter->b_real_end = filter->b_end ; len = half_filter_chan_len + 5 ; + if (len < 0 || filter->b_end + len > filter->b_len) + len = filter->b_len - filter->b_end ; + memset (filter->buffer + filter->b_end, 0, len * sizeof (filter->buffer [0])) ; filter->b_end += len ; } ; diff --git a/src/3rdparty/samplerate/src_zoh.c b/src/3rdparty/samplerate/src_zoh.c index 87545f555..bb02ba58e 100644 --- a/src/3rdparty/samplerate/src_zoh.c +++ b/src/3rdparty/samplerate/src_zoh.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2008 Erik de Castro Lopo +** Copyright (C) 2002-2011 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ /* -** This code is part of Secret Rabibt Code aka libsamplerate. A commercial +** This code is part of Secret Rabbit Code aka libsamplerate. A commercial ** use license for this code is available, please see: ** http://www.mega-nerd.com/SRC/procedure.html */ @@ -56,6 +56,9 @@ zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) double src_ratio, input_index, rem ; int ch ; + if (data->input_frames <= 0) + return SRC_ERR_NO_ERROR ; + if (psrc->private_data == NULL) return SRC_ERR_NO_PRIVATE ;