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.7 2001/05/27 06:43:59 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 int (*inverse) (struct vorbis_block *,vorbis_look_floor *,
79 int numbooks; /* <= 16 */
82 float lessthan; /* encode-only config setting hacks for libvorbis */
83 float greaterthan; /* encode-only config setting hacks for libvorbis */
91 int partitions; /* 0 to 31 */
92 int partitionclass[VIF_PARTS]; /* 0 to 15 */
94 int class_dim[VIF_CLASS]; /* 1 to 8 */
95 int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
96 int class_book[VIF_CLASS]; /* subs ^ dim entries */
97 int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
100 int mult; /* 1 2 3 or 4 */
101 int postlist[VIF_POSIT+2]; /* first two implicit */
104 /* encode side analysis parameters */
116 } vorbis_info_floor1;
118 /* Residue backend generic *****************************************/
120 void (*pack) (vorbis_info_residue *,oggpack_buffer *);
121 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
122 vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
123 vorbis_info_residue *);
124 vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
125 void (*free_info) (vorbis_info_residue *);
126 void (*free_look) (vorbis_look_residue *);
127 int (*forward) (struct vorbis_block *,vorbis_look_residue *,
129 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
131 } vorbis_func_residue;
133 typedef struct vorbis_info_residue0{
134 /* block-partitioned VQ coded straight residue */
138 /* first stage (lossless partitioning) */
139 int grouping; /* group n vectors per partition */
140 int partitions; /* possible codebooks for a partition */
141 int groupbook; /* huffbook for partitioning */
142 int secondstages[64]; /* expanded out to pointers in lookup */
143 int booklist[256]; /* list of second stage books */
145 /* encode-only heuristic settings */
146 float entmax[64]; /* book entropy threshholds*/
147 float ampmax[64]; /* book amp threshholds*/
148 int subgrp[64]; /* book heuristic subgroup size */
149 int blimit[64]; /* subgroup position limits */
151 } vorbis_info_residue0;
153 /* Mapping backend generic *****************************************/
155 void (*pack) (vorbis_info *,vorbis_info_mapping *,
157 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
158 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
159 vorbis_info_mapping *);
160 vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
161 void (*free_info) (vorbis_info_mapping *);
162 void (*free_look) (vorbis_look_mapping *);
163 int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *);
164 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
165 } vorbis_func_mapping;
167 typedef struct vorbis_info_mapping0{
168 int submaps; /* <= 16 */
169 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
171 int timesubmap[16]; /* [mux] */
172 int floorsubmap[16]; /* [mux] submap to floors */
173 int residuesubmap[16]; /* [mux] submap to residue */
174 int psysubmap[16]; /* [mux]; encode only */
175 } vorbis_info_mapping0;