diff --git a/Libraries/spandsp/spandsp/spandsp.xcodeproj/project.pbxproj b/Libraries/spandsp/spandsp/spandsp.xcodeproj/project.pbxproj index 4d324ab2e..313cb11c7 100644 --- a/Libraries/spandsp/spandsp/spandsp.xcodeproj/project.pbxproj +++ b/Libraries/spandsp/spandsp/spandsp.xcodeproj/project.pbxproj @@ -142,7 +142,6 @@ A1B98B0D1725EC6500B6E8B5 /* vector_float.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B98A861725EC6400B6E8B5 /* vector_float.h */; }; A1B98B0E1725EC6500B6E8B5 /* vector_int.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B98A871725EC6400B6E8B5 /* vector_int.h */; }; A1B98B0F1725EC6500B6E8B5 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B98A881725EC6400B6E8B5 /* version.h */; }; - B6C7AA3F1996F99C00B233D7 /* floating_fudge.h in Headers */ = {isa = PBXBuildFile; fileRef = B6C7AA3E1996F99C00B233D7 /* floating_fudge.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -284,7 +283,6 @@ A1B98A871725EC6400B6E8B5 /* vector_int.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vector_int.h; sourceTree = ""; }; A1B98A881725EC6400B6E8B5 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; A1B98A891725EC6400B6E8B5 /* version.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = version.h.in; sourceTree = ""; }; - B6C7AA3E1996F99C00B233D7 /* floating_fudge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = floating_fudge.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -349,7 +347,6 @@ A1B98A151725EC6400B6E8B5 /* fast_convert.h */, A1B98A161725EC6400B6E8B5 /* fax.h */, A1B98A171725EC6400B6E8B5 /* fax_modems.h */, - B6C7AA3E1996F99C00B233D7 /* floating_fudge.h */, A1B98A181725EC6400B6E8B5 /* fir.h */, A1B98A191725EC6400B6E8B5 /* fsk.h */, A1B98A1A1725EC6400B6E8B5 /* g168models.h */, @@ -547,7 +544,6 @@ A1B98AC81725EC6500B6E8B5 /* modem_echo.h in Headers */, A1B98AC91725EC6500B6E8B5 /* noise.h in Headers */, A1B98ACA1725EC6500B6E8B5 /* oki_adpcm.h in Headers */, - B6C7AA3F1996F99C00B233D7 /* floating_fudge.h in Headers */, A1B98ACB1725EC6500B6E8B5 /* queue.h in Headers */, A1B98ACC1725EC6500B6E8B5 /* schedule.h in Headers */, A1B98ACD1725EC6500B6E8B5 /* sig_tone.h in Headers */, diff --git a/Libraries/spandsp/spandsp/spandsp/floating_fudge.h b/Libraries/spandsp/spandsp/spandsp/floating_fudge.h deleted file mode 100644 index 2ef042339..000000000 --- a/Libraries/spandsp/spandsp/spandsp/floating_fudge.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * floating_fudge.h - A bunch of shims, to use double maths - * functions on platforms which lack the - * float versions with an 'f' at the end, - * and to deal with the vaguaries of lrint(). - * - * Written by Steve Underwood - * - * Copyright (C) 2008 Steve Underwood - * - * 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 version 2.1, - * as published by the Free Software Foundation. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#if !defined(_FLOATING_FUDGE_H_) -#define _FLOATING_FUDGE_H_ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if !defined(HAVE_SINF) -static __inline__ float sinf(float x) -{ - return (float) sin((double) x); -} -#endif - -#if !defined(HAVE_COSF) -static __inline__ float cosf(float x) -{ - return (float) cos((double) x); -} -#endif - -#if !defined(HAVE_TANF) -static __inline__ float tanf(float x) -{ - return (float) tan((double) x); -} -#endif - -#if !defined(HAVE_ASINF) -static __inline__ float asinf(float x) -{ - return (float) asin((double) x); -} -#endif - -#if !defined(HAVE_ACOSF) -static __inline__ float acosf(float x) -{ - return (float) acos((double) x); -} -#endif - -#if !defined(HAVE_ATANF) -static __inline__ float atanf(float x) -{ - return (float) atan((double) x); -} - -#endif - -#if !defined(HAVE_ATAN2F) -static __inline__ float atan2f(float y, float x) -{ - return (float) atan2((double) y, (double) x); -} - -#endif - -#if !defined(HAVE_CEILF) -static __inline__ float ceilf(float x) -{ - return (float) ceil((double) x); -} -#endif - -#if !defined(HAVE_FLOORF) -static __inline__ float floorf(float x) -{ - return (float) floor((double) x); -} - -#endif - -#if !defined(HAVE_POWF) -static __inline__ float powf(float x, float y) -{ - return (float) pow((double) x, (double) y); -} -#endif - -#if !defined(HAVE_EXPF) -static __inline__ float expf(float x) -{ - return (float) expf((double) x); -} -#endif - -#if !defined(HAVE_LOGF) -static __inline__ float logf(float x) -{ - return (float) logf((double) x); -} -#endif - -#if !defined(HAVE_LOG10F) -static __inline__ float log10f(float x) -{ - return (float) log10((double) x); -} -#endif - -#if defined(__cplusplus) -} -#endif - -#endif - -/*- End of file ------------------------------------------------------------*/ diff --git a/Libraries/spandsp/spandsp/time_scale.c b/Libraries/spandsp/spandsp/time_scale.c index 3a85cae71..e1f535d67 100644 --- a/Libraries/spandsp/spandsp/time_scale.c +++ b/Libraries/spandsp/spandsp/time_scale.c @@ -21,6 +21,8 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: time_scale.c,v 1.30 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ @@ -42,7 +44,7 @@ #if defined(HAVE_MATH_H) #include #endif -#include "floating_fudge.h" +//#include "floating_fudge.h" #include "spandsp/telephony.h" #include "spandsp/fast_convert.h" @@ -108,6 +110,7 @@ SPAN_DECLARE(int) time_scale_rate(time_scale_state_t *s, float playout_rate) /* Treat rate close to normal speed as exactly normal speed, and avoid divide by zero, and other numerical problems. */ playout_rate = 1.0f; + s->lcp=0; } else if (playout_rate < 1.0f) { @@ -180,6 +183,18 @@ SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], out_len = 0; in_len = 0; + // loge( "ts: %f %d", s->playout_rate, s->lcp ); + + //just copy on straight playout + if( s->playout_rate == 1.0f ) { + memcpy( out, s->buf, s->fill * sizeof(int16_t) ); + memcpy( out+s->fill, in, len * sizeof(int16_t) ); + out_len = len + s->fill; + s->fill = 0; + // loge( "tsr1: %d", out_len ); + return out_len; + } + /* Top up the buffer */ if (s->fill + len < s->buf_len) { @@ -229,7 +244,7 @@ SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], } if (s->playout_rate == 1.0f) { - s->lcp = 0x7FFFFFFF; + s->lcp = 0;//0x7FFFFFFF; } else {