/media/libtremor/lib/backends.h

http://github.com/zpao/v8monkey · C Header · 131 lines · 73 code · 29 blank · 29 comment · 0 complexity · 04345c1e38d4bd07faf96f4a37729ccb MD5 · raw file

  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
  4. * *
  5. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
  6. * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  7. * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  8. * *
  9. * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
  10. * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
  11. * *
  12. ********************************************************************
  13. function: backend and mapping structures
  14. ********************************************************************/
  15. /* this is exposed up here because we need it for static modes.
  16. Lookups for each backend aren't exposed because there's no reason
  17. to do so */
  18. #ifndef _vorbis_backend_h_
  19. #define _vorbis_backend_h_
  20. #include "codec_internal.h"
  21. /* this would all be simpler/shorter with templates, but.... */
  22. /* Transform backend generic *************************************/
  23. /* only mdct right now. Flesh it out more if we ever transcend mdct
  24. in the transform domain */
  25. /* Floor backend generic *****************************************/
  26. typedef struct{
  27. vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
  28. vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  29. vorbis_info_floor *);
  30. void (*free_info) (vorbis_info_floor *);
  31. void (*free_look) (vorbis_look_floor *);
  32. void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
  33. int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
  34. void *buffer,ogg_int32_t *);
  35. } vorbis_func_floor;
  36. typedef struct{
  37. int order;
  38. long rate;
  39. long barkmap;
  40. int ampbits;
  41. int ampdB;
  42. int numbooks; /* <= 16 */
  43. int books[16];
  44. } vorbis_info_floor0;
  45. #define VIF_POSIT 63
  46. #define VIF_CLASS 16
  47. #define VIF_PARTS 31
  48. typedef struct{
  49. int partitions; /* 0 to 31 */
  50. int partitionclass[VIF_PARTS]; /* 0 to 15 */
  51. int class_dim[VIF_CLASS]; /* 1 to 8 */
  52. int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
  53. int class_book[VIF_CLASS]; /* subs ^ dim entries */
  54. int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
  55. int mult; /* 1 2 3 or 4 */
  56. int postlist[VIF_POSIT+2]; /* first two implicit */
  57. } vorbis_info_floor1;
  58. /* Residue backend generic *****************************************/
  59. typedef struct{
  60. vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
  61. vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  62. vorbis_info_residue *);
  63. void (*free_info) (vorbis_info_residue *);
  64. void (*free_look) (vorbis_look_residue *);
  65. int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
  66. ogg_int32_t **,int *,int);
  67. } vorbis_func_residue;
  68. typedef struct vorbis_info_residue0{
  69. /* block-partitioned VQ coded straight residue */
  70. long begin;
  71. long end;
  72. /* first stage (lossless partitioning) */
  73. int grouping; /* group n vectors per partition */
  74. int partitions; /* possible codebooks for a partition */
  75. int partvals; /* partitions ^ groupbook dim */
  76. int groupbook; /* huffbook for partitioning */
  77. int secondstages[64]; /* expanded out to pointers in lookup */
  78. int booklist[512]; /* list of second stage books */
  79. } vorbis_info_residue0;
  80. /* Mapping backend generic *****************************************/
  81. typedef struct{
  82. vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
  83. vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  84. vorbis_info_mapping *);
  85. void (*free_info) (vorbis_info_mapping *);
  86. void (*free_look) (vorbis_look_mapping *);
  87. int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
  88. } vorbis_func_mapping;
  89. typedef struct vorbis_info_mapping0{
  90. int submaps; /* <= 16 */
  91. int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
  92. int floorsubmap[16]; /* [mux] submap to floors */
  93. int residuesubmap[16]; /* [mux] submap to residue */
  94. int psy[2]; /* by blocktype; impulse/padding for short,
  95. transition/normal for long */
  96. int coupling_steps;
  97. int coupling_mag[256];
  98. int coupling_ang[256];
  99. } vorbis_info_mapping0;
  100. #endif