[Scummvm-cvs-logs] SF.net SVN: scummvm: [25703] scummvm/trunk/backends/platform/ds/arm9/source /blitters.cpp

Tramboi at users.sourceforge.net Tramboi at users.sourceforge.net
Sun Feb 18 21:30:16 CET 2007


Revision: 25703
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25703&view=rev
Author:   Tramboi
Date:     2007-02-18 12:30:15 -0800 (Sun, 18 Feb 2007)

Log Message:
-----------
NDS : CPU scaler twiddling backup

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp

Modified: scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp	2007-02-18 18:59:40 UTC (rev 25702)
+++ scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp	2007-02-18 20:30:15 UTC (rev 25703)
@@ -137,11 +137,6 @@
 static bool isDivBy5Ready = false;
 static u32  DIV_BY_5[160];
 
-//#define USE_2D_TABLE
-#ifdef USE_2D_TABLE
-static u8   A4_B1_DIV5[32][32];
-static u8   A3_B2_DIV5[32][32];
-#endif
 void ComputeDivBy5TableIFN()
 {
     if (isDivBy5Ready)
@@ -151,16 +146,7 @@
     for(int i=0; i<160; ++i)
     {
         DIV_BY_5[i] = (2*i+5)/10;
-    }        
-    
-    #ifdef USE_2D_TABLE
-    for(int i=0; i<32; ++i)
-        for(int j=0; j<32; ++j)
-        {
-            A4_B1_DIV5[i][j] = DIV_BY_5[4*i + j];
-            A3_B2_DIV5[i][j] = DIV_BY_5[3*i + 2*j];
-        }
-    #endif
+    }                
 }
 
 static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4,
@@ -241,87 +227,38 @@
 static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3, u32 s4,
                                                     u16* dest)
 {
-#ifdef USE_2D_TABLE
-    u32 bs0 = s0 & 0xFF;
-    u32 bs1 = s1 & 0xFF;
-    u32 bs2 = s2 & 0xFF;
-    u32 bs3 = s3 & 0xFF;
-    u32 bs4 = s4 & 0xFF;
+    u32 d0 = 4*s0 +   s1;
+    u32 d1 = 2*s1 +   s1 + 2*s2;
 
-    u32 gs0 = (s0 >> 8) & 0xFF;
-    u32 gs1 = (s1 >> 8) & 0xFF;
-    u32 gs2 = (s2 >> 8) & 0xFF;
-    u32 gs3 = (s3 >> 8) & 0xFF;
-    u32 gs4 = (s4 >> 8) & 0xFF;
+    u32 bd0 = (d0 << 24) >> 24;
+    u32 bd1 = (d1 << 24) >> 24;
+    u32 gd0 = (d0 << 16) >> 24;
+    u32 gd1 = (d1 << 16) >> 24;    
+    u32 rd0 = (d0 >> 16);
+    u32 rd1 = (d1 >> 16);
     
-    u32 rs0 = (s0 >> 16);
-    u32 rs1 = (s1 >> 16);
-    u32 rs2 = (s2 >> 16);
-    u32 rs3 = (s3 >> 16);
-    u32 rs4 = (s4 >> 16);
-    
-    u32 rd0 = A4_B1_DIV5[rs0][rs1];
-    u32 rd1 = A3_B2_DIV5[rs1][rs2];
-    u32 rd2 = A3_B2_DIV5[rs3][rs2];
-    u32 rd3 = A4_B1_DIV5[rs4][rs3];
-
-    u32 gd0 = A4_B1_DIV5[gs0][gs1];
-    u32 gd1 = A3_B2_DIV5[gs1][gs2];
-    u32 gd2 = A3_B2_DIV5[gs3][gs2];
-    u32 gd3 = A4_B1_DIV5[gs4][gs3];
-
-    u32 bd0 = A4_B1_DIV5[bs0][bs1];
-    u32 bd1 = A3_B2_DIV5[bs1][bs2];
-    u32 bd2 = A3_B2_DIV5[bs3][bs2];
-    u32 bd3 = A4_B1_DIV5[bs4][bs3];
-
+	rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1];
+	gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
+	bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];    
     u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
-    u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-    
     ((u32*)dest)[0] = d10;
-    ((u32*)dest)[1] = d32;
-#else    
-    u32 d0 = 4*s0 +   s1;
-    u32 d1 = 2*s1 +   s1 + 2*s2;
+
     u32 d2 = 2*s2 + 2*s3 +   s3;
     u32 d3 =   s3 + 4*s4;
 
-    u32 bd0 = d0 & 0xFF;
-    u32 bd1 = d1 & 0xFF;
-    u32 bd2 = d2 & 0xFF;
-    u32 bd3 = d3 & 0xFF;
-
-    u32 gd0 = (d0 >> 8) & 0xFF;
-    u32 gd1 = (d1 >> 8) & 0xFF;
-    u32 gd2 = (d2 >> 8) & 0xFF;
-    u32 gd3 = (d3 >> 8) & 0xFF;
-    
-    u32 rd0 = (d0 >> 16);
-    u32 rd1 = (d1 >> 16);
+    u32 bd2 = (d2 << 24) >> 24;
+    u32 bd3 = (d3 << 24) >> 24;
+    u32 gd2 = (d2 << 16) >> 24;
+    u32 gd3 = (d3 << 16) >> 24;
     u32 rd2 = (d2 >> 16);
     u32 rd3 = (d3 >> 16);
 
-#if 0
-    // Offsetting for correct rounding
-    rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5;
-    gd0 = gd0*2+5; gd1 = gd1*2+5; gd2 = gd2*2+5; gd3 = gd3*2+5;
-    bd0 = bd0*2+5; bd1 = bd1*2+5; bd2 = bd2*2+5; bd3 = bd3*2+5;
-
-	rd0 = (rd0 * 51) >> 9; rd1 = (rd1 * 51) >> 9; rd2 = (rd2 * 51) >> 9; rd3 = (rd3 * 51) >> 9;
-	gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9;
-	bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9;
-#else
-	rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; 
-	gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; 
-	bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; 
-#endif
-    
-    u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
+    rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; 
+    gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; 
+    bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; 
     u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
     
-    ((u32*)dest)[0] = d10;
     ((u32*)dest)[1] = d32;
-#endif
 }
 
 // Can't work in place


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list