git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added fastlz support in record device
[swftools.git]
/
lib
/
devices
/
record.c
diff --git
a/lib/devices/record.c
b/lib/devices/record.c
index
f79d32c
..
4365230
100644
(file)
--- a/
lib/devices/record.c
+++ b/
lib/devices/record.c
@@
-39,6
+39,9
@@
#include "../log.h"
#include "../os.h"
#include "../png.h"
#include "../log.h"
#include "../os.h"
#include "../png.h"
+#ifdef HAVE_FASTLZ
+#include "../fastlz.h"
+#endif
#include "record.h"
//#define STATS
#include "record.h"
//#define STATS
@@
-176,6
+179,8
@@
static void dumpImage(writer_t*w, state_t*state, gfximage_t*img)
//45.2% images (3055340 bytes) (without filter)
//39.9% images (2458904 bytes) (with filter, Z_BEST_SPEED)
//35.3% images (2027305 bytes) (with filter, Z_BEST_COMPRESSION)
//45.2% images (3055340 bytes) (without filter)
//39.9% images (2458904 bytes) (with filter, Z_BEST_SPEED)
//35.3% images (2027305 bytes) (with filter, Z_BEST_COMPRESSION)
+ //48.0% images (3480495 bytes) (with filter, fastlz)
+
unsigned char*filter = malloc(img->height);
int y;
gfxcolor_t*image = malloc(img->width*img->height*sizeof(gfxcolor_t));
unsigned char*filter = malloc(img->height);
int y;
gfxcolor_t*image = malloc(img->width*img->height*sizeof(gfxcolor_t));
@@
-187,7
+192,13
@@
static void dumpImage(writer_t*w, state_t*state, gfximage_t*img)
int size = img->width*img->height;
uLongf compressdata_size = compressBound(size*sizeof(gfxcolor_t));
void*compressdata = malloc(compressdata_size);
int size = img->width*img->height;
uLongf compressdata_size = compressBound(size*sizeof(gfxcolor_t));
void*compressdata = malloc(compressdata_size);
+
+#ifdef HAVE_FASTLZ
+ compressdata_size = fastlz_compress_level(1, (void*)image, size*sizeof(gfxcolor_t), compressdata);
+#else
compress2(compressdata, &compressdata_size, (void*)image, sizeof(gfxcolor_t)*size, Z_BEST_SPEED);
compress2(compressdata, &compressdata_size, (void*)image, sizeof(gfxcolor_t)*size, Z_BEST_SPEED);
+#endif
+
writer_writeU32(w, compressdata_size);
w->write(w, filter, img->height);
w->write(w, compressdata, compressdata_size);
writer_writeU32(w, compressdata_size);
w->write(w, filter, img->height);
w->write(w, compressdata, compressdata_size);
@@
-213,7
+224,13
@@
static gfximage_t readImage(reader_t*r, state_t*state)
unsigned char*filter = malloc(img.height);
r->read(r, filter, img.height);
r->read(r, compressdata, compressdata_size);
unsigned char*filter = malloc(img.height);
r->read(r, filter, img.height);
r->read(r, compressdata, compressdata_size);
+
+#ifdef HAVE_FASTLZ
+ fastlz_decompress(compressdata, compressdata_size, (void*)img.data, size);
+#else
uncompress((void*)img.data, &size, compressdata, compressdata_size);
uncompress((void*)img.data, &size, compressdata, compressdata_size);
+#endif
+
int y;
unsigned char*line = malloc(img.width*sizeof(gfxcolor_t));
for(y=0;y<img.height;y++) {
int y;
unsigned char*line = malloc(img.width*sizeof(gfxcolor_t));
for(y=0;y<img.height;y++) {