mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-24 01:23:38 +00:00
Some small refactoring.
This commit is contained in:
parent
bcf7c5c389
commit
838d1f7b6e
1 changed files with 10 additions and 20 deletions
|
@ -487,11 +487,8 @@ namespace PVRTCC {
|
||||||
}
|
}
|
||||||
|
|
||||||
static FasTC::Pixel BilerpPixels(uint32 x, uint32 y,
|
static FasTC::Pixel BilerpPixels(uint32 x, uint32 y,
|
||||||
const FasTC::Pixel &p, FasTC::Pixel &fp,
|
const FasTC::Pixel &topLeft, const FasTC::Pixel &topRight,
|
||||||
const FasTC::Pixel &topLeft,
|
const FasTC::Pixel &bottomLeft, const FasTC::Pixel &bottomRight) {
|
||||||
const FasTC::Pixel &topRight,
|
|
||||||
const FasTC::Pixel &bottomLeft,
|
|
||||||
const FasTC::Pixel &bottomRight) {
|
|
||||||
|
|
||||||
const uint32 highXWeight = x;
|
const uint32 highXWeight = x;
|
||||||
const uint32 lowXWeight = 4 - x;
|
const uint32 lowXWeight = 4 - x;
|
||||||
|
@ -510,13 +507,12 @@ namespace PVRTCC {
|
||||||
const FasTC::Pixel br = bottomRight * bottomRightWeight;
|
const FasTC::Pixel br = bottomRight * bottomRightWeight;
|
||||||
const FasTC::Pixel sum = tl + tr + bl + br;
|
const FasTC::Pixel sum = tl + tr + bl + br;
|
||||||
|
|
||||||
|
FasTC::Pixel fp;
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
for(uint32 c = 0; c < 4; c++) {
|
||||||
fp.Component(c) = sum.Component(c) & 15;
|
fp.Component(c) = sum.Component(c) & 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
FasTC::Pixel tmp(p);
|
FasTC::Pixel tmp(sum / 16);
|
||||||
tmp = sum / (16);
|
|
||||||
|
|
||||||
tmp.A() = (tmp.A() << 4) | tmp.A();
|
tmp.A() = (tmp.A() << 4) | tmp.A();
|
||||||
tmp.G() = (tmp.G() << 3) | (tmp.G() >> 2);
|
tmp.G() = (tmp.G() << 3) | (tmp.G() >> 2);
|
||||||
tmp.B() = (tmp.B() << 3) | (tmp.B() >> 2);
|
tmp.B() = (tmp.B() << 3) | (tmp.B() >> 2);
|
||||||
|
@ -553,16 +549,10 @@ namespace PVRTCC {
|
||||||
|
|
||||||
const uint32 *pixels = reinterpret_cast<const uint32 *>(inBuf);
|
const uint32 *pixels = reinterpret_cast<const uint32 *>(inBuf);
|
||||||
|
|
||||||
// Make sure the bit depth matches the original...
|
// !SPEED! When we're iterating over the blocks here, we don't need to load from outBlocks
|
||||||
FasTC::Pixel p;
|
// every iteration of the loop. Once we finish with a block, topLeft becomes topRight and
|
||||||
uint8 bitDepth[4] = { 4, 5, 5, 5 };
|
// bottomLeft becomes bottomRight. Also, when we go to the next row, bottomRight becomes
|
||||||
p.ChangeBitDepth(bitDepth);
|
// topLeft.
|
||||||
|
|
||||||
// Save fractional bits
|
|
||||||
FasTC::Pixel fp;
|
|
||||||
uint8 fpDepths[4] = { 4, 4, 4, 4 };
|
|
||||||
fp.ChangeBitDepth(fpDepths);
|
|
||||||
|
|
||||||
for(uint32 j = 0; j < blocksH; j++) {
|
for(uint32 j = 0; j < blocksH; j++) {
|
||||||
for(uint32 i = 0; i < blocksW; i++) {
|
for(uint32 i = 0; i < blocksW; i++) {
|
||||||
|
|
||||||
|
@ -609,8 +599,8 @@ namespace PVRTCC {
|
||||||
for(uint32 x = 0; x < 4; x++) {
|
for(uint32 x = 0; x < 4; x++) {
|
||||||
uint32 pixelX = (i*4 + 2 + x) & (w - 1);
|
uint32 pixelX = (i*4 + 2 + x) & (w - 1);
|
||||||
uint32 pixelY = (j*4 + 2 + y) & (h - 1);
|
uint32 pixelY = (j*4 + 2 + y) & (h - 1);
|
||||||
FasTC::Pixel colorA = BilerpPixels(x, y, p, fp, topLeftA, topRightA, bottomLeftA, bottomRightA);
|
FasTC::Pixel colorA = BilerpPixels(x, y, topLeftA, topRightA, bottomLeftA, bottomRightA);
|
||||||
FasTC::Pixel colorB = BilerpPixels(x, y, p, fp, topLeftB, topRightB, bottomLeftB, bottomRightB);
|
FasTC::Pixel colorB = BilerpPixels(x, y, topLeftB, topRightB, bottomLeftB, bottomRightB);
|
||||||
FasTC::Pixel original(pixels[pixelY * w + pixelX]);
|
FasTC::Pixel original(pixels[pixelY * w + pixelX]);
|
||||||
|
|
||||||
// !FIXME! there are two modulation modes... we're only using one.
|
// !FIXME! there are two modulation modes... we're only using one.
|
||||||
|
|
Loading…
Reference in a new issue