annotate tremor/backends.h @ 16124:833fa602eb76

Sometimes you have to manually add scale at the end of the filter chain :-(
author reimar
date Thu, 28 Jul 2005 09:56:33 +0000
parents 8631a3803289
children cd6b211be811
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
1 /********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
2 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
4 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
5 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
6 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
7 * ALL REDISTRIBUTION RIGHTS RESERVED. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
8 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
9 ********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
10
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
11 function: backend and mapping structures
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
12
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
13 ********************************************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
14
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
15 /* this is exposed up here because we need it for static modes.
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
16 Lookups for each backend aren't exposed because there's no reason
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
17 to do so */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
18
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
19 #ifndef _vorbis_backend_h_
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
20 #define _vorbis_backend_h_
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
21
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
22 #include "codec_internal.h"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
23
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
24 /* this would all be simpler/shorter with templates, but.... */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
25 /* Transform backend generic *************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
26
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
27 /* only mdct right now. Flesh it out more if we ever transcend mdct
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
28 in the transform domain */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
29
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
30 /* Floor backend generic *****************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
31 typedef struct{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
32 vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
33 vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
34 vorbis_info_floor *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
35 void (*free_info) (vorbis_info_floor *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
36 void (*free_look) (vorbis_look_floor *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
37 void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
38 int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
39 void *buffer,ogg_int32_t *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
40 } vorbis_func_floor;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
41
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
42 typedef struct{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
43 int order;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
44 long rate;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
45 long barkmap;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
46
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
47 int ampbits;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
48 int ampdB;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
49
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
50 int numbooks; /* <= 16 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
51 int books[16];
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
52
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
53 } vorbis_info_floor0;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
54
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
55 #define VIF_POSIT 63
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
56 #define VIF_CLASS 16
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
57 #define VIF_PARTS 31
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
58 typedef struct{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
59 int partitions; /* 0 to 31 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
60 int partitionclass[VIF_PARTS]; /* 0 to 15 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
61
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
62 int class_dim[VIF_CLASS]; /* 1 to 8 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
63 int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
64 int class_book[VIF_CLASS]; /* subs ^ dim entries */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
65 int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
66
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
67
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
68 int mult; /* 1 2 3 or 4 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
69 int postlist[VIF_POSIT+2]; /* first two implicit */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
70
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
71 } vorbis_info_floor1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
72
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
73 /* Residue backend generic *****************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
74 typedef struct{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
75 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
76 vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
77 vorbis_info_residue *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
78 void (*free_info) (vorbis_info_residue *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
79 void (*free_look) (vorbis_look_residue *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
80 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
81 ogg_int32_t **,int *,int);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
82 } vorbis_func_residue;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
83
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
84 typedef struct vorbis_info_residue0{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
85 /* block-partitioned VQ coded straight residue */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
86 long begin;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
87 long end;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
88
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
89 /* first stage (lossless partitioning) */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
90 int grouping; /* group n vectors per partition */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
91 int partitions; /* possible codebooks for a partition */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
92 int groupbook; /* huffbook for partitioning */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
93 int secondstages[64]; /* expanded out to pointers in lookup */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
94 int booklist[256]; /* list of second stage books */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
95 } vorbis_info_residue0;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
96
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
97 /* Mapping backend generic *****************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
98 typedef struct{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
99 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
100 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
101 vorbis_info_mapping *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
102 void (*free_info) (vorbis_info_mapping *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
103 void (*free_look) (vorbis_look_mapping *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
104 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
105 } vorbis_func_mapping;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
106
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
107 typedef struct vorbis_info_mapping0{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
108 int submaps; /* <= 16 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
109 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
110
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
111 int floorsubmap[16]; /* [mux] submap to floors */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
112 int residuesubmap[16]; /* [mux] submap to residue */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
113
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
114 int psy[2]; /* by blocktype; impulse/padding for short,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
115 transition/normal for long */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
116
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
117 int coupling_steps;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
118 int coupling_mag[256];
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
119 int coupling_ang[256];
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
120 } vorbis_info_mapping0;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
121
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
122 #endif
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
123
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
124
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
125
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
126
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
127