September 18, 2019, 12:02:37 pm

News:

Juju thinks he's so clever by putting funny stuff here



Alternatively, join us on Discord.

Custom Bitmap Format

Started by rowan_futurerave, November 16, 2018, 08:46:55 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rowan_futurerave

November 16, 2018, 08:46:55 am Last Edit: November 16, 2018, 09:13:39 am by rowan_futurerave
Hi all. Am thinking of creating a custom bitmap format due to awkwardness I am experiencing with a lib (glaux.lib) which has been deprecated.

What would anyone else add to a custom bitmap format?

Not RLE. Possibly encryption. What else??

>:D

*edit - one idea - strangely ordered scanlines

gameblabla

You could use a raw format (RGB565, RGB8, RGB555 etc...) then compress it with an algorithm known to decompress pretty fast such as lz4.If your compiler is somewhat modern, then the best choice would probably be zStandard. It has higher compression rates than lz4 while being much faster than its other alternatives. (although lz4 is still faster)
If your platform is using a Motorola 68000 cpu, stef made a fast decompressor called lz4w for that CPU family. It can be found in assembly form here :https://github.com/Stephane-D/SGDK/blob/e8d6e7e6668579e1299e19f1c024dd8dc16d430e/src/tools_a.s
Function call in C is as such :u16 lz4w_unpack(const u8 *src, u8 *dest);
On the same platform, aplib is also another good alternative but it's a fair amount slower.
As for encryption, well it's just easier to do it outside out of the file format because that would require more work (separate the actual image data from the header then compare it to a hash etc...).
Make sure the file format meets your needs only. On the Atari falcon, space was of no concern so i simply made a raw RGB565 format except flipped for Big endian cpus. Of course on little endian machines, this is not a concern and you can go for compression for example.

rowan_futurerave

Nice thoughts gameblabla you have inspired me, I now have decided on the file spec. Woot  (-_(//));

Powered by EzPortal