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
2009-10-21 02:35:17
Many thanks!So you mean, if I want to interrupt decoding, I need to modify libjpeg source code, right?
2009-10-21 09:43:42
what do you want to interrupt? `jpeg_read_scanlines()` ?
Georg Fritzsche
2009-10-21 09:53:14
decoding an image needs 1000ms, at 300ms I decide to cancel decoding.I wish the decoder can interrupt immediately
2009-10-22 01:35:58
While decoding an image might need 1000ms, one call to jpeg_read_scanlines() should be fast if you read small chunks.
Georg Fritzsche
2009-10-22 15:15:31