Merge changes I4850b36e,Ic4d7128a into nextgenv2

* changes:
  variance_avx2: sync variance functions with c-code
  Resolve -Wshorten-64-to-32 in variance.