Implementing reference and masked pixels