Best way for meanStddev with two masks

Hey there,

I have an image.
I need the cv::meanStddev of that image for a randomly chosen pixel subset which is non zero.

The image is all floats 32 bit.

I basically want to do this:

			finalMask.setTo(mask);
			finalMask.setTo(0, image == 0);
			
			cv::Scalar mean, stddev;
			cv::meanStdDev(
				image,
				mean,
				stddev,
				finalMask
			);

But this is too slow.
What is the fastest way to meanStddev an image with two masks (one being a non-zero mask)?