commit | e770fe8898af75a1a543c0e3de96e0e37c15a7f1 | [log] [tgz] |
---|---|---|
author | Andreas Molzer <andreas.molzer@gmx.de> | Sun Jun 21 20:35:59 2020 |
committer | Andreas Molzer <andreas.molzer@gmx.de> | Sun Jun 21 20:35:59 2020 |
tree | 4fe062af9138a8f412f14f47712ea5708235e290 | |
parent | 073e21e4e031a724ae68a00937573d71725a7bc4 [diff] |
Make marker searches utilize read buffer This turns the search into a near perfect opportunity for memchr which should be MUCH faster than calling the underlying reader's read method for each single byte we want to inspect.
A Rust library for decoding JPEGs.
Cargo.toml:
[dependencies] jpeg-decoder = "0.1"
main.rs:
extern crate jpeg_decoder as jpeg; use std::fs::File; use std::io::BufReader; fn main() { let file = File::open("hello_world.jpg").expect("failed to open file"); let mut decoder = jpeg::Decoder::new(BufReader::new(file)); let pixels = decoder.decode().expect("failed to decode image"); let metadata = decoder.info().unwrap(); }
This crate compiles only with rust >= 1.34.