defined new type "opj_bool", and new constants OPJ_FALSE and OPJ_TRUE, to avoid having to deal with "stdbool.h" (patch from Winfried)

This commit is contained in:
Antonin Descampe 2011-05-18 11:02:27 +00:00
parent 0c9f6a3ac9
commit 88f43b15fa
26 changed files with 284 additions and 312 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
May 18, 2011
! [antonin] defined new type "opj_bool", and new constants OPJ_FALSE and OPJ_TRUE, to avoid having to deal with "stdbool.h" (patch from Winfried)
May 16, 2011
* [antonin] fixed another bug related to the number of packets in a tile-part, not correctly taken into acccount when generating an index file during decoding.
* [antonin] fixed part of issue 69, when tile-part index is inconsistent with the total number of tile-parts

View File

@ -140,7 +140,7 @@ int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
}
int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
bool flip_image)
opj_bool flip_image)
{
tga_header tga;
@ -173,8 +173,8 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
opj_image_cmptparm_t cmptparm[4]; /* maximum 4 components */
int numcomps;
OPJ_COLOR_SPACE color_space;
bool mono ;
bool save_alpha;
opj_bool mono ;
opj_bool save_alpha;
int subsampling_dx, subsampling_dy;
int i;
@ -282,7 +282,7 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
int imagetotga(opj_image_t * image, const char *outfile) {
int width, height, bpp, x, y;
bool write_alpha;
opj_bool write_alpha;
int i;
unsigned int alpha_channel;
float r,g,b,a;
@ -313,7 +313,7 @@ int imagetotga(opj_image_t * image, const char *outfile) {
// Write TGA header
bpp = write_alpha ? 32 : 24;
if (!tga_writeheader(fdest, bpp, width , height, true))
if (!tga_writeheader(fdest, bpp, width , height, OPJ_TRUE))
return 1;
alpha_channel = image->numcomps-1;

View File

@ -43,7 +43,7 @@ typedef struct raw_cparameters {
/** bit depth of the raw image */
int rawBitDepth;
/** signed/unsigned raw image */
bool rawSigned;
opj_bool rawSigned;
/*@}*/
} raw_cparameters_t;

View File

@ -454,7 +454,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
}
void cinema_parameters(opj_cparameters_t *parameters){
parameters->tile_size_on = false;
parameters->tile_size_on = OPJ_FALSE;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
@ -694,11 +694,11 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
char *s = optarg;
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;
raw_cp->rawSigned = OPJ_TRUE;
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;
raw_cp->rawSigned = OPJ_FALSE;
fprintf(stdout,"\nRaw file parameters: %d,%d,%d,%d Unsigned\n", raw_cp->rawWidth, raw_cp->rawHeight, raw_cp->rawComp, raw_cp->rawBitDepth);
}
else {
@ -791,7 +791,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
case 't': /* tiles */
{
sscanf(optarg, "%d,%d", &parameters->cp_tdx, &parameters->cp_tdy);
parameters->tile_size_on = true;
parameters->tile_size_on = OPJ_TRUE;
}
break;
@ -1363,7 +1363,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
/* some info */
fprintf(stdout, "Info: JPWL capabilities enabled\n");
parameters->jpwl_epc_on = true;
parameters->jpwl_epc_on = OPJ_TRUE;
}
break;
@ -1475,7 +1475,7 @@ void info_callback(const char *msg, void *client_data) {
/* -------------------------------------------------------------------------- */
int main(int argc, char **argv) {
bool bSuccess;
opj_bool bSuccess;
opj_cparameters_t parameters; /* compression parameters */
img_fol_t img_fol;
opj_event_mgr_t event_mgr; /* event manager */

View File

@ -443,7 +443,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
/* next token or bust */
token = strtok(NULL, ",");
};
parameters->jpwl_correct = true;
parameters->jpwl_correct = OPJ_TRUE;
fprintf(stdout, "JPWL correction capability activated\n");
fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps);
}

View File

@ -249,7 +249,7 @@ int main(int argc, char **argv)
FILE *mj2file;
int sampleno;
opj_cinfo_t* cinfo;
bool bSuccess;
opj_bool bSuccess;
int numframes;
int prec = 8;/* DEFAULT */
double total_time = 0;
@ -430,7 +430,7 @@ int main(int argc, char **argv)
/* ----------------------------------------------------- */
case 't': /* tiles */
sscanf(optarg, "%d,%d", &j2k_parameters->cp_tdx, &j2k_parameters->cp_tdy);
j2k_parameters->tile_size_on = true;
j2k_parameters->tile_size_on = OPJ_TRUE;
break;
/* ----------------------------------------------------- */
case 'n': /* resolution */

View File

@ -35,16 +35,6 @@
/** @name Local static functions */
/*@{*/
/**
Read box headers
@param cinfo Codec context info
@param cio Input stream
@param box
@return Returns true if successful, returns false otherwise
*/
/*-- UNUSED
static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box);
--*/
/*
*
* Read box headers
@ -2733,7 +2723,7 @@ opj_dinfo_t* mj2_create_decompress() {
opj_dinfo_t *dinfo = (opj_dinfo_t*) opj_calloc(1, sizeof(opj_dinfo_t));
if(!dinfo) return NULL;
dinfo->is_decompressor = true;
dinfo->is_decompressor = OPJ_TRUE;
mj2 = (opj_mj2_t*) opj_calloc(1, sizeof(opj_mj2_t));
dinfo->mj2_handle = mj2;

View File

@ -362,7 +362,7 @@ Encode an image into a JPEG-2000 file stream
@param index Name of the index file if required, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
bool mj2_encode(opj_mj2_t *movie, opj_cio_t *cio, opj_image_t *image, char *index);
opj_bool mj2_encode(opj_mj2_t *movie, opj_cio_t *cio, opj_image_t *image, char *index);
/**
Init a Standard MJ2 movie

View File

@ -179,7 +179,7 @@ char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters
// -----------------------
bool imagetoyuv(opj_image_t * img, char *outfile)
opj_bool imagetoyuv(opj_image_t * img, char *outfile)
{
FILE *f;
int *data;
@ -191,18 +191,18 @@ bool imagetoyuv(opj_image_t * img, char *outfile)
|| img->comps[1].dx != img->comps[2].dx) {
fprintf(stderr,
"Error with the input image components size: cannot create yuv file)\n");
return false;
return OPJ_FALSE;
}
} else if (!(img->numcomps == 1)) {
fprintf(stderr,
"Error with the number of image components(must be one or three)\n");
return false;
return OPJ_FALSE;
}
f = fopen(outfile, "a+b");
if (!f) {
fprintf(stderr, "failed to open %s for writing\n", outfile);
return false;
return OPJ_FALSE;
}
is_16 = (img->comps[0].prec > 8);
prec_bytes = (is_16?2:1);
@ -262,7 +262,7 @@ bool imagetoyuv(opj_image_t * img, char *outfile)
}
}
fclose(f);
return true;
return OPJ_TRUE;
}
// -----------------------

View File

@ -126,13 +126,13 @@ unsigned char *cio_getbp(opj_cio_t *cio) {
/*
* Write a byte.
*/
bool cio_byteout(opj_cio_t *cio, unsigned char v) {
opj_bool cio_byteout(opj_cio_t *cio, unsigned char v) {
if (cio->bp >= cio->end) {
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
return false;
return OPJ_FALSE;
}
*cio->bp++ = v;
return true;
return OPJ_TRUE;
}
/*

View File

@ -72,7 +72,7 @@ opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_
return NULL;
}
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
opj_msg_callback msg_handler = NULL;
@ -92,10 +92,10 @@ bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
break;
}
if(msg_handler == NULL) {
return false;
return OPJ_FALSE;
}
} else {
return false;
return OPJ_FALSE;
}
if ((fmt != NULL) && (event_mgr != NULL)) {
@ -116,6 +116,6 @@ bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
msg_handler(message, cinfo->client_data);
}
return true;
return OPJ_TRUE;
}

View File

@ -49,7 +49,7 @@ Write formatted data to a string and send the string to a user callback.
@param fmt Format-control string (plus optionnal arguments)
@return Returns true if successful, returns false otherwise
*/
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1496,7 +1496,7 @@ static void j2k_write_eoc(opj_j2k_t *j2k) {
static void j2k_read_eoc(opj_j2k_t *j2k) {
int i, tileno;
bool success;
opj_bool success;
/* if packets should be decoded */
if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
@ -1509,7 +1509,7 @@ static void j2k_read_eoc(opj_j2k_t *j2k) {
opj_free(j2k->tile_data[tileno]);
j2k->tile_data[tileno] = NULL;
tcd_free_decode_tile(tcd, i);
if (success == false) {
if (success == OPJ_FALSE) {
j2k->state |= J2K_STATE_ERR;
break;
}
@ -1764,7 +1764,7 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
if (j2k->cp->correct) {
int orig_pos = cio_tell(cio);
bool status;
opj_bool status;
/* call the corrector */
status = jpwl_correct(j2k);
@ -2040,12 +2040,12 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
int i;
/* set JPWL on */
cp->epc_on = true;
cp->info_on = false; /* no informative technique */
cp->epc_on = OPJ_TRUE;
cp->info_on = OPJ_FALSE; /* no informative technique */
/* set EPB on */
if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {
cp->epb_on = true;
cp->epb_on = OPJ_TRUE;
cp->hprot_MH = parameters->jpwl_hprot_MH;
for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
@ -2066,7 +2066,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
/* set ESD writing */
if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {
cp->esd_on = true;
cp->esd_on = OPJ_TRUE;
cp->sens_size = parameters->jpwl_sens_size;
cp->sens_addr = parameters->jpwl_sens_addr;
@ -2080,10 +2080,10 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
}
/* always set RED writing to false: we are at the encoder */
cp->red_on = false;
cp->red_on = OPJ_FALSE;
} else {
cp->epc_on = false;
cp->epc_on = OPJ_FALSE;
}
#endif /* USE_JPWL */
@ -2215,7 +2215,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
}
}
bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
int tileno, compno;
opj_cp_t *cp = NULL;
@ -2428,7 +2428,7 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
}
#endif /* USE_JPWL */
return true;
return OPJ_TRUE;
}

View File

@ -265,15 +265,15 @@ typedef struct opj_cp {
/* UniPG>> */
#ifdef USE_JPWL
/** enables writing of EPC in MH, thus activating JPWL */
bool epc_on;
opj_bool epc_on;
/** enables writing of EPB, in case of activated JPWL */
bool epb_on;
opj_bool epb_on;
/** enables writing of ESD, in case of activated JPWL */
bool esd_on;
opj_bool esd_on;
/** enables writing of informative techniques of ESD, in case of activated JPWL */
bool info_on;
opj_bool info_on;
/** enables writing of RED, in case of activated JPWL */
bool red_on;
opj_bool red_on;
/** error protection method for MH (0,1,16,32,37-128) */
int hprot_MH;
/** tile number of header protection specification (>=0) */
@ -299,7 +299,7 @@ typedef struct opj_cp {
/** sensitivity methods for TPHs (-1,0-7) */
int sens_TPH[JPWL_MAX_NO_TILESPECS];
/** enables JPWL correction at the decoder */
bool correct;
opj_bool correct;
/** expected number of components at the decoder */
int exp_comps;
/** maximum number of tiles at the decoder */
@ -436,7 +436,7 @@ Encode an image into a JPEG-2000 codestream
@param cstr_info Codestream information structure if required, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -43,7 +43,7 @@ Read box headers
@param box
@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 opj_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);*/
/**
Read the IHDR box - Image Header box
@ -51,10 +51,10 @@ Read the IHDR box - Image Header box
@param cio Input buffer stream
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio);
static opj_bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio);
static void jp2_write_ihdr(opj_jp2_t *jp2, opj_cio_t *cio);
static void jp2_write_bpcc(opj_jp2_t *jp2, opj_cio_t *cio);
static bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio);
static opj_bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio);
static void jp2_write_colr(opj_jp2_t *jp2, opj_cio_t *cio);
/**
Write the FTYP box - File type box
@ -68,9 +68,9 @@ Read the FTYP box - File type box
@param cio Input buffer stream
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio);
static opj_bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio);
static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
static bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset);
static opj_bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset);
static void jp2_write_jp(opj_cio_t *cio);
/**
Read the JP box - JPEG 2000 signature
@ -78,7 +78,7 @@ Read the JP box - JPEG 2000 signature
@param cio Input buffer stream
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_jp(opj_jp2_t *jp2, opj_cio_t *cio);
static opj_bool jp2_read_jp(opj_jp2_t *jp2, opj_cio_t *cio);
/**
Decode the structure of a JP2 file
@param jp2 JP2 handle
@ -86,7 +86,7 @@ Decode the structure of a JP2 file
@param color Collector for profile, cdef and pclr data
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_struct(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_struct(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_color_t *color);
/**
Apply collected palette data
@ -102,7 +102,7 @@ Collect palette data
@param color Collector for profile, cdef and pclr data
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color);
/**
Collect component mapping data
@ -112,7 +112,7 @@ Collect component mapping data
@param color Collector for profile, cdef and pclr data
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_cmap(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_cmap(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color);
/**
Collect colour specification data
@ -122,7 +122,7 @@ Collect colour specification data
@param color Collector for profile, cdef and pclr data
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color);
/*@}*/
@ -130,14 +130,14 @@ static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
/* ----------------------------------------------------------------------- */
static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box) {
static opj_bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box) {
box->init_pos = cio_tell(cio);
box->length = cio_read(cio, 4);
box->type = cio_read(cio, 4);
if (box->length == 1) {
if (cio_read(cio, 4) != 0) {
opj_event_msg(cinfo, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
return false;
return OPJ_FALSE;
}
box->length = cio_read(cio, 4);
if (box->length == 0)
@ -147,7 +147,7 @@ static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t
box->length = cio_numbytesleft(cio) + 8;
}
return true;
return OPJ_TRUE;
}
#if 0
@ -174,7 +174,7 @@ static void jp2_write_url(opj_cio_t *cio, char *Idx_file) {
}
#endif
static bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio) {
static opj_bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio) {
opj_jp2_box_t box;
opj_common_ptr cinfo = jp2->cinfo;
@ -182,7 +182,7 @@ static bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio) {
jp2_read_boxhdr(cinfo, cio, &box);
if (JP2_IHDR != box.type) {
opj_event_msg(cinfo, EVT_ERROR, "Expected IHDR Marker\n");
return false;
return OPJ_FALSE;
}
jp2->h = cio_read(cio, 4); /* HEIGHT */
@ -198,10 +198,10 @@ static bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio) {
if (cio_tell(cio) - box.init_pos != box.length) {
opj_event_msg(cinfo, EVT_ERROR, "Error with IHDR Box\n");
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
static void jp2_write_ihdr(opj_jp2_t *jp2, opj_cio_t *cio) {
@ -246,7 +246,7 @@ static void jp2_write_bpcc(opj_jp2_t *jp2, opj_cio_t *cio) {
}
static bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio) {
static opj_bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio) {
unsigned int i;
opj_jp2_box_t box;
@ -255,7 +255,7 @@ static bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio) {
jp2_read_boxhdr(cinfo, cio, &box);
if (JP2_BPCC != box.type) {
opj_event_msg(cinfo, EVT_ERROR, "Expected BPCC Marker\n");
return false;
return OPJ_FALSE;
}
for (i = 0; i < jp2->numcomps; i++) {
@ -264,10 +264,10 @@ static bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio) {
if (cio_tell(cio) - box.init_pos != box.length) {
opj_event_msg(cinfo, EVT_ERROR, "Error with BPCC Box\n");
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
static void jp2_write_colr(opj_jp2_t *jp2, opj_cio_t *cio) {
@ -389,7 +389,7 @@ static void jp2_apply_pclr(opj_jp2_color_t *color, opj_image_t *image)
}/* apply_pclr() */
static bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color)
{
opj_jp2_pclr_t *jp2_pclr;
@ -402,7 +402,7 @@ static bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio,
/* Part 1, I.5.3.4: 'There shall be at most one Palette box inside
* a JP2 Header box' :
*/
if(color->jp2_pclr) return false;
if(color->jp2_pclr) return OPJ_FALSE;
nr_entries = cio_read(cio, 2); /* NE */
nr_channels = cio_read(cio, 1);/* NPC */
@ -438,22 +438,22 @@ static bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio,
}
}
return true;
return OPJ_TRUE;
}/* jp2_read_pclr() */
static bool jp2_read_cmap(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_cmap(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color)
{
opj_jp2_cmap_comp_t *cmap;
unsigned short i, nr_channels;
/* Need nr_channels: */
if(color->jp2_pclr == NULL) return false;
if(color->jp2_pclr == NULL) return OPJ_FALSE;
/* Part 1, I.5.3.5: 'There shall be at most one Component Mapping box
* inside a JP2 Header box' :
*/
if(color->jp2_pclr->cmap) return false;
if(color->jp2_pclr->cmap) return OPJ_FALSE;
nr_channels = color->jp2_pclr->nr_channels;
cmap = (opj_jp2_cmap_comp_t*)
@ -468,7 +468,7 @@ static bool jp2_read_cmap(opj_jp2_t *jp2, opj_cio_t *cio,
}
color->jp2_pclr->cmap = cmap;
return true;
return OPJ_TRUE;
}/* jp2_read_cmap() */
static void jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
@ -506,7 +506,7 @@ static void jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
}/* jp2_apply_cdef() */
static bool jp2_read_cdef(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_cdef(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color)
{
opj_jp2_cdef_info_t *info;
@ -515,9 +515,9 @@ static bool jp2_read_cdef(opj_jp2_t *jp2, opj_cio_t *cio,
/* Part 1, I.5.3.6: 'The shall be at most one Channel Definition box
* inside a JP2 Header box.'
*/
if(color->jp2_cdef) return false;
if(color->jp2_cdef) return OPJ_FALSE;
if((n = cio_read(cio, 2)) == 0) return false; /* szukw000: FIXME */
if((n = cio_read(cio, 2)) == 0) return OPJ_FALSE; /* szukw000: FIXME */
info = (opj_jp2_cdef_info_t*)
opj_malloc(n * sizeof(opj_jp2_cdef_info_t));
@ -533,10 +533,10 @@ static bool jp2_read_cdef(opj_jp2_t *jp2, opj_cio_t *cio,
info[i].asoc = cio_read(cio, 2);
}
return true;
return OPJ_TRUE;
}/* jp2_read_cdef() */
static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_box_t *box, opj_jp2_color_t *color)
{
int skip_len;
@ -545,7 +545,7 @@ static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
/* Part 1, I.5.3.3 : 'A conforming JP2 reader shall ignore all Colour
* Specification boxes after the first.'
*/
if(color->jp2_has_colr) return false;
if(color->jp2_has_colr) return OPJ_FALSE;
cinfo = jp2->cinfo;
@ -564,7 +564,7 @@ static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
if (skip_len < 0)
{
opj_event_msg(cinfo, EVT_ERROR, "Error with COLR box size\n");
return false;
return OPJ_FALSE;
}
if(skip_len > 0)
{
@ -583,14 +583,14 @@ static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
if (cio_tell(cio) - box->init_pos != box->length)
{
opj_event_msg(cinfo, EVT_ERROR, "Error with COLR Box\n");
return false;
return OPJ_FALSE;
}
color->jp2_has_colr = 1;
return true;
return OPJ_TRUE;
}/* jp2_read_colr() */
bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
{
opj_jp2_box_t box;
int jp2h_end;
@ -605,24 +605,24 @@ bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
if (box.type == JP2_JP2C)
{
opj_event_msg(cinfo, EVT_ERROR, "Expected JP2H Marker\n");
return false;
return OPJ_FALSE;
}
cio_skip(cio, box.length - 8);
if(cio->bp >= cio->end) return false;
if(cio->bp >= cio->end) return OPJ_FALSE;
jp2_read_boxhdr(cinfo, cio, &box);
}
} while(JP2_JP2H != box.type);
if (!jp2_read_ihdr(jp2, cio))
return false;
return OPJ_FALSE;
jp2h_end = box.init_pos + box.length;
if (jp2->bpc == 255)
{
if (!jp2_read_bpcc(jp2, cio))
return false;
return OPJ_FALSE;
}
jp2_read_boxhdr(cinfo, cio, &box);
@ -787,7 +787,7 @@ static void jp2_write_ftyp(opj_jp2_t *jp2, opj_cio_t *cio) {
cio_seek(cio, box.init_pos + box.length);
}
static bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio) {
static opj_bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio) {
int i;
opj_jp2_box_t box;
@ -797,7 +797,7 @@ static bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio) {
if (JP2_FTYP != box.type) {
opj_event_msg(cinfo, EVT_ERROR, "Expected FTYP Marker\n");
return false;
return OPJ_FALSE;
}
jp2->brand = cio_read(cio, 4); /* BR */
@ -811,10 +811,10 @@ static bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio) {
if (cio_tell(cio) - box.init_pos != box.length) {
opj_event_msg(cinfo, EVT_ERROR, "Error with FTYP Box\n");
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
@ -846,7 +846,7 @@ static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, op
return box.length;
}
static bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset) {
static opj_bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset) {
opj_jp2_box_t box;
opj_common_ptr cinfo = jp2->cinfo;
@ -862,7 +862,7 @@ static bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_code
*j2k_codestream_offset = cio_tell(cio);
*j2k_codestream_length = box.length - 8;
return true;
return OPJ_TRUE;
}
static void jp2_write_jp(opj_cio_t *cio) {
@ -879,7 +879,7 @@ static void jp2_write_jp(opj_cio_t *cio) {
cio_seek(cio, box.init_pos + box.length);
}
static bool jp2_read_jp(opj_jp2_t *jp2, opj_cio_t *cio) {
static opj_bool jp2_read_jp(opj_jp2_t *jp2, opj_cio_t *cio) {
opj_jp2_box_t box;
opj_common_ptr cinfo = jp2->cinfo;
@ -887,33 +887,33 @@ static bool jp2_read_jp(opj_jp2_t *jp2, opj_cio_t *cio) {
jp2_read_boxhdr(cinfo, cio, &box);
if (JP2_JP != box.type) {
opj_event_msg(cinfo, EVT_ERROR, "Expected JP Marker\n");
return false;
return OPJ_FALSE;
}
if (0x0d0a870a != cio_read(cio, 4)) {
opj_event_msg(cinfo, EVT_ERROR, "Error with JP Marker\n");
return false;
return OPJ_FALSE;
}
if (cio_tell(cio) - box.init_pos != box.length) {
opj_event_msg(cinfo, EVT_ERROR, "Error with JP Box size\n");
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
static bool jp2_read_struct(opj_jp2_t *jp2, opj_cio_t *cio,
static opj_bool jp2_read_struct(opj_jp2_t *jp2, opj_cio_t *cio,
opj_jp2_color_t *color) {
if (!jp2_read_jp(jp2, cio))
return false;
return OPJ_FALSE;
if (!jp2_read_ftyp(jp2, cio))
return false;
return OPJ_FALSE;
if (!jp2_read_jp2h(jp2, cio, color))
return false;
return OPJ_FALSE;
if (!jp2_read_jp2c(jp2, cio, &jp2->j2k_codestream_length, &jp2->j2k_codestream_offset))
return false;
return OPJ_FALSE;
return true;
return OPJ_TRUE;
}
/* ----------------------------------------------------------------------- */
@ -1065,7 +1065,7 @@ void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_
}
bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
/* JP2 encoding */
@ -1080,10 +1080,10 @@ bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_code
if(!jp2_write_jp2c(jp2, cio, image, cstr_info)) {
opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n");
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}

View File

@ -167,7 +167,7 @@ Read the JP2H box - JP2 Header box (used in MJ2)
@param ext Collector for profile, cdef and pclr data
@return Returns true if successful, returns false otherwise
*/
bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color);
opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color);
/**
Creates a JP2 decompression structure
@param cinfo Codec context info
@ -221,7 +221,7 @@ Encode an image into a JPEG-2000 file stream
@param cstr_info Codestream information structure if required, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -59,7 +59,7 @@ static jpwl_marker_t jwmarker[JPWL_MAX_NO_MARKERS];
@param info_on true if informative techniques are activated
@return returns the freshly created EPC
*/
jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, bool esd_on, bool red_on, bool epb_on, bool info_on);
jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, opj_bool esd_on, opj_bool red_on, opj_bool epb_on, opj_bool info_on);
/*@}*/
@ -207,7 +207,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
j2k->cp->esd_on, /* is ESD present? */
j2k->cp->red_on, /* is RED present? */
j2k->cp->epb_on, /* is EPB present? */
false /* are informative techniques present? */
OPJ_FALSE /* are informative techniques present? */
))) {
/* Add this marker to the 'insertanda' list */
@ -217,10 +217,10 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.1; /* not so first */
jwmarker[jwmarker_num].len = epc_mark->Lepc; /* its length */
jwmarker[jwmarker_num].len_ready = true; /* ready */
jwmarker[jwmarker_num].pos_ready = true; /* ready */
jwmarker[jwmarker_num].parms_ready = false; /* not ready */
jwmarker[jwmarker_num].data_ready = true; /* ready */
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].parms_ready = OPJ_FALSE; /* not ready */
jwmarker[jwmarker_num].data_ready = OPJ_TRUE; /* ready */
jwmarker_num++;
};
@ -262,10 +262,10 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* we choose to place it after SIZ */
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */
jwmarker[jwmarker_num].len_ready = true; /* not ready, yet */
jwmarker[jwmarker_num].pos_ready = true; /* ready */
jwmarker[jwmarker_num].parms_ready = true; /* not ready */
jwmarker[jwmarker_num].data_ready = false; /* not ready */
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* not ready, yet */
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* not ready */
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
jwmarker_num++;
}
@ -357,10 +357,10 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */
jwmarker[jwmarker_num].len_ready = true; /* ready, yet */
jwmarker[jwmarker_num].pos_ready = true; /* ready */
jwmarker[jwmarker_num].parms_ready = true; /* not ready */
jwmarker[jwmarker_num].data_ready = false; /* ready */
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready, yet */
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* not ready */
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* ready */
jwmarker_num++;
}
@ -418,8 +418,8 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
/* Create the EPB */
if ((epb_mark = jpwl_epb_create(
j2k, /* this encoder handle */
true, /* is it the latest? */
true, /* is it packed? not for now */
OPJ_TRUE, /* is it the latest? */
OPJ_TRUE, /* is it packed? not for now */
-1, /* we are in main header */
0, /* its index is 0 (first) */
j2k->cp->hprot_MH, /* protection type parameters of data */
@ -434,10 +434,10 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
jwmarker[jwmarker_num].len_ready = true; /* ready */
jwmarker[jwmarker_num].pos_ready = true; /* ready */
jwmarker[jwmarker_num].parms_ready = true; /* ready */
jwmarker[jwmarker_num].data_ready = false; /* not ready */
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
jwmarker_num++;
}
@ -516,8 +516,8 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
/* Create the EPB */
if ((epb_mark = jpwl_epb_create(
j2k, /* this encoder handle */
false, /* is it the latest? in TPH, no for now (if huge data size in TPH, we'd need more) */
true, /* is it packed? yes for now */
OPJ_FALSE, /* is it the latest? in TPH, no for now (if huge data size in TPH, we'd need more) */
OPJ_TRUE, /* is it packed? yes for now */
tileno, /* we are in TPH */
epb_index++, /* its index is 0 (first) */
hprot, /* protection type parameters of following data */
@ -533,10 +533,10 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
jwmarker[jwmarker_num].len_ready = true; /* ready */
jwmarker[jwmarker_num].pos_ready = true; /* ready */
jwmarker[jwmarker_num].parms_ready = true; /* ready */
jwmarker[jwmarker_num].data_ready = false; /* not ready */
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* ready */
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
jwmarker_num++;
}
@ -614,9 +614,9 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
j2k, /* J2K handle */
jwmarker, /* pointer to JPWL markers list */
&jwmarker_num, /* pointer to the number of current markers */
false, /* latest */
true, /* packed */
false, /* inside MH */
OPJ_FALSE, /* latest */
OPJ_TRUE, /* packed */
OPJ_FALSE, /* inside MH */
&epb_index, /* pointer to EPB index */
pprot, /* protection type */
/****** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001, */ /* position */
@ -674,9 +674,9 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
j2k, /* J2K handle */
jwmarker, /* pointer to JPWL markers list */
&jwmarker_num, /* pointer to the number of current markers */
true, /* latest */
true, /* packed */
false, /* inside MH */
OPJ_TRUE, /* latest */
OPJ_TRUE, /* packed */
OPJ_FALSE, /* inside MH */
&epb_index, /* pointer to EPB index */
pprot, /* protection type */
/***** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001,*/ /* position */
@ -690,7 +690,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
/* we can now check if the TPH EPB was really the last one */
if (tph_epb && (epb_index == 1)) {
/* set the TPH EPB to be the last one in current header */
tph_epb->Depb |= (unsigned char) ((true & 0x0001) << 6);
tph_epb->Depb |= (unsigned char) ((OPJ_TRUE & 0x0001) << 6);
tph_epb = NULL;
}
@ -1018,8 +1018,8 @@ void j2k_read_epb(opj_j2k_t *j2k) {
unsigned short int Lepb;
unsigned char Depb;
char str1[25] = "";
bool status;
static bool first_in_tph = true;
opj_bool status;
static opj_bool first_in_tph = OPJ_TRUE;
int type, pre_len, post_len;
static unsigned char *redund = NULL;
@ -1045,7 +1045,7 @@ void j2k_read_epb(opj_j2k_t *j2k) {
/* we are in TPH */
type = 1; /* TPH */
pre_len = 12; /* SOC+SIZ */
first_in_tph = false;
first_in_tph = OPJ_FALSE;
post_len = -1; /* auto */
} else {
@ -1088,7 +1088,7 @@ void j2k_read_epb(opj_j2k_t *j2k) {
/* last in current header? */
if (Depb & 0x40) {
redund = NULL; /* reset the pointer to L4 buffer */
first_in_tph = true;
first_in_tph = OPJ_TRUE;
}
/* advance to EPB endpoint */
@ -1217,7 +1217,7 @@ void j2k_read_red(opj_j2k_t *j2k) {
cio_skip(cio, Lred - 3);
}
bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
opj_bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
#ifdef oerhgierhgvhreit4u
/*
@ -1273,7 +1273,7 @@ bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
"JPWL: wrong x-cord of block origin %d => x-prec is (%d, %d)\n",
block->x0, prec->x0, prec->x1);
if (!JPWL_ASSUME || JPWL_ASSUME)
return false;
return OPJ_FALSE;
};
}
}
@ -1283,7 +1283,7 @@ bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
#endif
return true;
return OPJ_TRUE;
}
/*@}*/

View File

@ -49,7 +49,7 @@ The functions in JPWL.C have for goal to read/write the markers added by JPWL.
/**
Assume a basic codestream structure, so you can resort better from uncorrected errors
*/
#define JPWL_ASSUME true
#define JPWL_ASSUME OPJ_TRUE
/**
EPB (Error Protection Block) Marker segment
@ -58,9 +58,9 @@ typedef struct jpwl_epb_ms {
/**@name Private fields set by epb_create */
/*@{*/
/** is the latest in header? */
bool latest;
opj_bool latest;
/** is it in packed mode? */
bool packed;
opj_bool packed;
/** TH where this marker has been placed (-1 means MH) */
int tileno;
/** index in current header (0-63) */
@ -100,13 +100,13 @@ EPC (Error Protection Capability) Marker segment
*/
typedef struct jpwl_epc_ms {
/** is ESD active? */
bool esd_on;
opj_bool esd_on;
/** is RED active? */
bool red_on;
opj_bool red_on;
/** is EPB active? */
bool epb_on;
opj_bool epb_on;
/** are informative techniques active? */
bool info_on;
opj_bool info_on;
/**@name Marker segment fields */
/*@{*/
/** two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes) */
@ -196,13 +196,13 @@ typedef struct jpwl_marker {
/** length of the marker segment (marker excluded) */
unsigned short int len;
/** the marker length is ready or not? */
bool len_ready;
opj_bool len_ready;
/** the marker position is ready or not? */
bool pos_ready;
opj_bool pos_ready;
/** the marker parameters are ready or not? */
bool parms_ready;
opj_bool parms_ready;
/** are the written data ready or not */
bool data_ready;
opj_bool data_ready;
} jpwl_marker_t;
/**
@ -280,7 +280,7 @@ void j2k_read_red(opj_j2k_t *j2k);
@param post_len length of post-protected data
@return returns the freshly created EPB
*/
jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int tileno, int idx, int hprot,
jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, opj_bool latest, opj_bool packed, int tileno, int idx, int hprot,
unsigned long int pre_len, unsigned long int post_len);
/** add a number of EPB marker segments
@ -299,7 +299,7 @@ jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int til
@return returns the length of all added markers
*/
int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
bool latest, bool packed, bool insideMH, int *idx, int hprot,
opj_bool latest, opj_bool packed, opj_bool insideMH, int *idx, int hprot,
double place_pos, int tileno,
unsigned long int pre_len, unsigned long int post_len);
@ -327,12 +327,12 @@ int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
@param jwmarker_num number of JPWL markers
@return returns true in case of success
*/
bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num);
opj_bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num);
bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf);
opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf);
bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf);
opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf);
void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
@ -340,7 +340,7 @@ void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, i
@param j2k J2K compressor handle
@return true if correction is performed correctly
*/
bool jpwl_correct(opj_j2k_t *j2k);
opj_bool jpwl_correct(opj_j2k_t *j2k);
/** corrects the data protected by an EPB
@param j2k J2K compressor handle
@ -352,7 +352,7 @@ bool jpwl_correct(opj_j2k_t *j2k);
@param L4_bufp is a pointer to the buffer pointer of redundancy data
@return returns true if correction could be succesfully performed
*/
bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn,
opj_bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn,
unsigned char **L4_bufp);
/** check that a tile and its children have valid data
@ -360,7 +360,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
@param tcd Tile decompressor handle
@param tileno number of the tile to check
*/
bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno);
opj_bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno);
/** Macro functions for CRC computation */

View File

@ -74,7 +74,7 @@ int jpwl_markcomp(const void *arg1, const void *arg2)
}
int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
bool latest, bool packed, bool insideMH, int *idx, int hprot,
opj_bool latest, opj_bool packed, opj_bool insideMH, int *idx, int hprot,
double place_pos, int tileno,
unsigned long int pre_len, unsigned long int post_len) {
@ -154,7 +154,7 @@ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
if ((epb_mark = jpwl_epb_create(
j2k, /* this encoder handle */
latest ? (dL4 < max_postlen) : false, /* is it the latest? */
latest ? (dL4 < max_postlen) : OPJ_FALSE, /* is it the latest? */
packed, /* is it packed? */
tileno, /* we are in TPH */
*idx, /* its index */
@ -170,10 +170,10 @@ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
jwmarker[*jwmarker_num].pos = (int) place_pos; /* after SOT */
jwmarker[*jwmarker_num].dpos = place_pos + 0.0000001 * (double)(*idx); /* not very first! */
jwmarker[*jwmarker_num].len = epb_mark->Lepb; /* its length */
jwmarker[*jwmarker_num].len_ready = true; /* ready */
jwmarker[*jwmarker_num].pos_ready = true; /* ready */
jwmarker[*jwmarker_num].parms_ready = true; /* ready */
jwmarker[*jwmarker_num].data_ready = false; /* not ready */
jwmarker[*jwmarker_num].len_ready = OPJ_TRUE; /* ready */
jwmarker[*jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
jwmarker[*jwmarker_num].parms_ready = OPJ_TRUE; /* ready */
jwmarker[*jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
(*jwmarker_num)++;
}
@ -196,7 +196,7 @@ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
}
jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int tileno, int idx, int hprot,
jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, opj_bool latest, opj_bool packed, int tileno, int idx, int hprot,
unsigned long int pre_len, unsigned long int post_len) {
jpwl_epb_ms_t *epb = NULL;
@ -205,7 +205,7 @@ jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int til
unsigned long int L1, L4;
/*unsigned char *predata_in = NULL;*/
bool insideMH = (tileno == -1);
opj_bool insideMH = (tileno == -1);
/* Alloc space */
if (!(epb = (jpwl_epb_ms_t *) opj_malloc((size_t) 1 * sizeof (jpwl_epb_ms_t)))) {
@ -330,7 +330,7 @@ void jpwl_epb_write(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf) {
};
jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, bool esd_on, bool red_on, bool epb_on, bool info_on) {
jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, opj_bool esd_on, opj_bool red_on, opj_bool epb_on, opj_bool info_on) {
jpwl_epc_ms_t *epc = NULL;
@ -356,7 +356,7 @@ jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, bool esd_on, bool red_on, bool ep
return (epc);
}
bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf, unsigned char *post_buf) {
opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf, unsigned char *post_buf) {
unsigned long int L1, L2, L3, L4;
int remaining;
@ -373,12 +373,12 @@ bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf, unsig
/* some consistency check */
if (!buf) {
opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no operating buffer for EPBs\n");
return false;
return OPJ_FALSE;
}
if (!post_buf && !L4_buf) {
opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no operating buffer for EPBs data\n");
return false;
return OPJ_FALSE;
}
/*
@ -539,15 +539,15 @@ bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf, unsig
}
return true;
return OPJ_TRUE;
}
bool jpwl_correct(opj_j2k_t *j2k) {
opj_bool jpwl_correct(opj_j2k_t *j2k) {
opj_cio_t *cio = j2k->cio;
bool status;
static bool mh_done = false;
opj_bool status;
static opj_bool mh_done = OPJ_FALSE;
int mark_pos, id, len, skips, sot_pos;
unsigned long int Psot = 0;
@ -592,8 +592,8 @@ bool jpwl_correct(opj_j2k_t *j2k) {
if (status && (mark_val == J2K_MS_EPB)) {
/* we found it! */
mh_done = true;
return true;
mh_done = OPJ_TRUE;
return OPJ_TRUE;
}
/* Disable correction in case of missing or bad head EPB */
@ -601,7 +601,7 @@ bool jpwl_correct(opj_j2k_t *j2k) {
/* PATCHED: 2008-01-25 */
/* MOVED UP: 2008-02-01 */
if (!status) {
j2k->cp->correct = false;
j2k->cp->correct = OPJ_FALSE;
opj_event_msg(j2k->cinfo, EVT_WARNING, "Couldn't find the MH EPB: disabling JPWL\n");
}
@ -609,7 +609,7 @@ bool jpwl_correct(opj_j2k_t *j2k) {
}
if (true /*(j2k->state == J2K_STATE_TPHSOT) || (j2k->state == J2K_STATE_TPH)*/) {
if (OPJ_TRUE /*(j2k->state == J2K_STATE_TPHSOT) || (j2k->state == J2K_STATE_TPH)*/) {
/* else, look if 12 positions ahead there is an EPB, in case of TPH */
cio_seek(cio, mark_pos);
if ((cio->bp + 12) < cio->end) {
@ -627,11 +627,11 @@ bool jpwl_correct(opj_j2k_t *j2k) {
);
if (status)
/* we found it! */
return true;
return OPJ_TRUE;
}
}
return false;
return OPJ_FALSE;
/* for now, don't use this code */
@ -652,13 +652,13 @@ bool jpwl_correct(opj_j2k_t *j2k) {
);
if (status)
/* we found it! */
return true;
return OPJ_TRUE;
}
/* nope, no EPBs probably, or they are so damaged that we can give up */
return false;
return OPJ_FALSE;
return true;
return OPJ_TRUE;
/* AN ATTEMPT OF PARSER */
/* NOT USED ACTUALLY */
@ -741,7 +741,7 @@ bool jpwl_correct(opj_j2k_t *j2k) {
}
bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn,
opj_bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn,
unsigned char **L4_bufp) {
/* Operating buffer */
@ -763,14 +763,14 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
unsigned char Depb;
char str1[25] = "";
int myconn, errnum = 0;
bool errflag = false;
opj_bool errflag = OPJ_FALSE;
opj_cio_t *cio = j2k->cio;
/* check for common errors */
if (!buffer) {
opj_event_msg(j2k->cinfo, EVT_ERROR, "The EPB pointer is a NULL buffer\n");
return false;
return OPJ_FALSE;
}
/* set bignesses */
@ -800,13 +800,13 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
case 3:
/* automatic setup */
opj_event_msg(j2k->cinfo, EVT_ERROR, "Auto. setup not yet implemented\n");
return false;
return OPJ_FALSE;
break;
default:
/* unknown type */
opj_event_msg(j2k->cinfo, EVT_ERROR, "Unknown expected EPB type\n");
return false;
return OPJ_FALSE;
break;
}
@ -845,11 +845,11 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
/*if (conn == NULL)
opj_event_msg(j2k->cinfo, EVT_WARNING,
"Possible decoding error in codeword @ position #%d\n", (L1_buf - buffer) / k_pre);*/
errflag = true;
errflag = OPJ_TRUE;
/* we can try to safely get out from the function:
if we are here, either this is not an EPB or the first codeword
is too damaged to be helpful */
/*return false;*/
/*return OPJ_FALSE;*/
} else if (status == 0) {
/*if (conn == NULL)
@ -864,8 +864,8 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
} else {
/*if (conn == NULL)
opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n");
return false;*/
errflag = true;
return OPJ_FALSE;*/
errflag = OPJ_TRUE;
}
@ -901,7 +901,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
(float) errnum / ((float) n_pre * (float) L1 / (float) k_pre));*/
if (errflag) {
/*opj_event_msg(j2k->cinfo, EVT_INFO, "+ there were unrecoverable errors\n");*/
return false;
return OPJ_FALSE;
}
}
@ -960,7 +960,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
printf("connected = %d\n", myconn);*/
/*cio_seek(j2k->cio, orig_pos);
return true;*/
return OPJ_TRUE;*/
/* post-data
the position of L4 buffer is at the end of currently connected EPBs
@ -983,7 +983,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
/* Do a further check here on the read parameters */
if (L4 > (unsigned long) cio_numbytesleft(j2k->cio))
/* overflow */
return false;
return OPJ_FALSE;
/* we are ready for decoding the remaining data */
if (((Pepb & 0xF0000000) >> 28) == 1) {
@ -1009,7 +1009,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
} else {
if (conn == NULL)
opj_event_msg(j2k->cinfo, EVT_WARNING, "- CRC is KO (r=%d, c=%d)\n", filecrc, mycrc);
errflag = true;
errflag = OPJ_TRUE;
}
}
@ -1036,7 +1036,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
} else {
if (conn == NULL)
opj_event_msg(j2k->cinfo, EVT_WARNING, "- CRC is KO (r=%d, c=%d)\n", filecrc, mycrc);
errflag = true;
errflag = OPJ_TRUE;
}
}
@ -1096,7 +1096,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
/*if (conn == NULL)
opj_event_msg(j2k->cinfo, EVT_WARNING,
"Possible decoding error in codeword @ position #%d\n", (L4_buf - (buffer + Lepb + 2)) / k_post);*/
errflag = true;
errflag = OPJ_TRUE;
} else if (status == 0) {
/*if (conn == NULL)
@ -1110,8 +1110,8 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
} else {
/*if (conn == NULL)
opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n");
return false;*/
errflag = true;
return OPJ_FALSE;*/
errflag = OPJ_TRUE;
}
@ -1157,7 +1157,7 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
cio_seek(j2k->cio, orig_pos);
return true;
return OPJ_TRUE;
}
void jpwl_epc_write(opj_j2k_t *j2k, jpwl_epc_ms_t *epc, unsigned char *buf) {
@ -1332,7 +1332,7 @@ jpwl_esd_ms_t *jpwl_esd_create(opj_j2k_t *j2k, int comp, unsigned char addrm, un
return (esd);
}
bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
int i;
unsigned long int vv;
@ -1340,7 +1340,7 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
double dvalue = 0.0, Omax2, tmp, TSE = 0.0, MSE, oldMSE = 0.0, PSNR, oldPSNR = 0.0;
unsigned short int pfpvalue;
unsigned long int addrmask = 0x00000000;
bool doneMH = false, doneTPH = false;
opj_bool doneMH = OPJ_FALSE, doneTPH = OPJ_FALSE;
/* sensitivity values in image info are as follows:
- for each tile, distotile is the starting distortion for that tile, sum of all components
@ -1365,7 +1365,7 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
if (esd->data) {
for (i = 0; i < (int) esd->svalnum; i++)
*(buf++) = esd->data[i];
return true;
return OPJ_TRUE;
}
/* addressing mask */
@ -1445,7 +1445,7 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
addr2 = j2k->cstr_info->main_head_end; /* end of MH */
/* set special dvalue for this MH */
dvalue = -10.0;
doneMH = true; /* don't come here anymore */
doneMH = OPJ_TRUE; /* don't come here anymore */
vv--; /* wrap back loop counter */
} else if (!doneTPH) {
@ -1454,12 +1454,12 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
addr2 = j2k->cstr_info->tile[thistile].end_header;
/* set special dvalue for this TPH */
dvalue = -1.0;
doneTPH = true; /* don't come here till the next tile */
doneTPH = OPJ_TRUE; /* don't come here till the next tile */
vv--; /* wrap back loop counter */
}
} else
doneTPH = false; /* reset TPH counter */
doneTPH = OPJ_FALSE; /* reset TPH counter */
/* write the addresses to the buffer */
switch (esd->ad_size) {
@ -1577,7 +1577,7 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
}
return true;
return OPJ_TRUE;
}
void jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
@ -1681,7 +1681,7 @@ double jpwl_pfp_to_double(unsigned short int em, int bytes) {
}
bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num) {
opj_bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num) {
int mm;
unsigned long int addlen;
@ -1691,7 +1691,7 @@ bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num)
if (!j2k || !jwmarker ) {
opj_event_msg(j2k->cinfo, EVT_ERROR, "J2K handle or JPWL markers list badly allocated\n");
return false;
return OPJ_FALSE;
}
/* main_head_end: how many markers are there before? */
@ -1790,7 +1790,7 @@ bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num)
/* reorder the markers list */
return true;
return OPJ_TRUE;
}
#endif /* USE_JPWL */

View File

@ -61,7 +61,7 @@ const char* OPJ_CALLCONV opj_version(void) {
opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(1, sizeof(opj_dinfo_t));
if(!dinfo) return NULL;
dinfo->is_decompressor = true;
dinfo->is_decompressor = OPJ_TRUE;
switch(format) {
case CODEC_J2K:
case CODEC_JPT:
@ -123,7 +123,7 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
parameters->cod_format = -1;
/* UniPG>> */
#ifdef USE_JPWL
parameters->jpwl_correct = false;
parameters->jpwl_correct = OPJ_FALSE;
parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
#endif /* USE_JPWL */
@ -172,7 +172,7 @@ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *ci
opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_calloc(1, sizeof(opj_cinfo_t));
if(!cinfo) return NULL;
cinfo->is_decompressor = false;
cinfo->is_decompressor = OPJ_FALSE;
switch(format) {
case CODEC_J2K:
/* get a J2K coder handle */
@ -247,7 +247,7 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *paramete
/* UniPG>> */
#ifdef USE_JPWL
parameters->jpwl_epc_on = false;
parameters->jpwl_epc_on = OPJ_FALSE;
parameters->jpwl_hprot_MH = -1; /* -1 means unassigned */
{
int i;
@ -297,7 +297,7 @@ void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *param
}
}
bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
if (index != NULL)
opj_event_msg((opj_common_ptr)cinfo, EVT_WARNING, "Set index to NULL when calling the opj_encode function.\n"
"To extract the index, use the opj_encode_with_info() function.\n"
@ -305,7 +305,7 @@ bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *im
return opj_encode_with_info(cinfo, cio, image, NULL);
}
bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
if(cinfo && cio && image) {
switch(cinfo->codec_format) {
case CODEC_J2K:
@ -318,7 +318,7 @@ bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_i
break;
}
}
return false;
return OPJ_FALSE;
}
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {

View File

@ -59,30 +59,9 @@ defined with this macro as being exported.
#endif /* OPJ_EXPORTS */
#endif /* !OPJ_STATIC || !_WIN32 */
#ifndef __cplusplus
#if defined(HAVE_STDBOOL_H)
/*
The C language implementation does correctly provide the standard header
file "stdbool.h".
*/
#include <stdbool.h>
#else
/*
The C language implementation does not provide the standard header file
"stdbool.h" as required by ISO/IEC 9899:1999. Try to compensate for this
braindamage below.
*/
#if !defined(bool)
#define bool int
#endif
#if !defined(true)
#define true 1
#endif
#if !defined(false)
#define false 0
#endif
#endif
#endif /* __cplusplus */
typedef int opj_bool;
#define OPJ_TRUE 1
#define OPJ_FALSE 0
/*
==========================================================
@ -243,7 +222,7 @@ Compression parameters
*/
typedef struct opj_cparameters {
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
bool tile_size_on;
opj_bool tile_size_on;
/** XTOsiz */
int cp_tx0;
/** YTOsiz */
@ -325,7 +304,7 @@ typedef struct opj_cparameters {
/**@name JPWL encoding parameters */
/*@{*/
/** enables writing of EPC in MH, thus activating JPWL */
bool jpwl_epc_on;
opj_bool jpwl_epc_on;
/** error protection method for MH (0,1,16,32,37-128) */
int jpwl_hprot_MH;
/** tile number of header protection specification (>=0) */
@ -403,7 +382,7 @@ typedef struct opj_dparameters {
/**@name JPWL decoding parameters */
/*@{*/
/** activates the JPWL correction capabilities */
bool jpwl_correct;
opj_bool jpwl_correct;
/** expected number of components */
int jpwl_exp_comps;
/** maximum number of tiles */
@ -426,7 +405,7 @@ typedef struct opj_dparameters {
#define opj_common_fields \
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
void * client_data; /**< Available for use by application */\
bool is_decompressor; /**< So common code can tell which is which */\
opj_bool is_decompressor; /**< So common code can tell which is which */\
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
void *j2k_handle; /**< pointer to the J2K codec */\
void *jp2_handle; /**< pointer to the JP2 codec */\
@ -892,7 +871,7 @@ Encode an image into a JPEG-2000 codestream
@param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
@return Returns true if successful, returns false otherwise
*/
OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
/**
Encode an image into a JPEG-2000 codestream and extract the codestream information
@param cinfo compressor handle
@ -901,7 +880,7 @@ Encode an image into a JPEG-2000 codestream and extract the codestream informati
@param cstr_info Codestream information structure if needed afterwards, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
OPJ_API bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
OPJ_API opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
/**
Destroy Codestream information after compression or decompression
@param cstr_info Codestream information structure

View File

@ -43,31 +43,31 @@ Get next packet in layer-resolution-component-precinct order.
@param pi packet iterator to modify
@return returns false if pi pointed to the last packet or else returns true
*/
static bool pi_next_lrcp(opj_pi_iterator_t * pi);
static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi);
/**
Get next packet in resolution-layer-component-precinct order.
@param pi packet iterator to modify
@return returns false if pi pointed to the last packet or else returns true
*/
static bool pi_next_rlcp(opj_pi_iterator_t * pi);
static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi);
/**
Get next packet in resolution-precinct-component-layer order.
@param pi packet iterator to modify
@return returns false if pi pointed to the last packet or else returns true
*/
static bool pi_next_rpcl(opj_pi_iterator_t * pi);
static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi);
/**
Get next packet in precinct-component-resolution-layer order.
@param pi packet iterator to modify
@return returns false if pi pointed to the last packet or else returns true
*/
static bool pi_next_pcrl(opj_pi_iterator_t * pi);
static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi);
/**
Get next packet in component-precinct-resolution-layer order.
@param pi packet iterator to modify
@return returns false if pi pointed to the last packet or else returns true
*/
static bool pi_next_cprl(opj_pi_iterator_t * pi);
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi);
/*@}*/
@ -79,7 +79,7 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi);
==========================================================
*/
static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
long index = 0;
@ -108,7 +108,7 @@ static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
if (!pi->include[index]) {
pi->include[index] = 1;
return true;
return OPJ_TRUE;
}
LABEL_SKIP:;
}
@ -116,10 +116,10 @@ LABEL_SKIP:;
}
}
return false;
return OPJ_FALSE;
}
static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
long index = 0;
@ -147,7 +147,7 @@ static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
if (!pi->include[index]) {
pi->include[index] = 1;
return true;
return OPJ_TRUE;
}
LABEL_SKIP:;
}
@ -155,10 +155,10 @@ LABEL_SKIP:;
}
}
return false;
return OPJ_FALSE;
}
static bool pi_next_rpcl(opj_pi_iterator_t * pi) {
static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
long index = 0;
@ -229,7 +229,7 @@ if (!pi->tp_on){
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
if (!pi->include[index]) {
pi->include[index] = 1;
return true;
return OPJ_TRUE;
}
LABEL_SKIP:;
}
@ -238,10 +238,10 @@ LABEL_SKIP:;
}
}
return false;
return OPJ_FALSE;
}
static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
long index = 0;
@ -310,7 +310,7 @@ static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
if (!pi->include[index]) {
pi->include[index] = 1;
return true;
return OPJ_TRUE;
}
LABEL_SKIP:;
}
@ -319,10 +319,10 @@ LABEL_SKIP:;
}
}
return false;
return OPJ_FALSE;
}
static bool pi_next_cprl(opj_pi_iterator_t * pi) {
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi) {
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
long index = 0;
@ -389,7 +389,7 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi) {
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
if (!pi->include[index]) {
pi->include[index] = 1;
return true;
return OPJ_TRUE;
}
LABEL_SKIP:;
}
@ -398,7 +398,7 @@ LABEL_SKIP:;
}
}
return false;
return OPJ_FALSE;
}
/*
@ -707,7 +707,7 @@ void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno) {
}
}
bool pi_next(opj_pi_iterator_t * pi) {
opj_bool pi_next(opj_pi_iterator_t * pi) {
switch (pi->poc.prg) {
case LRCP:
return pi_next_lrcp(pi);
@ -720,13 +720,13 @@ bool pi_next(opj_pi_iterator_t * pi) {
case CPRL:
return pi_next_cprl(pi);
case PROG_UNKNOWN:
return false;
return OPJ_FALSE;
}
return false;
return OPJ_FALSE;
}
bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp){
opj_bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp){
char prog[4];
int i;
int incr_top=1,resetX=0;
@ -748,7 +748,7 @@ bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,
case RPCL: strncpy(prog, "RPCL",4);
break;
case PROG_UNKNOWN:
return true;
return OPJ_TRUE;
}
if(!(cp->tp_on && ((!cp->cinema && (t2_mode == FINAL_PASS)) || cp->cinema))){
@ -958,6 +958,6 @@ bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,
}
}
}
return false;
return OPJ_FALSE;
}

View File

@ -122,7 +122,7 @@ Modify the packet iterator for enabling tile part generation
@param cur_totnum_tp The total number of tile parts in the current tile
@return Returns true if an error is detected
*/
bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp);
opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp);
/**
Create a packet iterator for Decoder
@param image Raw image for which the packets will be listed
@ -147,7 +147,7 @@ Modify the packet iterator to point to the next packet
@param pi Packet iterator to modify
@return Returns false if pi pointed to the last packet or else returns true
*/
bool pi_next(opj_pi_iterator_t * pi);
opj_bool pi_next(opj_pi_iterator_t * pi);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1103,7 +1103,7 @@ static double t1_getwmsedec(
return wmsedec;
}
static bool allocate_buffers(
static opj_bool allocate_buffers(
opj_t1_t *t1,
int w,
int h)
@ -1115,7 +1115,7 @@ static bool allocate_buffers(
opj_aligned_free(t1->data);
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
if(!t1->data){
return false;
return OPJ_FALSE;
}
t1->datasize=datasize;
}
@ -1128,7 +1128,7 @@ static bool allocate_buffers(
opj_aligned_free(t1->flags);
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
if(!t1->flags){
return false;
return OPJ_FALSE;
}
t1->flagssize=flagssize;
}
@ -1137,7 +1137,7 @@ static bool allocate_buffers(
t1->w=w;
t1->h=h;
return true;
return OPJ_TRUE;
}
/** mod fixed_quality */

View File

@ -997,7 +997,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
}
}
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
int compno, resno, bandno, precno, cblkno, passno, layno;
double min, max;
double cumdisto[100]; /* fixed_quality */
@ -1149,7 +1149,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
}
if (!success) {
return false;
return OPJ_FALSE;
}
if(cstr_info) { /* Threshold for Marcela Index */
@ -1161,7 +1161,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
cumdisto[layno] = (layno == 0) ? tcd_tile->distolayer[0] : (cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
}
return true;
return OPJ_TRUE;
}
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
@ -1313,7 +1313,7 @@ int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, op
return l;
}
bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
int l;
int compno;
int eof = 0;
@ -1396,7 +1396,7 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
if (tcd->image->comps[compno].resno_decoded < 0) {
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. The number of resolutions to remove [%d+1] is higher than the number "
" of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
return false;
return OPJ_FALSE;
}
}
@ -1476,10 +1476,10 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
opj_event_msg(tcd->cinfo, EVT_INFO, "- tile decoded in %f s\n", tile_time);
if (eof) {
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
void tcd_free_decode(opj_tcd_t *tcd) {

View File

@ -251,7 +251,7 @@ void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp,
void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
/**
Encode a tile from the raw image into a buffer
@param tcd TCD handle
@ -270,7 +270,7 @@ Decode a tile from a buffer into a raw image
@param tileno Number that identifies one of the tiles to be decoded
@param cstr_info Codestream information structure
*/
bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
/**
Free the memory allocated for decoding
@param tcd TCD handle