JPEG 2000 decoder support, part 2

In the last entry, I noted that JasPer itself could render all nine images correctly, but it wasn’t doing so when I was using it in render-jp2.

I dug through the sources for jiv.c yesterday, and figured out a few things I was doing differently than jiv.

For one, I was explicitly reading out the components of each image into memory separately, and then recombining the components to form the image. jiv, on the other hand, uses a different API call to read individual samples from the decoded image, without copying the samples into memory again. This seems to fix an odd and hard-to-debug error that was cropping up with images 2 and 3, where we’d try to read a bad pointer when accessing the image-width+1′th row of an image that was taller than it was wide. Very strange.

Also, jiv, unlike me, was using jas_image_chclrspc() to explicitly change the image’s color space. This fixed slightly-off colors in image 5 when I started doing it.

So now, render-jp2 correctly displays all nine images!

I don’t know how much of a performance impact these changes will have. I added a few printf()s to render-jp2, and right now it takes roughly 2.2 seconds to go from start to finish of downloading, decoding, and rendering a JPEG 2000 image in Firefox, at least for a 10 KB image. Add 0.1 seconds for an extra 100 KB. Haven’t yet tested with anything larger. This leads me to the other thing I got done this morning: Trac.

I wanted to temporarily revert the above changes to see how much of a speed difference they make. I figured, hey, I know, I’ll go into Trac and pull up the copy of nsJP2Decoder.cpp from a few revisions back. Problem was, when I visited Trac, it just spat out an incomprehensible error message. Something about “svn is not a valid repository type.” Say what? Turned out to be a combination of stale FCGI processes and missing swig-py bindings from when I recompiled Subversion on July 4th. Long story short, I spent a few hours this morning fixing my Trac install, so now there’s a web-accessible and dynamically-updated list of Subversion checkins. Much easier than running svn log

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s