Program: 154030
Project: 154030
Buggy source:
/** 
 * Scale the given rectangle by the specified scale and translation  factors. The sources are cobbled.
 * @param sources   an array of sources, guarantee to provide allnecessary source data for computing the rectangle.
 * @param dest      a tile that contains the rectangle to be computed.
 * @param destRect  the rectangle within this OpImage to be processed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  InterpolationTable jtable=(InterpolationTable)interp;
  mediaLibImageInterpTable mlibInterpTable;
  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);
  float mlibScaleX=(float)scaleXRationalNum / (float)scaleXRationalDenom;
  float mlibScaleY=(float)scaleYRationalNum / (float)scaleYRationalDenom;
  float tempDX=(float)(srcRect.x * scaleXRationalNum) / (float)scaleXRationalDenom;
  float tempDY=(float)(srcRect.y * scaleYRationalNum) / (float)scaleYRationalDenom;
  float tx=transX - destRect.x + tempDX;
  float ty=transY - destRect.y + tempDY;
  mediaLibImage srcML[], dstML[];
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
    mlibInterpTable=new mediaLibImageInterpTable(Constants.MLIB_INT,jtable.getWidth(),jtable.getHeight(),jtable.getLeftPadding(),jtable.getTopPadding(),jtable.getSubsampleBitsH(),jtable.getSubsampleBitsV(),jtable.getPrecisionBits(),jtable.getHorizontalTableData(),jtable.getVerticalTableData());
  srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
for (int i=0; i < dstML.length; i++) {
Image.ZoomTranslateTable(dstML[i],srcML[i],(double)mlibScaleX,(double)mlibScaleY,(double)tx,(double)ty,mlibInterpTable,Constants.MLIB_EDGE_DST_NO_WRITE);
}
break;
case DataBuffer.TYPE_FLOAT:
mlibInterpTable=new mediaLibImageInterpTable(Constants.MLIB_FLOAT,jtable.getWidth(),jtable.getHeight(),jtable.getLeftPadding(),jtable.getTopPadding(),jtable.getSubsampleBitsH(),jtable.getSubsampleBitsV(),jtable.getPrecisionBits(),jtable.getHorizontalTableDataFloat(),jtable.getVerticalTableDataFloat());
srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
for (int i=0; i < dstML.length; i++) {
Image.ZoomTranslateTable_Fp(dstML[i],srcML[i],(double)mlibScaleX,(double)mlibScaleY,(double)tx,(double)ty,mlibInterpTable,Constants.MLIB_EDGE_DST_NO_WRITE);
}
break;
case DataBuffer.TYPE_DOUBLE:
mlibInterpTable=new mediaLibImageInterpTable(Constants.MLIB_DOUBLE,jtable.getWidth(),jtable.getHeight(),jtable.getLeftPadding(),jtable.getTopPadding(),jtable.getSubsampleBitsH(),jtable.getSubsampleBitsV(),jtable.getPrecisionBits(),jtable.getHorizontalTableDataDouble(),jtable.getVerticalTableDataDouble());
srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
for (int i=0; i < dstML.length; i++) {
Image.ZoomTranslateTable_Fp(dstML[i],srcML[i],(double)mlibScaleX,(double)mlibScaleY,(double)tx,(double)ty,mlibInterpTable,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.clampDataArrays();
dstAccessor.copyDataToRaster();
}
}

Fixed version (ground truth):
/** 
 * Scale the given rectangle by the specified scale and translation  factors. The sources are cobbled.
 * @param sources   an array of sources, guarantee to provide allnecessary source data for computing the rectangle.
 * @param dest      a tile that contains the rectangle to be computed.
 * @param destRect  the rectangle within this OpImage to be processed.
 */
protected void computeRect(Raster[] sources,WritableRaster dest,Rectangle destRect){
  InterpolationTable jtable=(InterpolationTable)interp;
  mediaLibImageInterpTable mlibInterpTable;
  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);
  float mlibScaleX=(float)scaleXRationalNum / (float)scaleXRationalDenom;
  float mlibScaleY=(float)scaleYRationalNum / (float)scaleYRationalDenom;
  float tempDX=(float)(srcRect.x * scaleXRationalNum) / (float)scaleXRationalDenom;
  float tempDY=(float)(srcRect.y * scaleYRationalNum) / (float)scaleYRationalDenom;
  float tx=transX - destRect.x + tempDX;
  float ty=transY - destRect.y + tempDY;
  mediaLibImage srcML[], dstML[];
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
    mlibInterpTable=new mediaLibImageInterpTable(Constants.MLIB_INT,jtable.getWidth(),jtable.getHeight(),jtable.getLeftPadding(),jtable.getTopPadding(),jtable.getSubsampleBitsH(),jtable.getSubsampleBitsV(),jtable.getPrecisionBits(),jtable.getHorizontalTableData(),jtable.getVerticalTableData());
  srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
for (int i=0; i < dstML.length; i++) {
Image.ZoomTranslateTable(dstML[i],srcML[i],(double)mlibScaleX,(double)mlibScaleY,(double)tx,(double)ty,mlibInterpTable,Constants.MLIB_EDGE_DST_NO_WRITE);
MlibUtils.clampImage(dstML[i],getColorModel());
}
break;
case DataBuffer.TYPE_FLOAT:
mlibInterpTable=new mediaLibImageInterpTable(Constants.MLIB_FLOAT,jtable.getWidth(),jtable.getHeight(),jtable.getLeftPadding(),jtable.getTopPadding(),jtable.getSubsampleBitsH(),jtable.getSubsampleBitsV(),jtable.getPrecisionBits(),jtable.getHorizontalTableDataFloat(),jtable.getVerticalTableDataFloat());
srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
for (int i=0; i < dstML.length; i++) {
Image.ZoomTranslateTable_Fp(dstML[i],srcML[i],(double)mlibScaleX,(double)mlibScaleY,(double)tx,(double)ty,mlibInterpTable,Constants.MLIB_EDGE_DST_NO_WRITE);
}
break;
case DataBuffer.TYPE_DOUBLE:
mlibInterpTable=new mediaLibImageInterpTable(Constants.MLIB_DOUBLE,jtable.getWidth(),jtable.getHeight(),jtable.getLeftPadding(),jtable.getTopPadding(),jtable.getSubsampleBitsH(),jtable.getSubsampleBitsV(),jtable.getPrecisionBits(),jtable.getHorizontalTableDataDouble(),jtable.getVerticalTableDataDouble());
srcML=srcAccessor.getMediaLibImages();
dstML=dstAccessor.getMediaLibImages();
for (int i=0; i < dstML.length; i++) {
Image.ZoomTranslateTable_Fp(dstML[i],srcML[i],(double)mlibScaleX,(double)mlibScaleY,(double)tx,(double)ty,mlibInterpTable,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.clampDataArrays();
dstAccessor.copyDataToRaster();
}
}