< prev index next >

src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN.c

Print this page
rev 59106 : imported patch client


 165     cmask = 1;
 166 
 167   if ((cmask & ((1 << nchan) - 1)) == 0)
 168     return MLIB_SUCCESS;
 169 
 170   dx_l = edg_sizes[0];
 171   dx_r = edg_sizes[1];
 172   dy_t = edg_sizes[2];
 173   dy_b = edg_sizes[3];
 174 
 175   if (dx_l + dx_r + dy_t + dy_b == 0)
 176     edge = MLIB_EDGE_DST_NO_WRITE;
 177 
 178   if (edge != MLIB_EDGE_SRC_EXTEND) {
 179     if (mlib_ImageGetWidth(dst_i) >= m && mlib_ImageGetHeight(dst_i) >= n) {
 180       switch (type) {
 181         case MLIB_BYTE:
 182           ret = mlib_convMxNnw_u8(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 183           break;
 184         case MLIB_SHORT:
 185 #ifdef __sparc
 186           ret = mlib_convMxNnw_s16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 187 #else
 188 
 189           if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 190             ret = mlib_convMxNnw_s16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 191           else
 192             ret = mlib_i_convMxNnw_s16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 193 #endif /* __sparc */
 194           break;
 195         case MLIB_USHORT:
 196 #ifdef __sparc
 197           ret = mlib_convMxNnw_u16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 198 #else
 199 
 200           if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 201             ret = mlib_convMxNnw_u16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 202           else
 203             ret = mlib_i_convMxNnw_u16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 204 #endif /* __sparc */
 205           break;
 206         case MLIB_INT:
 207           ret = mlib_convMxNnw_s32(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 208           break;
 209         case MLIB_FLOAT:
 210           ret = mlib_convMxNnw_f32(dst_i, src_i, kernel, m, n, dm, dn, cmask);
 211           break;
 212         case MLIB_DOUBLE:
 213           ret = mlib_convMxNnw_d64(dst_i, src_i, kernel, m, n, dm, dn, cmask);
 214           break;
 215 
 216       default:
 217         /* For some reasons, there is no convolution routine for type MLIB_BIT.
 218          * For now, we silently ignore it (because this image type is not used by java),
 219          * but probably we have to report an error.
 220          */
 221         break;
 222       }
 223     }
 224 


 231         break;
 232     default:
 233       /* Other edge conditions do not need additional handling.
 234        *  Note also that they are not exposed in public Java API
 235        */
 236       break;
 237     }
 238   }
 239   else {                                    /* MLIB_EDGE_SRC_EXTEND */
 240     /* adjust src_e image */
 241     mlib_ImageSetSubimage(src_e, src_e, dx_l - dm, dy_t - dn,
 242                           mlib_ImageGetWidth(src_e), mlib_ImageGetHeight(src_e));
 243 
 244     switch (type) {
 245       case MLIB_BYTE:
 246         ret =
 247           mlib_convMxNext_u8(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 248                              cmask);
 249         break;
 250       case MLIB_SHORT:
 251 #ifdef __sparc
 252         ret =
 253           mlib_convMxNext_s16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 254                               cmask);
 255 #else
 256 
 257         if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 258           ret =
 259             mlib_convMxNext_s16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 260                                 cmask);
 261         else
 262           ret =
 263             mlib_i_convMxNext_s16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b,
 264                                   scale, cmask);
 265 #endif /* __sparc */
 266         break;
 267       case MLIB_USHORT:
 268 #ifdef __sparc
 269         ret =
 270           mlib_convMxNext_u16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 271                               cmask);
 272 #else
 273 
 274         if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 275           ret =
 276             mlib_convMxNext_u16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 277                                 cmask);
 278         else
 279           ret =
 280             mlib_i_convMxNext_u16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b,
 281                                   scale, cmask);
 282 #endif /* __sparc */
 283         break;
 284       case MLIB_INT:
 285         ret =
 286           mlib_convMxNext_s32(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 287                               cmask);
 288         break;
 289       case MLIB_FLOAT:
 290         mlib_convMxNext_f32(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
 291         break;
 292       case MLIB_DOUBLE:
 293         mlib_convMxNext_d64(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
 294         break;
 295     default:
 296       /* For some reasons, there is no convolution routine for type MLIB_BIT.
 297        * For now, we silently ignore it (because this image type is not used by java),
 298        * but probably we have to report an error.
 299        */
 300       break;
 301     }
 302   }


 165     cmask = 1;
 166 
 167   if ((cmask & ((1 << nchan) - 1)) == 0)
 168     return MLIB_SUCCESS;
 169 
 170   dx_l = edg_sizes[0];
 171   dx_r = edg_sizes[1];
 172   dy_t = edg_sizes[2];
 173   dy_b = edg_sizes[3];
 174 
 175   if (dx_l + dx_r + dy_t + dy_b == 0)
 176     edge = MLIB_EDGE_DST_NO_WRITE;
 177 
 178   if (edge != MLIB_EDGE_SRC_EXTEND) {
 179     if (mlib_ImageGetWidth(dst_i) >= m && mlib_ImageGetHeight(dst_i) >= n) {
 180       switch (type) {
 181         case MLIB_BYTE:
 182           ret = mlib_convMxNnw_u8(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 183           break;
 184         case MLIB_SHORT:




 185           if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 186             ret = mlib_convMxNnw_s16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 187           else
 188             ret = mlib_i_convMxNnw_s16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);

 189           break;
 190         case MLIB_USHORT:




 191           if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 192             ret = mlib_convMxNnw_u16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 193           else
 194             ret = mlib_i_convMxNnw_u16(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);

 195           break;
 196         case MLIB_INT:
 197           ret = mlib_convMxNnw_s32(dst_i, src_i, kernel, m, n, dm, dn, scale, cmask);
 198           break;
 199         case MLIB_FLOAT:
 200           ret = mlib_convMxNnw_f32(dst_i, src_i, kernel, m, n, dm, dn, cmask);
 201           break;
 202         case MLIB_DOUBLE:
 203           ret = mlib_convMxNnw_d64(dst_i, src_i, kernel, m, n, dm, dn, cmask);
 204           break;
 205 
 206       default:
 207         /* For some reasons, there is no convolution routine for type MLIB_BIT.
 208          * For now, we silently ignore it (because this image type is not used by java),
 209          * but probably we have to report an error.
 210          */
 211         break;
 212       }
 213     }
 214 


 221         break;
 222     default:
 223       /* Other edge conditions do not need additional handling.
 224        *  Note also that they are not exposed in public Java API
 225        */
 226       break;
 227     }
 228   }
 229   else {                                    /* MLIB_EDGE_SRC_EXTEND */
 230     /* adjust src_e image */
 231     mlib_ImageSetSubimage(src_e, src_e, dx_l - dm, dy_t - dn,
 232                           mlib_ImageGetWidth(src_e), mlib_ImageGetHeight(src_e));
 233 
 234     switch (type) {
 235       case MLIB_BYTE:
 236         ret =
 237           mlib_convMxNext_u8(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 238                              cmask);
 239         break;
 240       case MLIB_SHORT:






 241         if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 242           ret =
 243             mlib_convMxNext_s16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 244                                 cmask);
 245         else
 246           ret =
 247             mlib_i_convMxNext_s16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b,
 248                                   scale, cmask);

 249         break;
 250       case MLIB_USHORT:






 251         if (mlib_ImageConvVersion(m, n, scale, type) == 0)
 252           ret =
 253             mlib_convMxNext_u16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 254                                 cmask);
 255         else
 256           ret =
 257             mlib_i_convMxNext_u16(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b,
 258                                   scale, cmask);

 259         break;
 260       case MLIB_INT:
 261         ret =
 262           mlib_convMxNext_s32(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, scale,
 263                               cmask);
 264         break;
 265       case MLIB_FLOAT:
 266         mlib_convMxNext_f32(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
 267         break;
 268       case MLIB_DOUBLE:
 269         mlib_convMxNext_d64(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
 270         break;
 271     default:
 272       /* For some reasons, there is no convolution routine for type MLIB_BIT.
 273        * For now, we silently ignore it (because this image type is not used by java),
 274        * but probably we have to report an error.
 275        */
 276       break;
 277     }
 278   }
< prev index next >