3 ms·
I don't think those are your scm's business. git is the stupid content tracker, it tracks whatever you push into it. If I were to make a contrived analogy, how
by rakoo 12y ago
I don't think those are your scm's business. git is the stupid content tracker, it tracks whatever you push into it.
If I were to make a contrived analogy, how do you know how to diff random arrays of bytes ? Where do you start, where do you stop ? How do you know that "\n" or "\r\n" is some kind of delimiter ? You put that knowledge in "diff" and in your editor, and git stores the raw array of bytes. It's the same with binary content: git doesn't care that you don't deal with UTF-8 characters, it doesn't care that it isn't bounded by newline characters.
If you take things this way, you start to understand that the "diff" tool you use must be appropriate to the content you have, and it's not the scm's business. Now, how exactly would a diff work for images, I have absolutely no idea.
- davvid 12y agoAn image diff is pretty simple. If you represent an image as a vector of values, diffing just means subtracting two vectors abs(A-B) and writing out the result into a new image. template<typename T> T diff(const T& a, const T& b) { auto sz = std::min(a.size(), b.size()); T img(sz, 1); for (auto i = 0; i < sz; ++i) { img[i] = std::fabs(a[i] - b[i]); } return img; } // usage vector<float> a, b; a.emplace_back(1.0); b.emplace_back(0.5); a.emplace_back(1.0); b.emplace_back(0.0); a.emplace_back(0.5); b.emplace_back(0.5); auto img = diff(a, b); write_exr("filename.exr", img); The resulting image ends up with 0.0 black in pixels that are identical and non-zero values in the pixels that differ. When you look at it in an image viewer only the portions that differ will be visible. You often need to crank up the gain when the differences are small.