nabaztag_hack_kit 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. data/.gitignore +7 -0
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +4 -0
  5. data/README.md +119 -0
  6. data/Rakefile +21 -0
  7. data/bin/mtl_comp +41 -0
  8. data/bin/mtl_merge +22 -0
  9. data/bin/mtl_simu +40 -0
  10. data/bytecode/lib/buffer.mtl +109 -0
  11. data/bytecode/lib/button.mtl +27 -0
  12. data/bytecode/lib/data_helper.mtl +88 -0
  13. data/bytecode/lib/ear.mtl +90 -0
  14. data/bytecode/lib/led.mtl +33 -0
  15. data/bytecode/lib/rfid.mtl +50 -0
  16. data/bytecode/main.mtl +129 -0
  17. data/config.ru +6 -0
  18. data/ext/bytecode/Commands.md +172 -0
  19. data/ext/bytecode/Docs.md +488 -0
  20. data/ext/bytecode/README.md +5 -0
  21. data/ext/bytecode/lib/arp.mtl +159 -0
  22. data/ext/bytecode/lib/cfg.mtl +74 -0
  23. data/ext/bytecode/lib/choreos.mtl +1487 -0
  24. data/ext/bytecode/lib/dhcp.mtl +152 -0
  25. data/ext/bytecode/lib/dns.mtl +89 -0
  26. data/ext/bytecode/lib/http.mtl +84 -0
  27. data/ext/bytecode/lib/tcp.mtl +340 -0
  28. data/ext/bytecode/lib/udp.mtl +49 -0
  29. data/ext/bytecode/lib/util.mtl +74 -0
  30. data/ext/bytecode/lib/var.mtl +15 -0
  31. data/ext/bytecode/lib/wifi.mtl +243 -0
  32. data/ext/bytecode/nominal-ping.mtl +5828 -0
  33. data/ext/mtl/Makefile +42 -0
  34. data/ext/mtl/README.md +13 -0
  35. data/ext/mtl/bc.cpp +1891 -0
  36. data/ext/mtl/conf.bin.sans_password +0 -0
  37. data/ext/mtl/config.txt +5 -0
  38. data/ext/mtl/dumpbc.c +2566 -0
  39. data/ext/mtl/extconf.rb +1 -0
  40. data/ext/mtl/linux_simu.c +271 -0
  41. data/ext/mtl/linux_simuaudio.c +16 -0
  42. data/ext/mtl/linux_simuaudio.h +18 -0
  43. data/ext/mtl/linux_simunet.c +620 -0
  44. data/ext/mtl/linux_simunet.h +7 -0
  45. data/ext/mtl/log.c +297 -0
  46. data/ext/mtl/log.h +20 -0
  47. data/ext/mtl/main_compiler.cpp +104 -0
  48. data/ext/mtl/main_simu.cpp +221 -0
  49. data/ext/mtl/mp3/GTKANAL.H +97 -0
  50. data/ext/mtl/mp3/LAYER3.C +2090 -0
  51. data/ext/mtl/mp3/TABINIT.C +82 -0
  52. data/ext/mtl/mp3/common.c +265 -0
  53. data/ext/mtl/mp3/dct64_i386.c +316 -0
  54. data/ext/mtl/mp3/decode_i386.c +155 -0
  55. data/ext/mtl/mp3/huffman.h +332 -0
  56. data/ext/mtl/mp3/interface.c +258 -0
  57. data/ext/mtl/mp3/mpg123.h +182 -0
  58. data/ext/mtl/mp3/mpglib.h +44 -0
  59. data/ext/mtl/properties.c +293 -0
  60. data/ext/mtl/properties.h +10 -0
  61. data/ext/mtl/simu.c +750 -0
  62. data/ext/mtl/simuaudio.c +662 -0
  63. data/ext/mtl/simuaudio.h +74 -0
  64. data/ext/mtl/simunet.c +400 -0
  65. data/ext/mtl/simunet.h +30 -0
  66. data/ext/mtl/utils/correct_const.sh +34 -0
  67. data/ext/mtl/vaudio.c +677 -0
  68. data/ext/mtl/vaudio.h +46 -0
  69. data/ext/mtl/vbc.h +160 -0
  70. data/ext/mtl/vbc_str.h +166 -0
  71. data/ext/mtl/vcomp/Makefile +29 -0
  72. data/ext/mtl/vcomp/bootstrap.cpp +89 -0
  73. data/ext/mtl/vcomp/compiler.cpp +470 -0
  74. data/ext/mtl/vcomp/compiler.h +200 -0
  75. data/ext/mtl/vcomp/compiler_file.cpp +929 -0
  76. data/ext/mtl/vcomp/compiler_prog.cpp +250 -0
  77. data/ext/mtl/vcomp/compiler_term.cpp +1053 -0
  78. data/ext/mtl/vcomp/compiler_type.cpp +872 -0
  79. data/ext/mtl/vcomp/compiler_var.cpp +289 -0
  80. data/ext/mtl/vcomp/file.cpp +79 -0
  81. data/ext/mtl/vcomp/file.h +39 -0
  82. data/ext/mtl/vcomp/filesystem.h +14 -0
  83. data/ext/mtl/vcomp/interpreter.cpp +85 -0
  84. data/ext/mtl/vcomp/interpreter.h +121 -0
  85. data/ext/mtl/vcomp/memory.cpp +241 -0
  86. data/ext/mtl/vcomp/memory.h +326 -0
  87. data/ext/mtl/vcomp/param.h +95 -0
  88. data/ext/mtl/vcomp/parser.cpp +427 -0
  89. data/ext/mtl/vcomp/parser.h +97 -0
  90. data/ext/mtl/vcomp/parser_xml.cpp +124 -0
  91. data/ext/mtl/vcomp/prodbuffer.cpp +125 -0
  92. data/ext/mtl/vcomp/prodbuffer.h +42 -0
  93. data/ext/mtl/vcomp/resource.h +17 -0
  94. data/ext/mtl/vcomp/stdlib_core.cpp +122 -0
  95. data/ext/mtl/vcomp/terminal.cpp +73 -0
  96. data/ext/mtl/vcomp/terminal.h +30 -0
  97. data/ext/mtl/vcomp/util.cpp +48 -0
  98. data/ext/mtl/vcomp/util.h +31 -0
  99. data/ext/mtl/vinterp.c +1349 -0
  100. data/ext/mtl/vinterp.h +11 -0
  101. data/ext/mtl/vloader.c +127 -0
  102. data/ext/mtl/vloader.h +31 -0
  103. data/ext/mtl/vlog.c +589 -0
  104. data/ext/mtl/vlog.h +69 -0
  105. data/ext/mtl/vmem.c +424 -0
  106. data/ext/mtl/vmem.h +107 -0
  107. data/ext/mtl/vnet.c +255 -0
  108. data/ext/mtl/vnet.h +19 -0
  109. data/lib/nabaztag_hack_kit/message/api.rb +39 -0
  110. data/lib/nabaztag_hack_kit/message/helper.rb +39 -0
  111. data/lib/nabaztag_hack_kit/message.rb +36 -0
  112. data/lib/nabaztag_hack_kit/server.rb +50 -0
  113. data/lib/nabaztag_hack_kit/version.rb +3 -0
  114. data/lib/nabaztag_hack_kit.rb +4 -0
  115. data/nabaztag_hack_kit.gemspec +29 -0
  116. data/public/bytecode.bin +0 -0
  117. data/test/bytecode/helper.mtl +60 -0
  118. data/test/bytecode/native.mtl +28 -0
  119. data/test/bytecode/test.mtl +221 -0
  120. data/test/spec_helper.rb +5 -0
  121. data/test/unit/message_spec.rb +56 -0
  122. metadata +209 -0
@@ -0,0 +1,97 @@
1
+ /*
2
+ layerIII enc->dec delay: 1056 (observed)
3
+ layerII enc->dec dealy: 480 (observed)
4
+
5
+
6
+ polyphase 256-16 (dec or enc)
7
+ mdct 256+32 (9*32) (dec or enc)
8
+ total: 512+16
9
+
10
+
11
+ SYNC_FLUSH calculation:
12
+ layerIII enc delay: 528
13
+ extra bits to display full fft window: 224
14
+ total: 752
15
+
16
+ layerII sync_flush: should be 464
17
+ layerIII sync_flush: should be 752
18
+
19
+
20
+ Also we would like to remove mpg123 decoder delay with
21
+ DECDELAY of -528 (not possible)
22
+ so delay by a enough to make the total delay 1 whole frame (1152-528)
23
+ */
24
+
25
+
26
+
27
+ #define ENCDELAY 528
28
+ #define DECDELAY (1152-528)
29
+
30
+ /* use this delay if you want to also include the data from the FFT window */
31
+ #define WINDELAY (224 + ENCDELAY)
32
+
33
+
34
+ #ifdef HAVEGTK
35
+
36
+ /* mpg123 ouput is delayed by 1 frame
37
+ * HOWEVER, sometimes mpg123 doesn't produce a frame until we send the
38
+ * next frame. Everytime this happens, bump up MPGLAG.
39
+ */
40
+ #define READ_AHEAD 10 /* number of frames to read ahead */
41
+ #define MAXMPGLAG READ_AHEAD /* if the mpg123 lag becomes bigger than this we have to stop */
42
+ #define NUMBACK 6 /* number of frames we can back up */
43
+ #define NUMPINFO (NUMBACK+READ_AHEAD+1)
44
+
45
+ #define BLKSIZE 1024
46
+ #define HBLKSIZE 513
47
+ #define SBMAX_l 21
48
+ #define SBMAX_s 12
49
+
50
+
51
+
52
+ typedef struct {
53
+ int frameNum; /* current frame number */
54
+ int num_samples; /* number of pcm samples read for this frame */
55
+ double frametime; /* starting time of frame, in seconds */
56
+ double pcmdata[2][1152+WINDELAY];
57
+ double pcmdata2[2][1152+DECDELAY];
58
+ double energy[2][4][BLKSIZE];
59
+ double xr[2][2][576];
60
+ double mpg123xr[2][2][576];
61
+ double pe[2][4];
62
+ double ms_ratio[2];
63
+
64
+ double thr[2][4][SBMAX_l];
65
+ double en[2][4][SBMAX_l];
66
+ double thr_s[2][4][3*SBMAX_s];
67
+ double en_s[2][4][3*SBMAX_s];
68
+ double ers[2][4];
69
+
70
+ double xfsf[2][2][SBMAX_l];
71
+ double xfsf_s[2][2][3*SBMAX_s];
72
+
73
+ int mpglag;
74
+ int qss[2][2];
75
+ int sub_gain[2][2][3];
76
+ int over[2][2];
77
+ double noise[2][2];
78
+ int blocktype[2][2];
79
+ int scalefac_scale[2][2];
80
+ int mpg123blocktype[2][2];
81
+ int mixed[2][2];
82
+ int mainbits[2][2];
83
+ int LAMEmainbits[2][2];
84
+ int stereo,js,ms_stereo,i_stereo,emph,bitrate,sampfreq,maindata;
85
+ int scfsi,mean_bits,resvsize;
86
+ int totbits;
87
+ } plotting_data;
88
+
89
+
90
+ int gtkcontrol();
91
+
92
+ extern int gtkflag;
93
+ //extern plotting_data *pinfo;
94
+ int decode1file(int fd,short pcm[][1152],int *stereo);
95
+ int decode1(char *buf,int len,short pcm[][1152],int stereo);
96
+
97
+ #endif