TextureDecoder: Deduplicate some utility code

This commit is contained in:
hthh
2017-01-14 11:29:05 +11:00
parent 5d4e4aa561
commit 88d52b4d69
6 changed files with 31 additions and 43 deletions

View File

@ -14,6 +14,7 @@
#include "VideoCommon/LookUpTables.h"
#include "VideoCommon/TextureDecoder.h"
#include "VideoCommon/TextureDecoder_Util.h"
// GameCube/Wii texture decoder
@ -57,13 +58,6 @@ static inline u32 DecodePixel_RGB5A3(u16 val)
return r | (g << 8) | (b << 16) | (a << 24);
}
struct DXTBlock
{
u16 color1;
u16 color2;
u8 lines[4];
};
static inline void DecodeBytes_C4_IA8(u32* dst, const u8* src, const u8* tlut_)
{
const u16* tlut = (u16*)tlut_;
@ -168,11 +162,6 @@ static inline void DecodeBytes_IA4(u32* dst, const u8* src)
}
#ifdef CHECK
static inline u32 MakeRGBA(int r, int g, int b, int a)
{
return (a << 24) | (b << 16) | (g << 8) | r;
}
static void DecodeDXTBlock(u32* dst, const DXTBlock* src, int pitch)
{
// S3TC Decoder (Note: GCN decodes differently from PC so we can't use native support)
@ -190,7 +179,6 @@ static void DecodeDXTBlock(u32* dst, const DXTBlock* src, int pitch)
colors[1] = MakeRGBA(red2, green2, blue2, 255);
if (c1 > c2)
{
// Approximation of x/3: 3/8 (1/2 - 1/8)
colors[2] =
MakeRGBA(DXTBlend(red2, red1), DXTBlend(green2, green1), DXTBlend(blue2, blue1), 255);
colors[3] =