Skip to content

1.3.0

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 09 Jan 09:22
473c7d2

Changelog 1.3.0

Added

  • Lazy Grayscale Conversion: The library now caches the grayscale version of an image within the context. If you compute multiple hashes (aHash, dHash, pHash) for the same image, the conversion happens only once, significantly improving performance.
  • Thread-Safe Initialization: Added a global initialization flag for internal lookup tables, ensuring the library is safe to use in multi-threaded environments.

Improved

  • Bilinear Interpolation: Upgraded the image resizing algorithm from basic subsampling to Bilinear Interpolation. This produces much more accurate and "stable" hashes, especially when dealing with slight image modifications.
  • pHash Performance: The Discrete Cosine Transform (DCT) now uses a pre-computed coefficient matrix. This eliminates expensive trigonometric calls (cos, sqrt) during hash computation, making pHash up to 3x faster.

Fixed

  • Memory Management: Fixed a potential issue with stbi_image_free and improved the cleanup process in ph_free to prevent memory leaks when using the new caching system.
  • Edge Cases: Improved bounds checking in the resizing logic to prevent out-of-bounds memory access on specific image dimensions.

PR

  • [1.3.0]: implement lazy-loading, bilinear resizing, and DCT optimization by @gudoshnikovn in #3

Full Changelog: 1.2.0...1.3.0