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,154 +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: random psychoacoustics (not including preecho)
14
- last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #ifndef _V_PSY_H_
19
- #define _V_PSY_H_
20
- #include "smallft.h"
21
-
22
- #include "backends.h"
23
- #include "envelope.h"
24
-
25
- #ifndef EHMER_MAX
26
- #define EHMER_MAX 56
27
- #endif
28
-
29
- /* psychoacoustic setup ********************************************/
30
- #define P_BANDS 17 /* 62Hz to 16kHz */
31
- #define P_LEVELS 8 /* 30dB to 100dB */
32
- #define P_LEVEL_0 30. /* 30 dB */
33
- #define P_NOISECURVES 3
34
-
35
- #define NOISE_COMPAND_LEVELS 40
36
- typedef struct vorbis_info_psy{
37
- int blockflag;
38
-
39
- float ath_adjatt;
40
- float ath_maxatt;
41
-
42
- float tone_masteratt[P_NOISECURVES];
43
- float tone_centerboost;
44
- float tone_decay;
45
- float tone_abs_limit;
46
- float toneatt[P_BANDS];
47
-
48
- int noisemaskp;
49
- float noisemaxsupp;
50
- float noisewindowlo;
51
- float noisewindowhi;
52
- int noisewindowlomin;
53
- int noisewindowhimin;
54
- int noisewindowfixed;
55
- float noiseoff[P_NOISECURVES][P_BANDS];
56
- float noisecompand[NOISE_COMPAND_LEVELS];
57
-
58
- float max_curve_dB;
59
-
60
- int normal_p;
61
- int normal_start;
62
- int normal_partition;
63
- double normal_thresh;
64
- } vorbis_info_psy;
65
-
66
- typedef struct{
67
- int eighth_octave_lines;
68
-
69
- /* for block long/short tuning; encode only */
70
- float preecho_thresh[VE_BANDS];
71
- float postecho_thresh[VE_BANDS];
72
- float stretch_penalty;
73
- float preecho_minenergy;
74
-
75
- float ampmax_att_per_sec;
76
-
77
- /* channel coupling config */
78
- int coupling_pkHz[PACKETBLOBS];
79
- int coupling_pointlimit[2][PACKETBLOBS];
80
- int coupling_prepointamp[PACKETBLOBS];
81
- int coupling_postpointamp[PACKETBLOBS];
82
- int sliding_lowpass[2][PACKETBLOBS];
83
-
84
- } vorbis_info_psy_global;
85
-
86
- typedef struct {
87
- float ampmax;
88
- int channels;
89
-
90
- vorbis_info_psy_global *gi;
91
- int coupling_pointlimit[2][P_NOISECURVES];
92
- } vorbis_look_psy_global;
93
-
94
-
95
- typedef struct {
96
- int n;
97
- struct vorbis_info_psy *vi;
98
-
99
- float ***tonecurves;
100
- float **noiseoffset;
101
-
102
- float *ath;
103
- long *octave; /* in n.ocshift format */
104
- long *bark;
105
-
106
- long firstoc;
107
- long shiftoc;
108
- int eighth_octave_lines; /* power of two, please */
109
- int total_octave_lines;
110
- long rate; /* cache it */
111
-
112
- float m_val; /* Masking compensation value */
113
-
114
- } vorbis_look_psy;
115
-
116
- extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
117
- vorbis_info_psy_global *gi,int n,long rate);
118
- extern void _vp_psy_clear(vorbis_look_psy *p);
119
- extern void *_vi_psy_dup(void *source);
120
-
121
- extern void _vi_psy_free(vorbis_info_psy *i);
122
- extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
123
-
124
- extern void _vp_noisemask(vorbis_look_psy *p,
125
- float *logmdct,
126
- float *logmask);
127
-
128
- extern void _vp_tonemask(vorbis_look_psy *p,
129
- float *logfft,
130
- float *logmask,
131
- float global_specmax,
132
- float local_specmax);
133
-
134
- extern void _vp_offset_and_mix(vorbis_look_psy *p,
135
- float *noise,
136
- float *tone,
137
- int offset_select,
138
- float *logmask,
139
- float *mdct,
140
- float *logmdct);
141
-
142
- extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
143
-
144
- extern void _vp_couple_quantize_normalize(int blobno,
145
- vorbis_info_psy_global *g,
146
- vorbis_look_psy *p,
147
- vorbis_info_mapping0 *vi,
148
- float **mdct,
149
- int **iwork,
150
- int *nonzero,
151
- int sliding_lowpass,
152
- int ch);
153
-
154
- #endif
@@ -1,524 +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-2007 *
9
- * by the Xiph.Org Foundation http://www.xiph.org/ *
10
- * *
11
- ********************************************************************
12
-
13
- function: simple utility that runs audio through the psychoacoustics
14
- without encoding
15
- last mod: $Id: psytune.c 16037 2009-05-26 21:10:58Z xiphmont $
16
-
17
- ********************************************************************/
18
-
19
- /* NB: this is dead code, retained purely for doc and reference value
20
- don't try to compile it */
21
-
22
- #include <stdio.h>
23
- #include <stdlib.h>
24
- #include <string.h>
25
- #include <math.h>
26
-
27
- #include "vorbis/codec.h"
28
- #include "codec_internal.h"
29
- #include "os.h"
30
- #include "misc.h"
31
- #include "psy.h"
32
- #include "mdct.h"
33
- #include "smallft.h"
34
- #include "window.h"
35
- #include "scales.h"
36
- #include "lpc.h"
37
- #include "lsp.h"
38
- #include "masking.h"
39
- #include "registry.h"
40
-
41
- static vorbis_info_psy_global _psy_set0G={
42
- 0, /* decaydBpms */
43
- 8, /* lines per eighth octave */
44
-
45
- /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
46
- 256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
47
- -6.f,
48
-
49
- 0,
50
-
51
- 0.,
52
- 0.,
53
- };
54
-
55
- static vp_part _vp_part0[]={
56
- { 1,9e10f, 9e10f, 1.f,9999.f},
57
- { 9999, .75f, 9e10f, .5f,9999.f},
58
- /*{ 9999, 1.5f, 9e10f, .5f,9999.f},*/
59
- { 18,9e10f, 9e10f, .5f, 30.f},
60
- { 9999,9e10f, 9e10f, .5f, 30.f}
61
- };
62
-
63
- static vp_couple _vp_couple0[]={
64
- { 1, {9e10f,9e10f,0}, { 0.f, 0.f,0}, { 0.f, 0.f,0}, {0.f,0.f,0}},
65
- { 18, {9e10f,9e10f,0}, { 0.f, 0.f,0}, { 0.f, 0.f,0}, {0.f,0.f,0}},
66
- { 9999, {9e10f,9e10f,0}, { 0.f, 9e10f,0}, { 0.f,22.f,1}, {0.f,0.f,0}}
67
- };
68
-
69
- static vorbis_info_psy _psy_set0={
70
- ATH_Bark_dB_lineaggressive,
71
-
72
- -100.f,
73
- -140.f,
74
- 6.f, /* floor master att */
75
-
76
- /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
77
- /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
78
- /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
79
- 1, /* tonemaskp */
80
- 0.f, /* tone master att */
81
- /* 0 10 20 30 40 50 60 70 80 90 100 */
82
- {
83
- {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
84
- {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
85
- {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
86
-
87
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
88
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
89
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
90
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
91
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
92
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
93
- {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
94
- {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
95
- {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
96
- {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
97
-
98
- {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
99
-
100
- {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
101
- {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/
102
- {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/
103
-
104
- },
105
-
106
- 1,/* peakattp */
107
- {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*63*/
108
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*88*/
109
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*125*/
110
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*175*/
111
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*250*/
112
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*350*/
113
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*500*/
114
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*700*/
115
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*1000*/
116
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*1400*/
117
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*2000*/
118
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*2800*/
119
- {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*4000*/
120
- {-10.f,-12.f,-14.f,-16.f,-16.f,-20.f,-24.f,-30.f,-32.f,-40.f,-40.f},/*5600*/
121
- {-10.f,-12.f,-14.f,-16.f,-16.f,-20.f,-24.f,-30.f,-32.f,-40.f,-40.f},/*8000*/
122
- {-10.f,-10.f,-10.f,-12.f,-14.f,-18.f,-22.f,-28.f,-32.f,-40.f,-40.f},/*11500*/
123
- {-10.f,-10.f,-10.f,-12.f,-14.f,-18.f,-22.f,-28.f,-32.f,-40.f,-40.f},/*16000*/
124
- },
125
-
126
- 1,/*noisemaskp */
127
- -10.f, /* suppress any noise curve over maxspec+n */
128
- .5f, /* low window */
129
- .5f, /* high window */
130
- 10,
131
- 10,
132
- 25,
133
- {.000f, 0.f, /*63*/
134
- .000f, 0.f, /*88*/
135
- .000f, 0.f, /*125*/
136
- .000f, 0.f, /*175*/
137
- .000f, 0.f, /*250*/
138
- .000f, 0.f, /*350*/
139
- .000f, 0.f, /*500*/
140
- .000f, 0.f, /*700*/
141
- .000f, 0.f, /*1000*/
142
- .300f, 0.f, /*1400*/
143
- .300f, 0.f, /*2000*/
144
- .300f, 0.f, /*2800*/
145
- .500f, 0.f, /*4000*/
146
- .700f, 0.f, /*5600*/
147
- .850f, 0.f, /*8000*/
148
- .900f, 0.f, /*11500*/
149
- .900f, 1.f, /*16000*/
150
- },
151
-
152
- 95.f, /* even decade + 5 is important; saves an rint() later in a
153
- tight loop) */
154
- -44.,
155
-
156
- 32,
157
- _vp_part0,_vp_couple0
158
- };
159
-
160
- static vorbis_info_floor1 _floor_set0={1,
161
- {0},
162
-
163
- {32},
164
- {0},
165
- {0},
166
- {{-1}},
167
-
168
- 2,
169
- {0,1024,
170
-
171
- 88,31,243,
172
-
173
- 14,54,143,460,
174
-
175
- 6,3,10, 22,18,26, 41,36,47,
176
- 69,61,78, 112,99,126, 185,162,211,
177
- 329,282,387, 672,553,825
178
- },
179
-
180
- 60,30,400,
181
- 20,8,1,18.,
182
- 20,600,
183
- 960};
184
-
185
-
186
- static vorbis_info_mapping0 mapping_info={1,{0,1},{0},{0},{0},0, 1, {0},{1}};
187
- static codec_setup_info codec_setup0={ {0,0},
188
- 1,1,1,1,1,0,1,
189
- {NULL},
190
- {0},{&mapping_info},
191
- {0},{NULL},
192
- {1},{&_floor_set0},
193
- {2},{NULL},
194
- {NULL},
195
- {&_psy_set0},
196
- &_psy_set0G};
197
-
198
- static int noisy=0;
199
- void analysis(char *base,int i,float *v,int n,int bark,int dB){
200
- if(noisy){
201
- int j;
202
- FILE *of;
203
- char buffer[80];
204
- sprintf(buffer,"%s_%d.m",base,i);
205
- of=fopen(buffer,"w");
206
-
207
- for(j=0;j<n;j++){
208
- if(dB && v[j]==0)
209
- fprintf(of,"\n\n");
210
- else{
211
- if(bark)
212
- fprintf(of,"%g ",toBARK(22050.f*j/n));
213
- else
214
- fprintf(of,"%g ",(float)j);
215
-
216
- if(dB){
217
- fprintf(of,"%g\n",todB(v+j));
218
- }else{
219
- fprintf(of,"%g\n",v[j]);
220
- }
221
- }
222
- }
223
- fclose(of);
224
- }
225
- }
226
-
227
- long frameno=0;
228
-
229
- /****************************************************************/
230
-
231
- int main(int argc,char *argv[]){
232
- int eos=0;
233
- float nonz=0.f;
234
- float acc=0.f;
235
- float tot=0.f;
236
- float ampmax=-9999,newmax;
237
- float local_ampmax[2];
238
-
239
- int framesize=2048;
240
- float ampmax_att_per_sec=-6.;
241
-
242
- float *pcm[2],*out[2],*window,*flr[2],*mask[2],*work[2];
243
- signed char *buffer,*buffer2;
244
- mdct_lookup m_look;
245
- drft_lookup f_look;
246
- vorbis_look_psy p_look;
247
- vorbis_look_psy_global *pg_look;
248
- vorbis_look_floor *floor_look;
249
- vorbis_info vi;
250
- long i,j,k;
251
-
252
- int ath=0;
253
- int decayp=0;
254
-
255
- argv++;
256
- while(*argv){
257
- if(*argv[0]=='-'){
258
- /* option */
259
- if(argv[0][1]=='v'){
260
- noisy=0;
261
- }
262
- }else
263
- if(*argv[0]=='+'){
264
- /* option */
265
- if(argv[0][1]=='v'){
266
- noisy=1;
267
- }
268
- }else
269
- framesize=atoi(argv[0]);
270
- argv++;
271
- }
272
-
273
- vi.channels=2;
274
- vi.codec_setup=&codec_setup0;
275
-
276
- pcm[0]=_ogg_malloc(framesize*sizeof(float));
277
- pcm[1]=_ogg_malloc(framesize*sizeof(float));
278
- out[0]=_ogg_calloc(framesize/2,sizeof(float));
279
- out[1]=_ogg_calloc(framesize/2,sizeof(float));
280
- work[0]=_ogg_calloc(framesize,sizeof(float));
281
- work[1]=_ogg_calloc(framesize,sizeof(float));
282
- flr[0]=_ogg_calloc(framesize/2,sizeof(float));
283
- flr[1]=_ogg_calloc(framesize/2,sizeof(float));
284
- buffer=_ogg_malloc(framesize*4);
285
- buffer2=buffer+framesize*2;
286
- window=_vorbis_window_create(0,framesize,framesize/2,framesize/2);
287
- mdct_init(&m_look,framesize);
288
- drft_init(&f_look,framesize);
289
- _vp_psy_init(&p_look,&_psy_set0,&_psy_set0G,framesize/2,44100);
290
- pg_look=_vp_global_look(&vi);
291
- floor_look=_floor_P[1]->look(NULL,NULL,&_floor_set0);
292
-
293
- /* we cheat on the WAV header; we just bypass 44 bytes and never
294
- verify that it matches 16bit/stereo/44.1kHz. */
295
-
296
- fread(buffer,1,44,stdin);
297
- fwrite(buffer,1,44,stdout);
298
- memset(buffer,0,framesize*2);
299
-
300
- analysis("window",0,window,framesize,0,0);
301
-
302
- fprintf(stderr,"Processing for frame size %d...\n",framesize);
303
-
304
- while(!eos){
305
- long bytes=fread(buffer2,1,framesize*2,stdin);
306
- if(bytes<framesize*2)
307
- memset(buffer2+bytes,0,framesize*2-bytes);
308
-
309
- if(bytes!=0){
310
- int nonzero[2];
311
-
312
- /* uninterleave samples */
313
- for(i=0;i<framesize;i++){
314
- pcm[0][i]=((buffer[i*4+1]<<8)|
315
- (0x00ff&(int)buffer[i*4]))/32768.f;
316
- pcm[1][i]=((buffer[i*4+3]<<8)|
317
- (0x00ff&(int)buffer[i*4+2]))/32768.f;
318
- }
319
-
320
- {
321
- float secs=framesize/44100.;
322
-
323
- ampmax+=secs*ampmax_att_per_sec;
324
- if(ampmax<-9999)ampmax=-9999;
325
- }
326
-
327
- for(i=0;i<2;i++){
328
- float scale=4.f/framesize;
329
- float *fft=work[i];
330
- float *mdct=pcm[i];
331
- float *logmdct=mdct+framesize/2;
332
-
333
- analysis("pre",frameno+i,pcm[i],framesize,0,0);
334
-
335
- /* fft and mdct transforms */
336
- for(j=0;j<framesize;j++)
337
- fft[j]=pcm[i][j]*=window[j];
338
-
339
- drft_forward(&f_look,fft);
340
-
341
- local_ampmax[i]=-9999.f;
342
- fft[0]*=scale;
343
- fft[0]=todB(fft);
344
- for(j=1;j<framesize-1;j+=2){
345
- float temp=scale*FAST_HYPOT(fft[j],fft[j+1]);
346
- temp=fft[(j+1)>>1]=todB(&temp);
347
- if(temp>local_ampmax[i])local_ampmax[i]=temp;
348
- }
349
- if(local_ampmax[i]>ampmax)ampmax=local_ampmax[i];
350
-
351
- mdct_forward(&m_look,pcm[i],mdct);
352
- for(j=0;j<framesize/2;j++)
353
- logmdct[j]=todB(mdct+j);
354
-
355
- analysis("mdct",frameno+i,logmdct,framesize/2,1,0);
356
- analysis("fft",frameno+i,fft,framesize/2,1,0);
357
- }
358
-
359
- for(i=0;i<2;i++){
360
- float amp;
361
- float *fft=work[i];
362
- float *logmax=fft;
363
- float *mdct=pcm[i];
364
- float *logmdct=mdct+framesize/2;
365
- float *mask=fft+framesize/2;
366
-
367
- /* floor psychoacoustics */
368
- _vp_compute_mask(&p_look,
369
- pg_look,
370
- i,
371
- fft,
372
- logmdct,
373
- mask,
374
- ampmax,
375
- local_ampmax[i],
376
- framesize/2);
377
-
378
- analysis("mask",frameno+i,mask,framesize/2,1,0);
379
-
380
- {
381
- vorbis_block vb;
382
- vorbis_dsp_state vd;
383
- memset(&vd,0,sizeof(vd));
384
- vd.vi=&vi;
385
- vb.vd=&vd;
386
- vb.pcmend=framesize;
387
-
388
- /* floor quantization/application */
389
- nonzero[i]=_floor_P[1]->forward(&vb,floor_look,
390
- mdct,
391
- logmdct,
392
- mask,
393
- logmax,
394
-
395
- flr[i]);
396
- }
397
-
398
- _vp_remove_floor(&p_look,
399
- pg_look,
400
- logmdct,
401
- mdct,
402
- flr[i],
403
- pcm[i],
404
- local_ampmax[i]);
405
-
406
- for(j=0;j<framesize/2;j++)
407
- if(fabs(pcm[i][j])>1500)
408
- fprintf(stderr,"%ld ",frameno+i);
409
-
410
- analysis("res",frameno+i,pcm[i],framesize/2,1,0);
411
- analysis("codedflr",frameno+i,flr[i],framesize/2,1,1);
412
- }
413
-
414
- /* residue prequantization */
415
- _vp_partition_prequant(&p_look,
416
- &vi,
417
- pcm,
418
- nonzero);
419
-
420
- for(i=0;i<2;i++)
421
- analysis("quant",frameno+i,pcm[i],framesize/2,1,0);
422
-
423
- /* channel coupling / stereo quantization */
424
-
425
- _vp_couple(&p_look,
426
- &mapping_info,
427
- pcm,
428
- nonzero);
429
-
430
- for(i=0;i<2;i++)
431
- analysis("coupled",frameno+i,pcm[i],framesize/2,1,0);
432
-
433
- /* decoupling */
434
- for(i=mapping_info.coupling_steps-1;i>=0;i--){
435
- float *pcmM=pcm[mapping_info.coupling_mag[i]];
436
- float *pcmA=pcm[mapping_info.coupling_ang[i]];
437
-
438
- for(j=0;j<framesize/2;j++){
439
- float mag=pcmM[j];
440
- float ang=pcmA[j];
441
-
442
- if(mag>0)
443
- if(ang>0){
444
- pcmM[j]=mag;
445
- pcmA[j]=mag-ang;
446
- }else{
447
- pcmA[j]=mag;
448
- pcmM[j]=mag+ang;
449
- }
450
- else
451
- if(ang>0){
452
- pcmM[j]=mag;
453
- pcmA[j]=mag+ang;
454
- }else{
455
- pcmA[j]=mag;
456
- pcmM[j]=mag-ang;
457
- }
458
- }
459
- }
460
-
461
- for(i=0;i<2;i++)
462
- analysis("decoupled",frameno+i,pcm[i],framesize/2,1,0);
463
-
464
- for(i=0;i<2;i++){
465
- float amp;
466
-
467
- for(j=0;j<framesize/2;j++)
468
- pcm[i][j]*=flr[i][j];
469
-
470
- analysis("final",frameno+i,pcm[i],framesize/2,1,1);
471
-
472
- /* take it back to time */
473
- mdct_backward(&m_look,pcm[i],pcm[i]);
474
-
475
- for(j=0;j<framesize/2;j++)
476
- out[i][j]+=pcm[i][j]*window[j];
477
-
478
- analysis("out",frameno+i,out[i],framesize/2,0,0);
479
-
480
-
481
- }
482
-
483
- /* write data. Use the part of buffer we're about to shift out */
484
- for(i=0;i<2;i++){
485
- char *ptr=buffer+i*2;
486
- float *mono=out[i];
487
- int flag=0;
488
- for(j=0;j<framesize/2;j++){
489
- int val=mono[j]*32767.;
490
- /* might as well guard against clipping */
491
- if(val>32767){
492
- if(!flag)fprintf(stderr,"clipping in frame %ld ",frameno+i);
493
- flag=1;
494
- val=32767;
495
- }
496
- if(val<-32768){
497
- if(!flag)fprintf(stderr,"clipping in frame %ld ",frameno+i);
498
- flag=1;
499
- val=-32768;
500
- }
501
- ptr[0]=val&0xff;
502
- ptr[1]=(val>>8)&0xff;
503
- ptr+=4;
504
- }
505
- }
506
-
507
- fprintf(stderr,"*");
508
- fwrite(buffer,1,framesize*2,stdout);
509
- memmove(buffer,buffer2,framesize*2);
510
-
511
- for(i=0;i<2;i++){
512
- for(j=0,k=framesize/2;j<framesize/2;j++,k++)
513
- out[i][j]=pcm[i][k]*window[k];
514
- }
515
- frameno+=2;
516
- }else
517
- eos=1;
518
- }
519
- fprintf(stderr,"average raw bits of entropy: %.03g/sample\n",acc/tot);
520
- fprintf(stderr,"average nonzero samples: %.03g/%d\n",nonz/tot*framesize/2,
521
- framesize/2);
522
- fprintf(stderr,"Done\n\n");
523
- return 0;
524
- }