#define __J2K_H
#define J2K_MAXRLVLS 33 /* Number of maximum resolution level authorized */
-#define J2K_MAXBANDS (3*J2K_MAXRLVLS+1) /* Number of maximum sub-band linked to number of resolution level */
+#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /* Number of maximum sub-band linked to number of resolution level */
+#define J2K_CFMT 0
+#define JP2_CFMT 1
+#define JPT_CFMT 2
+#define MJ2_CFMT 3
+#define PXM_DFMT 0
+#define PGX_DFMT 1
+#define BMP_DFMT 2
+#define YUV_DFMT 3
#define J2K_CP_CSTY_PRT 0x01
#define J2K_CP_CSTY_SOP 0x02
#define J2K_CCP_QNTSTY_SIQNT 1
#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; /* XOsiz, YOsiz */
int x1, y1; /* Xsiz, Ysiz */
int numcomps; /* number of components */
- int index_on; /* 0 = no index || 1 = index */
+ int color_space; /* sRGB, Greyscale or YUV */
j2k_comp_t *comps; /* image-components */
} j2k_image_t;
int cblksty; /* code-block coding style */
int qmfbid; /* discrete wavelet transform identifier */
int qntsty; /* quantisation style */
- j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantisation */
+ j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantization */
int numgbits; /* number of guard bits */
int roishift; /* Region Of Interest shift */
int prcw[J2K_MAXRLVLS]; /* Precinct width */
unsigned char *ppt_data; /* packet header store there for futur use in t2_decode_packet */
int ppt; /* If ppt == 1 --> there was a PPT marker for the present tile */
int ppt_store; /* Use in case of multiple marker PPT (number of info already store) */
+ int ppt_len; /* ppmbug1 */
float distoratio[100]; /* add fixed_quality */
j2k_tccp_t *tccps; /* tile-component coding parameters */
} j2k_tcp_t;
typedef struct {
- int image_type; /* 0: PNM, PGM, PPM 1: PGX */
+ int intermed_file; /* 1: Store each encoded tile one by one in the output file (for mega-Images)*/
+ int decod_format; /* 0: PGX, 1: PxM, 2: BMP */
+ int cod_format; /* 0: J2K, 1: JP2, 2: JPT */
int disto_alloc; /* Allocation by rate/distortion */
int fixed_alloc; /* Allocation by fixed layer */
int fixed_quality; /* add fixed_quality */
- int reduce_on; /* option reduce is used if reduce = 1 */
- int reduce_value; /* if option reduce is used -> original dimension divided by 2^value */
+ int reduce; /* if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */
+ int layer; /* if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
+ int index_on; /* 0 = no index || 1 = index */
int tx0, ty0; /* XTOsiz, YTOsiz */
int tdx, tdy; /* XTsiz, YTsiz */
char *comment; /* comment for coding */
int ppm; /* If ppm == 1 --> there was a PPM marker for the present tile */
int ppm_store; /* Use in case of multiple marker PPM (number of info already store) */
int ppm_previous; /* Use in case of multiple marker PPM (case on non-finished previous info) */
+ int ppm_len; /* ppmbug1 */
j2k_tcp_t *tcps; /* tile coding parameters */
int *matrice; /* Fixed layer */
} j2k_cp_t;
int end_header; /* End position of the header */
int end_pos; /* End position */
int pw[33], ph[33]; /* precinct number for each resolution level */
+
int pdx[33], pdy[33]; /* precinct size (in power of 2), in X and Y for each resolution level */
info_packet *packet; /* information concerning packets inside tile */
int nbpix; /* add fixed_quality */
int index_write; /* writing the packet inthe index with t2_encode_packets */
int Im_w, Im_h; /* Image width and Height */
int Prog; /* progression order */
- int Tile_x, Tile_y; /* Number of Tile in X and Y */
- int tw, th;
+ int Tile_x, Tile_y; /* Tile size in x and y */
+ int Tile_Ox, Tile_Oy;
+ int tw, th; /* Number of Tile in X and Y */
int Comp; /* Component numbers */
int Layer; /* number of layer */
int Decomposition; /* number of decomposition */
- //int pw, ph; /* nombre precinct in X and Y */
- //int pdx, pdy; /* size of precinct in X and Y */
int Main_head_end; /* Main header position */
int codestream_size; /* codestream's size */
info_tile *tile; /* information concerning tiles inside image */
* Encode an image into a JPEG-2000 codestream
* i: image to encode
* cp: coding parameters
- * dest: destination buffer
+ * output: destination buffer or name of the output file when cp->intermed_file==1
* len: length of destination buffer
* index : index file name
*/
-LIBJ2K_API int j2k_encode(j2k_image_t * i, j2k_cp_t * cp, char *outfile,
+LIBJ2K_API int j2k_encode(j2k_image_t * i, j2k_cp_t * cp, char *output,
int len, char *index);
/* LIBJ2K_API int j2k_encode(j2k_image_t *i, j2k_cp_t *cp,unsigned char *dest, int len); */
* 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);
/*
* 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);
+
+void j2k_dec_release();//antonin
#endif