public static byte[] compressRow(byte[] b) {
		try {
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			byte active = b[0];
			byte same = (byte) -127;
			for (int i = 1; i < b.length; i++) {
				if (b[i] == active && same < 127) same += 1;
				else {
					baos.write(new byte[] { same, active });
					same = -127;
					active = b[i];
				}
			}
			
			baos.write(new byte[] { same, active });
			
			return baos.toByteArray();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}