Adapted the JPWL and OPJViewer code to new interface; fixed a samll bug in JPWL which...
[openjpeg.git] / jpwl / jpwl.c
index f97331d4be7f7d62f37b66dbe66f28298fcda69f..7a307839976dbba24a4eac6bb7d7976f468948d1 100644 (file)
@@ -232,7 +232,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                        unsigned long int left_THmarks_len;\r
 \r
                        /******* sot_pos = j2k->cstr_info->tile[tileno].start_pos; */\r
-                       sot_pos = j2k->cstr_info->tile[tileno].tp_start_pos[tpno];\r
+                       sot_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos;\r
                        cio_seek(cio, sot_pos + 2); \r
                        sot_len = cio_read(cio, 2); /* SOT Len */\r
                        cio_skip(cio, 2);\r
@@ -240,7 +240,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                        Psot = cio_read(cio, 4); /* tile length */\r
 \r
                        /******* post_sod_pos = j2k->cstr_info->tile[tileno].end_header + 1; */\r
-                       post_sod_pos = j2k->cstr_info->tile[tileno].tp_end_header[tpno] + 1;\r
+                       post_sod_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_end_header + 1;\r
                        left_THmarks_len = post_sod_pos - sot_pos;\r
 \r
                        /* add all the lengths of the markers which are len-ready and stay within SOT and SOD */\r
@@ -282,7 +282,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                                                jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */\r
                                                jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */\r
                                                /****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */\r
-                                               jwmarker[jwmarker_num].pos = soc_pos + j2k->cstr_info->tile[tileno].tp_start_pos[tpno] + sot_len + 2; /* after SOT */\r
+                                               jwmarker[jwmarker_num].pos = soc_pos + j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */\r
                                                jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */\r
                                                jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */\r
                                                jwmarker[jwmarker_num].len_ready = true; /* ready, yet */\r
@@ -403,12 +403,12 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                        int sot_len, Psot, Psotp, mm, epb_index = 0, prot_len = 0;\r
                        unsigned long sot_pos, post_sod_pos;\r
                        unsigned long int left_THmarks_len, epbs_len = 0;\r
-                       int startpack = 0, stoppack = j2k->cstr_info->num;\r
+                       int startpack = 0, stoppack = j2k->cstr_info->packno;\r
                        int first_tp_pack, last_tp_pack;\r
                        jpwl_epb_ms_t *tph_epb = NULL;\r
 \r
                        /****** sot_pos = j2k->cstr_info->tile[tileno].start_pos; */\r
-                       sot_pos = j2k->cstr_info->tile[tileno].tp_start_pos[tpno];\r
+                       sot_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos;\r
                        cio_seek(cio, sot_pos + 2); \r
                        sot_len = cio_read(cio, 2); /* SOT Len */\r
                        cio_skip(cio, 2);\r
@@ -417,7 +417,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
 \r
                        /* a-priori length of the data dwelling between SOT and SOD */\r
                        /****** post_sod_pos = j2k->cstr_info->tile[tileno].end_header + 1; */\r
-                       post_sod_pos = j2k->cstr_info->tile[tileno].tp_end_header[tpno] + 1;\r
+                       post_sod_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_end_header + 1;\r
                        left_THmarks_len = post_sod_pos - (sot_pos + sot_len + 2);\r
 \r
                        /* add all the lengths of the JPWL markers which are len-ready and stay within SOT and SOD */\r
@@ -458,7 +458,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                                                jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */\r
                                                jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */\r
                                                /****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */\r
-                                               jwmarker[jwmarker_num].pos = soc_pos + j2k->cstr_info->tile[tileno].tp_start_pos[tpno] + sot_len + 2; /* after SOT */\r
+                                               jwmarker[jwmarker_num].pos = soc_pos + j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */\r
                                                jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */\r
                                                jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */\r
                                                jwmarker[jwmarker_num].len_ready = true; /* ready */\r
@@ -493,9 +493,9 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                        startpack = 0;\r
                        /* EPB MSs for UEP packet data protection in Tile Parts */\r
                        /****** for (packno = 0; packno < j2k->cstr_info->num; packno++) { */\r
-                       first_tp_pack = (tpno > 0) ? (first_tp_pack + j2k->cstr_info->tile[tileno].tp_num[tpno - 1]) : 0;\r
-                       last_tp_pack = first_tp_pack + j2k->cstr_info->tile[tileno].tp_num[tpno] - 1;\r
-                       for (packno = 0; packno < j2k->cstr_info->tile[tileno].tp_num[tpno]; packno++) {\r
+                       first_tp_pack = (tpno > 0) ? (first_tp_pack + j2k->cstr_info->tile[tileno].tp[tpno - 1].tp_numpacks) : 0;\r
+                       last_tp_pack = first_tp_pack + j2k->cstr_info->tile[tileno].tp[tpno].tp_numpacks - 1;\r
+                       for (packno = 0; packno < j2k->cstr_info->tile[tileno].tp[tpno].tp_numpacks; packno++) {\r
 \r
                                /******** if ((packspec < JPWL_MAX_NO_PACKSPECS) &&\r
                                        (j2k->cp->pprot_tileno[packspec] == tileno) && (j2k->cp->pprot_packno[packspec] == packno)) { */\r
@@ -547,7 +547,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                                                        &epb_index, /* pointer to EPB index */\r
                                                        pprot, /* protection type */\r
                                                        /****** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001, */ /* position */\r
-                                                       (double) (j2k->cstr_info->tile[tileno].tp_start_pos[tpno] + sot_len + 2) + 0.0001, /* position */\r
+                                                       (double) (j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2) + 0.0001, /* position */\r
                                                        tileno, /* number of tile */\r
                                                        0, /* length of pre-data */\r
                                                        prot_len /*4000*/ /* length of post-data */\r
@@ -607,7 +607,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                                                        &epb_index, /* pointer to EPB index */\r
                                                        pprot, /* protection type */\r
                                                        /***** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001,*/ /* position */\r
-                                                       (double) (j2k->cstr_info->tile[tileno].tp_start_pos[tpno] + sot_len + 2) + 0.0001, /* position */\r
+                                                       (double) (j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2) + 0.0001, /* position */\r
                                                        tileno, /* number of tile */\r
                                                        0, /* length of pre-data */\r
                                                        prot_len /*4000*/ /* length of post-data */\r