tags:

views:

94

answers:

1

I am using libjpeg for decode jpeg file. when decoding a large image, user may switch to another jpeg file, So is decode-interrupt supported by libjpeg? Many thanks!

+1  A: 

I'm not sure i understand your problem.

As far as i recall you do the usual boiler-plate up to jpeg_start_decompress(), then you start reading the lines via jpeg_read_scanlines() iteratively. If you need to cancel the operation, break out of the loop reading the scanlines.
If you need better responsiveness, read in smaller chunks.

Georg Fritzsche
Many thanks!So you mean, if I want to interrupt decoding, I need to modify libjpeg source code, right?
what do you want to interrupt? `jpeg_read_scanlines()` ?
Georg Fritzsche
decoding an image needs 1000ms, at 300ms I decide to cancel decoding.I wish the decoder can interrupt immediately
While decoding an image might need 1000ms, one call to jpeg_read_scanlines() should be fast if you read small chunks.
Georg Fritzsche