make huffman optional

This commit is contained in:
David Voswinkel 2009-08-05 20:15:28 +02:00
parent af45ed720b
commit cf95b95723
2 changed files with 519 additions and 382 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ import time
LEN = 2**16
huffman = False
TARGET="/Users/david/Devel/arch/avr/code/quickdev16/avr/usbload"
HUFFMAN_ENCODER="/Users/david/Devel/arch/avr/code/quickdev16/tools/huffman/huffman-encode"
data = open(sys.argv[1],"r").read()
@ -15,17 +15,19 @@ print "Use %i bytes" % (len(data))
data = binascii.rlecode_hqx(data)
print "RLE crunch (%i) bytes" % (len(data))
rle_size = len(data)
huffman_size = 0
if huffman == True:
binfile = open("/tmp/loader.rle","w")
binfile.write(data)
binfile.close()
rle_size = len(data)
cmd = "%s /tmp/loader.rle" % HUFFMAN_ENCODER
os.system(cmd)
data = open("/tmp/loader.rle.hfm","r").read()
print "HUFFMAN crunch (%i) bytes" % (len(data))
huffman_size = len(data)
os.unlink("/tmp/loader.rle")
os.unlink("/tmp/loader.rle.hfm")