]> granicus.if.org Git - openjpeg/commitdiff
[trunk] rename int.h to opj_intmath.h and rename all its functions with opj_ prefix
authorMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 5 Oct 2012 09:10:15 +0000 (09:10 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 5 Oct 2012 09:10:15 +0000 (09:10 +0000)
src/lib/openjp2/dwt.c
src/lib/openjp2/image.c
src/lib/openjp2/j2k.c
src/lib/openjp2/mct.c
src/lib/openjp2/opj_includes.h
src/lib/openjp2/opj_intmath.h [moved from src/lib/openjp2/int.h with 77% similarity]
src/lib/openjp2/pi.c
src/lib/openjp2/t1.c
src/lib/openjp2/t1_generate_luts.c
src/lib/openjp2/t2.c
src/lib/openjp2/tcd.c

index 3b750fe86af77aae97e4382ed8c8b6a620921a8b..a94f21bb3eefe6568b17360d01a6f90adfcb7822 100644 (file)
@@ -331,40 +331,40 @@ void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 c
        if (!cas) {
                if ((dn > 0) || (sn > 1)) {     /* NEW :  CASE ONE ELEMENT */
                        for (i = 0; i < dn; i++)
-                               D(i) -= fix_mul(S_(i) + S_(i + 1), 12993);
+                               D(i) -= opj_int_fix_mul(S_(i) + S_(i + 1), 12993);
                        for (i = 0; i < sn; i++)
-                               S(i) -= fix_mul(D_(i - 1) + D_(i), 434);
+                               S(i) -= opj_int_fix_mul(D_(i - 1) + D_(i), 434);
                        for (i = 0; i < dn; i++)
-                               D(i) += fix_mul(S_(i) + S_(i + 1), 7233);
+                               D(i) += opj_int_fix_mul(S_(i) + S_(i + 1), 7233);
                        for (i = 0; i < sn; i++)
-                               S(i) += fix_mul(D_(i - 1) + D_(i), 3633);
+                               S(i) += opj_int_fix_mul(D_(i - 1) + D_(i), 3633);
                        for (i = 0; i < dn; i++)
-                               D(i) = fix_mul(D(i), 5038);     /*5038 */
+                               D(i) = opj_int_fix_mul(D(i), 5038);     /*5038 */
                        for (i = 0; i < sn; i++)
-                               S(i) = fix_mul(S(i), 6659);     /*6660 */
+                               S(i) = opj_int_fix_mul(S(i), 6659);     /*6660 */
                }
        } else {
                if ((sn > 0) || (dn > 1)) {     /* NEW :  CASE ONE ELEMENT */
                        for (i = 0; i < dn; i++)
-                               S(i) -= fix_mul(DD_(i) + DD_(i - 1), 12993);
+                               S(i) -= opj_int_fix_mul(DD_(i) + DD_(i - 1), 12993);
                        for (i = 0; i < sn; i++)
-                               D(i) -= fix_mul(SS_(i) + SS_(i + 1), 434);
+                               D(i) -= opj_int_fix_mul(SS_(i) + SS_(i + 1), 434);
                        for (i = 0; i < dn; i++)
-                               S(i) += fix_mul(DD_(i) + DD_(i - 1), 7233);
+                               S(i) += opj_int_fix_mul(DD_(i) + DD_(i - 1), 7233);
                        for (i = 0; i < sn; i++)
-                               D(i) += fix_mul(SS_(i) + SS_(i + 1), 3633);
+                               D(i) += opj_int_fix_mul(SS_(i) + SS_(i + 1), 3633);
                        for (i = 0; i < dn; i++)
-                               S(i) = fix_mul(S(i), 5038);     /*5038 */
+                               S(i) = opj_int_fix_mul(S(i), 5038);     /*5038 */
                        for (i = 0; i < sn; i++)
-                               D(i) = fix_mul(D(i), 6659);     /*6660 */
+                               D(i) = opj_int_fix_mul(D(i), 6659);     /*6660 */
                }
        }
 }
 
 void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
        OPJ_INT32 p, n;
-       p = int_floorlog2(stepsize) - 13;
-       n = 11 - int_floorlog2(stepsize);
+       p = opj_int_floorlog2(stepsize) - 13;
+       n = 11 - opj_int_floorlog2(stepsize);
        bandno_stepsize->mant = (n < 0 ? stepsize >> -n : stepsize << n) & 0x7ff;
        bandno_stepsize->expn = numbps - p;
 }
@@ -857,17 +857,17 @@ void opj_v4dwt_decode(v4dwt_t* restrict dwt)
 #ifdef __SSE__
        opj_v4dwt_decode_step1_sse(dwt->wavelet+a, dwt->sn, _mm_set1_ps(opj_K));
        opj_v4dwt_decode_step1_sse(dwt->wavelet+b, dwt->dn, _mm_set1_ps(opj_c13318));
-       opj_v4dwt_decode_step2_sse(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, int_min(dwt->sn, dwt->dn-a), _mm_set1_ps(opj_dwt_delta));
-       opj_v4dwt_decode_step2_sse(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, int_min(dwt->dn, dwt->sn-b), _mm_set1_ps(opj_dwt_gamma));
-       opj_v4dwt_decode_step2_sse(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, int_min(dwt->sn, dwt->dn-a), _mm_set1_ps(opj_dwt_beta));
-       opj_v4dwt_decode_step2_sse(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, int_min(dwt->dn, dwt->sn-b), _mm_set1_ps(opj_dwt_alpha));
+       opj_v4dwt_decode_step2_sse(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, opj_int_min(dwt->sn, dwt->dn-a), _mm_set1_ps(opj_dwt_delta));
+       opj_v4dwt_decode_step2_sse(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, opj_int_min(dwt->dn, dwt->sn-b), _mm_set1_ps(opj_dwt_gamma));
+       opj_v4dwt_decode_step2_sse(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, opj_int_min(dwt->sn, dwt->dn-a), _mm_set1_ps(opj_dwt_beta));
+       opj_v4dwt_decode_step2_sse(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, opj_int_min(dwt->dn, dwt->sn-b), _mm_set1_ps(opj_dwt_alpha));
 #else
        opj_v4dwt_decode_step1(dwt->wavelet+a, dwt->sn, opj_K);
        opj_v4dwt_decode_step1(dwt->wavelet+b, dwt->dn, opj_c13318);
-       opj_v4dwt_decode_step2(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, int_min(dwt->sn, dwt->dn-a), opj_dwt_delta);
-       opj_v4dwt_decode_step2(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, int_min(dwt->dn, dwt->sn-b), opj_dwt_gamma);
-       opj_v4dwt_decode_step2(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, int_min(dwt->sn, dwt->dn-a), opj_dwt_beta);
-       opj_v4dwt_decode_step2(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, int_min(dwt->dn, dwt->sn-b), opj_dwt_alpha);
+       opj_v4dwt_decode_step2(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, opj_int_min(dwt->sn, dwt->dn-a), opj_dwt_delta);
+       opj_v4dwt_decode_step2(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, opj_int_min(dwt->dn, dwt->sn-b), opj_dwt_gamma);
+       opj_v4dwt_decode_step2(dwt->wavelet+b, dwt->wavelet+a+1, dwt->sn, opj_int_min(dwt->sn, dwt->dn-a), opj_dwt_beta);
+       opj_v4dwt_decode_step2(dwt->wavelet+a, dwt->wavelet+b+1, dwt->dn, opj_int_min(dwt->dn, dwt->sn-b), opj_dwt_alpha);
 #endif
 }
 
index c9ae82166e77ba537529e3015f0cfb163dd2e56d..abf1df4be2d7a7346da2830189a2645f8e5b255c 100644 (file)
@@ -106,19 +106,19 @@ void opj_image_comp_header_update(opj_image_t * p_image_header, const struct opj
        OPJ_INT32 l_comp_x0, l_comp_y0, l_comp_x1, l_comp_y1;
        opj_image_comp_t* l_img_comp = NULL;
 
-       l_x0 = int_max(p_cp->tx0 , p_image_header->x0);
-       l_y0 = int_max(p_cp->ty0 , p_image_header->y0);
-       l_x1 = int_min(p_cp->tx0 + p_cp->tw * p_cp->tdx, p_image_header->x1);
-       l_y1 = int_min(p_cp->ty0 + p_cp->th * p_cp->tdy, p_image_header->y1);
+       l_x0 = opj_int_max(p_cp->tx0 , p_image_header->x0);
+       l_y0 = opj_int_max(p_cp->ty0 , p_image_header->y0);
+       l_x1 = opj_int_min(p_cp->tx0 + p_cp->tw * p_cp->tdx, p_image_header->x1);
+       l_y1 = opj_int_min(p_cp->ty0 + p_cp->th * p_cp->tdy, p_image_header->y1);
 
        l_img_comp = p_image_header->comps;
        for     (i = 0; i < p_image_header->numcomps; ++i) {
-               l_comp_x0 = int_ceildiv(l_x0, l_img_comp->dx);
-               l_comp_y0 = int_ceildiv(l_y0, l_img_comp->dy);
-               l_comp_x1 = int_ceildiv(l_x1, l_img_comp->dx);
-               l_comp_y1 = int_ceildiv(l_y1, l_img_comp->dy);
-               l_width = int_ceildivpow2(l_comp_x1 - l_comp_x0, l_img_comp->factor);
-               l_height = int_ceildivpow2(l_comp_y1 - l_comp_y0, l_img_comp->factor);
+               l_comp_x0 = opj_int_ceildiv(l_x0, l_img_comp->dx);
+               l_comp_y0 = opj_int_ceildiv(l_y0, l_img_comp->dy);
+               l_comp_x1 = opj_int_ceildiv(l_x1, l_img_comp->dx);
+               l_comp_y1 = opj_int_ceildiv(l_y1, l_img_comp->dy);
+               l_width = opj_int_ceildivpow2(l_comp_x1 - l_comp_x0, l_img_comp->factor);
+               l_height = opj_int_ceildivpow2(l_comp_y1 - l_comp_y0, l_img_comp->factor);
                l_img_comp->w = l_width;
                l_img_comp->h = l_height;
                l_img_comp->x0 = l_comp_x0/*l_x0*/;
index f706e828aa1686bce2fc527225fdfd249669e9c5..2bb6c52fbcd2e35f4b76f102388d62449cb379fc 100644 (file)
@@ -2031,16 +2031,16 @@ static opj_bool opj_j2k_read_siz(opj_j2k_v2_t *p_j2k,
         }
 
         /* Compute the number of tiles */
-        l_cp->tw = int_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
-        l_cp->th = int_ceildiv(l_image->y1 - l_cp->ty0, l_cp->tdy);
+        l_cp->tw = opj_int_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
+        l_cp->th = opj_int_ceildiv(l_image->y1 - l_cp->ty0, l_cp->tdy);
         l_nb_tiles = l_cp->tw * l_cp->th;
 
         /* Define the tiles which will be decoded */
         if (p_j2k->m_specific_param.m_decoder.m_discard_tiles) {
                 p_j2k->m_specific_param.m_decoder.m_start_tile_x = (p_j2k->m_specific_param.m_decoder.m_start_tile_x - l_cp->tx0) / l_cp->tdx;
                 p_j2k->m_specific_param.m_decoder.m_start_tile_y = (p_j2k->m_specific_param.m_decoder.m_start_tile_y - l_cp->ty0) / l_cp->tdy;
-                p_j2k->m_specific_param.m_decoder.m_end_tile_x = int_ceildiv((p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0), l_cp->tdx);
-                p_j2k->m_specific_param.m_decoder.m_end_tile_y = int_ceildiv((p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0), l_cp->tdy);
+                p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_int_ceildiv((p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0), l_cp->tdx);
+                p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_int_ceildiv((p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0), l_cp->tdy);
         }
         else {
                 p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
@@ -2505,7 +2505,7 @@ OPJ_UINT32 opj_j2k_get_max_coc_size(opj_j2k_v2_t *p_j2k)
 
         for (i=0;i<l_nb_tiles;++i) {
                 for (j=0;j<l_nb_comp;++j) {
-                        l_max = uint_max(l_max,opj_j2k_get_SPCod_SPCoc_size(p_j2k,i,j));
+                        l_max = opj_uint_max(l_max,opj_j2k_get_SPCod_SPCoc_size(p_j2k,i,j));
                 }
         }
 
@@ -2957,9 +2957,9 @@ void opj_j2k_write_poc_in_memory(   opj_j2k_v2_t *p_j2k,
                 ++l_current_data;
 
                 /* change the value of the max layer according to the actual number of layers in the file, components and resolutions*/
-                l_current_poc->layno1 = int_min(l_current_poc->layno1, l_tcp->numlayers);
-                l_current_poc->resno1 = int_min(l_current_poc->resno1, l_tccp->numresolutions);
-                l_current_poc->compno1 = int_min(l_current_poc->compno1, l_nb_comp);
+                l_current_poc->layno1 = opj_int_min(l_current_poc->layno1, l_tcp->numlayers);
+                l_current_poc->resno1 = opj_int_min(l_current_poc->resno1, l_tccp->numresolutions);
+                l_current_poc->compno1 = opj_int_min(l_current_poc->compno1, l_nb_comp);
 
                 ++l_current_poc;
         }
@@ -2978,7 +2978,7 @@ OPJ_UINT32 opj_j2k_get_max_poc_size(opj_j2k_v2_t *p_j2k)
         l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
 
         for (i=0;i<l_nb_tiles;++i) {
-                l_max_poc = uint_max(l_max_poc,l_tcp->numpocs);
+                l_max_poc = opj_uint_max(l_max_poc,l_tcp->numpocs);
                 ++l_tcp;
         }
 
@@ -2998,7 +2998,7 @@ OPJ_UINT32 opj_j2k_get_max_toc_size (opj_j2k_v2_t *p_j2k)
         l_nb_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th ;
 
         for (i=0;i<l_nb_tiles;++i) {
-                l_max = uint_max(l_max,l_tcp->m_nb_tile_parts);
+                l_max = opj_uint_max(l_max,l_tcp->m_nb_tile_parts);
 
                 ++l_tcp;
         }
@@ -3103,7 +3103,7 @@ static opj_bool opj_j2k_read_poc (  opj_j2k_v2_t *p_j2k,
                 ++p_header_data;
                 l_current_poc->prg = (OPJ_PROG_ORDER) l_tmp;
                 /* make sure comp is in acceptable bounds */
-                l_current_poc->compno1 = uint_min(l_current_poc->compno1, l_nb_comp);
+                l_current_poc->compno1 = opj_uint_min(l_current_poc->compno1, l_nb_comp);
                 ++l_current_poc;
         }
 
@@ -4466,10 +4466,10 @@ opj_bool opj_j2k_update_rates(  opj_j2k_v2_t *p_j2k,
                         OPJ_FLOAT32 l_offset = ((*l_tp_stride_func)(l_tcp)) / l_tcp->numlayers;
 
                         /* 4 borders of the tile rescale on the image if necessary */
-                        l_x0 = int_max(l_cp->tx0 + j * l_cp->tdx, l_image->x0);
-                        l_y0 = int_max(l_cp->ty0 + i * l_cp->tdy, l_image->y0);
-                        l_x1 = int_min(l_cp->tx0 + (j + 1) * l_cp->tdx, l_image->x1);
-                        l_y1 = int_min(l_cp->ty0 + (i + 1) * l_cp->tdy, l_image->y1);
+                        l_x0 = opj_int_max(l_cp->tx0 + j * l_cp->tdx, l_image->x0);
+                        l_y0 = opj_int_max(l_cp->ty0 + i * l_cp->tdy, l_image->y0);
+                        l_x1 = opj_int_min(l_cp->tx0 + (j + 1) * l_cp->tdx, l_image->x1);
+                        l_y1 = opj_int_min(l_cp->ty0 + (i + 1) * l_cp->tdy, l_image->y1);
 
                         l_rates = l_tcp->rates;
 
@@ -4550,9 +4550,9 @@ opj_bool opj_j2k_update_rates(  opj_j2k_v2_t *p_j2k,
         l_tile_size = 0;
 
         for (i=0;i<l_image->numcomps;++i) {
-                l_tile_size += (        uint_ceildiv(l_cp->tdx,l_img_comp->dx)
+                l_tile_size += (        opj_uint_ceildiv(l_cp->tdx,l_img_comp->dx)
                                                         *
-                                                        uint_ceildiv(l_cp->tdy,l_img_comp->dy)
+                                                        opj_uint_ceildiv(l_cp->tdy,l_img_comp->dy)
                                                         *
                                                         l_img_comp->prec
                                                 );
@@ -5778,8 +5778,8 @@ void opj_j2k_setup_encoder(     opj_j2k_v2_t *p_j2k,
         */
 
         if (parameters->tile_size_on) {
-                cp->tw = int_ceildiv(image->x1 - cp->tx0, cp->tdx);
-                cp->th = int_ceildiv(image->y1 - cp->ty0, cp->tdy);
+                cp->tw = opj_int_ceildiv(image->x1 - cp->tx0, cp->tdx);
+                cp->th = opj_int_ceildiv(image->y1 - cp->ty0, cp->tdy);
         } else {
                 cp->tdx = image->x1 - cp->tx0;
                 cp->tdy = image->y1 - cp->ty0;
@@ -5956,8 +5956,8 @@ void opj_j2k_setup_encoder(     opj_j2k_v2_t *p_j2k,
 
                         tccp->csty = parameters->csty & 0x01;   /* 0 => one precinct || 1 => custom precinct  */
                         tccp->numresolutions = parameters->numresolution;
-                        tccp->cblkw = int_floorlog2(parameters->cblockw_init);
-                        tccp->cblkh = int_floorlog2(parameters->cblockh_init);
+                        tccp->cblkw = opj_int_floorlog2(parameters->cblockw_init);
+                        tccp->cblkh = opj_int_floorlog2(parameters->cblockh_init);
                         tccp->cblksty = parameters->mode;
                         tccp->qmfbid = parameters->irreversible ? 0 : 1;
                         tccp->qntsty = parameters->irreversible ? J2K_CCP_QNTSTY_SEQNT : J2K_CCP_QNTSTY_NOQNT;
@@ -5987,13 +5987,13 @@ void opj_j2k_setup_encoder(     opj_j2k_v2_t *p_j2k,
                                                         if (parameters->prcw_init[p] < 1) {
                                                                 tccp->prcw[it_res] = 1;
                                                         } else {
-                                                                tccp->prcw[it_res] = int_floorlog2(parameters->prcw_init[p]);
+                                                                tccp->prcw[it_res] = opj_int_floorlog2(parameters->prcw_init[p]);
                                                         }
 
                                                         if (parameters->prch_init[p] < 1) {
                                                                 tccp->prch[it_res] = 1;
                                                         }else {
-                                                                tccp->prch[it_res] = int_floorlog2(parameters->prch_init[p]);
+                                                                tccp->prch[it_res] = opj_int_floorlog2(parameters->prch_init[p]);
                                                         }
 
                                                 } else {
@@ -6004,13 +6004,13 @@ void opj_j2k_setup_encoder(     opj_j2k_v2_t *p_j2k,
                                                         if (size_prcw < 1) {
                                                                 tccp->prcw[it_res] = 1;
                                                         } else {
-                                                                tccp->prcw[it_res] = int_floorlog2(size_prcw);
+                                                                tccp->prcw[it_res] = opj_int_floorlog2(size_prcw);
                                                         }
 
                                                         if (size_prch < 1) {
                                                                 tccp->prch[it_res] = 1;
                                                         } else {
-                                                                tccp->prch[it_res] = int_floorlog2(size_prch);
+                                                                tccp->prch[it_res] = opj_int_floorlog2(size_prch);
                                                         }
                                                 }
                                                 p++;
@@ -7320,8 +7320,8 @@ opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj
                 l_height_src = (l_res->y1 - l_res->y0);
 
                 /* Border of the current output component*/
-                l_x0_dest = int_ceildivpow2(l_img_comp_dest->x0, l_img_comp_dest->factor);
-                l_y0_dest = int_ceildivpow2(l_img_comp_dest->y0, l_img_comp_dest->factor);
+                l_x0_dest = opj_int_ceildivpow2(l_img_comp_dest->x0, l_img_comp_dest->factor);
+                l_y0_dest = opj_int_ceildivpow2(l_img_comp_dest->y0, l_img_comp_dest->factor);
                 l_x1_dest = l_x0_dest + l_img_comp_dest->w;
                 l_y1_dest = l_y0_dest + l_img_comp_dest->h;
 
@@ -7604,7 +7604,7 @@ opj_bool opj_j2k_set_decode_area(       opj_j2k_v2_t *p_j2k,
                 p_image->x1 = l_image->x1;
         }
         else {
-                p_j2k->m_specific_param.m_decoder.m_end_tile_x = int_ceildiv((p_end_x - l_cp->tx0), l_cp->tdx);
+                p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_int_ceildiv((p_end_x - l_cp->tx0), l_cp->tdx);
                 p_image->x1 = p_end_x;
         }
 
@@ -7623,7 +7623,7 @@ opj_bool opj_j2k_set_decode_area(       opj_j2k_v2_t *p_j2k,
                 p_image->y1 = l_image->y1;
         }
         else{
-                p_j2k->m_specific_param.m_decoder.m_end_tile_y = int_ceildiv((p_end_y - l_cp->ty0), l_cp->tdy);
+                p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_int_ceildiv((p_end_y - l_cp->ty0), l_cp->tdy);
                 p_image->y1 = p_end_y;
         }
         /* ----- */
@@ -7635,13 +7635,13 @@ opj_bool opj_j2k_set_decode_area(       opj_j2k_v2_t *p_j2k,
         {
                 OPJ_INT32 l_h,l_w;
 
-                l_img_comp->x0 = int_ceildiv(p_image->x0, l_img_comp->dx);
-                l_img_comp->y0 = int_ceildiv(p_image->y0, l_img_comp->dy);
-                l_comp_x1 = int_ceildiv(p_image->x1, l_img_comp->dx);
-                l_comp_y1 = int_ceildiv(p_image->y1, l_img_comp->dy);
+                l_img_comp->x0 = opj_int_ceildiv(p_image->x0, l_img_comp->dx);
+                l_img_comp->y0 = opj_int_ceildiv(p_image->y0, l_img_comp->dy);
+                l_comp_x1 = opj_int_ceildiv(p_image->x1, l_img_comp->dx);
+                l_comp_y1 = opj_int_ceildiv(p_image->y1, l_img_comp->dy);
 
-                l_w = int_ceildivpow2(l_comp_x1, l_img_comp->factor)
-                                - int_ceildivpow2(l_img_comp->x0, l_img_comp->factor);
+                l_w = opj_int_ceildivpow2(l_comp_x1, l_img_comp->factor)
+                                - opj_int_ceildivpow2(l_img_comp->x0, l_img_comp->factor);
                 if (l_w < 0){
                         opj_event_msg_v2(p_manager, EVT_ERROR,
                                 "Size x of the decoded component image is incorrect (comp[%d].w=%d).\n",
@@ -7650,8 +7650,8 @@ opj_bool opj_j2k_set_decode_area(       opj_j2k_v2_t *p_j2k,
                 }
                 l_img_comp->w = l_w;
 
-                l_h = int_ceildivpow2(l_comp_y1, l_img_comp->factor)
-                                - int_ceildivpow2(l_img_comp->y0, l_img_comp->factor);
+                l_h = opj_int_ceildivpow2(l_comp_y1, l_img_comp->factor)
+                                - opj_int_ceildivpow2(l_img_comp->y0, l_img_comp->factor);
                 if (l_h < 0){
                         opj_event_msg_v2(p_manager, EVT_ERROR,
                                 "Size y of the decoded component image is incorrect (comp[%d].h=%d).\n",
@@ -8932,13 +8932,13 @@ opj_bool opj_j2k_get_tile(      opj_j2k_v2_t *p_j2k,
 
                 l_img_comp->factor = p_j2k->m_private_image->comps[compno].factor;
 
-                l_img_comp->x0 = int_ceildiv(p_image->x0, l_img_comp->dx);
-                l_img_comp->y0 = int_ceildiv(p_image->y0, l_img_comp->dy);
-                l_comp_x1 = int_ceildiv(p_image->x1, l_img_comp->dx);
-                l_comp_y1 = int_ceildiv(p_image->y1, l_img_comp->dy);
+                l_img_comp->x0 = opj_int_ceildiv(p_image->x0, l_img_comp->dx);
+                l_img_comp->y0 = opj_int_ceildiv(p_image->y0, l_img_comp->dy);
+                l_comp_x1 = opj_int_ceildiv(p_image->x1, l_img_comp->dx);
+                l_comp_y1 = opj_int_ceildiv(p_image->y1, l_img_comp->dy);
 
-                l_img_comp->w = int_ceildivpow2(l_comp_x1, l_img_comp->factor) - int_ceildivpow2(l_img_comp->x0, l_img_comp->factor);
-                l_img_comp->h = int_ceildivpow2(l_comp_y1, l_img_comp->factor) - int_ceildivpow2(l_img_comp->y0, l_img_comp->factor);
+                l_img_comp->w = opj_int_ceildivpow2(l_comp_x1, l_img_comp->factor) - opj_int_ceildivpow2(l_img_comp->x0, l_img_comp->factor);
+                l_img_comp->h = opj_int_ceildivpow2(l_comp_y1, l_img_comp->factor) - opj_int_ceildivpow2(l_img_comp->y0, l_img_comp->factor);
 
                 l_img_comp++;
         }
@@ -9171,9 +9171,9 @@ void opj_j2k_get_tile_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data)
 
                 l_width = (l_tilec->x1 - l_tilec->x0);
                 l_height = (l_tilec->y1 - l_tilec->y0);
-                l_offset_x = int_ceildiv(l_image->x0, l_img_comp->dx);
-                l_offset_y = int_ceildiv(l_image->y0, l_img_comp->dy);
-                l_image_width = int_ceildiv(l_image->x1 - l_image->x0, l_img_comp->dx);
+                l_offset_x = opj_int_ceildiv(l_image->x0, l_img_comp->dx);
+                l_offset_y = opj_int_ceildiv(l_image->y0, l_img_comp->dy);
+                l_image_width = opj_int_ceildiv(l_image->x1 - l_image->x0, l_img_comp->dx);
                 l_stride = l_image_width - l_width;
                 l_src_ptr = l_img_comp->data + (l_tilec->x0 - l_offset_x) + (l_tilec->y0 - l_offset_y) * l_image_width;
 
index 75066c9ff99b59b13facfe242cb5bf6ac35fdeaa..59664241873cfa6e1665226087486d89b7543b94 100644 (file)
@@ -122,9 +122,9 @@ void opj_mct_encode_real(
                OPJ_INT32 r = c0[i];
                OPJ_INT32 g = c1[i];
                OPJ_INT32 b = c2[i];
-               OPJ_INT32 y =  fix_mul(r, 2449) + fix_mul(g, 4809) + fix_mul(b, 934);
-               OPJ_INT32 u = -fix_mul(r, 1382) - fix_mul(g, 2714) + fix_mul(b, 4096);
-               OPJ_INT32 v =  fix_mul(r, 4096) - fix_mul(g, 3430) - fix_mul(b, 666);
+               OPJ_INT32 y =  opj_int_fix_mul(r, 2449) + opj_int_fix_mul(g, 4809) + opj_int_fix_mul(b, 934);
+               OPJ_INT32 u = -opj_int_fix_mul(r, 1382) - opj_int_fix_mul(g, 2714) + opj_int_fix_mul(b, 4096);
+               OPJ_INT32 v =  opj_int_fix_mul(r, 4096) - opj_int_fix_mul(g, 3430) - opj_int_fix_mul(b, 666);
                c0[i] = y;
                c1[i] = u;
                c2[i] = v;
@@ -238,7 +238,7 @@ opj_bool opj_mct_encode_custom(
                for (j=0;j<pNbComp;++j) {
                        *(lData[j]) = 0;
                        for (k=0;k<pNbComp;++k) {
-                               *(lData[j]) += fix_mul(*lMctPtr, lCurrentData[k]);
+                               *(lData[j]) += opj_int_fix_mul(*lMctPtr, lCurrentData[k]);
                                ++lMctPtr;
                        }
 
index 472db3d2fa190d6bf3fb753fb416646990f7b00d..b58763412c847ddd4d91cdfeb013338260affe0f 100644 (file)
@@ -167,7 +167,7 @@ static INLINE long lrintf(float f){
 #include "dwt.h"
 #include "t2.h"
 #include "mct.h"
-#include "int.h"
+#include "opj_intmath.h"
 
 #include "cidx_manager.h"
 #include "indexbox_manager.h"
similarity index 77%
rename from src/lib/openjp2/int.h
rename to src/lib/openjp2/opj_intmath.h
index 6d71b105e3401022c9de76799e1db6a8f05721b7..94512afc71ed5b3c8e20f595147d0ba3b5758994 100644 (file)
 #ifndef __INT_H
 #define __INT_H
 /**
-@file int.h
+@file opj_intmath.h
 @brief Implementation of operations on integers (INT)
 
-The functions in INT.H have for goal to realize operations on integers.
+The functions in OPJ_INTMATH.H have for goal to realize operations on integers.
 */
 
-/** @defgroup INT INT - Implementation of operations on integers */
+/** @defgroup OPJ_INTMATH OPJ_INTMATH - Implementation of operations on integers */
 /*@{*/
 
 /** @name Exported functions (see also openjpeg.h) */
@@ -47,7 +47,7 @@ The functions in INT.H have for goal to realize operations on integers.
 Get the minimum of two integers
 @return Returns a if a < b else b
 */
-static INLINE OPJ_INT32 int_min(OPJ_INT32 a, OPJ_INT32 b) {
+static INLINE OPJ_INT32 opj_int_min(OPJ_INT32 a, OPJ_INT32 b) {
        return a < b ? a : b;
 }
 
@@ -55,7 +55,7 @@ static INLINE OPJ_INT32 int_min(OPJ_INT32 a, OPJ_INT32 b) {
 Get the minimum of two integers
 @return Returns a if a < b else b
 */
-static INLINE OPJ_UINT32 uint_min(OPJ_UINT32 a, OPJ_UINT32 b) {
+static INLINE OPJ_UINT32 opj_uint_min(OPJ_UINT32 a, OPJ_UINT32 b) {
        return a < b ? a : b;
 }
 
@@ -63,7 +63,7 @@ static INLINE OPJ_UINT32 uint_min(OPJ_UINT32 a, OPJ_UINT32 b) {
 Get the maximum of two integers
 @return Returns a if a > b else b
 */
-static INLINE OPJ_INT32 int_max(OPJ_INT32 a, OPJ_INT32 b) {
+static INLINE OPJ_INT32 opj_int_max(OPJ_INT32 a, OPJ_INT32 b) {
        return (a > b) ? a : b;
 }
 
@@ -71,7 +71,7 @@ static INLINE OPJ_INT32 int_max(OPJ_INT32 a, OPJ_INT32 b) {
 Get the maximum of two integers
 @return Returns a if a > b else b
 */
-static INLINE OPJ_UINT32 uint_max(OPJ_UINT32  a, OPJ_UINT32  b) {
+static INLINE OPJ_UINT32 opj_uint_max(OPJ_UINT32  a, OPJ_UINT32  b) {
        return (a > b) ? a : b;
 }
 
@@ -84,7 +84,7 @@ Clamp an integer inside an interval
 <li>Returns min if (a < min) 
 </ul>
 */
-static INLINE OPJ_INT32 int_clamp(OPJ_INT32 a, OPJ_INT32 min, OPJ_INT32 max) {
+static INLINE OPJ_INT32 opj_int_clamp(OPJ_INT32 a, OPJ_INT32 min, OPJ_INT32 max) {
        if (a < min)
                return min;
        if (a > max)
@@ -94,14 +94,14 @@ static INLINE OPJ_INT32 int_clamp(OPJ_INT32 a, OPJ_INT32 min, OPJ_INT32 max) {
 /**
 @return Get absolute value of integer
 */
-static INLINE OPJ_INT32 int_abs(OPJ_INT32 a) {
+static INLINE OPJ_INT32 opj_int_abs(OPJ_INT32 a) {
        return a < 0 ? -a : a;
 }
 /**
 Divide an integer and round upwards
 @return Returns a divided by b
 */
-static INLINE OPJ_INT32 int_ceildiv(OPJ_INT32 a, OPJ_INT32 b) {
+static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b) {
        return (a + b - 1) / b;
 }
 
@@ -109,7 +109,7 @@ static INLINE OPJ_INT32 int_ceildiv(OPJ_INT32 a, OPJ_INT32 b) {
 Divide an integer and round upwards
 @return Returns a divided by b
 */
-static INLINE OPJ_UINT32  uint_ceildiv(OPJ_UINT32  a, OPJ_UINT32  b) {
+static INLINE OPJ_UINT32  opj_uint_ceildiv(OPJ_UINT32  a, OPJ_UINT32  b) {
        return (a + b - 1) / b;
 }
 
@@ -117,21 +117,21 @@ static INLINE OPJ_UINT32  uint_ceildiv(OPJ_UINT32  a, OPJ_UINT32  b) {
 Divide an integer by a power of 2 and round upwards
 @return Returns a divided by 2^b
 */
-static INLINE OPJ_INT32 int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
+static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
        return (a + (1 << b) - 1) >> b;
 }
 /**
 Divide an integer by a power of 2 and round downwards
 @return Returns a divided by 2^b
 */
-static INLINE OPJ_INT32 int_floordivpow2(OPJ_INT32 a, OPJ_INT32 b) {
+static INLINE OPJ_INT32 opj_int_floordivpow2(OPJ_INT32 a, OPJ_INT32 b) {
        return a >> b;
 }
 /**
 Get logarithm of an integer and round downwards
 @return Returns log2(a)
 */
-static INLINE OPJ_INT32 int_floorlog2(OPJ_INT32 a) {
+static INLINE OPJ_INT32 opj_int_floorlog2(OPJ_INT32 a) {
        OPJ_INT32 l;
        for (l = 0; a > 1; l++) {
                a >>= 1;
@@ -142,7 +142,7 @@ static INLINE OPJ_INT32 int_floorlog2(OPJ_INT32 a) {
 Get logarithm of an integer and round downwards
 @return Returns log2(a)
 */
-static INLINE OPJ_UINT32  uint_floorlog2(OPJ_UINT32  a) {
+static INLINE OPJ_UINT32  opj_uint_floorlog2(OPJ_UINT32  a) {
        OPJ_UINT32  l;
        for (l = 0; a > 1; ++l)
        {
@@ -157,10 +157,10 @@ Multiply two fixed-precision rational numbers.
 @param b
 @return Returns a * b
 */
-static INLINE OPJ_INT32 fix_mul(OPJ_INT32 a, OPJ_INT32 b) {
+static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) {
     OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
     temp += temp & 4096;
-    return (int) (temp >> 13) ;
+    return (OPJ_INT32) (temp >> 13) ;
 }
 
 /* ----------------------------------------------------------------------- */
index 79a1f538c21703abc5934bf6e6adf873deb8638e..fb85b7005601136efe06651fabf4a71317cce89b 100644 (file)
@@ -321,8 +321,8 @@ opj_bool opj_pi_next_rpcl(opj_pi_iterator_t * pi) {
                                res = &comp->resolutions[resno];
                                dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
                                dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
-                               pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
-                               pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
+                               pi->dx = !pi->dx ? dx : opj_int_min(pi->dx, dx);
+                               pi->dy = !pi->dy ? dy : opj_int_min(pi->dy, dy);
                        }
                }
        }
@@ -347,10 +347,10 @@ if (!pi->tp_on){
                                        }
                                        res = &comp->resolutions[pi->resno];
                                        levelno = comp->numresolutions - 1 - pi->resno;
-                                       trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
-                                       try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
-                                       trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);
-                                       try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
+                                       trx0 = opj_int_ceildiv(pi->tx0, comp->dx << levelno);
+                                       try0 = opj_int_ceildiv(pi->ty0, comp->dy << levelno);
+                                       trx1 = opj_int_ceildiv(pi->tx1, comp->dx << levelno);
+                                       try1 = opj_int_ceildiv(pi->ty1, comp->dy << levelno);
                                        rpx = res->pdx + levelno;
                                        rpy = res->pdy + levelno;
                                        if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
@@ -364,10 +364,10 @@ if (!pi->tp_on){
                                        
                                        if ((trx0==trx1)||(try0==try1)) continue;
                                        
-                                       prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx)
-                                                - int_floordivpow2(trx0, res->pdx);
-                                       prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy)
-                                                - int_floordivpow2(try0, res->pdy);
+                                       prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, comp->dx << levelno), res->pdx)
+                                                - opj_int_floordivpow2(trx0, res->pdx);
+                                       prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, comp->dy << levelno), res->pdy)
+                                                - opj_int_floordivpow2(try0, res->pdy);
                                        pi->precno = prci + prcj * res->pw;
                                        for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
                                                index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
@@ -405,8 +405,8 @@ opj_bool opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
                                res = &comp->resolutions[resno];
                                dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
                                dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
-                               pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
-                               pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
+                               pi->dx = !pi->dx ? dx : opj_int_min(pi->dx, dx);
+                               pi->dy = !pi->dy ? dy : opj_int_min(pi->dy, dy);
                        }
                }
        }
@@ -420,7 +420,7 @@ opj_bool opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
                for (pi->x = pi->poc.tx0; pi->x < pi->poc.tx1; pi->x += pi->dx - (pi->x % pi->dx)) {
                        for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
                                comp = &pi->comps[pi->compno];
-                               for (pi->resno = pi->poc.resno0; pi->resno < uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
+                               for (pi->resno = pi->poc.resno0; pi->resno < opj_uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
                                        OPJ_UINT32 levelno;
                                        OPJ_INT32 trx0, try0;
                                        OPJ_INT32 trx1, try1;
@@ -428,10 +428,10 @@ opj_bool opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
                                        OPJ_INT32 prci, prcj;
                                        res = &comp->resolutions[pi->resno];
                                        levelno = comp->numresolutions - 1 - pi->resno;
-                                       trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
-                                       try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
-                                       trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);
-                                       try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
+                                       trx0 = opj_int_ceildiv(pi->tx0, comp->dx << levelno);
+                                       try0 = opj_int_ceildiv(pi->ty0, comp->dy << levelno);
+                                       trx1 = opj_int_ceildiv(pi->tx1, comp->dx << levelno);
+                                       try1 = opj_int_ceildiv(pi->ty1, comp->dy << levelno);
                                        rpx = res->pdx + levelno;
                                        rpy = res->pdy + levelno;
                                        if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
@@ -445,10 +445,10 @@ opj_bool opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
                                        
                                        if ((trx0==trx1)||(try0==try1)) continue;
                                        
-                                       prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx)
-                                                - int_floordivpow2(trx0, res->pdx);
-                                       prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy)
-                                                - int_floordivpow2(try0, res->pdy);
+                                       prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, comp->dx << levelno), res->pdx)
+                                                - opj_int_floordivpow2(trx0, res->pdx);
+                                       prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, comp->dy << levelno), res->pdy)
+                                                - opj_int_floordivpow2(try0, res->pdy);
                                        pi->precno = prci + prcj * res->pw;
                                        for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
                                                index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
@@ -488,8 +488,8 @@ opj_bool opj_pi_next_cprl(opj_pi_iterator_t * pi) {
                        res = &comp->resolutions[resno];
                        dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
                        dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
-                       pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
-                       pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
+                       pi->dx = !pi->dx ? dx : opj_int_min(pi->dx, dx);
+                       pi->dy = !pi->dy ? dy : opj_int_min(pi->dy, dy);
                }
                if (!pi->tp_on){
                        pi->poc.ty0 = pi->ty0;
@@ -499,7 +499,7 @@ opj_bool opj_pi_next_cprl(opj_pi_iterator_t * pi) {
                }
                for (pi->y = pi->poc.ty0; pi->y < pi->poc.ty1; pi->y += pi->dy - (pi->y % pi->dy)) {
                        for (pi->x = pi->poc.tx0; pi->x < pi->poc.tx1; pi->x += pi->dx - (pi->x % pi->dx)) {
-                               for (pi->resno = pi->poc.resno0; pi->resno < uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
+                               for (pi->resno = pi->poc.resno0; pi->resno < opj_uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
                                        OPJ_UINT32 levelno;
                                        OPJ_INT32 trx0, try0;
                                        OPJ_INT32 trx1, try1;
@@ -507,10 +507,10 @@ opj_bool opj_pi_next_cprl(opj_pi_iterator_t * pi) {
                                        OPJ_INT32 prci, prcj;
                                        res = &comp->resolutions[pi->resno];
                                        levelno = comp->numresolutions - 1 - pi->resno;
-                                       trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
-                                       try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
-                                       trx1 = int_ceildiv(pi->tx1, comp->dx << levelno);
-                                       try1 = int_ceildiv(pi->ty1, comp->dy << levelno);
+                                       trx0 = opj_int_ceildiv(pi->tx0, comp->dx << levelno);
+                                       try0 = opj_int_ceildiv(pi->ty0, comp->dy << levelno);
+                                       trx1 = opj_int_ceildiv(pi->tx1, comp->dx << levelno);
+                                       try1 = opj_int_ceildiv(pi->ty1, comp->dy << levelno);
                                        rpx = res->pdx + levelno;
                                        rpy = res->pdy + levelno;
                                        if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
@@ -524,10 +524,10 @@ opj_bool opj_pi_next_cprl(opj_pi_iterator_t * pi) {
                                        
                                        if ((trx0==trx1)||(try0==try1)) continue;
                                        
-                                       prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx)
-                                                - int_floordivpow2(trx0, res->pdx);
-                                       prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy)
-                                                - int_floordivpow2(try0, res->pdy);
+                                       prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, comp->dx << levelno), res->pdx)
+                                                - opj_int_floordivpow2(trx0, res->pdx);
+                                       prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, comp->dy << levelno), res->pdy)
+                                                - opj_int_floordivpow2(try0, res->pdy);
                                        pi->precno = prci + prcj * res->pw;
                                        for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
                                                index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
@@ -582,10 +582,10 @@ void opj_get_encoding_parameters( const opj_image_t *p_image,
        q = p_tileno / p_cp->tw;
 
        /* find extent of tile */
-       *p_tx0 = int_max(p_cp->tx0 + p * p_cp->tdx, p_image->x0);
-       *p_tx1 = int_min(p_cp->tx0 + (p + 1) * p_cp->tdx, p_image->x1);
-       *p_ty0 = int_max(p_cp->ty0 + q * p_cp->tdy, p_image->y0);
-       *p_ty1 = int_min(p_cp->ty0 + (q + 1) * p_cp->tdy, p_image->y1);
+       *p_tx0 = opj_int_max(p_cp->tx0 + p * p_cp->tdx, p_image->x0);
+       *p_tx1 = opj_int_min(p_cp->tx0 + (p + 1) * p_cp->tdx, p_image->x1);
+       *p_ty0 = opj_int_max(p_cp->ty0 + q * p_cp->tdy, p_image->y0);
+       *p_ty1 = opj_int_min(p_cp->ty0 + (q + 1) * p_cp->tdy, p_image->y1);
 
        /* max precision is 0 (can only grow) */
        *p_max_prec = 0;
@@ -605,10 +605,10 @@ void opj_get_encoding_parameters( const opj_image_t *p_image,
                OPJ_UINT32 l_product;
                OPJ_INT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;
 
-               l_tcx0 = int_ceildiv(*p_tx0, l_img_comp->dx);
-               l_tcy0 = int_ceildiv(*p_ty0, l_img_comp->dy);
-               l_tcx1 = int_ceildiv(*p_tx1, l_img_comp->dx);
-               l_tcy1 = int_ceildiv(*p_ty1, l_img_comp->dy);
+               l_tcx0 = opj_int_ceildiv(*p_tx0, l_img_comp->dx);
+               l_tcy0 = opj_int_ceildiv(*p_ty0, l_img_comp->dy);
+               l_tcx1 = opj_int_ceildiv(*p_tx1, l_img_comp->dx);
+               l_tcy1 = opj_int_ceildiv(*p_ty1, l_img_comp->dy);
 
                if (l_tccp->numresolutions > *p_max_res) {
                        *p_max_res = l_tccp->numresolutions;
@@ -626,22 +626,22 @@ void opj_get_encoding_parameters( const opj_image_t *p_image,
                        l_dy = l_img_comp->dy * (1 << (l_pdy + l_tccp->numresolutions - 1 - resno));
 
                        /* take the minimum size for dx for each comp and resolution */
-                       *p_dx_min = uint_min(*p_dx_min, l_dx);
-                       *p_dy_min = uint_min(*p_dy_min, l_dy);
+                       *p_dx_min = opj_uint_min(*p_dx_min, l_dx);
+                       *p_dy_min = opj_uint_min(*p_dy_min, l_dy);
 
                        /* various calculations of extents */
                        l_level_no = l_tccp->numresolutions - 1 - resno;
 
-                       l_rx0 = int_ceildivpow2(l_tcx0, l_level_no);
-                       l_ry0 = int_ceildivpow2(l_tcy0, l_level_no);
-                       l_rx1 = int_ceildivpow2(l_tcx1, l_level_no);
-                       l_ry1 = int_ceildivpow2(l_tcy1, l_level_no);
+                       l_rx0 = opj_int_ceildivpow2(l_tcx0, l_level_no);
+                       l_ry0 = opj_int_ceildivpow2(l_tcy0, l_level_no);
+                       l_rx1 = opj_int_ceildivpow2(l_tcx1, l_level_no);
+                       l_ry1 = opj_int_ceildivpow2(l_tcy1, l_level_no);
 
-                       l_px0 = int_floordivpow2(l_rx0, l_pdx) << l_pdx;
-                       l_py0 = int_floordivpow2(l_ry0, l_pdy) << l_pdy;
-                       l_px1 = int_ceildivpow2(l_rx1, l_pdx) << l_pdx;
+                       l_px0 = opj_int_floordivpow2(l_rx0, l_pdx) << l_pdx;
+                       l_py0 = opj_int_floordivpow2(l_ry0, l_pdy) << l_pdy;
+                       l_px1 = opj_int_ceildivpow2(l_rx1, l_pdx) << l_pdx;
 
-                       py1 = int_ceildivpow2(l_ry1, l_pdy) << l_pdy;
+                       py1 = opj_int_ceildivpow2(l_ry1, l_pdy) << l_pdy;
 
                        l_pw = (l_rx0==l_rx1)?0:((l_px1 - l_px0) >> l_pdx);
                        l_ph = (l_ry0==l_ry1)?0:((py1 - l_py0) >> l_pdy);
@@ -701,10 +701,10 @@ void opj_get_all_encoding_parameters(   const opj_image_t *p_image,
        q = tileno / p_cp->tw;
 
        /* here calculation of tx0, tx1, ty0, ty1, maxprec, l_dx and l_dy */
-       *p_tx0 = int_max(p_cp->tx0 + p * p_cp->tdx, p_image->x0);
-       *p_tx1 = int_min(p_cp->tx0 + (p + 1) * p_cp->tdx, p_image->x1);
-       *p_ty0 = int_max(p_cp->ty0 + q * p_cp->tdy, p_image->y0);
-       *p_ty1 = int_min(p_cp->ty0 + (q + 1) * p_cp->tdy, p_image->y1);
+       *p_tx0 = opj_int_max(p_cp->tx0 + p * p_cp->tdx, p_image->x0);
+       *p_tx1 = opj_int_min(p_cp->tx0 + (p + 1) * p_cp->tdx, p_image->x1);
+       *p_ty0 = opj_int_max(p_cp->ty0 + q * p_cp->tdy, p_image->y0);
+       *p_ty1 = opj_int_min(p_cp->ty0 + (q + 1) * p_cp->tdy, p_image->y1);
 
        /* max precision and resolution is 0 (can only grow)*/
        *p_max_prec = 0;
@@ -725,10 +725,10 @@ void opj_get_all_encoding_parameters(   const opj_image_t *p_image,
 
                lResolutionPtr = p_resolutions[compno];
 
-               l_tcx0 = int_ceildiv(*p_tx0, l_img_comp->dx);
-               l_tcy0 = int_ceildiv(*p_ty0, l_img_comp->dy);
-               l_tcx1 = int_ceildiv(*p_tx1, l_img_comp->dx);
-               l_tcy1 = int_ceildiv(*p_ty1, l_img_comp->dy);
+               l_tcx0 = opj_int_ceildiv(*p_tx0, l_img_comp->dx);
+               l_tcy0 = opj_int_ceildiv(*p_ty0, l_img_comp->dy);
+               l_tcx1 = opj_int_ceildiv(*p_tx1, l_img_comp->dx);
+               l_tcy1 = opj_int_ceildiv(*p_ty1, l_img_comp->dy);
 
                if (l_tccp->numresolutions > *p_max_res) {
                        *p_max_res = l_tccp->numresolutions;
@@ -747,18 +747,18 @@ void opj_get_all_encoding_parameters(   const opj_image_t *p_image,
                        l_dx = l_img_comp->dx * (1 << (l_pdx + l_level_no));
                        l_dy = l_img_comp->dy * (1 << (l_pdy + l_level_no));
                        /* take the minimum size for l_dx for each comp and resolution*/
-                       *p_dx_min = int_min(*p_dx_min, l_dx);
-                       *p_dy_min = int_min(*p_dy_min, l_dy);
+                       *p_dx_min = opj_int_min(*p_dx_min, l_dx);
+                       *p_dy_min = opj_int_min(*p_dy_min, l_dy);
 
                        /* various calculations of extents*/
-                       l_rx0 = int_ceildivpow2(l_tcx0, l_level_no);
-                       l_ry0 = int_ceildivpow2(l_tcy0, l_level_no);
-                       l_rx1 = int_ceildivpow2(l_tcx1, l_level_no);
-                       l_ry1 = int_ceildivpow2(l_tcy1, l_level_no);
-                       l_px0 = int_floordivpow2(l_rx0, l_pdx) << l_pdx;
-                       l_py0 = int_floordivpow2(l_ry0, l_pdy) << l_pdy;
-                       l_px1 = int_ceildivpow2(l_rx1, l_pdx) << l_pdx;
-                       py1 = int_ceildivpow2(l_ry1, l_pdy) << l_pdy;
+                       l_rx0 = opj_int_ceildivpow2(l_tcx0, l_level_no);
+                       l_ry0 = opj_int_ceildivpow2(l_tcy0, l_level_no);
+                       l_rx1 = opj_int_ceildivpow2(l_tcx1, l_level_no);
+                       l_ry1 = opj_int_ceildivpow2(l_tcy1, l_level_no);
+                       l_px0 = opj_int_floordivpow2(l_rx0, l_pdx) << l_pdx;
+                       l_py0 = opj_int_floordivpow2(l_ry0, l_pdy) << l_pdy;
+                       l_px1 = opj_int_ceildivpow2(l_rx1, l_pdx) << l_pdx;
+                       py1 = opj_int_ceildivpow2(l_ry1, l_pdy) << l_pdy;
                        l_pw = (l_rx0==l_rx1)?0:((l_px1 - l_px0) >> l_pdx);
                        l_ph = (l_ry0==l_ry1)?0:((py1 - l_py0) >> l_pdy);
                        *lResolutionPtr++ = l_pw;
index 2a8a67323ab7ada15936bfa7c3995ac5922dea3c..b0482860f658b68639d8f3aa7b769e452a64fc34 100644 (file)
@@ -318,7 +318,7 @@ void opj_t1_enc_sigpass_step(   opj_t1_t *t1,
        
        flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
        if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
-               v = int_abs(*datap) & one ? 1 : 0;
+               v = opj_int_abs(*datap) & one ? 1 : 0;
                opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient));       /* ESSAI */
                if (type == T1_TYPE_RAW) {      /* BYPASS/LAZY MODE */
                        opj_mqc_bypass_enc(mqc, v);
@@ -327,7 +327,7 @@ void opj_t1_enc_sigpass_step(   opj_t1_t *t1,
                }
                if (v) {
                        v = *datap < 0 ? 1 : 0;
-                       *nmsedec +=     opj_t1_getnmsedec_sig(int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
+                       *nmsedec +=     opj_t1_getnmsedec_sig(opj_int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
                        opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag));       /* ESSAI */
                        if (type == T1_TYPE_RAW) {      /* BYPASS/LAZY MODE */
                                opj_mqc_bypass_enc(mqc, v);
@@ -388,8 +388,8 @@ void opj_t1_enc_refpass_step(   opj_t1_t *t1,
        
        flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
        if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
-               *nmsedec += opj_t1_getnmsedec_ref(int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
-               v = int_abs(*datap) & one ? 1 : 0;
+               *nmsedec += opj_t1_getnmsedec_ref(opj_int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
+               v = opj_int_abs(*datap) & one ? 1 : 0;
                opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag(flag));      /* ESSAI */
                if (type == T1_TYPE_RAW) {      /* BYPASS/LAZY MODE */
                        opj_mqc_bypass_enc(mqc, v);
@@ -454,11 +454,11 @@ void opj_t1_enc_clnpass_step(
        }
        if (!(*flagsp & (T1_SIG | T1_VISIT))) {
                opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient));
-               v = int_abs(*datap) & one ? 1 : 0;
+               v = opj_int_abs(*datap) & one ? 1 : 0;
                opj_mqc_encode(mqc, v);
                if (v) {
 LABEL_PARTIAL:
-                       *nmsedec += opj_t1_getnmsedec_sig(int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
+                       *nmsedec += opj_t1_getnmsedec_sig(opj_int_abs(*datap), bpno + T1_NMSEDEC_FRACBITS);
                        opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag));
                        v = *datap < 0 ? 1 : 0;
                        opj_mqc_encode(mqc, v ^ opj_t1_getspb(flag));
@@ -577,7 +577,7 @@ void opj_t1_enc_clnpass(
                        }
                        if (agg) {
                                for (runlen = 0; runlen < 4; ++runlen) {
-                                       if (int_abs(t1->data[((k + runlen)*t1->w) + i]) & one)
+                                       if (opj_int_abs(t1->data[((k + runlen)*t1->w) + i]) & one)
                                                break;
                                }
                                opj_mqc_setcurctx(mqc, T1_CTXNO_AGG);
@@ -1124,7 +1124,7 @@ opj_bool opj_t1_encode_cblks(   opj_t1_t *t1,
                                                                for (i = 0; i < cblk_w; ++i) {
                                                                        OPJ_INT32 tmp = tiledp[(j * tile_w) + i];
                                                                        datap[(j * cblk_w) + i] =
-                                                                               fix_mul(
+                                                                               opj_int_fix_mul(
                                                                                tmp,
                                                                                bandconst) >> (11 - T1_NMSEDEC_FRACBITS);
                                                                }
@@ -1181,10 +1181,10 @@ void opj_t1_encode_cblk(opj_t1_t *t1,
        max = 0;
        for (i = 0; i < t1->w * t1->h; ++i) {
                OPJ_INT32 tmp = abs(t1->data[i]);
-               max = int_max(max, tmp);
+               max = opj_int_max(max, tmp);
        }
 
-       cblk->numbps = max ? (int_floorlog2(max) + 1) - T1_NMSEDEC_FRACBITS : 0;
+       cblk->numbps = max ? (opj_int_floorlog2(max) + 1) - T1_NMSEDEC_FRACBITS : 0;
 
        bpno = cblk->numbps - 1;
        passtype = 2;
index 67632373f202ccad112ffdcab0cf72ad2d9a702b..b2e3334d2a257352320abbbfc76a372211f061dd 100644 (file)
@@ -108,16 +108,16 @@ static int t1_init_ctxno_sc(int f) {
        int hc, vc, n;
        n = 0;
 
-       hc = int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
+       hc = opj_int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
                                T1_SIG_E) + ((f & (T1_SIG_W | T1_SGN_W)) == T1_SIG_W),
-                       1) - int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
+                       1) - opj_int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
                                        (T1_SIG_E | T1_SGN_E)) +
                                ((f & (T1_SIG_W | T1_SGN_W)) ==
                                 (T1_SIG_W | T1_SGN_W)), 1);
 
-       vc = int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
+       vc = opj_int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
                                T1_SIG_N) + ((f & (T1_SIG_S | T1_SGN_S)) == T1_SIG_S),
-                       1) - int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
+                       1) - opj_int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
                                        (T1_SIG_N | T1_SGN_N)) +
                                ((f & (T1_SIG_S | T1_SGN_S)) ==
                                 (T1_SIG_S | T1_SGN_S)), 1);
@@ -148,16 +148,16 @@ static int t1_init_ctxno_sc(int f) {
 static int t1_init_spb(int f) {
        int hc, vc, n;
 
-       hc = int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
+       hc = opj_int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
                                T1_SIG_E) + ((f & (T1_SIG_W | T1_SGN_W)) == T1_SIG_W),
-                       1) - int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
+                       1) - opj_int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
                                        (T1_SIG_E | T1_SGN_E)) +
                                ((f & (T1_SIG_W | T1_SGN_W)) ==
                                 (T1_SIG_W | T1_SGN_W)), 1);
 
-       vc = int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
+       vc = opj_int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
                                T1_SIG_N) + ((f & (T1_SIG_S | T1_SGN_S)) == T1_SIG_S),
-                       1) - int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
+                       1) - opj_int_min(((f & (T1_SIG_N | T1_SGN_N)) ==
                                        (T1_SIG_N | T1_SGN_N)) +
                                ((f & (T1_SIG_S | T1_SGN_S)) ==
                                 (T1_SIG_S | T1_SGN_S)), 1);
@@ -239,10 +239,10 @@ int main(){
                u = t;
                v = t - 1.5;
                lut_nmsedec_sig[i] = 
-                       int_max(0, 
+                       opj_int_max(0, 
                                        (int) (floor((u * u - v * v) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
                lut_nmsedec_sig0[i] =
-                       int_max(0,
+                       opj_int_max(0,
                                        (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
                u = t - 1.0;
                if (i & (1 << (T1_NMSEDEC_BITS - 1))) {
@@ -251,10 +251,10 @@ int main(){
                        v = t - 0.5;
                }
                lut_nmsedec_ref[i] =
-                       int_max(0,
+                       opj_int_max(0,
                                        (int) (floor((u * u - v * v) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
                lut_nmsedec_ref0[i] =
-                       int_max(0,
+                       opj_int_max(0,
                                        (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
        }
 
index 0c32ca601337ed618dce4b2c2935692afe0636f1..0d4345585f7da25ad6c20bd15572a728c057eb87 100644 (file)
@@ -373,7 +373,7 @@ opj_bool opj_t2_decode_packets( opj_t2_v2_t *p_t2,
                                 }
 
                                 l_img_comp = &(l_image->comps[l_current_pi->compno]);
-                                l_img_comp->resno_decoded = uint_max(l_current_pi->resno, l_img_comp->resno_decoded);
+                                l_img_comp->resno_decoded = opj_uint_max(l_current_pi->resno, l_img_comp->resno_decoded);
                         }
                         else {
                                 l_nb_bytes_read = 0;
@@ -621,7 +621,7 @@ opj_bool opj_t2_encode_packet(  OPJ_UINT32 tileno,
                                 len += pass->len;
 
                                 if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
-                                        increment = int_max(increment, int_floorlog2(len) + 1 - (cblk->numlenbits + int_floorlog2(nump)));
+                                        increment = opj_int_max(increment, opj_int_floorlog2(len) + 1 - (cblk->numlenbits + opj_int_floorlog2(nump)));
                                         len = 0;
                                         nump = 0;
                                 }
@@ -640,7 +640,7 @@ opj_bool opj_t2_encode_packet(  OPJ_UINT32 tileno,
                                 len += pass->len;
 
                                 if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
-                                        opj_bio_write(bio, len, cblk->numlenbits + int_floorlog2(nump));
+                                        opj_bio_write(bio, len, cblk->numlenbits + opj_int_floorlog2(nump));
                                         len = 0;
                                         nump = 0;
                                 }
@@ -967,8 +967,8 @@ opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
                         n = l_cblk->numnewpasses;
 
                         do {
-                                l_cblk->segs[l_segno].numnewpasses = int_min(l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses, n);
-                                l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, l_cblk->numlenbits + uint_floorlog2(l_cblk->segs[l_segno].numnewpasses));
+                                l_cblk->segs[l_segno].numnewpasses = opj_int_min(l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses, n);
+                                l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, l_cblk->numlenbits + opj_uint_floorlog2(l_cblk->segs[l_segno].numnewpasses));
 
                                 n -= l_cblk->segs[l_segno].numnewpasses;
                                 if (n > 0) {
index 187480f1224611507c9c9d716951f3fbd3bf75e0..6d5706fbe59ce2ac14f16ab1cb4a8489b4b39b18 100644 (file)
@@ -463,7 +463,7 @@ opj_bool opj_tcd_rateallocate(  opj_tcd_v2_t *tcd,
                 OPJ_FLOAT64 lo = min;
                 OPJ_FLOAT64 hi = max;
                 opj_bool success = OPJ_FALSE;
-                OPJ_UINT32 maxlen = tcd_tcp->rates[layno] ? uint_min(((OPJ_UINT32) ceil(tcd_tcp->rates[layno])), len) : len;
+                OPJ_UINT32 maxlen = tcd_tcp->rates[layno] ? opj_uint_min(((OPJ_UINT32) ceil(tcd_tcp->rates[layno])), len) : len;
                 OPJ_FLOAT64 goodthresh = 0;
                 OPJ_FLOAT64 stable_thresh = 0;
                 OPJ_UINT32 i;
@@ -655,10 +655,10 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
         /*fprintf(stderr, "Tile coordinate = %d,%d\n", p, q);*/     \
                                                                     \
         /* 4 borders of the tile rescale on the image if necessary */                                                                                                                                             \
-        l_tile->x0 = int_max(l_cp->tx0 + p * l_cp->tdx, l_image->x0);                                                                                                                                             \
-        l_tile->y0 = int_max(l_cp->ty0 + q * l_cp->tdy, l_image->y0);                                                                                                                                             \
-        l_tile->x1 = int_min(l_cp->tx0 + (p + 1) * l_cp->tdx, l_image->x1);                                                                                                                                       \
-        l_tile->y1 = int_min(l_cp->ty0 + (q + 1) * l_cp->tdy, l_image->y1);                                                                                                                                       \
+        l_tile->x0 = opj_int_max(l_cp->tx0 + p * l_cp->tdx, l_image->x0);                                                                                                                                             \
+        l_tile->y0 = opj_int_max(l_cp->ty0 + q * l_cp->tdy, l_image->y0);                                                                                                                                             \
+        l_tile->x1 = opj_int_min(l_cp->tx0 + (p + 1) * l_cp->tdx, l_image->x1);                                                                                                                                       \
+        l_tile->y1 = opj_int_min(l_cp->ty0 + (q + 1) * l_cp->tdy, l_image->y1);                                                                                                                                       \
         /*fprintf(stderr, "Tile border = %d,%d,%d,%d\n", l_tile->x0, l_tile->y0,l_tile->x1,l_tile->y1);*/                                                                                                         \
                                                                     \
         /*tile->numcomps = image->numcomps; */                      \
@@ -666,10 +666,10 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                 /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps);*/                                                                                                                                \
                                                                     \
                 /* border of each l_tile component (global) */      \
-                l_tilec->x0 = int_ceildiv(l_tile->x0, l_image_comp->dx);                                                                                                                                          \
-                l_tilec->y0 = int_ceildiv(l_tile->y0, l_image_comp->dy);                                                                                                                                          \
-                l_tilec->x1 = int_ceildiv(l_tile->x1, l_image_comp->dx);                                                                                                                                          \
-                l_tilec->y1 = int_ceildiv(l_tile->y1, l_image_comp->dy);                                                                                                                                          \
+                l_tilec->x0 = opj_int_ceildiv(l_tile->x0, l_image_comp->dx);                                                                                                                                          \
+                l_tilec->y0 = opj_int_ceildiv(l_tile->y0, l_image_comp->dy);                                                                                                                                          \
+                l_tilec->x1 = opj_int_ceildiv(l_tile->x1, l_image_comp->dx);                                                                                                                                          \
+                l_tilec->y1 = opj_int_ceildiv(l_tile->y1, l_image_comp->dy);                                                                                                                                          \
                 /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/                                                                                     \
                                                                     \
                 l_data_size = (l_tilec->x1 - l_tilec->x0)           \
@@ -752,20 +752,20 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                         OPJ_UINT32 cblkwidthexpn, cblkheightexpn;                                                                                                                                                 \
                                                                                                                                                                                                                   \
                         /* border for each resolution level (global) */                                                                                                                                           \
-                        l_res->x0 = int_ceildivpow2(l_tilec->x0, l_level_no);                                                                                                                                     \
-                        l_res->y0 = int_ceildivpow2(l_tilec->y0, l_level_no);                                                                                                                                     \
-                        l_res->x1 = int_ceildivpow2(l_tilec->x1, l_level_no);                                                                                                                                     \
-                        l_res->y1 = int_ceildivpow2(l_tilec->y1, l_level_no);                                                                                                                                     \
+                        l_res->x0 = opj_int_ceildivpow2(l_tilec->x0, l_level_no);                                                                                                                                     \
+                        l_res->y0 = opj_int_ceildivpow2(l_tilec->y0, l_level_no);                                                                                                                                     \
+                        l_res->x1 = opj_int_ceildivpow2(l_tilec->x1, l_level_no);                                                                                                                                     \
+                        l_res->y1 = opj_int_ceildivpow2(l_tilec->y1, l_level_no);                                                                                                                                     \
                         /*fprintf(stderr, "\t\t\tres_x0= %d, res_y0 =%d, res_x1=%d, res_y1=%d\n", l_res->x0, l_res->y0, l_res->x1, l_res->y1);*/                                                                  \
                         /* p. 35, table A-23, ISO/IEC FDIS154444-1 : 2000 (18 august 2000) */                                                                                                                     \
                         l_pdx = l_tccp->prcw[resno];                                                                                                                                                              \
                         l_pdy = l_tccp->prch[resno];                                                                                                                                                              \
                         /*fprintf(stderr, "\t\t\tpdx=%d, pdy=%d\n", l_pdx, l_pdy);*/                                                                                                                              \
                         /* p. 64, B.6, ISO/IEC FDIS15444-1 : 2000 (18 august 2000)  */                                                                                                                            \
-                        l_tl_prc_x_start = int_floordivpow2(l_res->x0, l_pdx) << l_pdx;                                                                                                                           \
-                        l_tl_prc_y_start = int_floordivpow2(l_res->y0, l_pdy) << l_pdy;                                                                                                                           \
-                        l_br_prc_x_end = int_ceildivpow2(l_res->x1, l_pdx) << l_pdx;                                                                                                                              \
-                        l_br_prc_y_end = int_ceildivpow2(l_res->y1, l_pdy) << l_pdy;                                                                                                                              \
+                        l_tl_prc_x_start = opj_int_floordivpow2(l_res->x0, l_pdx) << l_pdx;                                                                                                                           \
+                        l_tl_prc_y_start = opj_int_floordivpow2(l_res->y0, l_pdy) << l_pdy;                                                                                                                           \
+                        l_br_prc_x_end = opj_int_ceildivpow2(l_res->x1, l_pdx) << l_pdx;                                                                                                                              \
+                        l_br_prc_y_end = opj_int_ceildivpow2(l_res->y1, l_pdy) << l_pdy;                                                                                                                              \
                         /*fprintf(stderr, "\t\t\tprc_x_start=%d, prc_y_start=%d, br_prc_x_end=%d, br_prc_y_end=%d \n", l_tl_prc_x_start, l_tl_prc_y_start, l_br_prc_x_end ,l_br_prc_y_end );*/                    \
                                                                                                                                                                                                                   \
                         l_res->pw = (l_res->x0 == l_res->x1) ? 0 : ((l_br_prc_x_end - l_tl_prc_x_start) >> l_pdx);                                                                                                \
@@ -784,17 +784,17 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                                 l_res->numbands = 1;                                                                                                                                                              \
                         }                                                                                                                                                                                         \
                         else {                                                                                                                                                                                    \
-                                tlcbgxstart = int_ceildivpow2(l_tl_prc_x_start, 1);                                                                                                                               \
-                                tlcbgystart = int_ceildivpow2(l_tl_prc_y_start, 1);                                                                                                                               \
-                                brcbgxend = int_ceildivpow2(l_br_prc_x_end, 1);                                                                                                                                   \
-                                brcbgyend = int_ceildivpow2(l_br_prc_y_end, 1);                                                                                                                                   \
+                                tlcbgxstart = opj_int_ceildivpow2(l_tl_prc_x_start, 1);                                                                                                                               \
+                                tlcbgystart = opj_int_ceildivpow2(l_tl_prc_y_start, 1);                                                                                                                               \
+                                brcbgxend = opj_int_ceildivpow2(l_br_prc_x_end, 1);                                                                                                                                   \
+                                brcbgyend = opj_int_ceildivpow2(l_br_prc_y_end, 1);                                                                                                                                   \
                                 cbgwidthexpn = l_pdx - 1;                                                                                                                                                         \
                                 cbgheightexpn = l_pdy - 1;                                                                                                                                                        \
                                 l_res->numbands = 3;                                                                                                                                                              \
                         }                                                                                                                                                                                         \
                                                                                                                                                                                                                   \
-                        cblkwidthexpn = uint_min(l_tccp->cblkw, cbgwidthexpn);                                                                                                                                    \
-                        cblkheightexpn = uint_min(l_tccp->cblkh, cbgheightexpn);                                                                                                                                  \
+                        cblkwidthexpn = opj_uint_min(l_tccp->cblkw, cbgwidthexpn);                                                                                                                                    \
+                        cblkheightexpn = opj_uint_min(l_tccp->cblkh, cbgheightexpn);                                                                                                                                  \
                         l_band = l_res->bands;                                                                                                                                                                    \
                                                                                                                                                                                                                   \
                         for (bandno = 0; bandno < l_res->numbands; ++bandno) {                                                                                                                                    \
@@ -803,10 +803,10 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                                                                                                                                                                                                                   \
                                 if (resno == 0) {                                                                                                                                                                 \
                                         l_band->bandno = 0 ;                                                                                                                                                      \
-                                        l_band->x0 = int_ceildivpow2(l_tilec->x0, l_level_no);                                                                                                                    \
-                                        l_band->y0 = int_ceildivpow2(l_tilec->y0, l_level_no);                                                                                                                    \
-                                        l_band->x1 = int_ceildivpow2(l_tilec->x1, l_level_no);                                                                                                                    \
-                                        l_band->y1 = int_ceildivpow2(l_tilec->y1, l_level_no);                                                                                                                    \
+                                        l_band->x0 = opj_int_ceildivpow2(l_tilec->x0, l_level_no);                                                                                                                    \
+                                        l_band->y0 = opj_int_ceildivpow2(l_tilec->y0, l_level_no);                                                                                                                    \
+                                        l_band->x1 = opj_int_ceildivpow2(l_tilec->x1, l_level_no);                                                                                                                    \
+                                        l_band->y1 = opj_int_ceildivpow2(l_tilec->y1, l_level_no);                                                                                                                    \
                                 }                                                                                                                                                                                 \
                                 else {                                                                                                                                                                            \
                                         l_band->bandno = bandno + 1;                                                                                                                                              \
@@ -815,10 +815,10 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                                         /* y0b = 1 if bandno = 2 or 3 */                                                                                                                                          \
                                         l_y0b = (l_band->bandno)>>1;                                                                                                                                              \
                                         /* l_band border (global) */                                                                                                                                              \
-                                        l_band->x0 = int_ceildivpow2(l_tilec->x0 - (1 << l_level_no) * l_x0b, l_level_no + 1);                                                                                    \
-                                        l_band->y0 = int_ceildivpow2(l_tilec->y0 - (1 << l_level_no) * l_y0b, l_level_no + 1);                                                                                    \
-                                        l_band->x1 = int_ceildivpow2(l_tilec->x1 - (1 << l_level_no) * l_x0b, l_level_no + 1);                                                                                    \
-                                        l_band->y1 = int_ceildivpow2(l_tilec->y1 - (1 << l_level_no) * l_y0b, l_level_no + 1);                                                                                    \
+                                        l_band->x0 = opj_int_ceildivpow2(l_tilec->x0 - (1 << l_level_no) * l_x0b, l_level_no + 1);                                                                                    \
+                                        l_band->y0 = opj_int_ceildivpow2(l_tilec->y0 - (1 << l_level_no) * l_y0b, l_level_no + 1);                                                                                    \
+                                        l_band->x1 = opj_int_ceildivpow2(l_tilec->x1 - (1 << l_level_no) * l_x0b, l_level_no + 1);                                                                                    \
+                                        l_band->y1 = opj_int_ceildivpow2(l_tilec->y1 - (1 << l_level_no) * l_y0b, l_level_no + 1);                                                                                    \
                                 }                                                                                                                                                                                 \
                                                                                                                                                                                                                   \
                                 /** avoid an if with storing function pointer */                                                                                                                                  \
@@ -866,19 +866,19 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                                         /* precinct size (global) */                                                                                                                                              \
                                         /*fprintf(stderr, "\t cbgxstart=%d, l_band->x0 = %d \n",cbgxstart, l_band->x0);*/                                                                                         \
                                                                                                                                                                                                                   \
-                                        l_current_precinct->x0 = int_max(cbgxstart, l_band->x0);                                                                                                                  \
-                                        l_current_precinct->y0 = int_max(cbgystart, l_band->y0);                                                                                                                  \
-                                        l_current_precinct->x1 = int_min(cbgxend, l_band->x1);                                                                                                                    \
-                                        l_current_precinct->y1 = int_min(cbgyend, l_band->y1);                                                                                                                    \
+                                        l_current_precinct->x0 = opj_int_max(cbgxstart, l_band->x0);                                                                                                                  \
+                                        l_current_precinct->y0 = opj_int_max(cbgystart, l_band->y0);                                                                                                                  \
+                                        l_current_precinct->x1 = opj_int_min(cbgxend, l_band->x1);                                                                                                                    \
+                                        l_current_precinct->y1 = opj_int_min(cbgyend, l_band->y1);                                                                                                                    \
                                         /*fprintf(stderr, "\t prc_x0=%d; prc_y0=%d, prc_x1=%d; prc_y1=%d\n",l_current_precinct->x0, l_current_precinct->y0 ,l_current_precinct->x1, l_current_precinct->y1);*/    \
                                                                                                                                                                                                                   \
-                                        tlcblkxstart = int_floordivpow2(l_current_precinct->x0, cblkwidthexpn) << cblkwidthexpn;                                                                                  \
+                                        tlcblkxstart = opj_int_floordivpow2(l_current_precinct->x0, cblkwidthexpn) << cblkwidthexpn;                                                                                  \
                                         /*fprintf(stderr, "\t tlcblkxstart =%d\n",tlcblkxstart );*/                                                                                                               \
-                                        tlcblkystart = int_floordivpow2(l_current_precinct->y0, cblkheightexpn) << cblkheightexpn;                                                                                \
+                                        tlcblkystart = opj_int_floordivpow2(l_current_precinct->y0, cblkheightexpn) << cblkheightexpn;                                                                                \
                                         /*fprintf(stderr, "\t tlcblkystart =%d\n",tlcblkystart );*/                                                                                                               \
-                                        brcblkxend = int_ceildivpow2(l_current_precinct->x1, cblkwidthexpn) << cblkwidthexpn;                                                                                     \
+                                        brcblkxend = opj_int_ceildivpow2(l_current_precinct->x1, cblkwidthexpn) << cblkwidthexpn;                                                                                     \
                                         /*fprintf(stderr, "\t brcblkxend =%d\n",brcblkxend );*/                                                                                                                   \
-                                        brcblkyend = int_ceildivpow2(l_current_precinct->y1, cblkheightexpn) << cblkheightexpn;                                                                                   \
+                                        brcblkyend = opj_int_ceildivpow2(l_current_precinct->y1, cblkheightexpn) << cblkheightexpn;                                                                                   \
                                         /*fprintf(stderr, "\t brcblkyend =%d\n",brcblkyend );*/                                                                                                                   \
                                         l_current_precinct->cw = (brcblkxend - tlcblkxstart) >> cblkwidthexpn;                                                                                                    \
                                         l_current_precinct->ch = (brcblkyend - tlcblkystart) >> cblkheightexpn;                                                                                                   \
@@ -959,10 +959,10 @@ opj_bool FUNCTION (     opj_tcd_v2_t *p_tcd,                        \
                                                 OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn);                                                                                                          \
                                                                                                                                                                                                                   \
                                                 /* code-block size (global) */                                                                                                                                    \
-                                                l_code_block->x0 = int_max(cblkxstart, l_current_precinct->x0);                                                                                                   \
-                                                l_code_block->y0 = int_max(cblkystart, l_current_precinct->y0);                                                                                                   \
-                                                l_code_block->x1 = int_min(cblkxend, l_current_precinct->x1);                                                                                                     \
-                                                l_code_block->y1 = int_min(cblkyend, l_current_precinct->y1);                                                                                                     \
+                                                l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0);                                                                                                   \
+                                                l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0);                                                                                                   \
+                                                l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1);                                                                                                     \
+                                                l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1);                                                                                                     \
                                                                                                                                                                                                                   \
                                                 if (! FUNCTION_ELEMENT(l_code_block)) {                                                                                                                           \
                                                         return OPJ_FALSE;                                                                                                                                         \
@@ -1666,7 +1666,7 @@ opj_bool opj_tcd_dc_level_shift_decode ( opj_tcd_v2_t *p_tcd )
                 if (l_tccp->qmfbid == 1) {
                         for (j=0;j<l_height;++j) {
                                 for (i = 0; i < l_width; ++i) {
-                                        *l_current_ptr = int_clamp(*l_current_ptr + l_tccp->m_dc_level_shift, l_min, l_max);
+                                        *l_current_ptr = opj_int_clamp(*l_current_ptr + l_tccp->m_dc_level_shift, l_min, l_max);
                                         ++l_current_ptr;
                                 }
                                 l_current_ptr += l_stride;
@@ -1676,7 +1676,7 @@ opj_bool opj_tcd_dc_level_shift_decode ( opj_tcd_v2_t *p_tcd )
                         for (j=0;j<l_height;++j) {
                                 for (i = 0; i < l_width; ++i) {
                                         OPJ_FLOAT32 l_value = *((OPJ_FLOAT32 *) l_current_ptr);
-                                        *l_current_ptr = int_clamp(lrintf(l_value) + l_tccp->m_dc_level_shift, l_min, l_max); ;
+                                        *l_current_ptr = opj_int_clamp(lrintf(l_value) + l_tccp->m_dc_level_shift, l_min, l_max); ;
                                         ++l_current_ptr;
                                 }
                                 l_current_ptr += l_stride;