diff --git a/.gitignore b/.gitignore index 2eebb68..00b5038 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ a.out +mp3 huffcv.awk old diff --git a/README.md b/README.md index dced1ac..3c40fc5 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ ### (it is true) # files -- dat.h: miscellaneous tables and constants needed by the library -- huffman.h: generated huffman table - main.c: test application for the library - mp3.c: library code -- mp3.h: library header, include this in client code +- inc: includes + + dat.h: miscellaneous tables and constants needed by the library + + huffman.h: generated huffman table + + mp3.h: library header, include this in client code - scr: scripts unneeded to use the library, provided for reference purposes + huff: wrapper for huffcvt, generating huffman tables copied to the clipboard from the mp3 specification + scr/huffcvt.c: changes huffman string format to c array diff --git a/build b/build new file mode 100755 index 0000000..c7da57f --- /dev/null +++ b/build @@ -0,0 +1 @@ +cc -Iinc -O3 main.c mp3.c -o mp3 diff --git a/huff b/huff deleted file mode 100755 index 6d247b5..0000000 --- a/huff +++ /dev/null @@ -1,3 +0,0 @@ -echo -e ", {\t\t\t\t\t\t\t// $1" -eval `wl-paste|sed 's/^/\.\/huffcvt /g;s/$/;/g'` -echo -ne '\t}' diff --git a/huffcvt.c b/huffcvt.c deleted file mode 100644 index a2b9596..0000000 --- a/huffcvt.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -unsigned long btoi(char* s) { - unsigned long r = 0; - int l = strlen(s) - 1; - for(int i = l; i >= 0; i--) { - r <<= 1; - r |= (s[l-i]-'0'); - } - return r; -} - -int main(int argc, char** argv) { - printf("\t\t{%s,%s,%s,%i},\n", argv[1], argv[2], argv[3], btoi(argv[4])); -} diff --git a/dat.h b/inc/dat.h similarity index 100% rename from dat.h rename to inc/dat.h diff --git a/huffman.h b/inc/huffman.h similarity index 100% rename from huffman.h rename to inc/huffman.h diff --git a/mp3.h b/inc/mp3.h similarity index 100% rename from mp3.h rename to inc/mp3.h diff --git a/main.c b/main.c index 9caa394..2b88238 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -#include "mp3.h" +#include int main(int argc, char** argv) { diff --git a/mp3.c b/mp3.c index 612b14e..15b8d8c 100644 --- a/mp3.c +++ b/mp3.c @@ -1,7 +1,7 @@ -#include "mp3.h" +#include -#include "huffman.h" -#include "dat.h" +#include +#include // TODO autodetect endianness here #define fromle(x) (x)