Program: 150593
Project: 150593
Buggy source:
public static Planar<GrayU8> yuvToPlanarRgbU8(Image yuv,Planar<GrayU8> output,byte work[]){
  int width=yuv.getWidth();
  int height=yuv.getHeight();
  if (output != null) {
    output.setNumberOfBands(3);
    output.reshape(width,height);
  }
 else {
    output=new Planar(GrayU8.class,width,height,3);
  }
  Image.Plane planes[]=yuv.getPlanes();
  int workLength=planes[0].getRowStride() + planes[1].getRowStride() + planes[2].getRowStride();
  if (work.length < workLength)   throw new IllegalArgumentException("String_Node_Str" + workLength);
  ByteBuffer bufferY=planes[0].getBuffer();
  ByteBuffer bufferU=planes[2].getBuffer();
  ByteBuffer bufferV=planes[1].getBuffer();
  bufferY.position(0);
  bufferU.position(0);
  bufferV.position(0);
  int strideY=planes[0].getRowStride();
  int strideU=planes[1].getRowStride();
  int strideV=planes[2].getRowStride();
  int offsetU=strideY;
  int offsetV=strideY + offsetU;
  int stridePixelUV=planes[1].getPixelStride();
  GrayU8 R=output.getBand(0);
  GrayU8 G=output.getBand(1);
  GrayU8 B=output.getBand(2);
  for (int y=0, indexOut=0; y < height; y++) {
    bufferY.get(work,0,strideY);
    if (y % stridePixelUV == 0) {
      bufferU.get(work,offsetU,Math.min(bufferU.remaining(),strideU));
      bufferV.get(work,offsetV,Math.min(bufferV.remaining(),strideV));
    }
    int indexY=0;
    int indexU=offsetU;
    int indexV=offsetV;
    for (int x=0; x < width; x++, indexY++, indexOut++) {
      int Y=1191 * ((work[indexY] & 0xFF) - 16);
      int CR=(work[indexU] & 0xFF) - 128;
      int CB=(work[indexV] & 0xFF) - 128;
      int stepUV=stridePixelUV * (((x + stridePixelUV - 1) % stridePixelUV) ^ 1);
      indexU+=stepUV;
      indexV+=stepUV;
      Y=((Y >>> 31) ^ 1) * Y;
      int r=(Y + 1836 * CR) >> 10;
      int g=(Y - 547 * CR - 218 * CB) >> 10;
      int b=(Y + 2165 * CB) >> 10;
      r*=((r >>> 31) ^ 1);
      g*=((g >>> 31) ^ 1);
      b*=((b >>> 31) ^ 1);
      if (r > 255)       r=255;
      if (g > 255)       g=255;
      if (b > 255)       b=255;
      R.data[indexOut]=(byte)r;
      G.data[indexOut]=(byte)g;
      B.data[indexOut]=(byte)b;
    }
  }
  return output;
}

Fixed version (ground truth):
public static Planar<GrayU8> yuvToPlanarRgbU8(Image yuv,Planar<GrayU8> output,byte work[]){
  int width=yuv.getWidth();
  int height=yuv.getHeight();
  if (output != null) {
    output.setNumberOfBands(3);
    output.reshape(width,height);
  }
 else {
    output=new Planar(GrayU8.class,width,height,3);
  }
  Image.Plane planes[]=yuv.getPlanes();
  int strideY=planes[0].getRowStride();
  int strideU=planes[2].getRowStride();
  int strideV=planes[1].getRowStride();
  int workLength=strideY + strideU + strideV;
  if (work.length < workLength)   throw new IllegalArgumentException("String_Node_Str" + workLength);
  ByteBuffer bufferY=planes[0].getBuffer();
  ByteBuffer bufferU=planes[2].getBuffer();
  ByteBuffer bufferV=planes[1].getBuffer();
  bufferY.position(0);
  bufferU.position(0);
  bufferV.position(0);
  int offsetU=strideY;
  int offsetV=strideY + strideU;
  int stridePixelUV=planes[1].getPixelStride();
  GrayU8 R=output.getBand(0);
  GrayU8 G=output.getBand(1);
  GrayU8 B=output.getBand(2);
  for (int y=0, indexOut=0; y < height; y++) {
    bufferY.get(work,0,strideY);
    if (y % stridePixelUV == 0) {
      bufferU.get(work,offsetU,Math.min(bufferU.remaining(),strideU));
      bufferV.get(work,offsetV,Math.min(bufferV.remaining(),strideV));
    }
    int indexY=0;
    int indexU=offsetU;
    int indexV=offsetV;
    for (int x=0; x < width; x++, indexY++, indexOut++) {
      int Y=1191 * ((work[indexY] & 0xFF) - 16);
      int CR=(work[indexU] & 0xFF) - 128;
      int CB=(work[indexV] & 0xFF) - 128;
      int stepUV=stridePixelUV * (((x + stridePixelUV - 1) % stridePixelUV) ^ 1);
      indexU+=stepUV;
      indexV+=stepUV;
      Y=((Y >>> 31) ^ 1) * Y;
      int r=(Y + 1836 * CR) >> 10;
      int g=(Y - 547 * CR - 218 * CB) >> 10;
      int b=(Y + 2165 * CB) >> 10;
      r*=((r >>> 31) ^ 1);
      g*=((g >>> 31) ^ 1);
      b*=((b >>> 31) ^ 1);
      if (r > 255)       r=255;
      if (g > 255)       g=255;
      if (b > 255)       b=255;
      R.data[indexOut]=(byte)r;
      G.data[indexOut]=(byte)g;
      B.data[indexOut]=(byte)b;
    }
  }
  return output;
}