Merge infrastructure work; full books
[platform/upstream/libvorbis.git] / lib / mdct.h
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-2001             *
9  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
10
11  ********************************************************************
12
13  function: modified discrete cosine transform prototypes
14  last mod: $Id: mdct.h,v 1.18 2001/02/26 03:50:42 xiphmont Exp $
15
16  ********************************************************************/
17
18 #ifndef _OGG_mdct_H_
19 #define _OGG_mdct_H_
20
21 #include "vorbis/codec.h"
22
23 /*#define MDCT_INTEGERIZED  <- be warned there could be some hurt left here*/
24 #ifdef MDCT_INTEGERIZED
25
26 #define DATA_TYPE int
27 #define REG_TYPE  register int
28 #define TRIGBITS 14
29 #define cPI3_8 6270
30 #define cPI2_8 11585
31 #define cPI1_8 15137
32
33 #define FLOAT_CONV(x) ((int)((x)*(1<<TRIGBITS)+.5))
34 #define MULT_NORM(x) ((x)>>TRIGBITS)
35 #define HALVE(x) ((x)>>1)
36
37 #else
38
39 #define DATA_TYPE float
40 #define REG_TYPE  float
41 #define cPI3_8 .38268343236508977175F
42 #define cPI2_8 .70710678118654752441F
43 #define cPI1_8 .92387953251128675613F
44
45 #define FLOAT_CONV(x) (x)
46 #define MULT_NORM(x) (x)
47 #define HALVE(x) ((x)*.5f)
48
49 #endif
50
51
52 typedef struct {
53   int n;
54   int log2n;
55   
56   DATA_TYPE *trig;
57   int       *bitrev;
58
59   DATA_TYPE scale;
60 } mdct_lookup;
61
62 extern void mdct_init(mdct_lookup *lookup,int n);
63 extern void mdct_clear(mdct_lookup *l);
64 extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
65 extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
66
67 #endif
68
69
70
71
72
73
74
75
76
77
78
79