Skip to content

Commit cb1a83a

Browse files
Merge pull request #43 from johannesvollmer/rgba-image
Prepare for pubishing Version 0.7.4
2 parents f1a43b2 + 0ed330a commit cb1a83a

21 files changed

+279
-196
lines changed

Cargo.lock

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = "Read and write OpenEXR files without any unsafe code"
44
keywords = ["exr", "openexr", "file", "binary", "io"]
55
categories = ["encoding", "filesystem", "graphics", "multimedia"]
66

7-
version = "0.7.3"
7+
version = "0.7.4"
88
edition = "2018"
99
authors = ["johannesvollmer <[email protected]>"]
1010

@@ -26,16 +26,16 @@ plugin = false
2626
proc-macro = false
2727

2828
[dependencies]
29-
lebe = "0.5.0" # generic binary serialization
30-
half = "1.4.1" # 16 bit float pixel data type
29+
lebe = "0.5.1" # generic binary serialization
30+
half = "1.5.0" # 16 bit float pixel data type
3131
bit_field = "0.10.0" # exr file version bit flags
3232
libflate = "0.1.27" # zlib compression
33-
smallvec = "1.2.0" # make cache friendly allocations TODO profile if smallvec is really an improvement!
33+
smallvec = "1.3.0" # make cache friendly allocations TODO profile if smallvec is really an improvement!
3434
rayon = "1.3.0" # multi-core compression and decompression TODO make this an optional feature?
3535

3636
[dev-dependencies]
3737
bencher = "0.1.5"
38-
image = "0.23.0" # used to convert one exr to some pngs
38+
image = "0.23.3" # used to convert one exr to some pngs
3939
walkdir = "2.3.1" # automatically test things for all files in a directory
4040
rand = "0.7.3" # used for fuzz testing
4141

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ please leave an issue on this repository, containing the image file.
116116
- [x] Tiles
117117
- [x] Multipart
118118
- [ ] Deep Data
119-
- [ ] User supplied line order
119+
- [x] User supplied line order
120120
- [x] Rip/Mip Maps _(coded, but untested)_
121-
- [ ] 100% correct meta data
121+
- [x] 100% correct meta data
122122
- [x] Compression Methods
123123
- [x] Uncompressed
124124
- [x] ZIPS
@@ -157,7 +157,7 @@ please leave an issue on this repository, containing the image file.
157157
Add this to your `Cargo.toml`:
158158
```toml
159159
[dependencies]
160-
exr = "0.7.0"
160+
exr = "0.7.4"
161161

162162
# also, optionally add this to your crate for smaller binary size
163163
# and better runtime performance
@@ -176,11 +176,11 @@ fn main() {
176176
let my_image = unimplemented!("this is your own image value");
177177

178178
let get_pixel = |position: Vec2<usize>| {
179-
let [r, g, b, a] = my_image.pixel_at_xy(position.0, position.1);
179+
let [r, g, b, a] = my_image.pixel_at_xy(position.x(), position.y());
180180
rgba::Pixel::rgba(r, g, b, a)
181181
};
182182

183-
let image_info = rgba::Image::rgb(
183+
let image_info = rgba::ImageInfo::rgb(
184184
(my_image.width, my_image.height),
185185

186186
// all numbers will be converted to f16 automatically
@@ -240,7 +240,7 @@ Allocations have a safe maximum size that will not be exceeded at once.
240240

241241
### Running Tests
242242

243-
To run all fast tests, use `cargo test --no-fail-fast`.
243+
To run all fast tests, use `cargo test`.
244244
To start fuzzing indefinitely, use `cargo test --package exr --test fuzz fuzz -- --exact --ignored`.
245245

246246
### Specification

benches/profiling.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn read_single_image(bench: &mut Bencher) {
1212
let path = "tests/images/valid/custom/crowskull/crow_uncompressed.exr";
1313

1414
bench.iter(||{
15-
rgba::Image::read_from_file(path, read_options::low(), rgba::pixels::flattened_f16).unwrap();
15+
rgba::ImageInfo::read_pixels_from_file(path, read_options::low(), rgba::pixels::flattened_f16).unwrap();
1616
})
1717
}
1818

@@ -21,7 +21,7 @@ fn read_single_image_from_buffer(bench: &mut Bencher) {
2121
let file = fs::read("tests/images/valid/custom/crowskull/crow_uncompressed.exr").unwrap();
2222

2323
bench.iter(||{
24-
rgba::Image::read_from_buffered(std::io::Cursor::new(&file), read_options::low(), rgba::pixels::flattened_f16).unwrap();
24+
rgba::ImageInfo::read_pixels_from_buffered(std::io::Cursor::new(&file), read_options::low(), rgba::pixels::flattened_f16).unwrap();
2525
})
2626
}
2727

benches/rgba.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn read_rgba(bench: &mut Bencher) {
1111
bench.iter(||{
1212
let path = "tests/images/valid/custom/crowskull/crow_uncompressed.exr";
1313

14-
let image = rgba::Image::read_from_file(path, read_options::low(), rgba::pixels::flattened_f16).unwrap();
14+
let image = rgba::ImageInfo::read_pixels_from_file(path, read_options::low(), rgba::pixels::flattened_f16).unwrap();
1515
bencher::black_box(image);
1616
})
1717
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
extern crate exr;
55
use exr::meta::MetaData;
66

7-
/// Print the custom meta data of a file, excluding technical file meta data.
7+
/// Print the custom meta data of a file, excluding technical encoding meta data.
8+
/// Prints compression method and tile size, but not chunk count.
89
fn main() {
910
let meta_data = MetaData::read_from_file("tests/images/valid/custom/crowskull/crow_uncompressed.exr").unwrap();
1011

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ use exr::prelude::*;
55
use exr::meta::attributes::SampleType;
66

77
/// Write an RGBA exr file, generating the pixel values on the fly.
8+
/// This streams the generated pixel directly to the file,
9+
/// never allocating the actual total pixel memory of the image.
810
fn main() {
911

10-
// this function can generate a color for each pixel
12+
// this function can generate a color for any pixel
1113
let generate_pixels = |position: Vec2<usize>| {
1214

1315
// generate some arbitrary rgb colors, with varying size per channel
@@ -26,7 +28,8 @@ fn main() {
2628
)
2729
};
2830

29-
let image_info = rgba::Image::rgb(
31+
32+
let image_info = rgba::ImageInfo::rgb(
3033
(2*2048, 2*2048),
3134

3235
// the generated f32 is converted to an f16 while writing the file
@@ -35,9 +38,10 @@ fn main() {
3538

3639
// write it to a file with all cores in parallel
3740
image_info
38-
.with_encoding(rgba::Encoding::compress(Compression::RLE))
39-
.write_to_file(
41+
.with_encoding(rgba::Encoding::for_compression(Compression::RLE))
42+
.write_pixels_to_file(
4043
"tests/images/out/generated_rgba.exr",
41-
write_options::high(), &generate_pixels
44+
write_options::high(), // this will actually generate the pixels in parallel on all cores
45+
&generate_pixels
4246
).unwrap();
4347
}

0 commit comments

Comments
 (0)