summaryrefslogtreecommitdiff
path: root/codec/j2k_to_image.c
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2010-12-08 11:06:41 +0000
committerAntonin Descampe <antonin@gmail.com>2010-12-08 11:06:41 +0000
commitd08a96e2517c545b8ff2d7b89c7778eb5b1fd4ba (patch)
tree16f839d4499afc2ead2b759b22907a50bd012de3 /codec/j2k_to_image.c
parent59d9b97ffe35f17c71b25a749b885054cb4727d9 (diff)
(thanks to Winfried for his help)
* [antonin] changed remaining "WIN32" to "_WIN32" ! [antonin] libopenjpeg has no more dependency on LCMS lib. Everything concerning color (icc profile, conversion to rgb, etc) has been put outside libopenjpeg and is used in j2k_to_image.c and mj2_to_frames.c. - [antonin] removed "opj_convert{.c,.h}" + [antonin] added a directory "common/" that contains "getopt{.c,.h}" (previously in "codec/compat"). + [antonin] added files "color{.c,.h}" in "common/" that define the code for icc profile management and sycc_to_rgb conversion + [antonin] added "common/format_defs.h" that contains common definitions used in image_to_j2k, j2k_to_image, j2k_dump.
Diffstat (limited to 'codec/j2k_to_image.c')
-rw-r--r--codec/j2k_to_image.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/codec/j2k_to_image.c b/codec/j2k_to_image.c
index bbf40ad9..ff6141ee 100644
--- a/codec/j2k_to_image.c
+++ b/codec/j2k_to_image.c
@@ -35,38 +35,35 @@
#include <stdlib.h>
#include <math.h>
-#include "opj_config.h"
-#include "openjpeg.h"
-#include "compat/getopt.h"
-#include "convert.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "windirent.h"
#else
#include <dirent.h>
-#endif /* WIN32 */
-#include "index.h"
+#endif /* _WIN32 */
-#ifndef WIN32
+#ifdef _WIN32
+#include <windows.h>
+#else
#include <strings.h>
#define _stricmp strcasecmp
#define _strnicmp strncasecmp
-#endif
+#endif /* _WIN32 */
-/* ----------------------------------------------------------------------- */
+#include "opj_config.h"
+#include "openjpeg.h"
+#include "getopt.h"
+#include "convert.h"
+#include "index.h"
-#define J2K_CFMT 0
-#define JP2_CFMT 1
-#define JPT_CFMT 2
+#ifdef HAVE_LIBLCMS2
+#include <lcms2.h>
+#endif
+#ifdef HAVE_LIBLCMS1
+#include <lcms.h>
+#endif
+#include "color.h"
-#define PXM_DFMT 10
-#define PGX_DFMT 11
-#define BMP_DFMT 12
-#define YUV_DFMT 13
-#define TIF_DFMT 14
-#define RAW_DFMT 15
-#define TGA_DFMT 16
-#define PNG_DFMT 17
-/* ----------------------------------------------------------------------- */
+#include "format_defs.h"
typedef struct dircnt{
/** Buffer for holding images read from Directory*/
@@ -740,6 +737,21 @@ int main(int argc, char **argv) {
free(src);
src = NULL;
+ if(image->color_space == CLRSPC_SYCC)
+ {
+ color_sycc_to_rgb(image);
+ }
+
+ if(image->icc_profile_buf)
+ {
+#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
+ color_apply_icc_profile(image);
+#endif
+
+ free(image->icc_profile_buf);
+ image->icc_profile_buf = NULL; image->icc_profile_len = 0;
+ }
+
/* create output image */
/* ------------------- */
switch (parameters.cod_format) {