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:
parent
0c9f6a3ac9
commit
88f43b15fa
3
CHANGES
3
CHANGES
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : 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
|
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 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
|
* [antonin] fixed part of issue 69, when tile-part index is inconsistent with the total number of tile-parts
|
||||||
|
|
|
@ -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,
|
int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||||
bool flip_image)
|
opj_bool flip_image)
|
||||||
{
|
{
|
||||||
tga_header tga;
|
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 */
|
opj_image_cmptparm_t cmptparm[4]; /* maximum 4 components */
|
||||||
int numcomps;
|
int numcomps;
|
||||||
OPJ_COLOR_SPACE color_space;
|
OPJ_COLOR_SPACE color_space;
|
||||||
bool mono ;
|
opj_bool mono ;
|
||||||
bool save_alpha;
|
opj_bool save_alpha;
|
||||||
int subsampling_dx, subsampling_dy;
|
int subsampling_dx, subsampling_dy;
|
||||||
int i;
|
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 imagetotga(opj_image_t * image, const char *outfile) {
|
||||||
int width, height, bpp, x, y;
|
int width, height, bpp, x, y;
|
||||||
bool write_alpha;
|
opj_bool write_alpha;
|
||||||
int i;
|
int i;
|
||||||
unsigned int alpha_channel;
|
unsigned int alpha_channel;
|
||||||
float r,g,b,a;
|
float r,g,b,a;
|
||||||
|
@ -313,7 +313,7 @@ int imagetotga(opj_image_t * image, const char *outfile) {
|
||||||
|
|
||||||
// Write TGA header
|
// Write TGA header
|
||||||
bpp = write_alpha ? 32 : 24;
|
bpp = write_alpha ? 32 : 24;
|
||||||
if (!tga_writeheader(fdest, bpp, width , height, true))
|
if (!tga_writeheader(fdest, bpp, width , height, OPJ_TRUE))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
alpha_channel = image->numcomps-1;
|
alpha_channel = image->numcomps-1;
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct raw_cparameters {
|
||||||
/** bit depth of the raw image */
|
/** bit depth of the raw image */
|
||||||
int rawBitDepth;
|
int rawBitDepth;
|
||||||
/** signed/unsigned raw image */
|
/** signed/unsigned raw image */
|
||||||
bool rawSigned;
|
opj_bool rawSigned;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
} raw_cparameters_t;
|
} raw_cparameters_t;
|
||||||
|
|
||||||
|
|
|
@ -454,7 +454,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
||||||
}
|
}
|
||||||
|
|
||||||
void cinema_parameters(opj_cparameters_t *parameters){
|
void cinema_parameters(opj_cparameters_t *parameters){
|
||||||
parameters->tile_size_on = false;
|
parameters->tile_size_on = OPJ_FALSE;
|
||||||
parameters->cp_tdx=1;
|
parameters->cp_tdx=1;
|
||||||
parameters->cp_tdy=1;
|
parameters->cp_tdy=1;
|
||||||
|
|
||||||
|
@ -694,11 +694,11 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
char *s = optarg;
|
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 (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 = 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);
|
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 = 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);
|
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 {
|
||||||
|
@ -791,7 +791,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
case 't': /* tiles */
|
case 't': /* tiles */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||||
parameters->tile_size_on = true;
|
parameters->tile_size_on = OPJ_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1363,7 +1363,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
|
|
||||||
/* some info */
|
/* some info */
|
||||||
fprintf(stdout, "Info: JPWL capabilities enabled\n");
|
fprintf(stdout, "Info: JPWL capabilities enabled\n");
|
||||||
parameters->jpwl_epc_on = true;
|
parameters->jpwl_epc_on = OPJ_TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1475,7 +1475,7 @@ void info_callback(const char *msg, void *client_data) {
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
bool bSuccess;
|
opj_bool bSuccess;
|
||||||
opj_cparameters_t parameters; /* compression parameters */
|
opj_cparameters_t parameters; /* compression parameters */
|
||||||
img_fol_t img_fol;
|
img_fol_t img_fol;
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
|
|
@ -443,7 +443,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||||
/* next token or bust */
|
/* next token or bust */
|
||||||
token = strtok(NULL, ",");
|
token = strtok(NULL, ",");
|
||||||
};
|
};
|
||||||
parameters->jpwl_correct = true;
|
parameters->jpwl_correct = OPJ_TRUE;
|
||||||
fprintf(stdout, "JPWL correction capability activated\n");
|
fprintf(stdout, "JPWL correction capability activated\n");
|
||||||
fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps);
|
fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ int main(int argc, char **argv)
|
||||||
FILE *mj2file;
|
FILE *mj2file;
|
||||||
int sampleno;
|
int sampleno;
|
||||||
opj_cinfo_t* cinfo;
|
opj_cinfo_t* cinfo;
|
||||||
bool bSuccess;
|
opj_bool bSuccess;
|
||||||
int numframes;
|
int numframes;
|
||||||
int prec = 8;/* DEFAULT */
|
int prec = 8;/* DEFAULT */
|
||||||
double total_time = 0;
|
double total_time = 0;
|
||||||
|
@ -430,7 +430,7 @@ int main(int argc, char **argv)
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
case 't': /* tiles */
|
case 't': /* tiles */
|
||||||
sscanf(optarg, "%d,%d", &j2k_parameters->cp_tdx, &j2k_parameters->cp_tdy);
|
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;
|
break;
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
case 'n': /* resolution */
|
case 'n': /* resolution */
|
||||||
|
|
|
@ -35,16 +35,6 @@
|
||||||
/** @name Local static functions */
|
/** @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
|
* 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));
|
opj_dinfo_t *dinfo = (opj_dinfo_t*) opj_calloc(1, sizeof(opj_dinfo_t));
|
||||||
if(!dinfo) return NULL;
|
if(!dinfo) return NULL;
|
||||||
|
|
||||||
dinfo->is_decompressor = true;
|
dinfo->is_decompressor = OPJ_TRUE;
|
||||||
|
|
||||||
mj2 = (opj_mj2_t*) opj_calloc(1, sizeof(opj_mj2_t));
|
mj2 = (opj_mj2_t*) opj_calloc(1, sizeof(opj_mj2_t));
|
||||||
dinfo->mj2_handle = mj2;
|
dinfo->mj2_handle = mj2;
|
||||||
|
|
|
@ -362,7 +362,7 @@ Encode an image into a JPEG-2000 file stream
|
||||||
@param index Name of the index file if required, NULL otherwise
|
@param index Name of the index file if required, NULL otherwise
|
||||||
@return Returns true if successful, returns false 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
|
Init a Standard MJ2 movie
|
||||||
|
|
|
@ -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;
|
FILE *f;
|
||||||
int *data;
|
int *data;
|
||||||
|
@ -191,18 +191,18 @@ bool imagetoyuv(opj_image_t * img, char *outfile)
|
||||||
|| img->comps[1].dx != img->comps[2].dx) {
|
|| img->comps[1].dx != img->comps[2].dx) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error with the input image components size: cannot create yuv file)\n");
|
"Error with the input image components size: cannot create yuv file)\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
} else if (!(img->numcomps == 1)) {
|
} else if (!(img->numcomps == 1)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error with the number of image components(must be one or three)\n");
|
"Error with the number of image components(must be one or three)\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(outfile, "a+b");
|
f = fopen(outfile, "a+b");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(stderr, "failed to open %s for writing\n", outfile);
|
fprintf(stderr, "failed to open %s for writing\n", outfile);
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
is_16 = (img->comps[0].prec > 8);
|
is_16 = (img->comps[0].prec > 8);
|
||||||
prec_bytes = (is_16?2:1);
|
prec_bytes = (is_16?2:1);
|
||||||
|
@ -262,7 +262,7 @@ bool imagetoyuv(opj_image_t * img, char *outfile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------
|
// -----------------------
|
||||||
|
|
|
@ -126,13 +126,13 @@ unsigned char *cio_getbp(opj_cio_t *cio) {
|
||||||
/*
|
/*
|
||||||
* Write a byte.
|
* 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) {
|
if (cio->bp >= cio->end) {
|
||||||
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
*cio->bp++ = v;
|
*cio->bp++ = v;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -72,7 +72,7 @@ opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_
|
||||||
return NULL;
|
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 */
|
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
||||||
opj_msg_callback msg_handler = NULL;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
if(msg_handler == NULL) {
|
if(msg_handler == NULL) {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fmt != NULL) && (event_mgr != NULL)) {
|
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);
|
msg_handler(message, cinfo->client_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
@param fmt Format-control string (plus optionnal arguments)
|
||||||
@return Returns true if successful, returns false otherwise
|
@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, ...);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
|
@ -1496,7 +1496,7 @@ static void j2k_write_eoc(opj_j2k_t *j2k) {
|
||||||
|
|
||||||
static void j2k_read_eoc(opj_j2k_t *j2k) {
|
static void j2k_read_eoc(opj_j2k_t *j2k) {
|
||||||
int i, tileno;
|
int i, tileno;
|
||||||
bool success;
|
opj_bool success;
|
||||||
|
|
||||||
/* if packets should be decoded */
|
/* if packets should be decoded */
|
||||||
if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
|
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]);
|
opj_free(j2k->tile_data[tileno]);
|
||||||
j2k->tile_data[tileno] = NULL;
|
j2k->tile_data[tileno] = NULL;
|
||||||
tcd_free_decode_tile(tcd, i);
|
tcd_free_decode_tile(tcd, i);
|
||||||
if (success == false) {
|
if (success == OPJ_FALSE) {
|
||||||
j2k->state |= J2K_STATE_ERR;
|
j2k->state |= J2K_STATE_ERR;
|
||||||
break;
|
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) {
|
if (j2k->cp->correct) {
|
||||||
|
|
||||||
int orig_pos = cio_tell(cio);
|
int orig_pos = cio_tell(cio);
|
||||||
bool status;
|
opj_bool status;
|
||||||
|
|
||||||
/* call the corrector */
|
/* call the corrector */
|
||||||
status = jpwl_correct(j2k);
|
status = jpwl_correct(j2k);
|
||||||
|
@ -2040,12 +2040,12 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* set JPWL on */
|
/* set JPWL on */
|
||||||
cp->epc_on = true;
|
cp->epc_on = OPJ_TRUE;
|
||||||
cp->info_on = false; /* no informative technique */
|
cp->info_on = OPJ_FALSE; /* no informative technique */
|
||||||
|
|
||||||
/* set EPB on */
|
/* set EPB on */
|
||||||
if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {
|
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;
|
cp->hprot_MH = parameters->jpwl_hprot_MH;
|
||||||
for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
|
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 */
|
/* set ESD writing */
|
||||||
if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {
|
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_size = parameters->jpwl_sens_size;
|
||||||
cp->sens_addr = parameters->jpwl_sens_addr;
|
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 */
|
/* always set RED writing to false: we are at the encoder */
|
||||||
cp->red_on = false;
|
cp->red_on = OPJ_FALSE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cp->epc_on = false;
|
cp->epc_on = OPJ_FALSE;
|
||||||
}
|
}
|
||||||
#endif /* USE_JPWL */
|
#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;
|
int tileno, compno;
|
||||||
opj_cp_t *cp = NULL;
|
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 */
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -265,15 +265,15 @@ typedef struct opj_cp {
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
/** enables writing of EPC in MH, thus activating 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 */
|
/** 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 */
|
/** 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 */
|
/** 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 */
|
/** 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) */
|
/** error protection method for MH (0,1,16,32,37-128) */
|
||||||
int hprot_MH;
|
int hprot_MH;
|
||||||
/** tile number of header protection specification (>=0) */
|
/** tile number of header protection specification (>=0) */
|
||||||
|
@ -299,7 +299,7 @@ typedef struct opj_cp {
|
||||||
/** sensitivity methods for TPHs (-1,0-7) */
|
/** sensitivity methods for TPHs (-1,0-7) */
|
||||||
int sens_TPH[JPWL_MAX_NO_TILESPECS];
|
int sens_TPH[JPWL_MAX_NO_TILESPECS];
|
||||||
/** enables JPWL correction at the decoder */
|
/** enables JPWL correction at the decoder */
|
||||||
bool correct;
|
opj_bool correct;
|
||||||
/** expected number of components at the decoder */
|
/** expected number of components at the decoder */
|
||||||
int exp_comps;
|
int exp_comps;
|
||||||
/** maximum number of tiles at the decoder */
|
/** 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
|
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||||
@return Returns true if successful, returns false 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);
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -43,7 +43,7 @@ Read box headers
|
||||||
@param box
|
@param box
|
||||||
@return Returns true if successful, returns false otherwise
|
@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);*/
|
/*static void jp2_write_url(opj_cio_t *cio, char *Idx_file);*/
|
||||||
/**
|
/**
|
||||||
Read the IHDR box - Image Header box
|
Read the IHDR box - Image Header box
|
||||||
|
@ -51,10 +51,10 @@ Read the IHDR box - Image Header box
|
||||||
@param cio Input buffer stream
|
@param cio Input buffer stream
|
||||||
@return Returns true if successful, returns false otherwise
|
@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_ihdr(opj_jp2_t *jp2, opj_cio_t *cio);
|
||||||
static void jp2_write_bpcc(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);
|
static void jp2_write_colr(opj_jp2_t *jp2, opj_cio_t *cio);
|
||||||
/**
|
/**
|
||||||
Write the FTYP box - File type box
|
Write the FTYP box - File type box
|
||||||
|
@ -68,9 +68,9 @@ Read the FTYP box - File type box
|
||||||
@param cio Input buffer stream
|
@param cio Input buffer stream
|
||||||
@return Returns true if successful, returns false otherwise
|
@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 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);
|
static void jp2_write_jp(opj_cio_t *cio);
|
||||||
/**
|
/**
|
||||||
Read the JP box - JPEG 2000 signature
|
Read the JP box - JPEG 2000 signature
|
||||||
|
@ -78,7 +78,7 @@ Read the JP box - JPEG 2000 signature
|
||||||
@param cio Input buffer stream
|
@param cio Input buffer stream
|
||||||
@return Returns true if successful, returns false otherwise
|
@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
|
Decode the structure of a JP2 file
|
||||||
@param jp2 JP2 handle
|
@param jp2 JP2 handle
|
||||||
|
@ -86,7 +86,7 @@ Decode the structure of a JP2 file
|
||||||
@param color Collector for profile, cdef and pclr data
|
@param color Collector for profile, cdef and pclr data
|
||||||
@return Returns true if successful, returns false otherwise
|
@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);
|
opj_jp2_color_t *color);
|
||||||
/**
|
/**
|
||||||
Apply collected palette data
|
Apply collected palette data
|
||||||
|
@ -102,7 +102,7 @@ Collect palette data
|
||||||
@param color Collector for profile, cdef and pclr data
|
@param color Collector for profile, cdef and pclr data
|
||||||
@return Returns true if successful, returns false otherwise
|
@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);
|
opj_jp2_box_t *box, opj_jp2_color_t *color);
|
||||||
/**
|
/**
|
||||||
Collect component mapping data
|
Collect component mapping data
|
||||||
|
@ -112,7 +112,7 @@ Collect component mapping data
|
||||||
@param color Collector for profile, cdef and pclr data
|
@param color Collector for profile, cdef and pclr data
|
||||||
@return Returns true if successful, returns false otherwise
|
@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);
|
opj_jp2_box_t *box, opj_jp2_color_t *color);
|
||||||
/**
|
/**
|
||||||
Collect colour specification data
|
Collect colour specification data
|
||||||
|
@ -122,7 +122,7 @@ Collect colour specification data
|
||||||
@param color Collector for profile, cdef and pclr data
|
@param color Collector for profile, cdef and pclr data
|
||||||
@return Returns true if successful, returns false otherwise
|
@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);
|
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->init_pos = cio_tell(cio);
|
||||||
box->length = cio_read(cio, 4);
|
box->length = cio_read(cio, 4);
|
||||||
box->type = cio_read(cio, 4);
|
box->type = cio_read(cio, 4);
|
||||||
if (box->length == 1) {
|
if (box->length == 1) {
|
||||||
if (cio_read(cio, 4) != 0) {
|
if (cio_read(cio, 4) != 0) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
|
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);
|
box->length = cio_read(cio, 4);
|
||||||
if (box->length == 0)
|
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;
|
box->length = cio_numbytesleft(cio) + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -174,7 +174,7 @@ static void jp2_write_url(opj_cio_t *cio, char *Idx_file) {
|
||||||
}
|
}
|
||||||
#endif
|
#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_jp2_box_t box;
|
||||||
|
|
||||||
opj_common_ptr cinfo = jp2->cinfo;
|
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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
if (JP2_IHDR != box.type) {
|
if (JP2_IHDR != box.type) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Expected IHDR Marker\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Expected IHDR Marker\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
jp2->h = cio_read(cio, 4); /* HEIGHT */
|
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) {
|
if (cio_tell(cio) - box.init_pos != box.length) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with IHDR Box\n");
|
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) {
|
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;
|
unsigned int i;
|
||||||
opj_jp2_box_t box;
|
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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
if (JP2_BPCC != box.type) {
|
if (JP2_BPCC != box.type) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Expected BPCC Marker\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Expected BPCC Marker\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < jp2->numcomps; i++) {
|
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) {
|
if (cio_tell(cio) - box.init_pos != box.length) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with BPCC Box\n");
|
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) {
|
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() */
|
}/* 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_box_t *box, opj_jp2_color_t *color)
|
||||||
{
|
{
|
||||||
opj_jp2_pclr_t *jp2_pclr;
|
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
|
/* Part 1, I.5.3.4: 'There shall be at most one Palette box inside
|
||||||
* a JP2 Header box' :
|
* 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_entries = cio_read(cio, 2); /* NE */
|
||||||
nr_channels = cio_read(cio, 1);/* NPC */
|
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() */
|
}/* 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_box_t *box, opj_jp2_color_t *color)
|
||||||
{
|
{
|
||||||
opj_jp2_cmap_comp_t *cmap;
|
opj_jp2_cmap_comp_t *cmap;
|
||||||
unsigned short i, nr_channels;
|
unsigned short i, nr_channels;
|
||||||
|
|
||||||
/* Need 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
|
/* Part 1, I.5.3.5: 'There shall be at most one Component Mapping box
|
||||||
* inside a JP2 Header 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;
|
nr_channels = color->jp2_pclr->nr_channels;
|
||||||
cmap = (opj_jp2_cmap_comp_t*)
|
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;
|
color->jp2_pclr->cmap = cmap;
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}/* jp2_read_cmap() */
|
}/* jp2_read_cmap() */
|
||||||
|
|
||||||
static void jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
|
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() */
|
}/* 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_box_t *box, opj_jp2_color_t *color)
|
||||||
{
|
{
|
||||||
opj_jp2_cdef_info_t *info;
|
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
|
/* Part 1, I.5.3.6: 'The shall be at most one Channel Definition box
|
||||||
* inside a JP2 Header 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*)
|
info = (opj_jp2_cdef_info_t*)
|
||||||
opj_malloc(n * sizeof(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);
|
info[i].asoc = cio_read(cio, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}/* jp2_read_cdef() */
|
}/* 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)
|
opj_jp2_box_t *box, opj_jp2_color_t *color)
|
||||||
{
|
{
|
||||||
int skip_len;
|
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
|
/* Part 1, I.5.3.3 : 'A conforming JP2 reader shall ignore all Colour
|
||||||
* Specification boxes after the first.'
|
* Specification boxes after the first.'
|
||||||
*/
|
*/
|
||||||
if(color->jp2_has_colr) return false;
|
if(color->jp2_has_colr) return OPJ_FALSE;
|
||||||
|
|
||||||
cinfo = jp2->cinfo;
|
cinfo = jp2->cinfo;
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ static bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
|
||||||
if (skip_len < 0)
|
if (skip_len < 0)
|
||||||
{
|
{
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with COLR box size\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Error with COLR box size\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
if(skip_len > 0)
|
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)
|
if (cio_tell(cio) - box->init_pos != box->length)
|
||||||
{
|
{
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with COLR Box\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Error with COLR Box\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
color->jp2_has_colr = 1;
|
color->jp2_has_colr = 1;
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}/* jp2_read_colr() */
|
}/* 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;
|
opj_jp2_box_t box;
|
||||||
int jp2h_end;
|
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)
|
if (box.type == JP2_JP2C)
|
||||||
{
|
{
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Expected JP2H Marker\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Expected JP2H Marker\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
cio_skip(cio, box.length - 8);
|
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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
}
|
}
|
||||||
} while(JP2_JP2H != box.type);
|
} while(JP2_JP2H != box.type);
|
||||||
|
|
||||||
if (!jp2_read_ihdr(jp2, cio))
|
if (!jp2_read_ihdr(jp2, cio))
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
jp2h_end = box.init_pos + box.length;
|
jp2h_end = box.init_pos + box.length;
|
||||||
|
|
||||||
if (jp2->bpc == 255)
|
if (jp2->bpc == 255)
|
||||||
{
|
{
|
||||||
if (!jp2_read_bpcc(jp2, cio))
|
if (!jp2_read_bpcc(jp2, cio))
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
jp2_read_boxhdr(cinfo, cio, &box);
|
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);
|
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;
|
int i;
|
||||||
opj_jp2_box_t box;
|
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) {
|
if (JP2_FTYP != box.type) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Expected FTYP Marker\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Expected FTYP Marker\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
jp2->brand = cio_read(cio, 4); /* BR */
|
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) {
|
if (cio_tell(cio) - box.init_pos != box.length) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with FTYP Box\n");
|
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) {
|
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;
|
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_jp2_box_t box;
|
||||||
|
|
||||||
opj_common_ptr cinfo = jp2->cinfo;
|
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_offset = cio_tell(cio);
|
||||||
*j2k_codestream_length = box.length - 8;
|
*j2k_codestream_length = box.length - 8;
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jp2_write_jp(opj_cio_t *cio) {
|
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);
|
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_jp2_box_t box;
|
||||||
|
|
||||||
opj_common_ptr cinfo = jp2->cinfo;
|
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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
if (JP2_JP != box.type) {
|
if (JP2_JP != box.type) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Expected JP Marker\n");
|
opj_event_msg(cinfo, EVT_ERROR, "Expected JP Marker\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
if (0x0d0a870a != cio_read(cio, 4)) {
|
if (0x0d0a870a != cio_read(cio, 4)) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with JP Marker\n");
|
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) {
|
if (cio_tell(cio) - box.init_pos != box.length) {
|
||||||
opj_event_msg(cinfo, EVT_ERROR, "Error with JP Box size\n");
|
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) {
|
opj_jp2_color_t *color) {
|
||||||
if (!jp2_read_jp(jp2, cio))
|
if (!jp2_read_jp(jp2, cio))
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
if (!jp2_read_ftyp(jp2, cio))
|
if (!jp2_read_ftyp(jp2, cio))
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
if (!jp2_read_jp2h(jp2, cio, color))
|
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))
|
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 */
|
/* 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)) {
|
if(!jp2_write_jp2c(jp2, cio, image, cstr_info)) {
|
||||||
opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n");
|
opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ Read the JP2H box - JP2 Header box (used in MJ2)
|
||||||
@param ext Collector for profile, cdef and pclr data
|
@param ext Collector for profile, cdef and pclr data
|
||||||
@return Returns true if successful, returns false otherwise
|
@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
|
Creates a JP2 decompression structure
|
||||||
@param cinfo Codec context info
|
@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
|
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||||
@return Returns true if successful, returns false 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);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ static jpwl_marker_t jwmarker[JPWL_MAX_NO_MARKERS];
|
||||||
@param info_on true if informative techniques are activated
|
@param info_on true if informative techniques are activated
|
||||||
@return returns the freshly created EPC
|
@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->esd_on, /* is ESD present? */
|
||||||
j2k->cp->red_on, /* is RED present? */
|
j2k->cp->red_on, /* is RED present? */
|
||||||
j2k->cp->epb_on, /* is EPB 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 */
|
/* 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].pos = soc_pos + socsiz_len; /* after SIZ */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.1; /* not so first */
|
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 = epc_mark->Lepc; /* its length */
|
||||||
jwmarker[jwmarker_num].len_ready = true; /* ready */
|
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].pos_ready = true; /* ready */
|
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].parms_ready = false; /* not ready */
|
jwmarker[jwmarker_num].parms_ready = OPJ_FALSE; /* not ready */
|
||||||
jwmarker[jwmarker_num].data_ready = true; /* ready */
|
jwmarker[jwmarker_num].data_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker_num++;
|
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].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].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 = esd_mark->Lesd; /* its length */
|
||||||
jwmarker[jwmarker_num].len_ready = true; /* not ready, yet */
|
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* not ready, yet */
|
||||||
jwmarker[jwmarker_num].pos_ready = true; /* ready */
|
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].parms_ready = true; /* not ready */
|
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* not ready */
|
||||||
jwmarker[jwmarker_num].data_ready = false; /* not ready */
|
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
|
||||||
jwmarker_num++;
|
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].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].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 = esd_mark->Lesd; /* its length */
|
||||||
jwmarker[jwmarker_num].len_ready = true; /* ready, yet */
|
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready, yet */
|
||||||
jwmarker[jwmarker_num].pos_ready = true; /* ready */
|
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].parms_ready = true; /* not ready */
|
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* not ready */
|
||||||
jwmarker[jwmarker_num].data_ready = false; /* ready */
|
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* ready */
|
||||||
jwmarker_num++;
|
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 */
|
/* Create the EPB */
|
||||||
if ((epb_mark = jpwl_epb_create(
|
if ((epb_mark = jpwl_epb_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
true, /* is it the latest? */
|
OPJ_TRUE, /* is it the latest? */
|
||||||
true, /* is it packed? not for now */
|
OPJ_TRUE, /* is it packed? not for now */
|
||||||
-1, /* we are in main header */
|
-1, /* we are in main header */
|
||||||
0, /* its index is 0 (first) */
|
0, /* its index is 0 (first) */
|
||||||
j2k->cp->hprot_MH, /* protection type parameters of data */
|
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].pos = soc_pos + socsiz_len; /* after SIZ */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
|
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 = epb_mark->Lepb; /* its length */
|
||||||
jwmarker[jwmarker_num].len_ready = true; /* ready */
|
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].pos_ready = true; /* ready */
|
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].parms_ready = true; /* ready */
|
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].data_ready = false; /* not ready */
|
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
|
||||||
jwmarker_num++;
|
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 */
|
/* Create the EPB */
|
||||||
if ((epb_mark = jpwl_epb_create(
|
if ((epb_mark = jpwl_epb_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
false, /* is it the latest? in TPH, no for now (if huge data size in TPH, we'd need more) */
|
OPJ_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_TRUE, /* is it packed? yes for now */
|
||||||
tileno, /* we are in TPH */
|
tileno, /* we are in TPH */
|
||||||
epb_index++, /* its index is 0 (first) */
|
epb_index++, /* its index is 0 (first) */
|
||||||
hprot, /* protection type parameters of following data */
|
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].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].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
|
||||||
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
|
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
|
||||||
jwmarker[jwmarker_num].len_ready = true; /* ready */
|
jwmarker[jwmarker_num].len_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].pos_ready = true; /* ready */
|
jwmarker[jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].parms_ready = true; /* ready */
|
jwmarker[jwmarker_num].parms_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[jwmarker_num].data_ready = false; /* not ready */
|
jwmarker[jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
|
||||||
jwmarker_num++;
|
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 */
|
j2k, /* J2K handle */
|
||||||
jwmarker, /* pointer to JPWL markers list */
|
jwmarker, /* pointer to JPWL markers list */
|
||||||
&jwmarker_num, /* pointer to the number of current markers */
|
&jwmarker_num, /* pointer to the number of current markers */
|
||||||
false, /* latest */
|
OPJ_FALSE, /* latest */
|
||||||
true, /* packed */
|
OPJ_TRUE, /* packed */
|
||||||
false, /* inside MH */
|
OPJ_FALSE, /* inside MH */
|
||||||
&epb_index, /* pointer to EPB index */
|
&epb_index, /* pointer to EPB index */
|
||||||
pprot, /* protection type */
|
pprot, /* protection type */
|
||||||
/****** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001, */ /* position */
|
/****** (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 */
|
j2k, /* J2K handle */
|
||||||
jwmarker, /* pointer to JPWL markers list */
|
jwmarker, /* pointer to JPWL markers list */
|
||||||
&jwmarker_num, /* pointer to the number of current markers */
|
&jwmarker_num, /* pointer to the number of current markers */
|
||||||
true, /* latest */
|
OPJ_TRUE, /* latest */
|
||||||
true, /* packed */
|
OPJ_TRUE, /* packed */
|
||||||
false, /* inside MH */
|
OPJ_FALSE, /* inside MH */
|
||||||
&epb_index, /* pointer to EPB index */
|
&epb_index, /* pointer to EPB index */
|
||||||
pprot, /* protection type */
|
pprot, /* protection type */
|
||||||
/***** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001,*/ /* position */
|
/***** (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 */
|
/* we can now check if the TPH EPB was really the last one */
|
||||||
if (tph_epb && (epb_index == 1)) {
|
if (tph_epb && (epb_index == 1)) {
|
||||||
/* set the TPH EPB to be the last one in current header */
|
/* 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;
|
tph_epb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,8 +1018,8 @@ void j2k_read_epb(opj_j2k_t *j2k) {
|
||||||
unsigned short int Lepb;
|
unsigned short int Lepb;
|
||||||
unsigned char Depb;
|
unsigned char Depb;
|
||||||
char str1[25] = "";
|
char str1[25] = "";
|
||||||
bool status;
|
opj_bool status;
|
||||||
static bool first_in_tph = true;
|
static opj_bool first_in_tph = OPJ_TRUE;
|
||||||
int type, pre_len, post_len;
|
int type, pre_len, post_len;
|
||||||
static unsigned char *redund = NULL;
|
static unsigned char *redund = NULL;
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ void j2k_read_epb(opj_j2k_t *j2k) {
|
||||||
/* we are in TPH */
|
/* we are in TPH */
|
||||||
type = 1; /* TPH */
|
type = 1; /* TPH */
|
||||||
pre_len = 12; /* SOC+SIZ */
|
pre_len = 12; /* SOC+SIZ */
|
||||||
first_in_tph = false;
|
first_in_tph = OPJ_FALSE;
|
||||||
post_len = -1; /* auto */
|
post_len = -1; /* auto */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1088,7 +1088,7 @@ void j2k_read_epb(opj_j2k_t *j2k) {
|
||||||
/* last in current header? */
|
/* last in current header? */
|
||||||
if (Depb & 0x40) {
|
if (Depb & 0x40) {
|
||||||
redund = NULL; /* reset the pointer to L4 buffer */
|
redund = NULL; /* reset the pointer to L4 buffer */
|
||||||
first_in_tph = true;
|
first_in_tph = OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* advance to EPB endpoint */
|
/* advance to EPB endpoint */
|
||||||
|
@ -1217,7 +1217,7 @@ void j2k_read_red(opj_j2k_t *j2k) {
|
||||||
cio_skip(cio, Lred - 3);
|
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
|
#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",
|
"JPWL: wrong x-cord of block origin %d => x-prec is (%d, %d)\n",
|
||||||
block->x0, prec->x0, prec->x1);
|
block->x0, prec->x0, prec->x1);
|
||||||
if (!JPWL_ASSUME || JPWL_ASSUME)
|
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
|
#endif
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -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
|
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
|
EPB (Error Protection Block) Marker segment
|
||||||
|
@ -58,9 +58,9 @@ typedef struct jpwl_epb_ms {
|
||||||
/**@name Private fields set by epb_create */
|
/**@name Private fields set by epb_create */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** is the latest in header? */
|
/** is the latest in header? */
|
||||||
bool latest;
|
opj_bool latest;
|
||||||
/** is it in packed mode? */
|
/** is it in packed mode? */
|
||||||
bool packed;
|
opj_bool packed;
|
||||||
/** TH where this marker has been placed (-1 means MH) */
|
/** TH where this marker has been placed (-1 means MH) */
|
||||||
int tileno;
|
int tileno;
|
||||||
/** index in current header (0-63) */
|
/** index in current header (0-63) */
|
||||||
|
@ -100,13 +100,13 @@ EPC (Error Protection Capability) Marker segment
|
||||||
*/
|
*/
|
||||||
typedef struct jpwl_epc_ms {
|
typedef struct jpwl_epc_ms {
|
||||||
/** is ESD active? */
|
/** is ESD active? */
|
||||||
bool esd_on;
|
opj_bool esd_on;
|
||||||
/** is RED active? */
|
/** is RED active? */
|
||||||
bool red_on;
|
opj_bool red_on;
|
||||||
/** is EPB active? */
|
/** is EPB active? */
|
||||||
bool epb_on;
|
opj_bool epb_on;
|
||||||
/** are informative techniques active? */
|
/** are informative techniques active? */
|
||||||
bool info_on;
|
opj_bool info_on;
|
||||||
/**@name Marker segment fields */
|
/**@name Marker segment fields */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes) */
|
/** 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) */
|
/** length of the marker segment (marker excluded) */
|
||||||
unsigned short int len;
|
unsigned short int len;
|
||||||
/** the marker length is ready or not? */
|
/** the marker length is ready or not? */
|
||||||
bool len_ready;
|
opj_bool len_ready;
|
||||||
/** the marker position is ready or not? */
|
/** the marker position is ready or not? */
|
||||||
bool pos_ready;
|
opj_bool pos_ready;
|
||||||
/** the marker parameters are ready or not? */
|
/** the marker parameters are ready or not? */
|
||||||
bool parms_ready;
|
opj_bool parms_ready;
|
||||||
/** are the written data ready or not */
|
/** are the written data ready or not */
|
||||||
bool data_ready;
|
opj_bool data_ready;
|
||||||
} jpwl_marker_t;
|
} jpwl_marker_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -280,7 +280,7 @@ void j2k_read_red(opj_j2k_t *j2k);
|
||||||
@param post_len length of post-protected data
|
@param post_len length of post-protected data
|
||||||
@return returns the freshly created EPB
|
@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);
|
unsigned long int pre_len, unsigned long int post_len);
|
||||||
|
|
||||||
/** add a number of EPB marker segments
|
/** 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
|
@return returns the length of all added markers
|
||||||
*/
|
*/
|
||||||
int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
|
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,
|
double place_pos, int tileno,
|
||||||
unsigned long int pre_len, unsigned long int post_len);
|
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
|
@param jwmarker_num number of JPWL markers
|
||||||
@return returns true in case of success
|
@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);
|
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
|
@param j2k J2K compressor handle
|
||||||
@return true if correction is performed correctly
|
@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
|
/** corrects the data protected by an EPB
|
||||||
@param j2k J2K compressor handle
|
@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
|
@param L4_bufp is a pointer to the buffer pointer of redundancy data
|
||||||
@return returns true if correction could be succesfully performed
|
@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);
|
unsigned char **L4_bufp);
|
||||||
|
|
||||||
/** check that a tile and its children have valid data
|
/** 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 tcd Tile decompressor handle
|
||||||
@param tileno number of the tile to check
|
@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 */
|
/** Macro functions for CRC computation */
|
||||||
|
|
||||||
|
|
|
@ -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,
|
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,
|
double place_pos, int tileno,
|
||||||
unsigned long int pre_len, unsigned long int post_len) {
|
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(
|
if ((epb_mark = jpwl_epb_create(
|
||||||
j2k, /* this encoder handle */
|
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? */
|
packed, /* is it packed? */
|
||||||
tileno, /* we are in TPH */
|
tileno, /* we are in TPH */
|
||||||
*idx, /* its index */
|
*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].pos = (int) place_pos; /* after SOT */
|
||||||
jwmarker[*jwmarker_num].dpos = place_pos + 0.0000001 * (double)(*idx); /* not very first! */
|
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 = epb_mark->Lepb; /* its length */
|
||||||
jwmarker[*jwmarker_num].len_ready = true; /* ready */
|
jwmarker[*jwmarker_num].len_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[*jwmarker_num].pos_ready = true; /* ready */
|
jwmarker[*jwmarker_num].pos_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[*jwmarker_num].parms_ready = true; /* ready */
|
jwmarker[*jwmarker_num].parms_ready = OPJ_TRUE; /* ready */
|
||||||
jwmarker[*jwmarker_num].data_ready = false; /* not ready */
|
jwmarker[*jwmarker_num].data_ready = OPJ_FALSE; /* not ready */
|
||||||
(*jwmarker_num)++;
|
(*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) {
|
unsigned long int pre_len, unsigned long int post_len) {
|
||||||
|
|
||||||
jpwl_epb_ms_t *epb = NULL;
|
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 long int L1, L4;
|
||||||
/*unsigned char *predata_in = NULL;*/
|
/*unsigned char *predata_in = NULL;*/
|
||||||
|
|
||||||
bool insideMH = (tileno == -1);
|
opj_bool insideMH = (tileno == -1);
|
||||||
|
|
||||||
/* Alloc space */
|
/* Alloc space */
|
||||||
if (!(epb = (jpwl_epb_ms_t *) opj_malloc((size_t) 1 * sizeof (jpwl_epb_ms_t)))) {
|
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;
|
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);
|
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;
|
unsigned long int L1, L2, L3, L4;
|
||||||
int remaining;
|
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 */
|
/* some consistency check */
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no operating buffer for EPBs\n");
|
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) {
|
if (!post_buf && !L4_buf) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no operating buffer for EPBs data\n");
|
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;
|
opj_cio_t *cio = j2k->cio;
|
||||||
bool status;
|
opj_bool status;
|
||||||
static bool mh_done = false;
|
static opj_bool mh_done = OPJ_FALSE;
|
||||||
int mark_pos, id, len, skips, sot_pos;
|
int mark_pos, id, len, skips, sot_pos;
|
||||||
unsigned long int Psot = 0;
|
unsigned long int Psot = 0;
|
||||||
|
|
||||||
|
@ -592,8 +592,8 @@ bool jpwl_correct(opj_j2k_t *j2k) {
|
||||||
|
|
||||||
if (status && (mark_val == J2K_MS_EPB)) {
|
if (status && (mark_val == J2K_MS_EPB)) {
|
||||||
/* we found it! */
|
/* we found it! */
|
||||||
mh_done = true;
|
mh_done = OPJ_TRUE;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable correction in case of missing or bad head EPB */
|
/* 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 */
|
/* PATCHED: 2008-01-25 */
|
||||||
/* MOVED UP: 2008-02-01 */
|
/* MOVED UP: 2008-02-01 */
|
||||||
if (!status) {
|
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");
|
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 */
|
/* else, look if 12 positions ahead there is an EPB, in case of TPH */
|
||||||
cio_seek(cio, mark_pos);
|
cio_seek(cio, mark_pos);
|
||||||
if ((cio->bp + 12) < cio->end) {
|
if ((cio->bp + 12) < cio->end) {
|
||||||
|
@ -627,11 +627,11 @@ bool jpwl_correct(opj_j2k_t *j2k) {
|
||||||
);
|
);
|
||||||
if (status)
|
if (status)
|
||||||
/* we found it! */
|
/* we found it! */
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
|
|
||||||
/* for now, don't use this code */
|
/* for now, don't use this code */
|
||||||
|
|
||||||
|
@ -652,13 +652,13 @@ bool jpwl_correct(opj_j2k_t *j2k) {
|
||||||
);
|
);
|
||||||
if (status)
|
if (status)
|
||||||
/* we found it! */
|
/* we found it! */
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nope, no EPBs probably, or they are so damaged that we can give up */
|
/* 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 */
|
/* AN ATTEMPT OF PARSER */
|
||||||
/* NOT USED ACTUALLY */
|
/* 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) {
|
unsigned char **L4_bufp) {
|
||||||
|
|
||||||
/* Operating buffer */
|
/* 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;
|
unsigned char Depb;
|
||||||
char str1[25] = "";
|
char str1[25] = "";
|
||||||
int myconn, errnum = 0;
|
int myconn, errnum = 0;
|
||||||
bool errflag = false;
|
opj_bool errflag = OPJ_FALSE;
|
||||||
|
|
||||||
opj_cio_t *cio = j2k->cio;
|
opj_cio_t *cio = j2k->cio;
|
||||||
|
|
||||||
/* check for common errors */
|
/* check for common errors */
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "The EPB pointer is a NULL buffer\n");
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "The EPB pointer is a NULL buffer\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set bignesses */
|
/* set bignesses */
|
||||||
|
@ -800,13 +800,13 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
|
||||||
case 3:
|
case 3:
|
||||||
/* automatic setup */
|
/* automatic setup */
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Auto. setup not yet implemented\n");
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "Auto. setup not yet implemented\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* unknown type */
|
/* unknown type */
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Unknown expected EPB type\n");
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "Unknown expected EPB type\n");
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -845,11 +845,11 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
|
||||||
/*if (conn == NULL)
|
/*if (conn == NULL)
|
||||||
opj_event_msg(j2k->cinfo, EVT_WARNING,
|
opj_event_msg(j2k->cinfo, EVT_WARNING,
|
||||||
"Possible decoding error in codeword @ position #%d\n", (L1_buf - buffer) / k_pre);*/
|
"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:
|
/* we can try to safely get out from the function:
|
||||||
if we are here, either this is not an EPB or the first codeword
|
if we are here, either this is not an EPB or the first codeword
|
||||||
is too damaged to be helpful */
|
is too damaged to be helpful */
|
||||||
/*return false;*/
|
/*return OPJ_FALSE;*/
|
||||||
|
|
||||||
} else if (status == 0) {
|
} else if (status == 0) {
|
||||||
/*if (conn == NULL)
|
/*if (conn == NULL)
|
||||||
|
@ -864,8 +864,8 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
|
||||||
} else {
|
} else {
|
||||||
/*if (conn == NULL)
|
/*if (conn == NULL)
|
||||||
opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n");
|
opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n");
|
||||||
return false;*/
|
return OPJ_FALSE;*/
|
||||||
errflag = true;
|
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));*/
|
(float) errnum / ((float) n_pre * (float) L1 / (float) k_pre));*/
|
||||||
if (errflag) {
|
if (errflag) {
|
||||||
/*opj_event_msg(j2k->cinfo, EVT_INFO, "+ there were unrecoverable errors\n");*/
|
/*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);*/
|
printf("connected = %d\n", myconn);*/
|
||||||
|
|
||||||
/*cio_seek(j2k->cio, orig_pos);
|
/*cio_seek(j2k->cio, orig_pos);
|
||||||
return true;*/
|
return OPJ_TRUE;*/
|
||||||
|
|
||||||
/* post-data
|
/* post-data
|
||||||
the position of L4 buffer is at the end of currently connected EPBs
|
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 */
|
/* Do a further check here on the read parameters */
|
||||||
if (L4 > (unsigned long) cio_numbytesleft(j2k->cio))
|
if (L4 > (unsigned long) cio_numbytesleft(j2k->cio))
|
||||||
/* overflow */
|
/* overflow */
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
|
|
||||||
/* we are ready for decoding the remaining data */
|
/* we are ready for decoding the remaining data */
|
||||||
if (((Pepb & 0xF0000000) >> 28) == 1) {
|
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 {
|
} else {
|
||||||
if (conn == NULL)
|
if (conn == NULL)
|
||||||
opj_event_msg(j2k->cinfo, EVT_WARNING, "- CRC is KO (r=%d, c=%d)\n", filecrc, mycrc);
|
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 {
|
} else {
|
||||||
if (conn == NULL)
|
if (conn == NULL)
|
||||||
opj_event_msg(j2k->cinfo, EVT_WARNING, "- CRC is KO (r=%d, c=%d)\n", filecrc, mycrc);
|
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)
|
/*if (conn == NULL)
|
||||||
opj_event_msg(j2k->cinfo, EVT_WARNING,
|
opj_event_msg(j2k->cinfo, EVT_WARNING,
|
||||||
"Possible decoding error in codeword @ position #%d\n", (L4_buf - (buffer + Lepb + 2)) / k_post);*/
|
"Possible decoding error in codeword @ position #%d\n", (L4_buf - (buffer + Lepb + 2)) / k_post);*/
|
||||||
errflag = true;
|
errflag = OPJ_TRUE;
|
||||||
|
|
||||||
} else if (status == 0) {
|
} else if (status == 0) {
|
||||||
/*if (conn == NULL)
|
/*if (conn == NULL)
|
||||||
|
@ -1110,8 +1110,8 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
|
||||||
} else {
|
} else {
|
||||||
/*if (conn == NULL)
|
/*if (conn == NULL)
|
||||||
opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n");
|
opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n");
|
||||||
return false;*/
|
return OPJ_FALSE;*/
|
||||||
errflag = true;
|
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);
|
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) {
|
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);
|
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;
|
int i;
|
||||||
unsigned long int vv;
|
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;
|
double dvalue = 0.0, Omax2, tmp, TSE = 0.0, MSE, oldMSE = 0.0, PSNR, oldPSNR = 0.0;
|
||||||
unsigned short int pfpvalue;
|
unsigned short int pfpvalue;
|
||||||
unsigned long int addrmask = 0x00000000;
|
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:
|
/* sensitivity values in image info are as follows:
|
||||||
- for each tile, distotile is the starting distortion for that tile, sum of all components
|
- 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) {
|
if (esd->data) {
|
||||||
for (i = 0; i < (int) esd->svalnum; i++)
|
for (i = 0; i < (int) esd->svalnum; i++)
|
||||||
*(buf++) = esd->data[i];
|
*(buf++) = esd->data[i];
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* addressing mask */
|
/* 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 */
|
addr2 = j2k->cstr_info->main_head_end; /* end of MH */
|
||||||
/* set special dvalue for this MH */
|
/* set special dvalue for this MH */
|
||||||
dvalue = -10.0;
|
dvalue = -10.0;
|
||||||
doneMH = true; /* don't come here anymore */
|
doneMH = OPJ_TRUE; /* don't come here anymore */
|
||||||
vv--; /* wrap back loop counter */
|
vv--; /* wrap back loop counter */
|
||||||
|
|
||||||
} else if (!doneTPH) {
|
} 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;
|
addr2 = j2k->cstr_info->tile[thistile].end_header;
|
||||||
/* set special dvalue for this TPH */
|
/* set special dvalue for this TPH */
|
||||||
dvalue = -1.0;
|
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 */
|
vv--; /* wrap back loop counter */
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
doneTPH = false; /* reset TPH counter */
|
doneTPH = OPJ_FALSE; /* reset TPH counter */
|
||||||
|
|
||||||
/* write the addresses to the buffer */
|
/* write the addresses to the buffer */
|
||||||
switch (esd->ad_size) {
|
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) {
|
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;
|
int mm;
|
||||||
unsigned long int addlen;
|
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 ) {
|
if (!j2k || !jwmarker ) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "J2K handle or JPWL markers list badly allocated\n");
|
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? */
|
/* 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 */
|
/* reorder the markers list */
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
|
|
|
@ -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* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
|
||||||
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(1, sizeof(opj_dinfo_t));
|
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(1, sizeof(opj_dinfo_t));
|
||||||
if(!dinfo) return NULL;
|
if(!dinfo) return NULL;
|
||||||
dinfo->is_decompressor = true;
|
dinfo->is_decompressor = OPJ_TRUE;
|
||||||
switch(format) {
|
switch(format) {
|
||||||
case CODEC_J2K:
|
case CODEC_J2K:
|
||||||
case CODEC_JPT:
|
case CODEC_JPT:
|
||||||
|
@ -123,7 +123,7 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
|
||||||
parameters->cod_format = -1;
|
parameters->cod_format = -1;
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
parameters->jpwl_correct = false;
|
parameters->jpwl_correct = OPJ_FALSE;
|
||||||
parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
|
parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
|
||||||
parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
|
parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
|
||||||
#endif /* USE_JPWL */
|
#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* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
|
||||||
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_calloc(1, sizeof(opj_cinfo_t));
|
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_calloc(1, sizeof(opj_cinfo_t));
|
||||||
if(!cinfo) return NULL;
|
if(!cinfo) return NULL;
|
||||||
cinfo->is_decompressor = false;
|
cinfo->is_decompressor = OPJ_FALSE;
|
||||||
switch(format) {
|
switch(format) {
|
||||||
case CODEC_J2K:
|
case CODEC_J2K:
|
||||||
/* get a J2K coder handle */
|
/* get a J2K coder handle */
|
||||||
|
@ -247,7 +247,7 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *paramete
|
||||||
|
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
parameters->jpwl_epc_on = false;
|
parameters->jpwl_epc_on = OPJ_FALSE;
|
||||||
parameters->jpwl_hprot_MH = -1; /* -1 means unassigned */
|
parameters->jpwl_hprot_MH = -1; /* -1 means unassigned */
|
||||||
{
|
{
|
||||||
int i;
|
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)
|
if (index != NULL)
|
||||||
opj_event_msg((opj_common_ptr)cinfo, EVT_WARNING, "Set index to NULL when calling the opj_encode function.\n"
|
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"
|
"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);
|
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) {
|
if(cinfo && cio && image) {
|
||||||
switch(cinfo->codec_format) {
|
switch(cinfo->codec_format) {
|
||||||
case CODEC_J2K:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
||||||
|
|
|
@ -59,30 +59,9 @@ defined with this macro as being exported.
|
||||||
#endif /* OPJ_EXPORTS */
|
#endif /* OPJ_EXPORTS */
|
||||||
#endif /* !OPJ_STATIC || !_WIN32 */
|
#endif /* !OPJ_STATIC || !_WIN32 */
|
||||||
|
|
||||||
#ifndef __cplusplus
|
typedef int opj_bool;
|
||||||
#if defined(HAVE_STDBOOL_H)
|
#define OPJ_TRUE 1
|
||||||
/*
|
#define OPJ_FALSE 0
|
||||||
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 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================================================
|
==========================================================
|
||||||
|
@ -243,7 +222,7 @@ Compression parameters
|
||||||
*/
|
*/
|
||||||
typedef struct opj_cparameters {
|
typedef struct opj_cparameters {
|
||||||
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
|
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
|
||||||
bool tile_size_on;
|
opj_bool tile_size_on;
|
||||||
/** XTOsiz */
|
/** XTOsiz */
|
||||||
int cp_tx0;
|
int cp_tx0;
|
||||||
/** YTOsiz */
|
/** YTOsiz */
|
||||||
|
@ -325,7 +304,7 @@ typedef struct opj_cparameters {
|
||||||
/**@name JPWL encoding parameters */
|
/**@name JPWL encoding parameters */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** enables writing of EPC in MH, thus activating JPWL */
|
/** 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) */
|
/** error protection method for MH (0,1,16,32,37-128) */
|
||||||
int jpwl_hprot_MH;
|
int jpwl_hprot_MH;
|
||||||
/** tile number of header protection specification (>=0) */
|
/** tile number of header protection specification (>=0) */
|
||||||
|
@ -403,7 +382,7 @@ typedef struct opj_dparameters {
|
||||||
/**@name JPWL decoding parameters */
|
/**@name JPWL decoding parameters */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** activates the JPWL correction capabilities */
|
/** activates the JPWL correction capabilities */
|
||||||
bool jpwl_correct;
|
opj_bool jpwl_correct;
|
||||||
/** expected number of components */
|
/** expected number of components */
|
||||||
int jpwl_exp_comps;
|
int jpwl_exp_comps;
|
||||||
/** maximum number of tiles */
|
/** maximum number of tiles */
|
||||||
|
@ -426,7 +405,7 @@ typedef struct opj_dparameters {
|
||||||
#define opj_common_fields \
|
#define opj_common_fields \
|
||||||
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
|
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
|
||||||
void * client_data; /**< Available for use by application */\
|
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 */\
|
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
|
||||||
void *j2k_handle; /**< pointer to the J2K codec */\
|
void *j2k_handle; /**< pointer to the J2K codec */\
|
||||||
void *jp2_handle; /**< pointer to the JP2 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()
|
@param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
|
||||||
@return Returns true if successful, returns false otherwise
|
@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
|
Encode an image into a JPEG-2000 codestream and extract the codestream information
|
||||||
@param cinfo compressor handle
|
@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
|
@param cstr_info Codestream information structure if needed afterwards, NULL otherwise
|
||||||
@return Returns true if successful, returns false 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
|
Destroy Codestream information after compression or decompression
|
||||||
@param cstr_info Codestream information structure
|
@param cstr_info Codestream information structure
|
||||||
|
|
|
@ -43,31 +43,31 @@ Get next packet in layer-resolution-component-precinct order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@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.
|
Get next packet in resolution-layer-component-precinct order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@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.
|
Get next packet in resolution-precinct-component-layer order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@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.
|
Get next packet in precinct-component-resolution-layer order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@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.
|
Get next packet in component-precinct-resolution-layer order.
|
||||||
@param pi packet iterator to modify
|
@param pi packet iterator to modify
|
||||||
@return returns false if pi pointed to the last packet or else returns true
|
@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_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
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;
|
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]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
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_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
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;
|
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]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
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_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
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;
|
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]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
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_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
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;
|
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]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
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_comp_t *comp = NULL;
|
||||||
opj_pi_resolution_t *res = NULL;
|
opj_pi_resolution_t *res = NULL;
|
||||||
long index = 0;
|
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;
|
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]) {
|
if (!pi->include[index]) {
|
||||||
pi->include[index] = 1;
|
pi->include[index] = 1;
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
LABEL_SKIP:;
|
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) {
|
switch (pi->poc.prg) {
|
||||||
case LRCP:
|
case LRCP:
|
||||||
return pi_next_lrcp(pi);
|
return pi_next_lrcp(pi);
|
||||||
|
@ -720,13 +720,13 @@ bool pi_next(opj_pi_iterator_t * pi) {
|
||||||
case CPRL:
|
case CPRL:
|
||||||
return pi_next_cprl(pi);
|
return pi_next_cprl(pi);
|
||||||
case PROG_UNKNOWN:
|
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];
|
char prog[4];
|
||||||
int i;
|
int i;
|
||||||
int incr_top=1,resetX=0;
|
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);
|
case RPCL: strncpy(prog, "RPCL",4);
|
||||||
break;
|
break;
|
||||||
case PROG_UNKNOWN:
|
case PROG_UNKNOWN:
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(cp->tp_on && ((!cp->cinema && (t2_mode == FINAL_PASS)) || cp->cinema))){
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
@param cur_totnum_tp The total number of tile parts in the current tile
|
||||||
@return Returns true if an error is detected
|
@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
|
Create a packet iterator for Decoder
|
||||||
@param image Raw image for which the packets will be listed
|
@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
|
@param pi Packet iterator to modify
|
||||||
@return Returns false if pi pointed to the last packet or else returns true
|
@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);
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ static double t1_getwmsedec(
|
||||||
return wmsedec;
|
return wmsedec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool allocate_buffers(
|
static opj_bool allocate_buffers(
|
||||||
opj_t1_t *t1,
|
opj_t1_t *t1,
|
||||||
int w,
|
int w,
|
||||||
int h)
|
int h)
|
||||||
|
@ -1115,7 +1115,7 @@ static bool allocate_buffers(
|
||||||
opj_aligned_free(t1->data);
|
opj_aligned_free(t1->data);
|
||||||
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
|
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
|
||||||
if(!t1->data){
|
if(!t1->data){
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
t1->datasize=datasize;
|
t1->datasize=datasize;
|
||||||
}
|
}
|
||||||
|
@ -1128,7 +1128,7 @@ static bool allocate_buffers(
|
||||||
opj_aligned_free(t1->flags);
|
opj_aligned_free(t1->flags);
|
||||||
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
|
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
|
||||||
if(!t1->flags){
|
if(!t1->flags){
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
t1->flagssize=flagssize;
|
t1->flagssize=flagssize;
|
||||||
}
|
}
|
||||||
|
@ -1137,7 +1137,7 @@ static bool allocate_buffers(
|
||||||
t1->w=w;
|
t1->w=w;
|
||||||
t1->h=h;
|
t1->h=h;
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** mod fixed_quality */
|
/** mod fixed_quality */
|
||||||
|
|
|
@ -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;
|
int compno, resno, bandno, precno, cblkno, passno, layno;
|
||||||
double min, max;
|
double min, max;
|
||||||
double cumdisto[100]; /* fixed_quality */
|
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) {
|
if (!success) {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cstr_info) { /* Threshold for Marcela Index */
|
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]);
|
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) {
|
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;
|
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 l;
|
||||||
int compno;
|
int compno;
|
||||||
int eof = 0;
|
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) {
|
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 "
|
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);
|
" 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);
|
opj_event_msg(tcd->cinfo, EVT_INFO, "- tile decoded in %f s\n", tile_time);
|
||||||
|
|
||||||
if (eof) {
|
if (eof) {
|
||||||
return false;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return OPJ_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tcd_free_decode(opj_tcd_t *tcd) {
|
void tcd_free_decode(opj_tcd_t *tcd) {
|
||||||
|
|
|
@ -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_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
|
||||||
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
|
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
|
||||||
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
|
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
|
Encode a tile from the raw image into a buffer
|
||||||
@param tcd TCD handle
|
@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 tileno Number that identifies one of the tiles to be decoded
|
||||||
@param cstr_info Codestream information structure
|
@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
|
Free the memory allocated for decoding
|
||||||
@param tcd TCD handle
|
@param tcd TCD handle
|
||||||
|
|
Loading…
Reference in New Issue