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
add support for Grok JPEG 2000 decoder #376
Conversation
@adolski do you have any issues with the PR ? |
Hi @boxerab, sorry for the delay. This looks pretty much like a renamed OpenJpegProcessor? Is there any reason that that processor couldn't be modified to invoke OpenJpegProcessor has a couple of major problems, which are firstly that it can only read from files, and secondly that it relies on a weird technique involving This ties into #388, which describes a longer-term plan for replacing OpenJpegProcessor with an Image I/O plugin for OpenJPEG. Another user has mentioned working on such a plugin, but I haven't had time to look at it: #293 (comment) I wonder if this plugin could be retrofitted to work with Grok--or if it's already compatible? |
Grok differs somewhat from OpenJPEG, not just in the name of the binary but also in some command line args, so it's probably a good idea to have a separate processor.
Grok supports decoding to stdout on Linux and Windows for certain file formats : BMP for example. To call directly into the API is certainly do-able, but this brings the Grok license into play. It is released under AGPL, so a Cantaloupe release with Grok API would require an AGPL license on the Cantaloupe release. Using the binary doesn't trigger the AGPL.
Yes it could be retrofitted, but we would have the same issue with licensing. |
I see. That makes sense. Okay, I'm willing to take this if you can add a test for it, and get the test working in continuous integration. You could probably just copy OpenJpegProcessorTest and exclude it from the nodeps profile. The Grok dependency would then have to be added to the CI Dockerfiles. I can then add documentation for this new processor to the user manual. |
Thanks, will try to get a working test this week. |
Hi @adolski , I have added a test, and excluded it form the nodeps profile, as you suggested. |
Hi @boxerab, I'll trust your judgment on whatever will be easiest to get working and maintain. |
Thanks, actually, it looks like you use Fedora for the Docker image, so I will go with simple wget from github |
Hi @adolski , I have Grok now installed in the ubuntu-latest, jdk Docker, but I am getting a test failure that I can't figure out, as the error message is quite cryptic. When you have time, can you take a look ?
|
The idea of that test is that when |
Thanks. So, what's the best way of debugging the exception ? |
Does grk_decompress emit some kind of information when given a non-JP2 image to read, that you could check to determine what kind of exception to throw? For example, if it emits a message like, "Error: invalid JP2 image", could you check for that string? |
Here is the output when passing in a PNG:
and exit value is 1. Why is this not a problem for openjpeg, I wonder ? My test is quite similar to the OpenJPEG processor test. |
OK, I think I found the problem. As you suggested, grok outputs a different error string when file format is not recognized. |
@adolski is there a way of printing out the message string in the ProcessorException ? |
@adolski after a workaround, all GrokProcessor tests pass on ubuntu! For the Oracle Linux VM, it is possible to upgrade to a newer version of the OS ? I need to build Grok from source on the VM, and the compiler toolchain is a bit old. |
Oracle Linux is what the oracle/graalvm-ce image is based on. But the GraalVM tests really just need GraalVM + some kind of Linux--there's no reason they have to use this particular image. If GraalVM could be installed in Ubuntu instead, that would be fine, and then you wouldn't have to compile anything. |
Yes, that would be great. As the compiler version is gcc 4.8.5. I think I will still need to build Grok from source, as it has to link to the same |
So, what needs to happen to switch GraalVM images? |
I would change the I'm happy to do this if you'd rather not, but it might take me a few days. |
Thanks, if you don't mind. Out of curiosity, why can't you run all of the tests on the first VM ? |
The new Ubuntu+GraalVM image is available on
That could probably work too... I like that there is one Dockerfile per test environment, but, you're right, it does cause some duplication. |
Great, thanks. I've updated the PR. How long should the tests take on that VM? |
After 6 hours:
|
Hmm, there must be something in the addition of Grok that is triggering that, because I can't reproduce it. I've pushed a change on |
thanks, it looks like that fixed the hang. |
Test still fails, but this is due to other errors, not in Grok processor test. |
Cool, passing now. |
@adolski anything else that needs doing before this is merged ? |
It looks good to me @boxerab! Thanks for all of your work on this. I will make a note to check at some point whether Grok is available as a Debian package. Sorry this took so long--between other projects and vacation time you caught me at almost the worst possible time (not your fault). |
Great, thanks! No worries about the time, just glad it was relatively painless to get this merged in. |
btw, forgot to mention that Grok will not delete symlink output file, if decode fails (unlike openjpeg) |
Thanks @boxerab, and thanks for letting me know about the symlink thing, I will make a note to take a look. |
@adolski surely you are finished your vacation by now ? :) |
Hi @boxerab , I don't know for sure, but maybe early next year. 5.0 needs some more work, but I'm only able to spend around 10% of my time on this project. |
Thanks, sounds good. I have a number of improvements planned for the library, so by early next year it should be trading blows with Kakadu. |
@adolski still waiting for my deb package to be accepted by Debian. In the meantime, I've posted the .deb files for my latest release |
Thanks for letting me know, @boxerab. I will put this on my to-do list. By the way, are you planning to release to macOS Homebrew? |
Thanks. I took a look at the Homebrew docs : seems easy to create a package from a tarball. So, yes, I will look into releasing that way as well. |
@adolski hello and Happy New Year! Just wanted to let you know I've submitted a homebrew PR |
That's great, @boxerab! This will make it more convenient for all Mac users to use and test against Grok. I was already able to install the package, and all of the GrokProcessorTests passed right away. 👍 |
Add support for Grok decompressor.
Grok features include:
stdout
for certain file formatsTLM
code stream marker for fast single tile and sub-tile decodingof large tiled images
PLT
code stream marker for fast sub-tile decoding of large single-tile imagesICC
profiles and other meta-data such asXML
,IPTC
andXMP
High Throughput JPEG 2000
, which promisesup to 10x speed up over current Part 1.