PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Rotation/Scaling on SH3 vs ARM.

Hello, I was just wondering about the Rotation/Scaling functions used on a SH3 Vs an ARM processor. I currently only have a Jornada with a 133mhz SH3. In my newest game ,a puyo puyo clone, I wanted my guys to fly off the screen while comming closer and spinning. I tried this on my Ppc, and it was painfully slow. I was wondering how much faster an ARM processor really is?

I took my game to CompUSA on a storage card and ran it. I realized I had forgotten to put in timing code. My game ran so fast i couldn't even control it. Does that roughly 66mhz ARM make a ton of difference? Im guessing the rotation/scaling is more viable on a ARM, but I havent tested it.

What i hope to do is get enough money so i can buy one of those 206mhz ARM's to test stuff on.....

On another note, can you run Gapi 1.01 on an emulator?
Hi Dylan,

So that's why the game appeared to not work on my ipaq.. :) It takes 0.1 seconds and then the entire row is filled by the little creatures..

I actually benchmarked the GapiDraw Demo application on my HP 5xx (don't remember, but it's the 16-bit HP). The performance was:

GapiDraw DEMO on the Jornada 540
(~114ms vertical, ~128ms horizontal)


This was with a minimal amount of sprites as well (don't remember if it was 0 or 50 sprites). The IPAQ with 50 sprites I would say is around 10-15 ms or so (don't remember), which makes the IPAQ around 8-10 times faster.

I have GapiDraw 1.02 running on the emulator, but will have to keep the code a bit longer for test. There are so many games out there now depending on GapiDraw to function, so I cannot afford to stress a release and possibly introduce new issues.

/Johan
sbl wrote:I cannot afford to stress a release and possibly introduce new issues.

If all developpers were like you, we would have a lot of better quality software...
I've got a MIPS, ARM, and SHx device and my early attempts at benchmarking determined that what's limiting the SHx devices is the video memory/bus.

On the Jornadas you'll never see more then 20FPS. The video pipe is just to slow to be any faster.

MIPS varies, but on the EM500 I found it to be locked at about the 64 FPS level.

The ARMs I don't recall the number, but it was faster yet.

As for rotating/scaling blits... I have some code I put together for a rotozoomer (what you want) and it worked great on the Jornada and MIPS, but I haven't ported it to use GAPIDraw. I think I might just have to do that.

If anyone wants to see it I can post it up here as well. Been quite a while since I wrote it and it had already been optimized quite heavily though...

Oh, FYI, I got 12-16FPS or so on the SHx using my blitters when I wrote it. It sounds slow, but really all released games for the SHx that I've seen never run faster then 14 FPS at best. Doesn't much matter though as any higher and the screen tends to blur badly anyways (refresh rate)
I would be interested in having a look at your rotozoom code... I want to implement this in the next version of PocketFrog and could benefit from studying your optimizations...
Heh, alright. I'll clean it up a little bit and upload it.
Most of the optimizing was done in the blit loops. The optimizations were basically for removing the equations

Code:

PixelX = (centerx * 1024) - ((long)(1024.0f * cosine) * HalfDestWidth) - ((long)(1024.0f * sine) * HalfDestHeight);
PixelY = (centery * 1024) - ((long)(1024.0f * cosine) * HalfDestHeight) + ((long)(1024.0f * sine) * HalfDestWidth);


from being calculated for every pixel for every blit. Note: Fixed point arithmetic is being applied in the above calculation. If you'd like the original equations I could post them, but they're basically calculations for line rotations.

The ideas for the optimizations were originally derived from a great article on gamedev.net http://www.gamedev.net/reference/articles/article811.asp

Also, I couldn't figure out a way to maintain my optimizations on a buffered surface which is why I ended up abandoning the code. However, with Gapidraw I think I could port it over with minimal problems, though I haven't honestly looked into it.

Anyways, here's my code for a 16-bit to 16-bit Rotating blit and rotozoomer blit. http://www.planettribes.com/hosed/rotozoom.cpp

Oh, one last thing. The quality of the image is quite degraded as I didn't do any pixel color approximations, etc.
That's about the same code I use in GapiDraw. Except I shift with 16 bits instead of 10 (which shouldn't be a difference, or...?).

I also have to do one extra check each pixel to see if the pixel value differs from the mask value if the source surface is key sourced.

/Johan
Thanks for the reply, I wasnt aware that my poor SH3 Jornada was soooooo underpowered. I was using the GAPI Rotozooming functions, I dont beleive the functions are at fault whatsoever. I had just wondered how much faster on an ARM they would be.

Anyhow, I think I fixed the timming issue in my game. I have also made an option to enable the rotozooming/disable depending on your device. Normally I write my own code for timing, but I tried the GAPI functions. Now all I gotta do is drive over to Comp USA, hope no one sees, and test it out :)