osdteletext-0.4.2 page render speed up

Message ID 422DEFC6.5090408@gmx.de
State New
Headers

Commit Message

Udo Richter March 8, 2005, 6:32 p.m. UTC
  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
  

Comments

Thomas Glomann March 8, 2005, 9:58 p.m. UTC | #1
On Tuesday 08 March 2005 19:32, Udo Richter wrote:
> 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

nice work !!  :)
  
Marcel Wiesweg March 9, 2005, 5:49 p.m. UTC | #2
Am Dienstag 08 März 2005 19:32 schrieb Udo Richter:
> 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.

Thanks. This code really looks better.

Marcel

>
> Cheers,
>
> Udo
  
Udo Richter March 17, 2005, 4:38 a.m. UTC | #3
Udo Richter wrote:
> Since osdteletext page drawing is rather slow on my C3-600, I 
> investigated the page rendering speed of osdteletext-0.4.2. 
> 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. ;)

Time to heat things up!

The new patch replaces almost the complete character rendering, and 
draws directly to the osd display buffers. Render time is now down to 
0.172s, giving a speed boost of 4.3x. :)

Get it at:
http://urichter.cjb.net/vdr/?h=osdtt-speedup (german)
http://urichter.cjb.net/vdr/?h=osdtt-speedup&l=en (english)

On a side note - Displaying the current page again only needs 0.08s, I 
guess this is due to reading from same disk buffers again.

Cheers,

Udo

PS: @Marcel: Did you get my mail?
  

Patch

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 (ydst<hneu) {
+	   xsrc=x0;
+	   xdst=0;
+	   xfrac=0;
+	   while (xdst<wneu) {
+		   bitmap->SetIndex(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;x<wneu;x++)
       for (float y=0;y<hneu;y++) {
@@ -84,6 +117,7 @@ 
          oldY=(int)(((halt*10000/hneu)*y/10000));
          bitmap->SetIndex((int)x,(int)y,*(oldBitmap->Data(oldX+x0, oldY+y0)) );
       }
+#endif
    return bitmap;
          
 }