You are not logged in.

#1 2008-08-03 15:00:29

JustWoody
Member

LoadTexture with jpeg support

I would really like a version of LoadTexture that can decompress a jpeg into a texture instead/as well as a png image

JPEG is usually about 4 times smaller the png so would be good for memory usage if we had this function.

I've started doing a bit of digging around this myself too, but coming up a bit short at the moment

Offline

 

#2 2008-08-03 21:51:58

RedShade
Member

Re: LoadTexture with jpeg support

Just noting that jpeg textures are smaller because they are lossy. This means that they wouldn't work with all texture formats, all the features of textures, and would make sprite strips a bit strange due to the edges around them bleeding over more when uncompressed.

Offline

 

#3 2008-08-03 23:37:51

NoNameNo
Administrator

Re: LoadTexture with jpeg support

and more thant that, there is no "alpha" layer support in jpeg.

Offline

 

#4 2008-08-04 09:22:43

JustWoody
Member

Re: LoadTexture with jpeg support

I was thinking that they would be good for full screen backgrounds.

I've got a few of these in my current game and they are coming in at 450k a pop whereas this goes down to 120k ish per jpeg

Perhaps more like LoadXFB and SetXFBToFrameBuffer type commands

Last edited by JustWoody (2008-08-04 09:38:55)

Offline

 

#5 2008-08-05 07:31:09

RedShade
Member

Re: LoadTexture with jpeg support

Those both appear to be the same as drawing a texture to the efb and copying it to the xfb normally?

Since the maximum background is 640x480 (unless you want to draw in the offscreen areas that the efb has), it appears that for some reason your textures are not compressing to PNG very well.

What kind of backgrounds are you planning to use? Do you have any examples? I might be able to see if there are some other tricks that the Wii will allow to help cut down on your image size.

Offline

 

#6 2008-08-05 09:17:11

JustWoody
Member

Re: LoadTexture with jpeg support

RedShade wrote:

What kind of backgrounds are you planning to use? Do you have any examples? I might be able to see if there are some other tricks that the Wii will allow to help cut down on your image size.

Cheers RedShade there is an example of one of the backgrounds on the talk tab of my project (Mahjongg Wii) page on wiibrew.org its within homebrew apps

Currently, I've actually shrunk them down to 320x240 and scaled them by 2 (this makes them about the same as a jpeg equivalent), which doesn't look bad on my CRT TV, but not sure about what it would look like on a HD TV.

Last edited by JustWoody (2008-08-05 09:27:16)

Offline

 

#7 2008-08-05 21:50:55

bmic
Member

Re: LoadTexture with jpeg support

i'm would like to know how Draw a jpeg from a file into the screen using GRRLIB, i'm unsucessfull trying to make a slideshow with my files from a SDCard for a new project.

Anyone knows?

Offline

 

#8 2008-08-05 22:14:33

bmic
Member

Re: LoadTexture with jpeg support

one jpeg2png converter would help me a lot, anyone ?

Offline

 

#9 2008-08-07 06:06:58

RedShade
Member

Re: LoadTexture with jpeg support

GIMP2.0 is pretty good for converting from anything to anything and normalizing colors and such. I will look into libjpeg, though it might be a bit hard to handle any images larger than 1024x1024 without either breaking them into multiple textures or adding in a built-in scaling filter. I also want to see about tying zlib to some of the indexed and compressed built-in texture formats and see how those handle in terms of size to png.

Offline

 

#10 2008-08-07 09:18:47

JustWoody
Member

Re: LoadTexture with jpeg support

RedShade wrote:

I also want to see about tying zlib to some of the indexed and compressed built-in texture formats and see how those handle in terms of size to png.

That sounds like a good idea, I might look in this direction too.

If png is anything link bmp (i've just taken a 2.14Mb bmp down to 49k by zipping it) this could be a very good idea.

On the other hand zipping jpeg makes no different to the size as already well compressed

Offline

 

#11 2008-08-07 18:01:30

RedShade
Member

Re: LoadTexture with jpeg support

PNG has a couple formats. One of them does use indexed textures, but you can only use up to 256 color indexes. The other ones use a 1-1 pixel to RGBA format. It has a couple other tricks to shrink the size, by changing some of the colors to make the zipping more efficient, and then applying corrective filters afterward to restore the image to a perfect copy. Afterward it chunks the image data and does a zlib compression on it.

All of the supported indexing and compressed formats are lossy on the system though. They use RGB565 as the highest color supported, and RGB5A3 for alpha. TF_CMPR is the worst of them, since it reduces the resolution by quite a bit, but can do natural looking images pretty well because it preserves tones of the color, not detail. It reduces the texture size to (pixel count)/2 bytes before being zipped.
-http://en.wikipedia.org/wiki/S3TC

Last edited by RedShade (2008-08-07 18:02:04)

Offline

 

#12 2008-08-07 18:22:20

JustWoody
Member

Re: LoadTexture with jpeg support

Cutting the images down to 8 bit colour brings some really good memory savings 143k down to 34k.

What do you think the likelihood of 8bit png support are? Not sure why only 24 and 32 bit now supported (havn't looked too hard at the code though) + pngu 0.2b supports 8 and 16bit pngs.

Last edited by JustWoody (2008-08-07 18:59:15)

Offline

 

Board footer

Powered by FluxBB