This site is no longer active and is available for archival purposes only. Registration and login is disabled.

HP 2210 & 2215 slow video buffer!!


HP 2210 & 2215 slow video buffer!!

Postby pacomac » Sep 22, 2003 @ 2:51pm

pacomac
pm Member
 
Posts: 22
Joined: Sep 22, 2003 @ 2:39pm


A newbie's solution

Postby avdpro » Sep 24, 2003 @ 2:08pm

Hi
I'm Avdpro, a newbie PPC coder.
I C/C++, I think the key of optimize the screen update method is "data-alignment" and unrow the loop.

1>*ldst = *src++;
this is will cause a "strh" instruction. May be you will like to copy 2 pixels each time with 32bit pointers. I think this will brust up very much.

2>use reducing loop, that is:
for(y=240;y>=0;y--)
Some guys from intel said this will faster cuz the ARM instructions today.

3>unrow the loop

4>use ASM instead of C++, this always times faster due to the ugly M$ compiler.

I think you are lucky than me. I'm writing a palette based game. The screen 8bit->16bit update method is more complex than 16bit->16bit.
Here is my code of 8bit->16bit, hope it can help you get some idea for optimize yours. I used a re-ASMed version of this function that 2+ times faster than this.
I removed some prework. Sorry.
while(y--)//this,h,w,lpbase,lpdst,<lpfastpal,iScrpitchH,iScrpitchV>
{
lpdbyte=lpbase;
x=w;
m4=((int)lpsrc)&3;
m4=m4?4-m4:0;
x-=m4;
while(m4--)
{
*lpdst=(MAGWORD)lpFastPal[*lpsrc++];
lpdbyte+=iScrPitchH;
}
while(x>3)
{
dwcolor=*lpdwsrc++;

color=dwcolor&0xFF;
dwcolor>>=8;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

color=dwcolor&0xFF;
dwcolor>>=8;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

color=dwcolor&0xFF;
dwcolor>>=8;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

color=dwcolor&0xFF;
*lpdst=(MAGWORD)lpFastPal[color];
lpdbyte+=iScrPitchH;

x-=4;
}
while(x--)
{
*lpdst=(MAGWORD)lpFastPal[*lpsrc++];
lpdbyte+=iScrPitchH;
}
lpsrc+=ofs;
lpbase+=iScrPitchV;
}
Game coding is the way I living on.
avdpro
pm Member
 
Posts: 1
Joined: Sep 20, 2003 @ 11:21am
Location: China


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron