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 http://www.xiph.org/ *
11 ********************************************************************
13 function: libvorbis codec headers
14 last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
16 ********************************************************************/
24 #define BLOCKTYPE_IMPULSE 0
25 #define BLOCKTYPE_PADDING 1
26 #define BLOCKTYPE_TRANSITION 0
27 #define BLOCKTYPE_LONG 1
29 #define PACKETBLOBS 15
32 typedef struct vorbis_block_internal{
33 float **pcmdelay; /* this is a pointer into local storage */
37 oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
38 blob [PACKETBLOBS/2] points to
39 the oggpack_buffer in the
41 } vorbis_block_internal;
43 typedef void vorbis_look_floor;
44 typedef void vorbis_look_residue;
45 typedef void vorbis_look_transform;
47 /* mode ************************************************************/
55 typedef void vorbis_info_floor;
56 typedef void vorbis_info_residue;
57 typedef void vorbis_info_mapping;
62 typedef struct private_state {
63 /* local lookup storage */
64 envelope_lookup *ve; /* envelope lookup */
66 vorbis_look_transform **transform[2]; /* block, type */
67 drft_lookup fft_look[2];
70 vorbis_look_floor **flr;
71 vorbis_look_residue **residue;
73 vorbis_look_psy_global *psy_g_look;
75 /* local storage, only used on the encoding side. This way the
76 application does not need to worry about freeing some packets'
77 memory and not others'; packet storage is always tracked.
78 Cleared next call to a _dsp_ function */
79 unsigned char *header;
80 unsigned char *header1;
81 unsigned char *header2;
83 bitrate_manager_state bms;
85 ogg_int64_t sample_count;
88 /* codec_setup_info contains all the setup information specific to the
89 specific compression/decompression mode in progress (eg,
90 psychoacoustic settings, channel setup, options, codebook
92 *********************************************************************/
94 #include "highlevel.h"
95 typedef struct codec_setup_info {
97 /* Vorbis supports only short and long blocks, but allows the
98 encoder to choose the sizes */
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 */
112 int psys; /* encode only */
114 vorbis_info_mode *mode_param[64];
116 vorbis_info_mapping *map_param[64];
118 vorbis_info_floor *floor_param[64];
119 int residue_type[64];
120 vorbis_info_residue *residue_param[64];
121 static_codebook *book_param[256];
124 vorbis_info_psy *psy_param[4]; /* encode only */
125 vorbis_info_psy_global psy_g_param;
127 bitrate_manager_info bi;
128 highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
129 highly redundant structure, but
130 improves clarity of program flow. */
131 int halfrate_flag; /* painless downsample for decode */
134 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
135 extern void _vp_global_free(vorbis_look_psy_global *look);
140 int sorted_index[VIF_POSIT+2];
141 int forward_index[VIF_POSIT+2];
142 int reverse_index[VIF_POSIT+2];
144 int hineighbor[VIF_POSIT];
145 int loneighbor[VIF_POSIT];
150 vorbis_info_floor1 *vi;
155 } vorbis_look_floor1;
159 extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
160 const float *logmdct, /* in */
161 const float *logmask);
162 extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
165 extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
166 vorbis_look_floor1 *look,
167 int *post,int *ilogmask);