diff options
| author | Antonin Descampe <antonin@gmail.com> | 2004-07-13 14:37:11 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2004-07-13 14:37:11 +0000 |
| commit | de5a22aea053d3934536ee3ff5d2f7b2f706d045 (patch) | |
| tree | 91e0b034affe1ae8b98a06a6e12b1665b2cb7a7f /libopenjpeg | |
| parent | bc563fc5ba6e0369dc7da995e971b7077f4788a5 (diff) | |
Structure j2k_option_t deleted and option "-reduce" integrated to j2k_cp_t.
Parameters changed for j2k_decode, jp2_decode, j2k_decode_jpt_stream
Diffstat (limited to 'libopenjpeg')
| -rw-r--r-- | libopenjpeg/j2k.c | 24 | ||||
| -rw-r--r-- | libopenjpeg/j2k.h | 14 | ||||
| -rw-r--r-- | libopenjpeg/jp2.c | 8 | ||||
| -rw-r--r-- | libopenjpeg/jp2.h | 2 |
4 files changed, 19 insertions, 29 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 93d3001c..e510dac6 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -1408,8 +1408,9 @@ j2k_dec_mstabent_t *j2k_dec_mstab_lookup(int id) return e; } -LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t ** img, - j2k_cp_t ** cp, j2k_option_t option) + +LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t * img, + j2k_cp_t * cp) { if (setjmp(j2k_error)) { @@ -1420,13 +1421,8 @@ LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t ** img, return cio_numbytes(); } - j2k_img = (j2k_image_t *) malloc(sizeof(j2k_image_t)); - j2k_cp = (j2k_cp_t *) malloc(sizeof(j2k_cp_t)); - *img = j2k_img; - *cp = j2k_cp; - /* Option */ - j2k_cp->reduce_on = option.reduce_on; - j2k_cp->reduce_value = option.reduce_value; + j2k_img = img; + j2k_cp = cp; j2k_state = J2K_STATE_MHSOC; cio_init(src, len); @@ -1460,8 +1456,8 @@ LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t ** img, * Read a JPT-stream and decode file * */ -int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t ** img, - j2k_cp_t ** cp) +int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t * img, + j2k_cp_t * cp) { jpt_msg_header_struct_t header; int position; @@ -1474,10 +1470,8 @@ int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t ** img, return cio_numbytes(); } - j2k_img = (j2k_image_t *) malloc(sizeof(j2k_image_t)); - j2k_cp = (j2k_cp_t *) malloc(sizeof(j2k_cp_t)); - *img = j2k_img; - *cp = j2k_cp; + j2k_img = img; + j2k_cp = cp; j2k_state = J2K_STATE_MHSOC; cio_init(src, len); diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h index a4c4a52f..06343f1b 100644 --- a/libopenjpeg/j2k.h +++ b/libopenjpeg/j2k.h @@ -59,11 +59,6 @@ #define J2K_CCP_QNTSTY_SEQNT 2 typedef struct { - int reduce_on; /* option reduce is used if reduce = 1 */ - int reduce_value; /* if option reduce is used -> original dimension divided by 2^value */ -} j2k_option_t; - -typedef struct { int dx, dy; /* XRsiz, YRsiz */ int w, h; /* width and height of data */ int x0, y0; /* offset of the component compare to the whole image */ @@ -207,8 +202,9 @@ LIBJ2K_API int j2k_encode(j2k_image_t * i, j2k_cp_t * cp, char *output, * i: decode image * cp: coding parameters that were used to encode the image */ -LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t ** img, - j2k_cp_t ** cp, j2k_option_t option); + +LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t * img, + j2k_cp_t * cp); /* @@ -219,7 +215,7 @@ LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t ** img, * cp: coding parameters that were used to encode the image * */ -int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t ** img, - j2k_cp_t ** cp); +int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t * img, + j2k_cp_t * cp); #endif diff --git a/libopenjpeg/jp2.c b/libopenjpeg/jp2.c index d6d5c139..6f13f4d7 100644 --- a/libopenjpeg/jp2.c +++ b/libopenjpeg/jp2.c @@ -445,7 +445,7 @@ int jp2_write_jp2c(j2k_image_t * img, j2k_cp_t * cp, char *jp2_buffer, } int jp2_read_jp2c(unsigned char *src, int len, jp2_struct_t * jp2_struct, - j2k_cp_t ** cp, j2k_option_t option) + j2k_cp_t * cp) { jp2_box_t box; @@ -457,7 +457,7 @@ int jp2_read_jp2c(unsigned char *src, int len, jp2_struct_t * jp2_struct, src += cio_tell(); - if (j2k_decode(src, len, &jp2_struct->image, cp, option) == 0) { + if (j2k_decode(src, len, jp2_struct->image, cp) == 0) { fprintf(stderr, "JP2F box: failed to decode J2K bitstream image!\n"); return 1; } @@ -509,7 +509,7 @@ int jp2_read_jp() } int jp2_decode(unsigned char *src, int len, jp2_struct_t * jp2_struct, - j2k_cp_t ** cp, j2k_option_t option) + j2k_cp_t * cp) { cio_init(src, len); @@ -519,7 +519,7 @@ int jp2_decode(unsigned char *src, int len, jp2_struct_t * jp2_struct, return 1; if (jp2_read_jp2h(jp2_struct)) return 1; - if (jp2_read_jp2c(src, len, jp2_struct, cp, option)) + if (jp2_read_jp2c(src, len, jp2_struct, cp)) return 1; return 0; } diff --git a/libopenjpeg/jp2.h b/libopenjpeg/jp2.h index 87b8d75e..867c45ae 100644 --- a/libopenjpeg/jp2.h +++ b/libopenjpeg/jp2.h @@ -74,6 +74,6 @@ int jp2_encode(jp2_struct_t * jp2_struct, j2k_cp_t * cp, char *output, char *index); int jp2_decode(unsigned char *src, int len, jp2_struct_t * jp2_struct, - j2k_cp_t ** cp, j2k_option_t option); + j2k_cp_t * cp); #endif |
