Bug 364231

Summary: Support JPEG2000 using OpenJPEG to replace LibJasper
Product: [Applications] digikam Reporter: Christoph Anton Mitterer <calestyo>
Component: Plugin-DImg-JP2KAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles, max+kde, mvetter, steve
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 7.1.0
Sentry Crash Report:

Description Christoph Anton Mitterer 2016-06-12 02:58:29 UTC
Hey.

Would it be possible to support openjpeg for jpeg2000 in addition to jasper?
The later is e.g. going to be removed from debian as it's unmaintained.

Cheers,
Chris.

Reproducible: Always
Comment 1 caulier.gilles 2016-06-12 06:51:53 UTC
Yes, currently JPEG2000 support through Jasper is optional at compilation time.

A port to OpenJPEG must be done to replace Jasper as well...

Gilles Caulier
Comment 2 Michael Vetter 2019-03-29 11:09:50 UTC
Is there any news on this?
Debian removed jasper so Digikam is without JPEG-2000 support in Debian AFAIK.
We consider doing the same in openSUSE since jasper usptream is just too unresponsive and openjpeg2 is active.
Comment 3 caulier.gilles 2019-03-29 11:17:26 UTC
No plan for the moment.

Jasper team is revival and library is updated well. Look on github :

https://github.com/mdadams/jasper/releases

So, for the moment, Jasper still used and not OpenJPEG yet.

Giles Caulier
Comment 4 Michael Vetter 2019-03-29 11:25:33 UTC
> Jasper team is revival and library is updated well. Look on github :

*I* am the one doing the revival there ;)
I go through their issues try to sort things out, try to propose fixes.
And upstream is still quite unresponsive. We talk over mail and most of the time there is no answer. The proposed issues don't get a comment.

What you describe as "well" is that he merged *one* pull request and tagged a new release. A release which he didn't even announce on his website nor created a ChangeLog for.

Believe me jasper is not "updated well" and its also not revived yet. Though I still put in effort to help jasper, and the same time I try to take course to switch to openjpeg2 whenever possible because it's much better maintained.
Comment 5 caulier.gilles 2019-03-29 12:03:07 UTC
Oh, good to know. Thanks for the feedback.

So, if you have enough knowledge about OpenJPEG2, perhaps you can propose a patch over the digiKam JPEG 2000 image loader. 

Code located in a single C++ file here :

https://cgit.kde.org/digikam.git/tree/core/libs/dimg/loaders/jp2kloader.cpp

Of course there are some rules to change about cmake script to replace Jasper detection by OpenJPEG2, but it's easy to do.

Gilles Caulier
Comment 6 Michael Vetter 2019-03-29 14:20:29 UTC
> So, if you have enough knowledge about OpenJPEG2, perhaps you can propose a patch over the digiKam JPEG 2000 image loader. 

Unfortunately I don't have a lot of knowledge about usage of openjpeg2.
I would like to help with the porting but fear I won't find the time.

However I checked out digikams source and let's see, maybe I can do something.
If you are in the mood or find some time please don't wait for me.
Comment 7 Michael Vetter 2019-07-22 08:28:41 UTC
I have summarized some of Jaspers issues at https://github.com/mdadams/jasper/issues/208.
As a result NetBSD and Gentoo started dropping Jasper support too.

A switch to OpenJPEG would be highly appreciated. Unfortunately I don't find the time to work on it.
Comment 8 Michael Vetter 2020-07-28 10:56:45 UTC
We have just released JasPer 2.0.19: https://github.com/jasper-software/jasper/releases/tag/version-2.0.19

It fixes all known CVEs (see https://github.com/jasper-software/jasper/blob/master/CHANGELOG).

See https://github.com/mdadams/jasper/issues/208 for details.

I think this bug can be closed and JasPer can still be used for JPEG2000 support.
Comment 9 caulier.gilles 2020-07-28 11:12:31 UTC
Thanks Michael for the feedback.

What's the plan for the future. Any maintenance tasks or new features ?

Did you plan to pass static analyzers, as cppcheck, clang-scan, Krazy, or Coverity-scan. It will be sane to use it.

Best regards

Gilles Caulier
Comment 10 Max Kellermann 2020-07-28 11:54:51 UTC
Gilles, I've run JasPer with libFuzzer for a few weeks and it found lots of unknown bugs, all of which I fixed.

I've also submitted JasPer to Coverity Scan: https://scan.coverity.com/projects/jasper
Coverity found a few problems, most of which I have fixed. A few problems remain to be fixed (divide by zero). As usual, it was difficult to find the real problems in the depths of Coverity's false positives...

Any effort to use tools finding more bugs is welcome now.
Comment 11 caulier.gilles 2020-07-31 10:15:10 UTC
Hi Max,

In my office where is maintain a C/C++/qt framework based with more than 1.2 M of code lines, i deployed a CI with 3 static analysers : cppcheck, Krazy, and clang-scan. I cannot use Coverity as code is closed.

For digiKam i used the same static analysers + Coverity. We discover plenty of bugs, more and less important and a lots of C++11 improvements to include for the future.

You can found my bash scripts to run static analyzers here. They generate web page with reports:

https://invent.kde.org/graphics/digikam/-/tree/master/project/reports

There is another analyser that you can use in your library : asan. But this will require to write plenty of unit tests to check all use cases. Alternaitve is to use run-time memory check know as Dr valgrind

cppcheck.sourceforge.net
 
https://github.com/Krazy-collection/krazy

https://clang-analyzer.llvm.org/scan-build.html

https://github.com/google/sanitizers/wiki/AddressSanitizer

https://valgrind.org/

I close this file now as libjasper maintenance revival well and is suitable for the future.

Thanks for you great job.

Gilles Caulier