[LIBSAMPLERATE]

Update to version 0.1.8
Supports amd64 now

svn path=/trunk/; revision=53375
This commit is contained in:
Timo Kreuzer 2011-08-22 16:20:30 +00:00
parent 0232b2b680
commit a48c19b60c
12 changed files with 362860 additions and 44 deletions

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
@ -16,25 +16,25 @@
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
/*
** This is the Win32 specific config.h header file.
/*
** This is the Win32 specific config.h header file.
**
** On Unix (including MacOSX), this header file is automatically generated
** On Unix (including MacOSX), this header file is automatically generated
** during the configure process while on Win32 this has to be hand edited
** to keep it up to date.
**
** This is also a good file to add Win32 specific things.
*/
/*
** MSVC++ assumes that all floating point constants without a trailing
** letter 'f' are double precision.
/*
** MSVC++ assumes that all floating point constants without a trailing
** letter 'f' are double precision.
**
** If this assumption is incorrect and one of these floating point constants
** is assigned to a float variable MSVC++ generates a warning.
**
** Since there are currently about 25000 of these warnings generated in
** src/src_sinc.c this slows down compile times considerably. The
** src/src_sinc.c this slows down compile times considerably. The
** following #pragma disables the warning.
*/
#ifdef _MSC_VER
@ -48,7 +48,7 @@
#define COMPILER_IS_GCC 0
/* Target processor clips on negative float to int conversion. */
#define CPU_CLIPS_NEGATIVE 1
#define CPU_CLIPS_NEGATIVE 0
/* Target processor clips on positive float to int conversion. */
#define CPU_CLIPS_POSITIVE 0
@ -166,13 +166,16 @@
#define PACKAGE_NAME "libsamplerate"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libsamplerate 0.1.7"
#define PACKAGE_STRING "libsamplerate 0.1.8"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libsamplerate"
/* Define to the home page for this package. */
#define PACKAGE_URL "http://www.mega-nerd.com/libsamplerate/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.1.7"
#define PACKAGE_VERSION "0.1.8"
/* The size of `double', as computed by sizeof. */
#define SIZEOF_DOUBLE 8
@ -190,16 +193,26 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.1.4"
#define VERSION "0.1.8"
/* Extra Win32 hacks. */
/*
** Microsoft's compiler still does not support the 1999 ISO C Standard
** Microsoft's compiler still does not support the 1999 ISO C Standard
** which includes 'inline'.
*/
#define inline __inline
/* ReactOS hacks */
void DbgBreak(void);
void DbgPrint(char *, ...);
#define exit(n) DbgBreak()
#define printf DbgPrint
#ifdef _M_AMD64
#define _mm_load_sd(x) __hack_hack(x) // Prevent an internal compiler error
#pragma warning(disable:4244)
#endif

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
*/

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2001-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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 <math.h>
/* Win64 doesn't seem to have these functions, nor inline assembly.
** Therefore implement inline versions of these functions here.
*/
#include <emmintrin.h>
#include <mmintrin.h>
__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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
*/

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
*/

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
*/
@ -30,9 +30,6 @@
#include "float_cast.h"
#include "common.h"
#include <windows.h>
#include <debug.h>
static int linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static void linear_reset (SRC_PRIVATE *psrc) ;
@ -61,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 ;
@ -110,8 +110,8 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
src_ratio = psrc->last_ratio + priv->out_gen * (data->src_ratio - psrc->last_ratio) / priv->out_count ;
if (SRC_DEBUG && priv->in_used < priv->channels && input_index < 1.0)
{ DPRINT1 ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", priv->in_used, priv->channels, input_index) ;
ASSERT (0) ;
{ printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", priv->in_used, priv->channels, input_index) ;
exit (1) ;
} ;
for (ch = 0 ; ch < priv->channels ; ch++)

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
*/
@ -48,10 +48,8 @@ typedef int32_t increment_t ;
typedef float coeff_t ;
#include "fastest_coeffs.h"
#ifdef HIGH_QUALITY
#include "mid_qual_coeffs.h"
#include "high_qual_coeffs.h"
#endif
typedef struct
{ int sinc_magic_marker ;
@ -206,7 +204,7 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum)
temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 1 ;
temp_filter.index_inc = fastest_coeffs.increment ;
break ;
#if HIGH_QUALITY
case SRC_SINC_MEDIUM_QUALITY :
temp_filter.coeffs = slow_mid_qual_coeffs.coeffs ;
temp_filter.coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 1 ;
@ -218,7 +216,7 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum)
temp_filter.coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 1 ;
temp_filter.index_inc = slow_high_qual_coeffs.increment ;
break ;
#endif
default :
return SRC_ERR_BAD_CONVERTER ;
} ;
@ -1168,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,
@ -1196,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 ;
} ;

View file

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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 ;

View file

@ -1,18 +1,18 @@
/*
** Copyright (C) 2002 Erik de Castro Lopo <erikd@zip.com.au>
**
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** 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
** the Free Software Foundation; either version 2.1 of the License, or
** (at your option) any later version.
**
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program; if not, write to the Free Software
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/