codec_internal.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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-2009 *
  9. * by the Xiph.Org Foundation https://xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function: libvorbis codec headers
  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. #define PACKETBLOBS 15
  23. typedef struct vorbis_block_internal{
  24. float **pcmdelay; /* this is a pointer into local storage */
  25. float ampmax;
  26. int blocktype;
  27. oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
  28. blob [PACKETBLOBS/2] points to
  29. the oggpack_buffer in the
  30. main vorbis_block */
  31. } vorbis_block_internal;
  32. typedef void vorbis_look_floor;
  33. typedef void vorbis_look_residue;
  34. typedef void vorbis_look_transform;
  35. /* mode ************************************************************/
  36. typedef struct {
  37. int blockflag;
  38. int windowtype;
  39. int transformtype;
  40. int mapping;
  41. } vorbis_info_mode;
  42. typedef void vorbis_info_floor;
  43. typedef void vorbis_info_residue;
  44. typedef void vorbis_info_mapping;
  45. #include "psy.h"
  46. #include "bitrate.h"
  47. typedef struct private_state {
  48. /* local lookup storage */
  49. envelope_lookup *ve; /* envelope lookup */
  50. int window[2];
  51. vorbis_look_transform **transform[2]; /* block, type */
  52. drft_lookup fft_look[2];
  53. int modebits;
  54. vorbis_look_floor **flr;
  55. vorbis_look_residue **residue;
  56. vorbis_look_psy *psy;
  57. vorbis_look_psy_global *psy_g_look;
  58. /* local storage, only used on the encoding side. This way the
  59. application does not need to worry about freeing some packets'
  60. memory and not others'; packet storage is always tracked.
  61. Cleared next call to a _dsp_ function */
  62. unsigned char *header;
  63. unsigned char *header1;
  64. unsigned char *header2;
  65. bitrate_manager_state bms;
  66. ogg_int64_t sample_count;
  67. } private_state;
  68. /* codec_setup_info contains all the setup information specific to the
  69. specific compression/decompression mode in progress (eg,
  70. psychoacoustic settings, channel setup, options, codebook
  71. etc).
  72. *********************************************************************/
  73. #include "highlevel.h"
  74. typedef struct codec_setup_info {
  75. /* Vorbis supports only short and long blocks, but allows the
  76. encoder to choose the sizes */
  77. long blocksizes[2];
  78. /* modes are the primary means of supporting on-the-fly different
  79. blocksizes, different channel mappings (LR or M/A),
  80. different residue backends, etc. Each mode consists of a
  81. blocksize flag and a mapping (along with the mapping setup */
  82. int modes;
  83. int maps;
  84. int floors;
  85. int residues;
  86. int books;
  87. int psys; /* encode only */
  88. vorbis_info_mode *mode_param[64];
  89. int map_type[64];
  90. vorbis_info_mapping *map_param[64];
  91. int floor_type[64];
  92. vorbis_info_floor *floor_param[64];
  93. int residue_type[64];
  94. vorbis_info_residue *residue_param[64];
  95. static_codebook *book_param[256];
  96. codebook *fullbooks;
  97. vorbis_info_psy *psy_param[4]; /* encode only */
  98. vorbis_info_psy_global psy_g_param;
  99. bitrate_manager_info bi;
  100. highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
  101. highly redundant structure, but
  102. improves clarity of program flow. */
  103. int halfrate_flag; /* painless downsample for decode */
  104. } codec_setup_info;
  105. extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
  106. extern void _vp_global_free(vorbis_look_psy_global *look);
  107. typedef struct {
  108. int sorted_index[VIF_POSIT+2];
  109. int forward_index[VIF_POSIT+2];
  110. int reverse_index[VIF_POSIT+2];
  111. int hineighbor[VIF_POSIT];
  112. int loneighbor[VIF_POSIT];
  113. int posts;
  114. int n;
  115. int quant_q;
  116. vorbis_info_floor1 *vi;
  117. long phrasebits;
  118. long postbits;
  119. long frames;
  120. } vorbis_look_floor1;
  121. extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
  122. const float *logmdct, /* in */
  123. const float *logmask);
  124. extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
  125. int *A,int *B,
  126. int del);
  127. extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
  128. vorbis_look_floor1 *look,
  129. int *post,int *ilogmask);
  130. #endif