Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/decoders/dng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ impl<'a> Decoder for DngDecoder<'a> {

Ok(RawImage {
make: make,
model: model,
model: model.clone(),
canonical_model: model,
clean_make: clean_make,
clean_model: clean_model,
clean_model: clean_model.clone(),
clean_canonical_model: clean_model,
width: width,
height: height,
cpp: cpp,
Expand Down
6 changes: 6 additions & 0 deletions src/decoders/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ pub struct RawImage {
pub make: String,
/// camera model as encoded in the file
pub model: String,
/// official camera model
pub canonical_model: String,
/// make cleaned up to be consistent and short
pub clean_make: String,
/// model cleaned up to be consistent and short
pub clean_model: String,
/// official model cleaned up to be consistent and short
pub clean_canonical_model: String,
/// width of the full image
pub width: usize,
/// height of the full image
Expand Down Expand Up @@ -94,8 +98,10 @@ impl RawImage {
RawImage {
make: camera.make.clone(),
model: camera.model.clone(),
canonical_model: camera.canonical_model.clone(),
clean_make: camera.clean_make.clone(),
clean_model: camera.clean_model.clone(),
clean_canonical_model: camera.clean_canonical_model.clone(),
width: width,
height: height,
cpp: 1,
Expand Down
16 changes: 14 additions & 2 deletions src/decoders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ impl Buffer {
pub struct Camera {
pub make: String,
pub model: String,
pub canonical_model: String,
pub mode: String,
pub clean_make: String,
pub clean_model: String,
pub clean_canonical_model: String,
pub filesize: usize,
pub raw_width: usize,
pub raw_height: usize,
Expand All @@ -126,10 +128,18 @@ impl Camera {
for (name, val) in ct {
match name.as_ref() {
"make" => {self.make = val.as_str().unwrap().to_string().clone();},
"model" => {self.model = val.as_str().unwrap().to_string().clone();},
"model" => {
let model = val.as_str().unwrap().to_string();
self.model = model.clone();
self.canonical_model = model.clone();
},
"mode" => {self.mode = val.as_str().unwrap().to_string().clone();},
"clean_make" => {self.clean_make = val.as_str().unwrap().to_string().clone();},
"clean_model" => {self.clean_model = val.as_str().unwrap().to_string().clone();},
"clean_model" => {
let model = val.as_str().unwrap().to_string();
self.clean_model = model.clone();
self.clean_canonical_model = model.clone();
},
"whitepoint" => {let white = val.as_integer().unwrap() as u16; self.whitelevels = [white, white, white, white];},
"blackpoint" => {let black = val.as_integer().unwrap() as u16; self.blacklevels = [black, black, black, black];},
"blackareah" => {
Expand Down Expand Up @@ -176,9 +186,11 @@ impl Camera {
Camera {
make: "".to_string(),
model: "".to_string(),
canonical_model: "".to_string(),
mode: "".to_string(),
clean_make: "".to_string(),
clean_model: "".to_string(),
clean_canonical_model: "".to_string(),
filesize: 0,
raw_width: 0,
raw_height: 0,
Expand Down
2 changes: 2 additions & 0 deletions src/decoders/raf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ impl<'a> Decoder for RafDecoder<'a> {
Ok(RawImage {
make: camera.make.clone(),
model: camera.model.clone(),
canonical_model: camera.canonical_model.clone(),
clean_make: camera.clean_make.clone(),
clean_model: camera.clean_model.clone(),
clean_canonical_model: camera.canonical_model.clone(),
width: width,
height: height,
cpp: 1,
Expand Down