-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include a build fix from upstream master. See uclouvain/openjpeg#994
- Loading branch information
Showing
2 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
From 1e387de74273c4dac618df94475556541c1caf3e Mon Sep 17 00:00:00 2001 | ||
From: Even Rouault <[email protected]> | ||
Date: Wed, 16 Aug 2017 17:38:47 +0200 | ||
Subject: [PATCH] Fix build issue of JPWL by adding opj_image_data_alloc() and | ||
opj_image_data_free() to src/lib/openmj2 (#994) | ||
|
||
--- | ||
src/lib/openmj2/openjpeg.c | 15 +++++++++++++++ | ||
src/lib/openmj2/openjpeg.h | 21 +++++++++++++++++++++ | ||
2 files changed, 36 insertions(+) | ||
|
||
diff --git a/src/lib/openmj2/openjpeg.c b/src/lib/openmj2/openjpeg.c | ||
index ae4bf1e42..a0cce5da5 100644 | ||
--- a/src/lib/openmj2/openjpeg.c | ||
+++ b/src/lib/openmj2/openjpeg.c | ||
@@ -372,3 +372,18 @@ void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) | ||
opj_free(cstr_info->numdecompos); | ||
} | ||
} | ||
+ | ||
+void* OPJ_CALLCONV opj_image_data_alloc(size_t size) | ||
+{ | ||
+ /* NOTE: this defers from libopenjp2 where we use opj_aligned_malloc */ | ||
+ void* ret = opj_malloc(size); | ||
+ /* printf("opj_image_data_alloc %p\n", ret); */ | ||
+ return ret; | ||
+} | ||
+ | ||
+void OPJ_CALLCONV opj_image_data_free(void* ptr) | ||
+{ | ||
+ /* NOTE: this defers from libopenjp2 where we use opj_aligned_free */ | ||
+ /* printf("opj_image_data_free %p\n", ptr); */ | ||
+ opj_free(ptr); | ||
+} | ||
diff --git a/src/lib/openmj2/openjpeg.h b/src/lib/openmj2/openjpeg.h | ||
index 7861edb52..10fccf1ea 100644 | ||
--- a/src/lib/openmj2/openjpeg.h | ||
+++ b/src/lib/openmj2/openjpeg.h | ||
@@ -763,6 +763,27 @@ Deallocate any resources associated with an image | ||
*/ | ||
OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image); | ||
|
||
+/** | ||
+ * Allocator for opj_image_t->comps[].data | ||
+ * To be paired with opj_image_data_free. | ||
+ * | ||
+ * @param size number of bytes to allocate | ||
+ * | ||
+ * @return a new pointer if successful, NULL otherwise. | ||
+ * @since 2.2.0 | ||
+*/ | ||
+OPJ_API void* OPJ_CALLCONV opj_image_data_alloc(size_t size); | ||
+ | ||
+/** | ||
+ * Destructor for opj_image_t->comps[].data | ||
+ * To be paired with opj_image_data_alloc. | ||
+ * | ||
+ * @param ptr Pointer to free | ||
+ * | ||
+ * @since 2.2.0 | ||
+*/ | ||
+OPJ_API void OPJ_CALLCONV opj_image_data_free(void* ptr); | ||
+ | ||
/* | ||
========================================================== | ||
stream functions definitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters