< prev index next >

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

Print this page




 333     fscale *= 1.0/(1 << 30);
 334     scale -= 30;
 335   }
 336 
 337   fscale /= (1 << scale);
 338 
 339   mn = m*n;
 340 
 341   if (mn > 256) {
 342     k = mlib_malloc(mn*sizeof(mlib_d64));
 343 
 344     if (k == NULL) return MLIB_FAILURE;
 345   }
 346 
 347   for (i = 0; i < mn; i++) {
 348     k[i] = kernel[i]*fscale;
 349   }
 350 
 351   if (m == 1) {
 352     status = mlib_ImageConv1xN(dst, src, k, n, dn, cmask);
 353     FREE_AND_RETURN_STATUS;
 354   }
 355 
 356   bsize = (n + 2)*wid;
 357 
 358   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
 359     pbuff = mlib_malloc(sizeof(mlib_d64)*bsize + sizeof(mlib_d64*)*2*(n + 1));
 360 
 361     if (pbuff == NULL) {
 362       status = MLIB_FAILURE;
 363       FREE_AND_RETURN_STATUS;
 364     }
 365     buffs = (mlib_d64**)(pbuff + bsize);
 366   }
 367 
 368   for (l = 0; l < (n + 1); l++) buffs[l] = pbuff + l*wid;
 369   for (l = 0; l < (n + 1); l++) buffs[l + (n + 1)] = buffs[l];
 370   buffd = buffs[n] + wid;
 371 
 372   wid -= (m - 1);
 373   hgt -= (n - 1);
 374   adr_dst += dn*dll + dm*chan1;
 375 
 376   for (c = 0; c < chan1; c++) {
 377     if (!(cmask & (1 << (chan1 - 1 - c)))) continue;
 378 
 379     sl = adr_src + c;
 380     dl = adr_dst + c;
 381 
 382     for (l = 0; l < n; l++) {
 383       mlib_d64 *buff = buffs[l];


 689         CLAMP_S32(dp[0], s);
 690 
 691         buffn[i] = (mlib_d64)sp[0];
 692 
 693         sp += chan1;
 694         dp += chan1;
 695       }
 696 
 697       for (l = 0; l < (m - 1); l++) buffn[wid + l] = sp[l*chan1];
 698 
 699       /* next line */
 700       sl += sll;
 701       dl += dll;
 702 
 703       buff_ind++;
 704 
 705       if (buff_ind >= n + 1) buff_ind = 0;
 706     }
 707   }
 708 
 709   FREE_AND_RETURN_STATUS;
 710 }
 711 
 712 /***************************************************************/


 333     fscale *= 1.0/(1 << 30);
 334     scale -= 30;
 335   }
 336 
 337   fscale /= (1 << scale);
 338 
 339   mn = m*n;
 340 
 341   if (mn > 256) {
 342     k = mlib_malloc(mn*sizeof(mlib_d64));
 343 
 344     if (k == NULL) return MLIB_FAILURE;
 345   }
 346 
 347   for (i = 0; i < mn; i++) {
 348     k[i] = kernel[i]*fscale;
 349   }
 350 
 351   if (m == 1) {
 352     status = mlib_ImageConv1xN(dst, src, k, n, dn, cmask);
 353     FREE_AND_RETURN_STATUS
 354   }
 355 
 356   bsize = (n + 2)*wid;
 357 
 358   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
 359     pbuff = mlib_malloc(sizeof(mlib_d64)*bsize + sizeof(mlib_d64*)*2*(n + 1));
 360 
 361     if (pbuff == NULL) {
 362       status = MLIB_FAILURE;
 363       FREE_AND_RETURN_STATUS
 364     }
 365     buffs = (mlib_d64**)(pbuff + bsize);
 366   }
 367 
 368   for (l = 0; l < (n + 1); l++) buffs[l] = pbuff + l*wid;
 369   for (l = 0; l < (n + 1); l++) buffs[l + (n + 1)] = buffs[l];
 370   buffd = buffs[n] + wid;
 371 
 372   wid -= (m - 1);
 373   hgt -= (n - 1);
 374   adr_dst += dn*dll + dm*chan1;
 375 
 376   for (c = 0; c < chan1; c++) {
 377     if (!(cmask & (1 << (chan1 - 1 - c)))) continue;
 378 
 379     sl = adr_src + c;
 380     dl = adr_dst + c;
 381 
 382     for (l = 0; l < n; l++) {
 383       mlib_d64 *buff = buffs[l];


 689         CLAMP_S32(dp[0], s);
 690 
 691         buffn[i] = (mlib_d64)sp[0];
 692 
 693         sp += chan1;
 694         dp += chan1;
 695       }
 696 
 697       for (l = 0; l < (m - 1); l++) buffn[wid + l] = sp[l*chan1];
 698 
 699       /* next line */
 700       sl += sll;
 701       dl += dll;
 702 
 703       buff_ind++;
 704 
 705       if (buff_ind >= n + 1) buff_ind = 0;
 706     }
 707   }
 708 
 709   FREE_AND_RETURN_STATUS
 710 }
 711 
 712 /***************************************************************/
< prev index next >