final beta 4 commit
[platform/upstream/libvorbis.git] / lib / backends.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
13  function: libvorbis backend and mapping structures; needed for 
14            static mode headers
15  last mod: $Id: backends.h,v 1.6 2001/02/26 03:50:41 xiphmont Exp $
16
17  ********************************************************************/
18
19 /* this is exposed up here because we need it for static modes.
20    Lookups for each backend aren't exposed because there's no reason
21    to do so */
22
23 #ifndef _vorbis_backend_h_
24 #define _vorbis_backend_h_
25
26 #include "codec_internal.h"
27
28 /* this would all be simpler/shorter with templates, but.... */
29 /* Transform backend generic *************************************/
30
31 /* only mdct right now.  Flesh it out more if we ever transcend mdct
32    in the transform domain */
33
34 /* Time backend generic ******************************************/
35 typedef struct{
36   void              (*pack)  (vorbis_info_time *,oggpack_buffer *);
37   vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
38   vorbis_look_time *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
39                               vorbis_info_time *);
40   vorbis_info_time *(*copy_info)(vorbis_info_time *);
41
42   void (*free_info) (vorbis_info_time *);
43   void (*free_look) (vorbis_look_time *);
44   int  (*forward)   (struct vorbis_block *,vorbis_look_time *,
45                      float *,float *);
46   int  (*inverse)   (struct vorbis_block *,vorbis_look_time *,
47                      float *,float *);
48 } vorbis_func_time;
49
50 typedef struct{
51   int dummy;
52 } vorbis_info_time0;
53
54 /* Floor backend generic *****************************************/
55 typedef struct{
56   void                   (*pack)  (vorbis_info_floor *,oggpack_buffer *);
57   vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
58   vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
59                                    vorbis_info_floor *);
60   vorbis_info_floor     *(*copy_info)(vorbis_info_floor *);
61   void (*free_info) (vorbis_info_floor *);
62   void (*free_look) (vorbis_look_floor *);
63   int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
64                      float *);
65   int  (*inverse)   (struct vorbis_block *,vorbis_look_floor *,
66                      float *);
67 } vorbis_func_floor;
68
69 typedef struct{
70   int   order;
71   long  rate;
72   long  barkmap;
73
74   int   ampbits;
75   int   ampdB;
76
77   int   numbooks; /* <= 16 */
78   int   books[16];
79
80   float lessthan;     /* encode-only config setting hacks for libvorbis */
81   float greaterthan;  /* encode-only config setting hacks for libvorbis */
82
83 } vorbis_info_floor0;
84
85 /* Residue backend generic *****************************************/
86 typedef struct{
87   void                 (*pack)  (vorbis_info_residue *,oggpack_buffer *);
88   vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
89   vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
90                                  vorbis_info_residue *);
91   vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
92   void (*free_info)    (vorbis_info_residue *);
93   void (*free_look)    (vorbis_look_residue *);
94   int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
95                         float **,int);
96   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
97                         float **,int);
98 } vorbis_func_residue;
99
100 typedef struct vorbis_info_residue0{
101 /* block-partitioned VQ coded straight residue */
102   long  begin;
103   long  end;
104
105   /* first stage (lossless partitioning) */
106   int    grouping;         /* group n vectors per partition */
107   int    partitions;       /* possible codebooks for a partition */
108   int    groupbook;        /* huffbook for partitioning */
109   int    secondstages[64]; /* expanded out to pointers in lookup */
110   int    booklist[256];    /* list of second stage books */
111
112   /* encode-only heuristic settings */
113   float  entmax[64];       /* book entropy threshholds*/
114   float  ampmax[64];       /* book amp threshholds*/
115   int    subgrp[64];       /* book heuristic subgroup size */
116   int    blimit[64];       /* subgroup position limits */
117
118 } vorbis_info_residue0;
119
120 /* Mapping backend generic *****************************************/
121 typedef struct{
122   void                 (*pack)  (vorbis_info *,vorbis_info_mapping *,
123                                  oggpack_buffer *);
124   vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
125   vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
126                                  vorbis_info_mapping *);
127   vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
128   void (*free_info)    (vorbis_info_mapping *);
129   void (*free_look)    (vorbis_look_mapping *);
130   int  (*forward)      (struct vorbis_block *vb,vorbis_look_mapping *);
131   int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
132 } vorbis_func_mapping;
133
134 typedef struct vorbis_info_mapping0{
135   int   submaps;  /* <= 16 */
136   int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
137   
138   int   timesubmap[16];    /* [mux] */
139   int   floorsubmap[16];   /* [mux] submap to floors */
140   int   residuesubmap[16]; /* [mux] submap to residue */
141   int   psysubmap[16];     /* [mux]; encode only */
142 } vorbis_info_mapping0;
143
144 #endif
145
146
147
148
149