Hello ^^
I'm trying to unswizzle a texture but I can't understand correctly what is written here :( It's sooo complicated, especially for me who doesn't understand english very well :(
I've searched a lot but didn't found any code that does unswizzling.
So I'm asking here: can someone post a routine for unswizzling a texture please? :)
Thank you very much in advance,
Brunni
Unswizzling a texture
Unswizzling a texture
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Code: Select all
void unswizzle_fast(u8* out, const u8* in, unsigned int width, unsigned int height)
{
unsigned int blockx, blocky;
unsigned int i,j;
unsigned int width_blocks = (width / 16);
unsigned int height_blocks = (height / 8);
unsigned int dst_pitch = (width-16)/4;
unsigned int dst_row = width * 8;
u32* src = (u32*)in;
u8* ydst = out;
for (blocky = 0; blocky < height_blocks; ++blocky)
{
const u8* xdst = ydst;
for (blockx = 0; blockx < width_blocks; ++blockx)
{
const u32* dst= (u32*)xdst;
for (j = 0; j < 8; ++j)
{
*(dst++) = *(src++);
*(dst++) = *(src++);
*(dst++) = *(src++);
*(dst++) = *(src++);
dst += dst_pitch;
}
xdst += 16;
}
ydst += dst_row;
}
}
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl
Soooo kind of you :)
It works, thank you so much :D
It works, thank you so much :D
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released