[PATCH][Regression] BETA4: Scaling: needs better algo...

Postings relating to old VirtualBox pre-releases
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

[PATCH][Regression] BETA4: Scaling: needs better algo...

Post by Technologov »

Congrats for adding a new Retina-display mode !

Right now I have re-sized Windows XP to 150% on normal, non-retina display... (90 PPI) and eh... it is Ugg-lee.

Worse: Fonts are unreable. It kills my eyes.
Please consider a better image scaling algorithm.
I know GIMP gives a *MUCH* better result. (Lanczos algo, but probably not real-time...)
Is there anything good a modern GPU offers on OpenGL ?

(at least 200% looks fine. This is what I will use for old guests, once I get Retina display.)

Screenshot attached.
Attachments
Screenshot
Screenshot
notepad-WinXP-at-150-percent.png (6.37 KiB) Viewed 17264 times
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Display resizing needs better scaling ...

Post by Technologov »

A text font like that (above) kills my eyes.

This is because part of the letter has 2 pixels, part has one pixel, and with low vision like myself my brain needs to work harder to interpret this image. Problem is particularly visible on the letter "o".
This results in head-ache after several minutes of work, as my brain need to concentrate harder to see the letters and recognize. Worse yet - this happens at sub-conscious level, making people angry and frustrated.
Dsen
Oracle Corporation
Posts: 165
Joined: 10. Sep 2007, 10:42

Re: Scaling: needs better algo...

Post by Dsen »

I'm not sure what we can do for the software rendering case.
I can (and will) enable smooth Qt scaling algorithm but it will be much slower than that we have now (at least not that ugly as currently).
Finding 3rd party image scaling algorithm which is fast and smooth at the same time - is not an easy task.
For the 3D rendering case we at least will be able to do something more, there are known techniques already.
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Scaling: needs better algo...

Post by birdie »

Dsen wrote:I'm not sure what we can do for the software rendering case.
I can (and will) enable smooth Qt scaling algorithm but it will be much slower than that we have now (at least not that ugly as currently).
Finding 3rd party image scaling algorithm which is fast and smooth at the same time - is not an easy task.
For the 3D rendering case we at least will be able to do something more, there are known techniques already.
Like I mentioned in the other thread, if any scaling algorithms are to be implemented it must use OpenGL shaders otherwise it will be prohibitively computationally expensive (which also means that VM must be output via OpenGL).
Dsen
Oracle Corporation
Posts: 165
Joined: 10. Sep 2007, 10:42

Re: Scaling: needs better algo...

Post by Dsen »

birdie wrote:
Dsen wrote:I'm not sure what we can do for the software rendering case.
I can (and will) enable smooth Qt scaling algorithm but it will be much slower than that we have now (at least not that ugly as currently).
Finding 3rd party image scaling algorithm which is fast and smooth at the same time - is not an easy task.
For the 3D rendering case we at least will be able to do something more, there are known techniques already.
Like I mentioned in the other thread, if any scaling algorithms are to be implemented it must use OpenGL shaders otherwise it will be prohibitively computationally expensive (which also means that VM must be output via OpenGL).
Yep, I have seen that your proposal, but currently we can't use embedded OpenGL scaling for software rendering mode. GUI architecture limitation. It will be probably possible in future releases.
Of course for 3D rendering case that will come more early I suppose.
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Scaling: needs better algo...

Post by Technologov »

What is theoretically possible - but tricky - is to do 2-stage algo.

For example, Red Hat SPICE uses 2-stage algo for remote desktop protocol (Red Hat's SPICE).
1st level algo is fast, but ugly. (can work with animation, video and the like)
2nd level algo kicks in after few seconds, if no change to guest image (i.e. when reading text).

This 2nd level algo can be slow but high-quality.
No GPU needed.
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Scaling: needs better algo...

Post by birdie »

Dsen wrote:Yep, I have seen that your proposal, but currently we can't use embedded OpenGL scaling for software rendering mode. GUI architecture limitation. It will be probably possible in future releases.
Of course for 3D rendering case that will come more early I suppose.
Take a look at this:

http://www.vips.ecs.soton.ac.uk/index.p ... untu_14.10

Perhaps the VIPS library (licensed under the LGPL which is appropriate for VBox) is the best solution - it sports many algorithms not limited to Bilinear and Bicubic and it's really fast.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Scaling: needs better algo...

Post by frank »

birdie wrote:Take a look at this:

http://www.vips.ecs.soton.ac.uk/index.p ... untu_14.10

Perhaps the VIPS library (licensed under the LGPL which is appropriate for VBox) is the best solution - it sports many algorithms not limited to Bilinear and Bicubic and it's really fast.
Nice suggestion but adding the usage of LGPL software to VirtualBox is almost impossible. It's hard to get legal approval and for LGPL it's almost impossible.
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Scaling: needs better algo...

Post by birdie »

Frank Mehnert wrote:Nice suggestion but adding the usage of LGPL software to VirtualBox is almost impossible. It's hard to get legal approval and for LGPL it's almost impossible.
It's very strange since LGPL is a very permissive license.
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Scaling: needs better algo...

Post by Technologov »

LGPL requires Oracle to publish library's code when they are selling Oracle VDI, so they don't like it.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Scaling: needs better algo...

Post by michaln »

birdie wrote:It's very strange since LGPL is a very permissive license.
You got that exactly backwards :) GPL is about the least permissive license, and LGPL is only slightly more permissive. For licenses that are actually permissive (i.e. place very few restrictions on the licensee), see the BSD or MIT licenses.
bostjan
Posts: 5
Joined: 9. Apr 2015, 08:42

Re: Scaling: needs better algo...

Post by bostjan »

Technologov wrote:LGPL requires Oracle to publish library's code when they are selling Oracle VDI, so they don't like it.
I thought the code only needs to be published if you modify the library? Unmodified 'official' binaries cannot be used?
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Scaling: needs better algo...

Post by Technologov »

Code for unmodified libs must be published also.
twipley
Posts: 72
Joined: 5. Jul 2011, 20:46
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP

Re: Scaling: needs better algo...

Post by twipley »

Dsen wrote:I have seen that your proposal, but currently we can't use embedded OpenGL scaling for software rendering mode. GUI architecture limitation. It will be probably possible in future releases.
Of course for 3D rendering case that will come more early I suppose.
This is why locking the scale factor to integer values makes sense. (Or at least, putting an option for this restriction.) As noted by Technologov, 200% is exact multiply (2x, 3x, etc.) and every pixel end up being given as much love. No smaller lines than the others, or such.

GL_NEAREST interpolation might be a good candidate when the afore-mentioned limitation is bypassed in the future. Nearest-neighbor, in an integer-scaling scenario, is the mapping of individual pixels to larger (2x2, 3x3, 4x4, and so forth) blocks of like-value pixels. That scaling method is implementable because, if my logic is correct, no rights protect it. It's just doubling. There's no complicated code to borrow, but the limitation is that it only works great on 2x or something. Personally, I like it best than bilinear and ever lanczos in integer-scaling environments. It's an algorithm that should be selectable in every scaling software. It preserves detail and original data like no other can.
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Scaling: needs better algo...

Post by Technologov »

One idea is to allow integer-only scaling for software rendering. And require OpenGL for non integer scaling.
Post Reply