public static java.awt.Color twoColorFromYUV(byte y, byte u, byte v) { return new java.awt.Color(Ts.twoColorFromYUVInt(y, u, v)); } public static int twoColorFromYUVInt(byte y, byte u, byte v) { int red = (298 * ((y & 0xFF) - 16) + 409 * ((v & 0xFF) - 128) + 128) >> 8; int green = (298 * ((y & 0xFF) - 16) - 100 * ((u & 0xFF) - 128) - 208 * ((v & 0xFF) - 128) + 128) >> 8; int blue = (298 * ((y & 0xFF) - 16) + 516 * ((u & 0xFF) - 128) + 128) >> 8; red = red > 255 ? 255 : (red < 0 ? 0 : red); green = green > 255 ? 255 : (green < 0 ? 0 : green); blue = blue > 255 ? 255 : (blue < 0 ? 0 : blue); return ((red << 16) | (green << 8) | blue); }