+typedef struct opj_cp_v2
+{
+ /** Size of the image in bits*/
+ /*int img_size;*/
+ /** Rsiz*/
+ OPJ_RSIZ_CAPABILITIES rsiz;
+ /** XTOsiz */
+ OPJ_UINT32 tx0; // MSD see norm
+ /** YTOsiz */
+ OPJ_UINT32 ty0; // MSD see norm
+ /** XTsiz */
+ OPJ_UINT32 tdx;
+ /** YTsiz */
+ OPJ_UINT32 tdy;
+ /** comment */
+ OPJ_CHAR *comment;
+ /** number of tiles in width */
+ OPJ_UINT32 tw;
+ /** number of tiles in heigth */
+ OPJ_UINT32 th;
+
+
+
+
+ /** packet header store there for futur use in t2_decode_packet */
+ OPJ_BYTE *ppm_data;
+ /** size of the ppm_data*/
+ OPJ_UINT32 ppm_len;
+ /** size of the ppm_data*/
+ OPJ_UINT32 ppm_data_read;
+
+ OPJ_BYTE *ppm_data_current;
+
+ /** packet header storage original buffer */
+ OPJ_BYTE *ppm_buffer;
+ /** pointer remaining on the first byte of the first header if ppm is used */
+ OPJ_BYTE *ppm_data_first;
+ /** Number of bytes actually stored inside the ppm_data */
+ OPJ_UINT32 ppm_data_size;
+ /** use in case of multiple marker PPM (number of info already store) */
+ OPJ_INT32 ppm_store;
+ /** use in case of multiple marker PPM (case on non-finished previous info) */
+ OPJ_INT32 ppm_previous;
+
+ /** tile coding parameters */
+ opj_tcp_v2_t *tcps;
+ union
+ {
+ opj_decoding_param_t m_dec;
+ opj_encoding_param_t m_enc;
+ }
+ m_specific_param;
+
+
+/* UniPG>> */
+#ifdef USE_JPWL
+ /** enables writing of EPC in MH, thus activating JPWL */
+ opj_bool epc_on;
+ /** enables writing of EPB, in case of activated JPWL */
+ opj_bool epb_on;
+ /** enables writing of ESD, in case of activated JPWL */
+ opj_bool esd_on;
+ /** enables writing of informative techniques of ESD, in case of activated JPWL */
+ opj_bool info_on;
+ /** enables writing of RED, in case of activated JPWL */
+ opj_bool red_on;
+ /** error protection method for MH (0,1,16,32,37-128) */
+ int hprot_MH;
+ /** tile number of header protection specification (>=0) */
+ int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
+ /** error protection methods for TPHs (0,1,16,32,37-128) */
+ int hprot_TPH[JPWL_MAX_NO_TILESPECS];
+ /** tile number of packet protection specification (>=0) */
+ int pprot_tileno[JPWL_MAX_NO_PACKSPECS];
+ /** packet number of packet protection specification (>=0) */
+ int pprot_packno[JPWL_MAX_NO_PACKSPECS];
+ /** error protection methods for packets (0,1,16,32,37-128) */
+ int pprot[JPWL_MAX_NO_PACKSPECS];
+ /** enables writing of ESD, (0/2/4 bytes) */
+ int sens_size;
+ /** sensitivity addressing size (0=auto/2/4 bytes) */
+ int sens_addr;
+ /** sensitivity range (0-3) */
+ int sens_range;
+ /** sensitivity method for MH (-1,0-7) */
+ int sens_MH;
+ /** tile number of sensitivity specification (>=0) */
+ int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
+ /** sensitivity methods for TPHs (-1,0-7) */
+ int sens_TPH[JPWL_MAX_NO_TILESPECS];
+ /** enables JPWL correction at the decoder */
+ opj_bool correct;
+ /** expected number of components at the decoder */
+ int exp_comps;
+ /** maximum number of tiles at the decoder */
+ int max_tiles;
+#endif /* USE_JPWL */
+
+ /******** FLAGS *********/
+ /** if ppm == 1 --> there was a PPM marker*/
+ OPJ_UINT32 ppm : 1;
+ /** tells if the parameter is a coding or decoding one */
+ OPJ_UINT32 m_is_decoder : 1;
+/* <<UniPG */
+} opj_cp_v2_t;
+
+
+typedef struct opj_j2k_dec
+{
+ /** locate in which part of the codestream the decoder is (main header, tile header, end) */
+ OPJ_UINT32 m_state;
+ /**
+ * store decoding parameters common to all tiles (information like COD, COC in main header)
+ */
+ opj_tcp_v2_t *m_default_tcp;
+ OPJ_BYTE *m_header_data;
+ OPJ_UINT32 m_header_data_size;
+ /** to tell the tile part length */
+ OPJ_UINT32 m_sot_length;
+ /** Only tiles index in the correct range will be decoded.*/
+ OPJ_UINT32 m_start_tile_x;
+ OPJ_UINT32 m_start_tile_y;
+ OPJ_UINT32 m_end_tile_x;
+ OPJ_UINT32 m_end_tile_y;
+ /** to tell that a tile can be decoded. */
+ OPJ_UINT32 m_can_decode : 1;
+ OPJ_UINT32 m_discard_tiles : 1;
+ OPJ_UINT32 m_skip_data : 1;
+
+} opj_j2k_dec_t;
+
+typedef struct opj_j2k_enc
+{
+ /** Tile part number, regardless of poc, for each new poc, tp is reset to 1*/
+ OPJ_UINT32 m_current_poc_tile_part_number; // tp_num
+
+ /** Tile part number currently coding, taking into account POC. m_current_tile_part_number holds the total number of tile parts while encoding the last tile part.*/
+ OPJ_UINT32 m_current_tile_part_number; //cur_tp_num
+
+ /**
+ locate the start position of the TLM marker
+ after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length.
+ */
+ OPJ_SIZE_T m_tlm_start;
+ /**
+ * Stores the sizes of the tlm.
+ */
+ OPJ_BYTE * m_tlm_sot_offsets_buffer;
+ /**
+ * The current offset of the tlm buffer.
+ */
+ OPJ_BYTE * m_tlm_sot_offsets_current;
+
+ /** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/
+ /** used in TLMmarker*/
+ OPJ_UINT32 m_total_tile_parts; // totnum_tp
+
+ /* encoded data for a tile */
+ OPJ_BYTE * m_encoded_tile_data;
+
+ /* size of the encoded_data */
+ OPJ_UINT32 m_encoded_tile_size;
+
+ /* encoded data for a tile */
+ OPJ_BYTE * m_header_tile_data;
+
+ /* size of the encoded_data */
+ OPJ_UINT32 m_header_tile_data_size;
+
+
+} opj_j2k_enc_t;