Ive been trying to learn asm so I can help Ben wirh the scale2x code.
Ive managed to get a small start that really doesn't speed things up but
maybe after awhile may get better. Heres what Ive got if someone wants
to tweak and play with it (x86 only code).
This just replaces the first (if else) with asm.
 

Just coded for the function so far.

static void effect_scale2x_16_32

--------
added just after the while(count) {

         s0 = (UINT32 *)(((UINT32 *)lookup)[((UINT16*)src0)[0]]);
         s1 = (UINT32 *)(((UINT32 *)lookup)[((UINT16*)src1)[0]]);
------
comment out
          if (((UINT16*)src1)[-1] == ((UINT16*)src0)[0] && ((UINT16*)src2)[0] != ((UINT16*)src0)[0] && ((UINT16*)src1)[1] != ((UINT16*)src0)[0])
              *((UINT32*)dst0) = ((UINT32 *)lookup)[((UINT16*)src0)[0]];
          else    *((UINT32*)dst0) = ((UINT32 *)lookup)[((UINT16*)src1)[0]];
------

add after the last (if else)
                __asm__ __volatile__(
               "cmp -16(%3),%2\n"
               "jne 1f\n"
               "cmp %4,%2\n"
               "je 1f\n"
               "cmp 16(%3),%2\n"
               "je 1f\n"
               "movl %5, 0(%0)\n"
               "jmp 2f\n"
               "1:\n"
               "movl %6,0(%0)\n"
               "2:\n"
               : "=r" ((UINT32*)(dst0)), "=r" ((UINT32*)(dst1))
               : "r"((UINT16*)(src0)), "r" ((UINT16*)(src1)), \
                 "r" ((UINT16*)(src2)), "r" ((UINT32*)(s0)), "r" ((UINT32*)(s1))
               );
 

Ken
 
 

-- 
-------------------------------------
a funny comment: 1 karma
an insightful comment: 1 karma
a good old-fashioned flame: priceless
 


Reply via email to