-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for conformance testing #221
Conversation
There's now a lot of text in this PR, but the commit messages are still very short one-liners without any explanations. |
I got what you meant. Actually, I’m not familiar with git. Do you think the commit messages should be modified? |
Yes. True, this is advanced git usage - the tool of my choice is "stgit" (http://www.procode.org/stgit/doc/tutorial.html) - it lets me re-edit several patches-in-progress easily, and I can go back and forth in the patch series. I'll try to review your changes (your explanations are there), but before merging your code, I think it's important to preserve your text in commit messages. Commit messages are important, even more so for people less familiar with the JPEG2000 standard than you. If I ever find problems in your code, it will be vital to be able to find your comments in the git history. |
Maybe this helps: https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53 Usually commit messages are written (like yours) with a subject. In case of your first commit this is So that would be:
The advantage is that if GitHub goes down, or the repository is migrated or someone is offline (etc) one can still read all relevant details in the git commit messages using git log (for example). So if you want to add your detailed messages you can use git rebase to do so.
If you run this the first word will be After that you need to force push to your branch |
Question about "Fix incorrect calculation of derived stepsizes": which section of the standard describes the corrected formula? (The JasPer source code should really be full of code comments referring to the standard's section numbers!) |
The correct formula is written in Section E.1.1.1 of Annex E. (as Equation (E-5)) I'll put this information to the code. |
Why: If the LSB of the Sqcd or Sqcc in the QCD or QCC marker is equal to "1" , this incorrect calculation of derived stepsizes produces wrongly reconstructed sample values. How: The calculation of derived stepsizes in calcstepsizes() has been fixed according to the JPEG 2000 spec defined as the ISO/IEC 15444-1.
Answers to your questions made on the commits before force pushing are here. |
Why: If the DWT transform differs among components, the information of DWT transform used for each component should be found as the COC marker segment. This information is wrongly used for dequantization and rounding in JasPer. How: Fixed dequantization and rounding in jpc_dec_tiledecode() to use ccp->qmfbid which has the information of DWT transform.
…never decoded Why: If a tile has multiple tile-parts and all the tile-parts have the TNsot (a parameter in the tile-part header) = 0, such a tile is never decoded. How: Modified the condition whether jpc_dec_tiledecode() shall be invoked or not in jpc_dec_process_eoc()
Why: The condition for edge detection of precincts in jpc_pi_nextrpcl is wrong. (For example the p1_07 codestream used for the conformance contains first the packet for component 1, resolution 0, component 0, position (4,0) before the packet for component 0, resolution 0, component 0, position (8,0), but JasPer reads them in the wrong order.) How: Fixed the condition according to the JPEG 2000 spec defined as the ISO/IEC 15444-1.
Why: In the JPEG 2000 spec, the reconstruction parameter is introduced in the Annex E (Quantization). This reconstruction parameter can be arbitrarily chosen by the decoder, however, it is important to produce the best visual or objective quality for reconstruction. Generally, values for this parameter fall in the range [0, 1) and a common value is 0.5. How: Added new variable as the reconstruction parameter in jpc_dequantize() and set the value to 0.5.
@MaxKellermann @jubalh I modified all the commit messages. |
Thank you for the guidance. I think the commits have been appropriately modified (less confidence) |
Thanks @osamu620, I have spent a few hours today verifying your work (the |
Thanks for your great effort.
I agree. I think every variable which directly corresponds to the standard should be noted with the appropriate part of the spec. Ideally, we should make our "consensus" to do so. |
@osamu620 Would it be possible to provide a test case (or two) that we could add to the JasPer test suite that would catch the quantization/dequantization bug that you found? Or, if you can suggest the tightening of any of the PSNR thresholds used in some of our existing test cases that would have caught this bug, this might be better (as this would allow existing test images to be used). This type of bug would be a good thing to be able to catch via one (or more) test cases. (If you are able to provide a test case and you use an image not already used for testing in JasPer, please ensure that it does not pose any copyright issues with respect to image ownership.) |
@mdadams I'll look the codes of JasPer test suite and will provide some solutions. (I’m afraid that I’m not familiar with the JasPer test suites.) |
@osamu620 The tests that would be of interest in your case are the ones driven off the file called test/bin/codec_tests. This file has a record for each test. The important thing is that these tests can specify a threshold on the PSNR (or PAE). If there is a bug in the quantization/dequantization, then the fact that all of the tests with PSNR thresholds are passing suggests that some of these thresholds are set too low (so they are too easily satisfied). For example, one record in codec_tests reads as follows:
/* grayscale image, irreversible 9/7 WT */ The above entry says that the image stawamuschief_gray.pnm is to be encoded with mode=real (9/7 wavelet transform) at a rate of 0.05 with 5 resolution levels and then the result is decoded and the PSNR is checked to be at least 28.0 dB. If this PSNR requirement is not met, the test fails. If there is a bug in quantization/dequanitzation, the some of the "psnr=" thresholds must be set too low. Does that help? Incidentally, the test images are in the directory data/images. |
Some code fixes have been made for the conformance testing defined in ISO/IEC 15444-4.
Motivation:
Description:
3204e67
calcstepsizes()
has been fixed according to the JPEG 2000 spec defined as the ISO/IEC 15444-1.1c220a1
jpc_dec_tiledecode()
to useccp->qmfbid
which has the information of DWT transform.cc814c9
jpc_dec_tiledecode()
shall be invoked or not injpc_dec_process_eoc()
2004078
jpc_pi_nextrpcl
is wrong. (For example the p1_07 codestream used for the conformance contains first the packet for component 1, resolution 0, component 0, position (4,0) before the packet for component 0, resolution 0, component 0, position (8,0), but JasPer reads them in the wrong order.)55562ce
jpc_dequantize()
and set the value to 0.5.Results:
Note - It has been confirmed that the PAE for p1_03 is under the allowable value with JPC_FIX_FRACBITS = 15.