#ifndef PHASH_H #define PHASH_H #include #ifdef __cplusplus extern "C" { #endif #define PHASH_SIZE 24 #define PHASH_BITS 105 int phash_from_bytes(const uint8_t* data, int len, char* out_hash, int out_cap); int phash_from_rgba(const uint8_t* rgba, int width, int height, char* out_hash, int out_cap); int phash_from_rgb24x24(const uint8_t* rgb, char* out_hash, int out_cap); int phash_hamming(const char* a, const char* b); typedef struct { const char* id; const char* hash; } phash_entry; typedef struct { const char* id; int distance; } phash_match; int phash_topn(const char* query_hash, const phash_entry* library, int count, phash_match* out, int n); #ifdef __cplusplus } #endif #endif