aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Hawthorn <jhawthor@uvic.ca>2009-02-17 01:12:47 -0800
committerJohn Hawthorn <jhawthor@uvic.ca>2009-02-17 01:12:47 -0800
commitc43cbcacad6d4085996f29a6c1701e64eae97b71 (patch)
treeee1469b18638ff147560729b7c3f68a66bb13f12 /src
parenta55738cf6d32e1d18a3c793df3c6c2797c25ebfa (diff)
downloadmirror-meh-c43cbcacad6d4085996f29a6c1701e64eae97b71.tar.gz
mirror-meh-c43cbcacad6d4085996f29a6c1701e64eae97b71.tar.bz2
mirror-meh-c43cbcacad6d4085996f29a6c1701e64eae97b71.zip
minor minor change to jpeg (1% faster)
Diffstat (limited to 'src')
-rw-r--r--src/jpeg.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/jpeg.c b/src/jpeg.c
index 4271975..ea8188c 100644
--- a/src/jpeg.c
+++ b/src/jpeg.c
@@ -91,13 +91,16 @@ static int jpeg_read(struct image *img){
jpeg_start_decompress(&j->cinfo);
- unsigned char *buf = img->buf;
if(j->cinfo.output_components == 3){
- JSAMPARRAY buffer = &buf;
- for(y = 0; y < j->cinfo.output_height; y++){
- jpeg_read_scanlines(&j->cinfo, buffer, 1);
- buf += row_stride;
+ JSAMPROW rows[2];
+ rows[0] = img->buf;
+ rows[1] = rows[0] + row_stride;
+ for(y = 0; y < j->cinfo.output_height;){
+ int n = jpeg_read_scanlines(&j->cinfo, rows, 2);
+ y += n;
+ rows[0] = rows[n-1] + row_stride;
+ rows[1] = rows[0] + row_stride;
}
}else if(j->cinfo.output_components == 1){
JSAMPARRAY buffer = (*j->cinfo.mem->alloc_sarray)((j_common_ptr)&j->cinfo, JPOOL_IMAGE, row_stride, 4);