# Revision history [back]

Agree with @LorenaGdL about using basic matrix operations which are optimized by SSE, AVX codes and other parallel techniques (if needed). Your code should be:

void calcDepthValues(const Mat &depth, Mat & realDepth){ // should not return a Mat, it can be a very huge object
realDepth= depth.clone();
float a = -10758.02914f/255; // fix it if you already knew it
float b = 448.251214f+10758.02914f; // fix it if you already knew it

realDepth *= a;
realDepth += b;
}