* Optimize JPEG scaling by downscaling as much as possible during decompression.

This commit is contained in:
Justin Maggard
2010-06-08 17:34:29 +00:00
parent 20bb1db8a7
commit c779eab4de
6 changed files with 33 additions and 19 deletions

View File

@ -393,7 +393,7 @@ image_new(int32_t width, int32_t height)
}
image *
image_new_from_jpeg(const char * path, int is_file, const char * buf, int size)
image_new_from_jpeg(const char * path, int is_file, const char * buf, int size, int scale)
{
image *vimage;
FILE *file = NULL;
@ -427,6 +427,7 @@ image_new_from_jpeg(const char * path, int is_file, const char * buf, int size)
return NULL;
}
jpeg_read_header(&cinfo, TRUE);
cinfo.scale_denom = scale;
cinfo.do_fancy_upsampling = FALSE;
cinfo.do_block_smoothing = FALSE;
jpeg_start_decompress(&cinfo);