Author Topic: Here's a rotozoomer...  (Read 5636 times)

0 Members and 1 Guest are viewing this topic.

Offline Dr_D

  • Atari ST
  • ***
  • Posts: 151
  • Karma: 29
    • View Profile
Here's a rotozoomer...
« on: February 08, 2009 »
I don't know if anyone needs it or not, but most of it's programmed inline x86 asm. There is a known bug when drawing to another fb.image, but we'll get that fixed asap. :)

rotozoom
The Dr. is INsane!!!

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Here's a rotozoomer...
« Reply #1 on: February 08, 2009 »
Thats nice and fast Dr.D :)

And it has source code too which could be helpful for people who want to load Bitmaps.

Thanks :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Dr_D

  • Atari ST
  • ***
  • Posts: 151
  • Karma: 29
    • View Profile
Re: Here's a rotozoomer...
« Reply #2 on: February 09, 2009 »
Thanks Shockwave. That previously mentioned bug has been removed as well. ;)
The Dr. is INsane!!!

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Here's a rotozoomer...
« Reply #3 on: February 09, 2009 »
Indeed. Well done, Dr_D
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: Here's a rotozoomer...
« Reply #4 on: February 09, 2009 »
That's cool stuff, as always. Thanks!

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Here's a rotozoomer...
« Reply #5 on: February 10, 2009 »
Thanks Dr_D.  Would be interesting to compare what Freebasic compiler generates compared with hand optimised stuff.

Jim
Challenge Trophies Won:

Offline Dr_D

  • Atari ST
  • ***
  • Posts: 151
  • Karma: 29
    • View Profile
Re: Here's a rotozoomer...
« Reply #6 on: February 10, 2009 »
Well, we did some stuff like leaving a few vars that get used a lot on the fpu stack. I can't be sure, but I don't think fb does that. I haven't looked at the asm fb generates for it normally, but that's an interesting idea! This one is quite a bit faster than one programmed directly in fb code though.
The Dr. is INsane!!!

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Here's a rotozoomer...
« Reply #7 on: February 10, 2009 »
I had a quick look at your source, some points that can be improved:
Bubble-sort is not a particularly fast way to pick the minimum/maximum from 4 values.
You're much faster by using integer coordinates for interpolation, the fpu just requires permanent "fisting".
Don't test every texel if it's inside texture-boundaries:
You can test where the current scanline enters/leaves the valid range and skip the according amount of pixels (or use a polygon) which makes the innerloop end up in just a few instructions.
You don't need a multiplication to build a texel's address:
"my" always increasing by the integer-part of "tsdzx" or one more if the fractional part causes an overflow. So you can pick the value from a table according to the carry flag (see here).
Challenge Trophies Won:

Offline matthew

  • C= 64
  • **
  • Posts: 27
  • Karma: 2
    • View Profile
    • My Wikispace
Re: Here's a rotozoomer...
« Reply #8 on: February 10, 2009 »
Very nice & thanks for including the source.  :)

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Here's a rotozoomer...
« Reply #9 on: February 11, 2009 »
Neat Dr_D, must of taken abit of doing.

Cheers And K++,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Here's a rotozoomer...
« Reply #10 on: February 12, 2009 »
I can't seem to invoke the bug that you said was in the first version, where was it exactly?
It worked fine here.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Dr_D

  • Atari ST
  • ***
  • Posts: 151
  • Karma: 29
    • View Profile
Re: Here's a rotozoomer...
« Reply #11 on: February 12, 2009 »
Well, the fb.image structure now has pitch. We weren't taking that into consideration before, which caused errors when drawing to odd sized windows/images. It should be all good now though. :)
The Dr. is INsane!!!

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Here's a rotozoomer...
« Reply #12 on: February 13, 2009 »
I see :)

Next things to do is add a scroller and a song ;)
Shockwave ^ Codigos
Challenge Trophies Won: