Skip to content

Releases: gudoshnikovn/python-libphash

v1.4.1

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 19 Apr 09:08
e80e879

Update

  • Update submodule to 1.10.4
  • Increase accuracy

What's Changed

Full Changelog: v1.4.0...v1.4.1

v1.4.0

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 30 Mar 21:00
a48c029

Summary

Major update to v1.4.0, synchronizing the Python bindings with the new libphash v1.10.1 core. This release introduces native WebP support, significantly improved error handling, and a modernized build system using uv.

Key Changes

1. Core Engine Upgrade (libphash v1.10.1)

  • Native WebP Support: Integrated libwebp as a core dependency. Decoding is now handled natively with SIMD acceleration (AVX2/NEON), making WebP decoding up to 2.5x faster than Pillow.
  • Modular Architecture: The C engine has been completely refactored into a modular structure (src/image, src/loaders, src/hashes), improving maintainability and reducing the binary footprint.
  • Mathematical Rigor: Resolved edge-case bugs in DCT (pHash) and HSV color classification. Added dedicated rigor tests to ensure 100% hash stability across platforms.

2. Enhanced Python Integration

  • Smart Exception Mapping: C-level error codes are now automatically translated into descriptive Python exceptions (e.g., DecodeError, InvalidArgumentError) via the new ph_get_error_string() API.
  • Performance Optimizations:
    • Radial Hash: Now 6% faster due to optimized single-precision float math.
    • Memory Management: Implemented automatic scratchpad trimming in the Arena Allocator, preventing memory growth during massive batch processing.
    • Linux I/O: Added madvise hints to accelerate bulk image loading from disk.

3. Performance Benchmarks (v1.4.0 vs imagehash)

Algorithm Format Speedup vs imagehash
pHash JPEG 6.76x
wHash JPEG 50.39x
pHash WebP 2.66x
wHash WebP 17.14x

4. Infrastructure & CI/CD

  • Modern Toolchain: Migrated to uv for lightning-fast dependency management and environment synchronization.
  • Testing: Achieved >95% code coverage with a restructured test suite (26+ comprehensive tests).
  • Regression Tracking: New GitHub Actions workflow monitors performance to ensure no PR degrades hashing speed or quality.

What's Changed

Full Changelog: v1.3.3...v1.4.0

v1.3.3

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 23 Feb 06:11

Summary

Major update synchronizing the Python bindings with libphash v1.9.0. This release focuses on performance (SIMD, zero-copy), production-ready benchmarking, and robust CI/CD infrastructure.

Key Changes

1. Core Engine (libphash v1.9.0)

  • Bundled Decoders: Statically linked libjpeg-turbo, libpng, and spng for zero-dependency runtime.
  • SIMD Acceleration: Enabled NEON (ARM) and SSE/AVX (x86) for image decoding and hashing.
  • Zero-Copy I/O: Switched to mmap-based loading for all formats, significantly reducing memory overhead and FILE* latency.

2. API & Algorithms

  • Algorithm Split: Distinct exposure and documentation for color_hash (HSV-based) and color_moments_hash (statistical digest).
  • Corrected Types: Improved CFFI mapping for Digest types to ensure memory safety.
  • Enhanced Configuration: Full exposure of gamma, gray_weights, and whash modes.

3. Production Benchmarks

  • Unified Suite: Refactored ad-hoc scripts into a structured benchmarks/ package with shared utilities.
  • New Tools: Added generate_data.py, run_speed.py, and run_quality.py with full CLI support.
  • Consistency: Unified data paths under benchmarks/data/{jpeg,png}.

4. Robust Testing

  • Coverage: Expanded to 26 comprehensive tests covering:
    • Thread safety (multi-threaded context access).
    • Parameter tuning consistency.
    • Error handling for corrupt/missing files.
    • Context reuse and reloading.

5. CI/CD & Infrastructure

  • cibuildwheel: Automated build-time dependency injection (cmake, nasm) in pyproject.toml.
  • Project Mapping: Rewritten Gemini.md to serve as a high-level navigation map for the entire architecture.

What's Changed

  • v1.3.0 — libphash v1.9.0 synchronization, production-ready benchmarks, and CI/CD enhancements by @gudoshnikovn in #3

Full Changelog: v1.2.0...v1.3.3

v1.2.0

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 18 Feb 23:10
f1323f5

Added

  • Advanced Configuration API: Extended ImageContext with methods for fine-tuning hashing parameters:

  • set_phash_params: Configures DCT size and reduction factors for pHash.

  • set_radial_params: Controls Radial Hash precision (projections and samples).

  • set_block_params: Adjusts grid resolution for block-based hashes (BMH, mHash).

  • set_gray_weights: Allows custom R, G, B weights for grayscale conversion.

  • Digest Interface: Introduced the Digest class for handling multi-byte hashes (Radial, BMH, Color Hash).

  • Expanded Metrics: Added support for Euclidean distance (L2) calculation in addition to standard Hamming distance within the Digest class.

Improved

  • libphash v1.6.1 Compatibility: Updated bindings to support the latest features and thread-safe context API of the native library.
  • Project Structure: Renamed types.py to ph_types.py to prevent namespace collisions and improve internal organization.
  • Documentation: Updated README.md with comprehensive examples of the new configuration API and extended distance metrics.

Fixed

  • Import Resolution: Fixed all internal import references in __init__.py and utils.py following the types module refactoring.
  • Memory Handling: Improved integration with the native scratchpad to ensure efficient buffer reuse in Python environments.

What's Changed

  • v1.2.0 - Version bump and updated public interfaces by @gudoshnikovn in #2

Full Changelog: v1.1.0...v1.2.0

v1.1.0

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 09 Jan 09:46
3dad795

Release 1.1.0

Changes

  • Updated core engine: Upgraded native libphash to version 1.3.0
  • Improved performance: Significant speed-up in hash calculations due to new lazy-loading grayscale cache and optimized DCT matrix in the C layer.
  • Better accuracy: Switched to Bilinear Interpolation for image resizing, resulting in more stable and precise hashes.

Internal

  • Refreshed Git submodule and rebuilt CFFI bindings to support new internal structures.

PR

Full Changelog: v1.0.3...1.1.0

1.0.3

Choose a tag to compare

@gudoshnikovn gudoshnikovn released this 08 Jan 10:13
v1.0.3

Bump version