code wiki / (root) / nx_phash.nx

nx_phash.nx

buildroot/runtime/nx_phash.nx

3562 B102 linesdepth 5pulls 7 transitivereach 38 importersview sourcekind librarytopic phash
docsdependenciesstructsconstsfunctions

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

fx.nx syscalls.nx nx_simhash.nx nx_phash.nx nx_archive_media_recovery.nx nx_asset_autotag.nx nx_colordesc_gate.nx nx_image_index.nx nx_image_search.nx nx_image_search_gate.nx nx_img_decode_gate.nx nx_img_to_rgb_gate.nx nx_imgbench.nx nx_imgorient.nx

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

26func nx_phash_downscale(gray: *u8, w: i64, h: i64, out: *u8, dw: i64, dh: i64) -> i64
44func nx_phash_dhash(gray: *u8, w: i64, h: i64) -> i64
66func nx_phash_ahash(gray: *u8, w: i64, h: i64) -> i64
83func nx_phash_similarity_q16(a: i64, b: i64) -> i64
called by 1: main calls 2: fx_from_fracnx_simhash_hamming
90func nx_phash_nearest(query: i64, fps: *i64, n: i64, threshold: i64, out_ham: *i64) -> i64
called by 2: mainmain calls 1: nx_simhash_hamming