qDebug()<<"CAMERAVIEW: OVERFLOW! startIndex:"<<startIndex<<"length:"<<length<<"image raw size"<<((receivedWidth*receivedHeight*receivedChannels*receivedDepth)/8)-1;
}else{
memcpy(rawImage+startIndex,imageData,length);
rawLastIndex=startIndex+length;
// Check if we just reached the end of the image
if(startIndex+length==rawExpectedBytes){
//qDebug() << "CAMERAVIEW: END OF IMAGE REACHED!";
finishImage();
rawLastIndex=0;
}
}
// for (int i = 0; i < length; i++)
// {
// for (int j = 0; j < receivedChannels; j++)
// {
// unsigned int x = (startIndex+i) % receivedWidth;
// unsigned int y = static_cast<unsigned int>((startIndex+i) / receivedWidth);
// qDebug() << "Setting pixel" << x << "," << y << "to" << (unsigned int)*(rawImage+startIndex+i);