kodi: rework aml video scaling patch

This commit is contained in:
Jonas Karlman 2016-10-23 15:02:53 +02:00
parent 349b0fff3a
commit 9d782d7398
2 changed files with 37 additions and 84 deletions

View File

@ -2,72 +2,59 @@ From 211edfa19b20820772b33f6042992811037a21b3 Mon Sep 17 00:00:00 2001
From: Jamie Coldhill <wrxtasy@amnet.net.au>
Date: Thu, 6 Oct 2016 17:54:40 +0800
Subject: [PATCH] [aml] Scale video axis correctly when 1080p to 2160p switching
Limit 4096x2160p (smpte24hz) resolution to 3840x2160p display width.
Fixup 720p60hz fallback resolution
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 20 +++++++++++++++-----
xbmc/utils/AMLUtils.cpp | 2 +-
xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 10 +++++++++-
xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 1 +
xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 2 +-
3 files changed, 17 insertions(+), 7 deletions(-)
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
index f9b4138..dd7100a 100644
index f9b4138..2a3b413 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
@@ -2172,12 +2172,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
CRect gui, display;
gui = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iHeight);
-
-#ifdef TARGET_ANDROID
display = m_display_rect;
-#else
- display = gui;
-#endif
+
if (gui != display)
{
float xscale = display.Width() / gui.Width();
@@ -2191,6 +2187,20 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
dst_rect.y1 *= yscale;
dst_rect.y2 *= yscale;
@@ -2163,6 +2163,13 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
update = true;
}
+ else if ((SrcRect.Width() != DestRect.Width()) && (SrcRect.Width() >= 3840))
+ RESOLUTION video_res = g_graphicsContext.GetVideoResolution();
+ if (m_video_res != video_res)
+ {
+ float xscale = (3840 / DestRect.Width());
+ float yscale = xscale;
+ if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_VERTICAL)
+ xscale /= 2.0;
+ else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL)
+ yscale /= 2.0;
+ dst_rect.x1 = 0;
+ dst_rect.y1 = (DestRect.y1 * yscale);
+ dst_rect.x2 *= xscale;
+ dst_rect.y2 *= yscale;
+ m_video_res = video_res;
+ update = true;
+ }
+
if (!update)
{
// mainvideo 'should' be showing already if we get here, make sure.
@@ -2176,7 +2183,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
#ifdef TARGET_ANDROID
display = m_display_rect;
#else
- display = gui;
+ const RESOLUTION_INFO& video_res_info = CDisplaySettings::GetInstance().GetResolutionInfo(video_res);
+ display = m_display_rect = CRect(0, 0, video_res_info.iScreenWidth, video_res_info.iScreenHeight);
#endif
if (gui != display)
{
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h
index 0eb5c3e..ede815d 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h
@@ -93,6 +93,7 @@ private:
float m_zoom;
int m_contrast;
int m_brightness;
+ RESOLUTION m_video_res;
if (m_stereo_mode == RENDER_STEREO_MODE_MONO)
{
diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp
index 80fb453..fd3b38d 100644
--- a/xbmc/utils/AMLUtils.cpp
+++ b/xbmc/utils/AMLUtils.cpp
@@ -465,7 +465,7 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
{
res->iWidth = 1920;
res->iHeight= 1080;
- res->iScreenWidth = 4096;
+ res->iScreenWidth = 3840;
res->iScreenHeight= 2160;
res->fRefreshRate = 24;
res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
PosixFilePtr m_amlVideoFile;
std::string m_defaultVfmMap;
diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
index 3cbb604..67f9984 100644
index 88cd385..6d63571 100644
--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
@@ -177,7 +177,7 @@ bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const
@@ -173,7 +173,7 @@ bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const
if (!GetNativeResolution(res))
{
// punt to 720p if we get nothing
@ -76,6 +63,3 @@ index 3cbb604..67f9984 100644
}
return true;
--
1.9.1

View File

@ -1,31 +0,0 @@
From cf4d1b4f9b291197ebbea3bab36179575a470a7f Mon Sep 17 00:00:00 2001
From: Jamie Coldhill <wrxtasy@amnet.net.au>
Date: Wed, 28 Sep 2016 12:30:57 +0800
Subject: [PATCH] [aml] video & GUI 1080p >> 2160p scaling
---
xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
index dd7100a..48853ab 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
@@ -1628,7 +1628,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
Create();
- m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iHeight);
+ m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenHeight);
std::string strScaler;
SysfsUtils::GetString("/sys/class/ppmgr/ppscaler", strScaler);
@@ -2258,6 +2258,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
std::string s_gui = StringUtils::Format("%i,%i,%i,%i",
(int)gui.x1, (int)gui.y1,
(int)gui.Width(), (int)gui.Height());
+ CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:SrcRect(%i,%i,%i,%i)", (int)SrcRect.x1, (int)SrcRect.y1, (int)SrcRect.Width(), (int)SrcRect.Height());
+ CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:DestRect(%i,%i,%i,%i)", (int)DestRect.x1, (int)DestRect.y1, (int)DestRect.Width(), (int)DestRect.Height());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:display(%s)", s_display.c_str());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:gui(%s)", s_gui.c_str());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_dst_rect(%s)", s_m_dst_rect.c_str());