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 (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;
}