Fixed raw option to encode raw images with more than three components.
This commit is contained in:
parent
b7ce19709d
commit
64d72b7bfd
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
July 17, 2007
|
||||||
|
* [FOD] Fixed raw option for images with more than three components
|
||||||
|
|
||||||
July 17, 2007
|
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]
|
+ [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]
|
||||||
|
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
int i, compno, numcomps, w, h;
|
int i, compno, numcomps, w, h;
|
||||||
OPJ_COLOR_SPACE color_space;
|
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;
|
opj_image_t * image = NULL;
|
||||||
unsigned short ch;
|
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,"\nError: invalid raw image parameters\n");
|
||||||
fprintf(stderr,"Please use the Format option -F:\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,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
||||||
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
|
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1475,7 +1475,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
|
||||||
color_space = CLRSPC_SRGB;
|
color_space = CLRSPC_SRGB;
|
||||||
w = raw_cp->rawWidth;
|
w = raw_cp->rawWidth;
|
||||||
h = raw_cp->rawHeight;
|
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));
|
memset(&cmptparm[0], 0, numcomps * sizeof(opj_image_cmptparm_t));
|
||||||
|
|
|
@ -660,28 +660,28 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
{
|
{
|
||||||
char signo;
|
char signo;
|
||||||
char *s = optarg;
|
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') {
|
if (signo == 's') {
|
||||||
raw_cp->rawSigned = true;
|
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') {
|
else if (signo == 'u') {
|
||||||
raw_cp->rawSigned = false;
|
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 {
|
else {
|
||||||
fprintf(stderr,"\nError: invalid raw image parameters: Unknown sign of raw file\n");
|
fprintf(stderr,"\nError: invalid raw image parameters: Unknown sign of raw file\n");
|
||||||
fprintf(stderr,"Please use the Format option -F:\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,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
||||||
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
|
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
||||||
fprintf(stderr,"Please use the Format option -F:\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,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
||||||
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
|
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
return 1;
|
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) {
|
if (parameters->decod_format == RAW_DFMT && raw_cp->rawWidth == 0) {
|
||||||
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
||||||
fprintf(stderr,"Please use the Format option -F:\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,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
||||||
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512x512x3x8xu\n");
|
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue