From a51aed7ce282d99c79dae456dde92f7919dfc182 Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Thu, 9 Aug 2012 15:13:33 +0000 Subject: [PATCH] remove deprecated v1 style function j2k_decode --- libopenjpeg/j2k.c | 97 ----------------------------------------------- libopenjpeg/j2k.h | 8 ---- 2 files changed, 105 deletions(-) diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 509b627f..3f94d24a 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -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 diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h index 2658f699..439477b5 100644 --- a/libopenjpeg/j2k.h +++ b/libopenjpeg/j2k.h @@ -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