lifthrasiir / j40 Goto Github PK
View Code? Open in Web Editor NEWJ40: Independent, self-contained JPEG XL decoder
License: Other
J40: Independent, self-contained JPEG XL decoder
License: Other
Test image: https://stsci-opo.org/STScI-01GA76Q01D09HFEV174SVMQDMV.png
$ time ./dj40 w.fjxl
14560x8418 frame read and discarded.
real 0m16,854s
user 0m16,325s
sys 0m0,549s
8 MPx/s, PNG decoding speed on the same CPU is 50 MPx/s.
Too slow for just a prefix_codes + simple_avg_predictor + color_conversion
.
dj40.c
line 5:
#include "j40.h"
#include "j40.h"
If a block comment /* */
was used instead of many one line //
comments around the example program, then it could be copy pasted easier, with no need to remove all the //
by hand or using an editor (many don't offer multi-line comment/uncomment).
Might be helpful.
I built cjxl
from the official https://github.com/libjxl/libjxl repo. I then made a bricks-color.jxl
file (attached, with a fake .png
file extension to satisfy the GitHub upload UI).
$ build/tools/cjxl bricks-color.png bricks-color.jxl
JPEG XL encoder v0.8.0 506714ed [AVX2,SSE4,SSSE3,Unknown]
Read 160x120 image, 33928 bytes, 18.7 MP/s
Encoding [VarDCT, d1.000, effort: 7],
Compressed to 7287 bytes (3.036 bpp).
160 x 120, 0.76 MP/s [0.76, 0.76], 1 reps, 8 threads.
Trying to decode that with j40 hits an error:
$ ./dj40 bricks-color.jxl out.png
Error: Decoding failed (rnge) during j40_next_frame
Color management in JPEG XL is a complicated story. Ideally it's the best possible design: every JPEG XL codestream has a defined color profile (either ICC profile or abbreviated color space parameters) and it should be converted to the display color space. Unfortunately the status quo is not that ideal.
As such, I don't think J40 will ever implement the full ICC profile by itself (at least in C). This is also the case in libjxl, where either skcms or Little CMS 2 can be used, but it is a bit baffling to require an external library to implement the full format. Any other ideas are welcomed.
Anyway, this decision leads to the following subtasks:
J40_USE_LCMS2
)As I noted in the orange site, it is a long-term goal to produce a parallel Rust version of J40. There are many unanswered questions before starting this process, however.
ImageBuffer
for this purpose, or make our own? (This is important when J40 is going to be used as a dependency!)j40__st
), which would be a bad design in Rust. But this allows for a delayed error checking, which may be crucial for some cases.j40_advance
in the future), which is a good abuse of C macros. I'm not very sure this can be ever translated to Rust (should I use something like genawaiter?).This is currently an empty macro (and will remain so by default), but probably should be something else if it is to be used as, for example, a dynamically linked library.
Now that Chromium has dropped support for JPEG XL, the WebAssembly decoder is needed. Could you please provide a WASM version of J40? Thanks!
Thanks for this project.
Reading the README it is not clear to me whether progressive JPEG images are supported. Could you please clarify that?
(I'd like to try this lib it in a ESP32 with limited resources, where adding many dependencies is problematic).
libjxl has a battery of conformance tests, which is expected to become ISO/IEC 18181-3 in the future. They are coarser-grained tests and not suitable for detailed testing or estimating the actual progress, but they represent a good milestone so will be tracked here.
TODO
is reachedTODO
is reachedA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.