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
31 typedef struct vorbis_block_internal{
32 float **pcmdelay; /* this is a pointer into local storage */
36 oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
37 blob [PACKETBLOBS/2] points to
38 the oggpack_buffer in the
40 } vorbis_block_internal;
42 typedef void vorbis_look_floor;
43 typedef void vorbis_look_residue;
44 typedef void vorbis_look_transform;
46 /* mode ************************************************************/
54 typedef void vorbis_info_floor;
55 typedef void vorbis_info_residue;
56 typedef void vorbis_info_mapping;
61 typedef struct private_state {
62 /* local lookup storage */
63 envelope_lookup *ve; /* envelope lookup */
65 vorbis_look_transform **transform[2]; /* block, type */
66 drft_lookup fft_look[2];
69 vorbis_look_floor **flr;
70 vorbis_look_residue **residue;
72 vorbis_look_psy_global *psy_g_look;
74 /* local storage, only used on the encoding side. This way the
75 application does not need to worry about freeing some packets'
76 memory and not others'; packet storage is always tracked.
77 Cleared next call to a _dsp_ function */
78 unsigned char *header;
79 unsigned char *header1;
80 unsigned char *header2;
82 bitrate_manager_state bms;
84 ogg_int64_t sample_count;
87 /* codec_setup_info contains all the setup information specific to the
88 specific compression/decompression mode in progress (eg,
89 psychoacoustic settings, channel setup, options, codebook
91 *********************************************************************/
93 #include "highlevel.h"
94 typedef struct codec_setup_info {
96 /* Vorbis supports only short and long blocks, but allows the
97 encoder to choose the sizes */
101 /* modes are the primary means of supporting on-the-fly different
102 blocksizes, different channel mappings (LR or M/A),
103 different residue backends, etc. Each mode consists of a
104 blocksize flag and a mapping (along with the mapping setup */
111 int psys; /* encode only */
113 vorbis_info_mode *mode_param[64];
115 vorbis_info_mapping *map_param[64];
117 vorbis_info_floor *floor_param[64];
118 int residue_type[64];
119 vorbis_info_residue *residue_param[64];
120 static_codebook *book_param[256];
123 vorbis_info_psy *psy_param[4]; /* encode only */
124 vorbis_info_psy_global psy_g_param;
126 bitrate_manager_info bi;
127 highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
128 highly redundant structure, but
129 improves clarity of program flow. */
130 int halfrate_flag; /* painless downsample for decode */
133 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
134 extern void _vp_global_free(vorbis_look_psy_global *look);
139 int sorted_index[VIF_POSIT+2];
140 int forward_index[VIF_POSIT+2];
141 int reverse_index[VIF_POSIT+2];
143 int hineighbor[VIF_POSIT];
144 int loneighbor[VIF_POSIT];
149 vorbis_info_floor1 *vi;
154 } vorbis_look_floor1;
158 extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
159 const float *logmdct, /* in */
160 const float *logmask);
161 extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
164 extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
165 vorbis_look_floor1 *look,
166 int *post,int *ilogmask);