summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--codec/convert.c12
-rw-r--r--codec/image_to_j2k.c18
3 files changed, 18 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index ca281130..974fc705 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@ What's New for OpenJPEG
+ : added
July 17, 2007
+* [FOD] Fixed raw option for images with more than three components
+
+July 17, 2007
+ [FOD] Added support for RAW images. This module has been developped by the University of Perugia team. Thanks to them ! [image_to_j2k.c j2k_to_image.c convert.c convert.h]
July 13, 2007
diff --git a/codec/convert.c b/codec/convert.c
index 7ab674b9..1dc2ca66 100644
--- a/codec/convert.c
+++ b/codec/convert.c
@@ -1451,7 +1451,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
FILE *f = NULL;
int i, compno, numcomps, w, h;
OPJ_COLOR_SPACE color_space;
- opj_image_cmptparm_t cmptparm[3]; /* maximum of 3 components */
+ opj_image_cmptparm_t *cmptparm;
opj_image_t * image = NULL;
unsigned short ch;
@@ -1459,8 +1459,8 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
{
fprintf(stderr,"\nError: invalid raw image parameters\n");
fprintf(stderr,"Please use the Format option -F:\n");
- fprintf(stderr,"-F rawWidth x rawHeight x rawComp x rawBitDepth+s/u (Signed/Unsigned)\n");
- fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
+ fprintf(stderr,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
+ fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
fprintf(stderr,"Aborting\n");
return NULL;
}
@@ -1475,11 +1475,11 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
color_space = CLRSPC_SRGB;
w = raw_cp->rawWidth;
h = raw_cp->rawHeight;
-
+ cmptparm = (opj_image_cmptparm_t*) malloc(numcomps * sizeof(opj_image_cmptparm_t));
- /* initialize image components */
+ /* initialize image components */
memset(&cmptparm[0], 0, numcomps * sizeof(opj_image_cmptparm_t));
- for(i = 0; i < numcomps; i++) {
+ for(i = 0; i < numcomps; i++) {
cmptparm[i].prec = raw_cp->rawBitDepth;
cmptparm[i].bpp = raw_cp->rawBitDepth;
cmptparm[i].sgnd = raw_cp->rawSigned;
diff --git a/codec/image_to_j2k.c b/codec/image_to_j2k.c
index e3899593..2e146853 100644
--- a/codec/image_to_j2k.c
+++ b/codec/image_to_j2k.c
@@ -660,28 +660,28 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
{
char signo;
char *s = optarg;
- if (sscanf(s, "%dx%dx%dx%dx%c", &raw_cp->rawWidth, &raw_cp->rawHeight, &raw_cp->rawComp, &raw_cp->rawBitDepth, &signo) == 5) {
+ if (sscanf(s, "%d,%d,%d,%d,%c", &raw_cp->rawWidth, &raw_cp->rawHeight, &raw_cp->rawComp, &raw_cp->rawBitDepth, &signo) == 5) {
if (signo == 's') {
raw_cp->rawSigned = true;
- fprintf(stdout,"\nRaw file parameters: %dx%dx%dx%d Signed\n", raw_cp->rawWidth, raw_cp->rawHeight, raw_cp->rawComp, raw_cp->rawBitDepth);
+ fprintf(stdout,"\nRaw file parameters: %d,%d,%d,%d Signed\n", raw_cp->rawWidth, raw_cp->rawHeight, raw_cp->rawComp, raw_cp->rawBitDepth);
}
else if (signo == 'u') {
raw_cp->rawSigned = false;
- fprintf(stdout,"\nRaw file parameters: %dx%dx%dx%d Unsigned\n", raw_cp->rawWidth, raw_cp->rawHeight, raw_cp->rawComp, raw_cp->rawBitDepth);
+ fprintf(stdout,"\nRaw file parameters: %d,%d,%d,%d Unsigned\n", raw_cp->rawWidth, raw_cp->rawHeight, raw_cp->rawComp, raw_cp->rawBitDepth);
}
else {
fprintf(stderr,"\nError: invalid raw image parameters: Unknown sign of raw file\n");
fprintf(stderr,"Please use the Format option -F:\n");
- fprintf(stderr,"-F rawWidth x rawHeight x rawComp x rawBitDepth+s/u (Signed/Unsigned)\n");
- fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
+ fprintf(stderr,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
+ fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
fprintf(stderr,"Aborting\n");
}
}
else {
fprintf(stderr,"\nError: invalid raw image parameters\n");
fprintf(stderr,"Please use the Format option -F:\n");
- fprintf(stderr,"-F rawWidth x rawHeight x rawComp x rawBitDepth+s/u (Signed/Unsigned)\n");
- fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
+ fprintf(stderr,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
+ fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
fprintf(stderr,"Aborting\n");
return 1;
}
@@ -1385,8 +1385,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
if (parameters->decod_format == RAW_DFMT && raw_cp->rawWidth == 0) {
fprintf(stderr,"\nError: invalid raw image parameters\n");
fprintf(stderr,"Please use the Format option -F:\n");
- fprintf(stderr,"-F rawWidth x rawHeight x rawComp x rawBitDepth+s/u (Signed/Unsigned)\n");
- fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
+ fprintf(stderr,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
+ fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
fprintf(stderr,"Aborting\n");
return 1;
}