Home | History | Annotate | Download | only in libopenjpeg20
      1 diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c
      2 index 400ca8098..e77edd22b 100644
      3 --- a/third_party/libopenjpeg20/j2k.c
      4 +++ b/third_party/libopenjpeg20/j2k.c
      5 @@ -2155,8 +2155,8 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k,
      6          }
      7  
      8          /* Compute the number of tiles */
      9 -        l_cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(l_image->x1 - l_cp->tx0), (OPJ_INT32)l_cp->tdx);
     10 -        l_cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(l_image->y1 - l_cp->ty0), (OPJ_INT32)l_cp->tdy);
     11 +        l_cp->tw = opj_uint_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
     12 +        l_cp->th = opj_uint_ceildiv(l_image->y1 - l_cp->ty0, l_cp->tdy);
     13  
     14          /* Check that the number of tiles is valid */
     15          if (l_cp->tw == 0 || l_cp->th == 0 || l_cp->tw > 65535 / l_cp->th) {
     16 @@ -2171,8 +2171,8 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k,
     17          if (p_j2k->m_specific_param.m_decoder.m_discard_tiles) {
     18                  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;
     19                  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;
     20 -                p_j2k->m_specific_param.m_decoder.m_end_tile_x = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0), (OPJ_INT32)l_cp->tdx);
     21 -                p_j2k->m_specific_param.m_decoder.m_end_tile_y = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0), (OPJ_INT32)l_cp->tdy);
     22 +                p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_uint_ceildiv(p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0, l_cp->tdx);
     23 +                p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_uint_ceildiv(p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0, l_cp->tdy);
     24          }
     25          else {
     26                  p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
     27 @@ -6354,8 +6354,8 @@ OPJ_BOOL opj_j2k_setup_encoder(     opj_j2k_t *p_j2k,
     28          */
     29  
     30          if (parameters->tile_size_on) {
     31 -                cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->x1 - cp->tx0), (OPJ_INT32)cp->tdx);
     32 -                cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->y1 - cp->ty0), (OPJ_INT32)cp->tdy);
     33 +                cp->tw = opj_uint_ceildiv(image->x1 - cp->tx0, cp->tdx);
     34 +                cp->th = opj_uint_ceildiv(image->y1 - cp->ty0, cp->tdy);
     35          } else {
     36                  cp->tdx = image->x1 - cp->tx0;
     37                  cp->tdy = image->y1 - cp->ty0;
     38 @@ -8529,8 +8529,8 @@ OPJ_BOOL opj_j2k_set_decode_area(       opj_j2k_t *p_j2k,
     39          {
     40                  OPJ_INT32 l_h,l_w;
     41  
     42 -                l_img_comp->x0 = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)p_image->x0, (OPJ_INT32)l_img_comp->dx);
     43 -                l_img_comp->y0 = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)p_image->y0, (OPJ_INT32)l_img_comp->dy);
     44 +                l_img_comp->x0 = opj_uint_ceildiv(p_image->x0, l_img_comp->dx);
     45 +                l_img_comp->y0 = opj_uint_ceildiv(p_image->y0, l_img_comp->dy);
     46                  l_comp_x1 = opj_int_ceildiv((OPJ_INT32)p_image->x1, (OPJ_INT32)l_img_comp->dx);
     47                  l_comp_y1 = opj_int_ceildiv((OPJ_INT32)p_image->y1, (OPJ_INT32)l_img_comp->dy);
     48  
     49 @@ -9887,8 +9887,8 @@ OPJ_BOOL opj_j2k_get_tile(      opj_j2k_t *p_j2k,
     50  
     51                  l_img_comp->factor = p_j2k->m_private_image->comps[compno].factor;
     52  
     53 -                l_img_comp->x0 = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)p_image->x0, (OPJ_INT32)l_img_comp->dx);
     54 -                l_img_comp->y0 = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)p_image->y0, (OPJ_INT32)l_img_comp->dy);
     55 +                l_img_comp->x0 = opj_uint_ceildiv(p_image->x0, l_img_comp->dx);
     56 +                l_img_comp->y0 = opj_uint_ceildiv(p_image->y0, l_img_comp->dy);
     57                  l_comp_x1 = opj_int_ceildiv((OPJ_INT32)p_image->x1, (OPJ_INT32)l_img_comp->dx);
     58                  l_comp_y1 = opj_int_ceildiv((OPJ_INT32)p_image->y1, (OPJ_INT32)l_img_comp->dy);
     59  
     60 @@ -10169,8 +10169,8 @@ static void opj_get_tile_dimensions(opj_image_t * l_image,
     61  
     62         *l_width  = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0);
     63         *l_height = (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0);
     64 -       *l_offset_x = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)l_image->x0, (OPJ_INT32)l_img_comp->dx);
     65 -       *l_offset_y = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)l_image->y0, (OPJ_INT32)l_img_comp->dy);
     66 +       *l_offset_x = opj_uint_ceildiv(l_image->x0, l_img_comp->dx);
     67 +       *l_offset_y = opj_uint_ceildiv(l_image->y0, l_img_comp->dy);
     68         *l_image_width = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)l_image->x1 - (OPJ_INT32)l_image->x0, (OPJ_INT32)l_img_comp->dx);
     69         *l_stride = *l_image_width - *l_width;
     70         *l_tile_offset = ((OPJ_UINT32)l_tilec->x0 - *l_offset_x) + ((OPJ_UINT32)l_tilec->y0 - *l_offset_y) * *l_image_width;
     71