HackerTrans
TopNewTrendsCommentsPastAskShowJobs

Falvyu

no profile record

comments

Falvyu
·3 anni fa·discuss
If I were to guess:

AVX512 vector and mask register take space on the die, which is a finite resource and could be allocated to other things.

Moreover, power consumption may have also been a challenge, as seen in the early Intel implementations of AVX512 (especially Skylake-X).

And while AVX512 can improve single-threaded performance, that's only for applications that make use of it. And up until recently, that number was extremely limited.
Falvyu
·3 anni fa·discuss
Zen 4 lacks AVX512_FP16 (for 16-bits IEEE floating point operations), AVX512_VP2INTERSECT and also lack the Advanced Matrix eXtension (AMX) set (if you consider that part of AVX512).

https://twitter.com/InstLatX64/status/1646471371558461445/

It's worth noting that 16-bits floating point operations are still possible on Zen 4, but using Google's BF16.
Falvyu
·3 anni fa·discuss
I think the main difference is that the CCL would compute 'enclosed areas' on the fly. To be more specific, it would first create a mask (black & white) of pixels that are similar to the clicked pixel, and then find connections between foreground/white pixels.

I don't work in web development but accelerating CCL algorithms do happen to be my area of expertise. While their execution time depends on the image content, you can expect them to be in the tens of milliseconds for a 4K image, at least for the 'modern' one you can find in OpenCV, and on current consumer-level CPUs, without multi-threading.

Of course, implementing these newer algorithms isn't straightforward. That's why you should instead use something like OpenCV if you have the option to.

Moreover, if CCL doesn't fit what you're looking for then you can also check out watershed algorithms ( https://en.wikipedia.org/wiki/Watershed_%28image_processing%... ). Because they don't work on binary image, they might be a better way to describe what you call 'enclosed space'.
Falvyu
·3 anni fa·discuss
You can probably make the process extremely fast by replacing the flood-fill approach with a something based on a Connected-Component Labeling algorithm ( https://en.wikipedia.org/wiki/Connected-component_labeling ). There's a good amount of literature on the subject and it's often included in computer vision libraries (e.g. OpenCV).

You'd first threshold the image by checking if a pixel is 'close enough' to the clicked pixel. This will create a B&W image. Then you call the CCL on this binary image to produce a labelled image: each pixel will contain the id of its component (i.e. which enclosed space it belongs to). Once you have this, it's just a matter of replacing colors on the canvas for pixels with the same id as the clicked pixels.

Obviously, that's just the 'theory' part. If you can find a good library that includes one then you'll have to integrate it. Otherwise, you'll have to re-implement that in Javascript, which is easier said than done and may also not reach the desired performance.