Hi, I work on Rust stuff.
lokathor / imagine Goto Github PK
View Code? Open in Web Editor NEWBarebones image opening library.
Home Page: https://docs.rs/imagine
Barebones image opening library.
Home Page: https://docs.rs/imagine
Hi, I work on Rust stuff.
At least for when decoding, a zlib decoder should be a small enough module to not pull in an extra dependency at all.
We might keep the optional use of miniz_oxide for encoding images with good compression rates.
BMP allows for data to be encoded in a "bitmasked" form where bitmasks define the location of channel data within a u16 or u32.
This leads to each channel (R/G/B/A) being treated separately through several math ops.
Since we have 4 channels all doing identical operations, this lends itself very naturally to using SIMD.
Of course, since BMP is not a popular format, the percentage of use cases that would see a benefit from this gain is perhaps quite small. Still, when there's time it wouldn't hurt.
Preferably this would be done once portable-simd is stabilized, because it's not worth keeping the crate nightly-only for.
The Cargo.toml
and lib.rs
is already set up for this, we just need to mark individual elements with a doc(cfg()):
Example:
#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
And replace on whatever feature name. This can (I think) go on modules, types, free functions, etc.
Maybe we just need to mark modules and the rest of obvious enough? I guess we don't want to get too spammy with it.
It should be more obvious the relation between gamma / chromacity chunks and the srgb chunk (which implies a particular gamma / chromacity value).
We probably want a few possible top level functions here:
Output data is probably:
It seems best that the decoders simply return iterators that produce (x, y, P) triples, rather than accept a callback.
We're passing some pretty hefty sized arrays. If an inline fails to happen, we'll be moving a lot of data across the function bound for no big reason.
Then again, how often do you open a bitmap? And assuming that you're doing a heap allocation too for the pixel buffer, maybe it's not a big deal.
Still, probably something to do.
We just need to restore bmp support from the 0.0.8 version
Not yet fixed, though they're close to having a version 1 defined. Since a goal of the project is that the decoders/encoders are easy to write (at the expense of most other things) then this should be easy to do.
https://en.wikipedia.org/wiki/PCX
this is probably simple enough to add, because the WP page lists BMP as "more sophisticated" than PCX.
Other chunks it's probably fine to maybe have a bad CRC, but with the header we want to have a little extra confidence before we proceed all the way through the file.
bring the netpbm support back from the old 0.0.8 stuff
The renderer api from SDL2 expects ARGB ordered pixels.
also possibly other chunks?
the background color chunk is a very easy one to support
We ended up not needing the 16-bit BE formats, or the pixel packed formats, they should probably go?
And we should provide standard conversions between the formats.
lots of optional chunks we don't need, but transparency would be very good to support
Probably we should have some benchmarks, ya know.
We should place upper limits on how large of a file will be automatically decoded.
Apparently 16,384 is a common upper limit on textures, so a simple 17k limit seems fine I guess?
It's a small optimization in the scheme of things, but once portable simd is stabilized we should convert the "Up" filtering and unfiltering to use u8xN
values.
In this case, we'd want to cancel the normal iteration we'd do using the "PB iterator" (which is byte at a time), just do all the math as wide as possible, and then re-iterate the line for output as if it was a None filtered line the whole time. This will give the correct output while also being significantly faster to compute. The math itself will happen 16x (or more) faster, though having to iterate the row twice will reduce the overall gains.
(Unfortunately, all the other PNG filters are not very SIMD friendly)
now that netpbm pulls in wide, we might as well also use wide in the bmp parser.
A 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.