1 /********************************************************************
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. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 * by the Xiph.Org Foundation https://xiph.org/ *
11 ********************************************************************
13 function: libvorbis codec headers
15 ********************************************************************/
23 #define BLOCKTYPE_IMPULSE 0
24 #define BLOCKTYPE_PADDING 1
25 #define BLOCKTYPE_TRANSITION 0
26 #define BLOCKTYPE_LONG 1
28 #define PACKETBLOBS 15
30 typedef struct vorbis_block_internal{
31 float **pcmdelay; /* this is a pointer into local storage */
35 oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
36 blob [PACKETBLOBS/2] points to
37 the oggpack_buffer in the
39 } vorbis_block_internal;
41 typedef void vorbis_look_floor;
42 typedef void vorbis_look_residue;
43 typedef void vorbis_look_transform;
45 /* mode ************************************************************/
53 typedef void vorbis_info_floor;
54 typedef void vorbis_info_residue;
55 typedef void vorbis_info_mapping;
60 typedef struct private_state {
61 /* local lookup storage */
62 envelope_lookup *ve; /* envelope lookup */
64 vorbis_look_transform **transform[2]; /* block, type */
65 drft_lookup fft_look[2];
68 vorbis_look_floor **flr;
69 vorbis_look_residue **residue;
71 vorbis_look_psy_global *psy_g_look;
73 /* local storage, only used on the encoding side. This way the
74 application does not need to worry about freeing some packets'
75 memory and not others'; packet storage is always tracked.
76 Cleared next call to a _dsp_ function */
77 unsigned char *header;
78 unsigned char *header1;
79 unsigned char *header2;
81 bitrate_manager_state bms;
83 ogg_int64_t sample_count;
86 /* codec_setup_info contains all the setup information specific to the
87 specific compression/decompression mode in progress (eg,
88 psychoacoustic settings, channel setup, options, codebook
90 *********************************************************************/
92 #include "highlevel.h"
93 typedef struct codec_setup_info {
95 /* Vorbis supports only short and long blocks, but allows the
96 encoder to choose the sizes */
100 /* modes are the primary means of supporting on-the-fly different
101 blocksizes, different channel mappings (LR or M/A),
102 different residue backends, etc. Each mode consists of a
103 blocksize flag and a mapping (along with the mapping setup */
110 int psys; /* encode only */
112 vorbis_info_mode *mode_param[64];
114 vorbis_info_mapping *map_param[64];
116 vorbis_info_floor *floor_param[64];
117 int residue_type[64];
118 vorbis_info_residue *residue_param[64];
119 static_codebook *book_param[256];
122 vorbis_info_psy *psy_param[4]; /* encode only */
123 vorbis_info_psy_global psy_g_param;
125 bitrate_manager_info bi;
126 highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
127 highly redundant structure, but
128 improves clarity of program flow. */
129 int halfrate_flag; /* painless downsample for decode */
132 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
133 extern void _vp_global_free(vorbis_look_psy_global *look);
138 int sorted_index[VIF_POSIT+2];
139 int forward_index[VIF_POSIT+2];
140 int reverse_index[VIF_POSIT+2];
142 int hineighbor[VIF_POSIT];
143 int loneighbor[VIF_POSIT];
148 vorbis_info_floor1 *vi;
153 } vorbis_look_floor1;
157 extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
158 const float *logmdct, /* in */
159 const float *logmask);
160 extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
163 extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
164 vorbis_look_floor1 *look,
165 int *post,int *ilogmask);