Bringing rc2 (minus the modes it needs) onto mainline.
[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.9 2001/08/13 01:36:56 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 typedef struct vorbis_block_internal{
24   float  **pcmdelay;  /* this is a pointer into local storage */ 
25   float  ampmax;
26 } vorbis_block_internal;
27
28 typedef void vorbis_look_time;
29 typedef void vorbis_look_mapping;
30 typedef void vorbis_look_floor;
31 typedef void vorbis_look_residue;
32 typedef void vorbis_look_transform;
33
34 /* mode ************************************************************/
35 typedef struct {
36   int blockflag;
37   int windowtype;
38   int transformtype;
39   int mapping;
40 } vorbis_info_mode;
41
42 typedef void vorbis_info_time;
43 typedef void vorbis_info_floor;
44 typedef void vorbis_info_residue;
45 typedef void vorbis_info_mapping;
46
47 #include "psy.h"
48
49 typedef struct backend_lookup_state {
50   /* local lookup storage */
51   envelope_lookup        *ve; /* envelope lookup */    
52   float                 **window[2][2][2]; /* block, leadin, leadout, type */
53   vorbis_look_transform **transform[2];    /* block, type */
54   codebook               *fullbooks;
55   vorbis_look_psy_global *psy_g_look;
56
57   /* backend lookups are tied to the mode, not the backend or naked mapping */
58   int                     modebits;
59   vorbis_look_mapping   **mode;
60
61   /* local storage, only used on the encoding side.  This way the
62      application does not need to worry about freeing some packets'
63      memory and not others'; packet storage is always tracked.
64      Cleared next call to a _dsp_ function */
65   unsigned char *header;
66   unsigned char *header1;
67   unsigned char *header2;
68   
69 } backend_lookup_state;
70
71 /* vorbis_info contains all the setup information specific to the
72    specific compression/decompression mode in progress (eg,
73    psychoacoustic settings, channel setup, options, codebook
74    etc).  
75 *********************************************************************/
76
77 typedef struct codec_setup_info {
78
79   /* Vorbis supports only short and long blocks, but allows the
80      encoder to choose the sizes */
81
82   long blocksizes[2];
83
84   /* modes are the primary means of supporting on-the-fly different
85      blocksizes, different channel mappings (LR or M/A),
86      different residue backends, etc.  Each mode consists of a
87      blocksize flag and a mapping (along with the mapping setup */
88
89   int        modes;
90   int        maps;
91   int        times;
92   int        floors;
93   int        residues;
94   int        books;
95   int        psys;     /* encode only */
96
97   vorbis_info_mode       *mode_param[64];
98   int                     map_type[64];
99   vorbis_info_mapping    *map_param[64];
100   int                     time_type[64];
101   vorbis_info_time       *time_param[64];
102   int                     floor_type[64];
103   vorbis_info_floor      *floor_param[64];
104   int                     residue_type[64];
105   vorbis_info_residue    *residue_param[64];
106   static_codebook        *book_param[256];
107   vorbis_info_psy        *psy_param[64]; /* encode only */
108   vorbis_info_psy_global *psy_g_param;
109
110 } codec_setup_info;
111
112 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
113 extern void _vp_global_free(vorbis_look_psy_global *look);
114
115 #endif