Commit 450a3f41 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Simplify filestats() now that class LookupTable exposes more members.

parent 06fa5cce
......@@ -354,26 +354,9 @@ public:
// consecutively and the brick lookup table comes last.
result._header_size = _meta->oh().bricklupoff() + _meta->oh().bricklupsize();
const std::vector<std::array<std::int64_t,3>>& lodsizes = _meta->ih().lodsizes();
const std::vector<std::int64_t>& alphaoffsets = _meta->ih().alphaoffsets();
const std::vector<std::int64_t>& brickoffsets = _meta->ih().brickoffsets();
// This had been much simpler if I made a getBrickFilePositionByIndex.
// And possibly moving part of this code inside class LookupTable.
// I only need to iterate over the contents of alup, blup, bend
// but here I need to iterate over brick positiom and let class
// LookupTable convert that back to a raw index.
std::array<std::int64_t,3> size = _meta->ih().size();
const std::array<std::int64_t,3> bs = _meta->ih().bricksize();
for (std::int64_t lod= 0; lod < _meta->ih().nlods(); ++lod) {
for (std::int64_t ii = 0; ii < size[0]; ii += bs[0]) {
for (std::int64_t jj = 0; jj < size[1]; jj += bs[1]) {
for (std::size_t ix = 0; ix < alup.size(); ++ix) {
LookupTable::LutInfo info =
LookupTable::getAlphaFilePosition
(ii/bs[0], jj/bs[1], lod,
lodsizes,
alphaoffsets, alup, /*aend,*/
bytesperalpha);
//std::cout<< zgydump_format(ii/bs[0], jj/bs[1], 0, lod, info) << "\n";
LookupTable::getAlphaFilePositionFromIndex(ix, alup, bytesperalpha);
switch (info.status) {
case BrickStatus::Missing: result._alpha_missing_count += 1; break;
case BrickStatus::Constant: result._alpha_constant_count += 1; break;
......@@ -385,14 +368,10 @@ public:
result._alpha_compressed_size += info.size_in_file;
break;
}
for (std::int64_t kk = 0; kk < size[2]; kk += bs[2]) {
}
for (std::size_t ix = 0; ix < blup.size(); ++ix) {
LookupTable::LutInfo info =
LookupTable::getBrickFilePosition
(ii/bs[0], jj/bs[1], kk/bs[2], lod,
lodsizes,
brickoffsets, blup, bend,
bytesperbrick);
//std::cout << zgydump_format(ii/bs[0], jj/bs[1], kk/bs[2], lod, info) << "\n";
LookupTable::getBrickFilePositionFromIndex(ix, blup, bend, bytesperbrick);
switch (info.status) {
case BrickStatus::Missing: result._brick_missing_count += 1; break;
case BrickStatus::Constant: result._brick_constant_count += 1; break;
......@@ -404,12 +383,6 @@ public:
break;
}
}
}
}
size[0] = (size[0]+1)/2;
size[1] = (size[1]+1)/2;
size[2] = (size[2]+1)/2;
}
// TODO-Low: Keep track of wasted_size and padding_size.
// Padding gets added in ZgyInternalMeta::flushMeta(). I need to
......
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