Home | History | Annotate | Download | only in lib
      1 /********************************************************************
      2  *                                                                  *
      3  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
      4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
      5  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
      6  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
      7  *                                                                  *
      8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
      9  * by the Xiph.Org Foundation http://www.xiph.org/                  *
     10  *                                                                  *
     11  ********************************************************************
     12 
     13  function: modified discrete cosine transform prototypes
     14  last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
     15 
     16  ********************************************************************/
     17 
     18 #ifndef _OGG_mdct_H_
     19 #define _OGG_mdct_H_
     20 
     21 #include "vorbis/codec.h"
     22 
     23 
     24 
     25 
     26 
     27 /*#define MDCT_INTEGERIZED  <- be warned there could be some hurt left here*/
     28 #ifdef MDCT_INTEGERIZED
     29 
     30 #define DATA_TYPE int
     31 #define REG_TYPE  register int
     32 #define TRIGBITS 14
     33 #define cPI3_8 6270
     34 #define cPI2_8 11585
     35 #define cPI1_8 15137
     36 
     37 #define FLOAT_CONV(x) ((int)((x)*(1<<TRIGBITS)+.5))
     38 #define MULT_NORM(x) ((x)>>TRIGBITS)
     39 #define HALVE(x) ((x)>>1)
     40 
     41 #else
     42 
     43 #define DATA_TYPE float
     44 #define REG_TYPE  float
     45 #define cPI3_8 .38268343236508977175F
     46 #define cPI2_8 .70710678118654752441F
     47 #define cPI1_8 .92387953251128675613F
     48 
     49 #define FLOAT_CONV(x) (x)
     50 #define MULT_NORM(x) (x)
     51 #define HALVE(x) ((x)*.5f)
     52 
     53 #endif
     54 
     55 
     56 typedef struct {
     57   int n;
     58   int log2n;
     59 
     60   DATA_TYPE *trig;
     61   int       *bitrev;
     62 
     63   DATA_TYPE scale;
     64 } mdct_lookup;
     65 
     66 extern void mdct_init(mdct_lookup *lookup,int n);
     67 extern void mdct_clear(mdct_lookup *l);
     68 extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
     69 extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
     70 
     71 #endif
     72