gosu 0.7.45 → 0.7.46
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +6 -11
- data/Gosu/{ButtonsWin.hpp → Buttons.hpp} +91 -4
- data/Gosu/ButtonsMac.hpp +91 -4
- data/Gosu/Graphics.hpp +10 -0
- data/Gosu/ImageData.hpp +1 -0
- data/Gosu/Input.hpp +2 -3
- data/Gosu/Version.hpp +2 -2
- data/Gosu/Window.hpp +1 -1
- data/GosuImpl/Audio/AudioToolboxFile.hpp +4 -0
- data/GosuImpl/Graphics/BitmapApple.mm +5 -11
- data/GosuImpl/Graphics/ClipRectStack.hpp +2 -2
- data/GosuImpl/Graphics/Common.hpp +1 -1
- data/GosuImpl/Graphics/DrawOpQueue.hpp +30 -29
- data/GosuImpl/Graphics/Graphics.cpp +2 -3
- data/GosuImpl/Graphics/TextMac.cpp +9 -5
- data/GosuImpl/Graphics/TextTouch.mm +8 -4
- data/GosuImpl/Graphics/Texture.cpp +4 -1
- data/GosuImpl/InputMac.mm +24 -45
- data/GosuImpl/InputX.cpp +25 -39
- data/GosuImpl/RubyGosu.swg +11 -0
- data/GosuImpl/RubyGosu_wrap.cxx +109 -40
- data/GosuImpl/RubyGosu_wrap.h +1 -1
- data/GosuImpl/TextInputWin.cpp +1 -1
- data/GosuImpl/TextInputX.cpp +3 -1
- data/GosuImpl/WinMain.cpp +3 -4
- data/GosuImpl/WindowMac.mm +83 -73
- data/GosuImpl/WindowWin.cpp +65 -58
- data/dependencies/libogg/AUTHORS +4 -0
- data/dependencies/libogg/CHANGES +70 -0
- data/dependencies/libogg/COPYING +28 -0
- data/dependencies/libogg/include/ogg/ogg.h +209 -0
- data/dependencies/libogg/include/ogg/os_types.h +147 -0
- data/dependencies/libogg/src/bitwise.c +857 -0
- data/dependencies/libogg/src/framing.c +2089 -0
- data/dependencies/libvorbis/AUTHORS +3 -0
- data/dependencies/libvorbis/CHANGES +126 -0
- data/dependencies/libvorbis/COPYING +28 -0
- data/dependencies/libvorbis/include/vorbis/codec.h +243 -0
- data/dependencies/libvorbis/include/vorbis/vorbisenc.h +436 -0
- data/dependencies/libvorbis/include/vorbis/vorbisfile.h +206 -0
- data/dependencies/libvorbis/lib/analysis.c +120 -0
- data/dependencies/libvorbis/lib/backends.h +144 -0
- data/dependencies/libvorbis/lib/barkmel.c +64 -0
- data/dependencies/libvorbis/lib/bitrate.c +253 -0
- data/dependencies/libvorbis/lib/bitrate.h +59 -0
- data/dependencies/libvorbis/lib/block.c +1046 -0
- data/dependencies/libvorbis/lib/books/coupled/res_books_51.h +12257 -0
- data/dependencies/libvorbis/lib/books/coupled/res_books_stereo.h +15783 -0
- data/dependencies/libvorbis/lib/books/floor/floor_books.h +1547 -0
- data/dependencies/libvorbis/lib/books/uncoupled/res_books_uncoupled.h +7758 -0
- data/dependencies/libvorbis/lib/codebook.c +479 -0
- data/dependencies/libvorbis/lib/codebook.h +119 -0
- data/dependencies/libvorbis/lib/codec_internal.h +167 -0
- data/dependencies/libvorbis/lib/envelope.c +375 -0
- data/dependencies/libvorbis/lib/envelope.h +80 -0
- data/dependencies/libvorbis/lib/floor0.c +222 -0
- data/dependencies/libvorbis/lib/floor1.c +1099 -0
- data/dependencies/libvorbis/lib/highlevel.h +58 -0
- data/dependencies/libvorbis/lib/info.c +664 -0
- data/dependencies/libvorbis/lib/lookup.c +94 -0
- data/dependencies/libvorbis/lib/lookup.h +32 -0
- data/dependencies/libvorbis/lib/lookup_data.h +192 -0
- data/dependencies/libvorbis/lib/lpc.c +160 -0
- data/dependencies/libvorbis/lib/lpc.h +29 -0
- data/dependencies/libvorbis/lib/lsp.c +456 -0
- data/dependencies/libvorbis/lib/lsp.h +28 -0
- data/dependencies/libvorbis/lib/mapping0.c +816 -0
- data/dependencies/libvorbis/lib/masking.h +785 -0
- data/dependencies/libvorbis/lib/mdct.c +563 -0
- data/dependencies/libvorbis/lib/mdct.h +71 -0
- data/dependencies/libvorbis/lib/misc.h +57 -0
- data/dependencies/libvorbis/lib/modes/floor_all.h +260 -0
- data/dependencies/libvorbis/lib/modes/psych_11.h +51 -0
- data/dependencies/libvorbis/lib/modes/psych_16.h +133 -0
- data/dependencies/libvorbis/lib/modes/psych_44.h +642 -0
- data/dependencies/libvorbis/lib/modes/psych_8.h +101 -0
- data/dependencies/libvorbis/lib/modes/residue_16.h +163 -0
- data/dependencies/libvorbis/lib/modes/residue_44.h +292 -0
- data/dependencies/libvorbis/lib/modes/residue_44p51.h +451 -0
- data/dependencies/libvorbis/lib/modes/residue_44u.h +318 -0
- data/dependencies/libvorbis/lib/modes/residue_8.h +109 -0
- data/dependencies/libvorbis/lib/modes/setup_11.h +143 -0
- data/dependencies/libvorbis/lib/modes/setup_16.h +153 -0
- data/dependencies/libvorbis/lib/modes/setup_22.h +128 -0
- data/dependencies/libvorbis/lib/modes/setup_32.h +132 -0
- data/dependencies/libvorbis/lib/modes/setup_44.h +117 -0
- data/dependencies/libvorbis/lib/modes/setup_44p51.h +74 -0
- data/dependencies/libvorbis/lib/modes/setup_44u.h +74 -0
- data/dependencies/libvorbis/lib/modes/setup_8.h +149 -0
- data/dependencies/libvorbis/lib/modes/setup_X.h +225 -0
- data/dependencies/libvorbis/lib/os.h +186 -0
- data/dependencies/libvorbis/lib/psy.c +1203 -0
- data/dependencies/libvorbis/lib/psy.h +154 -0
- data/dependencies/libvorbis/lib/psytune.c +524 -0
- data/dependencies/libvorbis/lib/registry.c +45 -0
- data/dependencies/libvorbis/lib/registry.h +32 -0
- data/dependencies/libvorbis/lib/res0.c +889 -0
- data/dependencies/libvorbis/lib/scales.h +90 -0
- data/dependencies/libvorbis/lib/sharedbook.c +579 -0
- data/dependencies/libvorbis/lib/smallft.c +1255 -0
- data/dependencies/libvorbis/lib/smallft.h +34 -0
- data/dependencies/libvorbis/lib/synthesis.c +184 -0
- data/dependencies/libvorbis/lib/tone.c +54 -0
- data/dependencies/libvorbis/lib/vorbisenc.c +1215 -0
- data/dependencies/libvorbis/lib/vorbisfile.c +2337 -0
- data/dependencies/libvorbis/lib/window.c +2135 -0
- data/dependencies/libvorbis/lib/window.h +26 -0
- data/dependencies/ogg_vorbis.license +28 -0
- data/lib/gosu/swig_patches.rb +2 -2
- data/linux/extconf.rb +17 -3
- metadata +96 -17
- data/Gosu/ButtonsX.hpp +0 -141
- data/GosuImpl/Audio/AudioSDL.cpp +0 -315
@@ -0,0 +1,206 @@
|
|
1
|
+
/********************************************************************
|
2
|
+
* *
|
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. *
|
7
|
+
* *
|
8
|
+
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
9
|
+
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
10
|
+
* *
|
11
|
+
********************************************************************
|
12
|
+
|
13
|
+
function: stdio-based convenience library for opening/seeking/decoding
|
14
|
+
last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
|
15
|
+
|
16
|
+
********************************************************************/
|
17
|
+
|
18
|
+
#ifndef _OV_FILE_H_
|
19
|
+
#define _OV_FILE_H_
|
20
|
+
|
21
|
+
#ifdef __cplusplus
|
22
|
+
extern "C"
|
23
|
+
{
|
24
|
+
#endif /* __cplusplus */
|
25
|
+
|
26
|
+
#include <stdio.h>
|
27
|
+
#include "codec.h"
|
28
|
+
|
29
|
+
/* The function prototypes for the callbacks are basically the same as for
|
30
|
+
* the stdio functions fread, fseek, fclose, ftell.
|
31
|
+
* The one difference is that the FILE * arguments have been replaced with
|
32
|
+
* a void * - this is to be used as a pointer to whatever internal data these
|
33
|
+
* functions might need. In the stdio case, it's just a FILE * cast to a void *
|
34
|
+
*
|
35
|
+
* If you use other functions, check the docs for these functions and return
|
36
|
+
* the right values. For seek_func(), you *MUST* return -1 if the stream is
|
37
|
+
* unseekable
|
38
|
+
*/
|
39
|
+
typedef struct {
|
40
|
+
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
|
41
|
+
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
|
42
|
+
int (*close_func) (void *datasource);
|
43
|
+
long (*tell_func) (void *datasource);
|
44
|
+
} ov_callbacks;
|
45
|
+
|
46
|
+
#ifndef OV_EXCLUDE_STATIC_CALLBACKS
|
47
|
+
|
48
|
+
/* a few sets of convenient callbacks, especially for use under
|
49
|
+
* Windows where ov_open_callbacks() should always be used instead of
|
50
|
+
* ov_open() to avoid problems with incompatible crt.o version linking
|
51
|
+
* issues. */
|
52
|
+
|
53
|
+
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
54
|
+
if(f==NULL)return(-1);
|
55
|
+
|
56
|
+
#ifdef __MINGW32__
|
57
|
+
return fseeko64(f,off,whence);
|
58
|
+
#elif defined (_WIN32)
|
59
|
+
return _fseeki64(f,off,whence);
|
60
|
+
#else
|
61
|
+
return fseek(f,off,whence);
|
62
|
+
#endif
|
63
|
+
}
|
64
|
+
|
65
|
+
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
|
66
|
+
* static data. That means that every file which includes this header
|
67
|
+
* will get its own copy of these structs whether it uses them or
|
68
|
+
* not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
|
69
|
+
* These static symbols are essential on platforms such as Windows on
|
70
|
+
* which several different versions of stdio support may be linked to
|
71
|
+
* by different DLLs, and we need to be certain we know which one
|
72
|
+
* we're using (the same one as the main application).
|
73
|
+
*/
|
74
|
+
|
75
|
+
static ov_callbacks OV_CALLBACKS_DEFAULT = {
|
76
|
+
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
77
|
+
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
78
|
+
(int (*)(void *)) fclose,
|
79
|
+
(long (*)(void *)) ftell
|
80
|
+
};
|
81
|
+
|
82
|
+
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
|
83
|
+
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
84
|
+
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
85
|
+
(int (*)(void *)) NULL,
|
86
|
+
(long (*)(void *)) ftell
|
87
|
+
};
|
88
|
+
|
89
|
+
static ov_callbacks OV_CALLBACKS_STREAMONLY = {
|
90
|
+
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
91
|
+
(int (*)(void *, ogg_int64_t, int)) NULL,
|
92
|
+
(int (*)(void *)) fclose,
|
93
|
+
(long (*)(void *)) NULL
|
94
|
+
};
|
95
|
+
|
96
|
+
static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
|
97
|
+
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
98
|
+
(int (*)(void *, ogg_int64_t, int)) NULL,
|
99
|
+
(int (*)(void *)) NULL,
|
100
|
+
(long (*)(void *)) NULL
|
101
|
+
};
|
102
|
+
|
103
|
+
#endif
|
104
|
+
|
105
|
+
#define NOTOPEN 0
|
106
|
+
#define PARTOPEN 1
|
107
|
+
#define OPENED 2
|
108
|
+
#define STREAMSET 3
|
109
|
+
#define INITSET 4
|
110
|
+
|
111
|
+
typedef struct OggVorbis_File {
|
112
|
+
void *datasource; /* Pointer to a FILE *, etc. */
|
113
|
+
int seekable;
|
114
|
+
ogg_int64_t offset;
|
115
|
+
ogg_int64_t end;
|
116
|
+
ogg_sync_state oy;
|
117
|
+
|
118
|
+
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
119
|
+
stream appears */
|
120
|
+
int links;
|
121
|
+
ogg_int64_t *offsets;
|
122
|
+
ogg_int64_t *dataoffsets;
|
123
|
+
long *serialnos;
|
124
|
+
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
|
125
|
+
compatibility; x2 size, stores both
|
126
|
+
beginning and end values */
|
127
|
+
vorbis_info *vi;
|
128
|
+
vorbis_comment *vc;
|
129
|
+
|
130
|
+
/* Decoding working state local storage */
|
131
|
+
ogg_int64_t pcm_offset;
|
132
|
+
int ready_state;
|
133
|
+
long current_serialno;
|
134
|
+
int current_link;
|
135
|
+
|
136
|
+
double bittrack;
|
137
|
+
double samptrack;
|
138
|
+
|
139
|
+
ogg_stream_state os; /* take physical pages, weld into a logical
|
140
|
+
stream of packets */
|
141
|
+
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
142
|
+
vorbis_block vb; /* local working space for packet->PCM decode */
|
143
|
+
|
144
|
+
ov_callbacks callbacks;
|
145
|
+
|
146
|
+
} OggVorbis_File;
|
147
|
+
|
148
|
+
|
149
|
+
extern int ov_clear(OggVorbis_File *vf);
|
150
|
+
extern int ov_fopen(const char *path,OggVorbis_File *vf);
|
151
|
+
extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
|
152
|
+
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
153
|
+
const char *initial, long ibytes, ov_callbacks callbacks);
|
154
|
+
|
155
|
+
extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
|
156
|
+
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
157
|
+
const char *initial, long ibytes, ov_callbacks callbacks);
|
158
|
+
extern int ov_test_open(OggVorbis_File *vf);
|
159
|
+
|
160
|
+
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
161
|
+
extern long ov_bitrate_instant(OggVorbis_File *vf);
|
162
|
+
extern long ov_streams(OggVorbis_File *vf);
|
163
|
+
extern long ov_seekable(OggVorbis_File *vf);
|
164
|
+
extern long ov_serialnumber(OggVorbis_File *vf,int i);
|
165
|
+
|
166
|
+
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
|
167
|
+
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
|
168
|
+
extern double ov_time_total(OggVorbis_File *vf,int i);
|
169
|
+
|
170
|
+
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
171
|
+
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
172
|
+
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
|
173
|
+
extern int ov_time_seek(OggVorbis_File *vf,double pos);
|
174
|
+
extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
|
175
|
+
|
176
|
+
extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
177
|
+
extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
178
|
+
extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
179
|
+
extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
|
180
|
+
extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
|
181
|
+
|
182
|
+
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
|
183
|
+
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
|
184
|
+
extern double ov_time_tell(OggVorbis_File *vf);
|
185
|
+
|
186
|
+
extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
|
187
|
+
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
188
|
+
|
189
|
+
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
|
190
|
+
int *bitstream);
|
191
|
+
extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
|
192
|
+
int bigendianp,int word,int sgned,int *bitstream,
|
193
|
+
void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
|
194
|
+
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
195
|
+
int bigendianp,int word,int sgned,int *bitstream);
|
196
|
+
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
|
197
|
+
|
198
|
+
extern int ov_halfrate(OggVorbis_File *vf,int flag);
|
199
|
+
extern int ov_halfrate_p(OggVorbis_File *vf);
|
200
|
+
|
201
|
+
#ifdef __cplusplus
|
202
|
+
}
|
203
|
+
#endif /* __cplusplus */
|
204
|
+
|
205
|
+
#endif
|
206
|
+
|
@@ -0,0 +1,120 @@
|
|
1
|
+
/********************************************************************
|
2
|
+
* *
|
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. *
|
7
|
+
* *
|
8
|
+
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
9
|
+
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
10
|
+
* *
|
11
|
+
********************************************************************
|
12
|
+
|
13
|
+
function: single-block PCM analysis mode dispatch
|
14
|
+
last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
|
15
|
+
|
16
|
+
********************************************************************/
|
17
|
+
|
18
|
+
#include <stdio.h>
|
19
|
+
#include <string.h>
|
20
|
+
#include <math.h>
|
21
|
+
#include <ogg/ogg.h>
|
22
|
+
#include "vorbis/codec.h"
|
23
|
+
#include "codec_internal.h"
|
24
|
+
#include "registry.h"
|
25
|
+
#include "scales.h"
|
26
|
+
#include "os.h"
|
27
|
+
#include "misc.h"
|
28
|
+
|
29
|
+
/* decides between modes, dispatches to the appropriate mapping. */
|
30
|
+
int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
31
|
+
int ret,i;
|
32
|
+
vorbis_block_internal *vbi=vb->internal;
|
33
|
+
|
34
|
+
vb->glue_bits=0;
|
35
|
+
vb->time_bits=0;
|
36
|
+
vb->floor_bits=0;
|
37
|
+
vb->res_bits=0;
|
38
|
+
|
39
|
+
/* first things first. Make sure encode is ready */
|
40
|
+
for(i=0;i<PACKETBLOBS;i++)
|
41
|
+
oggpack_reset(vbi->packetblob[i]);
|
42
|
+
|
43
|
+
/* we only have one mapping type (0), and we let the mapping code
|
44
|
+
itself figure out what soft mode to use. This allows easier
|
45
|
+
bitrate management */
|
46
|
+
|
47
|
+
if((ret=_mapping_P[0]->forward(vb)))
|
48
|
+
return(ret);
|
49
|
+
|
50
|
+
if(op){
|
51
|
+
if(vorbis_bitrate_managed(vb))
|
52
|
+
/* The app is using a bitmanaged mode... but not using the
|
53
|
+
bitrate management interface. */
|
54
|
+
return(OV_EINVAL);
|
55
|
+
|
56
|
+
op->packet=oggpack_get_buffer(&vb->opb);
|
57
|
+
op->bytes=oggpack_bytes(&vb->opb);
|
58
|
+
op->b_o_s=0;
|
59
|
+
op->e_o_s=vb->eofflag;
|
60
|
+
op->granulepos=vb->granulepos;
|
61
|
+
op->packetno=vb->sequence; /* for sake of completeness */
|
62
|
+
}
|
63
|
+
return(0);
|
64
|
+
}
|
65
|
+
|
66
|
+
#ifdef ANALYSIS
|
67
|
+
int analysis_noisy=1;
|
68
|
+
|
69
|
+
/* there was no great place to put this.... */
|
70
|
+
void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
|
71
|
+
int j;
|
72
|
+
FILE *of;
|
73
|
+
char buffer[80];
|
74
|
+
|
75
|
+
sprintf(buffer,"%s_%d.m",base,i);
|
76
|
+
of=fopen(buffer,"w");
|
77
|
+
|
78
|
+
if(!of)perror("failed to open data dump file");
|
79
|
+
|
80
|
+
for(j=0;j<n;j++){
|
81
|
+
if(bark){
|
82
|
+
float b=toBARK((4000.f*j/n)+.25);
|
83
|
+
fprintf(of,"%f ",b);
|
84
|
+
}else
|
85
|
+
if(off!=0)
|
86
|
+
fprintf(of,"%f ",(double)(j+off)/8000.);
|
87
|
+
else
|
88
|
+
fprintf(of,"%f ",(double)j);
|
89
|
+
|
90
|
+
if(dB){
|
91
|
+
float val;
|
92
|
+
if(v[j]==0.)
|
93
|
+
val=-140.;
|
94
|
+
else
|
95
|
+
val=todB(v+j);
|
96
|
+
fprintf(of,"%f\n",val);
|
97
|
+
}else{
|
98
|
+
fprintf(of,"%f\n",v[j]);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
fclose(of);
|
102
|
+
}
|
103
|
+
|
104
|
+
void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
105
|
+
ogg_int64_t off){
|
106
|
+
if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
|
107
|
+
}
|
108
|
+
|
109
|
+
#endif
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/********************************************************************
|
2
|
+
* *
|
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. *
|
7
|
+
* *
|
8
|
+
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
9
|
+
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
10
|
+
* *
|
11
|
+
********************************************************************
|
12
|
+
|
13
|
+
function: libvorbis backend and mapping structures; needed for
|
14
|
+
static mode headers
|
15
|
+
last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $
|
16
|
+
|
17
|
+
********************************************************************/
|
18
|
+
|
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
|
21
|
+
to do so */
|
22
|
+
|
23
|
+
#ifndef _vorbis_backend_h_
|
24
|
+
#define _vorbis_backend_h_
|
25
|
+
|
26
|
+
#include "codec_internal.h"
|
27
|
+
|
28
|
+
/* this would all be simpler/shorter with templates, but.... */
|
29
|
+
/* Floor backend generic *****************************************/
|
30
|
+
typedef struct{
|
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 *);
|
39
|
+
} vorbis_func_floor;
|
40
|
+
|
41
|
+
typedef struct{
|
42
|
+
int order;
|
43
|
+
long rate;
|
44
|
+
long barkmap;
|
45
|
+
|
46
|
+
int ampbits;
|
47
|
+
int ampdB;
|
48
|
+
|
49
|
+
int numbooks; /* <= 16 */
|
50
|
+
int books[16];
|
51
|
+
|
52
|
+
float lessthan; /* encode-only config setting hacks for libvorbis */
|
53
|
+
float greaterthan; /* encode-only config setting hacks for libvorbis */
|
54
|
+
|
55
|
+
} vorbis_info_floor0;
|
56
|
+
|
57
|
+
|
58
|
+
#define VIF_POSIT 63
|
59
|
+
#define VIF_CLASS 16
|
60
|
+
#define VIF_PARTS 31
|
61
|
+
typedef struct{
|
62
|
+
int partitions; /* 0 to 31 */
|
63
|
+
int partitionclass[VIF_PARTS]; /* 0 to 15 */
|
64
|
+
|
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] */
|
69
|
+
|
70
|
+
|
71
|
+
int mult; /* 1 2 3 or 4 */
|
72
|
+
int postlist[VIF_POSIT+2]; /* first two implicit */
|
73
|
+
|
74
|
+
|
75
|
+
/* encode side analysis parameters */
|
76
|
+
float maxover;
|
77
|
+
float maxunder;
|
78
|
+
float maxerr;
|
79
|
+
|
80
|
+
float twofitweight;
|
81
|
+
float twofitatten;
|
82
|
+
|
83
|
+
int n;
|
84
|
+
|
85
|
+
} vorbis_info_floor1;
|
86
|
+
|
87
|
+
/* Residue backend generic *****************************************/
|
88
|
+
typedef struct{
|
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 *,
|
96
|
+
int **,int *,int);
|
97
|
+
int (*forward) (oggpack_buffer *,struct vorbis_block *,
|
98
|
+
vorbis_look_residue *,
|
99
|
+
int **,int *,int,long **,int);
|
100
|
+
int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
|
101
|
+
float **,int *,int);
|
102
|
+
} vorbis_func_residue;
|
103
|
+
|
104
|
+
typedef struct vorbis_info_residue0{
|
105
|
+
/* block-partitioned VQ coded straight residue */
|
106
|
+
long begin;
|
107
|
+
long end;
|
108
|
+
|
109
|
+
/* first stage (lossless partitioning) */
|
110
|
+
int grouping; /* group n vectors per partition */
|
111
|
+
int partitions; /* possible codebooks for a partition */
|
112
|
+
int partvals; /* partitions ^ groupbook dim */
|
113
|
+
int groupbook; /* huffbook for partitioning */
|
114
|
+
int secondstages[64]; /* expanded out to pointers in lookup */
|
115
|
+
int booklist[512]; /* list of second stage books */
|
116
|
+
|
117
|
+
const int classmetric1[64];
|
118
|
+
const int classmetric2[64];
|
119
|
+
} vorbis_info_residue0;
|
120
|
+
|
121
|
+
/* Mapping backend generic *****************************************/
|
122
|
+
typedef struct{
|
123
|
+
void (*pack) (vorbis_info *,vorbis_info_mapping *,
|
124
|
+
oggpack_buffer *);
|
125
|
+
vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
|
126
|
+
void (*free_info) (vorbis_info_mapping *);
|
127
|
+
int (*forward) (struct vorbis_block *vb);
|
128
|
+
int (*inverse) (struct vorbis_block *vb,vorbis_info_mapping *);
|
129
|
+
} vorbis_func_mapping;
|
130
|
+
|
131
|
+
typedef struct vorbis_info_mapping0{
|
132
|
+
int submaps; /* <= 16 */
|
133
|
+
int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
|
134
|
+
|
135
|
+
int floorsubmap[16]; /* [mux] submap to floors */
|
136
|
+
int residuesubmap[16]; /* [mux] submap to residue */
|
137
|
+
|
138
|
+
int coupling_steps;
|
139
|
+
int coupling_mag[256];
|
140
|
+
int coupling_ang[256];
|
141
|
+
|
142
|
+
} vorbis_info_mapping0;
|
143
|
+
|
144
|
+
#endif
|