re: rgbutil: namcos22 doesn't mind if it's done this way

This commit is contained in:
Michaël Banaan Ananas 2013-12-31 17:08:33 +00:00
parent 99ca462751
commit c0618cf722
4 changed files with 9 additions and 11 deletions

View File

@ -284,7 +284,7 @@ INLINE void rgbaint_shr(rgbaint *color, UINT8 shift)
INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale)
{
int scale1 = (int)color1scale + 1;
int scale1 = (int)color1scale;
int scale2 = 256 - scale1;
color1->r = (color1->r * scale1 + color2->r * scale2) >> 8;
@ -300,7 +300,7 @@ INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale
INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale)
{
int scale1 = (int)color1scale + 1;
int scale1 = (int)color1scale;
int scale2 = 256 - scale1;
color1->a = (color1->a * scale1 + color2->a * scale2) >> 8;

View File

@ -247,7 +247,7 @@ extern const struct _rgbsse_statics
{
__m128 dummy_for_alignment;
INT16 maxbyte[8];
INT16 scale_table[256+1][8];
INT16 scale_table[256][8];
} rgbsse_statics;
@ -264,7 +264,7 @@ extern const struct _rgbsse_statics
INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale)
{
*color1 = _mm_unpacklo_epi16(*color1, *color2);
*color1 = _mm_madd_epi16(*color1, *(__m128i *)&rgbsse_statics.scale_table[color1scale+1][0]);
*color1 = _mm_madd_epi16(*color1, *(__m128i *)&rgbsse_statics.scale_table[color1scale][0]);
*color1 = _mm_srli_epi32(*color1, 8);
*color1 = _mm_packs_epi32(*color1, *color1);
}

View File

@ -151,8 +151,7 @@ const struct _rgbsse_statics rgbsse_statics =
{ 248, 8, 248, 8, 248, 8, 248, 8 }, { 249, 7, 249, 7, 249, 7, 249, 7 },
{ 250, 6, 250, 6, 250, 6, 250, 6 }, { 251, 5, 251, 5, 251, 5, 251, 5 },
{ 252, 4, 252, 4, 252, 4, 252, 4 }, { 253, 3, 253, 3, 253, 3, 253, 3 },
{ 254, 2, 254, 2, 254, 2, 254, 2 }, { 255, 1, 255, 1, 255, 1, 255, 1 },
{ 256, 0, 256, 0, 256, 0, 256, 0 }
{ 254, 2, 254, 2, 254, 2, 254, 2 }, { 255, 1, 255, 1, 255, 1, 255, 1 }
}
};
#endif // defined(__SSE2__)
@ -296,8 +295,7 @@ const struct _rgbvmx_statics rgbvmx_statics =
{ 248, 8, 248, 8, 248, 8, 248, 8 }, { 249, 7, 249, 7, 249, 7, 249, 7 },
{ 250, 6, 250, 6, 250, 6, 250, 6 }, { 251, 5, 251, 5, 251, 5, 251, 5 },
{ 252, 4, 252, 4, 252, 4, 252, 4 }, { 253, 3, 253, 3, 253, 3, 253, 3 },
{ 254, 2, 254, 2, 254, 2, 254, 2 }, { 255, 1, 255, 1, 255, 1, 255, 1 },
{ 256, 0, 256, 0, 256, 0, 256, 0 }
{ 254, 2, 254, 2, 254, 2, 254, 2 }, { 255, 1, 255, 1, 255, 1, 255, 1 }
}
};
#endif // defined(__ALTIVEC__)

View File

@ -216,7 +216,7 @@ INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2)
extern const struct _rgbvmx_statics
{
rgbaint maxbyte;
rgbaint scale_table[256+1];
rgbaint scale_table[256];
} rgbvmx_statics;
@ -234,7 +234,7 @@ INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale
{
vector signed int temp;
*color1 = vec_mergeh(*color1, *color2);
temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale+1], vec_splat_s32(0));
temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0));
temp = (vector signed int)vec_sr(temp, vec_splat_u32(8));
*color1 = vec_packs(temp, temp);
}
@ -249,7 +249,7 @@ INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1sc
{
vector signed int temp;
*color1 = vec_mergeh(*color1, *color2);
temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale+1], vec_splat_s32(0));
temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0));
temp = (vector signed int)vec_sr(temp, vec_splat_u32(8));
*color1 = vec_packs(temp, temp);
}