[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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** 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)) #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__ #ifdef __GNUC__
# define WARN_UNUSED __attribute__ ((warn_unused_result)) # define WARN_UNUSED __attribute__ ((warn_unused_result))
#else #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 ** 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 ** it under the terms of the GNU General Public License as published by
@ -48,7 +48,7 @@
#define COMPILER_IS_GCC 0 #define COMPILER_IS_GCC 0
/* Target processor clips on negative float to int conversion. */ /* 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. */ /* Target processor clips on positive float to int conversion. */
#define CPU_CLIPS_POSITIVE 0 #define CPU_CLIPS_POSITIVE 0
@ -166,13 +166,16 @@
#define PACKAGE_NAME "libsamplerate" #define PACKAGE_NAME "libsamplerate"
/* Define to the full name and version of this package. */ /* 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 to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libsamplerate" #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 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. */ /* The size of `double', as computed by sizeof. */
#define SIZEOF_DOUBLE 8 #define SIZEOF_DOUBLE 8
@ -190,7 +193,7 @@
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Version number of package */ /* Version number of package */
#define VERSION "0.1.4" #define VERSION "0.1.8"
@ -203,3 +206,13 @@
#define inline __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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** 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 ** 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 ** 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. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/* Version 1.4 */ /* Version 1.5 */
#ifndef FLOAT_CAST_HEADER #ifndef FLOAT_CAST_HEADER
#define FLOAT_CAST_HEADER #define FLOAT_CAST_HEADER
@ -121,6 +121,32 @@
return retval ; return retval ;
} /* float2int */ } /* 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)) #elif (defined (WIN32) || defined (_WIN32))
#undef HAVE_LRINT_REPLACEMENT #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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** 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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** 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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** http://www.mega-nerd.com/SRC/procedure.html
*/ */
@ -30,9 +30,6 @@
#include "float_cast.h" #include "float_cast.h"
#include "common.h" #include "common.h"
#include <windows.h>
#include <debug.h>
static int linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ; static int linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static void linear_reset (SRC_PRIVATE *psrc) ; 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 ; double src_ratio, input_index, rem ;
int ch ; int ch ;
if (data->input_frames <= 0)
return SRC_ERR_NO_ERROR ;
if (psrc->private_data == NULL) if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ; 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 ; 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) 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) ; { printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", priv->in_used, priv->channels, input_index) ;
ASSERT (0) ; exit (1) ;
} ; } ;
for (ch = 0 ; ch < priv->channels ; ch++) 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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** http://www.mega-nerd.com/SRC/procedure.html
*/ */
@ -48,10 +48,8 @@ typedef int32_t increment_t ;
typedef float coeff_t ; typedef float coeff_t ;
#include "fastest_coeffs.h" #include "fastest_coeffs.h"
#ifdef HIGH_QUALITY
#include "mid_qual_coeffs.h" #include "mid_qual_coeffs.h"
#include "high_qual_coeffs.h" #include "high_qual_coeffs.h"
#endif
typedef struct typedef struct
{ int sinc_magic_marker ; { 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.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 1 ;
temp_filter.index_inc = fastest_coeffs.increment ; temp_filter.index_inc = fastest_coeffs.increment ;
break ; break ;
#if HIGH_QUALITY
case SRC_SINC_MEDIUM_QUALITY : case SRC_SINC_MEDIUM_QUALITY :
temp_filter.coeffs = slow_mid_qual_coeffs.coeffs ; temp_filter.coeffs = slow_mid_qual_coeffs.coeffs ;
temp_filter.coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 1 ; 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.coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 1 ;
temp_filter.index_inc = slow_high_qual_coeffs.increment ; temp_filter.index_inc = slow_high_qual_coeffs.increment ;
break ; break ;
#endif
default : default :
return SRC_ERR_BAD_CONVERTER ; return SRC_ERR_BAD_CONVERTER ;
} ; } ;
@ -1196,6 +1194,9 @@ prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len)
filter->b_real_end = filter->b_end ; filter->b_real_end = filter->b_end ;
len = half_filter_chan_len + 5 ; 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])) ; memset (filter->buffer + filter->b_end, 0, len * sizeof (filter->buffer [0])) ;
filter->b_end += len ; 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 ** 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 ** 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: ** use license for this code is available, please see:
** http://www.mega-nerd.com/SRC/procedure.html ** 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 ; double src_ratio, input_index, rem ;
int ch ; int ch ;
if (data->input_frames <= 0)
return SRC_ERR_NO_ERROR ;
if (psrc->private_data == NULL) if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ; return SRC_ERR_NO_PRIVATE ;

View file

@ -1,5 +1,5 @@
/* /*
** 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 ** 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 ** it under the terms of the GNU Lesser General Public License as published by