Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Inverse palette conversion algorithm...
Re: Inverse palette conversion algorithm... [message #2311 is a reply to message #2244] Fri, 07 April 2006 17:46 Go to previous messageGo to previous message
mr_ped is currently offline  mr_ped
Messages: 826
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
The idea behind my code is simple FIFO flood fill.
You put the palette colors into the color space (cube), and start parallel flood fills from each point, until whole space is filled.

The only problem is that you can't use FIFO approarch directly, as the (+3,+3,+0) point's "distance" in FIFO terms would be 6 (6 steps needed to reach it), while the space distance is sqrt(3*3+3*3+0*0).

So the "FIFO" has been improved by distance sorting.
("radix" sorted queue "Vector<sCubePoint> feed_me[RASTER_MAP_MAX_DIST+1];")

This is quite an overhead in terms of memory usage, and also I can just hope the Vector constructor/destructor is fast enough to keep this fast (probably this is the bottleneck of the code, which can be optimalised by someone who knows containers better).

But from the syntetic benchmark it's already almost 2 times faster than your original piece of code.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DLL and U++ type
Next Topic: Alpha composition OVER operator WITHOUT premultiplied alpha
Goto Forum:
  


Current Time: Thu Aug 28 04:48:46 CEST 2025

Total time taken to generate the page: 0.06256 seconds