Skip to content

Instantly share code, notes, and snippets.

@rygorous
Created August 13, 2013 01:50
Embed
What would you like to do?
OLD SCHOOL!
static RADFORCEINLINE U32 linear_mix_50(U32 a, U32 b)
{
return (a | b) - (((a ^ b) >> 1) & 0x7f7f7f7f);
}
static void linear_8x8_50_50(char unsigned * RADRESTRICT dest, int dw, char unsigned * RADRESTRICT src_near, char unsigned * RADRESTRICT src_far, int sw)
{
int y;
for( y = 0 ; y < 8 ; y++, src_near += sw, src_far += sw, dest += dw )
{
U32 const * RADRESTRICT srcn32 = (U32 const *) src_near;
U32 const * RADRESTRICT srcf32 = (U32 const *) src_far;
U32 * RADRESTRICT dst32 = (U32 *) dest;
dst32[0] = linear_mix_50(srcn32[0], srcf32[0]);
dst32[1] = linear_mix_50(srcn32[1], srcf32[1]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment