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-2009 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
11 ********************************************************************
13 function: libvorbis backend and mapping structures; needed for
15 last mod: $Id: backends.h 16227 2009-07-08 06:58:46Z xiphmont $
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 /* Floor backend generic *****************************************/
31 void (*pack
) (vorbis_info_floor
*,oggpack_buffer
*);
32 vorbis_info_floor
*(*unpack
)(vorbis_info
*,oggpack_buffer
*);
33 vorbis_look_floor
*(*look
) (vorbis_dsp_state
*,vorbis_info_floor
*);
34 void (*free_info
) (vorbis_info_floor
*);
35 void (*free_look
) (vorbis_look_floor
*);
36 void *(*inverse1
) (struct vorbis_block
*,vorbis_look_floor
*);
37 int (*inverse2
) (struct vorbis_block
*,vorbis_look_floor
*,
38 void *buffer
,float *);
49 int numbooks
; /* <= 16 */
52 float lessthan
; /* encode-only config setting hacks for libvorbis */
53 float greaterthan
; /* encode-only config setting hacks for libvorbis */
62 int partitions
; /* 0 to 31 */
63 int partitionclass
[VIF_PARTS
]; /* 0 to 15 */
65 int class_dim
[VIF_CLASS
]; /* 1 to 8 */
66 int class_subs
[VIF_CLASS
]; /* 0,1,2,3 (bits: 1<<n poss) */
67 int class_book
[VIF_CLASS
]; /* subs ^ dim entries */
68 int class_subbook
[VIF_CLASS
][8]; /* [VIF_CLASS][subs] */
71 int mult
; /* 1 2 3 or 4 */
72 int postlist
[VIF_POSIT
+2]; /* first two implicit */
75 /* encode side analysis parameters */
87 /* Residue backend generic *****************************************/
89 void (*pack
) (vorbis_info_residue
*,oggpack_buffer
*);
90 vorbis_info_residue
*(*unpack
)(vorbis_info
*,oggpack_buffer
*);
91 vorbis_look_residue
*(*look
) (vorbis_dsp_state
*,
92 vorbis_info_residue
*);
93 void (*free_info
) (vorbis_info_residue
*);
94 void (*free_look
) (vorbis_look_residue
*);
95 long **(*class) (struct vorbis_block
*,vorbis_look_residue
*,
97 int (*forward
) (oggpack_buffer
*,struct vorbis_block
*,
98 vorbis_look_residue
*,
99 float **,float **,int *,int,long **);
100 int (*inverse
) (struct vorbis_block
*,vorbis_look_residue
*,
102 } vorbis_func_residue
;
104 typedef struct vorbis_info_residue0
{
105 /* block-partitioned VQ coded straight residue */
109 /* first stage (lossless partitioning) */
110 int grouping
; /* group n vectors per partition */
111 int partitions
; /* possible codebooks for a partition */
112 int groupbook
; /* huffbook for partitioning */
113 int secondstages
[64]; /* expanded out to pointers in lookup */
114 int booklist
[256]; /* list of second stage books */
116 const float classmetric1
[64];
117 const float classmetric2
[64];
118 } vorbis_info_residue0
;
120 /* Mapping backend generic *****************************************/
122 void (*pack
) (vorbis_info
*,vorbis_info_mapping
*,
124 vorbis_info_mapping
*(*unpack
)(vorbis_info
*,oggpack_buffer
*);
125 void (*free_info
) (vorbis_info_mapping
*);
126 int (*forward
) (struct vorbis_block
*vb
);
127 int (*inverse
) (struct vorbis_block
*vb
,vorbis_info_mapping
*);
128 } vorbis_func_mapping
;
130 typedef struct vorbis_info_mapping0
{
131 int submaps
; /* <= 16 */
132 int chmuxlist
[256]; /* up to 256 channels in a Vorbis stream */
134 int floorsubmap
[16]; /* [mux] submap to floors */
135 int residuesubmap
[16]; /* [mux] submap to residue */
138 int coupling_mag
[256];
139 int coupling_ang
[256];
141 } vorbis_info_mapping0
;