comparison tremor/backends.h @ 14280:8631a3803289

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