]> Creatis software - gdcm.git/blobdiff - src/gdcmopenjpeg/libopenjpeg/image.c
ENH: Try to keep up with the openjpeg build changes
[gdcm.git] / src / gdcmopenjpeg / libopenjpeg / image.c
index bc39016b09376ad8a8f587280c83e0b71584f691..69267eed3cbdbd1d18b45b840a3ac6ace12bdf22 100644 (file)
@@ -1,87 +1,87 @@
-/*\r
- * Copyright (c) 2005, HervĂ© Drolon, FreeImage Team\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- *    notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- *    notice, this list of conditions and the following disclaimer in the\r
- *    documentation and/or other materials provided with the distribution.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'\r
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
- * POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-\r
-#include "opj_includes.h"\r
-\r
-opj_image_t* opj_image_create0() {\r
-  opj_image_t *image = (opj_image_t*)opj_malloc(sizeof(opj_image_t));\r
-  return image;\r
-}\r
-\r
-opj_image_t *opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) {\r
-  int compno;\r
-  opj_image_t *image = NULL;\r
-\r
-  image = (opj_image_t*)opj_malloc(sizeof(opj_image_t));\r
-  if(image) {\r
-    image->color_space = clrspc;\r
-    image->numcomps = numcmpts;\r
-    /* allocate memory for the per-component information */\r
-    image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(opj_image_comp_t));\r
-    if(!image->comps) {\r
-      opj_image_destroy(image);\r
-      return NULL;\r
-    }\r
-    /* create the individual image components */\r
-    for(compno = 0; compno < numcmpts; compno++) {\r
-      opj_image_comp_t *comp = &image->comps[compno];\r
-      comp->dx = cmptparms[compno].dx;\r
-      comp->dy = cmptparms[compno].dy;\r
-      comp->w = cmptparms[compno].w;\r
-      comp->h = cmptparms[compno].h;\r
-      comp->x0 = cmptparms[compno].x0;\r
-      comp->y0 = cmptparms[compno].y0;\r
-      comp->prec = cmptparms[compno].prec;\r
-      comp->bpp = cmptparms[compno].bpp;\r
-      comp->sgnd = cmptparms[compno].sgnd;\r
-      comp->data = (int*)opj_malloc(comp->w * comp->h * sizeof(int));\r
-      if(!comp->data) {\r
-        opj_image_destroy(image);\r
-        return NULL;\r
-      }\r
-    }\r
-  }\r
-\r
-  return image;\r
-}\r
-\r
-void opj_image_destroy(opj_image_t *image) {\r
-  int i;\r
-  if(image) {\r
-    if(image->comps) {\r
-      /* image components */\r
-      for(i = 0; i < image->numcomps; i++) {\r
-        opj_image_comp_t *image_comp = &image->comps[i];\r
-        if(image_comp->data) {\r
-          opj_free(image_comp->data);\r
-        }\r
-      }\r
-      opj_free(image->comps);\r
-    }\r
-    opj_free(image);\r
-  }\r
-}\r
-\r
+/*
+ * Copyright (c) 2005, HervĂ© Drolon, FreeImage Team
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "opj_includes.h"
+
+opj_image_t* opj_image_create0() {
+  opj_image_t *image = (opj_image_t*)opj_malloc(sizeof(opj_image_t));
+  return image;
+}
+
+opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) {
+  int compno;
+  opj_image_t *image = NULL;
+
+  image = (opj_image_t*)opj_malloc(sizeof(opj_image_t));
+  if(image) {
+    image->color_space = clrspc;
+    image->numcomps = numcmpts;
+    /* allocate memory for the per-component information */
+    image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(opj_image_comp_t));
+    if(!image->comps) {
+      opj_image_destroy(image);
+      return NULL;
+    }
+    /* create the individual image components */
+    for(compno = 0; compno < numcmpts; compno++) {
+      opj_image_comp_t *comp = &image->comps[compno];
+      comp->dx = cmptparms[compno].dx;
+      comp->dy = cmptparms[compno].dy;
+      comp->w = cmptparms[compno].w;
+      comp->h = cmptparms[compno].h;
+      comp->x0 = cmptparms[compno].x0;
+      comp->y0 = cmptparms[compno].y0;
+      comp->prec = cmptparms[compno].prec;
+      comp->bpp = cmptparms[compno].bpp;
+      comp->sgnd = cmptparms[compno].sgnd;
+      comp->data = (int*)opj_malloc(comp->w * comp->h * sizeof(int));
+      if(!comp->data) {
+        opj_image_destroy(image);
+        return NULL;
+      }
+    }
+  }
+
+  return image;
+}
+
+void OPJ_CALLCONV opj_image_destroy(opj_image_t *image) {
+  int i;
+  if(image) {
+    if(image->comps) {
+      /* image components */
+      for(i = 0; i < image->numcomps; i++) {
+        opj_image_comp_t *image_comp = &image->comps[i];
+        if(image_comp->data) {
+          opj_free(image_comp->data);
+        }
+      }
+      opj_free(image->comps);
+    }
+    opj_free(image);
+  }
+}
+