Welcome, Guest. Please login or register.

Author Topic: Help needed with a very silly idea...  (Read 8365 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Help needed with a very silly idea...
« Reply #29 from previous page: January 28, 2005, 03:14:58 PM »
You know, it's an interesting in point.

I know a few people who write the most atrocious code imaginable, simply because they are spoiled by the performance of their hardware. People who should not be let anywhere near a compiler, for that matter. Their only skill is in the application of brute force to solve any problem. Then they use some convenience-oriented, high-level language/design tools with which to write their ill thought out code.

I worry that the arts of problem analysis, algorithm design and implementation efficiency are fast dying.
int p; // A
 

Offline odin

  • Colonization had Galleons
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 6796
    • Show only replies by odin
Re: Help needed with a very silly idea...
« Reply #30 on: January 28, 2005, 03:21:32 PM »
You...you.....geek!  :-P

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Help needed with a very silly idea...
« Reply #31 on: January 28, 2005, 03:21:56 PM »
Quote

Karlos wrote:
You know, it's an interesting in point.

I know a few people who write the most atrocious code imaginable, simply because they are spoiled by the performance of their hardware. People who should not be let anywhere near a compiler, for that matter. Their only skill is in the application of brute force to solve any problem. Then they use some convenience-oriented, high-level language/design tools with which to write their ill thought out code.


I would fit probably into that category. I loved the Amiga because I could program stuff in any sloppy way and get great results, much better than my Speccie/Amstrad/C64 friends :-D

Quote

I worry that the arts of problem analysis, algorithm design and implementation efficiency are a fast dying.


Well, I would suggest the shift is from a problem oriented view of program design to a solution one.
Err... We don't need to worry about the implementation of the problem, and instead worry more abotu the outcome of the solution... or something...

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Help needed with a very silly idea...
« Reply #32 on: January 28, 2005, 03:24:26 PM »
Quote

bloodline wrote:

Well, I would suggest the shift is from a problem oriented view of program design to a solution one.
Err... We don't need to worry about the implementation of the problem, and instead worry more abotu the outcome of the solution... or something...


Which is a completely bollox approach for this situation. And indeed most of the things I work on.

I guess I like the mental challenges of actually doing something well.
int p; // A
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Help needed with a very silly idea...
« Reply #33 on: January 28, 2005, 03:34:45 PM »
Quote

Karlos wrote:
Quote

bloodline wrote:

Well, I would suggest the shift is from a problem oriented view of program design to a solution one.
Err... We don't need to worry about the implementation of the problem, and instead worry more abotu the outcome of the solution... or something...


Which is a completely bollox approach for this situation. And indeed most of the things I work on.

I guess I like the mental challenges of actually doing something well.


Yeah, well I suppose when it's a computer problem... hmmm. Anyay, there is a reason why DSPs have been developed... and that's for this type of task... so get yourself a DSP or more horsepower :-D

Offline 23JUL

  • Newbie
  • *
  • Join Date: Mar 2002
  • Posts: 32
    • Show only replies by 23JUL
    • http://amiga.name
Re: Help needed with a very silly idea...
« Reply #34 on: January 28, 2005, 05:39:35 PM »
You may try lookup 'Simple border tracing' in your favourite search engine.

Or try: http://ct.radiology.uiowa.edu/~jiangm/courses/dip/html/node126.html

To get a box around it, you have to get the max x,y and min x,y, of the list of coords. :)





 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Help needed with a very silly idea...
« Reply #35 on: January 29, 2005, 01:56:09 AM »
@ 23JUL/JULES :-)

Thanks for the link. The mechanism there reminds me of a trick used to speed up a mandelbrot generator I tried once. It had a  mask to define already calculated pixels and used this border tracing to determine the region that had reached the iteration limit, bound it off and 'flood fill' the area as being already rendered.
int p; // A
 

Offline Jose

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show only replies by Jose
Re: Help needed with a very silly idea...
« Reply #36 on: February 03, 2005, 07:58:24 PM »
@Karlos
"..if you need to know which pixels are different, there are a couple of ways of working it out. Probably the easiest is to take the result of the 32-bit xor operation and mask it with four succesive 32-bit masks that each isolate a byte in the long word. Anything coming up as non zero is a difference"

Slightly more complicated. I want to determine the color diference of each color component between two equivalent pixels (e.g. in the same position) in two images of the same size. I can't use LONGs for that because the results of a diference might pass the boudaries of each BYTE in a LONG.
I'm also scanning all pixels :-D so this is the critical part of the code..
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Help needed with a very silly idea...
« Reply #37 on: February 04, 2005, 01:28:05 AM »
@Jose

Stay away from 24-bit packed pixel format (3 bytes per pixel). It is surely not of God's pixel representation ;-)

If you need to compare true colour data, have your code load it as 32-bit by expanding with an alpha channel. Even if you don't use the alpha for anything (which increases your datasize by 25%), the benefits of sensible alignment and longword accesses to the data more than make up for it.

I don't know how exactly you are handling your images but it is realtively straightforward to have datatypes load it and then use the DTM_READPIXELARRAY method to extract a 32-bit truecolour (ARGB) representation, even if the source data is not 32-bit.
int p; // A
 

Offline Jose

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show only replies by Jose
Re: Help needed with a very silly idea...
« Reply #38 on: March 03, 2005, 07:59:12 PM »
@Karlos

Yes, but if I use the DTM_READPIXELARRAY to get an ARGB representation and the source file/memory region is in a different format, say 24bit-packed (isn't that and YUV what most Jpegs are in by the way?) won't things slow down the same cause the OS will have to do the conversion anyway ?  I though about doing a routine just for the 24bit-packed format wich uses LONGs, treating each LONG as, successively, RGBR, then GBRG and BRGB... but I haven't looked at the details to see if it's possible in my case...
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show only replies by Cymric
Re: Help needed with a very silly idea...
« Reply #39 on: March 03, 2005, 08:27:08 PM »
Quote
Karlos wrote:
@ 23JUL/JULES :-)
Thanks for the link. The mechanism there reminds me of a trick used to speed up a mandelbrot generator I tried once. It had a  mask to define already calculated pixels and used this border tracing to determine the region that had reached the iteration limit, bound it off and 'flood fill' the area as being already rendered.

Ah damn. Beaten to it. I came up with the same algorithm after staring at the blue/gray picture for a while. I have the nagging feeling you could do something clever with edge detection algorithms followed by a fast byte/word scanner to get a rough idea where the outlines of the blobs are. Then you can let loose the above algorithm. Finally wrap up with a box-within-box algorithm and merge them as necessary. But you're looking at an O(N^high integer) algorithm at the very least.

By the way, if you can locate Nico François' TurboMandel (or MandelVroom, forgot the exact name) you can witness a fractal flood fill in action. It was quite a sight to see fractals rendered in seconds rather than hours on a lowly 68000 :-).
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.