remove deprecated v1 style function j2k_decode

This commit is contained in:
Mickael Savinaud 2012-08-09 15:13:33 +00:00
parent 71e0106846
commit a51aed7ce2
2 changed files with 0 additions and 105 deletions

View File

@ -7688,104 +7688,7 @@ void opj_j2k_setup_decoder(opj_j2k_v2_t *j2k, opj_dparameters_t *parameters)
}
}
opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *cstr_info) {
opj_image_t *image = NULL;
opj_common_ptr cinfo = j2k->cinfo;
j2k->cio = cio;
j2k->cstr_info = cstr_info;
if (cstr_info)
memset(cstr_info, 0, sizeof(opj_codestream_info_t));
/* create an empty image */
image = opj_image_create0();
j2k->image = image;
j2k->state = J2K_STATE_MHSOC;
for (;;) {
opj_dec_mstabent_t *e;
int id = cio_read(cio, 2);
#ifdef USE_JPWL
/* we try to honor JPWL correction power */
if (j2k->cp->correct) {
int orig_pos = cio_tell(cio);
opj_bool status;
/* call the corrector */
status = jpwl_correct(j2k);
/* go back to where you were */
cio_seek(cio, orig_pos - 2);
/* re-read the marker */
id = cio_read(cio, 2);
/* check whether it begins with ff */
if (id >> 8 != 0xff) {
opj_event_msg(cinfo, EVT_ERROR,
"JPWL: possible bad marker %x at %d\n",
id, cio_tell(cio) - 2);
if (!JPWL_ASSUME) {
opj_image_destroy(image);
opj_event_msg(cinfo, EVT_ERROR, "JPWL: giving up\n");
return 0;
}
/* we try to correct */
id = id | 0xff00;
cio_seek(cio, cio_tell(cio) - 2);
cio_write(cio, id, 2);
opj_event_msg(cinfo, EVT_WARNING, "- trying to adjust this\n"
"- setting marker to %x\n",
id);
}
}
#endif /* USE_JPWL */
if (id >> 8 != 0xff) {
opj_image_destroy(image);
opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
return 0;
}
e = j2k_dec_mstab_lookup(id);
/* Check if the marker is known*/
if (!(j2k->state & e->states)) {
opj_image_destroy(image);
opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
return 0;
}
/* Check if the decoding is limited to the main header*/
if (e->id == J2K_MS_SOT && j2k->cp->limit_decoding == LIMIT_TO_MAIN_HEADER) {
opj_event_msg(cinfo, EVT_INFO, "Main Header decoded.\n");
return image;
}
if (e->handler) {
(*e->handler)(j2k);
}
if (j2k->state & J2K_STATE_ERR)
return NULL;
if (j2k->state == J2K_STATE_MT) {
break;
}
if (j2k->state == J2K_STATE_NEOC) {
break;
}
}
if (j2k->state == J2K_STATE_NEOC) {
j2k_read_eoc(j2k);
}
if (j2k->state != J2K_STATE_MT) {
opj_event_msg(cinfo, EVT_WARNING, "Incomplete bitstream\n");
}
return image;
}
/*
* Read a JPT-stream and decode file

View File

@ -792,14 +792,6 @@ Decoding parameters are returned in j2k->cp.
*/
void opj_j2k_setup_decoder(opj_j2k_v2_t *j2k, opj_dparameters_t *parameters);
/**
Decode an image from a JPEG-2000 codestream
@param j2k J2K decompressor handle
@param cio Input buffer stream
@param cstr_info Codestream information structure if required, NULL otherwise
@return Returns a decoded image if successful, returns NULL otherwise
*/
opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
/**
Decode an image form a JPT-stream (JPEG 2000, JPIP)
@param j2k J2K decompressor handle