about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lri-rs/src/block.rs10
-rw-r--r--lri-rs/src/lib.rs27
-rw-r--r--lri-study/src/main.rs11
-rw-r--r--prism/src/main.rs2
4 files changed, 47 insertions, 3 deletions
diff --git a/lri-rs/src/block.rs b/lri-rs/src/block.rs
index 5660185..77a0100 100644
--- a/lri-rs/src/block.rs
+++ b/lri-rs/src/block.rs
@@ -5,7 +5,9 @@ use lri_proto::{
 	view_preferences::ViewPreferences, Message as PbMessage,
 };
 
-use crate::{CameraId, CameraInfo, ColorInfo, DataFormat, HdrMode, RawData, RawImage, SensorModel};
+use crate::{
+	CameraId, CameraInfo, ColorInfo, DataFormat, HdrMode, RawData, RawImage, SceneMode, SensorModel,
+};
 
 pub(crate) struct Block<'lri> {
 	pub header: Header,
@@ -216,6 +218,7 @@ impl<'lri> Block<'lri> {
 			image_integration_time_ns,
 			image_gain,
 			hdr_mode,
+			scene_mode,
 			..
 		} = vp;
 
@@ -230,6 +233,10 @@ impl<'lri> Block<'lri> {
 		if let Some(Ok(h)) = hdr_mode.map(|ev| ev.enum_value()) {
 			ext.hdr = Some(h.into());
 		}
+
+		if let Some(Ok(h)) = scene_mode.map(|ev| ev.enum_value()) {
+			ext.scene = Some(h.into());
+		}
 	}
 }
 
@@ -243,6 +250,7 @@ pub(crate) struct ExtractedData {
 	pub image_integration_time: Option<Duration>,
 	pub af_achieved: Option<bool>,
 	pub hdr: Option<HdrMode>,
+	pub scene: Option<SceneMode>,
 }
 
 pub enum Message {
diff --git a/lri-rs/src/lib.rs b/lri-rs/src/lib.rs
index 660a720..404e501 100644
--- a/lri-rs/src/lib.rs
+++ b/lri-rs/src/lib.rs
@@ -21,6 +21,7 @@ pub struct LriFile<'lri> {
 	pub af_achieved: Option<bool>,
 	pub image_gain: Option<f32>,
 	pub hdr: Option<HdrMode>,
+	pub scene: Option<SceneMode>,
 }
 
 impl<'lri> LriFile<'lri> {
@@ -79,6 +80,7 @@ impl<'lri> LriFile<'lri> {
 			af_achieved: ext.af_achieved,
 			image_gain: ext.image_gain,
 			hdr: ext.hdr,
+			scene: ext.scene,
 		}
 	}
 
@@ -380,3 +382,28 @@ impl From<HDRMode> for HdrMode {
 		}
 	}
 }
+
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub enum SceneMode {
+	Portrait,
+	Landscape,
+	Sport,
+	Macro,
+	Night,
+	None,
+}
+
+impl From<lri_proto::view_preferences::view_preferences::SceneMode> for SceneMode {
+	fn from(sm: lri_proto::view_preferences::view_preferences::SceneMode) -> Self {
+		use lri_proto::view_preferences::view_preferences::SceneMode as PbSceneMode;
+
+		match sm {
+			PbSceneMode::SCENE_MODE_PORTRAIT => Self::Portrait,
+			PbSceneMode::SCENE_MODE_LANDSCAPE => Self::Landscape,
+			PbSceneMode::SCENE_MODE_SPORT => Self::Sport,
+			PbSceneMode::SCENE_MODE_MACRO => Self::Macro,
+			PbSceneMode::SCENE_MODE_NIGHT => Self::Night,
+			PbSceneMode::SCENE_MODE_NONE => Self::None,
+		}
+	}
+}
diff --git a/lri-study/src/main.rs b/lri-study/src/main.rs
index 048083b..a7368dc 100644
--- a/lri-study/src/main.rs
+++ b/lri-study/src/main.rs
@@ -4,7 +4,7 @@ use std::{
 };
 
 use camino::Utf8PathBuf;
-use lri_rs::{DataFormat, HdrMode, LriFile, SensorModel};
+use lri_rs::{DataFormat, HdrMode, LriFile, SceneMode, SensorModel};
 use owo_colors::OwoColorize;
 
 const DATA: &'static str = "/Users/gen/thanks_lak";
@@ -86,6 +86,15 @@ fn gather() -> ! {
 				Some(HdrMode::Surreal) => print!("{} ", "hdr".bright_magenta()),
 			}
 
+			match lri.scene {
+				None | Some(SceneMode::None) => print!("sc:{} ", "nop".dimmed()),
+				Some(SceneMode::Portrait) => print!("sc:prt "),
+				Some(SceneMode::Landscape) => print!("sc:lnd "),
+				Some(SceneMode::Macro) => print!("sc:mcr "),
+				Some(SceneMode::Sport) => print!("sc:spt "),
+				Some(SceneMode::Night) => print!("sc:ni  "),
+			}
+
 			match lri.af_achieved {
 				None => print!("{} - ", "af".dimmed()),
 				Some(false) => print!("{} - ", "af".red()),
diff --git a/prism/src/main.rs b/prism/src/main.rs
index e0da42a..291d725 100644
--- a/prism/src/main.rs
+++ b/prism/src/main.rs
@@ -88,7 +88,7 @@ fn make(img: &RawImage, path: String) {
 		format!("{}_bjpg", &path[..path.len() - 4]),
 	);
 
-	bayered.iter_mut().for_each(|p| *p = p.saturating_sub(42));
+	//bayered.iter_mut().for_each(|p| *p = p.saturating_sub(42));
 
 	let (mut rgb, color_format) = match img.cfa_string() {
 		Some(cfa_string) => {