Skin performance
#1
I would like to ask what are general suggestions or best practices for skin, regarding speed and resource requirements:

1. Use 1 texture 1920x1080 or rather use smaller one (if possible) and let Xbmc stretch it?

2. Would I improve speed or cut usage of system resources if I show 1080 fanart image in a smaller image container, say 1280x720? Or would it be in fact worse, because Xbmc would need to scale it before showing it?

Some other suggestions or advices?
My skins:

Amber
Quartz

Reply
#2
Don't take this as fact but here's my understanding of these things.

1. As long as they're simple textures then the smaller you can make them the better as they'll take up less memory. Don't go smaller than about 8px width/height otherwise they get messed up when added the the textures.xbt and make sure you use a border="" control as well.
If they're detailed textures I tend to make them at the size they'll be when XBMC runs at 1080p so there's no scaling needed. I assume this helps performance.

2. Not sure.
Reply
#3
Didn't know that. I have a few textures smaller than 8px. What happens if you omit border attribute? To be fair, so far, I didn't use it at all.
My skins:

Amber
Quartz

Reply
#4
There are a few mechanics which are interesting to know.
1) The GPU and the drawing library we (currently) use (OpenGL, OpenGLES and DirectX) will always do the calculations for scaling, even if its 1280x720 -> 1280x720, it will be scaling by 1.0. Hence scaling is considered for free.
2) The GPU will always display an image at the given size you want it in, so the amount it needs to write is the same (this is limited by fillrate).

So if you look at 1 and 2 if you use a 8px texture or 1080p one it will take the same resources. So what you gain from having a 8px border texture is that you need to upload less to GPU, you need to decode less data. This means that it will load and display quicker, giving an illusion of faster operation.

There is another important limitation and that is that the GPU (atleast on embedded) needs to move the textures it reads into a special type of memory, if you take a bigger image than fits in that cache you need to fetch it multiple times and as such smaller textures are much much quicker to display, even if you need to scale them.

Overall, if you are contemplating going 8px texture or pre-scale it in photoshop, always let the GPU do it instead, its doing it for free and at times its even faster (since it means free up memory and load).

There are a lot of other optimizations you can do which is limit the amount of blended images you will use by pre-merging them, this is something which is not an issue on desktop however where the GPUs are so quick, on embedded however its huge. You should ofcourse not feel obligated to do this while developing, but if you are looking for optimizing something which you feel "finished" with, this can make a big difference.

I wrote a bit about this during my google summer of code (much of the info there is beagleboard and gsoc specific so some of it can be skipped) http://elinux.org/BeagleBoard/GSoC/2010_...umentation
If you have problems please read this before posting

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

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#5
border is used to not scale the border portion of the image. Useful for dialog borders and the like, where you want the middle bit of the image scaled (as it doesn't contain anything useful) but the borders not scaled. Allows you to use one image for all your dialogs.

Scaling speed isn't really an issue.
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
#6
pecinko Wrote:Didn't know that. I have a few textures smaller than 8px. What happens if you omit border attribute? To be fair, so far, I didn't use it at all.


Note: This only happens when the textures are in the textures.xbt.

<texture></texture> Note the right side of the black bar

Image

<texture border="1"></texture>

Image


<texture></texture> Note the right and bottom of the white border

Image

<texture border="1"></texture>

Image
Reply
#7
jmarshall Wrote:border is used to not scale the border portion of the image. Useful for dialog borders and the like, where you want the middle bit of the image scaled (as it doesn't contain anything useful) but the borders not scaled. Allows you to use one image for all your dialogs.

Scaling speed isn't really an issue.

Jonathan, could the border code be used for an overlaying texture (as opposed to the border which, I assume, is drawn underneath actual image) so we could use glass effects for icons that aren't scaled to fit one size?

EDIT: And also the diffuse texture?

ie

PHP Code:
<texture background="true" >$INFO[ListItem.Icon]</texture>
<
bordersize>22</bordersize>
<
aspectratio>keep</aspectratio>
<
diffusetexture border="22">diffuse.png</diffusetexture>
<
bordertexture border="22">border.png</bordertexture>
<
overlaytexture border="100">overlay.png</overlaytexture
Reply
#8
topfs2 Wrote:There are a few mechanics which are interesting to know.
1) The GPU and the drawing library we (currently) use (OpenGL, OpenGLES and DirectX) will always do the calculations for scaling, even if its 1280x720 -> 1280x720, it will be scaling by 1.0. Hence scaling is considered for free.
2) The GPU will always display an image at the given size you want it in, so the amount it needs to write is the same (this is limited by fillrate).

Interesting.

Can you answer these questions please?

1. If you use textures that are sized at their 1080p resolutions is there any advantage in coding the skin at 1080i instead of 720p if there's scaling involved with each anyway?

2. Regarding the scaling from 1080p to 720p is it always best to make sure the textures are evenly divisible by 3 so they are scaled down to 720p without any decimals involved?

3. What happens to a 1px line in a 1080p sized texture that's scaled to 720p?

Thanks.
Reply
#9
Hitcher Wrote:3. What happens to a 1px line in a 1080p sized texture that's scaled to 720p?

AFAICT, Xbmc is showing it properly. Note: I didn't pack any textures to .xbt yet.

EDIT: Just to make it clear, it's 1px x 1px texture being stretched to 1px x 900px in 1080i skin and I'm comparing that to what I see when I switch to windowed 720p.
My skins:

Amber
Quartz

Reply
#10
Hitcher Wrote:Interesting.

Can you answer these questions please?

1. If you use textures that are sized at their 1080p resolutions is there any advantage in coding the skin at 1080i instead of 720p if there's scaling involved with each anyway?

2. Regarding the scaling from 1080p to 720p is it always best to make sure the textures are evenly divisible by 3 so they are scaled down to 720p without any decimals involved?

3. What happens to a 1px line in a 1080p sized texture that's scaled to 720p?

Thanks.

1) Jmarshall probably knows this better but I can't see any reason (except you getting better control about what textures and which font to use) for coding both 1080p and 720p versions. Confluence is only 720p for example.

2) Shouldnt make a difference afaik

3) In GPU you use bilinear scaling (it have been discussed using mip maps with a more advanced scaling), hence the 1px line in 720p generally look really bad, it vanishes at places and not at places. This is why having textures for both 720p and 1080p makes sense. If you want a 1px border around something you can use the border thing though but jmarshall explained the use cases for that tag.
If you have problems please read this before posting

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

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#11
2. If your coordinates are divisible by 3 then they'll be whole numbers at 720p as well, so you'll get crisp borders on the images (note you'll get that anyway as we round to integer, but it may avoid things not quite lining up correctly).

3. Generally you should end up with a 1pixel line - in fact, you should ALWAYS end up with a 1px line with the current code (we ensure the dimension is at least 1), unless it's rotated at an angle I think.

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
Reply
#12
jmarshall Wrote:2. If your coordinates are divisible by 3 then they'll be whole numbers at 720p as well, so you'll get crisp borders on the images (note you'll get that anyway as we round to integer, but it may avoid things not quite lining up correctly).

3. Generally you should end up with a 1pixel line - in fact, you should ALWAYS end up with a 1px line with the current code (we ensure the dimension is at least 1), unless it's rotated at an angle I think.

Cheers,
Jonathan

3) Maybe I missunderstood. I thought the question was 1px line in a 1080p texture? because that may not look good?
If you have problems please read this before posting

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

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#13
Yes, that's what I was trying to say.

A large texture (already scaled for 1080p dimensions) that has a 1px line detail in it, but then if a single 1px line will always be 1px that could be used instead.

Thanks.
Reply
#14
Right, yeah, a 1px line inside a larger texture will be aliased when downsampled. Just like it'll be aliased when upsampled. I suspect this isn't a problem in general though, as 1pixel lines are rare, and usually in the border region of a texture, whereby you generally don't scale it.
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

Logout Mark Read Team Forum Stats Members Help
Skin performance0