Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #86 from rdumusc/master
Browse files Browse the repository at this point in the history
Remove obsolete limitation to only open regular power-of-two volumes
  • Loading branch information
Ahmet Bilgili committed Jul 23, 2015
2 parents f753468 + c72edfe commit f92d53b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
2 changes: 2 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog {#Changelog}

# Release 0.4 (git master) {#Release040}

* [#86](https://github.com/BlueBrain/Livre/pull/86):
Removed obsolete limitation to open only regular power-of-two volumes
* [#84](https://github.com/BlueBrain/Livre/pull/84):
Cache statistics are printed when showing statistics (press 's' key)
* [#84](https://github.com/BlueBrain/Livre/pull/84):
Expand Down
30 changes: 0 additions & 30 deletions livre/core/Data/VolumeDataSourcePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,9 @@ void VolumeDataSourcePlugin::internalNodeToLODNode(
boxCoordMax - _volumeInfo.worldSize * 0.5f ));
}

bool isPowerOfTwo( const uint32_t x )
{
return ( x != 0 ) && ( ( x & ( x - 1 ) ) == 0 );
}

bool checkCompatibility( const Vector3ui& volumeDim,
const Vector3ui& blockSize )
{
if( volumeDim.x() % blockSize.x() )
return false;
if( volumeDim.y() % blockSize.y() )
return false;
if( volumeDim.z() % blockSize.z() )
return false;

if( !isPowerOfTwo( volumeDim.x() / blockSize.x() ) )
return false;
if( !isPowerOfTwo( volumeDim.y() / blockSize.y() ) )
return false;
if( !isPowerOfTwo( volumeDim.z() / blockSize.z() ) )
return false;

return true;
}

bool fillRegularVolumeInfo( VolumeInformation& info )
{
const Vector3ui& blockSize = info.maximumBlockSize - info.overlap * 2;
if( !checkCompatibility( info.voxels, blockSize ))
return false;

const float maxDim = float( info.voxels.find_max( ));

info.maximumBlockSize = blockSize + info.overlap * 2;
Expand All @@ -127,6 +99,4 @@ bool fillRegularVolumeInfo( VolumeInformation& info )
return true;
}



}

0 comments on commit f92d53b

Please sign in to comment.