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.8 2001/06/15 21:15:39 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 const float *, const float *, /* in */
65 const float *, const float *, /* in */
66 float *, float *); /* out */
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 */
117 } vorbis_info_floor1;
119 /* Residue backend generic *****************************************/
121 void (*pack) (vorbis_info_residue *,oggpack_buffer *);
122 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
123 vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
124 vorbis_info_residue *);
125 vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
126 void (*free_info) (vorbis_info_residue *);
127 void (*free_look) (vorbis_look_residue *);
128 int (*forward) (struct vorbis_block *,vorbis_look_residue *,
130 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
132 } vorbis_func_residue;
134 typedef struct vorbis_info_residue0{
135 /* block-partitioned VQ coded straight residue */
139 /* first stage (lossless partitioning) */
140 int grouping; /* group n vectors per partition */
141 int partitions; /* possible codebooks for a partition */
142 int groupbook; /* huffbook for partitioning */
143 int secondstages[64]; /* expanded out to pointers in lookup */
144 int booklist[256]; /* list of second stage books */
146 /* encode-only heuristic settings */
147 float entmax[64]; /* book entropy threshholds*/
148 float ampmax[64]; /* book amp threshholds*/
149 int subgrp[64]; /* book heuristic subgroup size */
150 int blimit[64]; /* subgroup position limits */
152 } vorbis_info_residue0;
154 /* Mapping backend generic *****************************************/
156 void (*pack) (vorbis_info *,vorbis_info_mapping *,
158 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
159 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
160 vorbis_info_mapping *);
161 vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
162 void (*free_info) (vorbis_info_mapping *);
163 void (*free_look) (vorbis_look_mapping *);
164 int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *);
165 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
166 } vorbis_func_mapping;
168 typedef struct vorbis_info_mapping0{
169 int submaps; /* <= 16 */
170 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
172 int timesubmap[16]; /* [mux] */
173 int floorsubmap[16]; /* [mux] submap to floors */
174 int residuesubmap[16]; /* [mux] submap to residue */
175 int psysubmap[16]; /* [mux]; encode only */
178 int coupling_mag[256];
179 int coupling_ang[256];
180 } vorbis_info_mapping0;