Initial branch merge toward rc3
[platform/upstream/libvorbis.git] / lib / codec_internal.h
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
12  function: libvorbis codec headers
13  last mod: $Id: codec_internal.h,v 1.10 2001/12/12 09:45:24 xiphmont Exp $
14
15  ********************************************************************/
16
17 #ifndef _V_CODECI_H_
18 #define _V_CODECI_H_
19
20 #include "envelope.h"
21 #include "codebook.h"
22
23 #define BLOCKTYPE_IMPULSE    0
24 #define BLOCKTYPE_PADDING    1
25 #define BLOCKTYPE_TRANSITION 0 
26 #define BLOCKTYPE_LONG       1
27
28 typedef struct vorbis_block_internal{
29   float  **pcmdelay;  /* this is a pointer into local storage */ 
30   float  ampmax;
31   int    blocktype;
32
33   ogg_uint32_t *packet_markers;
34 } vorbis_block_internal;
35
36 typedef void vorbis_look_time;
37 typedef void vorbis_look_mapping;
38 typedef void vorbis_look_floor;
39 typedef void vorbis_look_residue;
40 typedef void vorbis_look_transform;
41
42 /* mode ************************************************************/
43 typedef struct {
44   int blockflag;
45   int windowtype;
46   int transformtype;
47   int mapping;
48 } vorbis_info_mode;
49
50 typedef void vorbis_info_time;
51 typedef void vorbis_info_floor;
52 typedef void vorbis_info_residue;
53 typedef void vorbis_info_mapping;
54
55 #include "psy.h"
56 #include "bitrate.h"
57
58 typedef struct backend_lookup_state {
59   /* local lookup storage */
60   envelope_lookup        *ve; /* envelope lookup */    
61   float                 **window[2][2][2]; /* block, leadin, leadout, type */
62   vorbis_look_transform **transform[2];    /* block, type */
63   codebook               *fullbooks;
64   vorbis_look_psy_global *psy_g_look;
65
66   /* backend lookups are tied to the mode, not the backend or naked mapping */
67   int                     modebits;
68   vorbis_look_mapping   **mode;
69
70   /* local storage, only used on the encoding side.  This way the
71      application does not need to worry about freeing some packets'
72      memory and not others'; packet storage is always tracked.
73      Cleared next call to a _dsp_ function */
74   unsigned char *header;
75   unsigned char *header1;
76   unsigned char *header2;
77
78   bitrate_manager_state bms;
79
80 } backend_lookup_state;
81
82 /* vorbis_info contains all the setup information specific to the
83    specific compression/decompression mode in progress (eg,
84    psychoacoustic settings, channel setup, options, codebook
85    etc).  
86 *********************************************************************/
87
88 typedef struct codec_setup_info {
89
90   /* Vorbis supports only short and long blocks, but allows the
91      encoder to choose the sizes */
92
93   long blocksizes[2];
94
95   /* modes are the primary means of supporting on-the-fly different
96      blocksizes, different channel mappings (LR or M/A),
97      different residue backends, etc.  Each mode consists of a
98      blocksize flag and a mapping (along with the mapping setup */
99
100   int        modes;
101   int        maps;
102   int        times;
103   int        floors;
104   int        residues;
105   int        books;
106   int        psys;     /* encode only */
107
108   vorbis_info_mode       *mode_param[64];
109   int                     map_type[64];
110   vorbis_info_mapping    *map_param[64];
111   int                     time_type[64];
112   vorbis_info_time       *time_param[64];
113   int                     floor_type[64];
114   vorbis_info_floor      *floor_param[64];
115   int                     residue_type[64];
116   vorbis_info_residue    *residue_param[64];
117   static_codebook        *book_param[256];
118
119   vorbis_info_psy        *psy_param[64]; /* encode only */
120   vorbis_info_psy_global psy_g_param;
121   bitrate_manager_info   bi;
122
123   int    passlimit[32];     /* iteration limit per couple/quant pass */
124   int    coupling_passes;
125 } codec_setup_info;
126
127 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
128 extern void _vp_global_free(vorbis_look_psy_global *look);
129
130 #endif