Initial log freq scale and log scale bias defines.
authorMonty <xiphmont@xiph.org>
Sat, 21 Aug 1999 22:21:17 +0000 (22:21 +0000)
committerMonty <xiphmont@xiph.org>
Sat, 21 Aug 1999 22:21:17 +0000 (22:21 +0000)
Monty

svn path=/trunk/vorbis/; revision=72

lib/xlogmap.h [new file with mode: 0644]

diff --git a/lib/xlogmap.h b/lib/xlogmap.h
new file mode 100644 (file)
index 0000000..f845b1f
--- /dev/null
@@ -0,0 +1,36 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
+ * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ *                                                                  *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * http://www.xiph.org/                                             *
+ *                                                                  *
+ ********************************************************************
+
+  function: linear x scale -> log x scale mappings (with bias)
+  author: Monty <monty@xiph.org>
+  modifications by: Monty
+  last modification date: Aug 18 1999
+
+ ********************************************************************/
+
+#ifndef _V_XLOGMAP_H_
+#define _V_XLOGMAP_H_
+
+#include <math.h>
+
+/*
+Bias     = log_2( n / ( (2^octaves) - 1))
+log_x    = log_2( linear_x + 2^Bias ) - Bias 
+linear_x = 2^(Bias+log_x)-2^Bias; 
+*/
+
+#define LOG_BIAS(n,o)  (log((n)/(pow(2.,(o))-1))/log(2.))
+#define LOG_X(x,b)     (log((x)+pow(2.,(b)))/log(2.)-(b))
+#define LINEAR_X(x,b)  (pow(2.,((b)+(x)))-pow(2.,(b)))
+
+#endif