backends.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
  5. * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH *
  6. * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  7. * *
  8. * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
  9. * by Monty <monty@xiph.org> and the XIPHOPHORUS Company *
  10. * http://www.xiph.org/ *
  11. * *
  12. ********************************************************************
  13. function: libvorbis backend and mapping structures; needed for
  14. static mode headers
  15. last mod: $Id: backends.h,v 1.1.2.3 2000/11/04 07:13:07 xiphmont Exp $
  16. ********************************************************************/
  17. /* this is exposed up here because we need it for static modes.
  18. Lookups for each backend aren't exposed because there's no reason
  19. to do so */
  20. #ifndef _vorbis_backend_h_
  21. #define _vorbis_backend_h_
  22. #include "codec_internal.h"
  23. /* this would all be simpler/shorter with templates, but.... */
  24. /* Transform backend generic *************************************/
  25. /* only mdct right now. Flesh it out more if we ever transcend mdct
  26. in the transform domain */
  27. /* Time backend generic ******************************************/
  28. typedef struct{
  29. void (*pack) (vorbis_info_time *,oggpack_buffer *);
  30. vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
  31. vorbis_look_time *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  32. vorbis_info_time *);
  33. vorbis_info_time *(*copy_info)(vorbis_info_time *);
  34. void (*free_info) (vorbis_info_time *);
  35. void (*free_look) (vorbis_look_time *);
  36. int (*forward) (struct vorbis_block *,vorbis_look_time *,
  37. float *,float *);
  38. int (*inverse) (struct vorbis_block *,vorbis_look_time *,
  39. float *,float *);
  40. } vorbis_func_time;
  41. typedef struct{
  42. int dummy;
  43. } vorbis_info_time0;
  44. /* Floor backend generic *****************************************/
  45. typedef struct{
  46. void (*pack) (vorbis_info_floor *,oggpack_buffer *);
  47. vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
  48. vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  49. vorbis_info_floor *);
  50. vorbis_info_floor *(*copy_info)(vorbis_info_floor *);
  51. void (*free_info) (vorbis_info_floor *);
  52. void (*free_look) (vorbis_look_floor *);
  53. int (*forward) (struct vorbis_block *,vorbis_look_floor *,
  54. float *,float *);
  55. int (*inverse) (struct vorbis_block *,vorbis_look_floor *,
  56. float *);
  57. } vorbis_func_floor;
  58. typedef struct{
  59. int order;
  60. long rate;
  61. long barkmap;
  62. int ampbits;
  63. int ampdB;
  64. int numbooks; /* <= 16 */
  65. int books[16];
  66. } vorbis_info_floor0;
  67. /* Residue backend generic *****************************************/
  68. typedef struct{
  69. void (*pack) (vorbis_info_residue *,oggpack_buffer *);
  70. vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
  71. vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  72. vorbis_info_residue *);
  73. vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
  74. void (*free_info) (vorbis_info_residue *);
  75. void (*free_look) (vorbis_look_residue *);
  76. int (*forward) (struct vorbis_block *,vorbis_look_residue *,
  77. float **,int);
  78. int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
  79. float **,int);
  80. } vorbis_func_residue;
  81. typedef struct vorbis_info_residue0{
  82. /* block-partitioned VQ coded straight residue */
  83. long begin;
  84. long end;
  85. /* first stage (lossless partitioning) */
  86. int grouping; /* group n vectors per partition */
  87. int partitions; /* possible codebooks for a partition */
  88. int groupbook; /* huffbook for partitioning */
  89. int secondstages[64]; /* expanded out to pointers in lookup */
  90. int booklist[256]; /* list of second stage books */
  91. /* encode-only heuristic settings */
  92. float entmax[64]; /* book entropy threshholds*/
  93. float ampmax[64]; /* book amp threshholds*/
  94. int subgrp[64]; /* book heuristic subgroup size */
  95. int blimit[64]; /* subgroup position limits */
  96. } vorbis_info_residue0;
  97. /* Mapping backend generic *****************************************/
  98. typedef struct{
  99. void (*pack) (vorbis_info *,vorbis_info_mapping *,
  100. oggpack_buffer *);
  101. vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
  102. vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
  103. vorbis_info_mapping *);
  104. vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
  105. void (*free_info) (vorbis_info_mapping *);
  106. void (*free_look) (vorbis_look_mapping *);
  107. int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *);
  108. int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
  109. } vorbis_func_mapping;
  110. typedef struct vorbis_info_mapping0{
  111. int submaps; /* <= 16 */
  112. int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
  113. int timesubmap[16]; /* [mux] */
  114. int floorsubmap[16]; /* [mux] submap to floors */
  115. int residuesubmap[16]; /* [mux] submap to residue */
  116. int psysubmap[16]; /* [mux]; encode only */
  117. } vorbis_info_mapping0;
  118. #endif