void SendImageViaUDP(object sender, UInt16[] depthImage, byte[] rgbImage) { DateTime dateTimeNow = DateTime.Now; byte[] dateTimeNowByte = Encoding.ASCII.GetBytes(dateTimeNow.ToString()); client.Send(dateTimeNowByte, dateTimeNowByte.GetLength(0)); int length = depthImage.GetLength(0)*sizeof(UInt16); byte[] toSend = new byte[length]; byte[] dummy = new byte[2]; int maxUDPlength = 65000; int numberOfMesg = length / maxUDPlength + 1; for (int i = 0; i < maxUDPlength/2; i++) { dummy = BitConverter.GetBytes(depthImage[i]); toSend[2*i] = dummy[0]; toSend[2*i+1] = dummy[1]; } client.Send(toSend, maxUDPlength); /* // send 3 messsages for (int mes = 0; mes < numberOfMesg; mes++) { for (int i = 0; i < maxUDPlength / 2; i++) { dummy = BitConverter.GetBytes(depthImage[i]); toSend[i] = dummy[0]; toSend[i + 1] = dummy[1]; } } */ //client.Send(toSend, length); }
//return the row in the cache memory the memory location would be stored at private int adressRow(int adress, UInt16[,] cache) { return (adress & ((cache.GetLength(1) - 1) * rowSize)) / rowSize; }
//return the row in the cache memory the memory location would be stored at private int adressRow(int adress, UInt16[,] cache) { //I don't think this works //return (adress & (cache.GetLength(1) - 1)/*Removes unneccecary zeroes at the high bits*/) / rowSize; return (adress & ((cache.GetLength(1) - 1) * rowSize)) / rowSize; }