Commit d044ff82 authored by David Flynn's avatar David Flynn
Browse files

refactor: use uint64_t instead of long long for morton codes

parent b5ca7adc
......@@ -392,11 +392,11 @@ AttributeDecoder::decodeReflectancesRaht(
int x = int(position[0]);
int y = int(position[1]);
int z = int(position[2]);
long long mortonCode = 0;
uint64_t mortonCode = 0;
for (int b = 0; b < aps.raht_depth; b++) {
mortonCode |= (long long)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (long long)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (long long)((z >> b) & 1) << (3 * b);
mortonCode |= (uint64_t)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (uint64_t)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (uint64_t)((z >> b) & 1) << (3 * b);
}
packedVoxel[n].mortonCode = mortonCode;
packedVoxel[n].index = n;
......@@ -404,7 +404,7 @@ AttributeDecoder::decodeReflectancesRaht(
sort(packedVoxel.begin(), packedVoxel.end());
// Morton codes
long long* mortonCode = new long long[voxelCount];
uint64_t* mortonCode = new uint64_t[voxelCount];
for (int n = 0; n < voxelCount; n++) {
mortonCode[n] = packedVoxel[n].mortonCode;
}
......@@ -460,11 +460,11 @@ AttributeDecoder::decodeColorsRaht(
int x = int(position[0]);
int y = int(position[1]);
int z = int(position[2]);
long long mortonCode = 0;
uint64_t mortonCode = 0;
for (int b = 0; b < aps.raht_depth; b++) {
mortonCode |= (long long)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (long long)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (long long)((z >> b) & 1) << (3 * b);
mortonCode |= (uint64_t)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (uint64_t)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (uint64_t)((z >> b) & 1) << (3 * b);
}
packedVoxel[n].mortonCode = mortonCode;
packedVoxel[n].index = n;
......@@ -472,7 +472,7 @@ AttributeDecoder::decodeColorsRaht(
sort(packedVoxel.begin(), packedVoxel.end());
// Morton codes
long long* mortonCode = new long long[voxelCount];
uint64_t* mortonCode = new uint64_t[voxelCount];
for (int n = 0; n < voxelCount; n++) {
mortonCode[n] = packedVoxel[n].mortonCode;
}
......
......@@ -664,11 +664,11 @@ AttributeEncoder::encodeReflectancesTransformRaht(
int x = int(position[0]);
int y = int(position[1]);
int z = int(position[2]);
long long mortonCode = 0;
uint64_t mortonCode = 0;
for (int b = 0; b < aps.raht_depth; b++) {
mortonCode |= (long long)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (long long)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (long long)((z >> b) & 1) << (3 * b);
mortonCode |= (uint64_t)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (uint64_t)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (uint64_t)((z >> b) & 1) << (3 * b);
}
packedVoxel[n].mortonCode = mortonCode;
packedVoxel[n].index = n;
......@@ -676,7 +676,7 @@ AttributeEncoder::encodeReflectancesTransformRaht(
sort(packedVoxel.begin(), packedVoxel.end());
// Allocate arrays.
long long* mortonCode = new long long[voxelCount];
uint64_t* mortonCode = new uint64_t[voxelCount];
const int attribCount = 1;
FixedPoint* attributes = new FixedPoint[attribCount * voxelCount];
int* integerizedAttributes = new int[attribCount * voxelCount];
......@@ -749,11 +749,11 @@ AttributeEncoder::encodeColorsTransformRaht(
int x = int(position[0]);
int y = int(position[1]);
int z = int(position[2]);
long long mortonCode = 0;
uint64_t mortonCode = 0;
for (int b = 0; b < aps.raht_depth; b++) {
mortonCode |= (long long)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (long long)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (long long)((z >> b) & 1) << (3 * b);
mortonCode |= (uint64_t)((x >> b) & 1) << (3 * b + 2);
mortonCode |= (uint64_t)((y >> b) & 1) << (3 * b + 1);
mortonCode |= (uint64_t)((z >> b) & 1) << (3 * b);
}
packedVoxel[n].mortonCode = mortonCode;
packedVoxel[n].index = n;
......@@ -761,7 +761,7 @@ AttributeEncoder::encodeColorsTransformRaht(
sort(packedVoxel.begin(), packedVoxel.end());
// Allocate arrays.
long long* mortonCode = new long long[voxelCount];
uint64_t* mortonCode = new uint64_t[voxelCount];
const int attribCount = 3;
FixedPoint* attributes = new FixedPoint[attribCount * voxelCount];
int* integerizedAttributes = new int[attribCount * voxelCount];
......
......@@ -136,7 +136,7 @@ rahtFixedPointInverseRotation(
void
regionAdaptiveHierarchicalTransform(
FixedPoint quantStepSizeLuma,
long long* mortonCode,
uint64_t* mortonCode,
FixedPoint* attributes,
uint64_t* weight,
int* binaryLayer,
......@@ -151,7 +151,7 @@ regionAdaptiveHierarchicalTransform(
FixedPoint* attributesTransformed = new FixedPoint[voxelCount * attribCount];
uint64_t* weightTransformed = new uint64_t[voxelCount];
long long* mortonCodeTransformed = new long long[voxelCount];
uint64_t* mortonCodeTransformed = new uint64_t[voxelCount];
d = 0;
while (N > 1 || d % 2) {
......@@ -235,7 +235,7 @@ regionAdaptiveHierarchicalTransform(
void
regionAdaptiveHierarchicalInverseTransform(
FixedPoint quantStepSizeLuma,
long long* mortonCode,
uint64_t* mortonCode,
FixedPoint* attributes,
uint64_t* weight,
const int attribCount,
......@@ -249,21 +249,21 @@ regionAdaptiveHierarchicalInverseTransform(
FixedPoint* attributesTransformed = new FixedPoint[voxelCount * attribCount];
uint64_t* weightTransformed = new uint64_t[voxelCount];
long long* mortonCodeTransformed = new long long[voxelCount];
uint64_t* mortonCodeTransformed = new uint64_t[voxelCount];
long long** mortonCodeBuffer;
uint64_t** mortonCodeBuffer;
uint64_t** weightBuffer;
size_t* M_buffer;
{
size_t depth = 0;
long long maxMortonCode = mortonCode[voxelCount - 1];
uint64_t maxMortonCode = mortonCode[voxelCount - 1];
while (maxMortonCode--) {
depth++;
maxMortonCode >>= 1;
}
mortonCodeBuffer = new long long*[depth + 1];
mortonCodeBuffer = new uint64_t*[depth + 1];
weightBuffer = new uint64_t*[depth + 1];
M_buffer = new size_t[depth + 1];
}
......@@ -285,7 +285,7 @@ regionAdaptiveHierarchicalInverseTransform(
// Re-obtain weights at the decoder by partially executing the encoder
d = 0;
while (N > 1) {
long long* _mortonCode = new long long[M];
uint64_t* _mortonCode = new uint64_t[M];
uint64_t* _weight = new uint64_t[M];
M_buffer[d] = M;
......
......@@ -43,7 +43,7 @@ namespace pcc {
void regionAdaptiveHierarchicalTransform(
FixedPoint quantStepSizeLuma,
long long* mortonCode,
uint64_t* mortonCode,
FixedPoint* attributes,
uint64_t* weight,
int* binaryLayer,
......@@ -53,7 +53,7 @@ void regionAdaptiveHierarchicalTransform(
void regionAdaptiveHierarchicalInverseTransform(
FixedPoint quantStepSizeLuma,
long long* mortonCode,
uint64_t* mortonCode,
FixedPoint* attributes,
uint64_t* weight,
const int attribCount,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment