BEST FloodFill Algorithm using loop instead of recursion .

preview_player
Показать описание
Use three copies of the original version, one keeps the filled pixels, and one keeps the verified pixels. Fill a pixel and verify it's neighbors. do it in a loop. read and record your loop run results in the 2D arrays in memory, i.e. copies of the original image. When a complete canvas loop returns no new verified pixels, then you're good to go.
I'm pretty sure that it's the fastest floodfill algorythm in the world, because, not only it floodfills entires lines and rows in 10 instruction loop iterations, when it checks a verified space, it runs this instruction on the verified array in memory: IF (VerifiedPixelArray[23,23+1] = grey) THEN fill and verify it's neighbors. The IF check is only 2-3 instructions to read from an array position.

Performance: 7 million voxels every second of complex mandelbulb ISOsurfaces, 2012 AMD cpu suing one thread, maximum was 2 gb voxel arrays in 32 bit because that is the max array size, yes I was processing 2gb, three-dimensional canvases with this, in about 2-3 minutes.
Рекомендации по теме
Комментарии
Автор

He is replacing the grey.. it would have been better. If he did not share the screen

NileshAkhade
visit shbcf.ru