There is a line unsigned char rc = (unsigned char) ((r >> adjust)+((r >> (adjust-1))%2)); in that function which overflows a component's value if (r >> (adjust - 1)) == 511. It is also wrong to execute this at all if adjust == 0. According to oprofile a lot of time is spent in this function. See the attached patch for my try to fix and optimize this a little.
Created attachment 49280 [details] [review] Fix and optimization
please attach a file that shows the need for the patch.
Created attachment 49294 [details] Testcase
Unfortunately your patch breaks rendering of page 17 of http://www.investis.com/bby/investors/reports/2008rep/anreview08/anreveview2008.pdf Please have a look and try to fix it, otherwise your patch can not be applied.
Created attachment 49356 [details] [review] Fix and optimization I was under the impression that the code did not support JPEG 2000 images with more than three components because of the logic in JPXStream::getImageParams. It apparently does when the image dictionary overrides the values returned by that method, so interleaving all components into the first component's buffer is out of question. It's still faster than before.
Commited. Thanks
Thanks Albert and Daniel. Does this fix also apply to bug 33280 ?
No
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.