Live data from Hacker News

Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

github.com

41–50 of 66 posts

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#41

Compared to the other tool this is just "slow code, but now with threads." This problem is perfect to exploit capabilities of modern CPUs, and neither of the projects does so. At least this one iterates over the y coordinates in the outer loop. Nothing about what either tool does is noteworthy.

When one user is waiting for one image, this distinction matters. When multiple users are waiting for an image, or one user waiting for multiple images, the extra complexity is questionable.

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#42
post #29
post #17

Earlier quoted context omitted.

Considering the source material is a file, that needs to be loaded up by the CPU first, and the operation itself is dead simple, the real constraint is RAM bandwidth. I would guess that the time of getting the data out to the GPU and back, is about the same as just calculating the difference on the CPU. So, the quickest solution is probably to use the CPUs vector operations, and read ahead into the registers so you c…

GPU can now directly read the file on the SSD.

Citation needed? I know things have been announced but what's available now?

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#43
post #31

Looks like a for loop iterating over each pixel one row at a time. What makes this fast?

It does at least parallelize the work across available cores.

This is the line that makes the difference:

https://github.com/n7olkachev/imgdiff/blob/master/pkg/imgdif...

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#44

When making an image manipulation/creation/diff/etc tool I'd highly recommend showing at least a screenshot or two of the result in the Github itself.

There are so many tools on github lacking screenshots or examples. It’s like they don’t want to sell their free content!

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#45
post #5

I'm skeptical about it's high claims. Looking at the code its just using the Go standard library image package, looping over the bounds and calculating delta? Doesn't seem like there's anything special here? It's roughly what any novice would build if asked to diff two images in Go?

I just looked at the source code and I'm very skeptical about what the author claims. The way the code is structured and is written is not very professional. Also I don't see any benchmarks. If you claims something at least give valid sources.

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#46

Why not use the GPU? This is exactly the kind of tasks GPUs were designed for. Gimp can do this in real time using the difference layer mode.

The bottleneck is almost certainly decoding the image (PNGs are zlib compressed, which will be going at something like ~300 MB/s plus the filter stuff PNG does), not comparing raw pixels (which you should be able to do at memory bandwidth, so something in excess of 10 GP/s).

Compressed, but not as a single continuous block. The bottleneck will probably be in doing things serially, both with decompression and the disk IO.

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#47
A bit meta and very cruddy - a cheap and cheerful ruby tool I whipped up back in 2014 that would render two websites and then diff them.

It was achieved by looping over every RGB pixel from the PNG rendered image of each URL.

https://github.com/sammcj/urldiff

Not exactly something I'm proud of, but the pixel loop solution did make me laugh at the time.

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#49

I solved this problem for my use case by using an approximate diff. Basically diffing took too long ( I was diffing to remove duplicate frames from a virtualized browser to browser screencast ), so after trying to various options (hashing, diffs, etc) I just went with a simple check of a basically random but fixed set of pixels, which worked really well. I don't have data on the actual false positives/ negatives but…

Did you try using any exotic wide instructions, like AVX or something?

Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool

#50
post #29

Earlier quoted context omitted.

GPU can now directly read the file on the SSD.

Citation needed? I know things have been announced but what's available now?

GPUDirect has been available for quite sometime now: https://developer.nvidia.com/gpudirect
Post reply on HN