static void dumpImage(writer_t*w, state_t*state, gfximage_t*img)
{
int oldpos = w->pos;
writer_writeU16(w, img->width);
writer_writeU16(w, img->height);
#ifdef COMPRESS_IMAGES
static void dumpImage(writer_t*w, state_t*state, gfximage_t*img)
{
int oldpos = w->pos;
writer_writeU16(w, img->width);
writer_writeU16(w, img->height);
#ifdef COMPRESS_IMAGES
+ //48.0% images (3488650 bytes) (without filter, Z_BEST_SPEED)
+ //55.3% images (4665889 bytes) (without filter, fastlz level 2)
+ //55.6% images (4726334 bytes) (without filter, fastlz level 1)
for(y=0;y<img->height;y++) {
filter[y] = png_apply_filter_32(
(void*)&image[y*img->width],
(void*)&img->data[y*img->width], img->width, y);
}
for(y=0;y<img->height;y++) {
filter[y] = png_apply_filter_32(
(void*)&image[y*img->width],
(void*)&img->data[y*img->width], img->width, y);
}
int size = img->width*img->height;
uLongf compressdata_size = compressBound(size*sizeof(gfxcolor_t));
void*compressdata = malloc(compressdata_size);
#ifdef HAVE_FASTLZ
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);
+ compressdata_size = fastlz_compress_level(2, (void*)image, size*sizeof(gfxcolor_t), compressdata);
- compress2(compressdata, &compressdata_size, (void*)image, sizeof(gfxcolor_t)*size, Z_BEST_SPEED);
+ compress2(compressdata, &compressdata_size, (void*)image, sizeof(gfxcolor_t)*size, 6);
unsigned char*filter = malloc(img.height);
r->read(r, filter, img.height);
unsigned char*filter = malloc(img.height);
r->read(r, filter, img.height);
fastlz_decompress(compressdata, compressdata_size, (void*)img.data, size);
fastlz_decompress(compressdata, compressdata_size, (void*)img.data, size);
uncompress((void*)img.data, &size, compressdata, compressdata_size);
uncompress((void*)img.data, &size, compressdata, compressdata_size);