You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
21
- Fixed buffer reclamation order bug in image preprocessing
22
22
- Fixed `apply_orientation()` unnecessarily cloning entire image - now uses `Cow::Borrowed` to avoid expensive clone when no EXIF orientation transform is needed
23
23
- Fixed SIMD CPU extension detection being performed on every `Preprocessor::new()` call - now cached globally using `OnceLock` for better performance
24
+
-**Fixed DCT-II implementation** in PHash: Added proper twiddle factors for mathematically correct DCT-II computation
25
+
-**Fixed duplicate thread-local contexts**: Both `fingerprint()` and `fingerprint_with()` now share a single module-level TLS slot instead of creating separate ones
26
+
-**Fixed unsafe memory operations**: Replaced `unsafe { set_len() }` with safe `resize()` in preprocessing buffers
27
+
-**Fixed EXIF orientation handling**: Now reads EXIF orientation from raw bytes before decoding and applies transformations (rotate/flip) to decoded image
28
+
-**Fixed similarity algorithm consistency**: `MultiHashFingerprint::compare()` now includes block-level similarity (60% weight) for consistent crop resistance with single-algorithm mode
29
+
-**Fixed error handling in DCT**: Changed `unwrap()` to proper `Result` propagation in `dct2_32()`
24
30
25
31
-**API improvements**:
26
32
- Made `hash_similarity()` and `hamming_distance()` public utilities
27
33
- Added fast-path for exact match in similarity comparison
28
34
- Added compile-time assertions verifying `ImgFprintError` implements `Send + Sync` for safe use in async and multi-threaded contexts
35
+
-**Added model ID support to embeddings**: `Embedding::new_with_model()` allows tagging embeddings with model identifiers to prevent comparing incompatible models
36
+
-**Fixed serde feature gating**: `serde` crate is now properly optional (not compiled unless feature enabled)
**Note:** The library does not include built-in embedding providers. You must implement `EmbeddingProvider` for your use case (OpenAI CLIP, HuggingFace, local models, etc.).
776
782
783
+
#### Model ID Support
784
+
785
+
To prevent accidental comparison of embeddings from different models (e.g., comparing 512-dim CLIP with 768-dim CLIP), you can tag embeddings with a model identifier:
786
+
787
+
```rust
788
+
useimgfprint::Embedding;
789
+
790
+
// Create embedding with model ID
791
+
letembedding=Embedding::new_with_model(
792
+
vec![0.1, 0.2, 0.3, /* ... 512 dimensions */],
793
+
Some("clip-vit-base-patch32".to_string())
794
+
)?;
795
+
796
+
// The model ID is validated during similarity comparison
0 commit comments