rev |
line source |
nuclear@0
|
1 /********************************************************************
|
nuclear@0
|
2 * *
|
nuclear@0
|
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
nuclear@0
|
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
nuclear@0
|
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
nuclear@0
|
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
nuclear@0
|
7 * *
|
nuclear@0
|
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
nuclear@0
|
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
|
nuclear@0
|
10 * *
|
nuclear@0
|
11 ********************************************************************
|
nuclear@0
|
12
|
nuclear@0
|
13 function: libvorbis codec headers
|
nuclear@0
|
14 last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
|
nuclear@0
|
15
|
nuclear@0
|
16 ********************************************************************/
|
nuclear@0
|
17
|
nuclear@0
|
18 #ifndef _V_CODECI_H_
|
nuclear@0
|
19 #define _V_CODECI_H_
|
nuclear@0
|
20
|
nuclear@0
|
21 #include "envelope.h"
|
nuclear@0
|
22 #include "codebook.h"
|
nuclear@0
|
23
|
nuclear@0
|
24 #define BLOCKTYPE_IMPULSE 0
|
nuclear@0
|
25 #define BLOCKTYPE_PADDING 1
|
nuclear@0
|
26 #define BLOCKTYPE_TRANSITION 0
|
nuclear@0
|
27 #define BLOCKTYPE_LONG 1
|
nuclear@0
|
28
|
nuclear@0
|
29 #define PACKETBLOBS 15
|
nuclear@0
|
30
|
nuclear@0
|
31 typedef struct vorbis_block_internal{
|
nuclear@0
|
32 float **pcmdelay; /* this is a pointer into local storage */
|
nuclear@0
|
33 float ampmax;
|
nuclear@0
|
34 int blocktype;
|
nuclear@0
|
35
|
nuclear@0
|
36 oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
|
nuclear@0
|
37 blob [PACKETBLOBS/2] points to
|
nuclear@0
|
38 the oggpack_buffer in the
|
nuclear@0
|
39 main vorbis_block */
|
nuclear@0
|
40 } vorbis_block_internal;
|
nuclear@0
|
41
|
nuclear@0
|
42 typedef void vorbis_look_floor;
|
nuclear@0
|
43 typedef void vorbis_look_residue;
|
nuclear@0
|
44 typedef void vorbis_look_transform;
|
nuclear@0
|
45
|
nuclear@0
|
46 /* mode ************************************************************/
|
nuclear@0
|
47 typedef struct {
|
nuclear@0
|
48 int blockflag;
|
nuclear@0
|
49 int windowtype;
|
nuclear@0
|
50 int transformtype;
|
nuclear@0
|
51 int mapping;
|
nuclear@0
|
52 } vorbis_info_mode;
|
nuclear@0
|
53
|
nuclear@0
|
54 typedef void vorbis_info_floor;
|
nuclear@0
|
55 typedef void vorbis_info_residue;
|
nuclear@0
|
56 typedef void vorbis_info_mapping;
|
nuclear@0
|
57
|
nuclear@0
|
58 #include "psy.h"
|
nuclear@0
|
59 #include "bitrate.h"
|
nuclear@0
|
60
|
nuclear@0
|
61 typedef struct private_state {
|
nuclear@0
|
62 /* local lookup storage */
|
nuclear@0
|
63 envelope_lookup *ve; /* envelope lookup */
|
nuclear@0
|
64 int window[2];
|
nuclear@0
|
65 vorbis_look_transform **transform[2]; /* block, type */
|
nuclear@0
|
66 drft_lookup fft_look[2];
|
nuclear@0
|
67
|
nuclear@0
|
68 int modebits;
|
nuclear@0
|
69 vorbis_look_floor **flr;
|
nuclear@0
|
70 vorbis_look_residue **residue;
|
nuclear@0
|
71 vorbis_look_psy *psy;
|
nuclear@0
|
72 vorbis_look_psy_global *psy_g_look;
|
nuclear@0
|
73
|
nuclear@0
|
74 /* local storage, only used on the encoding side. This way the
|
nuclear@0
|
75 application does not need to worry about freeing some packets'
|
nuclear@0
|
76 memory and not others'; packet storage is always tracked.
|
nuclear@0
|
77 Cleared next call to a _dsp_ function */
|
nuclear@0
|
78 unsigned char *header;
|
nuclear@0
|
79 unsigned char *header1;
|
nuclear@0
|
80 unsigned char *header2;
|
nuclear@0
|
81
|
nuclear@0
|
82 bitrate_manager_state bms;
|
nuclear@0
|
83
|
nuclear@0
|
84 ogg_int64_t sample_count;
|
nuclear@0
|
85 } private_state;
|
nuclear@0
|
86
|
nuclear@0
|
87 /* codec_setup_info contains all the setup information specific to the
|
nuclear@0
|
88 specific compression/decompression mode in progress (eg,
|
nuclear@0
|
89 psychoacoustic settings, channel setup, options, codebook
|
nuclear@0
|
90 etc).
|
nuclear@0
|
91 *********************************************************************/
|
nuclear@0
|
92
|
nuclear@0
|
93 #include "highlevel.h"
|
nuclear@0
|
94 typedef struct codec_setup_info {
|
nuclear@0
|
95
|
nuclear@0
|
96 /* Vorbis supports only short and long blocks, but allows the
|
nuclear@0
|
97 encoder to choose the sizes */
|
nuclear@0
|
98
|
nuclear@0
|
99 long blocksizes[2];
|
nuclear@0
|
100
|
nuclear@0
|
101 /* modes are the primary means of supporting on-the-fly different
|
nuclear@0
|
102 blocksizes, different channel mappings (LR or M/A),
|
nuclear@0
|
103 different residue backends, etc. Each mode consists of a
|
nuclear@0
|
104 blocksize flag and a mapping (along with the mapping setup */
|
nuclear@0
|
105
|
nuclear@0
|
106 int modes;
|
nuclear@0
|
107 int maps;
|
nuclear@0
|
108 int floors;
|
nuclear@0
|
109 int residues;
|
nuclear@0
|
110 int books;
|
nuclear@0
|
111 int psys; /* encode only */
|
nuclear@0
|
112
|
nuclear@0
|
113 vorbis_info_mode *mode_param[64];
|
nuclear@0
|
114 int map_type[64];
|
nuclear@0
|
115 vorbis_info_mapping *map_param[64];
|
nuclear@0
|
116 int floor_type[64];
|
nuclear@0
|
117 vorbis_info_floor *floor_param[64];
|
nuclear@0
|
118 int residue_type[64];
|
nuclear@0
|
119 vorbis_info_residue *residue_param[64];
|
nuclear@0
|
120 static_codebook *book_param[256];
|
nuclear@0
|
121 codebook *fullbooks;
|
nuclear@0
|
122
|
nuclear@0
|
123 vorbis_info_psy *psy_param[4]; /* encode only */
|
nuclear@0
|
124 vorbis_info_psy_global psy_g_param;
|
nuclear@0
|
125
|
nuclear@0
|
126 bitrate_manager_info bi;
|
nuclear@0
|
127 highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
|
nuclear@0
|
128 highly redundant structure, but
|
nuclear@0
|
129 improves clarity of program flow. */
|
nuclear@0
|
130 int halfrate_flag; /* painless downsample for decode */
|
nuclear@0
|
131 } codec_setup_info;
|
nuclear@0
|
132
|
nuclear@0
|
133 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
|
nuclear@0
|
134 extern void _vp_global_free(vorbis_look_psy_global *look);
|
nuclear@0
|
135
|
nuclear@0
|
136
|
nuclear@0
|
137
|
nuclear@0
|
138 typedef struct {
|
nuclear@0
|
139 int sorted_index[VIF_POSIT+2];
|
nuclear@0
|
140 int forward_index[VIF_POSIT+2];
|
nuclear@0
|
141 int reverse_index[VIF_POSIT+2];
|
nuclear@0
|
142
|
nuclear@0
|
143 int hineighbor[VIF_POSIT];
|
nuclear@0
|
144 int loneighbor[VIF_POSIT];
|
nuclear@0
|
145 int posts;
|
nuclear@0
|
146
|
nuclear@0
|
147 int n;
|
nuclear@0
|
148 int quant_q;
|
nuclear@0
|
149 vorbis_info_floor1 *vi;
|
nuclear@0
|
150
|
nuclear@0
|
151 long phrasebits;
|
nuclear@0
|
152 long postbits;
|
nuclear@0
|
153 long frames;
|
nuclear@0
|
154 } vorbis_look_floor1;
|
nuclear@0
|
155
|
nuclear@0
|
156
|
nuclear@0
|
157
|
nuclear@0
|
158 extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
nuclear@0
|
159 const float *logmdct, /* in */
|
nuclear@0
|
160 const float *logmask);
|
nuclear@0
|
161 extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
nuclear@0
|
162 int *A,int *B,
|
nuclear@0
|
163 int del);
|
nuclear@0
|
164 extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
nuclear@0
|
165 vorbis_look_floor1 *look,
|
nuclear@0
|
166 int *post,int *ilogmask);
|
nuclear@0
|
167 #endif
|