annotate tremor/backends.h @ 23914:43718b819ab4

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