diff --git a/examples/vp8_multi_resolution_encoder.c b/examples/vp8_multi_resolution_encoder.c
index 4c29056e563e77eeab54941997044accd8740be4..1fef7dbb89bf64c1be6ec83fbe4ed75af838a971 100644
--- a/examples/vp8_multi_resolution_encoder.c
+++ b/examples/vp8_multi_resolution_encoder.c
@@ -18,11 +18,12 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include "math.h"
+#include <math.h>
 #define VPX_CODEC_DISABLE_COMPAT 1
 #include "vpx/vpx_encoder.h"
 #include "vpx/vp8cx.h"
 #include "vpx_ports/mem_ops.h"
+#include "./tools_common.h"
 #define interface (vpx_codec_vp8_cx())
 #define fourcc    0x30385056
 
@@ -44,21 +45,6 @@
 #include "third_party/libyuv/include/libyuv/scale.h"
 #include "third_party/libyuv/include/libyuv/cpu_id.h"
 
-static double vp8_mse2psnr(double Samples, double Peak, double Mse)
-{
-    double psnr;
-
-    if ((double)Mse > 0.0)
-        psnr = 10.0 * log10(Peak * Peak * Samples / Mse);
-    else
-        psnr = 60;      // Limit to prevent / 0
-
-    if (psnr > 60)
-        psnr = 60;
-
-    return psnr;
-}
-
 static void die(const char *fmt, ...) {
     va_list ap;
 
@@ -454,8 +440,8 @@ int main(int argc, char **argv)
         if ( (show_psnr) && (psnr_count[i]>0) )
         {
             int j;
-            double ovpsnr = vp8_mse2psnr(psnr_samples_total[i], 255.0,
-                                         psnr_sse_total[i]);
+            double ovpsnr = sse_to_psnr(psnr_samples_total[i], 255.0,
+                                        psnr_sse_total[i]);
 
             fprintf(stderr, "\n ENC%d PSNR (Overall/Avg/Y/U/V)", i);
 
diff --git a/tools_common.c b/tools_common.c
index 667432027f71d23d617a8a39fa8458fc20629f26..4f2ac74016383fa94f230e566eb3ee1c3bee472f 100644
--- a/tools_common.c
+++ b/tools_common.c
@@ -8,13 +8,14 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "tools_common.h"
-
+#include <math.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "./tools_common.h"
+
 #if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
 #include "vpx/vp8cx.h"
 #endif
@@ -253,3 +254,14 @@ int vpx_img_read(vpx_image_t *img, FILE *file) {
   return 1;
 }
 
+// TODO(dkovalev) change sse_to_psnr signature: double -> int64_t
+double sse_to_psnr(double samples, double peak, double sse) {
+  static const double kMaxPSNR = 100.0;
+
+  if (sse > 0.0) {
+    const double psnr = 10.0 * log10(samples * peak * peak / sse);
+    return psnr > kMaxPSNR ? kMaxPSNR : psnr;
+  } else {
+    return kMaxPSNR;
+  }
+}
diff --git a/tools_common.h b/tools_common.h
index b60825cefcc41f8237a6a0470bc3d8d8566f08bc..58894def092490639ac0a655992a47b7950303df 100644
--- a/tools_common.h
+++ b/tools_common.h
@@ -142,6 +142,8 @@ int vpx_img_plane_height(const vpx_image_t *img, int plane);
 void vpx_img_write(const vpx_image_t *img, FILE *file);
 int vpx_img_read(vpx_image_t *img, FILE *file);
 
+double sse_to_psnr(double samples, double peak, double mse);
+
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
diff --git a/vpxenc.c b/vpxenc.c
index 8cd5a103ae690fd09c3910817b4b8f6824b32df7..c61d83e41fd9bc1af4830ddf50d0980091d2e8d9 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1399,8 +1399,8 @@ static void show_psnr(struct stream_state  *stream) {
     return;
 
   fprintf(stderr, "Stream %d PSNR (Overall/Avg/Y/U/V)", stream->index);
-  ovpsnr = vp8_mse2psnr((double)stream->psnr_samples_total, 255.0,
-                        (double)stream->psnr_sse_total);
+  ovpsnr = sse_to_psnr((double)stream->psnr_samples_total, 255.0,
+                       (double)stream->psnr_sse_total);
   fprintf(stderr, " %.3f", ovpsnr);
 
   for (i = 0; i < 4; i++) {
diff --git a/vpxstats.c b/vpxstats.c
index 70cea3ee7fd4bf8553308ea7590478c90d3dd464..5f88f8d35975a38b388b6cc46f80c66fbb2f3c84 100644
--- a/vpxstats.c
+++ b/vpxstats.c
@@ -120,16 +120,3 @@ void stats_write(stats_io_t *stats, const void *pkt, size_t len) {
 vpx_fixed_buf_t stats_get(stats_io_t *stats) {
   return stats->buf;
 }
-
-double vp8_mse2psnr(double samples, double peak, double mse) {
-  const int kMaxPSNR = 100;
-  double psnr = kMaxPSNR;
-
-  if (mse > 0.0)
-    psnr = 10.0 * log10(peak * peak * samples / mse);
-
-  if (psnr > kMaxPSNR)
-    psnr = kMaxPSNR;
-
-  return psnr;
-}
diff --git a/vpxstats.h b/vpxstats.h
index 9ce9c532094d4414dd5b16efa1ddc8f86a8487a1..5c9ea34f71a3cd401b1ee4c8734f41e80ca8388f 100644
--- a/vpxstats.h
+++ b/vpxstats.h
@@ -36,8 +36,6 @@ void stats_close(stats_io_t *stats, int last_pass);
 void stats_write(stats_io_t *stats, const void *pkt, size_t len);
 vpx_fixed_buf_t stats_get(stats_io_t *stats);
 
-double vp8_mse2psnr(double samples, double peak, double mse);
-
 #ifdef __cplusplus
 }  // extern "C"
 #endif