From patchwork Tue Mar 8 18:32:38 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Udo Richter X-Patchwork-Id: 11802 Received: from mail.gmx.net ([213.165.64.20]) by www.linuxtv.org with smtp (Exim 4.34) id 1D8jVy-00038G-7F for vdr@linuxtv.org; Tue, 08 Mar 2005 19:33:06 +0100 Received: (qmail invoked by alias); 08 Mar 2005 18:32:42 -0000 Received: from math-ws1.mathematik.uni-kassel.de (EHLO [127.0.0.1]) (141.51.166.3) by mail.gmx.net (mp020) with SMTP; 08 Mar 2005 19:32:42 +0100 X-Authenticated: #1417946 Message-ID: <422DEFC6.5090408@gmx.de> Date: Tue, 08 Mar 2005 19:32:38 +0100 From: Udo Richter User-Agent: Mozilla Thunderbird 1.0+ (Windows/20050223) MIME-Version: 1.0 To: Klaus Schmidinger's VDR X-Y-GMX-Trusted: 0 Subject: [vdr] [patch] osdteletext-0.4.2 page render speed up X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2005 18:33:06 -0000 Status: O X-Status: X-Keywords: X-UID: 587 Hi list, Since osdteletext page drawing is rather slow on my C3-600, I investigated the page rendering speed of osdteletext-0.4.2. Average rendering time is 0.74s, dividing down to 0.11s rendering, 0.45s scaling, 0.09s osd drawing and 0.11s screen update. (numbers might be slightly off due to additional debug output) After a rewrite of the scaler, the scaling is down to 0.1s, speeding up screen update from 0.74s to 0.39s - a noticeable improvement. ;) The attached patch adds the new scaling code. Cheers, Udo diff -aur osdteletext-0.4.2/txtbitmap.c osdteletext-0.4.2-mod/txtbitmap.c --- osdteletext-0.4.2/txtbitmap.c 2005-03-03 17:51:00.000000000 +0100 +++ osdteletext-0.4.2-mod/txtbitmap.c 2005-03-08 18:45:15.000000000 +0100 @@ -74,6 +74,39 @@ cBitmap *bitmap=new cBitmap(wneu, hneu, depth); Display::SetBitmapPalette(*bitmap); +#if 1 + // Scale rule: + // xsrc=x0 + xdst*walt/wneu + // ysrc=y0 + ydst*halt/hneu + + int xsrc,xdst,xfrac,ysrc,ydst,yfrac; + // exact src coordinate is floor(xsrc+xfrac/wneu),floor(ysrc+yfrac/hneu) + ysrc=y0; + ydst=0; + yfrac=0; + while (ydstSetIndex(xdst,ydst,*(oldBitmap->Data(xsrc, ysrc)) ); + xdst++; + xfrac+=walt; + while (xfrac>=wneu) { + xfrac-=wneu; + xsrc++; + } + } + ydst++; + yfrac+=halt; + while (yfrac>=hneu) { + yfrac-=hneu; + ysrc++; + } + + } + +#else int/*float*/ oldX=0, oldY=0; for (float x=0;xSetIndex((int)x,(int)y,*(oldBitmap->Data(oldX+x0, oldY+y0)) ); } +#endif return bitmap; }