XBMCTex - The Textures.xpr Generator

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jmarshall Offline
Team-XBMC Developer
Posts: 26,221
Joined: Oct 2003
Reputation: 178
Post: #1
hi all,

i've just committed support for non-swizzled 32 bit textures in xbmc.

this includes a new xbmctex version which enables this by default (it can be disabled using the -onlyswizzled command line switch).

swizzled textures have to have each dimension a power of 2, which means that much of the ram taken up while in xbmc is wasted space - not efficient. they are, however, quicker to render which ofcourse is a bonus.

unswizzled textures just have to have their width a multiple of 64 pixels. this is a much less stringent requirement, thus less wasted space.

for comparison: in pm3, the old version of xbmctex produced a textures.xpr file whose textures were on average 46% wasted space.

the new version produces on average just 9.5% of wasted space.

this translates to 5.5mb of ram saved while in the pm3 home page.

one thing to note is that textures.xpr produced with the new xbmctex version will not work with older versions of xbmc.

a couple of other suggestions for saving ram:

1. keep wasted (transparent) space around images to a minimum. try and keep images inside the nearest power of 2, but if this is not possible, just try and keep within a 64 pixel width constraint.

2. if images do not change much (ie constant colour, or constant vertical gradient etc.) then consider breaking the bits up that don't follow the same pattern and use a small texture for the patterned piece (eg a vertical gradient can be done with a texture 1 pixel wide, stretched as far as you like horizontally).

hope these help.

cheers,
jonathan

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: badge.gif]
find quote
Smokehead Offline
Skilled Skinner
Posts: 168
Joined: Sep 2005
Reputation: 0
Location: Area 51
Post: #2
thanks for making this possible :thumbsup:

i guess going from 46% waste to 9.5% is pretty astonishing, and very efficient.. loads of respect for that m8. i tried it on my skin and it saves me 1mb on *.xpr filesize and about 3mb's for home page only, but i allready did some small optimization on the images, but the result is still impressive.
find quote
HarshReality Offline
Posting Freak
Posts: 1,544
Joined: Jan 2005
Reputation: 0
Post: #3
is textures.xpr and the current images in cvs also updated for this effect?

[Image: x3.jpg]
find quote
pike Offline
Project Manager
Posts: 4,852
Joined: Sep 2003
Reputation: 29
Location: Sweden
Post: #4
yes, textures.xpr in cvs is updated

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: badge.gif]
find quote
HarshReality Offline
Posting Freak
Posts: 1,544
Joined: Jan 2005
Reputation: 0
Post: #5
kewl, just did a build of the tool and ran it locally on the existing images so i will asume by the results not all the current imagery has been adjusted to make use of this as yet (some of the home images still show 60% wasted space). but the xpr file is still @ 2 meg smaller Big Grin

[Image: x3.jpg]
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,221
Joined: Oct 2003
Reputation: 178
Post: #6
if you run the current version of xbmctex on the pm3 media folder, then the average wasted space is 9.5%.

note that if a particular image is specifying a lot of wasted space, it's probably due to it using one of the compressed texture formats, which at worse are 8bits/pixel (ie 4 times smaller anyway than uncompressed). so the "waste" that you see, is only in terms of pixels, not in terms of memory.

cheers,
jonathan

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: badge.gif]
find quote
ashlar Offline
Donor
Posts: 2,148
Joined: Mar 2006
Reputation: 27
Post: #7
while much of this flies straight over my head, this new development saves memory for all purposes or only while in the gui? is this memory save something that frees more memory while playing videos as well?

For troubleshooting and bug reporting please make sure you read this first.
find quote
pike Offline
Project Manager
Posts: 4,852
Joined: Sep 2003
Reputation: 29
Location: Sweden
Post: #8
considering most big ui elements are already unloaded when you go fullscreen, im gonna walk out on a limb and say:

no

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: badge.gif]
find quote
SleepyP Offline
Posting Freak
Posts: 2,277
Joined: Nov 2005
Reputation: 4
Location: Portland, Oregon
Post: #9
is it safe to assume that the xbmctex.rar file over on the 'official' ftp server (where t3ch's builds are found) is a relatively current binary? the file attributes say it was last modified 4/21/06. i plan on getting into screwing around with skinning, so i knew i'd need to get xbmctex. i already checked out a copy of all the current resources from the cvs (to get the uncompressed pmiii files), but i don't want mess with finding the xdk just so i can build my own copy of xbmctex.

Catchy Signature Here
find quote
pike Offline
Project Manager
Posts: 4,852
Joined: Sep 2003
Reputation: 29
Location: Sweden
Post: #10
yes, i would say 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: badge.gif]
find quote
SleepyP Offline
Posting Freak
Posts: 2,277
Joined: Nov 2005
Reputation: 4
Location: Portland, Oregon
Post: #11
since i wasted a few hours on it, i figured i ought to post it somewhere to save others the trouble. i wrote a windows batch script which simplified building xpr files, especially themes.
you put the bat file & the xbmctex.exe together in a directory. you can then drag subdirectories in that location onto the bat file and xbmctex will build xprs with the same name as those directories.
example of usage:
i have a "themes" folder where i put the stuff i'm working on.
directory structure looks like this:
<themes>
<themes>\batch.bat
<themes>\xbmctex.exe
say i'm working on a v for vendetta theme. i would put all the files i want that theme to include in a subdirectory:
<themes>\vforvendetta\graphics *.png
then to build the xpr, i simply drag & drop that directory onto the bat file and it'll spit out a vforvendetta.xpr file in the same directory xbmctex.exe is located in.
it has a fork which looks for and deletes the file to be created if it already exists. it's intended to make developing themes a little easier.
Quote:@echo off
set startdir=%cd%
set target=%1
chdir /d %target%
for %%* in (%target%) do set mydir=%%~n*
if not defined mydir set mydir=%cd:\=%
cd..
if exist %mydir%.xpr echo file %mydir%.xpr already exists, deleting old copy...
if exist %mydir%.xpr del /f /q %mydir%.xpr
echo.
xbmctex.exe -input %mydir% -quality max -output %mydir%.xpr
pause

Catchy Signature Here
find quote
smuto Offline
Senior Member
Posts: 242
Joined: Sep 2004
Reputation: 2
Post: #12
Quote: -input <dir> Input directory. Default: current dir
-output <dir> Output directory/filename. Default: Textures.xpr
-quality <qual> Quality setting (min, low, normal, high, max). Default: normal

can i set different quality for subdirectories to build one xpr file?

[Image: 1.png]
find quote
smuto Offline
Senior Member
Posts: 242
Joined: Sep 2004
Reputation: 2
Post: #13
i try to make my own theme with not so big texture.xpr file

directory structure
\skinmedia\graphics *.png
\multiimage\4x3home-myprograms\graphics *.png
\multiimage\4x3home-mymusic\graphics *.png
.
.
\splash\animation\graphics *.png


this is my out of order .bat file

@echo off
xbmctex -input "skinmedia" -quality max -input "multiimage" -quality min -input "splash" -quality normal -output "new"

[Image: 1.png]
find quote
SleepyP Offline
Posting Freak
Posts: 2,277
Joined: Nov 2005
Reputation: 4
Location: Portland, Oregon
Post: #14
wtfConfusedConfused?
find quote
jgawera Offline
Senior Member
Posts: 221
Joined: Oct 2004
Reputation: 0
Location: UK
Post: #15
Has anyone tried building textures.xpr using XBMCTex while in a remote desktop session?
I've a feeling that is the cause of the below error, but I could be wrong.

I'm fairly sure It worked the first time I did it (when I was at the machine)
I needed to do another build and kicked it off remotely, and got the below error.
I'll try another local build tonight when I can get to the machine.

Thanks for any help.
J

Code:
Copying files...
'xbepatch.exe' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the file specified.
        1 file(s) copied.
19 File(s) copied
*.xml
The system cannot find the file specified.
        0 file(s) copied.
Changelog.txt
copying.txt
keymapping.txt
        3 file(s) copied.
----------------------------------------
Creating Project Mayhem III Build Folder
The system cannot find the file specified.
----------------------------------------
Creating XPR File...
Cannot init D3D device: 8876086a
----------------------------------------
Copying XPR File...
File not found - Textures.xpr
0 File(s) copied
----------------------------------------
Cleaning Up...
Could Not Find D:\Projects\XBMCDBR\XBMCDBR\bin\Debug\XBMC\skin\Project Mayhem
I\media\Textures.xpr
----------------------------------------
XPR Texture Files Created...
Building Skin Directory...
4 File(s) copied
4 File(s) copied
20 File(s) copied
5 File(s) copied
5 File(s) copied
73 File(s) copied
30 File(s) copied
8 File(s) copied
skin.xml
        1 file(s) copied.
Changelog_PM.txt
        1 file(s) copied.
----------------------------------------
find quote
Post Reply