XBMC Skin Compressed Textures Tool
#1
Thumbs Up 
i've implemented compressed texture support into the latest build of xbmc. this helps reduce the memory used by skins significantly. it does, however, mean that you will need to mind a few points while creating skins.

all textures used are now power of 2 (i.e 1, 2, 4, 8, 16, 32, etc.) if you supply a non-power of two texture, it will be padded to the next largest power of two. this can result in a large amount of wasted space. for instance a 40x40 texture is padded to 64x64 wasting 2496 pixels - more than half the pixels in the image are wasted. so basically, try to keep your images as close to power of 2 as possible.

png, jpg and gif files are automatically re-compressed on load into an xbox compatible format, this can cause some quality loss, particlarly in the alpha channel. i have added support for dds files to help with this. dds files are loaded without any conversion - whatever you put in the file, you get loaded directly. to create dds files you'll need an app, this util includes a plug-in for photoshop that will let you convert your textures to dds. please note xbmc does not support mipmaps. if you want animation, you'll have to use gifs still.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#2
sounds interesting.
will test it soon.

ok
my results:
i used the 2 different backgrounds from hifi skin.
these are two of the biggest graphics in my skin.
rescaled it to 512x512 and saved it as 32bit argb.
other modes (16bit,..) seemed to be a too high quality loss.

one background is now about 1mb big (150kb as png).
now i renamed these two dds files into .png and overwrite the original png's.
no problem for xbmc, but i only saved about 1-2 mb free memory.
that is not much for the two biggest graphics.
i don't know if i can use a better way to save the dds files, but if this is the only way every skin would be 10-20mb big.

is there a limit for free space ?
Reply
#3
you should be mainly using dxt1, dxt3, or dxt5 for graphics - for non-alpha textures, or textures with a single transparent colour use dxt1 as it's half the size of dxt3/dxt5.

if you use 32bit argb you'll not save any memory at all. in fact with the current code a 32-bit argb dds uses more memory than a png as the png will be recompressed to dxt3 by xbmc, while the dds will not.


also a note for skinners:
all current skins will work fine. you don't have to change anything if you don't want to, you can change stuff to dds if you want finer control over which compression method is used. that's the only advantage.
changing things to be power of two is a space saving feature only, they'll work fine if they aren't power of two but you waste some memory.

currently skins are loading very slowly unless you have all the texutres as power of 2 dds, but i'm planning to work on this and sort it so that pngs and jpgs will be just as fast.



Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
speed fix is done, pngs loading nice and fast now.

something to consider if you're finding dxt compression causes quality loss - try using gifs for stuff. you only get 256 colours, but xbmc loads them without recompressing so there's no quality loss and they're the same size (once loaded) as dxt3.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
k
i disabled the compressed textures (for now)
it caused the skins to look very ugly cause of the compression
we'll see if this can be solved, however in the mean time we'll just use uncompressed textures
frodo
XBMC Project Founder (Retired), now head programmer of MediaPortal
Reply
#6
note for those wanting to keep skin sizes down... easiest way is small textures. size of the file itself is largely irrelevant - you can have a 2k png, but if it's 1000x1000 pixels, it's going to use a lot of memory. also try and use sizes close to but below a power of 2. a 130x100 texture uses twice as much memory as a 128x100 or a 120x100.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#7
ok, new plan - i've made a texture compression tool, it's in cvs (sorry no bin, it needs the xdk). if you run it over your skin's media directory it'll compress the files in it a bit more "intellegently" than the xbox-based compression.

usage is quite simple:
xbmctex [-output outdir] [-input indir] [-quality qual]

-input lets you specify the input directory for the converter. it will search for any files named *.png, *.bmp *.jpg *.tga *.dds in the given directory and convert them. if you don't supply an input directory, it uses the current directory.

-outdir lets you specify an output directory for the converted files. files are saved as filename.xpr (e.g. pic.jpg.xpr) so they won't overwrite your files if you use the same input and output directory. if you don't supply an output directory, it uses the current directory.

-quality sets the quality for conversion. there are 5 levels, default is normal quality:
min this will change all textures to the smallest suitable type, regardless of quality implications. quality will generally be poor, but the size is very small also.
low this will aggressively compress most textures, it will generally give some visible artifacts in textures.
normal this gives a good balance of quality and compression. there may be soime small image artifacts, but much less than the low setting.
high this should give virtually no visible artifacts on textures, some very slight effects are possible though.
max this will only compress textures if the result is completely lossless. it gives little to no compression but you are guaranteed not to lose any quality.

i'd recommend skinners choose either normal or high as a quality setting for their skins.

edit: couple of other things.
256-colour images are never compressed, they are kept as 256-colour. if you want a 256-colour non-animated image a png is better than a gif as pngs are preconverted whereas gifs are not (faster loads for png). quality for both is the same.
images less than 1024 pixels (eg. 32x32, 16x64) are never compressed as it doesn't actually save any memory to do so. so your icons and such will not become distorted.



Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
sounds better and easier.
i will test it soon.

by the way..
i had a look at internal 02-28 and saw that there is more free memory as it was in 02-27.
any optimizations ?
Reply
#9
other than compressed textures i don't think so
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
are all graphics loaded on xbmc startup, or only if they needed ?
Reply
#11
as needed, we haven't got the memory to pre-load everything.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#12
new version of the tool does gif processing.
all gif processing is done in lossless mode, so you'll never lose any animation quality.
any duplicate frames in the gif are merged so it's not a problem if you want to repeat frames (a common one is a fully transparent frame to hide the anim). merged frames do not have to be sequential (e.g. if frame number 2 and frame number 10 are identical, they are merged).
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#13
1 new bug.
screen calibration is messed up if you use compressed textures
frodo
XBMC Project Founder (Retired), now head programmer of MediaPortal
Reply
#14
@Frodo

i think it's faulty png's that is the problem here. skins that has replaced these images doesnt show this problem. (atleast not project mayhem)
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#15
Exclamation 
i found this browsing nvidia's developers website, not sure if it can be used but here you go anyway:

dxtc decompression code
http://developer.nvidia.com/object/dxtc_..._code.html
this sample provides code to read and decompress .dds files in the dxt1, dxt3, and dxt5 formats.

dxt compression library with source
http://developer.nvidia.com/object/dxt_c...s_src.html
includes and image library with dxt compressor with full source written by jason dorie of black box games.

nvidia dxtc texture tools
http://developer.nvidia.com/object/ps_te...lugin.html
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC Skin Compressed Textures Tool0