From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- media/libvpx/vpx/src/vpx_psnr.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 media/libvpx/vpx/src/vpx_psnr.c (limited to 'media/libvpx/vpx/src/vpx_psnr.c') diff --git a/media/libvpx/vpx/src/vpx_psnr.c b/media/libvpx/vpx/src/vpx_psnr.c new file mode 100644 index 000000000..05843acb6 --- /dev/null +++ b/media/libvpx/vpx/src/vpx_psnr.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014 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 + +#include "vpx/internal/vpx_psnr.h" + +#define MAX_PSNR 100.0 + +double vpx_sse_to_psnr(double samples, double peak, double sse) { + if (sse > 0.0) { + const double psnr = 10.0 * log10(samples * peak * peak / sse); + return psnr > MAX_PSNR ? MAX_PSNR : psnr; + } else { + return MAX_PSNR; + } +} -- cgit v1.2.3