From 3bf3ce06f74078a641f76b46dbfdba39c3dd3cef Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Mon, 13 Aug 2012 08:53:17 +0000 Subject: [PATCH] remove deprecated v1 style functions : jp2_create_compress, jp2_destroy_compress, opj_jp2_encode --- libopenjpeg/jp2.c | 73 ----------------------------------------------- libopenjpeg/jp2.h | 50 +++++++++----------------------- 2 files changed, 14 insertions(+), 109 deletions(-) diff --git a/libopenjpeg/jp2.c b/libopenjpeg/jp2.c index a3d72bc4..83ed84c3 100644 --- a/libopenjpeg/jp2.c +++ b/libopenjpeg/jp2.c @@ -1740,35 +1740,6 @@ void opj_jp2_setup_decoder(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters) /* JP2 encoder interface */ /* ----------------------------------------------------------------------- */ -opj_jp2_t* jp2_create_compress(opj_common_ptr cinfo) { - opj_jp2_t *jp2 = (opj_jp2_t*)opj_malloc(sizeof(opj_jp2_t)); - if(jp2) { - jp2->cinfo = cinfo; - /* create the J2K codec */ - jp2->j2k = j2k_create_compress(cinfo); - if(jp2->j2k == NULL) { - jp2_destroy_compress(jp2); - return NULL; - } - } - return jp2; -} - -void jp2_destroy_compress(opj_jp2_t *jp2) { - if(jp2) { - /* destroy the J2K codec */ - j2k_destroy_compress(jp2->j2k); - - if(jp2->comps) { - opj_free(jp2->comps); - } - if(jp2->cl) { - opj_free(jp2->cl); - } - opj_free(jp2); - } -} - void jp2_setup_encoder( opj_jp2_v2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image, @@ -1857,50 +1828,6 @@ opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2, return j2k_encode_v2(jp2->j2k, stream, p_manager); } -opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) { - - int pos_iptr, pos_cidx, pos_jp2c, len_jp2c, len_cidx, end_pos, pos_fidx, len_fidx; - pos_jp2c = pos_iptr = -1; /* remove a warning */ - - /* JP2 encoding */ - - /* JPEG 2000 Signature box */ - jp2_write_jp(cio); - /* File Type box */ - jp2_write_ftyp(jp2, cio); - /* JP2 Header box */ - jp2_write_jp2h(jp2, cio); - - if( jp2->jpip_on){ - pos_iptr = cio_tell( cio); - cio_skip( cio, 24); /* IPTR further ! */ - - pos_jp2c = cio_tell( cio); - } - - /* J2K encoding */ - if(!(len_jp2c = jp2_write_jp2c( jp2, cio, image, cstr_info))){ - opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n"); - return OPJ_FALSE; - } - - if( jp2->jpip_on){ - pos_cidx = cio_tell( cio); - - len_cidx = write_cidx( pos_jp2c+8, cio, image, *cstr_info, len_jp2c-8); - - pos_fidx = cio_tell( cio); - len_fidx = write_fidx( pos_jp2c, len_jp2c, pos_cidx, len_cidx, cio); - - end_pos = cio_tell( cio); - - cio_seek( cio, pos_iptr); - write_iptr( pos_fidx, len_fidx, cio); - cio_seek( cio, end_pos); - } - - return OPJ_TRUE; -} /** * Ends the decompression procedures and possibiliy add data to be read after the diff --git a/libopenjpeg/jp2.h b/libopenjpeg/jp2.h index 8309c288..ee0e027b 100644 --- a/libopenjpeg/jp2.h +++ b/libopenjpeg/jp2.h @@ -39,33 +39,27 @@ #define JPIP_JPIP 0x6a706970 -#define JP2_JP 0x6a502020 /**< JPEG 2000 signature box */ -#define JP2_FTYP 0x66747970 /**< File type box */ - -#define JP2_JP2H 0x6a703268 /**< JP2 header box (super-box) */ +#define JP2_JP 0x6a502020 /**< JPEG 2000 signature box */ +#define JP2_FTYP 0x66747970 /**< File type box */ +#define JP2_JP2H 0x6a703268 /**< JP2 header box (super-box) */ #define JP2_IHDR 0x69686472 /**< Image header box */ -#define JP2_BPCC 0x62706363 /**< Bits per component box */ #define JP2_COLR 0x636f6c72 /**< Colour specification box */ +#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */ +#define JP2_URL 0x75726c20 /**< Data entry URL box */ #define JP2_PCLR 0x70636c72 /**< Palette box */ #define JP2_CMAP 0x636d6170 /**< Component Mapping box */ #define JP2_CDEF 0x63646566 /**< Channel Definition box */ -/* For the future MSD */ +#define JP2_DTBL 0x6474626c /**< Data Reference box */ +#define JP2_BPCC 0x62706363 /**< Bits per component box */ +#define JP2_JP2 0x6a703220 /**< File type fields */ + +/* For the future */ /* #define JP2_RES 0x72657320 */ /**< Resolution box (super-box) */ - -#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */ - -/* For the future MSD */ /* #define JP2_JP2I 0x6a703269 */ /**< Intellectual property box */ /* #define JP2_XML 0x786d6c20 */ /**< XML box */ /* #define JP2_UUID 0x75756994 */ /**< UUID box */ /* #define JP2_UINF 0x75696e66 */ /**< UUID info box (super-box) */ /* #define JP2_ULST 0x756c7374 */ /**< UUID list box */ -#define JP2_URL 0x75726c20 /**< Data entry URL box */ - -#define JP2_DTBL 0x6474626c /**< Data Reference box */ - -#define JP2_JP2 0x6a703220 /**< File type fields */ - /* ----------------------------------------------------------------------- */ @@ -298,17 +292,7 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2, opj_event_mgr_t * p_manager); -/** -Creates a JP2 compression structure -@param cinfo Codec context info -@return Returns a handle to a JP2 compressor if successful, returns NULL otherwise -*/ -opj_jp2_t* jp2_create_compress(opj_common_ptr cinfo); -/** -Destroy a JP2 compressor handle -@param jp2 JP2 compressor handle to destroy -*/ -void jp2_destroy_compress(opj_jp2_t *jp2); + /** Setup the encoder parameters using the current image and using user parameters. Coding parameters are returned in jp2->j2k->cp. @@ -320,15 +304,6 @@ void jp2_setup_encoder( opj_jp2_v2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image, struct opj_event_mgr * p_manager); -/** -Encode an image into a JPEG-2000 file stream -@param jp2 JP2 compressor handle -@param cio Output buffer stream -@param image Image to encode -@param cstr_info Codestream information structure if required, NULL otherwise -@return Returns true if successful, returns false otherwise -*/ -opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info); /** Encode an image into a JPEG-2000 file stream @@ -468,6 +443,9 @@ opj_bool jp2_set_decode_area( opj_jp2_v2_t *p_jp2, OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, struct opj_event_mgr * p_manager ); + /** + * + */ opj_bool jp2_get_tile( opj_jp2_v2_t *p_jp2, opj_stream_private_t *p_stream, opj_image_t* p_image,