diff options
author | Ronald S. Bultje <rbultje@google.com> | 2012-11-01 11:09:58 -0700 |
---|---|---|
committer | Ronald S. Bultje <rbultje@google.com> | 2012-11-01 16:31:22 -0700 |
commit | 4b2c2b9aa4a273a23d90ddb3bbf6dfb3482e0b8f (patch) | |
tree | 20eef975f1a8c28978d826a354092433b9093588 /vp9/encoder/psnr.c | |
parent | 6c280c2299f078a475dc87e7615fdf1a4998cd31 (diff) | |
download | libvpx-4b2c2b9aa4a273a23d90ddb3bbf6dfb3482e0b8f.tar libvpx-4b2c2b9aa4a273a23d90ddb3bbf6dfb3482e0b8f.tar.gz libvpx-4b2c2b9aa4a273a23d90ddb3bbf6dfb3482e0b8f.tar.bz2 libvpx-4b2c2b9aa4a273a23d90ddb3bbf6dfb3482e0b8f.zip |
Rename vp8/ codec directory to vp9/.
Change-Id: Ic084c475844b24092a433ab88138cf58af3abbe4
Diffstat (limited to 'vp9/encoder/psnr.c')
-rw-r--r-- | vp9/encoder/psnr.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vp9/encoder/psnr.c b/vp9/encoder/psnr.c new file mode 100644 index 000000000..6b67bd3b9 --- /dev/null +++ b/vp9/encoder/psnr.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + + +#include "vpx_scale/yv12config.h" +#include "math.h" +#include "vp9/common/systemdependent.h" /* for vp9_clear_system_state() */ + +#define MAX_PSNR 100 + +double vp9_mse2psnr(double Samples, double Peak, double Mse) { + double psnr; + + if ((double)Mse > 0.0) + psnr = 10.0 * log10(Peak * Peak * Samples / Mse); + else + psnr = MAX_PSNR; // Limit to prevent / 0 + + if (psnr > MAX_PSNR) + psnr = MAX_PSNR; + + return psnr; +} |