[PATCH] TT6400 dvbhddevice ScaleVideo aspect ratio correction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I wrote a patch for the ScaleVideo implementation in the dvbhddevice,
for keeping the actual aspect ratio of the video material when scaling.
It was tested by users at vdr-portal.de which also reported the
distortions (I don't own such a device), and they said it works [1]. You
can test it with the nOpacity skin and/or with the upcoming
yaepghd-0.0.4 plugin [2].

Regards,
Lucian


[1]
http://www.vdr-portal.de/board1-news/board2-vdr-news/p1137059-announce-nopacity-0-1-0/#post1137059
[2] http://sourceforge.net/projects/vdryaepghd/files/

>From 1591c4cdc50dda35c52902ce46851ab57291351c Mon Sep 17 00:00:00 2001
From: Lucian Muresan <Lucian.Muresan@xxxxxxxxxxx>
Date: Fri, 5 Apr 2013 11:21:25 +0200
Subject: [PATCH] vdr-2.0.0 dvbhdffdevice ScaleVideo Aspect v3

---
 PLUGINS/src/dvbhddevice/dvbhdffdevice.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/PLUGINS/src/dvbhddevice/dvbhdffdevice.c b/PLUGINS/src/dvbhddevice/dvbhdffdevice.c
index dd7ace5..7a05ccb 100644
--- a/PLUGINS/src/dvbhddevice/dvbhdffdevice.c
+++ b/PLUGINS/src/dvbhddevice/dvbhdffdevice.c
@@ -579,9 +579,24 @@ void cDvbHdFfDevice::ScaleVideo(const cRect &Rect)
         double osdPixelAspect;
 
         GetOsdSize(osdWidth, osdHeight, osdPixelAspect);
+
+        // make corrections
+        double osdAspect = double(osdWidth) / double(osdHeight);
+        cRect corRect(Rect);
+        corRect.SetWidth(Rect.Height() * osdAspect);
+        corRect.SetHeight(Rect.Width() / osdAspect);
+        if (double(Rect.Width())/double(Rect.Height()) > osdAspect) {
+            corRect.SetHeight(Rect.Height());
+            corRect.SetX(Rect.X() + (Rect.Width() - corRect.Width()) / 2);
+        }
+        else if (double(Rect.Width())/double(Rect.Height()) < osdAspect) {
+            corRect.SetWidth(Rect.Width());
+            corRect.SetY(Rect.Y() + (Rect.Height() - corRect.Height()) / 2);
+        }
+
         mHdffCmdIf->CmdAvSetVideoWindow(0, true,
-            Rect.X() * 1000 / osdWidth, Rect.Y() * 1000 / osdHeight,
-            Rect.Width() * 1000 / osdWidth, Rect.Height() * 1000 / osdHeight);
+            corRect.X() * 1000 / osdWidth, corRect.Y() * 1000 / osdHeight,
+            corRect.Width() * 1000 / osdWidth, corRect.Height() * 1000 / osdHeight);
     }
 }
 
-- 
1.8.1.msysgit.1

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux