1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: libvorbis backend and mapping structures; needed for
15 last mod: $Id: backends.h,v 1.11 2001/12/12 09:45:24 xiphmont Exp $
17 ********************************************************************/
19 /* this is exposed up here because we need it for static modes.
20 Lookups for each backend aren't exposed because there's no reason
23 #ifndef _vorbis_backend_h_
24 #define _vorbis_backend_h_
26 #include "codec_internal.h"
28 /* this would all be simpler/shorter with templates, but.... */
29 /* Transform backend generic *************************************/
31 /* only mdct right now. Flesh it out more if we ever transcend mdct
32 in the transform domain */
34 /* Time backend generic ******************************************/
36 void (*pack) (vorbis_info_time *,oggpack_buffer *);
37 vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
38 vorbis_look_time *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
40 vorbis_info_time *(*copy_info)(vorbis_info_time *);
42 void (*free_info) (vorbis_info_time *);
43 void (*free_look) (vorbis_look_time *);
44 int (*forward) (struct vorbis_block *,vorbis_look_time *,
46 int (*inverse) (struct vorbis_block *,vorbis_look_time *,
54 /* Floor backend generic *****************************************/
56 void (*pack) (vorbis_info_floor *,oggpack_buffer *);
57 vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
58 vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
60 vorbis_info_floor *(*copy_info)(vorbis_info_floor *);
61 void (*free_info) (vorbis_info_floor *);
62 void (*free_look) (vorbis_look_floor *);
63 int (*forward) (struct vorbis_block *,vorbis_look_floor *,
64 float *, const float *, /* in */
65 const float *, const float *, /* in */
67 void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
68 int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
69 void *buffer,float *);
80 int numbooks; /* <= 16 */
83 float lessthan; /* encode-only config setting hacks for libvorbis */
84 float greaterthan; /* encode-only config setting hacks for libvorbis */
92 int partitions; /* 0 to 31 */
93 int partitionclass[VIF_PARTS]; /* 0 to 15 */
95 int class_dim[VIF_CLASS]; /* 1 to 8 */
96 int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
97 int class_book[VIF_CLASS]; /* subs ^ dim entries */
98 int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
101 int mult; /* 1 2 3 or 4 */
102 int postlist[VIF_POSIT+2]; /* first two implicit */
105 /* encode side analysis parameters */
119 } vorbis_info_floor1;
121 /* Residue backend generic *****************************************/
123 void (*pack) (vorbis_info_residue *,oggpack_buffer *);
124 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
125 vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
126 vorbis_info_residue *);
127 vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
128 void (*free_info) (vorbis_info_residue *);
129 void (*free_look) (vorbis_look_residue *);
130 long **(*class) (struct vorbis_block *,vorbis_look_residue *,
132 int (*forward) (struct vorbis_block *,vorbis_look_residue *,
133 float **,float **,int *,int,int,long **,ogg_uint32_t *);
134 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
136 } vorbis_func_residue;
138 typedef struct vorbis_info_residue0{
139 /* block-partitioned VQ coded straight residue */
143 /* first stage (lossless partitioning) */
144 int grouping; /* group n vectors per partition */
145 int partitions; /* possible codebooks for a partition */
146 int groupbook; /* huffbook for partitioning */
147 int secondstages[64]; /* expanded out to pointers in lookup */
148 int booklist[256]; /* list of second stage books */
150 /* encode-only heuristic settings */
151 float entmax[64]; /* book entropy threshholds*/
152 float ampmax[64]; /* book amp threshholds*/
153 int subgrp[64]; /* book heuristic subgroup size */
154 int blimit[64]; /* subgroup position limits */
155 } vorbis_info_residue0;
157 /* Mapping backend generic *****************************************/
159 void (*pack) (vorbis_info *,vorbis_info_mapping *,
161 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
162 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
163 vorbis_info_mapping *);
164 vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
165 void (*free_info) (vorbis_info_mapping *);
166 void (*free_look) (vorbis_look_mapping *);
167 int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *);
168 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
169 } vorbis_func_mapping;
171 typedef struct vorbis_info_mapping0{
172 int submaps; /* <= 16 */
173 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
175 int timesubmap[16]; /* [mux] */
176 int floorsubmap[16]; /* [mux] submap to floors */
177 int residuesubmap[16]; /* [mux] submap to residue */
179 int psy[2]; /* by blocktype; impulse/padding for short,
180 transition/normal for long */
183 int coupling_mag[256];
184 int coupling_ang[256];
185 } vorbis_info_mapping0;