Merge "Fix high bit depth mask and variance reference function"