codec_internal.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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-2002 *
  9. * by the XIPHOPHORUS Company http://www.xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function: libvorbis codec headers
  13. last mod: $Id: codec_internal.h,v 1.17 2003/08/18 05:34:01 xiphmont Exp $
  14. ********************************************************************/
  15. #ifndef _V_CODECI_H_
  16. #define _V_CODECI_H_
  17. #include "envelope.h"
  18. #include "codebook.h"
  19. #define BLOCKTYPE_IMPULSE 0
  20. #define BLOCKTYPE_PADDING 1
  21. #define BLOCKTYPE_TRANSITION 0
  22. #define BLOCKTYPE_LONG 1
  23. #define PACKETBLOBS 15
  24. typedef struct vorbis_block_internal{
  25. float **pcmdelay; /* this is a pointer into local storage */
  26. float ampmax;
  27. int blocktype;
  28. ogg_uint32_t packetblob_markers[PACKETBLOBS];
  29. } vorbis_block_internal;
  30. typedef void vorbis_look_floor;
  31. typedef void vorbis_look_residue;
  32. typedef void vorbis_look_transform;
  33. /* mode ************************************************************/
  34. typedef struct {
  35. int blockflag;
  36. int windowtype;
  37. int transformtype;
  38. int mapping;
  39. } vorbis_info_mode;
  40. typedef void vorbis_info_floor;
  41. typedef void vorbis_info_residue;
  42. typedef void vorbis_info_mapping;
  43. #include "psy.h"
  44. #include "bitrate.h"
  45. typedef struct private_state {
  46. /* local lookup storage */
  47. envelope_lookup *ve; /* envelope lookup */
  48. int window[2];
  49. vorbis_look_transform **transform[2]; /* block, type */
  50. drft_lookup fft_look[2];
  51. int modebits;
  52. vorbis_look_floor **flr;
  53. vorbis_look_residue **residue;
  54. vorbis_look_psy *psy;
  55. vorbis_look_psy_global *psy_g_look;
  56. /* local storage, only used on the encoding side. This way the
  57. application does not need to worry about freeing some packets'
  58. memory and not others'; packet storage is always tracked.
  59. Cleared next call to a _dsp_ function */
  60. unsigned char *header;
  61. unsigned char *header1;
  62. unsigned char *header2;
  63. bitrate_manager_state bms;
  64. ogg_int64_t sample_count;
  65. } private_state;
  66. /* codec_setup_info contains all the setup information specific to the
  67. specific compression/decompression mode in progress (eg,
  68. psychoacoustic settings, channel setup, options, codebook
  69. etc).
  70. *********************************************************************/
  71. #include "highlevel.h"
  72. typedef struct codec_setup_info {
  73. /* Vorbis supports only short and long blocks, but allows the
  74. encoder to choose the sizes */
  75. long blocksizes[2];
  76. /* modes are the primary means of supporting on-the-fly different
  77. blocksizes, different channel mappings (LR or M/A),
  78. different residue backends, etc. Each mode consists of a
  79. blocksize flag and a mapping (along with the mapping setup */
  80. int modes;
  81. int maps;
  82. int floors;
  83. int residues;
  84. int books;
  85. int psys; /* encode only */
  86. vorbis_info_mode *mode_param[64];
  87. int map_type[64];
  88. vorbis_info_mapping *map_param[64];
  89. int floor_type[64];
  90. vorbis_info_floor *floor_param[64];
  91. int residue_type[64];
  92. vorbis_info_residue *residue_param[64];
  93. static_codebook *book_param[256];
  94. codebook *fullbooks;
  95. vorbis_info_psy *psy_param[4]; /* encode only */
  96. vorbis_info_psy_global psy_g_param;
  97. bitrate_manager_info bi;
  98. highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
  99. highly redundant structure, but
  100. improves clarity of program flow. */
  101. int halfrate_flag; /* painless downsample for decode */
  102. } codec_setup_info;
  103. extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
  104. extern void _vp_global_free(vorbis_look_psy_global *look);
  105. #endif