media/libyuv/util/psnr.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libyuv/util/psnr.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/*
     1.5 + *  Copyright 2013 The LibYuv 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 +// Get PSNR for video sequence. Assuming RAW 4:2:0 Y:Cb:Cr format
    1.15 +
    1.16 +#ifndef UTIL_PSNR_H_  // NOLINT
    1.17 +#define UTIL_PSNR_H_
    1.18 +
    1.19 +#ifdef __cplusplus
    1.20 +extern "C" {
    1.21 +#endif
    1.22 +
    1.23 +#if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED)
    1.24 +typedef unsigned char uint8;
    1.25 +#define UINT8_TYPE_DEFINED
    1.26 +#endif
    1.27 +
    1.28 +static const double kMaxPSNR = 128.0;
    1.29 +
    1.30 +// PSNR formula: psnr = 10 * log10 (Peak Signal^2 * size / sse).
    1.31 +// Returns 128.0 (kMaxPSNR) if sse is 0 (perfect match).
    1.32 +double ComputePSNR(double sse, double size);
    1.33 +
    1.34 +// Computer Sum of Squared Error (SSE).
    1.35 +// Pass this to ComputePSNR for final result.
    1.36 +double ComputeSumSquareError(const uint8* org, const uint8* rec, int size);
    1.37 +
    1.38 +#ifdef __cplusplus
    1.39 +}  // extern "C"
    1.40 +#endif
    1.41 +
    1.42 +#endif  // UTIL_PSNR_H_  // NOLINT

mercurial