remove deprecated v1 style function j2k_add_mhmarker; rename j2k_add_mhmarker_v2...
[openjpeg.git] / libopenjpeg / jpwl / jpwl.c
index b3e191a25bb84d363d017bbe788e65b415390e11..db8cfa3f7b997831998a63505e8aa6a10b832175 100644 (file)
@@ -168,8 +168,8 @@ void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, i
 
        /* expand the list? */
        if ((cstr_info->marknum + 1) > cstr_info->maxmarknum) {
-               cstr_info->maxmarknum = 100 + (int) ((float) cstr_info->maxmarknum * 1.0F);
-               cstr_info->marker = (opj_marker_info_t*)opj_realloc(cstr_info->marker, cstr_info->maxmarknum);
+               cstr_info->maxmarknum += 100;
+               cstr_info->marker = (opj_marker_info_t*)opj_realloc(cstr_info->marker, cstr_info->maxmarknum * sizeof(opj_marker_info_t));
        }
 
        /* add the marker */
@@ -191,6 +191,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
        jpwl_epb_ms_t *epb_mark;
        jpwl_epc_ms_t *epc_mark;
        jpwl_esd_ms_t *esd_mark;
+  (void)image;
 
        /* find (SOC + SIZ) length */
        /* I assume SIZ is always the first marker after SOC */
@@ -405,7 +406,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
 
                /* add all the lengths of the markers which are len-ready and stay within SOC and SOT */
                for (mm = 0; mm < jwmarker_num; mm++) {
-                       if ((jwmarker[mm].pos >=0) && (jwmarker[mm].pos < sot_pos)) {
+                       if ( jwmarker[mm].pos < sot_pos) { /* jwmarker[mm].pos >=0 since ulong */
                                if (jwmarker[mm].len_ready)
                                        left_MHmarks_len += jwmarker[mm].len + 2;
                                else {
@@ -632,7 +633,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
                                        pprot = j2k->cp->pprot[packspec++];
                                }
 
-                               //printf("Tile %02d, pack %02d ==> %d\n", tileno, packno, pprot);
+                               /*printf("Tile %02d, pack %02d ==> %d\n", tileno, packno, pprot);*/
                
                        }
 
@@ -717,6 +718,7 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
        unsigned char *jpwl_buf, *orig_buf;
        unsigned long int orig_pos;
        double epbcoding_time = 0.0, esdcoding_time = 0.0;
+  (void)image;
 
        /* Order JPWL markers according to their wishlist position */
        qsort((void *) jwmarker, (size_t) jwmarker_num, sizeof (jpwl_marker_t), jpwl_markcomp);
@@ -953,6 +955,7 @@ void j2k_read_epc(opj_j2k_t *j2k) {
        cio_seek(cio, Lepcp + Lepc);  
 }
 
+#if 0
 void j2k_write_epc(opj_j2k_t *j2k) {
 
        unsigned long int DL, Lepcp, Pcrcp, l;
@@ -1013,6 +1016,7 @@ void j2k_write_epc(opj_j2k_t *j2k) {
        j2k_add_marker(j2k->cstr_info, J2K_MS_EPC, Lepcp - 2, Lepc + 2);
 
 }
+#endif
 
 void j2k_read_epb(opj_j2k_t *j2k) {
        unsigned long int LDPepb, Pepb;
@@ -1282,6 +1286,10 @@ opj_bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
                }
        }
 
+#else
+  (void)j2k;
+  (void)tcd;
+  (void)tileno;
 #endif
 
        return OPJ_TRUE;