Fix build issue of JPWL by adding opj_image_data_alloc() and opj_image_data_free...
authorEven Rouault <even.rouault@spatialys.com>
Wed, 16 Aug 2017 15:38:47 +0000 (17:38 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Wed, 16 Aug 2017 15:39:20 +0000 (17:39 +0200)
src/lib/openmj2/openjpeg.c
src/lib/openmj2/openjpeg.h

index ae4bf1e42b506984f9664b4e754b4eb2078b022d..a0cce5da5960719328865539b9c2e32457bd184b 100644 (file)
@@ -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);
+}
index 7861edb52dcea2ef7342f48dac6a53b04dd6d65b..10fccf1ea7046a32d7bb5ea7ae09b4f417afa180 100644 (file)
@@ -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