Re: [patch] batch scanlines when loading JPEG...



On Fri, 2009-08-28 at 16:12 +0100, Daniel J Blueman wrote:

> I've written and tested a small patch that increases efficiency
> (particularly in small-cache systems) of loading JPEG images: override
> the recommended lines with what we've already allocated; increase
> batch size from 4 to 8 lines.

Thanks for trying to make JPEG loading faster; we could certainly use
that :)  A few comments:

First, did you actually test that patch (did you send the wrong one)?
The last hunk doesn't compile:
+			/* batch line updates f	or efficiency */
+			cinfo->rec_outbuf_height = cinfo.rec_outbuf_height > LINEBUF_SIZE ? cinfo.rec_outbuf_height : LINEBUF_SIZE;
+

That should be "cinfo->blah" instead of "cinfo.blah".

Second, that test looks wrong:

cinfo.rec_outbuf_height = cinfo.rec_outbuf_height > LINEBUF_SIZE ? cinfo.rec_outbuf_height : LINEBUF_SIZE;

I just checked the libjpeg sources and it will never return
cinfo.rec_outbuf_height larger than 4.  Thus, the test is redundant.
However, if libjpeg ever changes and sets rec_outbuf_height to something
larger than our LINEBUF_SIZE, you'll be trampling over memory as the
lines array is not big enough.

Third, I ran a quick benchmark with 

  /usr/bin/time eog image.jpg

for a 39 MB JPEG (a 11299x10764-pixel satellite image which expands t o
about 360 MB in RAM).  Both without your patch and with the patch, it
loads consistently in about 11.3 seconds.  I couldn't measure any
difference.

  Federico



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]