This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 531a053d11dd12d60ca0a01812a22cf1a0bb1950
Author: Kim Woelders <[email protected]>
AuthorDate: Mon Mar 20 18:48:52 2023 +0100
HEIF loader: Add some debug
---
src/modules/loaders/loader_heif.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/modules/loaders/loader_heif.c b/src/modules/loaders/loader_heif.c
index 4a4742f..264b215 100644
--- a/src/modules/loaders/loader_heif.c
+++ b/src/modules/loaders/loader_heif.c
@@ -7,8 +7,11 @@
#include "config.h"
#include "Imlib2_Loader.h"
+#include <stdbool.h>
#include <libheif/heif.h>
+#define DBG_PFX "LDR-heif"
+
static const char *const _formats[] =
{ "heif", "heifs", "heic", "heics", "avci", "avcs", "avif", "avifs" };
@@ -16,6 +19,22 @@ static const char *const _formats[] =
#define HEIF_8BIT_TO_PIXEL_ARGB(plane, has_alpha) \
PIXEL_ARGB((has_alpha) ? (plane)[3] : 0xff, (plane)[0], (plane)[1], (plane)[2])
+#if IMLIB2_DEBUG
+static bool
+_is_error(const struct heif_error *err)
+{
+ if (err->code == heif_error_Ok)
+ return false;
+
+ D("%s: error=%d:%d: %s\n", "libheif", err->code, err->subcode, err->message);
+
+ return true;
+}
+#define IS_ERROR(err) _is_error(&err)
+#else
+#define IS_ERROR(err) (err.code != heif_error_Ok)
+#endif
+
static int
_load(ImlibImage * im, int load_data)
{
@@ -58,11 +77,11 @@ _load(ImlibImage * im, int load_data)
error = heif_context_read_from_memory_without_copy(ctx, im->fi->fdata,
im->fi->fsize, NULL);
- if (error.code != heif_error_Ok)
+ if (IS_ERROR(error))
goto quit;
error = heif_context_get_primary_image_handle(ctx, &img_handle);
- if (error.code != heif_error_Ok)
+ if (IS_ERROR(error))
goto quit;
rc = LOAD_BADIMAGE; /* Format accepted */
@@ -100,7 +119,7 @@ _load(ImlibImage * im, int load_data)
heif_chroma_interleaved_RGB, decode_opts);
heif_decoding_options_free(decode_opts);
decode_opts = NULL;
- if (error.code != heif_error_Ok)
+ if (IS_ERROR(error))
goto quit;
im->w = heif_image_get_width(img_data, heif_channel_interleaved);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.