Author: tfaber Date: Sun Jun 18 11:41:14 2017 New Revision: 75088
URL: http://svn.reactos.org/svn/reactos?rev=75088&view=rev Log: [LIBSAMPLERATE] - Update to version 1.0.9 CORE-13451
Added: trunk/reactos/sdk/lib/3rdparty/libsamplerate/COPYING (with props) Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/common.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/config.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/fastest_coeffs.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/float_cast.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/high_qual_coeffs.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/mid_qual_coeffs.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.c trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.h trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_linear.c trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_sinc.c trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_zoh.c trunk/reactos/sdk/lib/3rdparty/libsamplerate/unistd.h
Added: trunk/reactos/sdk/lib/3rdparty/libsamplerate/COPYING URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/COPYING (added) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/COPYING [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -0,0 +1,25 @@ +Copyright (c) 2012-2016, Erik de Castro Lopo erikd@mega-nerd.com +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Propchange: trunk/reactos/sdk/lib/3rdparty/libsamplerate/COPYING ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/common.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/common.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/common.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
#ifndef COMMON_H_INCLUDED @@ -99,6 +83,7 @@ SRC_ERR_NULL_CALLBACK, SRC_ERR_NO_VARIABLE_RATIO, SRC_ERR_SINC_PREPARE_DATA_BAD_LEN, + SRC_ERR_BAD_INTERNAL_STATE,
/* This must be the last error number. */ SRC_ERR_MAX_ERROR @@ -129,7 +114,7 @@ src_callback_t callback_func ; void *user_callback_data ; long saved_frames ; - float *saved_data ; + const float *saved_data ; } SRC_PRIVATE ;
/* In src_sinc.c */ @@ -165,5 +150,11 @@ return res ; } /* fmod_one */
+static inline int +is_bad_src_ratio (double ratio) +{ return (ratio < (1.0 / SRC_MAX_RATIO) || ratio > (1.0 * SRC_MAX_RATIO)) ; +} /* is_bad_src_ratio */ + + #endif /* COMMON_H_INCLUDED */
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/config.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/config.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/config.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,19 +1,9 @@ /* -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. +** +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/*
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/fastest_coeffs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/fastest_coeffs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/fastest_coeffs.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/*
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/float_cast.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/float_cast.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/float_cast.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,19 +1,9 @@ /* -** 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 -** 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 -** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** Copyright (c) 2001-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. +** +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/* Version 1.5 */
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/high_qual_coeffs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/high_qual_coeffs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/high_qual_coeffs.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2007-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2007-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/*
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/mid_qual_coeffs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/mid_qual_coeffs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/mid_qual_coeffs.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2007-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2007-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/*
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.c [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,36 +1,15 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
-/* -** 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 -*/ - #include "precomp.h"
static int psrc_set_converter (SRC_PRIVATE *psrc, int converter_type) ;
- -static inline int -is_bad_src_ratio (double ratio) -{ return (ratio < (1.0 / SRC_MAX_RATIO) || ratio > (1.0 * SRC_MAX_RATIO)) ; -} /* is_bad_src_ratio */
SRC_STATE * src_new (int converter_type, int channels, int *error) @@ -285,6 +264,20 @@
return SRC_ERR_NO_ERROR ; } /* src_set_ratio */ + +int +src_get_channels (SRC_STATE *state) +{ SRC_PRIVATE *psrc ; + + psrc = (SRC_PRIVATE*) state ; + + if (psrc == NULL) + return SRC_ERR_BAD_STATE ; + if (psrc->vari_process == NULL || psrc->const_process == NULL) + return SRC_ERR_BAD_PROC_PTR ; + + return psrc->channels ; +} /* src_get_channels */
int src_reset (SRC_STATE *state) @@ -381,7 +374,7 @@ case SRC_ERR_BAD_DATA : return "SRC_DATA pointer is NULL." ; case SRC_ERR_BAD_DATA_PTR : - return "SRC_DATA->data_out is NULL." ; + return "SRC_DATA->data_out or SRC_DATA->data_in is NULL." ; case SRC_ERR_NO_PRIVATE : return "Internal error. No private data." ;
@@ -418,6 +411,8 @@ return "This converter only allows constant conversion ratios." ; case SRC_ERR_SINC_PREPARE_DATA_BAD_LEN : return "Internal error : Bad length in prepare_data ()." ; + case SRC_ERR_BAD_INTERNAL_STATE : + return "Error : Someone is trampling on my internal state." ;
case SRC_ERR_MAX_ERROR : return "Placeholder. No error defined for this error number." ; @@ -445,7 +440,7 @@
error = src_process (src_state, src_data) ;
- src_state = src_delete (src_state) ; + src_delete (src_state) ;
return error ; } /* src_simple */
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/samplerate.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/* @@ -40,7 +24,8 @@
/* SRC_DATA is used to pass data to src_simple() and src_process(). */ typedef struct -{ float *data_in, *data_out ; +{ const float *data_in ; + float *data_out ;
long input_frames, output_frames ; long input_frames_used, output_frames_gen ; @@ -49,12 +34,6 @@
double src_ratio ; } SRC_DATA ; - -/* SRC_CB_DATA is used with callback based API. */ -typedef struct -{ long frames ; - float *data_in ; -} SRC_CB_DATA ;
/* ** User supplied callback function type for use with src_callback_new() @@ -137,6 +116,13 @@ int src_set_ratio (SRC_STATE *state, double new_ratio) ;
/* +** Get the current channel count. +** Returns negative on error, positive channel count otherwise +*/ + +int src_get_channels (SRC_STATE *state) ; + +/* ** Reset the internal SRC state. ** Does not modify the quality settings. ** Does not free any memory allocations.
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_linear.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_linear.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_linear.c [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
#include "precomp.h" @@ -72,6 +56,10 @@ priv->in_used = priv->out_gen = 0 ;
src_ratio = psrc->last_ratio ; + + if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + input_index = psrc->last_position ;
/* Calculate samples before first sample in input array. */ @@ -177,10 +165,11 @@
if (psrc->private_data == NULL) { priv = calloc (1, sizeof (*priv) + psrc->channels * sizeof (float)) ; - if (priv == NULL) - return SRC_ERR_MALLOC_FAILED ; psrc->private_data = priv ; } ; + + if (priv == NULL) + return SRC_ERR_MALLOC_FAILED ;
priv->linear_magic_marker = LINEAR_MAGIC_MARKER ; priv->channels = psrc->channels ;
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_sinc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_sinc.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_sinc.c [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
#include "precomp.h" @@ -136,7 +120,7 @@ return "Band limited sinc interpolation, medium quality, 121dB SNR, 90% BW." ;
case SRC_SINC_BEST_QUALITY : - return "Band limited sinc interpolation, best quality, 145dB SNR, 96% BW." ; + return "Band limited sinc interpolation, best quality, 144dB SNR, 96% BW." ;
default : break ; @@ -195,19 +179,19 @@ switch (src_enum) { case SRC_SINC_FASTEST : temp_filter.coeffs = fastest_coeffs.coeffs ; - temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 1 ; + temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 2 ; temp_filter.index_inc = fastest_coeffs.increment ; break ;
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 ; + temp_filter.coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 2 ; temp_filter.index_inc = slow_mid_qual_coeffs.increment ; break ;
case SRC_SINC_BEST_QUALITY : temp_filter.coeffs = slow_high_qual_coeffs.coeffs ; - 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) - 2 ; temp_filter.index_inc = slow_high_qual_coeffs.increment ; break ;
@@ -341,6 +325,9 @@
src_ratio = psrc->last_ratio ;
+ if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + /* Check the sample rate ratio wrt the buffer len. */ count = (filter->coeff_half_len + 2.0) / filter->index_inc ; if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) @@ -375,17 +362,14 @@
/* This is the termination condition. */ if (filter->b_real_end >= 0) - { if (filter->b_current + input_index + terminate >= filter->b_real_end) + { if (filter->b_current + input_index + terminate > filter->b_real_end) break ; } ;
if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
- float_increment = filter->index_inc * 1.0 ; - if (src_ratio < 1.0) - float_increment = filter->index_inc * src_ratio ; - + float_increment = filter->index_inc * (src_ratio < 1.0 ? src_ratio : 1.0) ; increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ; @@ -490,6 +474,9 @@
src_ratio = psrc->last_ratio ;
+ if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + /* Check the sample rate ratio wrt the buffer len. */ count = (filter->coeff_half_len + 2.0) / filter->index_inc ; if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) @@ -531,10 +518,7 @@ if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
- float_increment = filter->index_inc * 1.0 ; - if (src_ratio < 1.0) - float_increment = filter->index_inc * src_ratio ; - + float_increment = filter->index_inc * (src_ratio < 1.0 ? src_ratio : 1.0) ; increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ; @@ -644,6 +628,9 @@
src_ratio = psrc->last_ratio ;
+ if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + /* Check the sample rate ratio wrt the buffer len. */ count = (filter->coeff_half_len + 2.0) / filter->index_inc ; if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) @@ -685,10 +672,7 @@ if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
- float_increment = filter->index_inc * 1.0 ; - if (src_ratio < 1.0) - float_increment = filter->index_inc * src_ratio ; - + float_increment = filter->index_inc * (src_ratio < 1.0 ? src_ratio : 1.0) ; increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ; @@ -804,6 +788,9 @@
src_ratio = psrc->last_ratio ;
+ if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + /* Check the sample rate ratio wrt the buffer len. */ count = (filter->coeff_half_len + 2.0) / filter->index_inc ; if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) @@ -845,10 +832,7 @@ if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
- float_increment = filter->index_inc * 1.0 ; - if (src_ratio < 1.0) - float_increment = filter->index_inc * src_ratio ; - + float_increment = filter->index_inc * (src_ratio < 1.0 ? src_ratio : 1.0) ; increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ; @@ -1051,6 +1035,9 @@
src_ratio = psrc->last_ratio ;
+ if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + /* Check the sample rate ratio wrt the buffer len. */ count = (filter->coeff_half_len + 2.0) / filter->index_inc ; if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) @@ -1092,10 +1079,7 @@ if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
- float_increment = filter->index_inc * 1.0 ; - if (src_ratio < 1.0) - float_increment = filter->index_inc * src_ratio ; - + float_increment = filter->index_inc * (src_ratio < 1.0 ? src_ratio : 1.0) ; increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ;
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_zoh.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_zoh.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/src_zoh.c [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,25 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** the Free Software Foundation; either version 2 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** 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 +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
#include "precomp.h" @@ -70,6 +54,10 @@ priv->in_used = priv->out_gen = 0 ;
src_ratio = psrc->last_ratio ; + + if (is_bad_src_ratio (src_ratio)) + return SRC_ERR_BAD_INTERNAL_STATE ; + input_index = psrc->last_position ;
/* Calculate samples before first sample in input array. */ @@ -168,10 +156,11 @@
if (psrc->private_data == NULL) { priv = calloc (1, sizeof (*priv) + psrc->channels * sizeof (float)) ; - if (priv == NULL) - return SRC_ERR_MALLOC_FAILED ; psrc->private_data = priv ; } ; + + if (priv == NULL) + return SRC_ERR_MALLOC_FAILED ;
priv->zoh_magic_marker = ZOH_MAGIC_MARKER ; priv->channels = psrc->channels ;
Modified: trunk/reactos/sdk/lib/3rdparty/libsamplerate/unistd.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/libsampler... ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/libsamplerate/unistd.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/libsamplerate/unistd.h [iso-8859-1] Sun Jun 18 11:41:14 2017 @@ -1,19 +1,9 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo erikd@mega-nerd.com +** Copyright (c) 2002-2016, Erik de Castro Lopo erikd@mega-nerd.com +** All rights reserved. ** -** 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 -** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING */
/*