Bug 504663

Summary: OpenJPEG produces decompressed images with massive corruption
Product: [Fedora] Fedora Reporter: Adam Goode <adam>
Component: openjpegAssignee: Rex Dieter <rdieter>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 11CC: rdieter, seg
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 1.3-5.fc10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-16 06:51:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Goode 2009-06-08 18:07:06 UTC
Description of problem:
On F11 x86_64 (not tested on 32-bit), OpenJPEG produces decompressed images with massive corruption.


Version-Release number of selected component (if applicable):
openjpeg-1.3-4.fc11.x86_64


How reproducible:
Always.


Steps to Reproduce:
1. Use imagemagick to create a jp2 file (uses jasper, not openjpeg)
 $ convert test.ppm test.jp2
2. Verify image is good
 $ display test.jp2
3. Decompress with openjpeg
 $ j2k_to_image -i test.jp2 -o test-out.ppm
4. See the corruption
 $ display test-out.ppm
  
Actual results:
Corrupted image.

Expected results:
Correct image.

Additional info:
If I replace openjpeg-libs with openjpeg-libs-1.3-2.fc9.x86_64, things work. I suspect a gcc 4.4 issue.

Comment 1 Rex Dieter 2009-06-19 13:23:24 UTC
adjusting summary. :)

Comment 2 Rex Dieter 2009-06-19 15:04:23 UTC
I'm working on an update, and removed a hard-coded -O3 optimization, and in my preliminary tests, seems to fix the issue.

Comment 3 Adam Goode 2009-06-19 15:08:59 UTC
Hah, thanks for fixing the summary.

If removing -O3 fixes the issue, then it may very well be something triggered by the autovectorizer in gcc 4.4. I will check to see if the bug exists on i586, which doesn't have sse2 and thus no vectorization.

In theory, we want -O3 for this library, because of the benefits of vectorization.

Comment 4 Fedora Update System 2009-06-19 15:19:01 UTC
openjpeg-1.3-5.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/openjpeg-1.3-5.fc11

Comment 5 Fedora Update System 2009-06-19 15:19:45 UTC
openjpeg-1.3-5.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/openjpeg-1.3-5.fc10

Comment 6 Adam Goode 2009-06-19 15:39:06 UTC
Yeah, openjpeg-1.3-4.fc11.i586 works fine, so it's probably autovectorization.

Comment 7 Rex Dieter 2009-06-19 15:59:43 UTC
What's your recommendation then?

If a gcc bug, the gcc folk will likely want a smallish test case.

Further, can we assume this is specific to F11/gcc44?  I guess we have no evidence otherwise, atm.

Comment 8 Adam Goode 2009-06-19 16:04:23 UTC
-O2 is the way for now, some investigation of openjpeg or gcc and upstream fixes will eventually be the way.

Comment 9 Callum Lerwick 2009-06-20 00:56:10 UTC
Interesting. I've done a lot of optimization work on OpenJPEG a lot of which is upstream, extensively tested with -O3 and autovectorization enabled, and are the settings I recommend. So it really ought to work. Some of the code (like the MCT) is specifically designed to autovectorize.

Comment 10 Fedora Update System 2009-06-24 19:20:24 UTC
openjpeg-1.3-5.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update openjpeg'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-6882

Comment 11 Fedora Update System 2009-06-24 19:24:06 UTC
openjpeg-1.3-5.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update openjpeg'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-6786

Comment 12 Fedora Update System 2009-07-16 06:51:15 UTC
openjpeg-1.3-5.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2009-07-16 06:54:04 UTC
openjpeg-1.3-5.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.