Program: 154026
Project: 154026
Buggy source:
/** 
 * Performs bilinear affine transformation on a specified rectangle.  The sources are cobbled and extended.
 * @param sources an array of source Rasters, guaranteed to provide allnecessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  Raster source=sources[0];
  Rectangle srcRect=source.getBounds();
  int formatTag=MediaLibAccessor.findCompatibleTag(sources,dest);
  MediaLibAccessor srcAccessor=new MediaLibAccessor(source,srcRect,formatTag);
  MediaLibAccessor dstAccessor=new MediaLibAccessor(dest,destRect,formatTag);
  double[] medialib_tr=(double[])this.medialib_tr.clone();
  medialib_tr[2]=m_transform[0] * srcRect.x + m_transform[1] * srcRect.y + m_transform[2] - destRect.x;
  medialib_tr[5]=m_transform[3] * srcRect.x + m_transform[4] * srcRect.y + m_transform[5] - destRect.y;
  mediaLibImage srcML[], dstML[];
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
    srcML=srcAccessor.getMediaLibImages();
  dstML=dstAccessor.getMediaLibImages();
if (setBackground) Image.Affine2(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE,intBackgroundValues);
 else Image.Affine(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE);
break;
case DataBuffer.TYPE_FLOAT:
case DataBuffer.TYPE_DOUBLE:
srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
if (setBackground) Image.Affine2_Fp(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE,backgroundValues);
 else Image.Affine_Fp(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE);
break;
default :
String className=this.getClass().getName();
throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
}
if (dstAccessor.isDataCopy()) {
dstAccessor.copyDataToRaster();
}
}

Fixed version (ground truth):
/** 
 * Performs bilinear affine transformation on a specified rectangle.  The sources are cobbled and extended.
 * @param sources an array of source Rasters, guaranteed to provide allnecessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  Raster source=sources[0];
  Rectangle srcRect=source.getBounds();
  int formatTag=MediaLibAccessor.findCompatibleTag(sources,dest);
  MediaLibAccessor srcAccessor=new MediaLibAccessor(source,srcRect,formatTag);
  MediaLibAccessor dstAccessor=new MediaLibAccessor(dest,destRect,formatTag);
  double[] medialib_tr=(double[])this.medialib_tr.clone();
  medialib_tr[2]=m_transform[0] * srcRect.x + m_transform[1] * srcRect.y + m_transform[2] - destRect.x;
  medialib_tr[5]=m_transform[3] * srcRect.x + m_transform[4] * srcRect.y + m_transform[5] - destRect.y;
  mediaLibImage srcML[], dstML[];
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
    srcML=srcAccessor.getMediaLibImages();
  dstML=dstAccessor.getMediaLibImages();
if (setBackground) Image.Affine2(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE,intBackgroundValues);
 else Image.Affine(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE);
MlibUtils.clampImage(dstML[0],getColorModel());
break;
case DataBuffer.TYPE_FLOAT:
case DataBuffer.TYPE_DOUBLE:
srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
if (setBackground) Image.Affine2_Fp(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE,backgroundValues);
 else Image.Affine_Fp(dstML[0],srcML[0],medialib_tr,Constants.MLIB_BILINEAR,Constants.MLIB_EDGE_DST_NO_WRITE);
break;
default :
String className=this.getClass().getName();
throw new RuntimeException(JaiI18N.getString("String_Node_Str"));
}
if (dstAccessor.isDataCopy()) {
dstAccessor.copyDataToRaster();
}
}