Recognizes if input is ogg or not.
[xiph.git] / Tremor / backends.h
blob50c1c45cfd6af5a65dc23ccfb06ff46715c216a1
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
14 function: backend and mapping structures
16 ********************************************************************/
18 /* this is exposed up here because we need it for static modes.
19 Lookups for each backend aren't exposed because there's no reason
20 to do so */
22 #ifndef _vorbis_backend_h_
23 #define _vorbis_backend_h_
25 #include "codec_internal.h"
27 /* this would all be simpler/shorter with templates, but.... */
28 /* Transform backend generic *************************************/
30 /* only mdct right now. Flesh it out more if we ever transcend mdct
31 in the transform domain */
33 /* Floor backend generic *****************************************/
34 typedef struct{
35 vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
36 vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
37 vorbis_info_floor *);
38 void (*free_info) (vorbis_info_floor *);
39 void (*free_look) (vorbis_look_floor *);
40 void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
41 int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
42 void *buffer,ogg_int32_t *);
43 } vorbis_func_floor;
45 typedef struct{
46 int order;
47 long rate;
48 long barkmap;
50 int ampbits;
51 int ampdB;
53 int numbooks; /* <= 16 */
54 int books[16];
56 } vorbis_info_floor0;
58 #define VIF_POSIT 63
59 #define VIF_CLASS 16
60 #define VIF_PARTS 31
61 typedef struct{
62 int partitions; /* 0 to 31 */
63 int partitionclass[VIF_PARTS]; /* 0 to 15 */
65 int class_dim[VIF_CLASS]; /* 1 to 8 */
66 int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
67 int class_book[VIF_CLASS]; /* subs ^ dim entries */
68 int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
71 int mult; /* 1 2 3 or 4 */
72 int postlist[VIF_POSIT+2]; /* first two implicit */
74 } vorbis_info_floor1;
76 /* Residue backend generic *****************************************/
77 typedef struct{
78 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
79 vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
80 vorbis_info_residue *);
81 void (*free_info) (vorbis_info_residue *);
82 void (*free_look) (vorbis_look_residue *);
83 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
84 ogg_int32_t **,int *,int);
85 } vorbis_func_residue;
87 typedef struct vorbis_info_residue0{
88 /* block-partitioned VQ coded straight residue */
89 long begin;
90 long end;
92 /* first stage (lossless partitioning) */
93 int grouping; /* group n vectors per partition */
94 int partitions; /* possible codebooks for a partition */
95 int groupbook; /* huffbook for partitioning */
96 int secondstages[64]; /* expanded out to pointers in lookup */
97 int booklist[256]; /* list of second stage books */
98 } vorbis_info_residue0;
100 /* Mapping backend generic *****************************************/
101 typedef struct{
102 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
103 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
104 vorbis_info_mapping *);
105 void (*free_info) (vorbis_info_mapping *);
106 void (*free_look) (vorbis_look_mapping *);
107 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
108 } vorbis_func_mapping;
110 typedef struct vorbis_info_mapping0{
111 int submaps; /* <= 16 */
112 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
114 int floorsubmap[16]; /* [mux] submap to floors */
115 int residuesubmap[16]; /* [mux] submap to residue */
117 int psy[2]; /* by blocktype; impulse/padding for short,
118 transition/normal for long */
120 int coupling_steps;
121 int coupling_mag[256];
122 int coupling_ang[256];
123 } vorbis_info_mapping0;
125 #endif