Sets the image color space for JP2 format

This commit is contained in:
Francois-Olivier Devaux 2004-07-07 07:34:15 +00:00
parent 3cb27c3912
commit 688a82dfd9
1 changed files with 8 additions and 0 deletions

View File

@ -76,8 +76,10 @@ int bmptoimage(char *filename, j2k_image_t * img, int subsampling_dx,
unsigned char *RGB; unsigned char *RGB;
unsigned char *table_R, *table_G, *table_B; unsigned char *table_R, *table_G, *table_B;
unsigned int j, w, h, PAD, type = 0; unsigned int j, w, h, PAD, type = 0;
int i; int i;
int gray_scale = 1, not_end_file = 1; int gray_scale = 1, not_end_file = 1;
unsigned int line = 0, col = 0; unsigned int line = 0, col = 0;
unsigned char v, v2; unsigned char v, v2;
UINT4 W, H; UINT4 W, H;
@ -185,6 +187,7 @@ int bmptoimage(char *filename, j2k_image_t * img, int subsampling_dx,
1) * 1) *
subsampling_dy + 1; subsampling_dy + 1;
img->numcomps = 3; img->numcomps = 3;
img->color_space = 1;
img->comps = img->comps =
(j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t)); (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) { for (i = 0; i < img->numcomps; i++) {
@ -559,6 +562,7 @@ int pgxtoimage(char *filename, j2k_image_t * img, int tdy,
j2k_comp_t *comp; j2k_comp_t *comp;
img->numcomps = 1; img->numcomps = 1;
img->color_space = 2;
img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t)); img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (compno = 0; compno < img->numcomps; compno++) { for (compno = 0; compno < img->numcomps; compno++) {
FILE *src; FILE *src;
@ -713,6 +717,7 @@ int pnmtoimage(char *filename, j2k_image_t * img, int subsampling_dx,
subsampling_dy + 1; subsampling_dy + 1;
img->numcomps = 1; img->numcomps = 1;
img->color_space = 2;
img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t)); img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t));
img->comps[0].prec = 8; img->comps[0].prec = 8;
img->comps[0].bpp = 8; img->comps[0].bpp = 8;
@ -756,6 +761,7 @@ int pnmtoimage(char *filename, j2k_image_t * img, int subsampling_dx,
subsampling_dy + 1; subsampling_dy + 1;
img->numcomps = 1; img->numcomps = 1;
img->color_space = 2;
img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t)); img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t));
img->comps[0].prec = 8; img->comps[0].prec = 8;
img->comps[0].bpp = 8; img->comps[0].bpp = 8;
@ -797,6 +803,7 @@ int pnmtoimage(char *filename, j2k_image_t * img, int subsampling_dx,
1) * 1) *
subsampling_dy + 1; subsampling_dy + 1;
img->numcomps = 3; img->numcomps = 3;
img->color_space = 1;
img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t)); img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) { for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8; img->comps[i].prec = 8;
@ -859,6 +866,7 @@ int pnmtoimage(char *filename, j2k_image_t * img, int subsampling_dx,
1) * 1) *
subsampling_dy + 1; subsampling_dy + 1;
img->numcomps = 3; img->numcomps = 3;
img->color_space = 1;
img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t)); img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) { for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8; img->comps[i].prec = 8;