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 https://xiph.org/ *
11 ********************************************************************
13 function: libvorbis backend and mapping structures; needed for
16 ********************************************************************/
18 /* this is exposed up here because we need it for static modes.
19 Lookups for each backend aren't exposed because there's no reason
22 #ifndef _vorbis_backend_h_
23 #define _vorbis_backend_h_
25 /* this would all be simpler/shorter with templates, but.... */
26 /* Floor backend generic *****************************************/
28 void (*pack) (vorbis_info_floor *,oggpack_buffer *);
29 vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
30 vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_floor *);
31 void (*free_info) (vorbis_info_floor *);
32 void (*free_look) (vorbis_look_floor *);
33 void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
34 int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
35 void *buffer,float *);
46 int numbooks; /* <= 16 */
49 float lessthan; /* encode-only config setting hacks for libvorbis */
50 float greaterthan; /* encode-only config setting hacks for libvorbis */
59 int partitions; /* 0 to 31 */
60 int partitionclass[VIF_PARTS]; /* 0 to 15 */
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] */
68 int mult; /* 1 2 3 or 4 */
69 int postlist[VIF_POSIT+2]; /* first two implicit */
72 /* encode side analysis parameters */
84 /* Residue backend generic *****************************************/
86 void (*pack) (vorbis_info_residue *,oggpack_buffer *);
87 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
88 vorbis_look_residue *(*look) (vorbis_dsp_state *,
89 vorbis_info_residue *);
90 void (*free_info) (vorbis_info_residue *);
91 void (*free_look) (vorbis_look_residue *);
92 long **(*class) (struct vorbis_block *,vorbis_look_residue *,
94 int (*forward) (oggpack_buffer *,struct vorbis_block *,
95 vorbis_look_residue *,
96 int **,int *,int,long **,int);
97 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
99 } vorbis_func_residue;
101 typedef struct vorbis_info_residue0{
102 /* block-partitioned VQ coded straight residue */
106 /* first stage (lossless partitioning) */
107 int grouping; /* group n vectors per partition */
108 int partitions; /* possible codebooks for a partition */
109 int partvals; /* partitions ^ groupbook dim */
110 int groupbook; /* huffbook for partitioning */
111 int secondstages[64]; /* expanded out to pointers in lookup */
112 int booklist[512]; /* list of second stage books */
114 const int classmetric1[64];
115 const int classmetric2[64];
116 } vorbis_info_residue0;
118 /* Mapping backend generic *****************************************/
120 void (*pack) (vorbis_info *,vorbis_info_mapping *,
122 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
123 void (*free_info) (vorbis_info_mapping *);
124 int (*forward) (struct vorbis_block *vb);
125 int (*inverse) (struct vorbis_block *vb,vorbis_info_mapping *);
126 } vorbis_func_mapping;
128 typedef struct vorbis_info_mapping0{
129 int submaps; /* <= 16 */
130 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
132 int floorsubmap[16]; /* [mux] submap to floors */
133 int residuesubmap[16]; /* [mux] submap to residue */
136 int coupling_mag[256];
137 int coupling_ang[256];
139 } vorbis_info_mapping0;