nx_phash.nx
buildroot/runtime/nx_phash.nx
about
nx_phash.nx -- perceptual image hashing + reverse-image (bits-up).
module: nishi-core.search.phash
depends: fx.nx, syscalls.nx, nx_simhash.nx (reuse 64-bit Hamming)
capability: CORE_COMPUTE
wired_status: FULLY_WIRED
genealogy_id: krawetz_2011_looks_like_it (aHash/dHash) + zauner_2010_phash
WHY (operator: Yandex-style "find this image across our crawl", done our way):
a deterministic visual fingerprint so the crawler can dedup/cluster images
and answer reverse-image queries. dHash is the research-backed best-ROI
choice -- it encodes the RELATIVE order of adjacent pixels, so it is
invariant to uniform brightness/contrast and robust to recompression/resize,
yet needs no DCT (pure integer downscale + compares). Distance reuses the
SimHash Hamming kernel; "find this image" = nearest fingerprint. Pixels come
from the existing JPEG decoder + nx_image; the input here is a grayscale
buffer so the hasher stays format-agnostic.
dependencies 3 imports · 21 importers
diagram shows first 10 each side; +0 more imports, +11 more importers in the complete lists below.
imports: fx.nxsyscalls.nxnx_simhash.nx
imported by: nx_archive_media_recovery.nxnx_asset_autotag.nxnx_colordesc_gate.nxnx_image_index.nxnx_image_search.nxnx_image_search_gate.nxnx_img_decode_gate.nxnx_img_to_rgb_gate.nxnx_imgbench.nxnx_imgorient.nxnx_imgquery.nxnx_imgsearch_tier.nxnx_media_exclusion.nxnx_media_exclusion_enforce_gate.nxnx_phash_test.nxnx_recording_gate.nxnx_recovery_guard.nxnx_refbench_lib.nxnx_revimg_crawl.nxnx_revimg_crawl_run.nxnx_visdesc_gate.nx
structs
| none |
consts
| none |
functions
| 26 | func nx_phash_downscale(gray: *u8, w: i64, h: i64, out: *u8, dw: i64, dh: i64) -> i64 |
| 44 | func nx_phash_dhash(gray: *u8, w: i64, h: i64) -> i64 |
| 66 | func nx_phash_ahash(gray: *u8, w: i64, h: i64) -> i64 |
| 83 | func nx_phash_similarity_q16(a: i64, b: i64) -> i64 |
| 90 | func nx_phash_nearest(query: i64, fps: *i64, n: i64, threshold: i64, out_ham: *i64) -> i64 |