for (int i = 0; i < sb.capacity(); i++) {
db.put(i, (byte)Math.max(Math.min(sb.get(i) & 0xFF,max),min));
}
break; }
case IPL_DEPTH_16U: {
ShortBuffer sb = src.getByteBuffer().asShortBuffer();
ShortBuffer db = dst.getByteBuffer().asShortBuffer();
for (int i = 0; i < sb.capacity(); i++) {
db.put(i, (short)Math.max(Math.min(sb.get(i) & 0xFFFF,max),min));
}
break; }
case IPL_DEPTH_32F: {
FloatBuffer sb = src.getByteBuffer().asFloatBuffer();
FloatBuffer db = dst.getByteBuffer().asFloatBuffer();
for (int i = 0; i < sb.capacity(); i++) {
db.put(i, (float)Math.max(Math.min(sb.get(i),max),min));
}
break; }
case IPL_DEPTH_8S: {
ByteBuffer sb = src.getByteBuffer();
ByteBuffer db = dst.getByteBuffer();
for (int i = 0; i < sb.capacity(); i++) {
db.put(i, (byte)Math.max(Math.min(sb.get(i),max),min));
}
break; }
case IPL_DEPTH_16S: {
ShortBuffer sb = src.getByteBuffer().asShortBuffer();
ShortBuffer db = dst.getByteBuffer().asShortBuffer();
for (int i = 0; i < sb.capacity(); i++) {
db.put(i, (short)Math.max(Math.min(sb.get(i),max),min));
}
break; }
case IPL_DEPTH_32S: {
IntBuffer sb = src.getByteBuffer().asIntBuffer();
IntBuffer db = dst.getByteBuffer().asIntBuffer();
for (int i = 0; i < sb.capacity(); i++) {
db.put(i, (int)Math.max(Math.min(sb.get(i),max),min));
}
break; }
case IPL_DEPTH_64F: {
DoubleBuffer sb = src.getByteBuffer().asDoubleBuffer();
DoubleBuffer db = dst.getByteBuffer().asDoubleBuffer();
for (int i = 0; i < sb.capacity(); i++) {
db.put(i, Math.max(Math.min(sb.get(i),max),min));
}
break; }
default: assert(false);
}