From 9f355ed1868e54e6f546172cbe0880fcfb721629 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 21 Aug 1999 22:21:17 +0000 Subject: [PATCH] Initial log freq scale and log scale bias defines. Monty svn path=/trunk/vorbis/; revision=72 --- lib/xlogmap.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lib/xlogmap.h diff --git a/lib/xlogmap.h b/lib/xlogmap.h new file mode 100644 index 0000000..f845b1f --- /dev/null +++ b/lib/xlogmap.h @@ -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 and The XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: linear x scale -> log x scale mappings (with bias) + author: Monty + modifications by: Monty + last modification date: Aug 18 1999 + + ********************************************************************/ + +#ifndef _V_XLOGMAP_H_ +#define _V_XLOGMAP_H_ + +#include + +/* +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 -- 2.7.4