fquant.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright (c) 1998-99 Relic Entertainment Inc.
  2. // Written by Janik Joire
  3. //
  4. // $History: $
  5. //
  6. // Version 1.6a
  7. #ifndef FQUANT_H
  8. #define FQUANT_H
  9. // General constants
  10. #define FQ_LEN 260 // Block length (bytes)
  11. #define FQ_SCALE 10.0F // Quantization scale
  12. #define FQ_EXP 6 // # of exponents
  13. #define FQ_FMASK 1.0F // Frequency masking factor
  14. #define FQ_TPMASK 2.0F // Primary time masking factor
  15. #define FQ_TSMASK 4.0F // Secondary time masking factor
  16. #define FQ_THRES aTBlock // Hearing thresholds
  17. #define FQ_STAT pSStream // Statistics stream
  18. // Scale constants
  19. #define FQ_SDATA aSDBlock // Scale data
  20. // Encoder flags
  21. #define FQ_ENORM 0x0000 // Normal
  22. #define FQ_ERESET 0x0001 // Reset exponents
  23. #define FQ_EMIX 0x0002 // Mix primary and secondary blocks
  24. // Quantization limits (# of bits)
  25. #define FQ_NBMAX 6 // Maximum
  26. #define FQ_NBMIN 1 // Minimum
  27. // Compression bitrates (per block)
  28. // Name Bits/block Kbps/channel
  29. #define FQ_BR176 2048 // 176
  30. #define FQ_BR88 1024 // 88
  31. #define FQ_BR44 512 // 44
  32. #define FQ_BR22 256 // 22
  33. // Critical band constants
  34. #define FQ_CBDATA aCBBlock // Critical band data
  35. #define FQ_CBNUM 27 // # of critical bands
  36. // Sub-band constants
  37. #define FQ_SBMODE 22 // # of modes
  38. #define FQ_SBSIZE aSBSBlock // Sub-band sizes
  39. #define FQ_SBDATA aSBDBlock // Sub-band data
  40. #define FQ_SBNUM 256 // # of sub-bands
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. // Functions
  45. int fqInitQuant(FILE *pStream);
  46. int fqQuantBlock(char *aQBlock,float *aFPBlock,float *aFSBlock,float *aFMBlock,unsigned char *aEBlock,
  47. unsigned long nLen,unsigned long nRate,unsigned long nSize,int nFlags);
  48. int fqInitDequant(void);
  49. int fqDequantBlock(char *aQBlock,float *aFPBlock,float *aFSBlock,unsigned char *aEBlock,
  50. unsigned long nLen,unsigned long nRate,unsigned long nSize);
  51. int fqSPack(short nVal,unsigned long nLen,unsigned long nPos,char *aBlock);
  52. _inline long fqSUnpack(unsigned long nLen,unsigned long nPos,char *aBlock);
  53. _inline unsigned long fqUnpack(unsigned long nLen,unsigned long nPos,char *aBlock);
  54. int linint(float *xa,float *ya,unsigned long n,float x,float *y);
  55. #ifdef __cplusplus
  56. } // extern "C"
  57. #endif
  58. #endif // FQUANT_H