From 2263080faadacbf44c9ce5c218f9ff099daacfab Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 6 Sep 2013 01:55:06 -0400 Subject: [PATCH] Fix the interleaving by doing it when we're actually reading in the blocks --- PVRTCEncoder/src/Decompressor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PVRTCEncoder/src/Decompressor.cpp b/PVRTCEncoder/src/Decompressor.cpp index b772756..40547de 100644 --- a/PVRTCEncoder/src/Decompressor.cpp +++ b/PVRTCEncoder/src/Decompressor.cpp @@ -105,7 +105,12 @@ namespace PVRTCC { for(uint32 j = 0; j < blocksH; j++) { for(uint32 i = 0; i < blocksW; i++) { - uint32 offset = (j * blocksW + i) * blockSz; + + // The blocks are initially arranged in morton order. Let's + // linearize them... + uint32 idx = Interleave(j, i); + + uint32 offset = idx * blockSz; blocks.push_back( Block(dcj.inBuf + offset) ); } } @@ -119,11 +124,7 @@ namespace PVRTCC { for(uint32 j = 0; j < blocksH; j++) { for(uint32 i = 0; i < blocksW; i++) { - // The blocks are initially arranged in morton order. Let's - // linearize them... (yes I know there are faster algorithms - // to do this out there) - uint32 idx = Interleave(i, j); - // uint32 idx = j * blocksW + i; + uint32 idx = j * blocksW + i; assert(idx < static_cast(blocks.size())); Block &b = blocks[idx];