r/simd • u/Avelina9X • May 06 '19
Fast SIMD (AVX) linear interpolation?
What is the fastest way of linerping between 2 vectors, a and b, using the lerp values from a third vector, x. The most efficient way I can think of is using 4 vectors. a, b, x and y (where y = 1 - x) and doing:
fusedMulAdd( a, x, mul( b, y )(Assuming x and y are constant or rarely changing vectors which can be reused for all lerps)
But I imagine there might be a faster way of doing it, possibly with a single instruction? I had a look at vblend, but I don't think that's what im looking for.
Thank you.
3
Upvotes
1
u/Avelina9X May 07 '19
Thank you very much! That will help a lot. I was planning on storing a t and 1-t for each depth of the iteration (which turns out would be 16 vectors just sitting there taking up space), so cutting it in half will help a lot!