avoid more unnecessary UINT32<->rgb_t conversions (nw)

This commit is contained in:
Oliver Stöneberg 2014-04-07 11:18:04 +00:00
parent c2ea61475b
commit 813e3265cf
2 changed files with 13 additions and 13 deletions

View File

@ -144,10 +144,10 @@ private:
const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base); const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base);
texbase += v0 * texture.rowpixels + u0; texbase += v0 * texture.rowpixels + u0;
rgb_t pix00 = texture.palette[texbase[0]]; UINT32 pix00 = texture.palette[texbase[0]];
rgb_t pix01 = texture.palette[texbase[u1]]; UINT32 pix01 = texture.palette[texbase[u1]];
rgb_t pix10 = texture.palette[texbase[v1]]; UINT32 pix10 = texture.palette[texbase[v1]];
rgb_t pix11 = texture.palette[texbase[u1 + v1]]; UINT32 pix11 = texture.palette[texbase[u1 + v1]];
return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
} }
else else
@ -214,10 +214,10 @@ private:
const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base); const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base);
texbase += v0 * texture.rowpixels + (u0 & ~1); texbase += v0 * texture.rowpixels + (u0 & ~1);
rgb_t pix00, pix01, pix10, pix11; UINT32 pix00, pix01, pix10, pix11;
if ((curu & 0x10000) == 0) if ((curu & 0x10000) == 0)
{ {
rgb_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); UINT32 cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16);
pix00 = (texbase[0] >> 8) | cbcr; pix00 = (texbase[0] >> 8) | cbcr;
pix01 = (texbase[u1] >> 8) | cbcr; pix01 = (texbase[u1] >> 8) | cbcr;
cbcr = ((texbase[v1 + 0] & 0xff) << 8) | ((texbase[v1 + 1] & 0xff) << 16); cbcr = ((texbase[v1 + 0] & 0xff) << 8) | ((texbase[v1 + 1] & 0xff) << 16);
@ -226,7 +226,7 @@ private:
} }
else else
{ {
rgb_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); UINT32 cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16);
pix00 = (texbase[1] >> 8) | cbcr; pix00 = (texbase[1] >> 8) | cbcr;
if (u1 != 0) if (u1 != 0)
{ {
@ -276,10 +276,10 @@ private:
const UINT32 *texbase = reinterpret_cast<const UINT32 *>(texture.base); const UINT32 *texbase = reinterpret_cast<const UINT32 *>(texture.base);
texbase += v0 * texture.rowpixels + u0; texbase += v0 * texture.rowpixels + u0;
rgb_t pix00 = texbase[0]; UINT32 pix00 = texbase[0];
rgb_t pix01 = texbase[u1]; UINT32 pix01 = texbase[u1];
rgb_t pix10 = texbase[v1]; UINT32 pix10 = texbase[v1];
rgb_t pix11 = texbase[u1 + v1]; UINT32 pix11 = texbase[u1 + v1];
return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
} }
else else

View File

@ -374,7 +374,7 @@ INLINE void rgbaint_scale_channel_and_clamp(rgbaint *color, const rgbaint *color
code provided by Michael Herf code provided by Michael Herf
-------------------------------------------------*/ -------------------------------------------------*/
INLINE rgb_t rgb_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) INLINE UINT32 rgb_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
{ {
UINT32 ag0, ag1, rb0, rb1; UINT32 ag0, ag1, rb0, rb1;
@ -396,7 +396,7 @@ INLINE rgb_t rgb_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT3
code provided by Michael Herf code provided by Michael Herf
-------------------------------------------------*/ -------------------------------------------------*/
INLINE rgb_t rgba_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) INLINE UINT32 rgba_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
{ {
UINT32 ag0, ag1, rb0, rb1; UINT32 ag0, ag1, rb0, rb1;