Comments (12)
Thank you Chris.
It is something that I forgot.
In ojph_expand, and in particular in the fileojph_image_io.cpp, I check if sample values are within their legible range, [0, 255] for Lena. If a value is larger, I clip it to 255, and if it is smaller I set it to 0.
The reason why this is not done in the library is that the library should produce the best estimate of the values; these estimates can be used in further processing. Then, before saving the file, the code should check that values are within the legible range.
In my world version, this clipping should ideally be done in javascript in index.html
I love what you have done with the webpage.
Kind regards,
Aous.
from openjph.
I would have to add that something in the library as it stand is not ideal.
In the irreversible path, I convert floats to integers before returning them. A better design is to return them as floats, and let the caller, ojph_expand, convert them to whatever format it wants.
Cheers,
Aous.
from openjph.
In the webpage, the input data is always [0,255] for Lena so I am not sure what additional clipping I can do. The way it works is that I first decode the encoded Lena into an 8 bit RGB buffer. When the user adjusts the quantization slider, I take the 8 bit RGB buffer and feed it back into the library. Since the input data is 8 bit RGB, the data is already [0,255] for each channel. Am I misunderstanding?
BTW- I am also seeing complete image corruption when encoding some of the other DICOM images. I need to investigate further before filing a bug.
from openjph.
Oh I misread - the clipping should be done on the decoded values! I just applied that fix and it solved the problem. THank you!
from openjph.
Follow-up question - do all values need to be clamped regardless of the source image? Is this needed only for irreversible and color 8 bit or does it also apply to reversible grayscale 16 bit?
from openjph.
Nevermind, figured out that clamping is required on all data types via experimentation. This fixes the image corruption issue in some of the other DICOM images I mentioned too
from openjph.
Is it true that clipping is only needed when the image is irreversible? Is there anyway to estimate the precision of the error? I can optimize the decoding if I don't have to clamp so am looking for the logic to do so.
from openjph.
Clipping is needed because quantization changes the original values such that when synthesis is employed, out of range values occur.
For the reversible path, I think, but never tested, clipping is also required if quantization is employed.
I also think that reduced resolutions can create out of range values.
Is there anyway to estimate the precision of the error?
I think you mean the maximum error in order to optimize the decoding.
I am not sure about this, but I do not think there is a way to achieve this.
One thing that you might want to look at is to implement SIMD instructions for WASM. It is supported in Chrome, maybe behind a flag.
https://v8.dev/features/simd
I believe this is similar to SSE2 implementation, so you can adapt my sse2 versions.
This SIMD will eventually be implemented by all browsers.
from openjph.
How can you use quantization and still be reversible?
Regarding SIMD - good to know that OpenJPH doesn't support SIMD - I was hoping this was already implemented and was planning to try it out once I had time. I don't have any need for faster HTJ2K right now so probably won't implement it unless I am super bored lol
from openjph.
How can you use quantization and still be reversible?
I mean the reversible 5/3 wavelet path. I do not have quantization, but this can be added, as you suggested in our talk long ago.
OpenJPH implements SIMD for Intel for colour and wavelet transform and the likes. It does not do that for the block coder/decoder. But for WASM, Intel SIMD must disabled. I was thinking that when SIMD picks up to implement WASM SIMD.
from openjph.
Does HTJ2K support quantizing the reversible path? I assumed it was only available for the irreversible path. Note that EMSCRIPTEN failed to compile when I accidentaly left the SIMD path on but didn't explore it further.
from openjph.
My understanding is that Kakadu supports quantization for conventional JPEG2000 and HTJ2K when the reversible path is used; all arithmetic is the same, but at the end bitplanes are removed is a rate-distorion optimized way to meet the rate target.
For SIMD, I suspect that I need to write the subroutines to call SIMD instructions for WASM. So the code has to detect if EMSCRIPTEN is used and then select the WASM SIMD subrountines. Ideally, it should also detect if the browser supports SIMD, if not non-SIMD code is called.
from openjph.
Related Issues (20)
- typo in CMakeLists.txt HOT 1
- ojph_compress support for uppercase file extensions HOT 1
- signed 16bit negative values mismatch in interoperablity test between openjph and kakadu HOT 2
- Incorrect COM marker length HOT 1
- openjph decompression fails HOT 2
- Question : what format to be used to decompress the color HTJ2K compressed imaging data HOT 6
- Build should not fail if SIMD optimizations are enabled and your CPU doesn't support them HOT 2
- Feature: Support ROI based rendering HOT 1
- Sample JPH images, please HOT 5
- Unable to build using MinGW HOT 3
- Apple silicon build error HOT 5
- Support decode/expand a j2c file with just tilepart bytes HOT 2
- Tests fails to pass in version 0.10.4 HOT 2
- Specifying non-standard binary and library directories complicates integration in other projects HOT 1
- Feature Request: Add support for vcpkg HOT 1
- Encode 115x25的YUV444 picture,There is serious distortion. HOT 4
- Automated Testing Improvements HOT 1
- Remove xcode specific files HOT 1
- The block coder should be usable without pulling in the rest of OpenJPH HOT 6
- Removing the ojph_ prefix. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openjph.