mdct.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. function: modified discrete cosine transform prototypes
  13. last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
  14. ********************************************************************/
  15. #ifndef _OGG_mdct_H_
  16. #define _OGG_mdct_H_
  17. #include "vorbis/codec.h"
  18. /*#define MDCT_INTEGERIZED <- be warned there could be some hurt left here*/
  19. #ifdef MDCT_INTEGERIZED
  20. #define DATA_TYPE int
  21. #define REG_TYPE register int
  22. #define TRIGBITS 14
  23. #define cPI3_8 6270
  24. #define cPI2_8 11585
  25. #define cPI1_8 15137
  26. #define FLOAT_CONV(x) ((int)((x)*(1<<TRIGBITS)+.5))
  27. #define MULT_NORM(x) ((x)>>TRIGBITS)
  28. #define HALVE(x) ((x)>>1)
  29. #else
  30. #define DATA_TYPE float
  31. #define REG_TYPE float
  32. #define cPI3_8 .38268343236508977175F
  33. #define cPI2_8 .70710678118654752441F
  34. #define cPI1_8 .92387953251128675613F
  35. #define FLOAT_CONV(x) (x)
  36. #define MULT_NORM(x) (x)
  37. #define HALVE(x) ((x)*.5f)
  38. #endif
  39. typedef struct {
  40. int n;
  41. int log2n;
  42. DATA_TYPE *trig;
  43. int *bitrev;
  44. DATA_TYPE scale;
  45. } mdct_lookup;
  46. extern void mdct_init(mdct_lookup *lookup,int n);
  47. extern void mdct_clear(mdct_lookup *l);
  48. extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
  49. extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
  50. #endif