1 /********************************************************************
3 * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS DISTRIBUTING. *
8 * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
9 * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************
14 function: linear x scale -> log x scale mappings (with bias)
15 author: Monty <monty@xiph.org>
16 modifications by: Monty
17 last modification date: Aug 18 1999
19 ********************************************************************/
27 Bias = log_2( n / ( (2^octaves) - 1))
28 log_x = log_2( linear_x + 2^Bias ) - Bias
29 linear_x = 2^(Bias+log_x)-2^Bias;
32 #define LOG_BIAS(n,o) (log((n)/(pow(2.,(o))-1))/log(2.))
33 #define LOG_X(x,b) (log((x)+pow(2.,(b)))/log(2.)-(b))
34 #define LINEAR_X(x,b) (pow(2.,((b)+(x)))-pow(2.,(b)))