nabaztag_hack_kit 0.1.0.beta3 → 0.1.0.beta8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -2
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +2 -2
  5. data/CHANGELOG.md +17 -2
  6. data/LICENSE +21 -0
  7. data/README.md +115 -44
  8. data/Rakefile +2 -6
  9. data/bytecode/{Commands.md → _docs/commands.md} +0 -0
  10. data/bytecode/{Docs.md → _docs/grammar.md} +0 -0
  11. data/bytecode/_docs/grammar.pdf +0 -0
  12. data/bytecode/{src → _original}/README.md +0 -0
  13. data/bytecode/{src → _original}/lib/arp.mtl +0 -0
  14. data/bytecode/{src → _original}/lib/cfg.mtl +0 -0
  15. data/bytecode/{src → _original}/lib/choreos.mtl +0 -0
  16. data/bytecode/{src → _original}/lib/dhcp.mtl +0 -0
  17. data/bytecode/{src → _original}/lib/dns.mtl +0 -0
  18. data/bytecode/{src → _original}/lib/http.mtl +0 -0
  19. data/bytecode/{src → _original}/lib/tcp.mtl +0 -0
  20. data/bytecode/{src → _original}/lib/udp.mtl +0 -0
  21. data/bytecode/{src → _original}/lib/util.mtl +0 -0
  22. data/bytecode/{src → _original}/lib/var.mtl +0 -0
  23. data/bytecode/{src → _original}/lib/wav.mtl +0 -0
  24. data/bytecode/{src → _original}/lib/wifi.mtl +0 -0
  25. data/bytecode/{src → _original}/nominal-ping.mtl +0 -0
  26. data/bytecode/main.mtl +11 -11
  27. data/bytecode/test/test.mtl +8 -8
  28. data/examples/basic/Gemfile +1 -3
  29. data/examples/basic/config.ru +14 -4
  30. data/examples/record/Gemfile +0 -5
  31. data/examples/record/{config.ru.example → config.ru} +2 -2
  32. data/examples/record/server.rb +0 -2
  33. data/ext/Makefile +10 -0
  34. data/ext/bin/mtl_comp +29 -0
  35. data/{bytecode → ext}/bin/mtl_merge +0 -0
  36. data/ext/bin/mtl_simu +29 -0
  37. data/{bytecode/src/mtl → ext}/extconf.rb +0 -0
  38. data/ext/mtl_linux/.gitignore +7 -0
  39. data/ext/mtl_linux/LICENSE +21 -0
  40. data/ext/mtl_linux/Makefile +116 -0
  41. data/ext/mtl_linux/MetalC.project +196 -0
  42. data/ext/mtl_linux/conf.bin +0 -0
  43. data/{bytecode/src/mtl → ext/mtl_linux}/conf.bin.sans_password +0 -0
  44. data/{bytecode/src/mtl → ext/mtl_linux}/config.txt +0 -0
  45. data/ext/mtl_linux/inc/log.h +21 -0
  46. data/{bytecode/src/mtl → ext/mtl_linux/inc}/properties.h +0 -0
  47. data/{bytecode/src/mtl/linux_simuaudio.h → ext/mtl_linux/inc/simu/linux/simuaudio.h} +0 -0
  48. data/{bytecode/src/mtl/linux_simunet.h → ext/mtl_linux/inc/simu/linux/simunet.h} +0 -0
  49. data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simuaudio.h +18 -18
  50. data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simunet.h +0 -0
  51. data/ext/mtl_linux/inc/vcomp/compiler.h +200 -0
  52. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/file.h +11 -11
  53. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/filesystem.h +0 -0
  54. data/ext/mtl_linux/inc/vcomp/interpreter.h +121 -0
  55. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/memory.h +120 -92
  56. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/param.h +0 -0
  57. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/parser.h +27 -27
  58. data/ext/mtl_linux/inc/vcomp/prodbuffer.h +42 -0
  59. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/resource.h +1 -1
  60. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/terminal.h +8 -8
  61. data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/util.h +7 -7
  62. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vaudio.h +0 -0
  63. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vbc.h +1 -1
  64. data/ext/mtl_linux/inc/vm/vbc_str.h +167 -0
  65. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vinterp.h +0 -0
  66. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vloader.h +0 -0
  67. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vlog.h +0 -0
  68. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vmem.h +0 -0
  69. data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vnet.h +0 -0
  70. data/ext/mtl_linux/nominal.mtl +3959 -0
  71. data/ext/mtl_linux/src/comp/main.cpp +123 -0
  72. data/ext/mtl_linux/src/simu/dumpbc.c +2566 -0
  73. data/ext/mtl_linux/src/simu/linux/main.cpp +288 -0
  74. data/ext/mtl_linux/src/simu/linux/simu.c +309 -0
  75. data/ext/mtl_linux/src/simu/linux/simuaudio.c +44 -0
  76. data/ext/mtl_linux/src/simu/linux/simunet.c +707 -0
  77. data/ext/mtl_linux/src/simu/log.c +340 -0
  78. data/ext/mtl_linux/src/simu/properties.c +368 -0
  79. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/GTKANAL.H +0 -0
  80. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/LAYER3.C +0 -0
  81. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/TABINIT.C +0 -0
  82. data/ext/mtl_linux/src/simu/win/mp3/common.c +302 -0
  83. data/ext/mtl_linux/src/simu/win/mp3/dct64_i386.c +316 -0
  84. data/ext/mtl_linux/src/simu/win/mp3/decode_i386.c +160 -0
  85. data/ext/mtl_linux/src/simu/win/mp3/huffman.h +332 -0
  86. data/ext/mtl_linux/src/simu/win/mp3/interface.c +276 -0
  87. data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/mpg123.h +34 -30
  88. data/ext/mtl_linux/src/simu/win/mp3/mpglib.h +47 -0
  89. data/ext/mtl_linux/src/simu/win/simu.c +819 -0
  90. data/ext/mtl_linux/src/simu/win/simuaudio.c +787 -0
  91. data/ext/mtl_linux/src/simu/win/simunet.c +489 -0
  92. data/ext/mtl_linux/src/vcomp/bootstrap.cpp +95 -0
  93. data/ext/mtl_linux/src/vcomp/compiler.cpp +587 -0
  94. data/ext/mtl_linux/src/vcomp/compiler_file.cpp +1253 -0
  95. data/ext/mtl_linux/src/vcomp/compiler_prog.cpp +437 -0
  96. data/ext/mtl_linux/src/vcomp/compiler_term.cpp +1500 -0
  97. data/ext/mtl_linux/src/vcomp/compiler_type.cpp +1238 -0
  98. data/ext/mtl_linux/src/vcomp/compiler_var.cpp +502 -0
  99. data/ext/mtl_linux/src/vcomp/file.cpp +100 -0
  100. data/ext/mtl_linux/src/vcomp/interpreter.cpp +93 -0
  101. data/ext/mtl_linux/src/vcomp/memory.cpp +313 -0
  102. data/ext/mtl_linux/src/vcomp/parser.cpp +584 -0
  103. data/ext/mtl_linux/src/vcomp/parser_xml.cpp +137 -0
  104. data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/prodbuffer.cpp +57 -36
  105. data/ext/mtl_linux/src/vcomp/stdlib_core.cpp +130 -0
  106. data/ext/mtl_linux/src/vcomp/terminal.cpp +80 -0
  107. data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/util.cpp +18 -11
  108. data/ext/mtl_linux/src/vm/vaudio.c +830 -0
  109. data/ext/mtl_linux/src/vm/vinterp.c +1780 -0
  110. data/ext/mtl_linux/src/vm/vloader.c +139 -0
  111. data/ext/mtl_linux/src/vm/vlog.c +782 -0
  112. data/ext/mtl_linux/src/vm/vmem.c +461 -0
  113. data/ext/mtl_linux/src/vm/vnet.c +298 -0
  114. data/{bytecode/src/mtl → ext/mtl_linux}/utils/correct_const.sh +0 -0
  115. data/lib/nabaztag_hack_kit/server.rb +4 -7
  116. data/lib/nabaztag_hack_kit/version.rb +1 -1
  117. data/lib/nabaztag_hack_kit.rb +2 -2
  118. data/nabaztag_hack_kit.gemspec +10 -11
  119. data/spec/integration/server_spec.rb +3 -3
  120. data/spec/spec_helper.rb +2 -0
  121. data/spec/unit/message_spec.rb +12 -18
  122. data/spec/unit/server_spec.rb +13 -10
  123. metadata +145 -137
  124. data/bytecode/bin/mtl_comp +0 -50
  125. data/bytecode/bin/mtl_simu +0 -49
  126. data/bytecode/src/mtl/Makefile +0 -42
  127. data/bytecode/src/mtl/README.md +0 -13
  128. data/bytecode/src/mtl/bc.cpp +0 -1891
  129. data/bytecode/src/mtl/dumpbc.c +0 -2566
  130. data/bytecode/src/mtl/linux_simu.c +0 -271
  131. data/bytecode/src/mtl/linux_simuaudio.c +0 -16
  132. data/bytecode/src/mtl/linux_simunet.c +0 -620
  133. data/bytecode/src/mtl/log.c +0 -297
  134. data/bytecode/src/mtl/log.h +0 -20
  135. data/bytecode/src/mtl/main_compiler.cpp +0 -104
  136. data/bytecode/src/mtl/main_simu.cpp +0 -221
  137. data/bytecode/src/mtl/mp3/common.c +0 -265
  138. data/bytecode/src/mtl/mp3/dct64_i386.c +0 -316
  139. data/bytecode/src/mtl/mp3/decode_i386.c +0 -155
  140. data/bytecode/src/mtl/mp3/huffman.h +0 -332
  141. data/bytecode/src/mtl/mp3/interface.c +0 -258
  142. data/bytecode/src/mtl/mp3/mpglib.h +0 -44
  143. data/bytecode/src/mtl/properties.c +0 -293
  144. data/bytecode/src/mtl/simu.c +0 -750
  145. data/bytecode/src/mtl/simuaudio.c +0 -662
  146. data/bytecode/src/mtl/simunet.c +0 -400
  147. data/bytecode/src/mtl/vaudio.c +0 -677
  148. data/bytecode/src/mtl/vbc_str.h +0 -166
  149. data/bytecode/src/mtl/vcomp/Makefile +0 -29
  150. data/bytecode/src/mtl/vcomp/bootstrap.cpp +0 -89
  151. data/bytecode/src/mtl/vcomp/compiler.cpp +0 -470
  152. data/bytecode/src/mtl/vcomp/compiler.h +0 -200
  153. data/bytecode/src/mtl/vcomp/compiler_file.cpp +0 -929
  154. data/bytecode/src/mtl/vcomp/compiler_prog.cpp +0 -250
  155. data/bytecode/src/mtl/vcomp/compiler_term.cpp +0 -1053
  156. data/bytecode/src/mtl/vcomp/compiler_type.cpp +0 -872
  157. data/bytecode/src/mtl/vcomp/compiler_var.cpp +0 -289
  158. data/bytecode/src/mtl/vcomp/file.cpp +0 -79
  159. data/bytecode/src/mtl/vcomp/interpreter.cpp +0 -85
  160. data/bytecode/src/mtl/vcomp/interpreter.h +0 -121
  161. data/bytecode/src/mtl/vcomp/memory.cpp +0 -241
  162. data/bytecode/src/mtl/vcomp/parser.cpp +0 -427
  163. data/bytecode/src/mtl/vcomp/parser_xml.cpp +0 -124
  164. data/bytecode/src/mtl/vcomp/prodbuffer.h +0 -42
  165. data/bytecode/src/mtl/vcomp/stdlib_core.cpp +0 -122
  166. data/bytecode/src/mtl/vcomp/terminal.cpp +0 -73
  167. data/bytecode/src/mtl/vinterp.c +0 -1349
  168. data/bytecode/src/mtl/vloader.c +0 -127
  169. data/bytecode/src/mtl/vlog.c +0 -589
  170. data/bytecode/src/mtl/vmem.c +0 -424
  171. data/bytecode/src/mtl/vnet.c +0 -255
  172. data/examples/basic/Procfile +0 -2
  173. data/examples/basic/server.rb +0 -14
@@ -1,265 +0,0 @@
1
- //#ifdef HAVEGTK
2
- #include <ctype.h>
3
- #include <stdlib.h>
4
- #include <signal.h>
5
-
6
- #include <sys/types.h>
7
- #include <sys/stat.h>
8
- #include <fcntl.h>
9
-
10
- #include "mpg123.h"
11
-
12
- struct parameter param = { 1 , 1 , 0 , 0 };
13
-
14
- int tabsel_123[2][3][16] = {
15
- { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
16
- {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
17
- {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
18
-
19
- { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
20
- {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
21
- {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
22
- };
23
-
24
- long freqs[9] = { 44100, 48000, 32000,
25
- 22050, 24000, 16000 ,
26
- 11025 , 12000 , 8000 };
27
-
28
- int bitindex;
29
- unsigned char *wordpointer;
30
- unsigned char *pcm_sample;
31
- int pcm_point = 0;
32
-
33
-
34
- #if 0
35
- static void get_II_stuff(struct frame *fr)
36
- {
37
- static int translate[3][2][16] =
38
- { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
39
- { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
40
- { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
41
- { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } ,
42
- { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,
43
- { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
44
-
45
- int table,sblim;
46
- static struct al_table *tables[5] =
47
- { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
48
- static int sblims[5] = { 27 , 30 , 8, 12 , 30 };
49
-
50
- if(fr->lsf)
51
- table = 4;
52
- else
53
- table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index];
54
- sblim = sblims[table];
55
-
56
- fr->alloc = tables[table];
57
- fr->II_sblimit = sblim;
58
- }
59
- #endif
60
-
61
- #define HDRCMPMASK 0xfffffd00
62
-
63
- #if 0
64
- int head_check(unsigned long head)
65
- {
66
- if( (head & 0xffe00000) != 0xffe00000)
67
- return FALSE;
68
- if(!((head>>17)&3))
69
- return FALSE;
70
- if( ((head>>12)&0xf) == 0xf)
71
- return FALSE;
72
- if( ((head>>10)&0x3) == 0x3 )
73
- return FALSE;
74
- return TRUE;
75
- }
76
- #endif
77
-
78
- /*
79
- * the code a header and write the information
80
- * into the frame structure
81
- */
82
- int decode_header(struct frame *fr,unsigned long newhead)
83
- {
84
-
85
-
86
- if( newhead & (1<<20) ) {
87
- fr->lsf = (newhead & (1<<19)) ? 0x0 : 0x1;
88
- fr->mpeg25 = 0;
89
- }
90
- else {
91
- fr->lsf = 1;
92
- fr->mpeg25 = 1;
93
- }
94
-
95
- fr->lay = 4-((newhead>>17)&3);
96
- if( ((newhead>>10)&0x3) == 0x3) {
97
- fprintf(stderr,"Stream error\n");
98
- // MMechostr(1,"MP3 Stream error\n");
99
- return -1;
100
- }
101
- if(fr->mpeg25) {
102
- fr->sampling_frequency = 6 + ((newhead>>10)&0x3);
103
- }
104
- else
105
- fr->sampling_frequency = ((newhead>>10)&0x3) + (fr->lsf*3);
106
- fr->error_protection = ((newhead>>16)&0x1)^0x1;
107
-
108
- if(fr->mpeg25) /* allow Bitrate change for 2.5 ... */
109
- fr->bitrate_index = ((newhead>>12)&0xf);
110
-
111
- fr->bitrate_index = ((newhead>>12)&0xf);
112
- fr->padding = ((newhead>>9)&0x1);
113
- fr->extension = ((newhead>>8)&0x1);
114
- fr->mode = ((newhead>>6)&0x3);
115
- fr->mode_ext = ((newhead>>4)&0x3);
116
- fr->copyright = ((newhead>>3)&0x1);
117
- fr->original = ((newhead>>2)&0x1);
118
- fr->emphasis = newhead & 0x3;
119
-
120
- fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2;
121
-
122
- if(!fr->bitrate_index)
123
- {
124
- fprintf(stderr,"Free format not supported.\n");
125
- return (0);
126
- }
127
- //fprintf(stderr,"newhead = %x\n",newhead);
128
- //fprintf(stderr,"layer = %d\n",fr->lay);
129
- switch(fr->lay)
130
- {
131
- case 1:
132
- #if 0
133
- fr->do_layer = do_layer1;
134
- fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
135
- (fr->mode_ext<<2)+4 : 32;
136
- fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000;
137
- fr->framesize /= freqs[fr->sampling_frequency];
138
- fr->framesize = ((fr->framesize+fr->padding)<<2)-4;
139
- #else
140
- fprintf(stderr,"Not supported!\n");
141
- #endif
142
- break;
143
- case 2:
144
- #if 0
145
- fr->do_layer = do_layer2;
146
- get_II_stuff(fr);
147
- fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
148
- (fr->mode_ext<<2)+4 : fr->II_sblimit;
149
- fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000;
150
- fr->framesize /= freqs[fr->sampling_frequency];
151
- fr->framesize += fr->padding - 4;
152
- #else
153
- fprintf(stderr,"Not supported!\n");
154
- #endif
155
- break;
156
- case 3:
157
- #if 0
158
- fr->do_layer = do_layer3;
159
- if(fr->lsf)
160
- ssize = (fr->stereo == 1) ? 9 : 17;
161
- else
162
- ssize = (fr->stereo == 1) ? 17 : 32;
163
- #endif
164
-
165
- #if 0
166
- if(fr->error_protection)
167
- ssize += 2;
168
- #endif
169
- fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000;
170
- fr->framesize /= freqs[fr->sampling_frequency]<<(fr->lsf);
171
- fr->framesize = fr->framesize + fr->padding - 4;
172
- break;
173
- default:
174
- fprintf(stderr,"Sorry, unknown layer type.\n");
175
- return (0);
176
- }
177
-
178
- /* print_header(fr); */
179
-
180
- return 1;
181
- }
182
-
183
-
184
- #if 1
185
- void print_header(struct frame *fr)
186
- {
187
- static char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
188
- static char *layers[4] = { "Unknown" , "I", "II", "III" };
189
-
190
- fprintf(stderr,"MPEG %s, Layer: %s, Freq: %ld, mode: %s, modext: %d, BPF : %d\n",
191
- fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
192
- layers[fr->lay],freqs[fr->sampling_frequency],
193
- modes[fr->mode],fr->mode_ext,fr->framesize+4);
194
- fprintf(stderr,"Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d.\n",
195
- fr->stereo,fr->copyright?"Yes":"No",
196
- fr->original?"Yes":"No",fr->error_protection?"Yes":"No",
197
- fr->emphasis);
198
- fprintf(stderr,"Bitrate: %d Kbits/s, Extension value: %d\n",
199
- tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index],fr->extension);
200
- }
201
-
202
- void print_header_compact(struct frame *fr)
203
- {
204
- static char *modes[4] = { "stereo", "joint-stereo", "dual-channel", "mono" };
205
- static char *layers[4] = { "Unknown" , "I", "II", "III" };
206
-
207
- fprintf(stderr,"MPEG %s layer %s, %d kbit/s, %ld Hz %s\n",
208
- fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
209
- layers[fr->lay],
210
- tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index],
211
- freqs[fr->sampling_frequency], modes[fr->mode]);
212
- }
213
-
214
- #endif
215
-
216
- unsigned int getbits(int number_of_bits)
217
- {
218
- unsigned long rval;
219
-
220
- if(!number_of_bits)
221
- return 0;
222
-
223
- {
224
- rval = wordpointer[0];
225
- rval <<= 8;
226
- rval |= wordpointer[1];
227
- rval <<= 8;
228
- rval |= wordpointer[2];
229
- rval <<= bitindex;
230
- rval &= 0xffffff;
231
-
232
- bitindex += number_of_bits;
233
-
234
- rval >>= (24-number_of_bits);
235
-
236
- wordpointer += (bitindex>>3);
237
- bitindex &= 7;
238
- }
239
- return rval;
240
- }
241
-
242
- unsigned int getbits_fast(int number_of_bits)
243
- {
244
- unsigned long rval;
245
-
246
- {
247
- rval = wordpointer[0];
248
- rval <<= 8;
249
- rval |= wordpointer[1];
250
- rval <<= bitindex;
251
- rval &= 0xffff;
252
- bitindex += number_of_bits;
253
-
254
- rval >>= (16-number_of_bits);
255
-
256
- wordpointer += (bitindex>>3);
257
- bitindex &= 7;
258
- }
259
- return rval;
260
- }
261
-
262
-
263
-
264
-
265
- //#endif
@@ -1,316 +0,0 @@
1
- //#ifdef HAVEGTK
2
- /*
3
- * Discrete Cosine Tansform (DCT) for subband synthesis
4
- * optimized for machines with no auto-increment.
5
- * The performance is highly compiler dependend. Maybe
6
- * the dct64.c version for 'normal' processor may be faster
7
- * even for Intel processors.
8
- */
9
-
10
- #include "mpg123.h"
11
-
12
- static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
13
- {
14
-
15
- {
16
- register real *costab = pnts[0];
17
-
18
- b1[0x00] = samples[0x00] + samples[0x1F];
19
- b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
20
-
21
- b1[0x01] = samples[0x01] + samples[0x1E];
22
- b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
23
-
24
- b1[0x02] = samples[0x02] + samples[0x1D];
25
- b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
26
-
27
- b1[0x03] = samples[0x03] + samples[0x1C];
28
- b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
29
-
30
- b1[0x04] = samples[0x04] + samples[0x1B];
31
- b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
32
-
33
- b1[0x05] = samples[0x05] + samples[0x1A];
34
- b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
35
-
36
- b1[0x06] = samples[0x06] + samples[0x19];
37
- b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
38
-
39
- b1[0x07] = samples[0x07] + samples[0x18];
40
- b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
41
-
42
- b1[0x08] = samples[0x08] + samples[0x17];
43
- b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
44
-
45
- b1[0x09] = samples[0x09] + samples[0x16];
46
- b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
47
-
48
- b1[0x0A] = samples[0x0A] + samples[0x15];
49
- b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
50
-
51
- b1[0x0B] = samples[0x0B] + samples[0x14];
52
- b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
53
-
54
- b1[0x0C] = samples[0x0C] + samples[0x13];
55
- b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
56
-
57
- b1[0x0D] = samples[0x0D] + samples[0x12];
58
- b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
59
-
60
- b1[0x0E] = samples[0x0E] + samples[0x11];
61
- b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
62
-
63
- b1[0x0F] = samples[0x0F] + samples[0x10];
64
- b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
65
- }
66
-
67
-
68
- {
69
- register real *costab = pnts[1];
70
-
71
- b2[0x00] = b1[0x00] + b1[0x0F];
72
- b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
73
- b2[0x01] = b1[0x01] + b1[0x0E];
74
- b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
75
- b2[0x02] = b1[0x02] + b1[0x0D];
76
- b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
77
- b2[0x03] = b1[0x03] + b1[0x0C];
78
- b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
79
- b2[0x04] = b1[0x04] + b1[0x0B];
80
- b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
81
- b2[0x05] = b1[0x05] + b1[0x0A];
82
- b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
83
- b2[0x06] = b1[0x06] + b1[0x09];
84
- b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
85
- b2[0x07] = b1[0x07] + b1[0x08];
86
- b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
87
-
88
- b2[0x10] = b1[0x10] + b1[0x1F];
89
- b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
90
- b2[0x11] = b1[0x11] + b1[0x1E];
91
- b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
92
- b2[0x12] = b1[0x12] + b1[0x1D];
93
- b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
94
- b2[0x13] = b1[0x13] + b1[0x1C];
95
- b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
96
- b2[0x14] = b1[0x14] + b1[0x1B];
97
- b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
98
- b2[0x15] = b1[0x15] + b1[0x1A];
99
- b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
100
- b2[0x16] = b1[0x16] + b1[0x19];
101
- b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
102
- b2[0x17] = b1[0x17] + b1[0x18];
103
- b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
104
- }
105
-
106
- {
107
- register real *costab = pnts[2];
108
-
109
- b1[0x00] = b2[0x00] + b2[0x07];
110
- b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
111
- b1[0x01] = b2[0x01] + b2[0x06];
112
- b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
113
- b1[0x02] = b2[0x02] + b2[0x05];
114
- b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
115
- b1[0x03] = b2[0x03] + b2[0x04];
116
- b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
117
-
118
- b1[0x08] = b2[0x08] + b2[0x0F];
119
- b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
120
- b1[0x09] = b2[0x09] + b2[0x0E];
121
- b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
122
- b1[0x0A] = b2[0x0A] + b2[0x0D];
123
- b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
124
- b1[0x0B] = b2[0x0B] + b2[0x0C];
125
- b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
126
-
127
- b1[0x10] = b2[0x10] + b2[0x17];
128
- b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
129
- b1[0x11] = b2[0x11] + b2[0x16];
130
- b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
131
- b1[0x12] = b2[0x12] + b2[0x15];
132
- b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
133
- b1[0x13] = b2[0x13] + b2[0x14];
134
- b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
135
-
136
- b1[0x18] = b2[0x18] + b2[0x1F];
137
- b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
138
- b1[0x19] = b2[0x19] + b2[0x1E];
139
- b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
140
- b1[0x1A] = b2[0x1A] + b2[0x1D];
141
- b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
142
- b1[0x1B] = b2[0x1B] + b2[0x1C];
143
- b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
144
- }
145
-
146
- {
147
- register real const cos0 = pnts[3][0];
148
- register real const cos1 = pnts[3][1];
149
-
150
- b2[0x00] = b1[0x00] + b1[0x03];
151
- b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
152
- b2[0x01] = b1[0x01] + b1[0x02];
153
- b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
154
-
155
- b2[0x04] = b1[0x04] + b1[0x07];
156
- b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
157
- b2[0x05] = b1[0x05] + b1[0x06];
158
- b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
159
-
160
- b2[0x08] = b1[0x08] + b1[0x0B];
161
- b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
162
- b2[0x09] = b1[0x09] + b1[0x0A];
163
- b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
164
-
165
- b2[0x0C] = b1[0x0C] + b1[0x0F];
166
- b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
167
- b2[0x0D] = b1[0x0D] + b1[0x0E];
168
- b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
169
-
170
- b2[0x10] = b1[0x10] + b1[0x13];
171
- b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
172
- b2[0x11] = b1[0x11] + b1[0x12];
173
- b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
174
-
175
- b2[0x14] = b1[0x14] + b1[0x17];
176
- b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
177
- b2[0x15] = b1[0x15] + b1[0x16];
178
- b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
179
-
180
- b2[0x18] = b1[0x18] + b1[0x1B];
181
- b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
182
- b2[0x19] = b1[0x19] + b1[0x1A];
183
- b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
184
-
185
- b2[0x1C] = b1[0x1C] + b1[0x1F];
186
- b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
187
- b2[0x1D] = b1[0x1D] + b1[0x1E];
188
- b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
189
- }
190
-
191
- {
192
- register real const cos0 = pnts[4][0];
193
-
194
- b1[0x00] = b2[0x00] + b2[0x01];
195
- b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
196
- b1[0x02] = b2[0x02] + b2[0x03];
197
- b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
198
- b1[0x02] += b1[0x03];
199
-
200
- b1[0x04] = b2[0x04] + b2[0x05];
201
- b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
202
- b1[0x06] = b2[0x06] + b2[0x07];
203
- b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
204
- b1[0x06] += b1[0x07];
205
- b1[0x04] += b1[0x06];
206
- b1[0x06] += b1[0x05];
207
- b1[0x05] += b1[0x07];
208
-
209
- b1[0x08] = b2[0x08] + b2[0x09];
210
- b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
211
- b1[0x0A] = b2[0x0A] + b2[0x0B];
212
- b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
213
- b1[0x0A] += b1[0x0B];
214
-
215
- b1[0x0C] = b2[0x0C] + b2[0x0D];
216
- b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
217
- b1[0x0E] = b2[0x0E] + b2[0x0F];
218
- b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
219
- b1[0x0E] += b1[0x0F];
220
- b1[0x0C] += b1[0x0E];
221
- b1[0x0E] += b1[0x0D];
222
- b1[0x0D] += b1[0x0F];
223
-
224
- b1[0x10] = b2[0x10] + b2[0x11];
225
- b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
226
- b1[0x12] = b2[0x12] + b2[0x13];
227
- b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
228
- b1[0x12] += b1[0x13];
229
-
230
- b1[0x14] = b2[0x14] + b2[0x15];
231
- b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
232
- b1[0x16] = b2[0x16] + b2[0x17];
233
- b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
234
- b1[0x16] += b1[0x17];
235
- b1[0x14] += b1[0x16];
236
- b1[0x16] += b1[0x15];
237
- b1[0x15] += b1[0x17];
238
-
239
- b1[0x18] = b2[0x18] + b2[0x19];
240
- b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
241
- b1[0x1A] = b2[0x1A] + b2[0x1B];
242
- b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
243
- b1[0x1A] += b1[0x1B];
244
-
245
- b1[0x1C] = b2[0x1C] + b2[0x1D];
246
- b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
247
- b1[0x1E] = b2[0x1E] + b2[0x1F];
248
- b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
249
- b1[0x1E] += b1[0x1F];
250
- b1[0x1C] += b1[0x1E];
251
- b1[0x1E] += b1[0x1D];
252
- b1[0x1D] += b1[0x1F];
253
- }
254
-
255
- out0[0x10*16] = b1[0x00];
256
- out0[0x10*12] = b1[0x04];
257
- out0[0x10* 8] = b1[0x02];
258
- out0[0x10* 4] = b1[0x06];
259
- out0[0x10* 0] = b1[0x01];
260
- out1[0x10* 0] = b1[0x01];
261
- out1[0x10* 4] = b1[0x05];
262
- out1[0x10* 8] = b1[0x03];
263
- out1[0x10*12] = b1[0x07];
264
-
265
- b1[0x08] += b1[0x0C];
266
- out0[0x10*14] = b1[0x08];
267
- b1[0x0C] += b1[0x0a];
268
- out0[0x10*10] = b1[0x0C];
269
- b1[0x0A] += b1[0x0E];
270
- out0[0x10* 6] = b1[0x0A];
271
- b1[0x0E] += b1[0x09];
272
- out0[0x10* 2] = b1[0x0E];
273
- b1[0x09] += b1[0x0D];
274
- out1[0x10* 2] = b1[0x09];
275
- b1[0x0D] += b1[0x0B];
276
- out1[0x10* 6] = b1[0x0D];
277
- b1[0x0B] += b1[0x0F];
278
- out1[0x10*10] = b1[0x0B];
279
- out1[0x10*14] = b1[0x0F];
280
-
281
- b1[0x18] += b1[0x1C];
282
- out0[0x10*15] = b1[0x10] + b1[0x18];
283
- out0[0x10*13] = b1[0x18] + b1[0x14];
284
- b1[0x1C] += b1[0x1a];
285
- out0[0x10*11] = b1[0x14] + b1[0x1C];
286
- out0[0x10* 9] = b1[0x1C] + b1[0x12];
287
- b1[0x1A] += b1[0x1E];
288
- out0[0x10* 7] = b1[0x12] + b1[0x1A];
289
- out0[0x10* 5] = b1[0x1A] + b1[0x16];
290
- b1[0x1E] += b1[0x19];
291
- out0[0x10* 3] = b1[0x16] + b1[0x1E];
292
- out0[0x10* 1] = b1[0x1E] + b1[0x11];
293
- b1[0x19] += b1[0x1D];
294
- out1[0x10* 1] = b1[0x11] + b1[0x19];
295
- out1[0x10* 3] = b1[0x19] + b1[0x15];
296
- b1[0x1D] += b1[0x1B];
297
- out1[0x10* 5] = b1[0x15] + b1[0x1D];
298
- out1[0x10* 7] = b1[0x1D] + b1[0x13];
299
- b1[0x1B] += b1[0x1F];
300
- out1[0x10* 9] = b1[0x13] + b1[0x1B];
301
- out1[0x10*11] = b1[0x1B] + b1[0x17];
302
- out1[0x10*13] = b1[0x17] + b1[0x1F];
303
- out1[0x10*15] = b1[0x1F];
304
- }
305
-
306
- /*
307
- * the call via dct64 is a trick to force GCC to use
308
- * (new) registers for the b1,b2 pointer to the bufs[xx] field
309
- */
310
- void dct64(real *a,real *b,real *c)
311
- {
312
- real bufs[0x40];
313
- dct64_1(a,b,bufs,bufs+0x20,c);
314
- }
315
-
316
- //#endif