codec_internal.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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-2001 *
  9. * by the XIPHOPHORUS Company http://www.xiph.org/ *
  10. ********************************************************************
  11. function: libvorbis codec headers
  12. last mod: $Id: codec_internal.h,v 1.10.2.1 2001/12/17 05:39:23 xiphmont Exp $
  13. ********************************************************************/
  14. #ifndef _V_CODECI_H_
  15. #define _V_CODECI_H_
  16. #include "envelope.h"
  17. #include "codebook.h"
  18. #define BLOCKTYPE_IMPULSE 0
  19. #define BLOCKTYPE_PADDING 1
  20. #define BLOCKTYPE_TRANSITION 0
  21. #define BLOCKTYPE_LONG 1
  22. typedef struct vorbis_block_internal{
  23. float **pcmdelay; /* this is a pointer into local storage */
  24. float ampmax;
  25. int blocktype;
  26. ogg_uint32_t *packet_markers;
  27. } vorbis_block_internal;
  28. typedef void vorbis_look_time;
  29. typedef void vorbis_look_mapping;
  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_time;
  41. typedef void vorbis_info_floor;
  42. typedef void vorbis_info_residue;
  43. typedef void vorbis_info_mapping;
  44. #include "psy.h"
  45. #include "bitrate.h"
  46. typedef struct backend_lookup_state {
  47. /* local lookup storage */
  48. envelope_lookup *ve; /* envelope lookup */
  49. float **window[2][2][2]; /* block, leadin, leadout, type */
  50. vorbis_look_transform **transform[2]; /* block, type */
  51. codebook *fullbooks;
  52. vorbis_look_psy_global *psy_g_look;
  53. /* backend lookups are tied to the mode, not the backend or naked mapping */
  54. int modebits;
  55. vorbis_look_mapping **mode;
  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. } backend_lookup_state;
  65. /* high level configuration information for setting things up
  66. step-by-step with the detaile vorbis_encode_ctl interface */
  67. typedef struct highlevel_block {
  68. double tone_mask_quality;
  69. double tone_peaklimit_quality;
  70. double noise_bias_quality;
  71. double noise_compand_quality;
  72. double ath_quality;
  73. } highlevel_block;
  74. typedef struct highlevel_encode_setup {
  75. double base_quality; /* these have to be tracked by the ctl */
  76. double base_quality_short; /* interface so that the right books get */
  77. double base_quality_long; /* chosen... */
  78. int short_block_p;
  79. int long_block_p;
  80. int impulse_block_p;
  81. int stereo_couple_p;
  82. int stereo_backfill_p;
  83. int residue_backfill_p;
  84. int stereo_point_dB;
  85. double stereo_point_kHz[2];
  86. double lowpass_kHz[2];
  87. double ath_floating_dB;
  88. double ath_absolute_dB;
  89. double amplitude_track_dBpersec;
  90. double trigger_quality;
  91. highlevel_block blocktype[4]; /* impulse, padding, trans, long */
  92. } highlevel_encode_setup;
  93. /* codec_setup_info contains all the setup information specific to the
  94. specific compression/decompression mode in progress (eg,
  95. psychoacoustic settings, channel setup, options, codebook
  96. etc).
  97. *********************************************************************/
  98. typedef struct codec_setup_info {
  99. /* Vorbis supports only short and long blocks, but allows the
  100. encoder to choose the sizes */
  101. long blocksizes[2];
  102. /* modes are the primary means of supporting on-the-fly different
  103. blocksizes, different channel mappings (LR or M/A),
  104. different residue backends, etc. Each mode consists of a
  105. blocksize flag and a mapping (along with the mapping setup */
  106. int modes;
  107. int maps;
  108. int times;
  109. int floors;
  110. int residues;
  111. int books;
  112. int psys; /* encode only */
  113. vorbis_info_mode *mode_param[64];
  114. int map_type[64];
  115. vorbis_info_mapping *map_param[64];
  116. int time_type[64];
  117. vorbis_info_time *time_param[64];
  118. int floor_type[64];
  119. vorbis_info_floor *floor_param[64];
  120. int residue_type[64];
  121. vorbis_info_residue *residue_param[64];
  122. static_codebook *book_param[256];
  123. vorbis_info_psy *psy_param[64]; /* encode only */
  124. vorbis_info_psy_global psy_g_param;
  125. bitrate_manager_info bi;
  126. highlevel_encode_setup hi;
  127. int passlimit[32]; /* iteration limit per couple/quant pass */
  128. int coupling_passes;
  129. } codec_setup_info;
  130. extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
  131. extern void _vp_global_free(vorbis_look_psy_global *look);
  132. #endif