This project has moved and is read-only. For the latest updates, please go here.

JPEG 2000 Encoder very slow in multithread setup

Jan 6, 2015 at 5:32 PM
I use Imagemagick.net for converting pictures in TIFs and perform the color space of them.

At the moment i only use imagemagick.net for the color transform and save the pictures to TIF files, than i use my own JPEG2000 encoder (based on openjpeg) to encode the pictures to J2K.

Now i will change the whole process to only use imagemagick.net, so i only have to change the output format of the first process and disable my encoder.

This works now, but with very low speed. Also the CPU load is very low.
My programm runns up to 16 threads, when i change the output format to TIFF, CPU load go to 100%, back to J2K the load is about 10-15%.

I have measured the time for one picture to convert from the source format to J2K, and for this one picture procress i have a increase in speed compared to the old process.
But with multithreading all is very slow.....

Someone have an idea?
Jan 6, 2015 at 9:12 PM
Edited Jan 6, 2015 at 10:41 PM
The jp2 coder that uses the OpenJPEG library in ImageMagick does not seem to have support for reading/writing multiple images at the same time. This restriction was probably put there a while ago. I will have to check if OpenJPEG still does not support reading images multi-threaded. But it seems you are already using it in a multi-threaded environment. I will get back to you when I know more.

EDIT: We removed the NoThreadSupport from the jp2 coder. The next version of Magick.NET will be able to write your jp2 images much faster.
Jan 7, 2015 at 5:24 PM
My J2K encoder uses openjpeg 1.5.1, i will test the new version when its available. Thanks.
Jan 7, 2015 at 6:01 PM
I could get you a development build if you are interested. Contact me through Codeplex so I get your e-mail. Can you also specify the build you need? X86/x64/any and q8/q16.