summaryrefslogtreecommitdiff
path: root/main/libresample/src/resample_defs.h
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-12-31 21:22:31 +0000
committerRussell Bryant <russell@russellbryant.com>2007-12-31 21:22:31 +0000
commit21cb767db7d4854769d6a9d15e2008ab27c404a5 (patch)
tree823393d4498b07581162c3e5266a494aa638a45c /main/libresample/src/resample_defs.h
parentf3e2f0bb0a0bed2960871087e3555b5acb239a78 (diff)
Merge changes from team/russell/codec_resample
This commit imports libresample for use in Asterisk. It also adds a new codec module, codec_resample. This module uses libresample to re-sample signed linear audio between 8 kHz and 16 kHz. It also provides an alternative for converting between 16 kHz G.722 and 8 kHz signed linear when using G.722, which will likely be useful as some people have complained about volume issues when the current codec_g722 converts to 8 kHz signed linear. But, to test this, you will have to disable the g722-to-slin and g722-to-slin16 translators in codec_g722.c. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/libresample/src/resample_defs.h')
-rw-r--r--main/libresample/src/resample_defs.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/main/libresample/src/resample_defs.h b/main/libresample/src/resample_defs.h
new file mode 100644
index 000000000..f1b10d432
--- /dev/null
+++ b/main/libresample/src/resample_defs.h
@@ -0,0 +1,90 @@
+/**********************************************************************
+
+ resample_defs.h
+
+ Real-time library interface by Dominic Mazzoni
+
+ Based on resample-1.7:
+ http://www-ccrma.stanford.edu/~jos/resample/
+
+ License: LGPL - see the file LICENSE.txt for more information
+
+**********************************************************************/
+
+#ifndef __RESAMPLE_DEFS__
+#define __RESAMPLE_DEFS__
+
+#if 0
+#if !defined(WIN32) && !defined(__CYGWIN__)
+#include "config.h"
+#endif
+#endif
+
+#define DEBUG 0
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef PI
+#define PI (3.14159265358979232846)
+#endif
+
+#ifndef PI2
+#define PI2 (6.28318530717958465692)
+#endif
+
+#define D2R (0.01745329348) /* (2*pi)/360 */
+#define R2D (57.29577951) /* 360/(2*pi) */
+
+#ifndef MAX
+#define MAX(x,y) ((x)>(y) ?(x):(y))
+#endif
+#ifndef MIN
+#define MIN(x,y) ((x)<(y) ?(x):(y))
+#endif
+
+#ifndef ABS
+#define ABS(x) ((x)<0 ?(-(x)):(x))
+#endif
+
+#ifndef SGN
+#define SGN(x) ((x)<0 ?(-1):((x)==0?(0):(1)))
+#endif
+
+#if HAVE_INTTYPES_H
+ #include <inttypes.h>
+ typedef char BOOL;
+ typedef int32_t WORD;
+ typedef uint32_t UWORD;
+#else
+ typedef char BOOL;
+ typedef int WORD;
+ typedef unsigned int UWORD;
+#endif
+
+#ifdef DEBUG
+#define INLINE
+#else
+#define INLINE inline
+#endif
+
+/* Accuracy */
+
+#define Npc 4096
+
+/* Function prototypes */
+
+int lrsSrcUp(float X[], float Y[], double factor, double *Time,
+ UWORD Nx, UWORD Nwing, float LpScl,
+ float Imp[], float ImpD[], BOOL Interp);
+
+int lrsSrcUD(float X[], float Y[], double factor, double *Time,
+ UWORD Nx, UWORD Nwing, float LpScl,
+ float Imp[], float ImpD[], BOOL Interp);
+
+#endif