Understanding VQ and UnTwiddle algorithms

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
krystalgamer
DCEmu Newbie
DCEmu Newbie
Posts: 1
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun May 12, 2019 2:03 pm
Has thanked: 0
Been thanked: 0

Understanding VQ and UnTwiddle algorithms

Post by krystalgamer »

Hello,

Long time ago I reverse engineered a spiderman game for the PC that used textures in the PSXPVR format which later I came to find out are textures that are twiddled+VQ compressed.

Although I have the twiddle table and the decompression logic: https://github.com/krystalgamer/spidey- ... #L162-L170 , I can't understand what's going on. It picks a value from the twiddle table based on the current x,y and then performs some bitwise magic to find the address the contains the index of the colors to paint.

What's going on with the bitwise operations??
Post Reply