gosu 0.8.0.pre3 → 0.8.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Buttons.hpp +13 -11
  3. data/{linux → ext/gosu}/extconf.rb +25 -47
  4. data/{GosuImpl/RubyGosu_wrap.cxx → ext/gosu/gosu_wrap.cxx} +3 -2
  5. data/{GosuImpl/RubyGosu_wrap.h → ext/gosu/gosu_wrap.h} +0 -0
  6. data/lib/gosu.rb +6 -7
  7. data/lib/gosu/zen.rb +12 -0
  8. data/{GosuImpl → src}/Audio/ALChannelManagement.hpp +0 -0
  9. data/{GosuImpl → src}/Audio/AudioFile.hpp +0 -0
  10. data/{GosuImpl → src}/Audio/AudioOpenAL.cpp +0 -0
  11. data/{GosuImpl → src}/Audio/AudioOpenAL.mm +0 -0
  12. data/{GosuImpl → src}/Audio/AudioToolboxFile.hpp +0 -0
  13. data/{GosuImpl → src}/Audio/OggFile.hpp +0 -0
  14. data/{GosuImpl → src}/Audio/SndFile.hpp +0 -0
  15. data/{GosuImpl/Graphics → src/Bitmap}/Bitmap.cpp +2 -0
  16. data/{GosuImpl/Graphics → src/Bitmap}/BitmapApple.mm +0 -0
  17. data/{GosuImpl/Graphics → src/Bitmap}/BitmapBMP.cpp +0 -0
  18. data/{GosuImpl/Graphics → src/Bitmap}/BitmapColorKey.cpp +0 -0
  19. data/{GosuImpl/Graphics → src/Bitmap}/BitmapFreeImage.cpp +0 -0
  20. data/{GosuImpl/Graphics → src/Bitmap}/BitmapGDIplus.cpp +0 -0
  21. data/{GosuImpl/Graphics → src/Bitmap}/BitmapUtils.cpp +0 -0
  22. data/{GosuImpl → src}/DirectoriesMac.mm +0 -0
  23. data/{GosuImpl → src}/DirectoriesTouch.mm +0 -0
  24. data/{GosuImpl → src}/DirectoriesUnix.cpp +0 -0
  25. data/{GosuImpl → src}/DirectoriesWin.cpp +0 -0
  26. data/{GosuImpl → src}/FileUnix.cpp +0 -0
  27. data/{GosuImpl → src}/FileWin.cpp +0 -0
  28. data/{GosuImpl/Graphics → src}/GosuView.hpp +0 -0
  29. data/{GosuImpl/Graphics → src}/GosuView.mm +0 -0
  30. data/{GosuImpl → src}/Graphics/BlockAllocator.cpp +0 -0
  31. data/{GosuImpl → src}/Graphics/BlockAllocator.hpp +0 -0
  32. data/{GosuImpl → src}/Graphics/ClipRectStack.hpp +0 -0
  33. data/{GosuImpl → src}/Graphics/Color.cpp +0 -0
  34. data/{GosuImpl → src}/Graphics/Common.hpp +0 -0
  35. data/{GosuImpl → src}/Graphics/DrawOp.hpp +0 -0
  36. data/{GosuImpl → src}/Graphics/DrawOpQueue.hpp +0 -0
  37. data/{GosuImpl → src}/Graphics/Graphics.cpp +0 -0
  38. data/{GosuImpl → src}/Graphics/Image.cpp +0 -0
  39. data/{GosuImpl → src}/Graphics/LargeImageData.cpp +0 -0
  40. data/{GosuImpl → src}/Graphics/LargeImageData.hpp +0 -0
  41. data/{GosuImpl → src}/Graphics/Macro.hpp +0 -0
  42. data/{GosuImpl → src}/Graphics/RenderState.hpp +0 -0
  43. data/{GosuImpl → src}/Graphics/TexChunk.cpp +0 -0
  44. data/{GosuImpl → src}/Graphics/TexChunk.hpp +0 -0
  45. data/{GosuImpl → src}/Graphics/Texture.cpp +0 -0
  46. data/{GosuImpl → src}/Graphics/Texture.hpp +0 -0
  47. data/{GosuImpl → src}/Graphics/Transform.cpp +0 -0
  48. data/{GosuImpl → src}/Graphics/TransformStack.hpp +0 -0
  49. data/{GosuImpl → src}/IO.cpp +0 -0
  50. data/{GosuImpl → src}/Iconv.hpp +0 -0
  51. data/{GosuImpl → src}/Input/AccelerometerReader.hpp +0 -0
  52. data/{GosuImpl → src}/Input/AccelerometerReader.mm +0 -0
  53. data/{GosuImpl → src/Input}/Input.cpp +0 -0
  54. data/{GosuImpl → src/Input}/InputTouch.mm +0 -0
  55. data/{GosuImpl → src/Input}/TextInput.cpp +0 -0
  56. data/{GosuImpl → src/Input}/TextInputMac.mm +0 -0
  57. data/{GosuImpl → src}/Inspection.cpp +0 -0
  58. data/{GosuImpl → src}/MacUtility.hpp +0 -0
  59. data/{GosuImpl → src}/Math.cpp +0 -0
  60. data/{GosuImpl → src}/Sockets/CommSocket.cpp +0 -0
  61. data/{GosuImpl → src}/Sockets/ListenerSocket.cpp +0 -0
  62. data/{GosuImpl → src}/Sockets/MessageSocket.cpp +0 -0
  63. data/{GosuImpl → src}/Sockets/Socket.cpp +0 -0
  64. data/{GosuImpl → src}/Sockets/Socket.hpp +0 -0
  65. data/{GosuImpl/Graphics → src/Text}/Font.cpp +1 -1
  66. data/{GosuImpl/Graphics → src/Text}/FormattedString.hpp +0 -0
  67. data/{GosuImpl/Graphics → src/Text}/Text.cpp +1 -1
  68. data/{GosuImpl/Graphics/TextTouch.mm → src/Text/TextApple.mm} +0 -0
  69. data/{GosuImpl/Graphics → src/Text}/TextMac.cpp +1 -1
  70. data/{GosuImpl/Graphics → src/Text}/TextTTFWin.cpp +0 -0
  71. data/{GosuImpl/Graphics → src/Text}/TextUnix.cpp +0 -0
  72. data/{GosuImpl/Graphics → src/Text}/TextWin.cpp +0 -0
  73. data/{GosuImpl → src}/TimingApple.cpp +0 -0
  74. data/{GosuImpl → src}/TimingUnix.cpp +0 -0
  75. data/{GosuImpl → src}/TimingWin.cpp +0 -0
  76. data/{GosuImpl → src}/Utility.cpp +0 -0
  77. data/{GosuImpl → src}/UtilityApple.mm +0 -0
  78. data/{GosuImpl → src}/UtilityWin.cpp +0 -0
  79. data/{GosuImpl → src}/WinMain.cpp +0 -0
  80. data/{GosuImpl → src}/WinUtility.cpp +0 -0
  81. data/{GosuImpl → src}/Window.cpp +0 -0
  82. data/{GosuImpl → src}/WindowTouch.mm +0 -0
  83. data/{GosuImpl → src}/X11vroot.h +0 -0
  84. metadata +97 -193
  85. data/.yardopts +0 -1
  86. data/COPYING +0 -29
  87. data/GosuImpl/InputMac.mm +0 -733
  88. data/GosuImpl/InputWin.cpp +0 -483
  89. data/GosuImpl/InputX.cpp +0 -243
  90. data/GosuImpl/RubyGosu.swg +0 -821
  91. data/GosuImpl/RubyGosu_SWIG_GC_PATCH.patch +0 -126
  92. data/GosuImpl/RubyGosu_SWIG_RENAME_PATCH.patch +0 -62
  93. data/GosuImpl/TextInputWin.cpp +0 -211
  94. data/GosuImpl/TextInputX.cpp +0 -217
  95. data/GosuImpl/WindowWin.cpp +0 -534
  96. data/GosuImpl/WindowX.cpp +0 -458
  97. data/README.txt +0 -25
  98. data/dependencies/libogg/AUTHORS +0 -4
  99. data/dependencies/libogg/CHANGES +0 -70
  100. data/dependencies/libogg/COPYING +0 -28
  101. data/dependencies/libogg/include/ogg/ogg.h +0 -209
  102. data/dependencies/libogg/include/ogg/os_types.h +0 -147
  103. data/dependencies/libogg/src/bitwise.c +0 -857
  104. data/dependencies/libogg/src/framing.c +0 -2089
  105. data/dependencies/libvorbis/AUTHORS +0 -3
  106. data/dependencies/libvorbis/CHANGES +0 -126
  107. data/dependencies/libvorbis/COPYING +0 -28
  108. data/dependencies/libvorbis/include/vorbis/codec.h +0 -243
  109. data/dependencies/libvorbis/include/vorbis/vorbisenc.h +0 -436
  110. data/dependencies/libvorbis/include/vorbis/vorbisfile.h +0 -206
  111. data/dependencies/libvorbis/lib/analysis.c +0 -120
  112. data/dependencies/libvorbis/lib/backends.h +0 -144
  113. data/dependencies/libvorbis/lib/barkmel.c +0 -64
  114. data/dependencies/libvorbis/lib/bitrate.c +0 -253
  115. data/dependencies/libvorbis/lib/bitrate.h +0 -59
  116. data/dependencies/libvorbis/lib/block.c +0 -1046
  117. data/dependencies/libvorbis/lib/books/coupled/res_books_51.h +0 -12257
  118. data/dependencies/libvorbis/lib/books/coupled/res_books_stereo.h +0 -15783
  119. data/dependencies/libvorbis/lib/books/floor/floor_books.h +0 -1547
  120. data/dependencies/libvorbis/lib/books/uncoupled/res_books_uncoupled.h +0 -7758
  121. data/dependencies/libvorbis/lib/codebook.c +0 -479
  122. data/dependencies/libvorbis/lib/codebook.h +0 -119
  123. data/dependencies/libvorbis/lib/codec_internal.h +0 -167
  124. data/dependencies/libvorbis/lib/envelope.c +0 -375
  125. data/dependencies/libvorbis/lib/envelope.h +0 -80
  126. data/dependencies/libvorbis/lib/floor0.c +0 -222
  127. data/dependencies/libvorbis/lib/floor1.c +0 -1099
  128. data/dependencies/libvorbis/lib/highlevel.h +0 -58
  129. data/dependencies/libvorbis/lib/info.c +0 -664
  130. data/dependencies/libvorbis/lib/lookup.c +0 -94
  131. data/dependencies/libvorbis/lib/lookup.h +0 -32
  132. data/dependencies/libvorbis/lib/lookup_data.h +0 -192
  133. data/dependencies/libvorbis/lib/lpc.c +0 -160
  134. data/dependencies/libvorbis/lib/lpc.h +0 -29
  135. data/dependencies/libvorbis/lib/lsp.c +0 -456
  136. data/dependencies/libvorbis/lib/lsp.h +0 -28
  137. data/dependencies/libvorbis/lib/mapping0.c +0 -816
  138. data/dependencies/libvorbis/lib/masking.h +0 -785
  139. data/dependencies/libvorbis/lib/mdct.c +0 -563
  140. data/dependencies/libvorbis/lib/mdct.h +0 -71
  141. data/dependencies/libvorbis/lib/misc.h +0 -57
  142. data/dependencies/libvorbis/lib/modes/floor_all.h +0 -260
  143. data/dependencies/libvorbis/lib/modes/psych_11.h +0 -51
  144. data/dependencies/libvorbis/lib/modes/psych_16.h +0 -133
  145. data/dependencies/libvorbis/lib/modes/psych_44.h +0 -642
  146. data/dependencies/libvorbis/lib/modes/psych_8.h +0 -101
  147. data/dependencies/libvorbis/lib/modes/residue_16.h +0 -163
  148. data/dependencies/libvorbis/lib/modes/residue_44.h +0 -292
  149. data/dependencies/libvorbis/lib/modes/residue_44p51.h +0 -451
  150. data/dependencies/libvorbis/lib/modes/residue_44u.h +0 -318
  151. data/dependencies/libvorbis/lib/modes/residue_8.h +0 -109
  152. data/dependencies/libvorbis/lib/modes/setup_11.h +0 -143
  153. data/dependencies/libvorbis/lib/modes/setup_16.h +0 -153
  154. data/dependencies/libvorbis/lib/modes/setup_22.h +0 -128
  155. data/dependencies/libvorbis/lib/modes/setup_32.h +0 -132
  156. data/dependencies/libvorbis/lib/modes/setup_44.h +0 -117
  157. data/dependencies/libvorbis/lib/modes/setup_44p51.h +0 -74
  158. data/dependencies/libvorbis/lib/modes/setup_44u.h +0 -74
  159. data/dependencies/libvorbis/lib/modes/setup_8.h +0 -149
  160. data/dependencies/libvorbis/lib/modes/setup_X.h +0 -225
  161. data/dependencies/libvorbis/lib/os.h +0 -186
  162. data/dependencies/libvorbis/lib/psy.c +0 -1203
  163. data/dependencies/libvorbis/lib/psy.h +0 -154
  164. data/dependencies/libvorbis/lib/psytune.c +0 -524
  165. data/dependencies/libvorbis/lib/registry.c +0 -45
  166. data/dependencies/libvorbis/lib/registry.h +0 -32
  167. data/dependencies/libvorbis/lib/res0.c +0 -889
  168. data/dependencies/libvorbis/lib/scales.h +0 -90
  169. data/dependencies/libvorbis/lib/sharedbook.c +0 -579
  170. data/dependencies/libvorbis/lib/smallft.c +0 -1255
  171. data/dependencies/libvorbis/lib/smallft.h +0 -34
  172. data/dependencies/libvorbis/lib/synthesis.c +0 -184
  173. data/dependencies/libvorbis/lib/tone.c +0 -54
  174. data/dependencies/libvorbis/lib/vorbisenc.c +0 -1215
  175. data/dependencies/libvorbis/lib/vorbisfile.c +0 -2337
  176. data/dependencies/libvorbis/lib/window.c +0 -2135
  177. data/dependencies/libvorbis/lib/window.h +0 -26
  178. data/dependencies/ogg_vorbis.license +0 -28
  179. data/reference/gosu.rb +0 -1284
@@ -1,119 +0,0 @@
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: basic shared codebook operations
14
- last mod: $Id: codebook.h 17030 2010-03-25 06:52:55Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #ifndef _V_CODEBOOK_H_
19
- #define _V_CODEBOOK_H_
20
-
21
- #include <ogg/ogg.h>
22
-
23
- /* This structure encapsulates huffman and VQ style encoding books; it
24
- doesn't do anything specific to either.
25
-
26
- valuelist/quantlist are nonNULL (and q_* significant) only if
27
- there's entry->value mapping to be done.
28
-
29
- If encode-side mapping must be done (and thus the entry needs to be
30
- hunted), the auxiliary encode pointer will point to a decision
31
- tree. This is true of both VQ and huffman, but is mostly useful
32
- with VQ.
33
-
34
- */
35
-
36
- typedef struct static_codebook{
37
- long dim; /* codebook dimensions (elements per vector) */
38
- long entries; /* codebook entries */
39
- long *lengthlist; /* codeword lengths in bits */
40
-
41
- /* mapping ***************************************************************/
42
- int maptype; /* 0=none
43
- 1=implicitly populated values from map column
44
- 2=listed arbitrary values */
45
-
46
- /* The below does a linear, single monotonic sequence mapping. */
47
- long q_min; /* packed 32 bit float; quant value 0 maps to minval */
48
- long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
49
- int q_quant; /* bits: 0 < quant <= 16 */
50
- int q_sequencep; /* bitflag */
51
-
52
- long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
53
- map == 2: list of dim*entries quantized entry vals
54
- */
55
- int allocedp;
56
- } static_codebook;
57
-
58
- typedef struct codebook{
59
- long dim; /* codebook dimensions (elements per vector) */
60
- long entries; /* codebook entries */
61
- long used_entries; /* populated codebook entries */
62
- const static_codebook *c;
63
-
64
- /* for encode, the below are entry-ordered, fully populated */
65
- /* for decode, the below are ordered by bitreversed codeword and only
66
- used entries are populated */
67
- float *valuelist; /* list of dim*entries actual entry values */
68
- ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
69
-
70
- int *dec_index; /* only used if sparseness collapsed */
71
- char *dec_codelengths;
72
- ogg_uint32_t *dec_firsttable;
73
- int dec_firsttablen;
74
- int dec_maxlength;
75
-
76
- /* The current encoder uses only centered, integer-only lattice books. */
77
- int quantvals;
78
- int minval;
79
- int delta;
80
- } codebook;
81
-
82
- extern void vorbis_staticbook_destroy(static_codebook *b);
83
- extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
84
- extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
85
- extern void vorbis_book_clear(codebook *b);
86
-
87
- extern float *_book_unquantize(const static_codebook *b,int n,int *map);
88
- extern float *_book_logdist(const static_codebook *b,float *vals);
89
- extern float _float32_unpack(long val);
90
- extern long _float32_pack(float val);
91
- extern int _best(codebook *book, float *a, int step);
92
- extern int _ilog(unsigned int v);
93
- extern long _book_maptype1_quantvals(const static_codebook *b);
94
-
95
- extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
96
- extern long vorbis_book_codeword(codebook *book,int entry);
97
- extern long vorbis_book_codelen(codebook *book,int entry);
98
-
99
-
100
-
101
- extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
102
- extern static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b);
103
-
104
- extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
105
-
106
- extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
107
- extern long vorbis_book_decodevs_add(codebook *book, float *a,
108
- oggpack_buffer *b,int n);
109
- extern long vorbis_book_decodev_set(codebook *book, float *a,
110
- oggpack_buffer *b,int n);
111
- extern long vorbis_book_decodev_add(codebook *book, float *a,
112
- oggpack_buffer *b,int n);
113
- extern long vorbis_book_decodevv_add(codebook *book, float **a,
114
- long off,int ch,
115
- oggpack_buffer *b,int n);
116
-
117
-
118
-
119
- #endif
@@ -1,167 +0,0 @@
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 codec headers
14
- last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #ifndef _V_CODECI_H_
19
- #define _V_CODECI_H_
20
-
21
- #include "envelope.h"
22
- #include "codebook.h"
23
-
24
- #define BLOCKTYPE_IMPULSE 0
25
- #define BLOCKTYPE_PADDING 1
26
- #define BLOCKTYPE_TRANSITION 0
27
- #define BLOCKTYPE_LONG 1
28
-
29
- #define PACKETBLOBS 15
30
-
31
- typedef struct vorbis_block_internal{
32
- float **pcmdelay; /* this is a pointer into local storage */
33
- float ampmax;
34
- int blocktype;
35
-
36
- oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
37
- blob [PACKETBLOBS/2] points to
38
- the oggpack_buffer in the
39
- main vorbis_block */
40
- } vorbis_block_internal;
41
-
42
- typedef void vorbis_look_floor;
43
- typedef void vorbis_look_residue;
44
- typedef void vorbis_look_transform;
45
-
46
- /* mode ************************************************************/
47
- typedef struct {
48
- int blockflag;
49
- int windowtype;
50
- int transformtype;
51
- int mapping;
52
- } vorbis_info_mode;
53
-
54
- typedef void vorbis_info_floor;
55
- typedef void vorbis_info_residue;
56
- typedef void vorbis_info_mapping;
57
-
58
- #include "psy.h"
59
- #include "bitrate.h"
60
-
61
- typedef struct private_state {
62
- /* local lookup storage */
63
- envelope_lookup *ve; /* envelope lookup */
64
- int window[2];
65
- vorbis_look_transform **transform[2]; /* block, type */
66
- drft_lookup fft_look[2];
67
-
68
- int modebits;
69
- vorbis_look_floor **flr;
70
- vorbis_look_residue **residue;
71
- vorbis_look_psy *psy;
72
- vorbis_look_psy_global *psy_g_look;
73
-
74
- /* local storage, only used on the encoding side. This way the
75
- application does not need to worry about freeing some packets'
76
- memory and not others'; packet storage is always tracked.
77
- Cleared next call to a _dsp_ function */
78
- unsigned char *header;
79
- unsigned char *header1;
80
- unsigned char *header2;
81
-
82
- bitrate_manager_state bms;
83
-
84
- ogg_int64_t sample_count;
85
- } private_state;
86
-
87
- /* codec_setup_info contains all the setup information specific to the
88
- specific compression/decompression mode in progress (eg,
89
- psychoacoustic settings, channel setup, options, codebook
90
- etc).
91
- *********************************************************************/
92
-
93
- #include "highlevel.h"
94
- typedef struct codec_setup_info {
95
-
96
- /* Vorbis supports only short and long blocks, but allows the
97
- encoder to choose the sizes */
98
-
99
- long blocksizes[2];
100
-
101
- /* modes are the primary means of supporting on-the-fly different
102
- blocksizes, different channel mappings (LR or M/A),
103
- different residue backends, etc. Each mode consists of a
104
- blocksize flag and a mapping (along with the mapping setup */
105
-
106
- int modes;
107
- int maps;
108
- int floors;
109
- int residues;
110
- int books;
111
- int psys; /* encode only */
112
-
113
- vorbis_info_mode *mode_param[64];
114
- int map_type[64];
115
- vorbis_info_mapping *map_param[64];
116
- int floor_type[64];
117
- vorbis_info_floor *floor_param[64];
118
- int residue_type[64];
119
- vorbis_info_residue *residue_param[64];
120
- static_codebook *book_param[256];
121
- codebook *fullbooks;
122
-
123
- vorbis_info_psy *psy_param[4]; /* encode only */
124
- vorbis_info_psy_global psy_g_param;
125
-
126
- bitrate_manager_info bi;
127
- highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
128
- highly redundant structure, but
129
- improves clarity of program flow. */
130
- int halfrate_flag; /* painless downsample for decode */
131
- } codec_setup_info;
132
-
133
- extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
134
- extern void _vp_global_free(vorbis_look_psy_global *look);
135
-
136
-
137
-
138
- typedef struct {
139
- int sorted_index[VIF_POSIT+2];
140
- int forward_index[VIF_POSIT+2];
141
- int reverse_index[VIF_POSIT+2];
142
-
143
- int hineighbor[VIF_POSIT];
144
- int loneighbor[VIF_POSIT];
145
- int posts;
146
-
147
- int n;
148
- int quant_q;
149
- vorbis_info_floor1 *vi;
150
-
151
- long phrasebits;
152
- long postbits;
153
- long frames;
154
- } vorbis_look_floor1;
155
-
156
-
157
-
158
- extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
159
- const float *logmdct, /* in */
160
- const float *logmask);
161
- extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
162
- int *A,int *B,
163
- int del);
164
- extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
165
- vorbis_look_floor1 *look,
166
- int *post,int *ilogmask);
167
- #endif
@@ -1,375 +0,0 @@
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: PCM data envelope analysis
14
- last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #include <stdlib.h>
19
- #include <string.h>
20
- #include <stdio.h>
21
- #include <math.h>
22
- #include <ogg/ogg.h>
23
- #include "vorbis/codec.h"
24
- #include "codec_internal.h"
25
-
26
- #include "os.h"
27
- #include "scales.h"
28
- #include "envelope.h"
29
- #include "mdct.h"
30
- #include "misc.h"
31
-
32
- void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
33
- codec_setup_info *ci=vi->codec_setup;
34
- vorbis_info_psy_global *gi=&ci->psy_g_param;
35
- int ch=vi->channels;
36
- int i,j;
37
- int n=e->winlength=128;
38
- e->searchstep=64; /* not random */
39
-
40
- e->minenergy=gi->preecho_minenergy;
41
- e->ch=ch;
42
- e->storage=128;
43
- e->cursor=ci->blocksizes[1]/2;
44
- e->mdct_win=_ogg_calloc(n,sizeof(*e->mdct_win));
45
- mdct_init(&e->mdct,n);
46
-
47
- for(i=0;i<n;i++){
48
- e->mdct_win[i]=sin(i/(n-1.)*M_PI);
49
- e->mdct_win[i]*=e->mdct_win[i];
50
- }
51
-
52
- /* magic follows */
53
- e->band[0].begin=2; e->band[0].end=4;
54
- e->band[1].begin=4; e->band[1].end=5;
55
- e->band[2].begin=6; e->band[2].end=6;
56
- e->band[3].begin=9; e->band[3].end=8;
57
- e->band[4].begin=13; e->band[4].end=8;
58
- e->band[5].begin=17; e->band[5].end=8;
59
- e->band[6].begin=22; e->band[6].end=8;
60
-
61
- for(j=0;j<VE_BANDS;j++){
62
- n=e->band[j].end;
63
- e->band[j].window=_ogg_malloc(n*sizeof(*e->band[0].window));
64
- for(i=0;i<n;i++){
65
- e->band[j].window[i]=sin((i+.5)/n*M_PI);
66
- e->band[j].total+=e->band[j].window[i];
67
- }
68
- e->band[j].total=1./e->band[j].total;
69
- }
70
-
71
- e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter));
72
- e->mark=_ogg_calloc(e->storage,sizeof(*e->mark));
73
-
74
- }
75
-
76
- void _ve_envelope_clear(envelope_lookup *e){
77
- int i;
78
- mdct_clear(&e->mdct);
79
- for(i=0;i<VE_BANDS;i++)
80
- _ogg_free(e->band[i].window);
81
- _ogg_free(e->mdct_win);
82
- _ogg_free(e->filter);
83
- _ogg_free(e->mark);
84
- memset(e,0,sizeof(*e));
85
- }
86
-
87
- /* fairly straight threshhold-by-band based until we find something
88
- that works better and isn't patented. */
89
-
90
- static int _ve_amp(envelope_lookup *ve,
91
- vorbis_info_psy_global *gi,
92
- float *data,
93
- envelope_band *bands,
94
- envelope_filter_state *filters){
95
- long n=ve->winlength;
96
- int ret=0;
97
- long i,j;
98
- float decay;
99
-
100
- /* we want to have a 'minimum bar' for energy, else we're just
101
- basing blocks on quantization noise that outweighs the signal
102
- itself (for low power signals) */
103
-
104
- float minV=ve->minenergy;
105
- float *vec=alloca(n*sizeof(*vec));
106
-
107
- /* stretch is used to gradually lengthen the number of windows
108
- considered prevoius-to-potential-trigger */
109
- int stretch=max(VE_MINSTRETCH,ve->stretch/2);
110
- float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH);
111
- if(penalty<0.f)penalty=0.f;
112
- if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty;
113
-
114
- /*_analysis_output_always("lpcm",seq2,data,n,0,0,
115
- totalshift+pos*ve->searchstep);*/
116
-
117
- /* window and transform */
118
- for(i=0;i<n;i++)
119
- vec[i]=data[i]*ve->mdct_win[i];
120
- mdct_forward(&ve->mdct,vec,vec);
121
-
122
- /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
123
-
124
- /* near-DC spreading function; this has nothing to do with
125
- psychoacoustics, just sidelobe leakage and window size */
126
- {
127
- float temp=vec[0]*vec[0]+.7*vec[1]*vec[1]+.2*vec[2]*vec[2];
128
- int ptr=filters->nearptr;
129
-
130
- /* the accumulation is regularly refreshed from scratch to avoid
131
- floating point creep */
132
- if(ptr==0){
133
- decay=filters->nearDC_acc=filters->nearDC_partialacc+temp;
134
- filters->nearDC_partialacc=temp;
135
- }else{
136
- decay=filters->nearDC_acc+=temp;
137
- filters->nearDC_partialacc+=temp;
138
- }
139
- filters->nearDC_acc-=filters->nearDC[ptr];
140
- filters->nearDC[ptr]=temp;
141
-
142
- decay*=(1./(VE_NEARDC+1));
143
- filters->nearptr++;
144
- if(filters->nearptr>=VE_NEARDC)filters->nearptr=0;
145
- decay=todB(&decay)*.5-15.f;
146
- }
147
-
148
- /* perform spreading and limiting, also smooth the spectrum. yes,
149
- the MDCT results in all real coefficients, but it still *behaves*
150
- like real/imaginary pairs */
151
- for(i=0;i<n/2;i+=2){
152
- float val=vec[i]*vec[i]+vec[i+1]*vec[i+1];
153
- val=todB(&val)*.5f;
154
- if(val<decay)val=decay;
155
- if(val<minV)val=minV;
156
- vec[i>>1]=val;
157
- decay-=8.;
158
- }
159
-
160
- /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
161
-
162
- /* perform preecho/postecho triggering by band */
163
- for(j=0;j<VE_BANDS;j++){
164
- float acc=0.;
165
- float valmax,valmin;
166
-
167
- /* accumulate amplitude */
168
- for(i=0;i<bands[j].end;i++)
169
- acc+=vec[i+bands[j].begin]*bands[j].window[i];
170
-
171
- acc*=bands[j].total;
172
-
173
- /* convert amplitude to delta */
174
- {
175
- int p,this=filters[j].ampptr;
176
- float postmax,postmin,premax=-99999.f,premin=99999.f;
177
-
178
- p=this;
179
- p--;
180
- if(p<0)p+=VE_AMP;
181
- postmax=max(acc,filters[j].ampbuf[p]);
182
- postmin=min(acc,filters[j].ampbuf[p]);
183
-
184
- for(i=0;i<stretch;i++){
185
- p--;
186
- if(p<0)p+=VE_AMP;
187
- premax=max(premax,filters[j].ampbuf[p]);
188
- premin=min(premin,filters[j].ampbuf[p]);
189
- }
190
-
191
- valmin=postmin-premin;
192
- valmax=postmax-premax;
193
-
194
- /*filters[j].markers[pos]=valmax;*/
195
- filters[j].ampbuf[this]=acc;
196
- filters[j].ampptr++;
197
- if(filters[j].ampptr>=VE_AMP)filters[j].ampptr=0;
198
- }
199
-
200
- /* look at min/max, decide trigger */
201
- if(valmax>gi->preecho_thresh[j]+penalty){
202
- ret|=1;
203
- ret|=4;
204
- }
205
- if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
206
- }
207
-
208
- return(ret);
209
- }
210
-
211
- #if 0
212
- static int seq=0;
213
- static ogg_int64_t totalshift=-1024;
214
- #endif
215
-
216
- long _ve_envelope_search(vorbis_dsp_state *v){
217
- vorbis_info *vi=v->vi;
218
- codec_setup_info *ci=vi->codec_setup;
219
- vorbis_info_psy_global *gi=&ci->psy_g_param;
220
- envelope_lookup *ve=((private_state *)(v->backend_state))->ve;
221
- long i,j;
222
-
223
- int first=ve->current/ve->searchstep;
224
- int last=v->pcm_current/ve->searchstep-VE_WIN;
225
- if(first<0)first=0;
226
-
227
- /* make sure we have enough storage to match the PCM */
228
- if(last+VE_WIN+VE_POST>ve->storage){
229
- ve->storage=last+VE_WIN+VE_POST; /* be sure */
230
- ve->mark=_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark));
231
- }
232
-
233
- for(j=first;j<last;j++){
234
- int ret=0;
235
-
236
- ve->stretch++;
237
- if(ve->stretch>VE_MAXSTRETCH*2)
238
- ve->stretch=VE_MAXSTRETCH*2;
239
-
240
- for(i=0;i<ve->ch;i++){
241
- float *pcm=v->pcm[i]+ve->searchstep*(j);
242
- ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS);
243
- }
244
-
245
- ve->mark[j+VE_POST]=0;
246
- if(ret&1){
247
- ve->mark[j]=1;
248
- ve->mark[j+1]=1;
249
- }
250
-
251
- if(ret&2){
252
- ve->mark[j]=1;
253
- if(j>0)ve->mark[j-1]=1;
254
- }
255
-
256
- if(ret&4)ve->stretch=-1;
257
- }
258
-
259
- ve->current=last*ve->searchstep;
260
-
261
- {
262
- long centerW=v->centerW;
263
- long testW=
264
- centerW+
265
- ci->blocksizes[v->W]/4+
266
- ci->blocksizes[1]/2+
267
- ci->blocksizes[0]/4;
268
-
269
- j=ve->cursor;
270
-
271
- while(j<ve->current-(ve->searchstep)){/* account for postecho
272
- working back one window */
273
- if(j>=testW)return(1);
274
-
275
- ve->cursor=j;
276
-
277
- if(ve->mark[j/ve->searchstep]){
278
- if(j>centerW){
279
-
280
- #if 0
281
- if(j>ve->curmark){
282
- float *marker=alloca(v->pcm_current*sizeof(*marker));
283
- int l,m;
284
- memset(marker,0,sizeof(*marker)*v->pcm_current);
285
- fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n",
286
- seq,
287
- (totalshift+ve->cursor)/44100.,
288
- (totalshift+j)/44100.);
289
- _analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift);
290
- _analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift);
291
-
292
- _analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
293
- _analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
294
-
295
- for(m=0;m<VE_BANDS;m++){
296
- char buf[80];
297
- sprintf(buf,"delL%d",m);
298
- for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1;
299
- _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
300
- }
301
-
302
- for(m=0;m<VE_BANDS;m++){
303
- char buf[80];
304
- sprintf(buf,"delR%d",m);
305
- for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1;
306
- _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
307
- }
308
-
309
- for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->mark[l]*.4;
310
- _analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift);
311
-
312
-
313
- seq++;
314
-
315
- }
316
- #endif
317
-
318
- ve->curmark=j;
319
- if(j>=testW)return(1);
320
- return(0);
321
- }
322
- }
323
- j+=ve->searchstep;
324
- }
325
- }
326
-
327
- return(-1);
328
- }
329
-
330
- int _ve_envelope_mark(vorbis_dsp_state *v){
331
- envelope_lookup *ve=((private_state *)(v->backend_state))->ve;
332
- vorbis_info *vi=v->vi;
333
- codec_setup_info *ci=vi->codec_setup;
334
- long centerW=v->centerW;
335
- long beginW=centerW-ci->blocksizes[v->W]/4;
336
- long endW=centerW+ci->blocksizes[v->W]/4;
337
- if(v->W){
338
- beginW-=ci->blocksizes[v->lW]/4;
339
- endW+=ci->blocksizes[v->nW]/4;
340
- }else{
341
- beginW-=ci->blocksizes[0]/4;
342
- endW+=ci->blocksizes[0]/4;
343
- }
344
-
345
- if(ve->curmark>=beginW && ve->curmark<endW)return(1);
346
- {
347
- long first=beginW/ve->searchstep;
348
- long last=endW/ve->searchstep;
349
- long i;
350
- for(i=first;i<last;i++)
351
- if(ve->mark[i])return(1);
352
- }
353
- return(0);
354
- }
355
-
356
- void _ve_envelope_shift(envelope_lookup *e,long shift){
357
- int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks
358
- ahead of ve->current */
359
- int smallshift=shift/e->searchstep;
360
-
361
- memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
362
-
363
- #if 0
364
- for(i=0;i<VE_BANDS*e->ch;i++)
365
- memmove(e->filter[i].markers,
366
- e->filter[i].markers+smallshift,
367
- (1024-smallshift)*sizeof(*(*e->filter).markers));
368
- totalshift+=shift;
369
- #endif
370
-
371
- e->current-=shift;
372
- if(e->curmark>=0)
373
- e->curmark-=shift;
374
- e->cursor-=shift;
375
- }