media/libvpx/vp9/encoder/vp9_psnr.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp9/encoder/vp9_psnr.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +#include <math.h>
    1.15 +
    1.16 +#include "vpx_scale/yv12config.h"
    1.17 +
    1.18 +#define MAX_PSNR 100
    1.19 +
    1.20 +double vp9_mse2psnr(double samples, double peak, double mse) {
    1.21 +  double psnr;
    1.22 +
    1.23 +  if (mse > 0.0)
    1.24 +    psnr = 10.0 * log10(peak * peak * samples / mse);
    1.25 +  else
    1.26 +    psnr = MAX_PSNR;  // Limit to prevent / 0
    1.27 +
    1.28 +  if (psnr > MAX_PSNR)
    1.29 +    psnr = MAX_PSNR;
    1.30 +
    1.31 +  return psnr;
    1.32 +}

mercurial