Merge of the current Monty branch; this brings in new psychoacoustic
[platform/upstream/libvorbis.git] / include / vorbis / backends.h
1 /********************************************************************
2  *                                                                  *
3  * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5  * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
6  * PLEASE READ THESE TERMS DISTRIBUTING.                            *
7  *                                                                  *
8  * THE OggSQUISH 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.9 2000/06/14 01:38:27 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_time_backend_h_
25 #define _vorbis_time_backend_h_
26
27 /* this would all be simpler/shorter with templates, but.... */
28 /* Transform backend generic *************************************/
29
30 /* only mdct right now.  Flesh it out more if we ever transcend mdct
31    in the transform domain */
32
33 /* Time backend generic ******************************************/
34 typedef struct{
35   void              (*pack)  (vorbis_info_time *,oggpack_buffer *);
36   vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
37   vorbis_look_time *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
38                               vorbis_info_time *);
39   void (*free_info) (vorbis_info_time *);
40   void (*free_look) (vorbis_look_time *);
41   int  (*forward)   (struct vorbis_block *,vorbis_look_time *,
42                      double *,double *);
43   int  (*inverse)   (struct vorbis_block *,vorbis_look_time *,
44                      double *,double *);
45 } vorbis_func_time;
46
47 typedef struct{
48   int dummy;
49 } vorbis_info_time0;
50
51 /* Floor backend generic *****************************************/
52 typedef struct{
53   void                   (*pack)  (vorbis_info_floor *,oggpack_buffer *);
54   vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
55   vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
56                                    vorbis_info_floor *);
57   vorbis_echstate_floor *(*state) (vorbis_info_floor *);
58   void (*free_info) (vorbis_info_floor *);
59   void (*free_look) (vorbis_look_floor *);
60   void (*free_state)(vorbis_echstate_floor *);
61   int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
62                      double *,double *,vorbis_echstate_floor *);
63   int  (*inverse)   (struct vorbis_block *,vorbis_look_floor *,
64                      double *);
65 } vorbis_func_floor;
66
67 typedef struct{
68   int   order;
69   long  rate;
70   long  barkmap;
71
72   int   ampbits;
73   int   ampdB;
74
75   int   numbooks; /* <= 16 */
76   int   books[16];
77 } vorbis_info_floor0;
78
79 /* Residue backend generic *****************************************/
80 typedef struct{
81   void                 (*pack)  (vorbis_info_residue *,oggpack_buffer *);
82   vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
83   vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
84                                  vorbis_info_residue *);
85   void (*free_info)    (vorbis_info_residue *);
86   void (*free_look)    (vorbis_look_residue *);
87   int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
88                         double **,int);
89   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
90                         double **,int);
91 } vorbis_func_residue;
92
93 typedef struct vorbis_info_residue0{
94 /* block-partitioned VQ coded straight residue */
95   long  begin;
96   long  end;
97
98   /* first stage (lossless partitioning) */
99   int    grouping;         /* group n vectors per partition */
100   int    partitions;       /* possible codebooks for a partition */
101   int    groupbook;        /* huffbook for partitioning */
102   int    secondstages[64]; /* expanded out to pointers in lookup */
103   int    booklist[256];    /* list of second stage books */
104
105   double entmax[64];       /* book entropy threshholds for *encode* */
106   double ampmax[64];       /* book amp threshholds for *encode* */
107   int    subgrp[64];       /* book subgroup size for *encode* */
108   long   Bpoint;
109   long   Cpoint;
110
111 } vorbis_info_residue0;
112
113 /* Mapping backend generic *****************************************/
114 typedef struct{
115   void                 (*pack)  (vorbis_info *,vorbis_info_mapping *,
116                                  oggpack_buffer *);
117   vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
118   vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
119                                  vorbis_info_mapping *);
120   void (*free_info)    (vorbis_info_mapping *);
121   void (*free_look)    (vorbis_look_mapping *);
122   int  (*forward)      (struct vorbis_block *vb,vorbis_look_mapping *);
123   int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
124 } vorbis_func_mapping;
125
126 typedef struct vorbis_info_mapping0{
127   int   submaps;  /* <= 16 */
128   int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
129   
130   int   timesubmap[16];    /* [mux] */
131   int   floorsubmap[16];   /* [mux] submap to floors */
132   int   residuesubmap[16]; /* [mux] submap to residue */
133   int   psysubmap[16];     /* [mux]; encode only */
134 } vorbis_info_mapping0;
135
136 #endif
137
138
139
140
141