1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH *
6 * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
9 * by Monty <monty@xiph.org> and the XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************
14 function: libvorbis backend and mapping structures; needed for
16 last mod: $Id: backends.h,v 1.3 2000/11/17 11:47:18 xiphmont Exp $
18 ********************************************************************/
20 /* this is exposed up here because we need it for static modes.
21 Lookups for each backend aren't exposed because there's no reason
24 #ifndef _vorbis_backend_h_
25 #define _vorbis_backend_h_
27 #include "codec_internal.h"
29 /* this would all be simpler/shorter with templates, but.... */
30 /* Transform backend generic *************************************/
32 /* only mdct right now. Flesh it out more if we ever transcend mdct
33 in the transform domain */
35 /* Time backend generic ******************************************/
37 void (*pack) (vorbis_info_time *,oggpack_buffer *);
38 vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
39 vorbis_look_time *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
41 vorbis_info_time *(*copy_info)(vorbis_info_time *);
43 void (*free_info) (vorbis_info_time *);
44 void (*free_look) (vorbis_look_time *);
45 int (*forward) (struct vorbis_block *,vorbis_look_time *,
47 int (*inverse) (struct vorbis_block *,vorbis_look_time *,
55 /* Floor backend generic *****************************************/
57 void (*pack) (vorbis_info_floor *,oggpack_buffer *);
58 vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
59 vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
61 vorbis_info_floor *(*copy_info)(vorbis_info_floor *);
62 void (*free_info) (vorbis_info_floor *);
63 void (*free_look) (vorbis_look_floor *);
64 int (*forward) (struct vorbis_block *,vorbis_look_floor *,
65 float *,float *,vorbis_bitbuffer *);
66 float(*forward2) (struct vorbis_block *,vorbis_look_floor *,
67 long,float, vorbis_bitbuffer *);
68 int (*inverse) (struct vorbis_block *,vorbis_look_floor *,
80 int numbooks; /* <= 16 */
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 *,vorbis_info_mode *,
89 vorbis_info_residue *);
90 vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
91 void (*free_info) (vorbis_info_residue *);
92 void (*free_look) (vorbis_look_residue *);
93 int (*forward) (struct vorbis_block *,vorbis_look_residue *,
94 float **,int,vorbis_bitbuffer *);
95 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
97 } vorbis_func_residue;
99 typedef struct vorbis_info_residue0{
100 /* block-partitioned VQ coded straight residue */
104 /* first stage (lossless partitioning) */
105 int grouping; /* group n vectors per partition */
106 int partitions; /* possible codebooks for a partition */
107 int groupbook; /* huffbook for partitioning */
108 int secondstages[64]; /* expanded out to pointers in lookup */
109 int booklist[256]; /* list of second stage books */
111 /* encode-only heuristic settings */
112 float entmax[64]; /* book entropy threshholds*/
113 float ampmax[64]; /* book amp threshholds*/
114 int subgrp[64]; /* book heuristic subgroup size */
115 int blimit[64]; /* subgroup position limits */
117 } vorbis_info_residue0;
119 /* Mapping backend generic *****************************************/
121 void (*pack) (vorbis_info *,vorbis_info_mapping *,
123 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
124 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
125 vorbis_info_mapping *);
126 vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
127 void (*free_info) (vorbis_info_mapping *);
128 void (*free_look) (vorbis_look_mapping *);
129 int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *);
130 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
131 } vorbis_func_mapping;
133 typedef struct vorbis_info_mapping0{
134 int submaps; /* <= 16 */
135 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
137 int timesubmap[16]; /* [mux] */
138 int floorsubmap[16]; /* [mux] submap to floors */
139 int residuesubmap[16]; /* [mux] submap to residue */
140 int psysubmap[16]; /* [mux]; encode only */
141 } vorbis_info_mapping0;