tirr-c / jxl-oxide

Pure Rust implementation of JPEG XL decoder
Apache License 2.0
305 stars 13 forks source link

Feature request: support JPEG decoding #4

Open Rodhos opened 1 year ago

Rodhos commented 1 year ago

Support JPEG decoding to easily replace libjpeg-turbo and MozJPEG on browsers.

pkese commented 1 year ago

Any idea, how much extra code would it take to actually implement this (how much / which parts of code can be reused)?

Rodhos commented 1 year ago

Any idea, how much extra code would it take to actually implement this (how much / which parts of code can be reused)?

The only thing I know is what Jon Sneyers said. https://github.com/mozilla/standards-positions/issues/522#issuecomment-856035731

"I want to point out that potentially a JPEG XL decoder could also be used as a JPEG decoder (libjxl currently doesn't do that yet, but it does contain all the code needed to do that), which means the dependency that browsers have on libjpeg-turbo could potentially be dropped."

Rodhos commented 1 year ago

Also, if you compare flowchats in slide 20 and 21 it kinda tells you which parts of the code can be reused.

https://docs.google.com/presentation/d/1LlmUR0Uoh4dgT3DjanLjhlXrk_5W2nJBDqDAMbhe8v8/edit#slide=id.g910bfb2ea8_45_0

tirr-c commented 1 year ago

JPEG provides subset of JPEG XL features (basically it's VarDCT image with only DCT8 varblocks and without fancy image features), so if jxl-oxide could read JPEG bitstream it would be able to reuse most of the rendering code.

I'm going to focus on properly implementing JPEG XL features, so rendering JPEG images is in somewhat low priority. It would be very nice to support JPEG decoding though!