Fix the initial frame bug triggered by vcut; if the first block of a
[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.8 2001/03/26 23:27:43 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 #include "psy.h"
23 #include "bitbuffer.h"
24
25 typedef struct vorbis_block_internal{
26   float  **pcmdelay;  /* this is a pointer into local storage */ 
27   float  ampmax;
28 } vorbis_block_internal;
29
30 typedef void vorbis_look_time;
31 typedef void vorbis_look_mapping;
32 typedef void vorbis_look_floor;
33 typedef void vorbis_look_residue;
34 typedef void vorbis_look_transform;
35
36 typedef struct backend_lookup_state {
37   /* local lookup storage */
38   envelope_lookup        *ve; /* envelope lookup */    
39   float                 **window[2][2][2]; /* block, leadin, leadout, type */
40   vorbis_look_transform **transform[2];    /* block, type */
41   codebook               *fullbooks;
42
43   /* backend lookups are tied to the mode, not the backend or naked mapping */
44   int                     modebits;
45   vorbis_look_mapping   **mode;
46
47   /* local storage, only used on the encoding side.  This way the
48      application does not need to worry about freeing some packets'
49      memory and not others'; packet storage is always tracked.
50      Cleared next call to a _dsp_ function */
51   unsigned char *header;
52   unsigned char *header1;
53   unsigned char *header2;
54
55   float ampmax;
56
57 } backend_lookup_state;
58
59 /* mode ************************************************************/
60 typedef struct {
61   int blockflag;
62   int windowtype;
63   int transformtype;
64   int mapping;
65 } vorbis_info_mode;
66
67 typedef void vorbis_info_time;
68 typedef void vorbis_info_floor;
69 typedef void vorbis_info_residue;
70 typedef void vorbis_info_mapping;
71
72 /* vorbis_info contains all the setup information specific to the
73    specific compression/decompression mode in progress (eg,
74    psychoacoustic settings, channel setup, options, codebook
75    etc).  
76 *********************************************************************/
77
78 typedef struct codec_setup_info {
79
80   /* Vorbis supports only short and long blocks, but allows the
81      encoder to choose the sizes */
82
83   long blocksizes[2];
84
85   /* modes are the primary means of supporting on-the-fly different
86      blocksizes, different channel mappings (LR or mid-side),
87      different residue backends, etc.  Each mode consists of a
88      blocksize flag and a mapping (along with the mapping setup */
89
90   int        modes;
91   int        maps;
92   int        times;
93   int        floors;
94   int        residues;
95   int        books;
96   int        psys;     /* encode only */
97
98   vorbis_info_mode    *mode_param[64];
99   int                  map_type[64];
100   vorbis_info_mapping *map_param[64];
101   int                  time_type[64];
102   vorbis_info_time    *time_param[64];
103   int                  floor_type[64];
104   vorbis_info_floor   *floor_param[64];
105   int                  residue_type[64];
106   vorbis_info_residue *residue_param[64];
107   static_codebook     *book_param[256];
108   vorbis_info_psy     *psy_param[64]; /* encode only */
109   
110   /* for block long/sort tuning; encode only */
111   int       envelopesa;
112   float     preecho_thresh[4];
113   float     postecho_thresh[4];
114   float     preecho_minenergy;
115
116   float     ampmax_att_per_sec;
117
118   /* delay caching... how many samples to keep around prior to our
119      current block to aid in analysis? */
120   int       delaycache;
121
122 } codec_setup_info;
123
124 #endif