So while I were writing a image player, I had to compress images so they wouldn't be so slow loading.
However, the displayed image is not the same as before (well, expect from the colors changing to 8-bit). The whole image is messed up.
I don't know if it's the compressing or the decompressing. So if anyone can help, then it would be appreciated!
I have a public key for a project containing the compressor and the viewer. Also, there is a test image there too.
Public Key: XDNY3QJ
EDIT: Run the 320X240TO8-BIT first, then run 8-BITTO320X240.
EDIT2: It's working now. Though if someone can optimize this it would be really appreciated! (it's slower than loading GRPs normally)
Also there is a 512x512 one too. That one takes REALLY LONG. BTW, I have included precompressed images too so you don't have to experience a long wait.
My image compression/decompression is not working properly
Root / Programming Questions / [.]
PerskaCreated:
pfshhhhh
Integers are signed two's-compliment 32-bit (-2147483648 to 2147483647, whole numbers only, % suffix). A 32-bit color-code pulled from a GRP is in the hex format &HAARRGGBB.
Keep in mind that the 32-bit codes are simply a level of abstraction: GRP in reality works in 16-bit &BRRRRRGGGGGBBBBBA color.
I optimized it a fair bit. Key: 73KKXPDX Images not included.
For the decompressor:
- Multiplies were replaced with left-shifts
- I%*4 was stored to a variable T% so you don't have to do it 4 times
- LOAD[I%,J%] was assigned to a variable C% because array access times are slower than variables
- The R%, G%, and B% arrays were replaced with individual variables (see above)
- Same changes as above where applicable
- Instead of using string operations, only left-shift and OR were used to concatenate the pixel values
- Instead of using the array NEW$, a single int C% was used as the intermediary