I haven't looked at NL means filtering in detail yet, but could't you precompute the weights and store them in a LUT?