18e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels/********************************************************************
28e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels *                                                                  *
38e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
48e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
58e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
68e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
78e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels *                                                                  *
88e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
98e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels * by the Xiph.Org Foundation http://www.xiph.org/                  *
108e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels *                                                                  *
118e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels ********************************************************************
128e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
138e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels function: modified discrete cosine transform prototypes
148e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
158e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
168e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels ********************************************************************/
178e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
188e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#ifndef _OGG_mdct_H_
198e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define _OGG_mdct_H_
208e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
218e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#include "vorbis/codec.h"
228e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
238e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
248e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
258e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
268e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
278e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels/*#define MDCT_INTEGERIZED  <- be warned there could be some hurt left here*/
288e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#ifdef MDCT_INTEGERIZED
298e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
308e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define DATA_TYPE int
318e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define REG_TYPE  register int
328e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define TRIGBITS 14
338e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define cPI3_8 6270
348e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define cPI2_8 11585
358e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define cPI1_8 15137
368e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
378e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define FLOAT_CONV(x) ((int)((x)*(1<<TRIGBITS)+.5))
388e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define MULT_NORM(x) ((x)>>TRIGBITS)
398e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define HALVE(x) ((x)>>1)
408e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
418e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#else
428e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
438e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define DATA_TYPE float
448e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define REG_TYPE  float
458e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define cPI3_8 .38268343236508977175F
468e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define cPI2_8 .70710678118654752441F
478e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define cPI1_8 .92387953251128675613F
488e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
498e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define FLOAT_CONV(x) (x)
508e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define MULT_NORM(x) (x)
518e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#define HALVE(x) ((x)*.5f)
528e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
538e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#endif
548e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
558e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
568e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckelstypedef struct {
578e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels  int n;
588e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels  int log2n;
598e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
608e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels  DATA_TYPE *trig;
618e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels  int       *bitrev;
628e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
638e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels  DATA_TYPE scale;
648e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels} mdct_lookup;
658e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
668e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckelsextern void mdct_init(mdct_lookup *lookup,int n);
678e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckelsextern void mdct_clear(mdct_lookup *l);
688e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckelsextern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
698e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckelsextern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
708e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels
718e01cdce135d5d816f92d7bb83f9a930aa1b45aeLucas Eckels#endif
72