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