Testing the decoder
- To test the decoder, you must start by downloading the source-code of the libj2k C library. This library can be downloaded from the J2000.org website using the online CVS browser.
- You can create a c:\j2000\ folder and extract the contents of the archive there using WinZip for example.
- The next step is to compile the DLL of the library using Visual Studio 6. To do this, you can simply double-click on the c:\j2000\libj2k\libj2k.dsp icon in Windows Explorer and press F7 once the project is opened.
- Now that the J2000 library is compiled, you can build one of the applications that use the library. To easily test the decoder, you can download the graphical j2kview JPEG-2000 viewer program. You should also download the sample JPEG-2000 codestreams to test the decoder on. The j2kview program and the sample codestreams can be downloaded using the online CVS browser. Once the tarballs are downloaded, extract the contents int the c:\j2000\ folder.
- The j2kview program is written in C# and uses the .NET framework. If you don't have the .NET framework SDK installed, you can download it here. Once the .NET framework SDK is installed, you can compile j2kview using the command csc /unsafe j2kview.cs. The /unsafe switch must be used because j2kview.cs calls the libj2k DLL written in C.
- When libj2k and j2kview are compiled, you must add their path to the PATH environment variable. This can be done using the Control Panel by clicking on the System icon and selecting the Advanced tab. The path of the libj2k library is generally c:\j2000\libj2k\debug\ and the path of j2kview is c:\j2000\j2kview.
- For your convenience, you may associate the j2kview program with the J2K file type, so that j2kview is launched when you click on a J2K file in Windows Explorer. This can be done by clicking the Folder Options menu item in the Tools menu of Explorer and by selecting the File Types tab.
- At this point, when you click on a J2K file in Windows Explorer, it should be viewed by the j2kview program. You can test this by clicking on the c:\j2000\testing\j2k\p0_01.j2k file that is included with the sample JPEG-2000 codestreams. The resulting decoded image should look like this:
- This J2K sample codestream is encoded using the perfectly reversible 5-3 wavelet. You can test that the decoded image is exactly the same as the original by printing the MD5 hashcode of the component in base64. This can be done by right-clicking on the image component and by selecting MD5 in the context menu. For this J2K sample, the result is as follows:

This MD5 sum can be compared against the MD5-sum of the original image using PGXView, which can also be downloaded and installed from J2000.org in a way similar to j2kview.
Testing the encoder
I'm writing this tomorrow.