You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.6 KiB
60 lines
1.6 KiB
#ifndef HAS_BITMAP_H |
|
#define HAS_BITMAP_H 1 |
|
|
|
/** |
|
* @file |
|
* @brief Functions for work with image bitmaps |
|
*/ |
|
|
|
/** Bits per bitmap side (currently - 16) */ |
|
#define SIMDB_BITMAP_SIDE 16 |
|
/** Total bits in bitmap (currently - 256) */ |
|
#define SIMDB_BITMAP_BITS (SIMDB_BITMAP_SIDE * SIMDB_BITMAP_SIDE) |
|
/** Bitmap size in bytes (currently - 32) */ |
|
#define SIMDB_BITMAP_SIZE (SIMDB_BITMAP_BITS / 8) |
|
|
|
/** placeholders for various bit states */ |
|
#define CHAR_USED '@' /**< bit is 1 */ |
|
#define CHAR_NONE '-' /**< bit is 0 */ |
|
|
|
/** |
|
* @brief Compare two bitmaps |
|
* @param a First bitmap to compare |
|
* @param b Second bitmap to compare |
|
* @returns Integer showing difference between bitmaps in bits (0-256) |
|
*/ |
|
int |
|
simdb_bitmap_compare(const unsigned char *a, |
|
const unsigned char *b); |
|
|
|
/** |
|
* @brief Make difference map of to bitmaps |
|
* @param a First bitmap to compare |
|
* @param b Second bitmap to compare |
|
* @param diff Storage for difference map |
|
* @returns Size of generated map (now is @a BITMAP_SIZE) |
|
*/ |
|
size_t |
|
simdb_bitmap_diffmap(const unsigned char *a, |
|
const unsigned char *b, |
|
unsigned char *diff); |
|
|
|
|
|
/** |
|
* @brief Unpack BITmap to BYTEmap |
|
* @param map Source bitmap |
|
* @param buf Pointer to store generated bytemap |
|
* @returns Size of generated bytemap (now is @a BITMAP_BITS) |
|
*/ |
|
size_t |
|
simdb_bitmap_unpack(const unsigned char *map, char **buf); |
|
|
|
/** |
|
* @brief Print bitmap to stdout as ascii-square |
|
* @param map Source bitmap |
|
* @note Height of "square" is equals to BITMAP_SIDE, |
|
* but width is BITMAP_SIDE x 2, for ease of reading |
|
*/ |
|
void |
|
simdb_bitmap_print(const unsigned char *map); |
|
#endif
|
|
|