cleanup debug, readd fix to not recurse subtrees when node is colored

This commit is contained in:
ZappoMan 2013-11-26 19:23:21 -08:00
parent 2ce9937126
commit 77590b5b87
4 changed files with 19 additions and 45 deletions

View file

@ -619,23 +619,16 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
int flightTime = arrivedAt - sentAt;
int dataBytes = numBytes - VOXEL_PACKET_HEADER_SIZE;
if (true || Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) {
printf("Got Packet... color:%s compressed:%s sequence: %u flightTime:%d size:%d data:%d\n",
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
sequence, flightTime, numBytes, dataBytes);
}
// ask the VoxelTree to read the bitstream into the tree
// need to check for WANT_COLOR vs NO_COLOR
// need to also setup packet properly with enableCompression true/false
ReadBitstreamToTreeParams args(packetIsColored ? WANT_COLOR : NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID());
lockTree();
VoxelPacketData packetData(packetIsCompressed);
packetData.loadFinalizedContent(voxelData, dataBytes);
if (true || Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) {
qDebug("got packet numBytes=%d finalized size %d uncompressed size %d\n",
numBytes, dataBytes, packetData.getUncompressedSize());
if (Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) {
qDebug("Got Packet color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d uncompressed:%d\n",
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
sequence, flightTime, numBytes, dataBytes, packetData.getUncompressedSize());
}
_tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args);
unlockTree();

View file

@ -97,7 +97,7 @@ uint64_t VoxelSendThread::_totalWastedBytes = 0;
uint64_t VoxelSendThread::_totalPackets = 0;
int VoxelSendThread::handlePacketSend(Node* node, VoxelNodeData* nodeData, int& trueBytesSent, int& truePacketsSent) {
bool debug = true; // _myServer->wantsDebugVoxelSending();
bool debug = _myServer->wantsDebugVoxelSending();
uint64_t now = usecTimestampNow();
bool packetSent = false; // did we send a packet?
@ -254,7 +254,7 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
_packetData.changeSettings(wantCompression);
}
if (true || (_myServer->wantsDebugVoxelSending() && _myServer->wantsVerboseDebug())) {
if (_myServer->wantsDebugVoxelSending() && _myServer->wantsVerboseDebug()) {
printf("wantColor/isColor=%s/%s wantCompression/isCompressed=%s/%s viewFrustumChanged=%s, getWantLowResMoving()=%s\n",
debug::valueOf(wantColor), debug::valueOf(nodeData->getCurrentPacketIsColor()),
debug::valueOf(wantCompression), debug::valueOf(nodeData->getCurrentPacketIsCompressed()),
@ -313,15 +313,9 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
unsigned long elapsedTime = nodeData->stats.getElapsedTime();
packetsSentThisInterval += handlePacketSend(node, nodeData, trueBytesSent, truePacketsSent);
bool debug = false;
if (debug) {
qDebug() << "Scene completed at " << usecTimestampNow() <<
" encodeTime: "<< encodeTime <<
" sleepTime: " << sleepTime <<
" elapsed: "<< elapsedTime <<
" Packets:["<< _totalPackets <<"]"<<
" Total Bytes:["<< _totalBytes <<"]"<<
" Wasted bytes:["<< _totalWastedBytes << "]\n";
if (true || _myServer->wantsDebugVoxelSending()) {
qDebug("Scene completed at %llu encodeTime:%lu sleepTime:%lu elapsed:%lu Packets:%llu Bytes:%llu Wasted:%llu\n",
usecTimestampNow(), encodeTime, sleepTime, elapsedTime, _totalPackets, _totalBytes, _totalWastedBytes);
}
}
@ -339,16 +333,14 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
nodeData->nodeBag.deleteAll();
}
bool debug = false;
if (debug) {
qDebug() << "Scene started at " << usecTimestampNow() <<
" Packets:["<< _totalPackets <<"]"<<
" Total Bytes:["<< _totalBytes <<"]"<<
" Wasted bytes:["<< _totalWastedBytes << "]\n";
if (_myServer->wantsDebugVoxelSending()) {
qDebug("Scene started at %llu Packets:%llu Bytes:%llu Wasted:%llu\n",
usecTimestampNow(),_totalPackets,_totalBytes,_totalWastedBytes);
}
::startSceneSleepTime = _usleepTime;
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, _myServer->getServerTree().rootNode, _myServer->getJurisdiction());
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged,
_myServer->getServerTree().rootNode, _myServer->getJurisdiction());
// This is the start of "resending" the scene.
bool dontRestartSceneOnMove = false; // this is experimental
@ -479,7 +471,6 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod
elapsedmsec, elapsedCompressTimeMsecs, elapsedCompressCalls, trueBytesSent, truePacketsSent, nodeData->nodeBag.count());
}
} else if (_myServer->wantsDebugVoxelSending() && _myServer->wantsVerboseDebug()) {
printf("packetLoop() took %d milliseconds [%d milliseconds %d calls in compress] to generate %d bytes in %d packets, %d nodes still to send\n",
elapsedmsec, elapsedCompressTimeMsecs, elapsedCompressCalls, trueBytesSent, truePacketsSent, nodeData->nodeBag.count());
}

View file

@ -128,9 +128,6 @@ const unsigned char* VoxelPacketData::getFinalizedData() {
}
checkCompress();
}
printf("VoxelPacketData::getFinalizedData()... _bytesInUse=%d compressed version..._compressedBytes=%d\n",_bytesInUse, _compressedBytes);
return &_compressed[0];
}
@ -281,21 +278,13 @@ void VoxelPacketData::loadFinalizedContent(const unsigned char* data, int length
if (_enableCompression) {
QByteArray compressedData;
printf("VoxelPacketData::loadCompressedContent()... copying %d bytes into compressedData \n", length);
for (int i = 0; i < length; i++) {
compressedData[i] = data[i];
_compressed[i] = compressedData[i];
}
_compressedBytes = length;
printf("VoxelPacketData::loadCompressedContent()... compressedData.size()=%d\n", compressedData.size());
QByteArray uncompressedData = qUncompress(compressedData);
printf("VoxelPacketData::loadCompressedContent()... uncompressedData.size()=%d\n", uncompressedData.size());
if (uncompressedData.size() <= _bytesAvailable) {
printf("VoxelPacketData::loadCompressedContent()... copying %d bytes into _uncompressed[] \n", uncompressedData.size());
_bytesInUse = uncompressedData.size();
_bytesAvailable -= uncompressedData.size();
@ -310,12 +299,13 @@ void VoxelPacketData::loadFinalizedContent(const unsigned char* data, int length
_bytesInUse = _compressedBytes = length;
}
} else {
if (_debug) printf("VoxelPacketData::loadCompressedContent()... length = 0, nothing to do...\n");
if (_debug) {
printf("VoxelPacketData::loadCompressedContent()... length = 0, nothing to do...\n");
}
}
}
void VoxelPacketData::debugContent() {
printf("VoxelPacketData::debugContent()... COMPRESSED DATA.... size=%d\n",_compressedBytes);
int perline=0;
for (int i = 0; i < _compressedBytes; i++) {

View file

@ -1542,7 +1542,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node,
//
// This only applies in the view frustum case, in other cases, like file save and copy/past where
// no viewFrustum was requested, we still want to recurse the child tree.
if (true || !params.viewFrustum || !oneAtBit(childrenColoredBits, originalIndex)) {
if (!params.viewFrustum || !oneAtBit(childrenColoredBits, originalIndex)) {
childTreeBytesOut = encodeTreeBitstreamRecursion(childNode, packetData, bag, params, thisLevel);
}