Switched to using the openexr crate on crates.io.

This commit is contained in:
Nathan Vegdahl 2017-05-17 00:36:35 -07:00
parent edb71864e8
commit 4e2d3e64c0
3 changed files with 21 additions and 29 deletions

26
Cargo.lock generated
View File

@ -42,14 +42,6 @@ dependencies = [
"vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "cmake"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "crossbeam" name = "crossbeam"
version = "0.2.10" version = "0.2.10"
@ -126,19 +118,18 @@ dependencies = [
[[package]] [[package]]
name = "openexr" name = "openexr"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/cessen/openexr-rs?rev=612fc6c81c031970ffddcab15509236711613de8#612fc6c81c031970ffddcab15509236711613de8" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"openexr-sys 0.1.0 (git+https://github.com/cessen/openexr-rs?rev=612fc6c81c031970ffddcab15509236711613de8)", "openexr-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "openexr-sys" name = "openexr-sys"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/cessen/openexr-rs?rev=612fc6c81c031970ffddcab15509236711613de8#612fc6c81c031970ffddcab15509236711613de8" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -163,7 +154,7 @@ dependencies = [
"mem_arena 0.1.0", "mem_arena 0.1.0",
"nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"openexr 0.1.0 (git+https://github.com/cessen/openexr-rs?rev=612fc6c81c031970ffddcab15509236711613de8)", "openexr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"sobol 0.1.0", "sobol 0.1.0",
@ -257,7 +248,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
"checksum c_vec 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9e1d9f7d49e289f36f19effbf3d5a5e30163ecf9c7a3c9be94d5374dec5b9a" "checksum c_vec 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9e1d9f7d49e289f36f19effbf3d5a5e30163ecf9c7a3c9be94d5374dec5b9a"
"checksum clap 2.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf1114886d7cde2d6448517161d7db8d681a9a1c09f7d210f0b0864e48195f6" "checksum clap 2.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf1114886d7cde2d6448517161d7db8d681a9a1c09f7d210f0b0864e48195f6"
"checksum cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "d18d68987ed4c516dcc3e7913659bfa4076f5182eea4a7e0038bb060953e76ac"
"checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97"
"checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae" "checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
@ -266,8 +256,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum lodepng 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2949340106c6ddacb872a8bceb940e39e332739873d56c1315917778527f8779" "checksum lodepng 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2949340106c6ddacb872a8bceb940e39e332739873d56c1315917778527f8779"
"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce" "checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
"checksum num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a18c392466409c50b87369414a2680c93e739aedeb498eb2bff7d7eb569744e2" "checksum num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a18c392466409c50b87369414a2680c93e739aedeb498eb2bff7d7eb569744e2"
"checksum openexr 0.1.0 (git+https://github.com/cessen/openexr-rs?rev=612fc6c81c031970ffddcab15509236711613de8)" = "<none>" "checksum openexr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3264f8c1f2a5d42ad2af6687642bbc21568f1dea9d3baf2e46482cec4b9d85"
"checksum openexr-sys 0.1.0 (git+https://github.com/cessen/openexr-rs?rev=612fc6c81c031970ffddcab15509236711613de8)" = "<none>" "checksum openexr-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e653fb76e5be78b4953990238249b83f48caf1aaebe1ade434aec84c430cfe3f"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "29dbdfd4b9df8ab31dec47c6087b7b13cbf4a776f335e4de8efba8288dda075b" "checksum redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "29dbdfd4b9df8ab31dec47c6087b7b13cbf4a776f335e4de8efba8288dda075b"
"checksum rgb 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "4db5350eea2dbb4f4972c4fb4d980b70c3f0ed3983eb2f66d174a43457514a14" "checksum rgb 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "4db5350eea2dbb4f4972c4fb4d980b70c3f0ed3983eb2f66d174a43457514a14"

View File

@ -30,11 +30,9 @@ crossbeam = "0.2"
num_cpus = "1.0" num_cpus = "1.0"
lodepng = "0.8" lodepng = "0.8"
lazy_static = "0.2" lazy_static = "0.2"
openexr = "0.2"
# Github dependencies
openexr = { git = "https://github.com/cessen/openexr-rs", rev = "612fc6c81c031970ffddcab15509236711613de8" }
# Local crate dependencies # Local crate dependencies
[dependencies.float4] [dependencies.float4]
path = "sub_crates/float4" path = "sub_crates/float4"

View File

@ -168,18 +168,22 @@ impl Image {
} }
} }
let mut wr = openexr::ExrWriterBuilder::new(path) let mut wr = openexr::OutputFile::from_file(
.display_window((0, 0), ((self.res.0 - 1) as i32, (self.res.1 - 1) as i32)) path,
.data_window((0, 0), ((self.res.0 - 1) as i32, (self.res.1 - 1) as i32)) (self.res.0 as u32, self.res.1 as u32),
.insert_channel("R", openexr::Channel::with_type(openexr::PixelType::F32)) &[
.insert_channel("G", openexr::Channel::with_type(openexr::PixelType::F32)) ("R", openexr::PixelType::FLOAT),
.insert_channel("B", openexr::Channel::with_type(openexr::PixelType::F32)) ("G", openexr::PixelType::FLOAT),
.open(); ("B", openexr::PixelType::FLOAT),
],
openexr::Compression::PIZ_COMPRESSION,
)
.unwrap();
let mut fb = { let mut fb = {
// Create the frame buffer // Create the frame buffer
let mut fb = openexr::FrameBuffer::new(self.res.0, self.res.1); let mut fb = openexr::FrameBuffer::new(self.res.0, self.res.1);
fb.add_structured_slice(&mut image, &[("R", 0.0), ("G", 0.0), ("B", 0.0)]); fb.insert_pixels(&[("R", 0.0), ("G", 0.0), ("B", 0.0)], &mut image);
fb fb
}; };