Use zlib - thanks to Dcoder!
This commit is contained in:
parent
2731ddfe14
commit
5fb64e9ea8
100
Inc/fastlz.h
100
Inc/fastlz.h
|
@ -1,100 +0,0 @@
|
||||||
/*
|
|
||||||
FastLZ - lightning-fast lossless compression library
|
|
||||||
|
|
||||||
Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
|
|
||||||
Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
|
|
||||||
Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FASTLZ_H
|
|
||||||
#define FASTLZ_H
|
|
||||||
|
|
||||||
#define FASTLZ_VERSION 0x000100
|
|
||||||
|
|
||||||
#define FASTLZ_VERSION_MAJOR 0
|
|
||||||
#define FASTLZ_VERSION_MINOR 0
|
|
||||||
#define FASTLZ_VERSION_REVISION 0
|
|
||||||
|
|
||||||
#define FASTLZ_VERSION_STRING "0.1.0"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
Compress a block of data in the input buffer and returns the size of
|
|
||||||
compressed block. The size of input buffer is specified by length. The
|
|
||||||
minimum input buffer size is 16.
|
|
||||||
|
|
||||||
The output buffer must be at least 5% larger than the input buffer
|
|
||||||
and can not be smaller than 66 bytes.
|
|
||||||
|
|
||||||
If the input is not compressible, the return value might be larger than
|
|
||||||
length (input buffer size).
|
|
||||||
|
|
||||||
The input buffer and the output buffer can not overlap.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int fastlz_compress(const void* input, int length, void* output);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Decompress a block of compressed data and returns the size of the
|
|
||||||
decompressed block. If error occurs, e.g. the compressed data is
|
|
||||||
corrupted or the output buffer is not large enough, then 0 (zero)
|
|
||||||
will be returned instead.
|
|
||||||
|
|
||||||
The input buffer and the output buffer can not overlap.
|
|
||||||
|
|
||||||
Decompression is memory safe and guaranteed not to write the output buffer
|
|
||||||
more than what is specified in maxout.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int fastlz_decompress(const void* input, int length, void* output, int maxout);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Compress a block of data in the input buffer and returns the size of
|
|
||||||
compressed block. The size of input buffer is specified by length. The
|
|
||||||
minimum input buffer size is 16.
|
|
||||||
|
|
||||||
The output buffer must be at least 5% larger than the input buffer
|
|
||||||
and can not be smaller than 66 bytes.
|
|
||||||
|
|
||||||
If the input is not compressible, the return value might be larger than
|
|
||||||
length (input buffer size).
|
|
||||||
|
|
||||||
The input buffer and the output buffer can not overlap.
|
|
||||||
|
|
||||||
Compression level can be specified in parameter level. At the moment,
|
|
||||||
only level 1 and level 2 are supported.
|
|
||||||
Level 1 is the fastest compression and generally useful for short data.
|
|
||||||
Level 2 is slightly slower but it gives better compression ratio.
|
|
||||||
|
|
||||||
Note that the compressed data, regardless of the level, can always be
|
|
||||||
decompressed using the function fastlz_decompress above.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int fastlz_compress_level(int level, const void* input, int length, void* output);
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* FASTLZ_H */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,12 @@
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "sprites.h"
|
#include "sprites.h"
|
||||||
#include "fastlz.h"
|
|
||||||
|
#define MINIZ_NO_ARCHIVE_APIS
|
||||||
|
#define MINIZ_NO_STDIO
|
||||||
|
#define MINIZ_NO_TIME
|
||||||
|
|
||||||
|
#include "miniz.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef ssd1306
|
#ifndef ssd1306
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ BUILD_DIR = build
|
||||||
######################################
|
######################################
|
||||||
C_SOURCES = \
|
C_SOURCES = \
|
||||||
Src/main.c \
|
Src/main.c \
|
||||||
Src/fastlz.c \
|
Src/miniz.c \
|
||||||
Src/sprites.c \
|
Src/sprites.c \
|
||||||
Src/image.c \
|
Src/image.c \
|
||||||
Src/ssd1306.c \
|
Src/ssd1306.c \
|
||||||
|
|
551
Src/fastlz.c
551
Src/fastlz.c
|
@ -1,551 +0,0 @@
|
||||||
/*
|
|
||||||
FastLZ - lightning-fast lossless compression library
|
|
||||||
|
|
||||||
Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
|
|
||||||
Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
|
|
||||||
Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(FASTLZ__COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Always check for bound when decompressing.
|
|
||||||
* Generally it is best to leave it defined.
|
|
||||||
*/
|
|
||||||
#define FASTLZ_SAFE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Give hints to the compiler for branch prediction optimization.
|
|
||||||
*/
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
|
||||||
#define FASTLZ_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1))
|
|
||||||
#define FASTLZ_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0))
|
|
||||||
#else
|
|
||||||
#define FASTLZ_EXPECT_CONDITIONAL(c) (c)
|
|
||||||
#define FASTLZ_UNEXPECT_CONDITIONAL(c) (c)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Use inlined functions for supported systems.
|
|
||||||
*/
|
|
||||||
#if defined(__GNUC__) || defined(__DMC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C)
|
|
||||||
#define FASTLZ_INLINE inline
|
|
||||||
#elif defined(__BORLANDC__) || defined(_MSC_VER) || defined(__LCC__)
|
|
||||||
#define FASTLZ_INLINE __inline
|
|
||||||
#else
|
|
||||||
#define FASTLZ_INLINE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Prevent accessing more than 8-bit at once, except on x86 architectures.
|
|
||||||
*/
|
|
||||||
#if !defined(FASTLZ_STRICT_ALIGN)
|
|
||||||
#define FASTLZ_STRICT_ALIGN
|
|
||||||
#if defined(__i386__) || defined(__386) /* GNU C, Sun Studio */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(__i486__) || defined(__i586__) || defined(__i686__) /* GNU C */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(_M_IX86) /* Intel, MSVC */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(__386)
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(_X86_) /* MinGW */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(__I86__) /* Digital Mars */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: use preprocessor magic to set this on different platforms!
|
|
||||||
*/
|
|
||||||
typedef unsigned char flzuint8;
|
|
||||||
typedef unsigned short flzuint16;
|
|
||||||
typedef unsigned int flzuint32;
|
|
||||||
|
|
||||||
/* prototypes */
|
|
||||||
int fastlz_compress(const void* input, int length, void* output);
|
|
||||||
int fastlz_compress_level(int level, const void* input, int length, void* output);
|
|
||||||
int fastlz_decompress(const void* input, int length, void* output, int maxout);
|
|
||||||
|
|
||||||
#define MAX_COPY 32
|
|
||||||
#define MAX_LEN 264 /* 256 + 8 */
|
|
||||||
#define MAX_DISTANCE 8192
|
|
||||||
|
|
||||||
#if !defined(FASTLZ_STRICT_ALIGN)
|
|
||||||
#define FASTLZ_READU16(p) *((const flzuint16*)(p))
|
|
||||||
#else
|
|
||||||
#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HASH_LOG 13
|
|
||||||
#define HASH_SIZE (1<< HASH_LOG)
|
|
||||||
#define HASH_MASK (HASH_SIZE-1)
|
|
||||||
#define HASH_FUNCTION(v,p) { v = FASTLZ_READU16(p); v ^= FASTLZ_READU16(p+1)^(v>>(16-HASH_LOG));v &= HASH_MASK; }
|
|
||||||
|
|
||||||
#undef FASTLZ_LEVEL
|
|
||||||
#define FASTLZ_LEVEL 1
|
|
||||||
|
|
||||||
#undef FASTLZ_COMPRESSOR
|
|
||||||
#undef FASTLZ_DECOMPRESSOR
|
|
||||||
#define FASTLZ_COMPRESSOR fastlz1_compress
|
|
||||||
#define FASTLZ_DECOMPRESSOR fastlz1_decompress
|
|
||||||
static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
|
|
||||||
static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
|
|
||||||
#include "fastlz.c"
|
|
||||||
|
|
||||||
#undef FASTLZ_LEVEL
|
|
||||||
#define FASTLZ_LEVEL 2
|
|
||||||
|
|
||||||
#undef MAX_DISTANCE
|
|
||||||
#define MAX_DISTANCE 8191
|
|
||||||
#define MAX_FARDISTANCE (65535+MAX_DISTANCE-1)
|
|
||||||
|
|
||||||
#undef FASTLZ_COMPRESSOR
|
|
||||||
#undef FASTLZ_DECOMPRESSOR
|
|
||||||
#define FASTLZ_COMPRESSOR fastlz2_compress
|
|
||||||
#define FASTLZ_DECOMPRESSOR fastlz2_decompress
|
|
||||||
static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
|
|
||||||
static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
|
|
||||||
#include "fastlz.c"
|
|
||||||
|
|
||||||
int fastlz_compress(const void* input, int length, void* output)
|
|
||||||
{
|
|
||||||
/* for short block, choose fastlz1 */
|
|
||||||
if(length < 65536)
|
|
||||||
return fastlz1_compress(input, length, output);
|
|
||||||
|
|
||||||
/* else... */
|
|
||||||
return fastlz2_compress(input, length, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
int fastlz_decompress(const void* input, int length, void* output, int maxout)
|
|
||||||
{
|
|
||||||
/* magic identifier for compression level */
|
|
||||||
int level = ((*(const flzuint8*)input) >> 5) + 1;
|
|
||||||
|
|
||||||
if(level == 1)
|
|
||||||
return fastlz1_decompress(input, length, output, maxout);
|
|
||||||
if(level == 2)
|
|
||||||
return fastlz2_decompress(input, length, output, maxout);
|
|
||||||
|
|
||||||
/* unknown level, trigger error */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fastlz_compress_level(int level, const void* input, int length, void* output)
|
|
||||||
{
|
|
||||||
if(level == 1)
|
|
||||||
return fastlz1_compress(input, length, output);
|
|
||||||
if(level == 2)
|
|
||||||
return fastlz2_compress(input, length, output);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
|
|
||||||
|
|
||||||
static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output)
|
|
||||||
{
|
|
||||||
const flzuint8* ip = (const flzuint8*) input;
|
|
||||||
const flzuint8* ip_bound = ip + length - 2;
|
|
||||||
const flzuint8* ip_limit = ip + length - 12;
|
|
||||||
flzuint8* op = (flzuint8*) output;
|
|
||||||
|
|
||||||
const flzuint8* htab[HASH_SIZE];
|
|
||||||
const flzuint8** hslot;
|
|
||||||
flzuint32 hval;
|
|
||||||
|
|
||||||
flzuint32 copy;
|
|
||||||
|
|
||||||
/* sanity check */
|
|
||||||
if(FASTLZ_UNEXPECT_CONDITIONAL(length < 4))
|
|
||||||
{
|
|
||||||
if(length)
|
|
||||||
{
|
|
||||||
/* create literal copy only */
|
|
||||||
*op++ = length-1;
|
|
||||||
ip_bound++;
|
|
||||||
while(ip <= ip_bound)
|
|
||||||
*op++ = *ip++;
|
|
||||||
return length+1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initializes hash table */
|
|
||||||
for (hslot = htab; hslot < htab + HASH_SIZE; hslot++)
|
|
||||||
*hslot = ip;
|
|
||||||
|
|
||||||
/* we start with literal copy */
|
|
||||||
copy = 2;
|
|
||||||
*op++ = MAX_COPY-1;
|
|
||||||
*op++ = *ip++;
|
|
||||||
*op++ = *ip++;
|
|
||||||
|
|
||||||
/* main loop */
|
|
||||||
while(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
|
|
||||||
{
|
|
||||||
const flzuint8* ref;
|
|
||||||
flzuint32 distance;
|
|
||||||
|
|
||||||
/* minimum match length */
|
|
||||||
flzuint32 len = 3;
|
|
||||||
|
|
||||||
/* comparison starting-point */
|
|
||||||
const flzuint8* anchor = ip;
|
|
||||||
|
|
||||||
/* check for a run */
|
|
||||||
#if FASTLZ_LEVEL==2
|
|
||||||
if(ip[0] == ip[-1] && FASTLZ_READU16(ip-1)==FASTLZ_READU16(ip+1))
|
|
||||||
{
|
|
||||||
distance = 1;
|
|
||||||
ip += 3;
|
|
||||||
ref = anchor - 1 + 3;
|
|
||||||
goto match;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* find potential match */
|
|
||||||
HASH_FUNCTION(hval,ip);
|
|
||||||
hslot = htab + hval;
|
|
||||||
ref = htab[hval];
|
|
||||||
|
|
||||||
/* calculate distance to the match */
|
|
||||||
distance = anchor - ref;
|
|
||||||
|
|
||||||
/* update hash table */
|
|
||||||
*hslot = anchor;
|
|
||||||
|
|
||||||
/* is this a match? check the first 3 bytes */
|
|
||||||
if(distance==0 ||
|
|
||||||
#if FASTLZ_LEVEL==1
|
|
||||||
(distance >= MAX_DISTANCE) ||
|
|
||||||
#else
|
|
||||||
(distance >= MAX_FARDISTANCE) ||
|
|
||||||
#endif
|
|
||||||
*ref++ != *ip++ || *ref++!=*ip++ || *ref++!=*ip++)
|
|
||||||
goto literal;
|
|
||||||
|
|
||||||
#if FASTLZ_LEVEL==2
|
|
||||||
/* far, needs at least 5-byte match */
|
|
||||||
if(distance >= MAX_DISTANCE)
|
|
||||||
{
|
|
||||||
if(*ip++ != *ref++ || *ip++!= *ref++)
|
|
||||||
goto literal;
|
|
||||||
len += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
match:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* last matched byte */
|
|
||||||
ip = anchor + len;
|
|
||||||
|
|
||||||
/* distance is biased */
|
|
||||||
distance--;
|
|
||||||
|
|
||||||
if(!distance)
|
|
||||||
{
|
|
||||||
/* zero distance means a run */
|
|
||||||
flzuint8 x = ip[-1];
|
|
||||||
while(ip < ip_bound)
|
|
||||||
if(*ref++ != x) break; else ip++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
/* safe because the outer check against ip limit */
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
while(ip < ip_bound)
|
|
||||||
if(*ref++ != *ip++) break;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we have copied something, adjust the copy count */
|
|
||||||
if(copy)
|
|
||||||
/* copy is biased, '0' means 1 byte copy */
|
|
||||||
*(op-copy-1) = copy-1;
|
|
||||||
else
|
|
||||||
/* back, to overwrite the copy count */
|
|
||||||
op--;
|
|
||||||
|
|
||||||
/* reset literal counter */
|
|
||||||
copy = 0;
|
|
||||||
|
|
||||||
/* length is biased, '1' means a match of 3 bytes */
|
|
||||||
ip -= 3;
|
|
||||||
len = ip - anchor;
|
|
||||||
|
|
||||||
/* encode the match */
|
|
||||||
#if FASTLZ_LEVEL==2
|
|
||||||
if(distance < MAX_DISTANCE)
|
|
||||||
{
|
|
||||||
if(len < 7)
|
|
||||||
{
|
|
||||||
*op++ = (len << 5) + (distance >> 8);
|
|
||||||
*op++ = (distance & 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*op++ = (7 << 5) + (distance >> 8);
|
|
||||||
for(len-=7; len >= 255; len-= 255)
|
|
||||||
*op++ = 255;
|
|
||||||
*op++ = len;
|
|
||||||
*op++ = (distance & 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* far away, but not yet in the another galaxy... */
|
|
||||||
if(len < 7)
|
|
||||||
{
|
|
||||||
distance -= MAX_DISTANCE;
|
|
||||||
*op++ = (len << 5) + 31;
|
|
||||||
*op++ = 255;
|
|
||||||
*op++ = distance >> 8;
|
|
||||||
*op++ = distance & 255;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
distance -= MAX_DISTANCE;
|
|
||||||
*op++ = (7 << 5) + 31;
|
|
||||||
for(len-=7; len >= 255; len-= 255)
|
|
||||||
*op++ = 255;
|
|
||||||
*op++ = len;
|
|
||||||
*op++ = 255;
|
|
||||||
*op++ = distance >> 8;
|
|
||||||
*op++ = distance & 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
if(FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN-2))
|
|
||||||
while(len > MAX_LEN-2)
|
|
||||||
{
|
|
||||||
*op++ = (7 << 5) + (distance >> 8);
|
|
||||||
*op++ = MAX_LEN - 2 - 7 -2;
|
|
||||||
*op++ = (distance & 255);
|
|
||||||
len -= MAX_LEN-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(len < 7)
|
|
||||||
{
|
|
||||||
*op++ = (len << 5) + (distance >> 8);
|
|
||||||
*op++ = (distance & 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*op++ = (7 << 5) + (distance >> 8);
|
|
||||||
*op++ = len - 7;
|
|
||||||
*op++ = (distance & 255);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* update the hash at match boundary */
|
|
||||||
HASH_FUNCTION(hval,ip);
|
|
||||||
htab[hval] = ip++;
|
|
||||||
HASH_FUNCTION(hval,ip);
|
|
||||||
htab[hval] = ip++;
|
|
||||||
|
|
||||||
/* assuming literal copy */
|
|
||||||
*op++ = MAX_COPY-1;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
|
|
||||||
literal:
|
|
||||||
*op++ = *anchor++;
|
|
||||||
ip = anchor;
|
|
||||||
copy++;
|
|
||||||
if(FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY))
|
|
||||||
{
|
|
||||||
copy = 0;
|
|
||||||
*op++ = MAX_COPY-1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* left-over as literal copy */
|
|
||||||
ip_bound++;
|
|
||||||
while(ip <= ip_bound)
|
|
||||||
{
|
|
||||||
*op++ = *ip++;
|
|
||||||
copy++;
|
|
||||||
if(copy == MAX_COPY)
|
|
||||||
{
|
|
||||||
copy = 0;
|
|
||||||
*op++ = MAX_COPY-1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we have copied something, adjust the copy length */
|
|
||||||
if(copy)
|
|
||||||
*(op-copy-1) = copy-1;
|
|
||||||
else
|
|
||||||
op--;
|
|
||||||
|
|
||||||
#if FASTLZ_LEVEL==2
|
|
||||||
/* marker for fastlz2 */
|
|
||||||
*(flzuint8*)output |= (1 << 5);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return op - (flzuint8*)output;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout)
|
|
||||||
{
|
|
||||||
const flzuint8* ip = (const flzuint8*) input;
|
|
||||||
const flzuint8* ip_limit = ip + length;
|
|
||||||
flzuint8* op = (flzuint8*) output;
|
|
||||||
flzuint8* op_limit = op + maxout;
|
|
||||||
flzuint32 ctrl = (*ip++) & 31;
|
|
||||||
int loop = 1;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
const flzuint8* ref = op;
|
|
||||||
flzuint32 len = ctrl >> 5;
|
|
||||||
flzuint32 ofs = (ctrl & 31) << 8;
|
|
||||||
|
|
||||||
if(ctrl >= 32)
|
|
||||||
{
|
|
||||||
#if FASTLZ_LEVEL==2
|
|
||||||
flzuint8 code;
|
|
||||||
#endif
|
|
||||||
len--;
|
|
||||||
ref -= ofs;
|
|
||||||
if (len == 7-1)
|
|
||||||
#if FASTLZ_LEVEL==1
|
|
||||||
len += *ip++;
|
|
||||||
ref -= *ip++;
|
|
||||||
#else
|
|
||||||
do
|
|
||||||
{
|
|
||||||
code = *ip++;
|
|
||||||
len += code;
|
|
||||||
} while (code==255);
|
|
||||||
code = *ip++;
|
|
||||||
ref -= code;
|
|
||||||
|
|
||||||
/* match from 16-bit distance */
|
|
||||||
if(FASTLZ_UNEXPECT_CONDITIONAL(code==255))
|
|
||||||
if(FASTLZ_EXPECT_CONDITIONAL(ofs==(31 << 8)))
|
|
||||||
{
|
|
||||||
ofs = (*ip++) << 8;
|
|
||||||
ofs += *ip++;
|
|
||||||
ref = op - ofs - MAX_DISTANCE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FASTLZ_SAFE
|
|
||||||
if (FASTLZ_UNEXPECT_CONDITIONAL(op + len + 3 > op_limit))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (FASTLZ_UNEXPECT_CONDITIONAL(ref-1 < (flzuint8 *)output))
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
|
|
||||||
ctrl = *ip++;
|
|
||||||
else
|
|
||||||
loop = 0;
|
|
||||||
|
|
||||||
if(ref == op)
|
|
||||||
{
|
|
||||||
/* optimize copy for a run */
|
|
||||||
flzuint8 b = ref[-1];
|
|
||||||
*op++ = b;
|
|
||||||
*op++ = b;
|
|
||||||
*op++ = b;
|
|
||||||
for(; len; --len)
|
|
||||||
*op++ = b;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if !defined(FASTLZ_STRICT_ALIGN)
|
|
||||||
const flzuint16* p;
|
|
||||||
flzuint16* q;
|
|
||||||
#endif
|
|
||||||
/* copy from reference */
|
|
||||||
ref--;
|
|
||||||
*op++ = *ref++;
|
|
||||||
*op++ = *ref++;
|
|
||||||
*op++ = *ref++;
|
|
||||||
|
|
||||||
#if !defined(FASTLZ_STRICT_ALIGN)
|
|
||||||
/* copy a byte, so that now it's word aligned */
|
|
||||||
if(len & 1)
|
|
||||||
{
|
|
||||||
*op++ = *ref++;
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy 16-bit at once */
|
|
||||||
q = (flzuint16*) op;
|
|
||||||
op += len;
|
|
||||||
p = (const flzuint16*) ref;
|
|
||||||
for(len>>=1; len > 4; len-=4)
|
|
||||||
{
|
|
||||||
*q++ = *p++;
|
|
||||||
*q++ = *p++;
|
|
||||||
*q++ = *p++;
|
|
||||||
*q++ = *p++;
|
|
||||||
}
|
|
||||||
for(; len; --len)
|
|
||||||
*q++ = *p++;
|
|
||||||
#else
|
|
||||||
for(; len; --len)
|
|
||||||
*op++ = *ref++;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ctrl++;
|
|
||||||
#ifdef FASTLZ_SAFE
|
|
||||||
if (FASTLZ_UNEXPECT_CONDITIONAL(op + ctrl > op_limit))
|
|
||||||
return 0;
|
|
||||||
if (FASTLZ_UNEXPECT_CONDITIONAL(ip + ctrl > ip_limit))
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*op++ = *ip++;
|
|
||||||
for(--ctrl; ctrl; ctrl--)
|
|
||||||
*op++ = *ip++;
|
|
||||||
|
|
||||||
loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
|
|
||||||
if(loop)
|
|
||||||
ctrl = *ip++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while(FASTLZ_EXPECT_CONDITIONAL(loop));
|
|
||||||
|
|
||||||
return op - (flzuint8*)output;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
|
|
86
Src/image.c
86
Src/image.c
|
@ -108,6 +108,7 @@ uint8_t image[1024] = {
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
uint8_t image[340] = {
|
uint8_t image[340] = {
|
||||||
0x01, 0x00, 0x00, 0xe0, 0xe9, 0x01, 0x0c, 0x20,
|
0x01, 0x00, 0x00, 0xe0, 0xe9, 0x01, 0x0c, 0x20,
|
||||||
0x20, 0xe0, 0x20, 0x20, 0x00, 0xe0, 0xe0, 0x40,
|
0x20, 0xe0, 0x20, 0x20, 0x00, 0xe0, 0xe0, 0x40,
|
||||||
|
@ -153,4 +154,89 @@ uint8_t image[340] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
uint8_t image[196] = {
|
||||||
|
0x78, 0x01, 0xe5, 0x8f, 0x31, 0x12, 0x82, 0x30,
|
||||||
|
0x10, 0x45, 0x97, 0x49, 0x91, 0x92, 0x23, 0x24,
|
||||||
|
0xc7, 0xb0, 0x83, 0x3b, 0x59, 0x48, 0x97, 0x74,
|
||||||
|
0x5a, 0x5a, 0x5a, 0x38, 0x72, 0x15, 0x1c, 0x2f,
|
||||||
|
0x12, 0x6f, 0x60, 0x49, 0x11, 0x13, 0x37, 0xb8,
|
||||||
|
0x32, 0x1b, 0x06, 0x86, 0x8a, 0xca, 0x37, 0x03,
|
||||||
|
0x9b, 0xfd, 0x2f, 0x93, 0x4d, 0x00, 0xfe, 0x0f,
|
||||||
|
0xad, 0x9d, 0xd6, 0xe0, 0x5c, 0x5d, 0xd7, 0xae,
|
||||||
|
0x4f, 0x34, 0xbb, 0x8c, 0x66, 0x08, 0x71, 0x63,
|
||||||
|
0x2a, 0x63, 0xff, 0x05, 0x5b, 0x26, 0x89, 0x86,
|
||||||
|
0x52, 0x62, 0x4d, 0x02, 0xc8, 0xf4, 0x89, 0xf4,
|
||||||
|
0x8b, 0x48, 0x81, 0x0b, 0x1f, 0x08, 0xef, 0xba,
|
||||||
|
0xee, 0x9e, 0x52, 0x0c, 0xa9, 0xc0, 0xf3, 0x71,
|
||||||
|
0x2c, 0x55, 0x65, 0xf2, 0x34, 0x12, 0x55, 0x29,
|
||||||
|
0xa0, 0x73, 0xb6, 0x90, 0xca, 0x50, 0xb2, 0x26,
|
||||||
|
0x39, 0xbf, 0xc8, 0x18, 0x73, 0xd8, 0x0f, 0x08,
|
||||||
|
0x64, 0x32, 0x1f, 0x4b, 0xf0, 0xfd, 0x0b, 0xaf,
|
||||||
|
0x21, 0xf3, 0xf9, 0x46, 0xc9, 0xc2, 0xda, 0xcb,
|
||||||
|
0xad, 0x6d, 0xdb, 0xab, 0xb5, 0x20, 0x14, 0xbf,
|
||||||
|
0x63, 0x1c, 0xe4, 0x69, 0x94, 0x65, 0xb5, 0x30,
|
||||||
|
0x1f, 0x1f, 0x9d, 0x11, 0x02, 0x3b, 0xc5, 0xf7,
|
||||||
|
0x3e, 0xc4, 0x91, 0xb4, 0x93, 0x4b, 0x6a, 0x67,
|
||||||
|
0xe5, 0x7b, 0x49, 0x4e, 0xe7, 0xcf, 0xb3, 0x9d,
|
||||||
|
0xe4, 0xc8, 0x45, 0xb6, 0x93, 0x9c, 0xf3, 0x07,
|
||||||
|
0x85, 0xf0, 0xa9, 0x9b,
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint8_t image[506] = {
|
||||||
|
0x78, 0x9c, 0x8d, 0x52, 0xbf, 0x6b, 0xd5, 0x40, 0x1c, 0xbf,
|
||||||
|
0xbb, 0xa4, 0x4d, 0xd4, 0xd0, 0x3c, 0xa4, 0x43, 0x50, 0xf1,
|
||||||
|
0x82, 0x08, 0x7d, 0x96, 0x22, 0x4e, 0x1d, 0xf4, 0xe1, 0x05,
|
||||||
|
0x0b, 0x8e, 0xbe, 0x82, 0x83, 0x0e, 0xc2, 0x53, 0x10, 0x5c,
|
||||||
|
0x1e, 0x38, 0xb8, 0x38, 0x94, 0x97, 0x0b, 0x74, 0x2e, 0xba,
|
||||||
|
0x76, 0x2a, 0xe2, 0xac, 0x7f, 0x82, 0xf7, 0x70, 0x12, 0x29,
|
||||||
|
0x3a, 0x89, 0x9b, 0x59, 0x44, 0x27, 0x3d, 0x5b, 0x87, 0x13,
|
||||||
|
0xd2, 0x9c, 0xdf, 0xbb, 0x34, 0x6d, 0x4c, 0x43, 0xf1, 0x33,
|
||||||
|
0x7c, 0x2f, 0xf7, 0xcd, 0xf7, 0xd7, 0xe7, 0x73, 0x5f, 0x84,
|
||||||
|
0x5a, 0x90, 0x4a, 0xca, 0x5e, 0xdb, 0xd9, 0x05, 0x91, 0xcb,
|
||||||
|
0xbe, 0x3f, 0x98, 0x9f, 0x9f, 0x0b, 0x02, 0x37, 0x08, 0x82,
|
||||||
|
0xe8, 0x7c, 0x34, 0xb8, 0x7b, 0x25, 0x46, 0xfc, 0x7f, 0x72,
|
||||||
|
0x8f, 0x80, 0x0b, 0x91, 0xe7, 0x12, 0x50, 0x68, 0x00, 0x9c,
|
||||||
|
0x79, 0x9e, 0x1f, 0x53, 0x49, 0x70, 0x55, 0x6a, 0xbd, 0xf7,
|
||||||
|
0x5b, 0x3d, 0xfc, 0x1c, 0xc3, 0x35, 0x01, 0x87, 0x30, 0xe1,
|
||||||
|
0x1c, 0x71, 0xec, 0xf6, 0x92, 0xae, 0xfa, 0x79, 0x55, 0x5f,
|
||||||
|
0x56, 0xb5, 0x85, 0x68, 0xfe, 0x55, 0xa6, 0x6b, 0xea, 0x39,
|
||||||
|
0x8e, 0x83, 0x0d, 0x1c, 0x0c, 0x5f, 0x9e, 0xe7, 0xb5, 0x6b,
|
||||||
|
0xc4, 0x3e, 0xd8, 0x59, 0x44, 0x5e, 0x10, 0xef, 0xcd, 0xf0,
|
||||||
|
0xd1, 0xf0, 0xf1, 0x48, 0xa7, 0x73, 0x2b, 0xe0, 0x8a, 0xdc,
|
||||||
|
0x0b, 0xb7, 0xcf, 0x9e, 0xba, 0xf6, 0x6a, 0xd3, 0x3d, 0xd1,
|
||||||
|
0x9f, 0x39, 0xd7, 0x1f, 0xaf, 0x2f, 0xbb, 0xcd, 0x34, 0x59,
|
||||||
|
0x94, 0xa5, 0x66, 0x34, 0x34, 0xf5, 0x2b, 0x78, 0x61, 0x48,
|
||||||
|
0x67, 0x1b, 0x21, 0x21, 0x4d, 0xb5, 0x2e, 0x95, 0x34, 0x73,
|
||||||
|
0x71, 0xde, 0xcd, 0x7b, 0x35, 0xc6, 0x35, 0x2f, 0xec, 0xa3,
|
||||||
|
0x9f, 0x68, 0xeb, 0xf4, 0xfa, 0x77, 0x5d, 0xe4, 0x1f, 0xe5,
|
||||||
|
0x56, 0x9c, 0x83, 0x02, 0x09, 0x47, 0xd9, 0x03, 0xce, 0xed,
|
||||||
|
0xcb, 0x61, 0x82, 0x56, 0xcd, 0x79, 0xdf, 0x90, 0x55, 0x46,
|
||||||
|
0x50, 0xbd, 0x5b, 0x73, 0x97, 0x1d, 0xe2, 0xd8, 0x1c, 0x0c,
|
||||||
|
0x8c, 0x43, 0x98, 0x8b, 0x52, 0x36, 0x99, 0x94, 0x45, 0x01,
|
||||||
|
0xd3, 0x34, 0x34, 0x4a, 0x08, 0x98, 0x97, 0x07, 0x57, 0x72,
|
||||||
|
0x09, 0xe1, 0xc1, 0x17, 0x5d, 0xa1, 0xa0, 0x1b, 0xd7, 0x3f,
|
||||||
|
0xfd, 0x78, 0x7d, 0x79, 0xfb, 0xd6, 0xf6, 0xbb, 0xe0, 0xde,
|
||||||
|
0xd5, 0xc8, 0x47, 0x3d, 0x74, 0xc6, 0x32, 0xcf, 0xa6, 0xd9,
|
||||||
|
0x7b, 0x1b, 0xf2, 0x76, 0x3a, 0xcd, 0xe0, 0x02, 0x26, 0xeb,
|
||||||
|
0x6e, 0xdf, 0x9e, 0xc6, 0xb1, 0x69, 0xe5, 0xfe, 0x55, 0xf4,
|
||||||
|
0x88, 0xf5, 0x36, 0x64, 0x75, 0xfd, 0x9b, 0x77, 0xd8, 0xfe,
|
||||||
|
0x00, 0xe5, 0x5e, 0xf1, 0xeb, 0xcf, 0xee, 0xce, 0xd7, 0x9d,
|
||||||
|
0x6f, 0x4f, 0xd6, 0xc6, 0xe8, 0xd9, 0x01, 0xc3, 0x19, 0xe0,
|
||||||
|
0x13, 0xa6, 0x36, 0xe4, 0x43, 0x58, 0x83, 0x1c, 0xed, 0x36,
|
||||||
|
0x58, 0x2b, 0x94, 0x52, 0xd5, 0x6a, 0x58, 0xab, 0x8a, 0x49,
|
||||||
|
0xca, 0x18, 0xf5, 0x70, 0x3d, 0x4e, 0x1d, 0xb9, 0xd8, 0x54,
|
||||||
|
0xef, 0x46, 0xb4, 0x32, 0x5a, 0x48, 0x87, 0x2c, 0xa5, 0x8c,
|
||||||
|
0x32, 0x36, 0xa2, 0xa1, 0x03, 0x71, 0xee, 0xc9, 0xe7, 0x2e,
|
||||||
|
0x41, 0x41, 0x7c, 0x18, 0xe8, 0x84, 0x0c, 0x66, 0x30, 0x7a,
|
||||||
|
0x9a, 0xe7, 0x15, 0xa2, 0xda, 0x44, 0xf5, 0xf4, 0x1f, 0xbe,
|
||||||
|
0x76, 0xe9, 0xcc, 0xa0, 0x0b, 0x8e, 0xdd, 0xc2, 0x63, 0xb4,
|
||||||
|
0x89, 0x0f, 0x35, 0x68, 0x78, 0x93, 0x78, 0x11, 0xa1, 0xbe,
|
||||||
|
0xbb, 0x84, 0xc6, 0x78, 0xe9, 0x22, 0xf1, 0x5b, 0x2c, 0xa1,
|
||||||
|
0xbc, 0x59, 0x68, 0xf3, 0xc0, 0xe6, 0x80, 0x4d, 0xac, 0x3b,
|
||||||
|
0xfc, 0x05, 0x6e, 0x37, 0xf3, 0xe4,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
11
Src/main.c
11
Src/main.c
|
@ -97,7 +97,8 @@ int main(void)
|
||||||
HAL_UART_Receive_IT(&huart1, (uint8_t*) &UART1_Data, 1);
|
HAL_UART_Receive_IT(&huart1, (uint8_t*) &UART1_Data, 1);
|
||||||
//drawLine(0,2, 150, 2);
|
//drawLine(0,2, 150, 2);
|
||||||
//drawLine(0,4, 150, 4);
|
//drawLine(0,4, 150, 4);
|
||||||
//ssd1306_LoadImage();
|
ssd1306_LoadImage();
|
||||||
|
ssd1306_UpdateScreen();
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
|
@ -107,7 +108,7 @@ int main(void)
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END WHILE */
|
||||||
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
ssd1306_Fill(Black);
|
//ssd1306_Fill(Black);
|
||||||
//ssd1306_Fill(White);
|
//ssd1306_Fill(White);
|
||||||
/*
|
/*
|
||||||
int x, msg;
|
int x, msg;
|
||||||
|
@ -123,9 +124,9 @@ int main(void)
|
||||||
//starfield_Update();
|
//starfield_Update();
|
||||||
//cube_Update(60);
|
//cube_Update(60);
|
||||||
*/
|
*/
|
||||||
ssd1306_Anim();
|
//ssd1306_Anim();
|
||||||
ssd1306_UpdateScreen();
|
//ssd1306_UpdateScreen();
|
||||||
HAL_Delay(100);
|
//HAL_Delay(100);
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -62,7 +62,23 @@ static int x = -64;
|
||||||
|
|
||||||
void ssd1306_LoadImage(void) {
|
void ssd1306_LoadImage(void) {
|
||||||
//memcpy(SSD1306_Buffer, image, 1024);
|
//memcpy(SSD1306_Buffer, image, 1024);
|
||||||
fastlz_decompress(image, 1024, SSD1306_Buffer, 1024);
|
//fastlz_decompress(image, 1024, SSD1306_Buffer, 1024);
|
||||||
|
|
||||||
|
z_stream infstream;
|
||||||
|
infstream.zalloc = Z_NULL;
|
||||||
|
infstream.zfree = Z_NULL;
|
||||||
|
infstream.opaque = Z_NULL;
|
||||||
|
|
||||||
|
// setup "b" as the input and "c" as the compressed output
|
||||||
|
//infstream.avail_in = (uInt)((char*)defstream.next_out - image); // size of input
|
||||||
|
infstream.next_in = (Bytef *)image; // input char array
|
||||||
|
infstream.avail_out = (uInt)sizeof(SSD1306_Buffer); // size of output
|
||||||
|
infstream.next_out = (Bytef *)SSD1306_Buffer; // output char array
|
||||||
|
|
||||||
|
// the actual DE-compression work.
|
||||||
|
inflateInit(&infstream);
|
||||||
|
inflate(&infstream, Z_NO_FLUSH);
|
||||||
|
inflateEnd(&infstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssd1306_DrawSprite(SpriteDef *sprite, int x, int y) {
|
void ssd1306_DrawSprite(SpriteDef *sprite, int x, int y) {
|
||||||
|
|
4
image.py
4
image.py
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import sys
|
import sys
|
||||||
#import zlib
|
import zlib
|
||||||
|
|
||||||
invert = 0
|
invert = 0
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ for bank in range(0, 8):
|
||||||
c = c - 1
|
c = c - 1
|
||||||
buffer.append(value)
|
buffer.append(value)
|
||||||
|
|
||||||
#buffer = zlib.compress(bytes(buffer))
|
buffer = zlib.compress(bytes(buffer))
|
||||||
|
|
||||||
c = 0
|
c = 0
|
||||||
bytes_per_line = 10
|
bytes_per_line = 10
|
||||||
|
|
Loading…
Reference in New Issue