#28884 - ThUg4LiFe - Mon Nov 08, 2004 2:02 pm
ive been thinking about the way images are saved, but use bitwise operations. and ive been thinking that a binary number of 8 bits (1 byte?) would have 256 possible binary numbers; 9 bits would have 512 (511 colours is what was on a nintendo website as the GBAs colour depth in one (character?) mode); and 15 bits would have 32,768 possibilities - which i think was the colour depth stated on the website of a different (bitmap?) mode.
512 colours = 9 bit = 1byte
32,768 colours = 15 bit = 2bytes
if this is correct then a entire GBA screen 240 x 160 pixels = 38,400 pixels, each pixel needs up to 2 bytes to store which colour it is. making 76-77Kb approx. for an entire GBA screen. however i have a JPG saved with that many colours and at that image resolution (240 x 160) which is only 22kb! obviously i have overlooked something completely!
anyway, once i know how much a GBA cartridge can hold of data, if i assumed 80% was used to save graphics, how would i know how many full screen GBA images that would allow for? (i dont know how much space one full screen image (for example) will take up on the cartridge)
#28886 - ThUg4LiFe - Mon Nov 08, 2004 2:12 pm
ah hang on, its 32-bit isnt it?? like windows :-\ would that make 32 bits to 1 byte making that 77Kb into 18,200 bytes. thats closer to the JPG
#28889 - poslundc - Mon Nov 08, 2004 3:12 pm
ThUg4LiFe wrote: |
ive been thinking about the way images are saved, but use bitwise operations. and ive been thinking that a binary number of 8 bits (1 byte?) would have 256 possible binary numbers; 9 bits would have 512 (511 colours is what was on a nintendo website as the GBAs colour depth in one (character?) mode); and 15 bits would have 32,768 possibilities - which i think was the colour depth stated on the website of a different (bitmap?) mode.
512 colours = 9 bit = 1byte
32,768 colours = 15 bit = 2bytes |
8 bits = 1 byte = 256 colours. The GBA technically displays up to 511 at once, but this is because it has two separate 8-bit palettes: one for sprites and one for backgrounds.
Oh, and 32,768 colours = 16 bits = 2 bytes.
Quote: |
if this is correct then a entire GBA screen 240 x 160 pixels = 38,400 pixels, each pixel needs up to 2 bytes to store which colour it is. making 76-77Kb approx. for an entire GBA screen. however i have a JPG saved with that many colours and at that image resolution (240 x 160) which is only 22kb! obviously i have overlooked something completely! |
JPEG images are compressed, and trade off on image quality in order to achieve more efficient compression. If you tried copying JPEG image data directly into the GBA's VRAM then you would only get garbage; you need to manually decompress it first, which in turn consumes CPU cycles.
Dan.
#28895 - ThUg4LiFe - Mon Nov 08, 2004 4:22 pm
i knew that about JPEGs, but i wondered what the most space efficient way to store images for a GBA game is, while maintaining the original's quality
what picture format is best used? or which will give the closest file size to what it would take up on a GBA cart so i know how much will fit
#28897 - tepples - Mon Nov 08, 2004 4:25 pm
Most GBA games that losslessly compress their graphics use LZSS compression. GBACrusher will give you an idea of how well an image would compress with this technique.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#28912 - ThUg4LiFe - Mon Nov 08, 2004 5:38 pm
i found a download of GBACrusher here http://1181-1.1st-housing.de/enjin/ and have tried it with compressing both a BMP and a PNG with LZSS compression; into the .h header file; yet it is making no difference to the file size and the status message when finished says file sizes almost the same and compression at 0%. why is that happening
#28917 - sajiimori - Mon Nov 08, 2004 5:58 pm
Perhaps the images were already compressed. PNGs are normally.
#28928 - tepples - Mon Nov 08, 2004 8:25 pm
Make sure that your .bmp file is 16-color or 256-color. LZSS by itself doesn't work very well on 16 million color (24-bit) bitmaps.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#28943 - ThUg4LiFe - Tue Nov 09, 2004 12:24 am
by only using 256 colour it would not be up to the GBA's capabilities..
if this is right there is 0% compression ?... :-\ well, its not realy expected, compression has a name for a reason lol i mean my PNG of a GBA fullscreen was 90something KB and the BMP was about 110something; and the LZSS compression had no affect. are these accurate file spaces for a full screen GBA image once compressed and on the cart ?
#28945 - sajiimori - Tue Nov 09, 2004 12:42 am
Quote: |
by only using 256 colour it would not be up to the GBA's capabilities.. |
You mean 15-bit truecolor? Right, 256 colors is a lot less than 32K colors. Use mode 3 if it suits you.
Quote: |
are these accurate file spaces for a full screen GBA image once compressed and on the cart ? |
Putting data on a GBA ROM does not change its size.
#28951 - tepples - Tue Nov 09, 2004 2:51 am
wrote: |
by only using 256 colour it would not be up to the GBA's capabilities.. |
"Capabilities" also refers to the capability for a compatible data storage medium to be replicated at a given price. You can store more images on a Microdrive than on block-addressed flash (e.g. CF, SD) and more images on block-addressed flash than on word-addressed flash (e.g. GBA flash), but only GBA flash is a "compatible data storage medium" without a big, separately-powered SDRAM in the middle. So even if there's a bit of subtle image degradation due to the use of 256-color or multi-palette 16-color images compared to 32K-color images, it may be worth it in order to gain the "capabilities" of storing more images.
sajiimori wrote: |
Use mode 3 if it suits you. |
Point is that GBA mode 3 full-screen images are often compressed with a lossy codec.
Quote: |
Putting data on a GBA ROM does not change its size. |
Depends on which "its" you mean, as the pronoun has an ambiguous antecedent:
Assuming you wrote: |
Putting data on a GBA ROM does not change the data's size. |
However, putting data on a GBA ROM typically entails converting it to a format directly usable by the GBA, and this often involves converting it to GBA raster or tile formats, compressing it to be decompressed by the BIOS, etc. These conversion operations do change the size.
Assuming you wrote: |
Putting data on a GBA ROM does not change the GBA ROM's size. |
However, it does reduce the space available on the ROM or flash card for other data.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.