Modifications made to enable the decoding of a J2K file headers without decoding...
[openjpeg.git] / libopenjpeg / j2k.h
index a4c4a52fb52c5472203446627c3edf9494293c67..2ebdeb2c613c9574bd145298b73d427ca645409a 100644 (file)
 
 #define J2K_MAXRLVLS 33                /* Number of maximum resolution level authorized                   */
 #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  */
@@ -79,7 +82,6 @@ typedef struct {
   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;
@@ -125,19 +127,21 @@ typedef struct {
   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 JPEG2000_format;         /* 0: J2K   1:JP2 */
   int intermed_file;           /* 1: Store each encoded tile one by one in the output file (for mega-Images)*/
-  int image_type;              /* 0: PNM, PGM, PPM 1: PGX           */
+  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                */
@@ -148,6 +152,7 @@ typedef struct {
   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;
@@ -179,6 +184,7 @@ typedef struct {
   int Im_w, Im_h;              /* Image width and Height                                */
   int Prog;                    /* progression order                                     */
   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                                       */
@@ -207,8 +213,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 +226,9 @@ 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);
+
+void j2k_dec_release();//antonin
 
 #endif