Commit efe1b1db authored by Yaowu Xu's avatar Yaowu Xu

Set a max dB value for PSNR_HVS and FAST_SSIM

Now set at 100.0 instead of infinite

Change-Id: I41bae0c4bd95a26f9819584e7311b7945df1271a
parent 3c28b4a8
......@@ -11,6 +11,8 @@
#ifndef VPX_INTERNAL_VPX_PSNR_H_
#define VPX_INTERNAL_VPX_PSNR_H_
#define MAX_PSNR 100.0
#ifdef __cplusplus
extern "C" {
#endif
......
......@@ -12,7 +12,6 @@
#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) {
......
......@@ -10,6 +10,7 @@
* This code was originally written by: Nathan E. Egge, at the Daala
* project.
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
......@@ -17,6 +18,7 @@
#include "./vpx_dsp_rtcd.h"
#include "vpx_dsp/ssim.h"
#include "vpx_ports/system_state.h"
/* TODO(jbb): High bit depth version of this code needed */
typedef struct fs_level fs_level;
typedef struct fs_ctx fs_ctx;
......@@ -442,6 +444,9 @@ static double calc_ssim(const unsigned char *_src, int _systride,
}
static double convert_ssim_db(double _ssim, double _weight) {
assert(_weight >= _ssim);
if ((_weight - _ssim) < 1e-10)
return MAX_SSIM_DB;
return 10 * (log10(_weight) - log10(_weight - _ssim));
}
......
......@@ -10,6 +10,7 @@
* This code was originally written by: Gregory Maxwell, at the Daala
* project.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
......@@ -18,6 +19,7 @@
#include "./vpx_dsp_rtcd.h"
#include "vpx_dsp/ssim.h"
#include "vpx_ports/system_state.h"
#include "vpx/internal/vpx_psnr.h"
#if !defined(M_PI)
# define M_PI (3.141592653589793238462643)
......@@ -90,6 +92,9 @@ static const double csf_cr420[8][8] = {
0.478717061273, 0.393021669543, 0.330555063063, 0.285345396658}};
static double convert_score_db(double _score, double _weight) {
assert(_score * _weight >= 0.0);
if (_weight * _score < 255 * 255 * 1e-10)
return MAX_PSNR;
return 10 * (log10(255 * 255) - log10(_weight * _score));
}
......
......@@ -11,6 +11,8 @@
#ifndef VPX_DSP_SSIM_H_
#define VPX_DSP_SSIM_H_
#define MAX_SSIM_DB 100.0;
#ifdef __cplusplus
extern "C" {
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment