fixed various minor warnings with gdcm patches

This commit is contained in:
Antonin Descampe 2006-01-20 16:53:05 +00:00
parent 197b0505cb
commit 6a52f1a9df
7 changed files with 39 additions and 32 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
January 20, 2006
* [Antonin Descampe] fixed various minor warnings with gdcm patches
January 19, 2006
* [Herve Drolon] fixed a bug in jp2_read_ihdr (need to allocate jp2->comps)

View File

@ -245,8 +245,8 @@ opj_image_t* bmptoimage(char *filename, opj_cparameters_t *parameters) {
W = Info_h.biWidth;
H = Info_h.biHeight;
// PAD = 4 - (3 * W) % 4;
// PAD = (PAD == 4) ? 0 : PAD;
/* PAD = 4 - (3 * W) % 4; */
/* PAD = (PAD == 4) ? 0 : PAD; */
PAD = (3 * W) % 4 ? 4 - (3 * W) % 4 : 0;
RGB = (unsigned char *) malloc((3 * W + PAD) * H * sizeof(unsigned char));
@ -483,13 +483,13 @@ int imagetobmp(opj_image_t * image, char *outfile) {
return 1;
}
// w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx);
// wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), image->comps[0].dx);
/* w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx); */
/* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), image->comps[0].dx); */
w = image->comps[0].w;
wr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
// h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy);
// hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy);
/* h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy); */
/* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy); */
h = image->comps[0].h;
hr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
@ -531,11 +531,11 @@ int imagetobmp(opj_image_t * image, char *outfile) {
for (i = 0; i < wr * hr; i++) {
unsigned char R, G, B;
/* a modifier */
// R = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
/* R = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; */
R = image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
// G = image->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
/* G = image->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; */
G = image->comps[1].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
// B = image->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
/* B = image->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; */
B = image->comps[2].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
fprintf(fdest, "%c%c%c", B, G, R);
@ -552,13 +552,13 @@ int imagetobmp(opj_image_t * image, char *outfile) {
<<-- <<-- <<-- <<-- */
fdest = fopen(outfile, "wb");
// w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx);
// wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), image->comps[0].dx);
/* w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx); */
/* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), image->comps[0].dx); */
w = image->comps[0].w;
wr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
// h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy);
// hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy);
/* h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy); */
/* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy); */
h = image->comps[0].h;
hr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
@ -605,7 +605,7 @@ int imagetobmp(opj_image_t * image, char *outfile) {
for (i = 0; i < wr * hr; i++) {
/* a modifier !! */
// fprintf(fdest, "%c", image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]);
/* fprintf(fdest, "%c", image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]); */
fprintf(fdest, "%c", image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]);
/*if (((i + 1) % w == 0 && w % 2))
fprintf(fdest, "%c", 0); */
@ -662,7 +662,7 @@ opj_image_t* pgxtoimage(char *filename, opj_cparameters_t *parameters) {
int w, h, prec;
int i, numcomps, max;
OPJ_COLOR_SPACE color_space;
opj_image_cmptparm_t cmptparm; // maximum of 1 component
opj_image_cmptparm_t cmptparm; /* maximum of 1 component */
opj_image_t * image = NULL;
char endian1,endian2,sign;
@ -797,13 +797,13 @@ int imagetopgx(opj_image_t * image, char *outfile) {
fprintf(stderr, "ERROR -> failed to open %s for writing\n", name);
return 1;
}
// w = int_ceildiv(image->x1 - image->x0, comp->dx);
// wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), comp->dx);
/* w = int_ceildiv(image->x1 - image->x0, comp->dx); */
/* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), comp->dx); */
w = image->comps[compno].w;
wr = int_ceildivpow2(image->comps[compno].w, image->comps[compno].factor);
// h = int_ceildiv(image->y1 - image->y0, comp->dy);
// hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), comp->dy);
/* h = int_ceildiv(image->y1 - image->y0, comp->dy); */
/* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), comp->dy); */
h = image->comps[compno].h;
hr = int_ceildivpow2(image->comps[compno].h, image->comps[compno].factor);
@ -835,7 +835,6 @@ PNM IMAGE FORMAT
<<-- <<-- <<-- <<-- */
opj_image_t* pnmtoimage(char *filename, opj_cparameters_t *parameters) {
int tdy = parameters->cp_tdy;
int subsampling_dx = parameters->subsampling_dx;
int subsampling_dy = parameters->subsampling_dy;
@ -955,7 +954,7 @@ opj_image_t* pnmtoimage(char *filename, opj_cparameters_t *parameters) {
for (i = 0; i < w * h; i++) {
for(compno = 0; compno < numcomps; compno++) {
unsigned int index = 0;
fscanf(f, "%d", &index);
fscanf(f, "%u", &index);
/* compno : 0 = GREY, (0, 1, 2) = (R, G, B) */
image->comps[compno].data[i] = index;
}
@ -1006,12 +1005,12 @@ int imagetopnm(opj_image_t * image, char *outfile) {
}
w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx);
// wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor),image->comps[0].dx);
/* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor),image->comps[0].dx); */
wr = image->comps[0].w;
wrr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy);
// hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy);
/* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy); */
hr = image->comps[0].h;
hrr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
@ -1061,12 +1060,12 @@ int imagetopnm(opj_image_t * image, char *outfile) {
}
w = int_ceildiv(image->x1 - image->x0, image->comps[compno].dx);
// wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor),image->comps[compno].dx);
/* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor),image->comps[compno].dx); */
wr = image->comps[compno].w;
wrr = int_ceildivpow2(image->comps[compno].w, image->comps[compno].factor);
h = int_ceildiv(image->y1 - image->y0, image->comps[compno].dy);
// hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[compno].dy);
/* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[compno].dy); */
hr = image->comps[compno].h;
hrr = int_ceildivpow2(image->comps[compno].h, image->comps[compno].factor);

View File

@ -200,7 +200,7 @@ OPJ_PROG_ORDER give_progression(char progression[4]) {
}
int get_file_format(char *filename) {
int i;
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp", "j2k", "jp2" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, J2K_CFMT, JP2_CFMT };
char * ext = strrchr(filename, '.') + 1;

View File

@ -87,7 +87,7 @@ void decode_help_display() {
/* -------------------------------------------------------------------------- */
int get_file_format(char *filename) {
int i;
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp", "j2k", "jp2", "jpt" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT };
char * ext = strrchr(filename, '.') + 1;
@ -217,6 +217,7 @@ void warning_callback(const char *msg, void *client_data) {
sample debug callback expecting no client object
*/
void info_callback(const char *msg, void *client_data) {
(void)client_data;
fprintf(stdout, "[INFO] %s", msg);
}

View File

@ -577,6 +577,7 @@ void dwt_decode_real(opj_tcd_tilecomp_t * tilec, int stop) {
/* Get gain of 9-7 wavelet transform. */
/* </summary> */
int dwt_getgain_real(int orient) {
(void)orient;
return 0;
}

View File

@ -26,9 +26,9 @@
#include "opj_includes.h"
// ==========================================================
// Utility functions
// ==========================================================
/* ==========================================================
Utility functions
==========================================================*/
#ifndef WIN32
static char*
@ -57,7 +57,7 @@ _itoa(int i, char *a, int r) {
return a;
}
#endif // !WIN32
#endif /* !WIN32 */
/* ----------------------------------------------------------------------- */

View File

@ -42,7 +42,7 @@ Read box headers
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box);
static void jp2_write_url(opj_cio_t *cio, char *Idx_file);
/*static void jp2_write_url(opj_cio_t *cio, char *Idx_file);*/
/**
Read the IHDR box - Image Header box
@param jp2 JP2 handle
@ -125,6 +125,7 @@ static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t
return true;
}
#if 0
static void jp2_write_url(opj_cio_t *cio, char *Idx_file) {
unsigned int i;
opj_jp2_box_t box;
@ -146,6 +147,7 @@ static void jp2_write_url(opj_cio_t *cio, char *Idx_file) {
cio_write(cio, box.length, 4); /* L */
cio_seek(cio, box.init_pos + box.length);
}
#endif
static bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio) {
opj_jp2_box_t box;
@ -682,6 +684,7 @@ void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_
}
bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, char *index) {
(void)image;
/* JP2 encoding */