• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 8
Req GUI: improved image scaling algorithm
#1
Hi there,

I'm currently trying XBMC on a high-end Windows PC. Looks quite nice, but I have to say the image scaling quality (especially downscaling) is atrocious. Looks like a simple Bilinear stretch to me, which doesn't take all pixels into account. The proper way to downscale images is to apply linear filtering. E.g. I'd recommend using Lanczos with 3-taps, or Bicubic with 2-taps. Here's a small image comparison:

Image (original)

The left side was downscaled with Lanczos3, the right side is how XBMC currently downscales. As you can see, the XBMC produced downscale is terribly aliased, with visible jaggies everywhere.

There are many good Lanczos/Bicubic implementations available under GPL. Hopefully XBMC could use one of those, if the CPU is capable enough for that? Bicubic would work well enough. Should also be pretty easy to apply Bicubic scaling in a Direct3D or OpenGL pixel shader. E.g. some of the MPC-HC internal video renderers already have GPL code for that (for Direct3D).
Reply
#2
Same thing applies to textures in a skin so this would be very welcome.
Reply
#3
The video scalers already can do lanczos3, so I presume he is talking about 2d Images
Reply
#4
Yes, I'm talking about the GUI, scaling things like posters and fanart and stuff. Posters can have a rather high resolution and XBMC skins often downscale them to much smaller sizes. With the current scaling algorithm used by XBMC such downscaled images have a much lower quality than necessary. Upscaling could also be better (sharper) by using Lanczos3 or Bicubic50 instead of the simple Bilinear stretch which XBMC currently seems to be using. But the difference in downscaling is much higher compared to a potential quality gain by improved upscaling, because the very simple Bilinear downscaling algorithm used by XBMC (at least on my Windows PC) only uses 4 source pixels for each target pixel. The larger the downscaling factor is, the nearer this comes to Nearest Neighbor Sampling. A proper downscaling algorithm takes all source pixels into account which "cover" the target pixel. Which of course consumes much more rendering resources, but is necessary to get aliasing-free images. For example, when downscaling a 1920x1080 image down to 192x108 pixels, a proper downscaling algorithm takes more than 100 source pixels into account for each target pixel, while the current XBMC downscaling algorithm only takes 4 source pixels into account, regardless of how large the downscaling factor is.

Or in short: Upscaling with Bilinear is "ok" in XBMC, not optimal, but ok. However, the current downscaling algorithm is mathematically/scientifically insufficient/incorrect, which produces heavy aliasing artifacts.
Reply
#5
This is one of those things that should just be coded and pull requested, and will in all likelyhood be accepted without too much trouble.
I wish i could code - good feature request!
Reply
#6
I'd love to see this as well. It's not always noticeable, but when it is... ouch ;)
Reply
#7
A big thumbs up for this request! A skin wall view on a 100" projector screen could look so much better.
Reply
#8
Hopefully someone takes on the challenge.
Reply
#9
Can you compare the result between the algorithms defined in http://www.ffmpeg.org/doxygen/2.0/swscal...ource.html ?
Currently fast bilinear is used: https://github.com/xbmc/xbmc/blob/master...e.cpp#L245 .
Reply
#10
The scaling really do need an upgrade, the aliasing is terrible. Here's an example to show how much aliasing is introduced to clearart when running XBMC in a smaller window compared to running it fullscreen. I don't know how many taps the bicubic scaling in paint.net uses, but it's a massive improvement.

Image
Reply
#11
Any updates on this? The downscaling is indeed horrible and should not be part of a software that gets it's popularity from it's graphical user interface Smile
Reply
#12
GSOC suggestion?
Reply
#13
(2015-03-31, 08:37)Hitcher Wrote: GSOC suggestion?

Yeah could have been a good one, probably a bit small but should be easy to add a few things and make it into a project. Its to late though Smile
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
#14
Sad
Reply
#15
There is surely going to be a speed penalty for this.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 8

Logout Mark Read Team Forum Stats Members Help
GUI: improved image scaling algorithm2