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