https://github.com/friendlymatthew/jpeg
Implements jpeg algorithms using portable SIMD.
https://github.com/friendlymatthew/jpeg
jfif jpeg simd
Last synced: about 1 year ago
JSON representation
Implements jpeg algorithms using portable SIMD.
- Host: GitHub
- URL: https://github.com/friendlymatthew/jpeg
- Owner: friendlymatthew
- Created: 2024-05-22T21:36:11.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T15:24:33.000Z (over 1 year ago)
- Last Synced: 2025-04-20T22:32:36.643Z (about 1 year ago)
- Topics: jfif, jpeg, simd
- Language: Rust
- Homepage:
- Size: 895 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jpeg-decoder
A decoder following the [ITU-T.81 Specification](https://www.w3.org/Graphics/JPEG/itu-t81.pdf).
```rust
use jpeg::prelude::*;
fn main() -> anyhow::Result<()> {
let mut decoder = Decoder {
mmap: unsafe { Mmap::map(&File::open("mike.jpg")?)? },
cursor: 0,
encoding: CodingProcess::BaselineDCT,
};
let ycbcrs: Vec = decoder.decode()?;
let rgbs = ColorSpace::convert_ycbcr_to_rgb(ycbcrs);
Ok(())
}
```
## Coding Process
The decoder uses baseline sequential as its coding process.
For other coding processes, see `CODING_PROCESSES.md`.
## Portable SIMD
`jpeg` makes use of portable SIMD throughout various steps of the decoding process, as well as color space conversion
and grayscaling. For example, consider dequantization:

This can be easily vectorized, simply cast the quantization table and coefficients into `Simd` and perform a
lane-multiplication with each other.
Such trivial cases also exist during coefficient level-shifting and marker segment parsing.