From abb2a340e298aaaaf7b8d9696aaab168e0baf814 Mon Sep 17 00:00:00 2001 From: James Graham Date: Sun, 23 Apr 2023 09:56:36 +0000 Subject: [PATCH] Document blurhash Add documentation from the blurhash reference implementation to the code. --- src/blurhash.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/blurhash.h b/src/blurhash.h index 1a5e5f673..f41fcaaf1 100644 --- a/src/blurhash.h +++ b/src/blurhash.h @@ -5,6 +5,24 @@ #include +/** + * @brief Returns the pixel array of the result image given the blurhash string. + * + * @param blurhash a string representing the blurhash to be decoded. + * @param width the width of the resulting image. + * @param height the height of the resulting image. + * @param punch the factor to improve the contrast, default = 1. + * @param nChannels the number of channels in the resulting image array, 3 = RGB, 4 = RGBA. + * + * @return A pointer to memory region where pixels are stored in (H, W, C) format. + */ uint8_t *decode(const char *blurhash, int width, int height, int punch, int nChannels); +/** + * @brief Checks if the Blurhash is valid or not. + * + * @param blurhash a string representing the blurhash. + * + * @return A bool (true if it is a valid blurhash, else false). + */ bool isValidBlurhash(const char *blurhash);