diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-07-18 09:45:59 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-07-18 09:45:59 +0000 |
| commit | 64d72b7bfdc677ad98570c1ce1f9d35ada7e21c7 (patch) | |
| tree | eeac8606c1c93029c00360377c05f613c9aa127a /codec | |
| parent | b7ce19709df0b304c1c8b0116b617208992b3a32 (diff) | |
Fixed raw option to encode raw images with more than three components.
Diffstat (limited to 'codec')
| -rw-r--r-- | codec/convert.c | 12 | ||||
| -rw-r--r-- | codec/image_to_j2k.c | 18 |
2 files changed, 15 insertions, 15 deletions
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; } |
