9 ms·
J40: Independent, self-contained JPEG XL decoder
- userbinator 4y agoThe format claims to be "royalty-free" but standard itself is not free.
- blurred 4y agoAlso it seems it has unresolved patent issue: https://www.theregister.com/2022/02/17/microsoft_ans_patent/ https://www.theregister.com/2022/02/17/microsoft_ans_patent/
- defrost 4y agoShades of LizardTech v. ERM I hope not. That was a US filed in 1999, decided 2005 patent case over mid 90s use of discrete wavelet transforms in image storage, and the progressive loading of very large images rather than the prior full scanline by scanline loading of the dialup era ... [0] https://en.wikipedia.org/wiki/LizardTech,_Inc._v._Earth_Resource_Mapping,_Inc https://en.wikipedia.org/wiki/LizardTech,_Inc._v._Earth_Reso.... Court cases over patents on mathematical techiques and their implemantations really pisses me off .. being called as an expert witness even more so - it's more excruciating than teaching first year engineering students linear algebra . . . (I'll let myself out).
- dataflow 4y agoCould someone ELI5 the following? 1. Weren't "ideas" not supposed to be patentable, but only actual implementations? Given that, how can an algorithm be patented? 2. Wasn't prior art supposed to invalidate a patent? If the algorithm was already used in JPEG-XL, then clearly Microsoft isn't the first to discover it, and hence should not be able to patent it, right? Or if the algorithm in JPEG-XL is considered different, then there's no infringement by definition, right? So what's the issue?
- blurred 4y agoOne is theory, second is practice. Here is some discussion about this patent: https://encode.su/threads/3863-RANS-Microsoft-wins-data-encoding-patent https://encode.su/threads/3863-RANS-Microsoft-wins-data-enco...
- Nokinside 4y ago1. In patent law an idea is a creation that has been imagined but not yet prototyped, produced, or manufactured and they can be patented. Products with usefulness are patentable. Including algorithms used in software, and process (act or method of doing something) 2. In the US prior 2013 that was often the case. In 2013 US switched from first-to-invent to first-to-file system to be more compatible with the rest of the world.
- derf_ 4y agoThat is a common misunderstanding of first-to-file. Under first-to-file, prior art is absolutely still a defense, and much easier to prove than under first-to-invent. If you publicly disclose something before someone who invented, but did not disclose, the same thing, your publication counts as prior art. It is much easier (read: cheaper) to demonstrate that "X document was published on Y website on Z date" than it is to start doing discovery to compare private lab notebooks or whatever to decide who really invented the thing first. First-to-file is mostly about simplifying the complicated litigation edge cases where two people claim to have invented, but not disclosed, the same thing during the (US-specific) one-year grace period they have to file a patent on it. Prior art may still not invalidate the patent, though. Usually the patent holder will argue that their patent differs from the prior art in some respect (you can often find these arguments in the patent's file wrapper at http://patentcenter.uspto.gov/ http://patentcenter.uspto.gov/). But that narrows the scope of the patent, and being your own prior art is a pretty good defense against infringement.
- ClumsyPilot 4y agoThis is a huge powergrab by our industry - it is the only industry in the world that gets both patent and copyright protection. Think about it, you can patent a car engine, but you cannot get copyright on it. You get copyright on a book, but you can't patent a book. Also that's mostly US. By contrast, in Europe, software is generally not patentable.
- lifthrasiir 4y agoWhile the software patent is a spicy issue, Jon Sneyers once noted that Microsoft may be in a deep trouble if they actually exercise that patent because of both Google's and Cloudinary's defensive patents [1]. [1] https://twitter.com/jonsneyers/status/1526598054685642753 https://twitter.com/jonsneyers/status/1526598054685642753
- lifthrasiir 4y agoEditors wanted to make the standard freely available (one of them even wrote an open letter [1]) but for now it is paywalled. I personally worked with a recent community draft which was circulated in the JPEG XL discord. [1] https://twitter.com/jonsneyers/status/1420765059739914243 https://twitter.com/jonsneyers/status/1420765059739914243
- iforgotpassword 4y ago"JPEG XL discord" - man I feel like I'm really getting old and falling out of the loop. Discord to me is that young people/gamers walled garden platform, for voice chat and sharing meme gifs.
- lifthrasiir 4y agoNowadays Discord is used for all sort of things. If you don't want to join the Discord server, you may reach editors and they are probably willing to hand out the most recent draft.
- jeroenhd 4y agoDiscord has replaced many forums, sadly. They're even rolling out a special forum feature right now that (obviously) can't be indexed by Google. Public post-based discussion is moving to quick chats in private servers. It started out with Slack spaces but has moved to Discord because of Slack's inferior UX/UI/business model. This makes taking part in a community a lot easier as you can actually talk to the people working on the stuff you're excited about, like you could with good ol' IRC except you don't need to log in at the exact right time to send them a message. Some open source projects opt to use Matrix rather than Discord or Slack, which is an open standard but the problems still remain. Especially, finding a solution to an obscure error message can be a real challenge if you don't want to join some random chat room full of existing conversations to ask the question yourself, even if ten or twenty people before you already did the same. I much prefer the forums for this type of stuff but most of the world seems to disagree.
- chungy 4y ago
- lifthrasiir 4y agoI am the author of J40; ask me anything. As you can see it is only mature in the sense that it implements a large subset of the specification, and it has tons of rough edges (I know, I know, proper tests and fuzzing are in progress). I also didn't expect this to weigh more than 5K LoC, so my hope is to produce a parallel Rust version in the future.
- greatgib 4y agoFirst, very good job to have created such a simple lib without dependency! Looking at the code example, I was wondering if the 'oops' error check wouldn't be doable at a frame level, or even have some recoverable errors for within a frame? When loading that kind of objects (image, vidéos,...) It is always annoying when libs have an all of nothing behavior.
- lifthrasiir 4y agoJ40 is indeed designed with a possibility of partial decoding in mind, but both the API and the internal architecture is currently less prepared for such use cases.
- pornel 4y agoWhich part was hardest to implement so far?
- lifthrasiir 4y agoModular predictors (`j40__modular_channel` and related functions in J40). The JPEG XL specification was written after the reference implementation, and there are lots of bugs especially in that part of specification. There are also a significant number of bugs in DCT-like transformations, but those bugs are relatively isolated while modular predictors can wreck the entire image. Those bugs are being reported to the spec editors, so later implementations will have a much easier time.
- twotwotwo 4y ago
- TeaDude 4y agoAh, excellent. I was hoping to integrate JPEG XL into a future C project and was facing the prospect of reimplementing it/translating the standard implementation. Seriously though, this is going to be HUGE for image editors. A format that finally supports both layers and animation.
- Dwedit 4y agoHere's the nice thing about DLL files, your code can stay C. You just make calls to another library, and it doesn't matter which language was used to build that DLL. So you get to use LibJXL as long as you have a working DLL file. (For non-Windows, substitute the appropriate file type for libraries)
- pornel 4y agoThe current limitation is probably a good feature to have for a Web-oriented format: > Crop retangles are currently ignored and can reveal a frame larger than the actual image. People unaware of lossless cropping may end up posting images that still contain private information they wanted to cut off. If JPEG XL ever makes it to browsers, I hope they won't support cropping, so that people will spot the problem right away, rather later when trolls find it.
- lifthrasiir 4y agoI'd like to note that "crop rectangles" here refer to the region of the virtual image canvas, whose size is recorded in the image header, where each frame gets decoded. So here what's being cropped is an image canvas, not a frame. Your point still stands in the sense that, if those rectangles exceed the canvas extent, the surplus will be indeed discarded. I believe the current libjxl doesn't produce such image anyway (why do you keep a portion of image to be discarded?) but it is still something to note.
- nightpool 4y ago> why do you keep a portion of image to be discarded? I can't speak to the context of the feature in JXL, but this is very very common in mobile image editor metadata formats, so that users can later "undo" a crop they did, because no data is actually lost. Both iOS and Android support this for all images cropped on device.
- p0nce 4y agoThanks for this, this must be a huge amount of work. A bicephal codec like JPEG XL is very intimidating to implement.
- lifthrasiir 4y agoIndeed. I worked on J40 for last 4 months of my unemployment (and I'm available for work wink), and it took one or two months to get each major feature---modular and VarDCT---working.
- p0nce 4y agoHire this man.
- tambourine_man 4y agoFor those unfamiliar with the format, like me: “JPEG XL, next generation image compression standard with 60% better compression efficiency than JPEG. The draft predicts that the standard will outperform the still image compression performance shown by HEVC HM, Daala and WebP and unlike previous attempts to replace JPEG, it provides transport options and more efficient lossless recompression storage for traditional images.” https://en.m.wikipedia.org/wiki/JPEG_XL https://en.m.wikipedia.org/wiki/JPEG_XL
- NavinF 4y agoI'll add "Royalty-free format with an open-source reference implementation". In other words there's a chance this will see real adoption unlike the many previous attempts to build a JPEG v2. > outperform the still image compression performance shown by HEVC HM, Daala and WebP Naw, the real competitor is AVIF which recently got desktop and iOS Safari support. Chrome and Firefox have supported AVIF since forever and Safari was the final holdout.
- zinekeller 4y agoThe thing about AVIF is that it's genuinely heavier processor-wise (software decoding) or requires more hardware circuitry than JXL (hardware decoding). It's better than nothing and since AV1 was finalised a few years ago it's definitely helpful (JXL has been just finalised), but it's worse than WebP in lossless encoding (so stick to WebP for that) and may affect battery life in devices with a WebM hardware decoder but don't have any AV1 circuitry.
- pornel 4y agoAFAIK nobody decodes still images using video hardware acceleration. HW supports only one stream at a time and has a setup latency. Browsers decode images in parallel and want them ASAP. AVIF does very well in almost-lossless encoding of the kinds of images you'd use lossless formats for. You can beat any lossless format with imperceptibly small amount of loss. True lossless is needed for authoring, but not for typical Web distribution. People think lossy can't be used for icon-like images, because they associate lossy with JPEG-like distortions, but it's possible to do lossy compression using other methods that preserve razor-sharp edges.