Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move rust mobile code to shared crate

laurenspriem6e59dd7f2702
diff --git a/mobile/apps/photos/rust/Cargo.lock b/mobile/apps/photos/rust/Cargo.lock
index 74ca94b528..c118e3e30c 100644
--- a/mobile/apps/photos/rust/Cargo.lock
+++ b/mobile/apps/photos/rust/Cargo.lock
@@ -753,16 +753,7 @@ checksum = "177a59811828ea5dbc8927662d444ffee7b55a44696486f1b1a245ae9e652533"
name = "ente_media_inspector"
version = "0.1.0"
dependencies = [
- "quick-xml",
-]
-
-[[package]]
-name = "ente_photos_rust"
-version = "0.0.1"
-dependencies = [
- "ente_media_inspector",
"fast_image_resize",
- "flutter_rust_bridge",
"half",
"html-escape",
"image",
@@ -774,12 +765,21 @@ dependencies = [
"once_cell",
"ort",
"plsfix",
+ "quick-xml",
"regex",
"thiserror 2.0.18",
"tiff",
"usearch",
]
+[[package]]
+name = "ente_photos_rust"
+version = "0.0.1"
+dependencies = [
+ "ente_media_inspector",
+ "flutter_rust_bridge",
+]
+
[[package]]
name = "env_filter"
version = "0.1.4"
diff --git a/mobile/apps/photos/rust/Cargo.toml b/mobile/apps/photos/rust/Cargo.toml
index ab81d337b5..708590aa79 100644
--- a/mobile/apps/photos/rust/Cargo.toml
+++ b/mobile/apps/photos/rust/Cargo.toml
@@ -8,46 +8,7 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
flutter_rust_bridge = "=2.11.1"
-usearch = "2.21.3"
ente_media_inspector = { path = "../../../../rust/photos" }
-fast_image_resize = { version = "5.5.0", features = ["image", "rayon"] }
-image = { version = "0.25.5", default-features = true }
-imageproc = "0.25.0"
-kamadak-exif = "0.6.1"
-libheic-rs = { git = "https://github.com/laurens-pilot/libheic-rs.git", tag = "v0.1.5", features = [
- "image-integration",
-] }
-tiff = "0.10.3"
-nalgebra = "0.33.2"
-ndarray = "0.16.1"
-half = "2.1"
-once_cell = "1.20.2"
-regex = "1.11.1"
-html-escape = "0.2.13"
-plsfix = "0.1.8"
-thiserror = "2.0.11"
-
-[target.'cfg(target_os = "ios")'.dependencies]
-ort = { version = "=2.0.0-rc.4", default-features = false, features = [
- "ndarray",
- "half",
- # Temporarily disabled to avoid iOS duplicate ObjC class collisions
- # when both Dart ONNXRuntime and Rust ONNXRuntime are linked.
- # Re-enable once we move to a single shared ORT runtime.
- # "coreml",
- "xnnpack",
-] }
-
-[target.'cfg(not(target_os = "ios"))'.dependencies]
-ort = { version = "=2.0.0-rc.4", default-features = false, features = [
- "ndarray",
- "half",
- "load-dynamic",
- "copy-dylibs",
- "coreml",
- "nnapi",
- "xnnpack",
-] }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
diff --git a/mobile/apps/photos/rust/src/api/image_processing_api.rs b/mobile/apps/photos/rust/src/api/image_processing_api.rs
index 4a7e115795..6b121ae6ff 100644
--- a/mobile/apps/photos/rust/src/api/image_processing_api.rs
+++ b/mobile/apps/photos/rust/src/api/image_processing_api.rs
@@ -1,4 +1,4 @@
-use crate::{
+use ente_media_inspector::{
image::decode::decode_image_from_path,
ml::face::thumbnail::{FaceBox, generate_face_thumbnails as generate_face_thumbnails_impl},
};
diff --git a/mobile/apps/photos/rust/src/api/ml_indexing_api.rs b/mobile/apps/photos/rust/src/api/ml_indexing_api.rs
index 202e131a4a..0762637190 100644
--- a/mobile/apps/photos/rust/src/api/ml_indexing_api.rs
+++ b/mobile/apps/photos/rust/src/api/ml_indexing_api.rs
@@ -1,14 +1,7 @@
-use crate::image::decode::decode_image_from_path;
-use crate::ml::{
- clip::{image::run_clip_image, text::run_clip_text_query, tokenizer::tokenize_clip_text},
- error::{MlError, MlResult},
- face::{align::run_face_alignment, detect::run_face_detection, embed::run_face_embedding},
- pet::{
- align::run_pet_face_alignment,
- detect::{run_pet_body_detection, run_pet_face_detection},
- embed::{run_pet_body_embedding, run_pet_face_embedding},
- },
- runtime::{self, ExecutionProviderPolicy, MlRuntimeConfig, ModelPaths},
+use ente_media_inspector::ml::{
+ indexing as shared_indexing,
+ runtime::{ExecutionProviderPolicy, MlRuntimeConfig, ModelPaths},
+ types as shared_types,
};
#[derive(Clone, Debug)]
@@ -155,218 +148,52 @@ pub struct RunClipTextResult {
}
pub fn init_ml_runtime(config: RustMlRuntimeConfig) -> Result<(), String> {
- runtime::prepare_runtime(&to_runtime_config(&config)).map_err(|e| e.to_string())
+ shared_indexing::init_ml_runtime(to_runtime_config(&config)).map_err(|e| e.to_string())
}
pub fn release_ml_runtime() -> Result<(), String> {
- runtime::release_runtime().map_err(|e| e.to_string())
+ shared_indexing::release_ml_runtime().map_err(|e| e.to_string())
}
pub fn analyze_image_rust(req: AnalyzeImageRequest) -> Result<AnalyzeImageResult, String> {
- analyze_image_rust_inner(req).map_err(|e| e.to_string())
-}
-
-pub fn run_clip_text_rust(req: RunClipTextRequest) -> Result<RunClipTextResult, String> {
- run_clip_text_rust_inner(req).map_err(|e| e.to_string())
-}
-
-pub fn tokenize_clip_text_rust(text: String, vocab_path: String) -> Result<Vec<i32>, String> {
- tokenize_clip_text_rust_inner(&text, &vocab_path).map_err(|e| e.to_string())
-}
-
-fn analyze_image_rust_inner(req: AnalyzeImageRequest) -> MlResult<AnalyzeImageResult> {
- validate_request_model_paths(&req)?;
-
- let runtime_config = MlRuntimeConfig {
- model_paths: to_model_paths(&req.model_paths),
- provider_policy: to_provider_policy(&req.provider_policy),
+ let shared_req = shared_indexing::AnalyzeImageRequest {
+ file_id: req.file_id,
+ image_path: req.image_path,
+ run_faces: req.run_faces,
+ run_clip: req.run_clip,
+ run_pets: req.run_pets,
+ runtime_config: MlRuntimeConfig {
+ model_paths: to_model_paths(&req.model_paths),
+ provider_policy: to_provider_policy(&req.provider_policy),
+ },
};
- runtime::with_runtime(&runtime_config, |runtime| {
- let decoded = decode_image_from_path(&req.image_path)?;
- let dims = RustDimensions {
- width: decoded.dimensions.width as i32,
- height: decoded.dimensions.height as i32,
- };
-
- let faces = if req.run_faces {
- let detections = run_face_detection(runtime, &decoded)?;
- if detections.is_empty() {
- Some(Vec::new())
- } else {
- let (aligned, mut face_results) =
- run_face_alignment(req.file_id, &decoded, detections)?;
- run_face_embedding(runtime, &aligned, &mut face_results)?;
- Some(face_results.into_iter().map(to_api_face_result).collect())
- }
- } else {
- None
- };
-
- let clip = if req.run_clip {
- let clip = run_clip_image(runtime, &decoded)?;
- Some(RustClipResult {
- embedding: clip.embedding,
- })
- } else {
- None
- };
-
- let (pet_faces, pet_bodies) = if req.run_pets {
- let pet_face_detections = run_pet_face_detection(runtime, &decoded)?;
- let body_detections = run_pet_body_detection(runtime, &decoded)?;
-
- let pet_face_results = if !pet_face_detections.is_empty() {
- let (aligned, mut pet_results) =
- run_pet_face_alignment(req.file_id, &decoded, &pet_face_detections)?;
- run_pet_face_embedding(runtime, &aligned, &mut pet_results)?;
- pet_results
- } else {
- Vec::new()
- };
-
- let mut body_results: Vec<crate::ml::types::PetBodyResult> = body_detections
- .into_iter()
- .map(|det| {
- let base_id = crate::ml::types::to_face_id(req.file_id, det.box_xyxy);
- let pet_body_id = format!("{base_id}_c{}", det.coco_class);
- crate::ml::types::PetBodyResult {
- pet_body_id,
- detection: det,
- body_embedding: Vec::new(),
- }
- })
- .collect();
- if !body_results.is_empty() {
- run_pet_body_embedding(runtime, &decoded, &mut body_results)?;
- }
-
- (
- Some(
- pet_face_results
- .into_iter()
- .map(to_api_pet_face_result)
- .collect(),
- ),
- Some(
- body_results
- .into_iter()
- .map(to_api_pet_body_result)
- .collect(),
- ),
- )
- } else {
- (None, None)
- };
-
- Ok(AnalyzeImageResult {
- file_id: req.file_id,
- decoded_image_size: dims,
- faces,
- clip,
- pet_faces,
- pet_bodies,
- })
- })
+ shared_indexing::analyze_image(shared_req)
+ .map(to_api_analyze_image_result)
+ .map_err(|e| e.to_string())
}
-fn run_clip_text_rust_inner(req: RunClipTextRequest) -> MlResult<RunClipTextResult> {
- let RunClipTextRequest {
- text,
- model_path,
- vocab_path,
- provider_policy,
- } = req;
-
- if model_path.trim().is_empty() {
- return Err(MlError::InvalidRequest(
- "missing model path: clipTextModelPath".to_string(),
- ));
- }
- if vocab_path.trim().is_empty() {
- return Err(MlError::InvalidRequest(
- "missing model path: clipTextVocabPath".to_string(),
- ));
- }
-
- let runtime_config = MlRuntimeConfig {
- model_paths: ModelPaths {
- face_detection: String::new(),
- face_embedding: String::new(),
- clip_image: String::new(),
- clip_text: model_path,
- pet_face_detection: String::new(),
- pet_face_embedding_dog: String::new(),
- pet_face_embedding_cat: String::new(),
- pet_body_detection: String::new(),
- pet_body_embedding_dog: String::new(),
- pet_body_embedding_cat: String::new(),
- },
- provider_policy: to_provider_policy(&provider_policy),
+pub fn run_clip_text_rust(req: RunClipTextRequest) -> Result<RunClipTextResult, String> {
+ let shared_req = shared_indexing::RunClipTextRequest {
+ text: req.text,
+ model_path: req.model_path,
+ vocab_path: req.vocab_path,
+ provider_policy: to_provider_policy(&req.provider_policy),
};
- runtime::with_runtime(&runtime_config, |runtime| {
- let clip = run_clip_text_query(runtime, &text, &vocab_path)?;
- Ok(RunClipTextResult {
- embedding: clip
+ shared_indexing::run_clip_text(shared_req)
+ .map(|result| RunClipTextResult {
+ embedding: result
.embedding
.into_iter()
.map(|value| value as f64)
.collect(),
})
- })
-}
-
-fn tokenize_clip_text_rust_inner(text: &str, vocab_path: &str) -> MlResult<Vec<i32>> {
- if vocab_path.trim().is_empty() {
- return Err(MlError::InvalidRequest(
- "missing model path: clipTextVocabPath".to_string(),
- ));
- }
- tokenize_clip_text(text, vocab_path)
+ .map_err(|e| e.to_string())
}
-fn validate_request_model_paths(req: &AnalyzeImageRequest) -> MlResult<()> {
- let mut missing = Vec::new();
- if req.run_faces {
- if req.model_paths.face_detection.trim().is_empty() {
- missing.push("faceDetectionModelPath");
- }
- if req.model_paths.face_embedding.trim().is_empty() {
- missing.push("faceEmbeddingModelPath");
- }
- }
- if req.run_clip && req.model_paths.clip_image.trim().is_empty() {
- missing.push("clipImageModelPath");
- }
- if req.run_pets {
- if req.model_paths.pet_face_detection.trim().is_empty() {
- missing.push("petFaceDetectionModelPath");
- }
- if req.model_paths.pet_body_detection.trim().is_empty() {
- missing.push("petBodyDetectionModelPath");
- }
- if req.model_paths.pet_face_embedding_dog.trim().is_empty() {
- missing.push("petFaceEmbeddingDogModelPath");
- }
- if req.model_paths.pet_face_embedding_cat.trim().is_empty() {
- missing.push("petFaceEmbeddingCatModelPath");
- }
- if req.model_paths.pet_body_embedding_dog.trim().is_empty() {
- missing.push("petBodyEmbeddingDogModelPath");
- }
- if req.model_paths.pet_body_embedding_cat.trim().is_empty() {
- missing.push("petBodyEmbeddingCatModelPath");
- }
- }
- if missing.is_empty() {
- return Ok(());
- }
-
- Err(MlError::InvalidRequest(format!(
- "missing required model paths: {}",
- missing.join(", ")
- )))
+pub fn tokenize_clip_text_rust(text: String, vocab_path: String) -> Result<Vec<i32>, String> {
+ shared_indexing::tokenize_clip_text(&text, &vocab_path).map_err(|e| e.to_string())
}
fn to_runtime_config(config: &RustMlRuntimeConfig) -> MlRuntimeConfig {
@@ -400,7 +227,29 @@ fn to_provider_policy(policy: &RustExecutionProviderPolicy) -> ExecutionProvider
}
}
-fn to_api_face_result(result: crate::ml::types::FaceResult) -> RustFaceResult {
+fn to_api_analyze_image_result(result: shared_indexing::AnalyzeImageResult) -> AnalyzeImageResult {
+ AnalyzeImageResult {
+ file_id: result.file_id,
+ decoded_image_size: RustDimensions {
+ width: result.decoded_image_size.width as i32,
+ height: result.decoded_image_size.height as i32,
+ },
+ faces: result
+ .faces
+ .map(|faces| faces.into_iter().map(to_api_face_result).collect()),
+ clip: result.clip.map(|clip| RustClipResult {
+ embedding: clip.embedding,
+ }),
+ pet_faces: result
+ .pet_faces
+ .map(|faces| faces.into_iter().map(to_api_pet_face_result).collect()),
+ pet_bodies: result
+ .pet_bodies
+ .map(|bodies| bodies.into_iter().map(to_api_pet_body_result).collect()),
+ }
+}
+
+fn to_api_face_result(result: shared_types::FaceResult) -> RustFaceResult {
RustFaceResult {
detection: RustDetection {
score: result.detection.score,
@@ -429,7 +278,7 @@ fn to_api_face_result(result: crate::ml::types::FaceResult) -> RustFaceResult {
}
}
-fn to_api_pet_face_result(result: crate::ml::types::PetFaceResult) -> RustPetFaceResult {
+fn to_api_pet_face_result(result: shared_types::PetFaceResult) -> RustPetFaceResult {
RustPetFaceResult {
detection: RustPetFaceDetectionResult {
score: result.detection.score as f64,
@@ -466,7 +315,7 @@ fn to_api_pet_face_result(result: crate::ml::types::PetFaceResult) -> RustPetFac
}
}
-fn to_api_pet_body_result(result: crate::ml::types::PetBodyResult) -> RustPetBodyResult {
+fn to_api_pet_body_result(result: shared_types::PetBodyResult) -> RustPetBodyResult {
RustPetBodyResult {
box_xyxy: result
.detection
diff --git a/mobile/apps/photos/rust/src/api/usearch_api.rs b/mobile/apps/photos/rust/src/api/usearch_api.rs
index 81fca3fa65..ec75b23cf0 100644
--- a/mobile/apps/photos/rust/src/api/usearch_api.rs
+++ b/mobile/apps/photos/rust/src/api/usearch_api.rs
@@ -1,12 +1,5 @@
+use ente_media_inspector::vector_db;
use flutter_rust_bridge::frb;
-use usearch::{Index, IndexOptions, MetricKind, ScalarKind};
-
-use std::collections::HashSet;
-use std::path::PathBuf;
-use std::sync::atomic::{AtomicU64, Ordering};
-
-const FAST_SEARCH_STEP_COUNTS: [usize; 5] = [200, 500, 2000, 5000, 10000];
-static INDEX_SAVE_TEMP_COUNTER: AtomicU64 = AtomicU64::new(0);
type SearchMatch = (Vec<u64>, Vec<f32>);
type BulkSearchMatch = (Vec<Vec<u64>>, Vec<Vec<f32>>);
@@ -14,138 +7,23 @@ type BulkSearchByKeyMatch = (Vec<u64>, Vec<Vec<u64>>, Vec<Vec<f32>>);
#[frb(opaque)]
pub struct VectorDB {
- index: Index,
- path: PathBuf,
+ inner: vector_db::VectorDB,
}
impl VectorDB {
#[frb(sync)]
pub fn new(file_path: &str, dimensions: usize) -> Result<Self, String> {
- let path = PathBuf::from(file_path);
- let file_exists = path.try_exists().map_err(|e| {
- format!(
- "Failed to check index file existence at {}: {e}",
- path.display()
- )
- })?;
-
- let mut options = IndexOptions::default();
- options.dimensions = dimensions;
- options.metric = MetricKind::IP;
- options.quantization = ScalarKind::F32;
- options.connectivity = 0; // auto
- options.expansion_add = 0; // auto
- options.expansion_search = 0; // auto
-
- let index = Index::new(&options).map_err(|e| format!("Failed to create index: {e}"))?;
- index
- .reserve(1000)
- .map_err(|e| format!("Failed to reserve space in index: {e}"))?;
-
- let db = Self { index, path };
-
- if file_exists {
- println!("Loading index from disk.");
- // Must use load() instead of view() because:
- // - view() creates a read-only memory-mapped view (immutable)
- // - load() loads the index into RAM for read/write operations (mutable)
- // Using view() causes "Can't add to an immutable index" error
- db.index
- .load(file_path)
- .map_err(|e| format!("Failed to load index from {file_path}: {e}"))?;
- } else {
- println!("Creating new index.");
- db.save_index()?;
- }
- Ok(db)
- }
-
- fn save_index(&self) -> Result<(), String> {
- // Ensure directory exists
- if let Some(parent) = self.path.parent() {
- std::fs::create_dir_all(parent).map_err(|e| {
- format!(
- "Failed to create index parent directory {}: {e}",
- parent.display()
- )
- })?;
- }
-
- // Use atomic write: save to temp file first, then rename
- // Use a unique temp path per save so concurrent saves can never race
- // by clobbering the same temporary file.
- let save_sequence = INDEX_SAVE_TEMP_COUNTER.fetch_add(1, Ordering::Relaxed);
- let temp_path =
- self.path
- .with_extension(format!("tmp.{}.{}", std::process::id(), save_sequence));
- let temp_path_str = temp_path
- .to_str()
- .ok_or_else(|| format!("Invalid temp path: {}", temp_path.display()))?;
-
- // Save to temporary file
- self.index.save(temp_path_str).map_err(|e| {
- let _ = std::fs::remove_file(&temp_path);
- format!(
- "Failed to save index to temp file {}: {e}",
- temp_path.display()
- )
- })?;
-
- // Atomic rename - guaranteed atomic on iOS/Android
- // This will atomically replace the existing file
- // The rename ensures we never have a partially written file,
- // even if the app is suspended or crashes
- if let Err(e) = std::fs::rename(&temp_path, &self.path) {
- let _ = std::fs::remove_file(&temp_path);
- return Err(format!(
- "Failed to atomically save index (rename {} -> {}): {e}",
- temp_path.display(),
- self.path.display()
- ));
- }
-
- println!("Successfully saved index atomically");
- Ok(())
- }
-
- fn ensure_capacity(&self, margin: usize) -> Result<(), String> {
- let current_size = self.index.size();
- let capacity = self.index.capacity();
- if current_size + margin + 1000 >= capacity {
- self.index
- .reserve(current_size + margin)
- .map_err(|e| format!("Failed to reserve space in index: {e}"))?;
- }
- Ok(())
+ Ok(Self {
+ inner: vector_db::VectorDB::new(file_path, dimensions)?,
+ })
}
pub fn add_vector(&mut self, key: u64, vector: &[f32]) -> Result<(), String> {
- if self.contains_vector(key) {
- self.index
- .remove(key)
- .map_err(|e| format!("Failed to remove existing vector for key {key}: {e}"))?;
- } else {
- self.ensure_capacity(1)?;
- }
- self.index
- .add(key, vector)
- .map_err(|e| format!("Failed to add vector for key {key}: {e}"))?;
- self.save_index()
+ self.inner.add_vector(key, vector)
}
pub fn bulk_add_vectors(&mut self, keys: Vec<u64>, vectors: &[Vec<f32>]) -> Result<(), String> {
- self.ensure_capacity(keys.len())?;
- for (key, vector) in keys.iter().zip(vectors.iter()) {
- if self.contains_vector(*key) {
- self.index.remove(*key).map_err(|e| {
- format!("Failed to remove existing vector for key {key} before bulk add: {e}")
- })?;
- }
- self.index
- .add(*key, vector)
- .map_err(|e| format!("Failed to bulk add vector for key {key}: {e}"))?;
- }
- self.save_index()
+ self.inner.bulk_add_vectors(keys, vectors)
}
pub fn search_vectors(
@@ -154,16 +32,7 @@ impl VectorDB {
count: usize,
exact: bool,
) -> Result<SearchMatch, String> {
- let matches = if exact {
- self.index
- .exact_search(query, count)
- .map_err(|e| format!("Failed to exact search vectors: {e}"))?
- } else {
- self.index
- .search(query, count)
- .map_err(|e| format!("Failed to search vectors: {e}"))?
- };
- Ok((matches.keys, matches.distances))
+ self.inner.search_vectors(query, count, exact)
}
pub fn approx_search_vectors_within_similarity(
@@ -171,17 +40,8 @@ impl VectorDB {
query: &[f32],
minimum_similarity: f32,
) -> Result<SearchMatch, String> {
- let index_size = self.index.size();
- if index_size == 0 || !minimum_similarity.is_finite() {
- return Ok((Vec::new(), Vec::new()));
- }
-
- let max_distance = 1.0_f32 - minimum_similarity;
- if !max_distance.is_finite() || max_distance < 0.0 {
- return Ok((Vec::new(), Vec::new()));
- }
-
- self.fast_search_vectors_within_distance(query, max_distance)
+ self.inner
+ .approx_search_vectors_within_similarity(query, minimum_similarity)
}
pub fn approx_filtered_search_vectors_within_distance(
@@ -191,30 +51,12 @@ impl VectorDB {
count: usize,
max_distance: f32,
) -> Result<SearchMatch, String> {
- let index_size = self.index.size();
- if index_size == 0 || count == 0 || allowed_keys.is_empty() {
- return Ok((Vec::new(), Vec::new()));
- }
- if !max_distance.is_finite() || max_distance < 0.0 {
- return Ok((Vec::new(), Vec::new()));
- }
-
- let allowed = allowed_keys.iter().copied().collect::<HashSet<u64>>();
- let search_count = count.min(allowed.len()).min(index_size);
- if search_count == 0 {
- return Ok((Vec::new(), Vec::new()));
- }
-
- let matches = self
- .index
- .filtered_search(query, search_count, |key| allowed.contains(&key))
- .map_err(|e| format!("Failed to run filtered vector search: {e}"))?;
-
- Ok(Self::truncate_sorted_matches_within_distance(
- matches.keys,
- matches.distances,
+ self.inner.approx_filtered_search_vectors_within_distance(
+ query,
+ allowed_keys,
+ count,
max_distance,
- ))
+ )
}
pub fn bulk_approx_filtered_search_vectors_within_distance(
@@ -224,121 +66,13 @@ impl VectorDB {
count: usize,
max_distance: f32,
) -> Result<BulkSearchMatch, String> {
- let query_count = queries.len();
- if query_count == 0 {
- return Ok((Vec::new(), Vec::new()));
- }
-
- let empty_aligned_results = || {
- (
- vec![Vec::<u64>::new(); query_count],
- vec![Vec::<f32>::new(); query_count],
- )
- };
-
- let index_size = self.index.size();
- if index_size == 0 || count == 0 || allowed_keys.is_empty() {
- return Ok(empty_aligned_results());
- }
- if !max_distance.is_finite() || max_distance < 0.0 {
- return Ok(empty_aligned_results());
- }
-
- let allowed = allowed_keys.iter().copied().collect::<HashSet<u64>>();
- let search_count = count.min(allowed.len()).min(index_size);
- if search_count == 0 {
- return Ok(empty_aligned_results());
- }
-
- let mut all_keys = Vec::with_capacity(query_count);
- let mut all_distances = Vec::with_capacity(query_count);
-
- for query in queries {
- let matches = self
- .index
- .filtered_search(query, search_count, |key| allowed.contains(&key))
- .map_err(|e| format!("Failed to run filtered vector search: {e}"))?;
-
- let (keys, distances) = Self::truncate_sorted_matches_within_distance(
- matches.keys,
- matches.distances,
+ self.inner
+ .bulk_approx_filtered_search_vectors_within_distance(
+ queries,
+ allowed_keys,
+ count,
max_distance,
- );
- all_keys.push(keys);
- all_distances.push(distances);
- }
-
- Ok((all_keys, all_distances))
- }
-
- fn fast_search_vectors_within_distance(
- &self,
- query: &[f32],
- max_distance: f32,
- ) -> Result<SearchMatch, String> {
- let index_size = self.index.size();
- if index_size == 0 {
- return Ok((Vec::new(), Vec::new()));
- }
-
- let mut previous_count = 0_usize;
- for step_count in FAST_SEARCH_STEP_COUNTS {
- let count = step_count.min(index_size);
- if count <= previous_count {
- continue;
- }
- previous_count = count;
-
- let matches = self
- .index
- .search(query, count)
- .map_err(|e| format!("Failed to search vectors: {e}"))?;
-
- let should_expand = count < index_size
- && matches
- .distances
- .last()
- .map(|d| *d <= max_distance)
- .unwrap_or(false);
- if should_expand {
- continue;
- }
-
- return Ok(Self::truncate_sorted_matches_within_distance(
- matches.keys,
- matches.distances,
- max_distance,
- ));
- }
-
- if previous_count < index_size {
- let matches = self
- .index
- .search(query, index_size)
- .map_err(|e| format!("Failed to search vectors: {e}"))?;
- return Ok(Self::truncate_sorted_matches_within_distance(
- matches.keys,
- matches.distances,
- max_distance,
- ));
- }
-
- Ok((Vec::new(), Vec::new()))
- }
-
- fn truncate_sorted_matches_within_distance(
- mut keys: Vec<u64>,
- mut distances: Vec<f32>,
- max_distance: f32,
- ) -> SearchMatch {
- let aligned_len = keys.len().min(distances.len());
- keys.truncate(aligned_len);
- distances.truncate(aligned_len);
-
- let keep_len = distances.partition_point(|distance| *distance <= max_distance);
- keys.truncate(keep_len);
- distances.truncate(keep_len);
- (keys, distances)
+ )
}
pub fn bulk_search_vectors(
@@ -347,15 +81,7 @@ impl VectorDB {
count: usize,
exact: bool,
) -> Result<BulkSearchMatch, String> {
- let mut keys = Vec::new();
- let mut distances = Vec::new();
-
- for query in queries {
- let (keys_result, distances_result) = self.search_vectors(query, count, exact)?;
- keys.push(keys_result);
- distances.push(distances_result);
- }
- Ok((keys, distances))
+ self.inner.bulk_search_vectors(queries, count, exact)
}
pub fn bulk_search_keys(
@@ -364,127 +90,40 @@ impl VectorDB {
count: usize,
exact: bool,
) -> Result<BulkSearchByKeyMatch, String> {
- let dimensions = self.index.dimensions();
- let mut embedding_data = vec![0.0f32; potential_keys.len() * dimensions];
- let mut contained_keys = Vec::with_capacity(potential_keys.len());
- let mut actual_query_count = 0;
-
- // Fill embeddings directly into flat storage using slices
- for key in potential_keys {
- if self.index.contains(*key) {
- let start_idx = actual_query_count * dimensions;
- let end_idx = start_idx + dimensions;
- let embedding_slice = &mut embedding_data[start_idx..end_idx];
-
- self.index
- .get(*key, embedding_slice)
- .map_err(|e| format!("Failed to get vector for key {key}: {e}"))?;
- contained_keys.push(*key);
- actual_query_count += 1;
- }
- }
- embedding_data.truncate(actual_query_count * dimensions);
-
- let max_result_size = std::cmp::min(self.index.size(), count);
- let mut closeby_keys = vec![Vec::with_capacity(max_result_size); actual_query_count];
- let mut distances = vec![Vec::with_capacity(max_result_size); actual_query_count];
-
- // Search using slices and fill pre-allocated containers
- for i in 0..actual_query_count {
- let start_idx = i * dimensions;
- let end_idx = start_idx + dimensions;
- let query_slice = &embedding_data[start_idx..end_idx];
- let (keys_result, distances_result) = self.search_vectors(query_slice, count, exact)?;
- closeby_keys[i] = keys_result;
- distances[i] = distances_result;
- }
-
- Ok((contained_keys, closeby_keys, distances))
+ self.inner.bulk_search_keys(potential_keys, count, exact)
}
/// Check if a vector with the given key exists in the index.
/// `true` if the index contains the vector with the given key, `false` otherwise.
pub fn contains_vector(&self, key: u64) -> bool {
- self.index.contains(key)
+ self.inner.contains_vector(key)
}
pub fn get_vector(&self, key: u64) -> Result<Vec<f32>, String> {
- let mut vector: Vec<f32> = vec![0.0; self.index.dimensions()];
- self.index
- .get(key, &mut vector)
- .map_err(|e| format!("Failed to get vector for key {key}: {e}"))?;
- Ok(vector)
+ self.inner.get_vector(key)
}
pub fn bulk_get_vectors(&self, keys: Vec<u64>) -> Result<Vec<Vec<f32>>, String> {
- let mut vectors = Vec::new();
- for key in keys {
- let vector = self.get_vector(key)?;
- vectors.push(vector);
- }
- Ok(vectors)
+ self.inner.bulk_get_vectors(keys)
}
pub fn remove_vector(&mut self, key: u64) -> Result<usize, String> {
- let removed_count = self
- .index
- .remove(key)
- .map_err(|e| format!("Failed to remove vector for key {key}: {e}"))?;
- self.save_index()?;
- Ok(removed_count)
+ self.inner.remove_vector(key)
}
pub fn bulk_remove_vectors(&mut self, keys: Vec<u64>) -> Result<usize, String> {
- let mut removed_count = 0;
- for key in keys {
- removed_count += self
- .index
- .remove(key)
- .map_err(|e| format!("Failed to bulk remove vector for key {key}: {e}"))?;
- }
- self.save_index()?;
- Ok(removed_count)
+ self.inner.bulk_remove_vectors(keys)
}
pub fn reset_index(&mut self) -> Result<(), String> {
- self.index
- .reset()
- .map_err(|e| format!("Failed to reset index: {e}"))?;
- self.index
- .reserve(1000)
- .map_err(|e| format!("Failed to reserve space in index after reset: {e}"))?;
- self.save_index()
+ self.inner.reset_index()
}
pub fn delete_index(self) -> Result<(), String> {
- if self.path.exists() {
- std::fs::remove_file(&self.path)
- .map_err(|e| format!("Failed to delete index file {}: {e}", self.path.display()))?;
- } else {
- println!("Index file does not exist.");
- }
- Ok(())
+ self.inner.delete_index()
}
pub fn get_index_stats(&self) -> (usize, usize, usize, usize, usize, usize, usize) {
- let size = self.index.size();
- let capacity = self.index.capacity();
- let dimensions = self.index.dimensions();
-
- let file_size = self.index.serialized_length();
- let memory_usage = self.index.memory_usage();
-
- let expansion_add = self.index.expansion_add();
- let expansion_search = self.index.expansion_search();
-
- (
- size,
- capacity,
- dimensions,
- file_size,
- memory_usage,
- expansion_add,
- expansion_search,
- )
+ self.inner.get_index_stats()
}
}
diff --git a/mobile/apps/photos/rust/src/lib.rs b/mobile/apps/photos/rust/src/lib.rs
index 004f3a1a19..cbb071f8bf 100644
--- a/mobile/apps/photos/rust/src/lib.rs
+++ b/mobile/apps/photos/rust/src/lib.rs
@@ -1,4 +1,2 @@
pub mod api;
mod frb_generated;
-pub mod image;
-pub mod ml;
diff --git a/rust/README.md b/rust/README.md
index 8e4c9c82cc..85ccda9056 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -33,14 +33,15 @@
β”‚ mobile/apps/photos/rust/ β”‚
β”‚ (ente_photos_rust crate) β”‚
β”‚ β”‚
-β”‚ App-specific #[frb]: β”‚
-β”‚ usearch, ML, etc. β”‚
+β”‚ Thin app-specific #[frb] β”‚
+β”‚ wrappers for rust/photos β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
## Contents (this repo)
- `rust/core/` (`ente-core`) - shared, pure Rust code used by clients (crypto + auth, plus small HTTP/URL helpers).
+- `rust/photos/` (`ente_media_inspector`) - shared Photos Rust logic (motion photo, ML, image processing, vector DB).
- `rust/cli/` (`ente-rs`) - Rust CLI.
- `rust/ensu/` - LLM chat stack (see `rust/ensu/README.md`).
@@ -64,6 +65,14 @@ rust/
β”‚ β”‚ └── auth.md
β”‚ └── Cargo.toml
β”‚
+β”œβ”€β”€ photos/ # Shared Photos Rust logic
+β”‚ β”œβ”€β”€ src/
+β”‚ β”‚ β”œβ”€β”€ lib.rs
+β”‚ β”‚ β”œβ”€β”€ image/
+β”‚ β”‚ β”œβ”€β”€ ml/
+β”‚ β”‚ └── vector_db.rs
+β”‚ └── Cargo.toml
+β”‚
└── ensu/ # LLM chat stack (see rust/ensu/README.md)
rust/uniffi/ # UniFFI bindings for core crypto/auth + ensu
@@ -88,7 +97,7 @@ mobile/packages/rust/ # Shared FRB bindings for all mobile apps
mobile/apps/photos/rust/ # Photos app-specific FRB bindings
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ lib.rs
-β”‚ └── api/ # #[frb] app-specific code (usearch, ML)
+β”‚ └── api/ # #[frb] thin wrappers over rust/photos
β”‚ └── *.rs
└── Cargo.toml # crate name: ente_photos_rust
```
@@ -97,6 +106,7 @@ mobile/apps/photos/rust/ # Photos app-specific FRB bindings
- `ente-core` - shared business logic (pure Rust, no FFI)
- Docs: `rust/core/docs/crypto.md`, `rust/core/docs/auth.md`
+- `ente_media_inspector` - shared Photos Rust logic
- `ente-rs` - CLI binary
- `ente-wasm` - wasm-bindgen wrappers for web
- `ente_rust` - shared FRB wrappers for mobile (Dart class: `EnteRust`)
@@ -127,7 +137,7 @@ wasm-pack is installed via npm as a devDependency, so `yarn install` handles it.
Used for Flutter integration. FRB is used on two crates:
- **`ente_rust`** (`mobile/packages/rust/`) - Shared wrappers around `ente-core`, used by multiple mobile apps (Photos, Auth, etc.)
-- **`ente_photos_rust`** (`mobile/apps/photos/rust/`) - Photos app-specific functionality (usearch, ML)
+- **`ente_photos_rust`** (`mobile/apps/photos/rust/`) - Thin Photos-specific wrappers around `rust/photos`
Both depend on `ente-core` and use `#[frb]` annotations to generate Dart bindings.
diff --git a/rust/photos/Cargo.lock b/rust/photos/Cargo.lock
index 5e67f7ff13..06f8d3055d 100644
--- a/rust/photos/Cargo.lock
+++ b/rust/photos/Cargo.lock
@@ -2,239 +2,2649 @@
# It is not intended for manual editing.
version = 4
+[[package]]
+name = "ab_glyph"
+version = "0.2.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2"
+dependencies = [
+ "ab_glyph_rasterizer",
+ "owned_ttf_parser",
+]
+
+[[package]]
+name = "ab_glyph_rasterizer"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "aligned"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
+dependencies = [
+ "as-slice",
+]
+
+[[package]]
+name = "aligned-vec"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"
+dependencies = [
+ "equator",
+]
+
+[[package]]
+name = "alloc-no-stdlib"
+version = "2.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"
+
+[[package]]
+name = "alloc-stdlib"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"
+dependencies = [
+ "alloc-no-stdlib",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
+
[[package]]
name = "anyhow"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"
+checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"
+
+[[package]]
+name = "approx"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "arbitrary"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
+
+[[package]]
+name = "archmage"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0fb818f2e02ca08cc6416725044fadc84bcf5a96e2eb7ab103c966123667d86"
+dependencies = [
+ "archmage-macros",
+ "safe_unaligned_simd",
+]
+
+[[package]]
+name = "archmage-macros"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1886761e37995842cfbaf8c24d483e62d9b8c174254d29146f596d4d87efff2d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "arg_enum_proc_macro"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+
+[[package]]
+name = "as-slice"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
+dependencies = [
+ "stable_deref_trait",
+]
+
+[[package]]
+name = "assert_matches"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
+
+[[package]]
+name = "atomig"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd0f41f4bb89f5c6450325e283fb78c4a3d042181b54f3855ee2f872919f9863"
+dependencies = [
+ "atomig-macro",
+]
+
+[[package]]
+name = "atomig-macro"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49c98dba06b920588de7d63f6acc23f1e6a9fade5fd6198e564506334fb5a4f5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
+
+[[package]]
+name = "av-scenechange"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"
+dependencies = [
+ "aligned",
+ "anyhow",
+ "arg_enum_proc_macro",
+ "arrayvec",
+ "log",
+ "num-rational",
+ "num-traits",
+ "pastey",
+ "rayon",
+ "thiserror 2.0.18",
+ "v_frame",
+ "y4m",
+]
+
+[[package]]
+name = "av1-grain"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"
+dependencies = [
+ "anyhow",
+ "arrayvec",
+ "log",
+ "nom",
+ "num-rational",
+ "v_frame",
+]
+
+[[package]]
+name = "avif-serialize"
+version = "0.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "375082f007bd67184fb9c0374614b29f9aaa604ec301635f72338bb65386a53d"
+dependencies = [
+ "arrayvec",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
+dependencies = [
+ "bit-vec",
+]
+
+[[package]]
+name = "bit-vec"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
+
+[[package]]
+name = "bit_field"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
+
+[[package]]
+name = "bitflags"
+version = "2.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
+
+[[package]]
+name = "bitstream-io"
+version = "4.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60d4bd9d1db2c6bdf285e223a7fa369d5ce98ec767dec949c6ca62863ce61757"
+dependencies = [
+ "core2",
+]
+
+[[package]]
+name = "brotli"
+version = "8.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560"
+dependencies = [
+ "alloc-no-stdlib",
+ "alloc-stdlib",
+ "brotli-decompressor",
+]
+
+[[package]]
+name = "brotli-decompressor"
+version = "5.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03"
+dependencies = [
+ "alloc-no-stdlib",
+ "alloc-stdlib",
+]
+
+[[package]]
+name = "built"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64"
+
+[[package]]
+name = "bumpalo"
+version = "3.20.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
+
+[[package]]
+name = "bytemuck"
+version = "1.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "byteorder-lite"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
+
+[[package]]
+name = "bytes"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
+
+[[package]]
+name = "bytestring"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "113b4343b5f6617e7ad401ced8de3cc8b012e73a594347c307b90db3e9271289"
+dependencies = [
+ "bytes",
+]
+
+[[package]]
+name = "calendrical_calculations"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e97f73e95d668625c9b28a3072e6326773785a0cf807de9f3d632778438f3d38"
+dependencies = [
+ "core_maths",
+ "displaydoc",
+]
+
+[[package]]
+name = "cc"
+version = "1.2.57"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423"
+dependencies = [
+ "find-msvc-tools",
+ "jobserver",
+ "libc",
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "clap"
+version = "4.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351"
+dependencies = [
+ "clap_builder",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
+dependencies = [
+ "anstyle",
+ "clap_lex",
+ "strsim",
+]
+
+[[package]]
+name = "clap_lex"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
+
+[[package]]
+name = "codespan-reporting"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"
+dependencies = [
+ "serde",
+ "termcolor",
+ "unicode-width",
+]
+
+[[package]]
+name = "color_quant"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
+
+[[package]]
+name = "core2"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "core_maths"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
+dependencies = [
+ "libm",
+]
+
+[[package]]
+name = "crc32fast"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
+dependencies = [
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
+
+[[package]]
+name = "crunchy"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
+
+[[package]]
+name = "cxx"
+version = "1.0.194"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "747d8437319e3a2f43d93b341c137927ca70c0f5dabeea7a005a73665e247c7e"
+dependencies = [
+ "cc",
+ "cxx-build",
+ "cxxbridge-cmd",
+ "cxxbridge-flags",
+ "cxxbridge-macro",
+ "foldhash 0.2.0",
+ "link-cplusplus",
+]
+
+[[package]]
+name = "cxx-build"
+version = "1.0.194"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b0f4697d190a142477b16aef7da8a99bfdc41e7e8b1687583c0d23a79c7afc1e"
+dependencies = [
+ "cc",
+ "codespan-reporting",
+ "indexmap",
+ "proc-macro2",
+ "quote",
+ "scratch",
+ "syn",
+]
+
+[[package]]
+name = "cxxbridge-cmd"
+version = "1.0.194"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0956799fa8678d4c50eed028f2de1c0552ae183c76e976cf7ca8c4e36a7c328"
+dependencies = [
+ "clap",
+ "codespan-reporting",
+ "indexmap",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "cxxbridge-flags"
+version = "1.0.194"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23384a836ab4f0ad98ace7e3955ad2de39de42378ab487dc28d3990392cb283a"
+
+[[package]]
+name = "cxxbridge-macro"
+version = "1.0.194"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6acc6b5822b9526adfb4fc377b67128fdd60aac757cc4a741a6278603f763cf"
+dependencies = [
+ "indexmap",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "displaydoc"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "document-features"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
+dependencies = [
+ "litrs",
+]
+
+[[package]]
+name = "either"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+
+[[package]]
+name = "encoding"
+version = "0.2.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
+dependencies = [
+ "encoding-index-japanese",
+ "encoding-index-korean",
+ "encoding-index-simpchinese",
+ "encoding-index-singlebyte",
+ "encoding-index-tradchinese",
+]
+
+[[package]]
+name = "encoding-index-japanese"
+version = "1.20141219.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
+dependencies = [
+ "encoding_index_tests",
+]
+
+[[package]]
+name = "encoding-index-korean"
+version = "1.20141219.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
+dependencies = [
+ "encoding_index_tests",
+]
+
+[[package]]
+name = "encoding-index-simpchinese"
+version = "1.20141219.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
+dependencies = [
+ "encoding_index_tests",
+]
+
+[[package]]
+name = "encoding-index-singlebyte"
+version = "1.20141219.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
+dependencies = [
+ "encoding_index_tests",
+]
+
+[[package]]
+name = "encoding-index-tradchinese"
+version = "1.20141219.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
+dependencies = [
+ "encoding_index_tests",
+]
+
+[[package]]
+name = "encoding_index_tests"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
+
+[[package]]
+name = "encoding_rs"
+version = "0.8.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "enough"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "177a59811828ea5dbc8927662d444ffee7b55a44696486f1b1a245ae9e652533"
+
+[[package]]
+name = "ente_media_inspector"
+version = "0.1.0"
+dependencies = [
+ "fast_image_resize",
+ "half",
+ "html-escape",
+ "image",
+ "imageproc",
+ "kamadak-exif",
+ "libheic-rs",
+ "nalgebra 0.33.2",
+ "ndarray 0.16.1",
+ "once_cell",
+ "ort",
+ "plsfix",
+ "quick-xml",
+ "regex",
+ "tempfile",
+ "thiserror 2.0.18",
+ "tiff",
+ "usearch",
+]
+
+[[package]]
+name = "equator"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"
+dependencies = [
+ "equator-macro",
+]
+
+[[package]]
+name = "equator-macro"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
+[[package]]
+name = "errno"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "exr"
+version = "1.74.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be"
+dependencies = [
+ "bit_field",
+ "half",
+ "lebe",
+ "miniz_oxide",
+ "rayon-core",
+ "smallvec",
+ "zune-inflate",
+]
+
+[[package]]
+name = "fancy-regex"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298"
+dependencies = [
+ "bit-set",
+ "regex-automata 0.4.14",
+ "regex-syntax",
+]
+
+[[package]]
+name = "fast_image_resize"
+version = "5.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbc7fe45cf92b43817ff62a3723e862b85bd1d06288f63007f7645d1d2f7a060"
+dependencies = [
+ "bytemuck",
+ "cfg-if",
+ "document-features",
+ "image",
+ "num-traits",
+ "rayon",
+ "thiserror 2.0.18",
+]
+
+[[package]]
+name = "fastrand"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+
+[[package]]
+name = "fax"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab"
+dependencies = [
+ "fax_derive",
+]
+
+[[package]]
+name = "fax_derive"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "fdeflate"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
+dependencies = [
+ "simd-adler32",
+]
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
+
+[[package]]
+name = "fixed_decimal"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0febbeb1118a9ecdee6e4520ead6b54882e843dd0592ad233247dbee84c53db8"
+dependencies = [
+ "displaydoc",
+ "smallvec",
+ "writeable",
+]
+
+[[package]]
+name = "flate2"
+version = "1.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide",
+]
+
+[[package]]
+name = "foldhash"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
+
+[[package]]
+name = "foldhash"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "wasi",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi",
+ "wasip2",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi",
+ "wasip2",
+ "wasip3",
+]
+
+[[package]]
+name = "gif"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f5df2ba84018d80c213569363bdcd0c64e6933c67fe4c1d60ecf822971a3c35e"
+dependencies = [
+ "color_quant",
+ "weezl",
+]
+
+[[package]]
+name = "half"
+version = "2.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
+dependencies = [
+ "cfg-if",
+ "crunchy",
+ "zerocopy 0.8.42",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.15.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
+dependencies = [
+ "foldhash 0.1.5",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
+
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
+name = "heic-decoder"
+version = "0.1.0"
+source = "git+https://github.com/laurens-pilot/libheic-rs.git?tag=v0.1.5#18307d94c72c13eb9526655b748c333722ee145b"
+dependencies = [
+ "archmage",
+ "enough",
+ "safe_unaligned_simd",
+ "whereat",
+]
+
+[[package]]
+name = "html-escape"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476"
+dependencies = [
+ "utf8-width",
+]
+
+[[package]]
+name = "icu"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dff5e3018d703f168b00dcefa540a65f1bbc50754ae32f3f5f0e43fe5ee51502"
+dependencies = [
+ "icu_calendar",
+ "icu_casemap",
+ "icu_collator",
+ "icu_collections",
+ "icu_datetime",
+ "icu_decimal",
+ "icu_experimental",
+ "icu_list",
+ "icu_locid",
+ "icu_locid_transform",
+ "icu_normalizer",
+ "icu_plurals",
+ "icu_properties",
+ "icu_provider",
+ "icu_segmenter",
+ "icu_timezone",
+]
+
+[[package]]
+name = "icu_calendar"
+version = "1.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7265b2137f9a36f7634a308d91f984574bbdba8cfd95ceffe1c345552275a8ff"
+dependencies = [
+ "calendrical_calculations",
+ "displaydoc",
+ "icu_calendar_data",
+ "icu_locid",
+ "icu_locid_transform",
+ "icu_provider",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_calendar_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "820499e77e852162190608b4f444e7b4552619150eafc39a9e39333d9efae9e1"
+
+[[package]]
+name = "icu_casemap"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ff0c8ae9f8d31b12e27fc385ff9ab1f3cd9b17417c665c49e4ec958c37da75f"
+dependencies = [
+ "displaydoc",
+ "icu_casemap_data",
+ "icu_collections",
+ "icu_locid",
+ "icu_properties",
+ "icu_provider",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_casemap_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02bd9f6276270c85a5cd54611adbbf94e993ec464a2a86a452a6c565b7ded5d9"
+
+[[package]]
+name = "icu_collator"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d370371887d31d56f361c3eaa15743e54f13bc677059c9191c77e099ed6966b2"
+dependencies = [
+ "displaydoc",
+ "icu_collator_data",
+ "icu_collections",
+ "icu_locid_transform",
+ "icu_normalizer",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "utf16_iter",
+ "utf8_iter",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_collator_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b353986d77d28991eca4dea5ef2b8982f639342ae19ca81edc44f048bc38ebb"
+
+[[package]]
+name = "icu_collections"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_datetime"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d115efb85e08df3fd77e77f52e7e087545a783fffba8be80bfa2102f306b1780"
+dependencies = [
+ "displaydoc",
+ "either",
+ "fixed_decimal",
+ "icu_calendar",
+ "icu_datetime_data",
+ "icu_decimal",
+ "icu_locid",
+ "icu_locid_transform",
+ "icu_plurals",
+ "icu_provider",
+ "icu_timezone",
+ "smallvec",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_datetime_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef5f04076123cab1b7a926a7083db27fe0d7a0e575adb984854aae3f3a6507d"
+
+[[package]]
+name = "icu_decimal"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb8fd98f86ec0448d85e1edf8884e4e318bb2e121bd733ec929a05c0a5e8b0eb"
+dependencies = [
+ "displaydoc",
+ "fixed_decimal",
+ "icu_decimal_data",
+ "icu_locid_transform",
+ "icu_provider",
+ "writeable",
+]
+
+[[package]]
+name = "icu_decimal_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67c95dd97f5ccf6d837a9c115496ec7d36646fa86ca18e7f1412115b4c820ae2"
+
+[[package]]
+name = "icu_experimental"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "844ad7b682a165c758065d694bc4d74ac67f176da1c499a04d85d492c0f193b7"
+dependencies = [
+ "displaydoc",
+ "fixed_decimal",
+ "icu_collections",
+ "icu_decimal",
+ "icu_experimental_data",
+ "icu_locid",
+ "icu_locid_transform",
+ "icu_normalizer",
+ "icu_pattern",
+ "icu_plurals",
+ "icu_properties",
+ "icu_provider",
+ "litemap",
+ "num-bigint",
+ "num-rational",
+ "num-traits",
+ "smallvec",
+ "tinystr",
+ "writeable",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_experimental_data"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121df92eafb8f5286d4e8ff401c1e7db8384377f806db3f8db77b91e5b7bd4dd"
+
+[[package]]
+name = "icu_list"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbfeda1d7775b6548edd4e8b7562304a559a91ed56ab56e18961a053f367c365"
+dependencies = [
+ "displaydoc",
+ "icu_list_data",
+ "icu_locid_transform",
+ "icu_provider",
+ "regex-automata 0.2.0",
+ "writeable",
+]
+
+[[package]]
+name = "icu_list_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52b1a7fbdbf3958f1be8354cb59ac73f165b7b7082d447ff2090355c9a069120"
+
+[[package]]
+name = "icu_locid"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
+dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_locid_transform_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d"
+
+[[package]]
+name = "icu_normalizer"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "utf16_iter",
+ "utf8_iter",
+ "write16",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7"
+
+[[package]]
+name = "icu_pattern"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb7f36aafd098d6717de34e668a8120822275c1fba22b936e757b7de8a2fd7e4"
+dependencies = [
+ "displaydoc",
+ "either",
+ "writeable",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "icu_plurals"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba5a70e7c025dbd5c501b0a5c188cd11666a424f0dadcd4f0a95b7dafde3b114"
+dependencies = [
+ "displaydoc",
+ "fixed_decimal",
+ "icu_locid_transform",
+ "icu_plurals_data",
+ "icu_provider",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_plurals_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a483403238cb7d6a876a77a5f8191780336d80fe7b8b00bfdeb20be6abbfd112"
+
+[[package]]
+name = "icu_properties"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_locid_transform",
+ "icu_properties_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2"
+
+[[package]]
+name = "icu_provider"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
+dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_provider_macros",
+ "stable_deref_trait",
+ "tinystr",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_provider_macros"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "icu_segmenter"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a717725612346ffc2d7b42c94b820db6908048f39434504cb130e8b46256b0de"
+dependencies = [
+ "core_maths",
+ "displaydoc",
+ "icu_collections",
+ "icu_locid",
+ "icu_provider",
+ "icu_segmenter_data",
+ "utf8_iter",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_segmenter_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1e52775179941363cc594e49ce99284d13d6948928d8e72c755f55e98caa1eb"
+
+[[package]]
+name = "icu_timezone"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa91ba6a585939a020c787235daa8aee856d9bceebd6355e283c0c310bc6de96"
+dependencies = [
+ "displaydoc",
+ "icu_calendar",
+ "icu_provider",
+ "icu_timezone_data",
+ "tinystr",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_timezone_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1adcf7b613a268af025bc2a2532b4b9ee294e6051c5c0832d8bff20ac0232e68"
+
+[[package]]
+name = "id-arena"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
+
+[[package]]
+name = "image"
+version = "0.25.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a"
+dependencies = [
+ "bytemuck",
+ "byteorder-lite",
+ "color_quant",
+ "exr",
+ "gif",
+ "image-webp",
+ "moxcms",
+ "num-traits",
+ "png",
+ "qoi",
+ "ravif",
+ "rayon",
+ "rgb",
+ "tiff",
+ "zune-core 0.5.1",
+ "zune-jpeg 0.5.13",
+]
+
+[[package]]
+name = "image-webp"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
+dependencies = [
+ "byteorder-lite",
+ "quick-error",
+]
+
+[[package]]
+name = "imageproc"
+version = "0.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2393fb7808960751a52e8a154f67e7dd3f8a2ef9bd80d1553078a7b4e8ed3f0d"
+dependencies = [
+ "ab_glyph",
+ "approx",
+ "getrandom 0.2.17",
+ "image",
+ "itertools 0.12.1",
+ "nalgebra 0.32.6",
+ "num",
+ "rand 0.8.5",
+ "rand_distr",
+ "rayon",
+]
+
+[[package]]
+name = "imgref"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8"
+
+[[package]]
+name = "indexmap"
+version = "2.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.16.1",
+ "serde",
+ "serde_core",
+]
+
+[[package]]
+name = "interpolate_name"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "itertools"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itertools"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
+
+[[package]]
+name = "jobserver"
+version = "0.1.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
+dependencies = [
+ "getrandom 0.3.4",
+ "libc",
+]
+
+[[package]]
+name = "js-sys"
+version = "0.3.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c"
+dependencies = [
+ "once_cell",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "kamadak-exif"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1130d80c7374efad55a117d715a3af9368f0fa7a2c54573afc15a188cd984837"
+dependencies = [
+ "mutate_once",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "leb128fmt"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
+
+[[package]]
+name = "lebe"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
+
+[[package]]
+name = "libc"
+version = "0.2.181"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5"
+
+[[package]]
+name = "libfuzzer-sys"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d"
+dependencies = [
+ "arbitrary",
+ "cc",
+]
+
+[[package]]
+name = "libheic-rs"
+version = "0.1.5"
+source = "git+https://github.com/laurens-pilot/libheic-rs.git?tag=v0.1.5#18307d94c72c13eb9526655b748c333722ee145b"
+dependencies = [
+ "brotli",
+ "flate2",
+ "heic-decoder",
+ "image",
+ "libc",
+ "png",
+ "rav1d",
+ "scuffle-h265",
+]
+
+[[package]]
+name = "libloading"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
+dependencies = [
+ "cfg-if",
+ "windows-link",
+]
+
+[[package]]
+name = "libm"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
+
+[[package]]
+name = "link-cplusplus"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
+
+[[package]]
+name = "litemap"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
+
+[[package]]
+name = "litrs"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
+
+[[package]]
+name = "lock_api"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
+dependencies = [
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
+
+[[package]]
+name = "loop9"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"
+dependencies = [
+ "imgref",
+]
+
+[[package]]
+name = "matrixmultiply"
+version = "0.3.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
+dependencies = [
+ "autocfg",
+ "rawpointer",
+]
+
+[[package]]
+name = "maybe-rayon"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
+dependencies = [
+ "cfg-if",
+ "rayon",
+]
+
+[[package]]
+name = "memchr"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
+dependencies = [
+ "adler2",
+ "simd-adler32",
+]
+
+[[package]]
+name = "moxcms"
+version = "0.7.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac9557c559cd6fc9867e122e20d2cbefc9ca29d80d027a8e39310920ed2f0a97"
+dependencies = [
+ "num-traits",
+ "pxfm",
+]
+
+[[package]]
+name = "mutate_once"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13d2233c9842d08cfe13f9eac96e207ca6a2ea10b80259ebe8ad0268be27d2af"
+
+[[package]]
+name = "nalgebra"
+version = "0.32.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4"
+dependencies = [
+ "approx",
+ "matrixmultiply",
+ "num-complex",
+ "num-rational",
+ "num-traits",
+ "simba 0.8.1",
+ "typenum",
+]
+
+[[package]]
+name = "nalgebra"
+version = "0.33.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26aecdf64b707efd1310e3544d709c5c0ac61c13756046aaaba41be5c4f66a3b"
+dependencies = [
+ "approx",
+ "matrixmultiply",
+ "nalgebra-macros",
+ "num-complex",
+ "num-rational",
+ "num-traits",
+ "simba 0.9.1",
+ "typenum",
+]
+
+[[package]]
+name = "nalgebra-macros"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "nasm-rs"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "706bf8a5e8c8ddb99128c3291d31bd21f4bcde17f0f4c20ec678d85c74faa149"
+dependencies = [
+ "jobserver",
+ "log",
+]
+
+[[package]]
+name = "ndarray"
+version = "0.15.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
+dependencies = [
+ "matrixmultiply",
+ "num-complex",
+ "num-integer",
+ "num-traits",
+ "rawpointer",
+]
+
+[[package]]
+name = "ndarray"
+version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
+dependencies = [
+ "matrixmultiply",
+ "num-complex",
+ "num-integer",
+ "num-traits",
+ "portable-atomic",
+ "portable-atomic-util",
+ "rawpointer",
+]
+
+[[package]]
+name = "new_debug_unreachable"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+
+[[package]]
+name = "nom"
+version = "8.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "noop_proc_macro"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
+
+[[package]]
+name = "num"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
+dependencies = [
+ "num-bigint",
+ "num-complex",
+ "num-integer",
+ "num-iter",
+ "num-rational",
+ "num-traits",
+]
+
+[[package]]
+name = "num-bigint"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
+dependencies = [
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-complex"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-derive"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "num-integer"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-iter"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
+dependencies = [
+ "num-bigint",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
+dependencies = [
+ "autocfg",
+ "libm",
+]
+
+[[package]]
+name = "nutype-enum"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1e13adea6de269faa0724df58f43f6fe2a81af7094f1dcb8b5b968eb2103cb3"
+dependencies = [
+ "scuffle-workspace-hack",
+]
+
+[[package]]
+name = "oem_cp"
+version = "2.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c7959d3349f484aec36462f98226983578bf7d33f9b034c32967489c7000e1f"
+dependencies = [
+ "phf",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+
+[[package]]
+name = "ort"
+version = "2.0.0-rc.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86d83095ae3c1258738d70ae7a06195c94d966a8e546f0d3609dc90885fb61f5"
+dependencies = [
+ "half",
+ "js-sys",
+ "libloading",
+ "ndarray 0.15.6",
+ "ort-sys",
+ "thiserror 1.0.69",
+ "tracing",
+ "web-sys",
+]
+
+[[package]]
+name = "ort-sys"
+version = "2.0.0-rc.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f2f6427193c808010b126bef45ebd33f8dee43770223a1200f84d3734d6c656"
+dependencies = [
+ "pkg-config",
+]
+
+[[package]]
+name = "owned_ttf_parser"
+version = "0.25.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b"
+dependencies = [
+ "ttf-parser",
+]
+
+[[package]]
+name = "parking_lot"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-link",
+]
+
+[[package]]
+name = "paste"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
+
+[[package]]
+name = "pastey"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
+
+[[package]]
+name = "phf"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
+dependencies = [
+ "phf_shared",
+]
+
+[[package]]
+name = "phf_shared"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
+dependencies = [
+ "siphasher",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
+
+[[package]]
+name = "pkg-config"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
+
+[[package]]
+name = "plsfix"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47e129828817e1defb60118a50ba214ea20f04d90cde20463494155e3915cf7b"
+dependencies = [
+ "encoding",
+ "encoding_rs",
+ "fancy-regex",
+ "html-escape",
+ "icu",
+ "lazy_static",
+ "oem_cp",
+ "regex",
+ "rustc-hash",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "png"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
+dependencies = [
+ "bitflags",
+ "crc32fast",
+ "fdeflate",
+ "flate2",
+ "miniz_oxide",
+]
+
+[[package]]
+name = "portable-atomic"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
+
+[[package]]
+name = "portable-atomic-util"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "091397be61a01d4be58e7841595bd4bfedb15f1cd54977d79b8271e94ed799a3"
+dependencies = [
+ "portable-atomic",
+]
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
+dependencies = [
+ "zerocopy 0.8.42",
+]
+
+[[package]]
+name = "prettyplease"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.106"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "profiling"
+version = "1.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
+dependencies = [
+ "profiling-procmacros",
+]
+
+[[package]]
+name = "profiling-procmacros"
+version = "1.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b"
+dependencies = [
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "pxfm"
+version = "0.1.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5a041e753da8b807c9255f28de81879c78c876392ff2469cde94799b2896b9d"
+
+[[package]]
+name = "qoi"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
+dependencies = [
+ "bytemuck",
+]
+
+[[package]]
+name = "quick-error"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
+
+[[package]]
+name = "quick-xml"
+version = "0.37.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha 0.3.1",
+ "rand_core 0.6.4",
+]
+
+[[package]]
+name = "rand"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
+dependencies = [
+ "rand_chacha 0.9.0",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.6.4",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom 0.2.17",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
+dependencies = [
+ "getrandom 0.3.4",
+]
+
+[[package]]
+name = "rand_distr"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31"
+dependencies = [
+ "num-traits",
+ "rand 0.8.5",
+]
+
+[[package]]
+name = "rav1d"
+version = "1.1.0"
+source = "git+https://github.com/laurens-pilot/libheic-rs.git?tag=v0.1.5#18307d94c72c13eb9526655b748c333722ee145b"
+dependencies = [
+ "assert_matches",
+ "atomig",
+ "bitflags",
+ "cc",
+ "cfg-if",
+ "libc",
+ "nasm-rs",
+ "parking_lot",
+ "paste",
+ "raw-cpuid",
+ "strum",
+ "to_method",
+ "zerocopy 0.7.35",
+]
+
+[[package]]
+name = "rav1e"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"
+dependencies = [
+ "aligned-vec",
+ "arbitrary",
+ "arg_enum_proc_macro",
+ "arrayvec",
+ "av-scenechange",
+ "av1-grain",
+ "bitstream-io",
+ "built",
+ "cfg-if",
+ "interpolate_name",
+ "itertools 0.14.0",
+ "libc",
+ "libfuzzer-sys",
+ "log",
+ "maybe-rayon",
+ "new_debug_unreachable",
+ "noop_proc_macro",
+ "num-derive",
+ "num-traits",
+ "paste",
+ "profiling",
+ "rand 0.9.2",
+ "rand_chacha 0.9.0",
+ "simd_helpers",
+ "thiserror 2.0.18",
+ "v_frame",
+ "wasm-bindgen",
+]
[[package]]
-name = "bitflags"
-version = "2.10.0"
+name = "ravif"
+version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
+checksum = "ef69c1990ceef18a116855938e74793a5f7496ee907562bd0857b6ac734ab285"
+dependencies = [
+ "avif-serialize",
+ "imgref",
+ "loop9",
+ "quick-error",
+ "rav1e",
+ "rayon",
+ "rgb",
+]
[[package]]
-name = "cfg-if"
-version = "1.0.4"
+name = "raw-cpuid"
+version = "11.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186"
+dependencies = [
+ "bitflags",
+]
[[package]]
-name = "ente_media_inspector"
-version = "0.1.0"
+name = "rawpointer"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
+
+[[package]]
+name = "rayon"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
dependencies = [
- "quick-xml",
- "tempfile",
+ "either",
+ "rayon-core",
]
[[package]]
-name = "equivalent"
-version = "1.0.2"
+name = "rayon-core"
+version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
+dependencies = [
+ "crossbeam-deque",
+ "crossbeam-utils",
+]
[[package]]
-name = "errno"
-version = "0.3.14"
+name = "redox_syscall"
+version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "regex"
+version = "1.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata 0.4.14",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9368763f5a9b804326f3af749e16f9abf378d227bcdee7634b13d8f17793782"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
+
+[[package]]
+name = "rgb"
+version = "0.8.53"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+
+[[package]]
+name = "rustix"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
dependencies = [
+ "bitflags",
+ "errno",
"libc",
+ "linux-raw-sys",
"windows-sys",
]
[[package]]
-name = "fastrand"
-version = "2.3.0"
+name = "rustversion"
+version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
-name = "foldhash"
+name = "safe_arch"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323"
+dependencies = [
+ "bytemuck",
+]
+
+[[package]]
+name = "safe_unaligned_simd"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9c874fb993656d484725d58fbfddb39dfcf98ebcadc1a1d09568aa6b39bafba"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "scratch"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2"
+
+[[package]]
+name = "scuffle-bytes-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
+checksum = "0417748c2a42f4a08d4e634b68b1d64f22a8c24bef2e7ac93df33aa61202a45b"
+dependencies = [
+ "byteorder",
+ "bytes",
+ "bytestring",
+ "scuffle-workspace-hack",
+]
[[package]]
-name = "getrandom"
-version = "0.4.1"
+name = "scuffle-expgolomb"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
+checksum = "48d21330974c941e4c0aedc1e7255ea809e8cbac51e135209f6d67843ad1b94d"
dependencies = [
- "cfg-if",
- "libc",
- "r-efi",
- "wasip2",
- "wasip3",
+ "scuffle-bytes-util",
+ "scuffle-workspace-hack",
]
[[package]]
-name = "hashbrown"
-version = "0.15.5"
+name = "scuffle-h265"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
+checksum = "b04b276c2f79846b7968abe6f87cedf951e06fd2a2b72d99c457e85d7e40f3fb"
dependencies = [
- "foldhash",
+ "bitflags",
+ "byteorder",
+ "bytes",
+ "nutype-enum",
+ "scuffle-bytes-util",
+ "scuffle-expgolomb",
+ "scuffle-workspace-hack",
]
[[package]]
-name = "hashbrown"
-version = "0.16.1"
+name = "scuffle-workspace-hack"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
+checksum = "8028ded836a0d9fabdfa4d713389b76a2098b5153f50a135c8faed7e3a3d5ae2"
[[package]]
-name = "heck"
-version = "0.5.0"
+name = "semver"
+version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
[[package]]
-name = "id-arena"
-version = "2.3.0"
+name = "serde"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
[[package]]
-name = "indexmap"
-version = "2.13.0"
+name = "serde_core"
+version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
- "equivalent",
- "hashbrown 0.16.1",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.149"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
+dependencies = [
+ "itoa",
+ "memchr",
"serde",
"serde_core",
+ "zmij",
]
[[package]]
-name = "itoa"
-version = "1.0.17"
+name = "shlex"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
-name = "leb128fmt"
+name = "simba"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae"
+dependencies = [
+ "approx",
+ "num-complex",
+ "num-traits",
+ "paste",
+ "wide",
+]
+
+[[package]]
+name = "simba"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c99284beb21666094ba2b75bbceda012e610f5479dfcc2d6e2426f53197ffd95"
+dependencies = [
+ "approx",
+ "num-complex",
+ "num-traits",
+ "paste",
+ "wide",
+]
+
+[[package]]
+name = "simd-adler32"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
+
+[[package]]
+name = "simd_helpers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
+checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
+dependencies = [
+ "quote",
+]
[[package]]
-name = "libc"
-version = "0.2.181"
+name = "siphasher"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5"
+checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
[[package]]
-name = "linux-raw-sys"
-version = "0.11.0"
+name = "smallvec"
+version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
-name = "log"
-version = "0.4.29"
+name = "stable_deref_trait"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
-name = "memchr"
-version = "2.8.0"
+name = "strsim"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
-name = "once_cell"
-version = "1.21.3"
+name = "strum"
+version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
+dependencies = [
+ "strum_macros",
+]
[[package]]
-name = "prettyplease"
-version = "0.2.37"
+name = "strum_macros"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "rustversion",
+ "syn",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "synstructure"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1"
+dependencies = [
+ "fastrand",
+ "getrandom 0.4.1",
+ "once_cell",
+ "rustix",
+ "windows-sys",
+]
+
+[[package]]
+name = "termcolor"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "thiserror"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
+dependencies = [
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
+dependencies = [
+ "thiserror-impl 2.0.18",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
+ "quote",
"syn",
]
[[package]]
-name = "proc-macro2"
-version = "1.0.106"
+name = "thiserror-impl"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
- "unicode-ident",
+ "proc-macro2",
+ "quote",
+ "syn",
]
[[package]]
-name = "quick-xml"
-version = "0.37.5"
+name = "tiff"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
+checksum = "af9605de7fee8d9551863fd692cce7637f548dbd9db9180fcc07ccc6d26c336f"
dependencies = [
- "memchr",
+ "fax",
+ "flate2",
+ "half",
+ "quick-error",
+ "weezl",
+ "zune-jpeg 0.4.21",
]
[[package]]
-name = "quote"
-version = "1.0.44"
+name = "tinystr"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
+checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
dependencies = [
- "proc-macro2",
+ "displaydoc",
+ "zerovec",
]
[[package]]
-name = "r-efi"
-version = "5.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
-
-[[package]]
-name = "rustix"
-version = "1.1.3"
+name = "tinyvec"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
+checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
dependencies = [
- "bitflags",
- "errno",
- "libc",
- "linux-raw-sys",
- "windows-sys",
+ "tinyvec_macros",
]
[[package]]
-name = "semver"
-version = "1.0.27"
+name = "tinyvec_macros"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
-name = "serde"
-version = "1.0.228"
+name = "to_method"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
-dependencies = [
- "serde_core",
-]
+checksum = "c7c4ceeeca15c8384bbc3e011dbd8fccb7f068a440b752b7d9b32ceb0ca0e2e8"
[[package]]
-name = "serde_core"
-version = "1.0.228"
+name = "tracing"
+version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
- "serde_derive",
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
]
[[package]]
-name = "serde_derive"
-version = "1.0.228"
+name = "tracing-attributes"
+version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
@@ -242,41 +2652,25 @@ dependencies = [
]
[[package]]
-name = "serde_json"
-version = "1.0.149"
+name = "tracing-core"
+version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
- "itoa",
- "memchr",
- "serde",
- "serde_core",
- "zmij",
+ "once_cell",
]
[[package]]
-name = "syn"
-version = "2.0.114"
+name = "ttf-parser"
+version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
+checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
[[package]]
-name = "tempfile"
-version = "3.25.0"
+name = "typenum"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1"
-dependencies = [
- "fastrand",
- "getrandom",
- "once_cell",
- "rustix",
- "windows-sys",
-]
+checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
[[package]]
name = "unicode-ident"
@@ -284,12 +2678,72 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e"
+[[package]]
+name = "unicode-normalization"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "unicode-width"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
+
[[package]]
name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+[[package]]
+name = "usearch"
+version = "2.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2cc9fc5f872a3a4f9081d5f42624d788231b763e1846c829b9968a3755ac884d"
+dependencies = [
+ "cxx",
+ "cxx-build",
+]
+
+[[package]]
+name = "utf16_iter"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
+
+[[package]]
+name = "utf8-width"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1292c0d970b54115d14f2492fe0170adf21d68a1de108eebc51c1df4f346a091"
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
+[[package]]
+name = "v_frame"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"
+dependencies = [
+ "aligned-vec",
+ "num-traits",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
[[package]]
name = "wasip2"
version = "1.0.2+wasi-0.2.9"
@@ -308,6 +2762,51 @@ dependencies = [
"wit-bindgen",
]
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+ "rustversion",
+ "wasm-bindgen-macro",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3"
+dependencies = [
+ "bumpalo",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16"
+dependencies = [
+ "unicode-ident",
+]
+
[[package]]
name = "wasm-encoder"
version = "0.244.0"
@@ -342,6 +2841,47 @@ dependencies = [
"semver",
]
+[[package]]
+name = "web-sys"
+version = "0.3.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "weezl"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
+
+[[package]]
+name = "whereat"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ec598a1ade4224cfe3c5dace0d5d7deec9ed670503ff99d4946973c8c094534"
+
+[[package]]
+name = "wide"
+version = "0.7.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03"
+dependencies = [
+ "bytemuck",
+ "safe_arch",
+]
+
+[[package]]
+name = "winapi-util"
+version = "0.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
+dependencies = [
+ "windows-sys",
+]
+
[[package]]
name = "windows-link"
version = "0.2.1"
@@ -445,8 +2985,187 @@ dependencies = [
"wasmparser",
]
+[[package]]
+name = "write16"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
+
+[[package]]
+name = "writeable"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "y4m"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
+
+[[package]]
+name = "yoke"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
+dependencies = [
+ "serde",
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.7.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
+dependencies = [
+ "byteorder",
+ "zerocopy-derive 0.7.35",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.8.42"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3"
+dependencies = [
+ "zerocopy-derive 0.8.42",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.7.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.8.42"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
+[[package]]
+name = "zerotrie"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb594dd55d87335c5f60177cee24f19457a5ec10a065e0a3014722ad252d0a1f"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "zmij"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4de98dfa5d5b7fef4ee834d0073d560c9ca7b6c46a71d058c48db7960f8cfaf7"
+
+[[package]]
+name = "zune-core"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
+
+[[package]]
+name = "zune-core"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"
+
+[[package]]
+name = "zune-inflate"
+version = "0.2.54"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
+dependencies = [
+ "simd-adler32",
+]
+
+[[package]]
+name = "zune-jpeg"
+version = "0.4.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713"
+dependencies = [
+ "zune-core 0.4.12",
+]
+
+[[package]]
+name = "zune-jpeg"
+version = "0.5.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec5f41c76397b7da451efd19915684f727d7e1d516384ca6bd0ec43ec94de23c"
+dependencies = [
+ "zune-core 0.5.1",
+]
diff --git a/rust/photos/Cargo.toml b/rust/photos/Cargo.toml
index 77c9276e44..ea3042bfa6 100644
--- a/rust/photos/Cargo.toml
+++ b/rust/photos/Cargo.toml
@@ -5,6 +5,45 @@ edition = "2024"
[dependencies]
quick-xml = "0.37"
+usearch = "2.21.3"
+fast_image_resize = { version = "5.5.0", features = ["image", "rayon"] }
+image = { version = "0.25.5", default-features = true }
+imageproc = "0.25.0"
+kamadak-exif = "0.6.1"
+libheic-rs = { git = "https://github.com/laurens-pilot/libheic-rs.git", tag = "v0.1.5", features = [
+ "image-integration",
+] }
+tiff = "0.10.3"
+nalgebra = "0.33.2"
+ndarray = "0.16.1"
+half = "2.1"
+once_cell = "1.20.2"
+regex = "1.11.1"
+html-escape = "0.2.13"
+plsfix = "0.1.8"
+thiserror = "2.0.11"
+
+[target.'cfg(target_os = "ios")'.dependencies]
+ort = { version = "=2.0.0-rc.4", default-features = false, features = [
+ "ndarray",
+ "half",
+ # Temporarily disabled to avoid iOS duplicate ObjC class collisions
+ # when both Dart ONNXRuntime and Rust ONNXRuntime are linked.
+ # Re-enable once we move to a single shared ORT runtime.
+ # "coreml",
+ "xnnpack",
+] }
+
+[target.'cfg(not(target_os = "ios"))'.dependencies]
+ort = { version = "=2.0.0-rc.4", default-features = false, features = [
+ "ndarray",
+ "half",
+ "load-dynamic",
+ "copy-dylibs",
+ "coreml",
+ "nnapi",
+ "xnnpack",
+] }
[dev-dependencies]
tempfile = "3.12"
diff --git a/mobile/apps/photos/rust/src/image/decode.rs b/rust/photos/src/image/decode.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/image/decode.rs
rename to rust/photos/src/image/decode.rs
diff --git a/mobile/apps/photos/rust/src/image/image_compression.rs b/rust/photos/src/image/image_compression.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/image/image_compression.rs
rename to rust/photos/src/image/image_compression.rs
diff --git a/mobile/apps/photos/rust/src/image/mod.rs b/rust/photos/src/image/mod.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/image/mod.rs
rename to rust/photos/src/image/mod.rs
diff --git a/rust/photos/src/lib.rs b/rust/photos/src/lib.rs
index 06b9587222..90038e3a77 100644
--- a/rust/photos/src/lib.rs
+++ b/rust/photos/src/lib.rs
@@ -1,3 +1,7 @@
+pub mod image;
+pub mod ml;
+pub mod vector_db;
+
use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use std::fs;
diff --git a/mobile/apps/photos/rust/src/ml/clip/image.rs b/rust/photos/src/ml/clip/image.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/clip/image.rs
rename to rust/photos/src/ml/clip/image.rs
diff --git a/mobile/apps/photos/rust/src/ml/clip/mod.rs b/rust/photos/src/ml/clip/mod.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/clip/mod.rs
rename to rust/photos/src/ml/clip/mod.rs
diff --git a/mobile/apps/photos/rust/src/ml/clip/text.rs b/rust/photos/src/ml/clip/text.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/clip/text.rs
rename to rust/photos/src/ml/clip/text.rs
diff --git a/mobile/apps/photos/rust/src/ml/clip/tokenizer.rs b/rust/photos/src/ml/clip/tokenizer.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/clip/tokenizer.rs
rename to rust/photos/src/ml/clip/tokenizer.rs
diff --git a/mobile/apps/photos/rust/src/ml/error.rs b/rust/photos/src/ml/error.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/error.rs
rename to rust/photos/src/ml/error.rs
diff --git a/mobile/apps/photos/rust/src/ml/face/align.rs b/rust/photos/src/ml/face/align.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/face/align.rs
rename to rust/photos/src/ml/face/align.rs
diff --git a/mobile/apps/photos/rust/src/ml/face/detect.rs b/rust/photos/src/ml/face/detect.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/face/detect.rs
rename to rust/photos/src/ml/face/detect.rs
diff --git a/mobile/apps/photos/rust/src/ml/face/embed.rs b/rust/photos/src/ml/face/embed.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/face/embed.rs
rename to rust/photos/src/ml/face/embed.rs
diff --git a/mobile/apps/photos/rust/src/ml/face/mod.rs b/rust/photos/src/ml/face/mod.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/face/mod.rs
rename to rust/photos/src/ml/face/mod.rs
diff --git a/mobile/apps/photos/rust/src/ml/face/thumbnail.rs b/rust/photos/src/ml/face/thumbnail.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/face/thumbnail.rs
rename to rust/photos/src/ml/face/thumbnail.rs
diff --git a/rust/photos/src/ml/indexing.rs b/rust/photos/src/ml/indexing.rs
new file mode 100644
index 0000000000..86689f80c9
--- /dev/null
+++ b/rust/photos/src/ml/indexing.rs
@@ -0,0 +1,238 @@
+use crate::{
+ image::decode::decode_image_from_path,
+ ml::{
+ clip::{
+ image::run_clip_image, text::run_clip_text_query,
+ tokenizer::tokenize_clip_text as tokenize_clip_text_impl,
+ },
+ error::{MlError, MlResult},
+ face::{align::run_face_alignment, detect::run_face_detection, embed::run_face_embedding},
+ pet::{
+ align::run_pet_face_alignment,
+ detect::{run_pet_body_detection, run_pet_face_detection},
+ embed::{run_pet_body_embedding, run_pet_face_embedding},
+ },
+ runtime::{self, ExecutionProviderPolicy, MlRuntimeConfig, ModelPaths},
+ types::{self, ClipResult, Dimensions, FaceResult, PetBodyResult, PetFaceResult},
+ },
+};
+
+#[derive(Clone, Debug)]
+pub struct AnalyzeImageRequest {
+ pub file_id: i64,
+ pub image_path: String,
+ pub run_faces: bool,
+ pub run_clip: bool,
+ pub run_pets: bool,
+ pub runtime_config: MlRuntimeConfig,
+}
+
+#[derive(Clone, Debug)]
+pub struct AnalyzeImageResult {
+ pub file_id: i64,
+ pub decoded_image_size: Dimensions,
+ pub faces: Option<Vec<FaceResult>>,
+ pub clip: Option<ClipResult>,
+ pub pet_faces: Option<Vec<PetFaceResult>>,
+ pub pet_bodies: Option<Vec<PetBodyResult>>,
+}
+
+#[derive(Clone, Debug)]
+pub struct RunClipTextRequest {
+ pub text: String,
+ pub model_path: String,
+ pub vocab_path: String,
+ pub provider_policy: ExecutionProviderPolicy,
+}
+
+#[derive(Clone, Debug)]
+pub struct RunClipTextResult {
+ pub embedding: Vec<f32>,
+}
+
+pub fn init_ml_runtime(config: MlRuntimeConfig) -> MlResult<()> {
+ runtime::prepare_runtime(&config)
+}
+
+pub fn release_ml_runtime() -> MlResult<()> {
+ runtime::release_runtime()
+}
+
+pub fn analyze_image(req: AnalyzeImageRequest) -> MlResult<AnalyzeImageResult> {
+ validate_request_model_paths(&req)?;
+
+ let AnalyzeImageRequest {
+ file_id,
+ image_path,
+ run_faces,
+ run_clip,
+ run_pets,
+ runtime_config,
+ } = req;
+
+ runtime::with_runtime(&runtime_config, |runtime| {
+ let decoded = decode_image_from_path(&image_path)?;
+ let dims = decoded.dimensions.clone();
+
+ let faces = if run_faces {
+ let detections = run_face_detection(runtime, &decoded)?;
+ if detections.is_empty() {
+ Some(Vec::new())
+ } else {
+ let (aligned, mut face_results) =
+ run_face_alignment(file_id, &decoded, detections)?;
+ run_face_embedding(runtime, &aligned, &mut face_results)?;
+ Some(face_results)
+ }
+ } else {
+ None
+ };
+
+ let clip = if run_clip {
+ Some(run_clip_image(runtime, &decoded)?)
+ } else {
+ None
+ };
+
+ let (pet_faces, pet_bodies) = if run_pets {
+ let pet_face_detections = run_pet_face_detection(runtime, &decoded)?;
+ let body_detections = run_pet_body_detection(runtime, &decoded)?;
+
+ let pet_face_results = if !pet_face_detections.is_empty() {
+ let (aligned, mut pet_results) =
+ run_pet_face_alignment(file_id, &decoded, &pet_face_detections)?;
+ run_pet_face_embedding(runtime, &aligned, &mut pet_results)?;
+ pet_results
+ } else {
+ Vec::new()
+ };
+
+ let mut body_results: Vec<PetBodyResult> = body_detections
+ .into_iter()
+ .map(|det| {
+ let base_id = types::to_face_id(file_id, det.box_xyxy);
+ let pet_body_id = format!("{base_id}_c{}", det.coco_class);
+ PetBodyResult {
+ pet_body_id,
+ detection: det,
+ body_embedding: Vec::new(),
+ }
+ })
+ .collect();
+
+ if !body_results.is_empty() {
+ run_pet_body_embedding(runtime, &decoded, &mut body_results)?;
+ }
+
+ (Some(pet_face_results), Some(body_results))
+ } else {
+ (None, None)
+ };
+
+ Ok(AnalyzeImageResult {
+ file_id,
+ decoded_image_size: dims,
+ faces,
+ clip,
+ pet_faces,
+ pet_bodies,
+ })
+ })
+}
+
+pub fn run_clip_text(req: RunClipTextRequest) -> MlResult<RunClipTextResult> {
+ let RunClipTextRequest {
+ text,
+ model_path,
+ vocab_path,
+ provider_policy,
+ } = req;
+
+ if model_path.trim().is_empty() {
+ return Err(MlError::InvalidRequest(
+ "missing model path: clipTextModelPath".to_string(),
+ ));
+ }
+ if vocab_path.trim().is_empty() {
+ return Err(MlError::InvalidRequest(
+ "missing model path: clipTextVocabPath".to_string(),
+ ));
+ }
+
+ let runtime_config = MlRuntimeConfig {
+ model_paths: ModelPaths {
+ face_detection: String::new(),
+ face_embedding: String::new(),
+ clip_image: String::new(),
+ clip_text: model_path,
+ pet_face_detection: String::new(),
+ pet_face_embedding_dog: String::new(),
+ pet_face_embedding_cat: String::new(),
+ pet_body_detection: String::new(),
+ pet_body_embedding_dog: String::new(),
+ pet_body_embedding_cat: String::new(),
+ },
+ provider_policy,
+ };
+
+ runtime::with_runtime(&runtime_config, |runtime| {
+ let clip = run_clip_text_query(runtime, &text, &vocab_path)?;
+ Ok(RunClipTextResult {
+ embedding: clip.embedding,
+ })
+ })
+}
+
+pub fn tokenize_clip_text(text: &str, vocab_path: &str) -> MlResult<Vec<i32>> {
+ if vocab_path.trim().is_empty() {
+ return Err(MlError::InvalidRequest(
+ "missing model path: clipTextVocabPath".to_string(),
+ ));
+ }
+ tokenize_clip_text_impl(text, vocab_path)
+}
+
+fn validate_request_model_paths(req: &AnalyzeImageRequest) -> MlResult<()> {
+ let model_paths = &req.runtime_config.model_paths;
+
+ let mut missing = Vec::new();
+ if req.run_faces {
+ if model_paths.face_detection.trim().is_empty() {
+ missing.push("faceDetectionModelPath");
+ }
+ if model_paths.face_embedding.trim().is_empty() {
+ missing.push("faceEmbeddingModelPath");
+ }
+ }
+ if req.run_clip && model_paths.clip_image.trim().is_empty() {
+ missing.push("clipImageModelPath");
+ }
+ if req.run_pets {
+ if model_paths.pet_face_detection.trim().is_empty() {
+ missing.push("petFaceDetectionModelPath");
+ }
+ if model_paths.pet_body_detection.trim().is_empty() {
+ missing.push("petBodyDetectionModelPath");
+ }
+ if model_paths.pet_face_embedding_dog.trim().is_empty() {
+ missing.push("petFaceEmbeddingDogModelPath");
+ }
+ if model_paths.pet_face_embedding_cat.trim().is_empty() {
+ missing.push("petFaceEmbeddingCatModelPath");
+ }
+ if model_paths.pet_body_embedding_dog.trim().is_empty() {
+ missing.push("petBodyEmbeddingDogModelPath");
+ }
+ if model_paths.pet_body_embedding_cat.trim().is_empty() {
+ missing.push("petBodyEmbeddingCatModelPath");
+ }
+ }
+ if missing.is_empty() {
+ return Ok(());
+ }
+
+ Err(MlError::InvalidRequest(format!(
+ "missing required model paths: {}",
+ missing.join(", ")
+ )))
+}
diff --git a/mobile/apps/photos/rust/src/ml/mod.rs b/rust/photos/src/ml/mod.rs
similarity index 87%
rename from mobile/apps/photos/rust/src/ml/mod.rs
rename to rust/photos/src/ml/mod.rs
index e3053a649b..a492cbe1ad 100644
--- a/mobile/apps/photos/rust/src/ml/mod.rs
+++ b/rust/photos/src/ml/mod.rs
@@ -1,6 +1,7 @@
pub mod clip;
pub mod error;
pub mod face;
+pub mod indexing;
pub mod onnx;
pub mod pet;
pub mod preprocess;
diff --git a/mobile/apps/photos/rust/src/ml/onnx.rs b/rust/photos/src/ml/onnx.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/onnx.rs
rename to rust/photos/src/ml/onnx.rs
diff --git a/mobile/apps/photos/rust/src/ml/pet/align.rs b/rust/photos/src/ml/pet/align.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/pet/align.rs
rename to rust/photos/src/ml/pet/align.rs
diff --git a/mobile/apps/photos/rust/src/ml/pet/detect.rs b/rust/photos/src/ml/pet/detect.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/pet/detect.rs
rename to rust/photos/src/ml/pet/detect.rs
diff --git a/mobile/apps/photos/rust/src/ml/pet/embed.rs b/rust/photos/src/ml/pet/embed.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/pet/embed.rs
rename to rust/photos/src/ml/pet/embed.rs
diff --git a/mobile/apps/photos/rust/src/ml/pet/mod.rs b/rust/photos/src/ml/pet/mod.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/pet/mod.rs
rename to rust/photos/src/ml/pet/mod.rs
diff --git a/mobile/apps/photos/rust/src/ml/pet/preprocess.rs b/rust/photos/src/ml/pet/preprocess.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/pet/preprocess.rs
rename to rust/photos/src/ml/pet/preprocess.rs
diff --git a/mobile/apps/photos/rust/src/ml/preprocess.rs b/rust/photos/src/ml/preprocess.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/preprocess.rs
rename to rust/photos/src/ml/preprocess.rs
diff --git a/mobile/apps/photos/rust/src/ml/runtime.rs b/rust/photos/src/ml/runtime.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/runtime.rs
rename to rust/photos/src/ml/runtime.rs
diff --git a/mobile/apps/photos/rust/src/ml/types.rs b/rust/photos/src/ml/types.rs
similarity index 100%
rename from mobile/apps/photos/rust/src/ml/types.rs
rename to rust/photos/src/ml/types.rs
diff --git a/rust/photos/src/vector_db.rs b/rust/photos/src/vector_db.rs
new file mode 100644
index 0000000000..b3447875c5
--- /dev/null
+++ b/rust/photos/src/vector_db.rs
@@ -0,0 +1,487 @@
+use std::collections::HashSet;
+use std::path::PathBuf;
+use std::sync::atomic::{AtomicU64, Ordering};
+
+use usearch::{Index, IndexOptions, MetricKind, ScalarKind};
+
+const FAST_SEARCH_STEP_COUNTS: [usize; 5] = [200, 500, 2000, 5000, 10000];
+static INDEX_SAVE_TEMP_COUNTER: AtomicU64 = AtomicU64::new(0);
+
+type SearchMatch = (Vec<u64>, Vec<f32>);
+type BulkSearchMatch = (Vec<Vec<u64>>, Vec<Vec<f32>>);
+type BulkSearchByKeyMatch = (Vec<u64>, Vec<Vec<u64>>, Vec<Vec<f32>>);
+
+pub struct VectorDB {
+ index: Index,
+ path: PathBuf,
+}
+
+impl VectorDB {
+ pub fn new(file_path: &str, dimensions: usize) -> Result<Self, String> {
+ let path = PathBuf::from(file_path);
+ let file_exists = path.try_exists().map_err(|e| {
+ format!(
+ "Failed to check index file existence at {}: {e}",
+ path.display()
+ )
+ })?;
+
+ let mut options = IndexOptions::default();
+ options.dimensions = dimensions;
+ options.metric = MetricKind::IP;
+ options.quantization = ScalarKind::F32;
+ options.connectivity = 0; // auto
+ options.expansion_add = 0; // auto
+ options.expansion_search = 0; // auto
+
+ let index = Index::new(&options).map_err(|e| format!("Failed to create index: {e}"))?;
+ index
+ .reserve(1000)
+ .map_err(|e| format!("Failed to reserve space in index: {e}"))?;
+
+ let db = Self { index, path };
+
+ if file_exists {
+ println!("Loading index from disk.");
+ // Must use load() instead of view() because:
+ // - view() creates a read-only memory-mapped view (immutable)
+ // - load() loads the index into RAM for read/write operations (mutable)
+ // Using view() causes "Can't add to an immutable index" error
+ db.index
+ .load(file_path)
+ .map_err(|e| format!("Failed to load index from {file_path}: {e}"))?;
+ } else {
+ println!("Creating new index.");
+ db.save_index()?;
+ }
+ Ok(db)
+ }
+
+ fn save_index(&self) -> Result<(), String> {
+ // Ensure directory exists
+ if let Some(parent) = self.path.parent() {
+ std::fs::create_dir_all(parent).map_err(|e| {
+ format!(
+ "Failed to create index parent directory {}: {e}",
+ parent.display()
+ )
+ })?;
+ }
+
+ // Use atomic write: save to temp file first, then rename
+ // Use a unique temp path per save so concurrent saves can never race
+ // by clobbering the same temporary file.
+ let save_sequence = INDEX_SAVE_TEMP_COUNTER.fetch_add(1, Ordering::Relaxed);
+ let temp_path =
+ self.path
+ .with_extension(format!("tmp.{}.{}", std::process::id(), save_sequence));
+ let temp_path_str = temp_path
+ .to_str()
+ .ok_or_else(|| format!("Invalid temp path: {}", temp_path.display()))?;
+
+ // Save to temporary file
+ self.index.save(temp_path_str).map_err(|e| {
+ let _ = std::fs::remove_file(&temp_path);
+ format!(
+ "Failed to save index to temp file {}: {e}",
+ temp_path.display()
+ )
+ })?;
+
+ // Atomic rename - guaranteed atomic on iOS/Android
+ // This will atomically replace the existing file
+ // The rename ensures we never have a partially written file,
+ // even if the app is suspended or crashes
+ if let Err(e) = std::fs::rename(&temp_path, &self.path) {
+ let _ = std::fs::remove_file(&temp_path);
+ return Err(format!(
+ "Failed to atomically save index (rename {} -> {}): {e}",
+ temp_path.display(),
+ self.path.display()
+ ));
+ }
+
+ println!("Successfully saved index atomically");
+ Ok(())
+ }
+
+ fn ensure_capacity(&self, margin: usize) -> Result<(), String> {
+ let current_size = self.index.size();
+ let capacity = self.index.capacity();
+ if current_size + margin + 1000 >= capacity {
+ self.index
+ .reserve(current_size + margin)
+ .map_err(|e| format!("Failed to reserve space in index: {e}"))?;
+ }
+ Ok(())
+ }
+
+ pub fn add_vector(&mut self, key: u64, vector: &[f32]) -> Result<(), String> {
+ if self.contains_vector(key) {
+ self.index
+ .remove(key)
+ .map_err(|e| format!("Failed to remove existing vector for key {key}: {e}"))?;
+ } else {
+ self.ensure_capacity(1)?;
+ }
+ self.index
+ .add(key, vector)
+ .map_err(|e| format!("Failed to add vector for key {key}: {e}"))?;
+ self.save_index()
+ }
+
+ pub fn bulk_add_vectors(&mut self, keys: Vec<u64>, vectors: &[Vec<f32>]) -> Result<(), String> {
+ self.ensure_capacity(keys.len())?;
+ for (key, vector) in keys.iter().zip(vectors.iter()) {
+ if self.contains_vector(*key) {
+ self.index.remove(*key).map_err(|e| {
+ format!("Failed to remove existing vector for key {key} before bulk add: {e}")
+ })?;
+ }
+ self.index
+ .add(*key, vector)
+ .map_err(|e| format!("Failed to bulk add vector for key {key}: {e}"))?;
+ }
+ self.save_index()
+ }
+
+ pub fn search_vectors(
+ &self,
+ query: &[f32],
+ count: usize,
+ exact: bool,
+ ) -> Result<SearchMatch, String> {
+ let matches = if exact {
+ self.index
+ .exact_search(query, count)
+ .map_err(|e| format!("Failed to exact search vectors: {e}"))?
+ } else {
+ self.index
+ .search(query, count)
+ .map_err(|e| format!("Failed to search vectors: {e}"))?
+ };
+ Ok((matches.keys, matches.distances))
+ }
+
+ pub fn approx_search_vectors_within_similarity(
+ &self,
+ query: &[f32],
+ minimum_similarity: f32,
+ ) -> Result<SearchMatch, String> {
+ let index_size = self.index.size();
+ if index_size == 0 || !minimum_similarity.is_finite() {
+ return Ok((Vec::new(), Vec::new()));
+ }
+
+ let max_distance = 1.0_f32 - minimum_similarity;
+ if !max_distance.is_finite() || max_distance < 0.0 {
+ return Ok((Vec::new(), Vec::new()));
+ }
+
+ self.fast_search_vectors_within_distance(query, max_distance)
+ }
+
+ pub fn approx_filtered_search_vectors_within_distance(
+ &self,
+ query: &[f32],
+ allowed_keys: &[u64],
+ count: usize,
+ max_distance: f32,
+ ) -> Result<SearchMatch, String> {
+ let index_size = self.index.size();
+ if index_size == 0 || count == 0 || allowed_keys.is_empty() {
+ return Ok((Vec::new(), Vec::new()));
+ }
+ if !max_distance.is_finite() || max_distance < 0.0 {
+ return Ok((Vec::new(), Vec::new()));
+ }
+
+ let allowed = allowed_keys.iter().copied().collect::<HashSet<u64>>();
+ let search_count = count.min(allowed.len()).min(index_size);
+ if search_count == 0 {
+ return Ok((Vec::new(), Vec::new()));
+ }
+
+ let matches = self
+ .index
+ .filtered_search(query, search_count, |key| allowed.contains(&key))
+ .map_err(|e| format!("Failed to run filtered vector search: {e}"))?;
+
+ Ok(Self::truncate_sorted_matches_within_distance(
+ matches.keys,
+ matches.distances,
+ max_distance,
+ ))
+ }
+
+ pub fn bulk_approx_filtered_search_vectors_within_distance(
+ &self,
+ queries: &Vec<Vec<f32>>,
+ allowed_keys: &[u64],
+ count: usize,
+ max_distance: f32,
+ ) -> Result<BulkSearchMatch, String> {
+ let query_count = queries.len();
+ if query_count == 0 {
+ return Ok((Vec::new(), Vec::new()));
+ }
+
+ let empty_aligned_results = || {
+ (
+ vec![Vec::<u64>::new(); query_count],
+ vec![Vec::<f32>::new(); query_count],
+ )
+ };
+
+ let index_size = self.index.size();
+ if index_size == 0 || count == 0 || allowed_keys.is_empty() {
+ return Ok(empty_aligned_results());
+ }
+ if !max_distance.is_finite() || max_distance < 0.0 {
+ return Ok(empty_aligned_results());
+ }
+
+ let allowed = allowed_keys.iter().copied().collect::<HashSet<u64>>();
+ let search_count = count.min(allowed.len()).min(index_size);
+ if search_count == 0 {
+ return Ok(empty_aligned_results());
+ }
+
+ let mut all_keys = Vec::with_capacity(query_count);
+ let mut all_distances = Vec::with_capacity(query_count);
+
+ for query in queries {
+ let matches = self
+ .index
+ .filtered_search(query, search_count, |key| allowed.contains(&key))
+ .map_err(|e| format!("Failed to run filtered vector search: {e}"))?;
+
+ let (keys, distances) = Self::truncate_sorted_matches_within_distance(
+ matches.keys,
+ matches.distances,
+ max_distance,
+ );
+ all_keys.push(keys);
+ all_distances.push(distances);
+ }
+
+ Ok((all_keys, all_distances))
+ }
+
+ fn fast_search_vectors_within_distance(
+ &self,
+ query: &[f32],
+ max_distance: f32,
+ ) -> Result<SearchMatch, String> {
+ let index_size = self.index.size();
+ if index_size == 0 {
+ return Ok((Vec::new(), Vec::new()));
+ }
+
+ let mut previous_count = 0_usize;
+ for step_count in FAST_SEARCH_STEP_COUNTS {
+ let count = step_count.min(index_size);
+ if count <= previous_count {
+ continue;
+ }
+ previous_count = count;
+
+ let matches = self
+ .index
+ .search(query, count)
+ .map_err(|e| format!("Failed to search vectors: {e}"))?;
+
+ let should_expand = count < index_size
+ && matches
+ .distances
+ .last()
+ .map(|d| *d <= max_distance)
+ .unwrap_or(false);
+ if should_expand {
+ continue;
+ }
+
+ return Ok(Self::truncate_sorted_matches_within_distance(
+ matches.keys,
+ matches.distances,
+ max_distance,
+ ));
+ }
+
+ if previous_count < index_size {
+ let matches = self
+ .index
+ .search(query, index_size)
+ .map_err(|e| format!("Failed to search vectors: {e}"))?;
+ return Ok(Self::truncate_sorted_matches_within_distance(
+ matches.keys,
+ matches.distances,
+ max_distance,
+ ));
+ }
+
+ Ok((Vec::new(), Vec::new()))
+ }
+
+ fn truncate_sorted_matches_within_distance(
+ mut keys: Vec<u64>,
+ mut distances: Vec<f32>,
+ max_distance: f32,
+ ) -> SearchMatch {
+ let aligned_len = keys.len().min(distances.len());
+ keys.truncate(aligned_len);
+ distances.truncate(aligned_len);
+
+ let keep_len = distances.partition_point(|distance| *distance <= max_distance);
+ keys.truncate(keep_len);
+ distances.truncate(keep_len);
+ (keys, distances)
+ }
+
+ pub fn bulk_search_vectors(
+ &self,
+ queries: &Vec<Vec<f32>>,
+ count: usize,
+ exact: bool,
+ ) -> Result<BulkSearchMatch, String> {
+ let mut keys = Vec::new();
+ let mut distances = Vec::new();
+
+ for query in queries {
+ let (keys_result, distances_result) = self.search_vectors(query, count, exact)?;
+ keys.push(keys_result);
+ distances.push(distances_result);
+ }
+ Ok((keys, distances))
+ }
+
+ pub fn bulk_search_keys(
+ &self,
+ potential_keys: &Vec<u64>,
+ count: usize,
+ exact: bool,
+ ) -> Result<BulkSearchByKeyMatch, String> {
+ let dimensions = self.index.dimensions();
+ let mut embedding_data = vec![0.0f32; potential_keys.len() * dimensions];
+ let mut contained_keys = Vec::with_capacity(potential_keys.len());
+ let mut actual_query_count = 0;
+
+ // Fill embeddings directly into flat storage using slices
+ for key in potential_keys {
+ if self.index.contains(*key) {
+ let start_idx = actual_query_count * dimensions;
+ let end_idx = start_idx + dimensions;
+ let embedding_slice = &mut embedding_data[start_idx..end_idx];
+
+ self.index
+ .get(*key, embedding_slice)
+ .map_err(|e| format!("Failed to get vector for key {key}: {e}"))?;
+ contained_keys.push(*key);
+ actual_query_count += 1;
+ }
+ }
+ embedding_data.truncate(actual_query_count * dimensions);
+
+ let max_result_size = std::cmp::min(self.index.size(), count);
+ let mut closeby_keys = vec![Vec::with_capacity(max_result_size); actual_query_count];
+ let mut distances = vec![Vec::with_capacity(max_result_size); actual_query_count];
+
+ // Search using slices and fill pre-allocated containers
+ for i in 0..actual_query_count {
+ let start_idx = i * dimensions;
+ let end_idx = start_idx + dimensions;
+ let query_slice = &embedding_data[start_idx..end_idx];
+ let (keys_result, distances_result) = self.search_vectors(query_slice, count, exact)?;
+ closeby_keys[i] = keys_result;
+ distances[i] = distances_result;
+ }
+
+ Ok((contained_keys, closeby_keys, distances))
+ }
+
+ /// Check if a vector with the given key exists in the index.
+ /// `true` if the index contains the vector with the given key, `false` otherwise.
+ pub fn contains_vector(&self, key: u64) -> bool {
+ self.index.contains(key)
+ }
+
+ pub fn get_vector(&self, key: u64) -> Result<Vec<f32>, String> {
+ let mut vector: Vec<f32> = vec![0.0; self.index.dimensions()];
+ self.index
+ .get(key, &mut vector)
+ .map_err(|e| format!("Failed to get vector for key {key}: {e}"))?;
+ Ok(vector)
+ }
+
+ pub fn bulk_get_vectors(&self, keys: Vec<u64>) -> Result<Vec<Vec<f32>>, String> {
+ let mut vectors = Vec::new();
+ for key in keys {
+ let vector = self.get_vector(key)?;
+ vectors.push(vector);
+ }
+ Ok(vectors)
+ }
+
+ pub fn remove_vector(&mut self, key: u64) -> Result<usize, String> {
+ let removed_count = self
+ .index
+ .remove(key)
+ .map_err(|e| format!("Failed to remove vector for key {key}: {e}"))?;
+ self.save_index()?;
+ Ok(removed_count)
+ }
+
+ pub fn bulk_remove_vectors(&mut self, keys: Vec<u64>) -> Result<usize, String> {
+ let mut removed_count = 0;
+ for key in keys {
+ removed_count += self
+ .index
+ .remove(key)
+ .map_err(|e| format!("Failed to bulk remove vector for key {key}: {e}"))?;
+ }
+ self.save_index()?;
+ Ok(removed_count)
+ }
+
+ pub fn reset_index(&mut self) -> Result<(), String> {
+ self.index
+ .reset()
+ .map_err(|e| format!("Failed to reset index: {e}"))?;
+ self.index
+ .reserve(1000)
+ .map_err(|e| format!("Failed to reserve space in index after reset: {e}"))?;
+ self.save_index()
+ }
+
+ pub fn delete_index(self) -> Result<(), String> {
+ if self.path.exists() {
+ std::fs::remove_file(&self.path)
+ .map_err(|e| format!("Failed to delete index file {}: {e}", self.path.display()))?;
+ } else {
+ println!("Index file does not exist.");
+ }
+ Ok(())
+ }
+
+ pub fn get_index_stats(&self) -> (usize, usize, usize, usize, usize, usize, usize) {
+ let size = self.index.size();
+ let capacity = self.index.capacity();
+ let dimensions = self.index.dimensions();
+
+ let file_size = self.index.serialized_length();
+ let memory_usage = self.index.memory_usage();
+
+ let expansion_add = self.index.expansion_add();
+ let expansion_search = self.index.expansion_search();
+
+ (
+ size,
+ capacity,
+ dimensions,
+ file_size,
+ memory_usage,
+ expansion_add,
+ expansion_search,
+ )
+ }
+}