Initial beta 4 merge
[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 SOURCE IS GOVERNED BY *
5  * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
6  * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
7  *                                                                  *
8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
9  * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
10  * http://www.xiph.org/                                             *
11  *                                                                  *
12  ********************************************************************
13
14  function: libvorbis codec headers
15  last mod: $Id: codec_internal.h,v 1.4 2001/01/22 01:38:24 xiphmont Exp $
16
17  ********************************************************************/
18
19 #ifndef _V_CODECI_H_
20 #define _V_CODECI_H_
21
22 #include "envelope.h"
23 #include "codebook.h"
24 #include "psy.h"
25 #include "bitbuffer.h"
26
27 typedef struct vorbis_block_internal{
28   float  **pcmdelay;  /* this is a pointer into local storage */ 
29   float  ampmax;
30 } vorbis_block_internal;
31
32 typedef void vorbis_look_time;
33 typedef void vorbis_look_mapping;
34 typedef void vorbis_look_floor;
35 typedef void vorbis_look_residue;
36 typedef void vorbis_look_transform;
37
38 typedef struct backend_lookup_state {
39   /* local lookup storage */
40   envelope_lookup        *ve; /* envelope lookup */    
41   float                 **window[2][2][2]; /* block, leadin, leadout, type */
42   vorbis_look_transform **transform[2];    /* block, type */
43   codebook               *fullbooks;
44
45   /* backend lookups are tied to the mode, not the backend or naked mapping */
46   int                     modebits;
47   vorbis_look_mapping   **mode;
48
49   /* local storage, only used on the encoding side.  This way the
50      application does not need to worry about freeing some packets'
51      memory and not others'; packet storage is always tracked.
52      Cleared next call to a _dsp_ function */
53   unsigned char *header;
54   unsigned char *header1;
55   unsigned char *header2;
56
57   float ampmax;
58
59 } backend_lookup_state;
60
61 /* mode ************************************************************/
62 typedef struct {
63   int blockflag;
64   int windowtype;
65   int transformtype;
66   int mapping;
67 } vorbis_info_mode;
68
69 typedef void vorbis_info_time;
70 typedef void vorbis_info_floor;
71 typedef void vorbis_info_residue;
72 typedef void vorbis_info_mapping;
73
74 /* vorbis_info contains all the setup information specific to the
75    specific compression/decompression mode in progress (eg,
76    psychoacoustic settings, channel setup, options, codebook
77    etc).  
78 *********************************************************************/
79
80 typedef struct codec_setup_info {
81
82   /* Vorbis supports only short and long blocks, but allows the
83      encoder to choose the sizes */
84
85   long blocksizes[2];
86
87   /* modes are the primary means of supporting on-the-fly different
88      blocksizes, different channel mappings (LR or mid-side),
89      different residue backends, etc.  Each mode consists of a
90      blocksize flag and a mapping (along with the mapping setup */
91
92   int        modes;
93   int        maps;
94   int        times;
95   int        floors;
96   int        residues;
97   int        books;
98   int        psys;     /* encode only */
99
100   vorbis_info_mode    *mode_param[64];
101   int                  map_type[64];
102   vorbis_info_mapping *map_param[64];
103   int                  time_type[64];
104   vorbis_info_time    *time_param[64];
105   int                  floor_type[64];
106   vorbis_info_floor   *floor_param[64];
107   int                  residue_type[64];
108   vorbis_info_residue *residue_param[64];
109   static_codebook     *book_param[256];
110   vorbis_info_psy     *psy_param[64]; /* encode only */
111   
112   /* for block long/sort tuning; encode only */
113   int       envelopesa;
114   float     preecho_thresh;
115   float     postecho_thresh;
116   float     preecho_minenergy;
117
118   float     ampmax_att_per_sec;
119
120   /* delay caching... how many samples to keep around prior to our
121      current block to aid in analysis? */
122   int       delaycache;
123
124 } codec_setup_info;
125
126 #endif