going to do a standalone fast gradient impl
setup
current piggyHog grad
8ms avg for gradients, 1 img, 10 runs, singlethreaded.
8ms avg for gradients, 1 img, 10 runs, singlethreaded.make
whaddaya know, the 'index directly into img' does help
hmm interesting, the atan2 seems expensive
nvm, indexing with .at(y,x) vs [direct] makes no difference
fast atan2 takes half the time. lets try that lookup table again
yeah, atan2 table lookup is reasoanbly cheap. (but, more variation in perf when using the lookup table)
sqrt accounts for ~0.5ms
bizarre...not writing mag_img is more expensive than actually writing mag_img
second version of the grad function that tries to approximate a stream benchmark
yeahhhh, using all ints (8-bit, 16-bit, 32-bit) for the gradX, gradY
doing just x-gradient in 0.72ms for 640x480
if we do all 3 channels (if tmp_mag > max_mag) for gradX, we get 1ms.
cleanup
plain stream benchmark with no gradient = 0.43ms
interesting, loading the cv:vec3b all at once, then using the pixels at one at a time -- helps. 0.43ms -> 0.34ms (in the 2-3gb/s range)
avoiding 'dram += local' -- not making much difference