aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/shaders/convolution-4x4.glsl5
-rw-r--r--system/shaders/convolution-6x6.glsl5
-rw-r--r--system/shaders/stretch.glsl5
-rw-r--r--system/shaders/yuv2rgb_basic.glsl5
-rw-r--r--xbmc/AdvancedSettings.cpp2
-rw-r--r--xbmc/cores/VideoRenderers/LinuxRendererGL.cpp6
6 files changed, 20 insertions, 8 deletions
diff --git a/system/shaders/convolution-4x4.glsl b/system/shaders/convolution-4x4.glsl
index 62db84a976..7dc88f11f1 100644
--- a/system/shaders/convolution-4x4.glsl
+++ b/system/shaders/convolution-4x4.glsl
@@ -32,8 +32,11 @@ half4 weight(float pos)
#define POSITION(pos) stretch(pos)
vec2 stretch(vec2 pos)
{
+ // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
+ // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
+ // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
float x = pos.x - 0.5;
- return vec2(mix(x, x * abs(x) * 2.0, m_stretch) + 0.5, pos.y);
+ return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);
}
#else
#define POSITION(pos) (pos)
diff --git a/system/shaders/convolution-6x6.glsl b/system/shaders/convolution-6x6.glsl
index 9197ebb34f..76ea02e24b 100644
--- a/system/shaders/convolution-6x6.glsl
+++ b/system/shaders/convolution-6x6.glsl
@@ -32,8 +32,11 @@ half3 weight(float pos)
#define POSITION(pos) stretch(pos)
vec2 stretch(vec2 pos)
{
+ // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
+ // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
+ // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
float x = pos.x - 0.5;
- return vec2(mix(x, x * abs(x) * 2.0, m_stretch) + 0.5, pos.y);
+ return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);
}
#else
#define POSITION(pos) (pos)
diff --git a/system/shaders/stretch.glsl b/system/shaders/stretch.glsl
index 2e368563e0..ac7ddd9783 100644
--- a/system/shaders/stretch.glsl
+++ b/system/shaders/stretch.glsl
@@ -3,8 +3,11 @@ uniform float m_stretch;
vec2 stretch(vec2 pos)
{
+ // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
+ // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
+ // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
float x = pos.x - 0.5;
- return vec2(mix(x, x * abs(x) * 2.0, m_stretch) + 0.5, pos.y);
+ return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);
}
void main()
diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl
index 6841d5f0f8..1527a7a4d1 100644
--- a/system/shaders/yuv2rgb_basic.glsl
+++ b/system/shaders/yuv2rgb_basic.glsl
@@ -19,8 +19,11 @@ uniform float m_stretch;
#define POSITION(pos) stretch(pos)
vec2 stretch(vec2 pos)
{
+ // our transform should map [0..1] to itself, with f(0) = 0, f(1) = 1, f(0.5) = 0.5, and f'(0.5) = b.
+ // a simple curve to do this is g(x) = b(x-0.5) + (1-b)2^(n-1)(x-0.5)^n + 0.5
+ // where the power preserves sign. n = 2 is the simplest non-linear case (required when b != 1)
float x = pos.x - 0.5;
- return vec2(mix(x, x * abs(x) * 2.0, m_stretch) + 0.5, pos.y);
+ return vec2(mix(2.0 * x * abs(x), x, m_stretch) + 0.5, pos.y);
}
#else
#define POSITION(pos) (pos)
diff --git a/xbmc/AdvancedSettings.cpp b/xbmc/AdvancedSettings.cpp
index 6d18ff5b72..449eb67472 100644
--- a/xbmc/AdvancedSettings.cpp
+++ b/xbmc/AdvancedSettings.cpp
@@ -88,7 +88,7 @@ void CAdvancedSettings::Initialize()
m_videoHighQualityScaling = SOFTWARE_UPSCALING_DISABLED;
m_videoHighQualityScalingMethod = VS_SCALINGMETHOD_BICUBIC_SOFTWARE;
m_videoVDPAUScaling = false;
- m_videoNonLinStretchRatio = 0.667f;
+ m_videoNonLinStretchRatio = 0.5f;
m_musicUseTimeSeeking = true;
m_musicTimeSeekForward = 10;
diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
index dc752fbbec..c05e7e2366 100644
--- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
@@ -1311,7 +1311,7 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field)
m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f);
m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f);
- m_pYUVShader->SetNonLinStretch((m_customPixelRatio - 1.0) * g_advancedSettings.m_videoNonLinStretchRatio * -1.0);
+ m_pYUVShader->SetNonLinStretch(pow(m_customPixelRatio, g_advancedSettings.m_videoNonLinStretchRatio));
m_pYUVShader->SetWidth(im.width);
m_pYUVShader->SetHeight(im.height);
if (field == FIELD_ODD)
@@ -1513,7 +1513,7 @@ void CLinuxRendererGL::RenderMultiPass(int index, int field)
m_pVideoFilterShader->SetSourceTexture(0);
m_pVideoFilterShader->SetWidth(m_sourceWidth);
m_pVideoFilterShader->SetHeight(m_sourceHeight);
- m_pVideoFilterShader->SetNonLinStretch((m_customPixelRatio - 1.0) * g_advancedSettings.m_videoNonLinStretchRatio * -1.0);
+ m_pVideoFilterShader->SetNonLinStretch(pow(m_customPixelRatio, g_advancedSettings.m_videoNonLinStretchRatio));
m_pVideoFilterShader->Enable();
}
else
@@ -1585,7 +1585,7 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field)
m_pVideoFilterShader->SetSourceTexture(0);
m_pVideoFilterShader->SetWidth(m_sourceWidth);
m_pVideoFilterShader->SetHeight(m_sourceHeight);
- m_pVideoFilterShader->SetNonLinStretch((m_customPixelRatio - 1.0) * g_advancedSettings.m_videoNonLinStretchRatio * -1.0);
+ m_pVideoFilterShader->SetNonLinStretch(pow(m_customPixelRatio, g_advancedSettings.m_videoNonLinStretchRatio));
m_pVideoFilterShader->Enable();
}
else