cleanup up and remove huffman stuff

This commit is contained in:
David Voswinkel
2009-08-04 08:38:26 +02:00
parent 92762d7f51
commit af45ed720b
10 changed files with 2165 additions and 2300 deletions

View File

@@ -18,7 +18,7 @@
* =====================================================================================
*/
#include <avr/io.h>
#include <stdlib.h>
#include <stdio.h>
@@ -34,12 +34,12 @@
uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
{
uint8_t in_byte, in_repeat, last_byte;
uint32_t out_len, out_len_left;
info("RLE decode len=%li addr=0x%08lx\n",in_len,out_addr);
uint8_t in_byte, in_repeat, last_byte;
uint32_t out_len, out_len_left;
info("RLE decode len=%li addr=0x%08lx\n", in_len, out_addr);
last_byte = 0;
out_len_left = out_len;
out_len_left = out_len;
sram_bulk_write_start(out_addr);
#define INBYTE(b) \
do { \
@@ -58,41 +58,46 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
out_addr++;\
} while(0)
INBYTE(in_byte);
INBYTE(in_byte);
if (in_byte == RUNCHAR) {
INBYTE(in_repeat);
if (in_repeat != 0) {
info("Orphaned RLE code at start\n");
return 1;
}
OUTBYTE(RUNCHAR);
} else {
OUTBYTE(in_byte);
}
if (in_byte == RUNCHAR) {
INBYTE(in_repeat);
if (in_repeat != 0) {
info("Orphaned RLE code at start\n");
return 1;
}
OUTBYTE(RUNCHAR);
} else {
OUTBYTE(in_byte);
}
while( in_len > 0 ) {
INBYTE(in_byte);
if (in_len%1024==0)
while (in_len > 0) {
INBYTE(in_byte);
if (in_len % 1024 == 0)
info(".");
if (in_byte == RUNCHAR) {
INBYTE(in_repeat);
if ( in_repeat == 0 ) {
/* Just an escaped RUNCHAR value */
OUTBYTE(RUNCHAR);
} else {
/* Pick up value and output a sequence of it */
in_byte = last_byte; //;out_data[-1];
while ( --in_repeat > 0 )
OUTBYTE(in_byte);
}
} else {
/* Normal byte */
OUTBYTE(in_byte);
}
if (in_byte == RUNCHAR) {
INBYTE(in_repeat);
if (in_repeat == 0) {
/*
* Just an escaped RUNCHAR value
*/
OUTBYTE(RUNCHAR);
} else {
/*
* Pick up value and output a sequence of it
*/
in_byte = last_byte; // ;out_data[-1];
while (--in_repeat > 0)
OUTBYTE(in_byte);
}
} else {
/*
* Normal byte
*/
OUTBYTE(in_byte);
}
last_byte = in_byte;
}
}
sram_bulk_write_end();
return 0;
return 0;
}