by dosshell · 4y ago · 0 comments
However...
inc.cpp:27
Gray is not the average of RGB, it is usally approximated with `Y = 0.299 R + 0.587 G + 0.114 B`.
https://github.com/ern0/howto-wasm-minimal/blob/master/inc.c...
It should be:
uint32_t gray = 0.299 * ptr[i] + 0.587 * ptr[i+1] + 0.114 * ptr[i+2];
ptr[i] = gray;
ptr[i+1] = gray;
ptr[i+2] = gray;