native resolution ( disable upscaling ) option

http://forum.xbmc.org/showthread.php?tid=64139&pid=1131505#pid1131505


I spent few hours to dig into it and the results are promising. I'm pretty fresh to xbmc though, so maybe there is better way to deal with it. Anyway, what you need to run native resolution:

- apply the provided patch
- set in your advancedsettings.xml following variable in < video > section:

```
    <video>
        <upscalemode>1</upscalemode>      <!-- upscalemode: 0-default, 1-native scaling -->
    </video>
```

- set your receiver to upscaling mode - upscale source to maximum display resolution (1080p in my case)

How it works:
- the GUI works with maximum resolution
- when the player is spawned it reads the source dimension and sets the renderer to the lowest supported resolution which is the best match for the source resolution
- the movie is played with lowest acceptable resolution and is upscaled by the receiver to 1080p
- when the playback stops, the xbmc GUI is back to default resolution (1080p for me)

Here are few examples, where
USER = default screen resolution
NATIVE = movie resolution
ADJUST2 = final xbmc resolution for playback

<pre><code>
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 1920x1080
    NOTICE: Display resolution ADJUST2 : default: 1920x1080 @ 24.00Hz (17)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 1280x720
    NOTICE: Display resolution ADJUST2 : default: 1280x720 @ 50.00Hz (29)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 720x304
    NOTICE: Display resolution ADJUST2 : default: 720x576 @ 50.00Hz (37)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 608x336
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 640x256
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 640x272
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 720x392
    NOTICE: Display resolution ADJUST2 : default: 720x576 @ 50.00Hz (37)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 608x256
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 640x352
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 624x224
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 1280x544
    NOTICE: Display resolution ADJUST2 : default: 1280x720 @ 50.00Hz (29)
    .
    NOTICE: Display resolution USER : default: 1920x1080 @ 24.00Hz (17)
    NOTICE: Searching for NATIVE resolution: 624x352
    NOTICE: Display resolution ADJUST2 : default: 640x480 @ 60.00Hz (41)
</code></pre>

I have to say that results are surprisingly good. I'm using receiver with Marvell Qdeo chip and it is doing great job, the picture is visible better than when xbmc is upscaling directly to 1080p. Well, you need to try yourself to judge.

The function used to find the closest resolution match is very simple, perhaps it might be improved. For now it tries to find the lowest resolution which is equal or higher than source resolution and tries to keep as close as possible to original refresh rate for the display.