2014-04-09 03:08:39 +04:00
|
|
|
/*
|
2016-09-02 00:32:49 +03:00
|
|
|
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
2014-04-09 03:08:39 +04:00
|
|
|
*
|
2016-09-02 00:32:49 +03:00
|
|
|
* This source code is subject to the terms of the BSD 2 Clause License and
|
|
|
|
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
|
|
|
* was not distributed with this source code in the LICENSE file, you can
|
|
|
|
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
|
|
|
* Media Patent License 1.0 was not distributed with this source code in the
|
|
|
|
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
2014-04-09 03:08:39 +04:00
|
|
|
*/
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#ifndef AOM_DSP_SSIM_H_
|
|
|
|
#define AOM_DSP_SSIM_H_
|
2014-04-09 03:08:39 +04:00
|
|
|
|
2016-02-05 01:03:48 +03:00
|
|
|
#define MAX_SSIM_DB 100.0;
|
|
|
|
|
2014-04-09 03:08:39 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#include "./aom_config.h"
|
2016-08-23 02:08:15 +03:00
|
|
|
#include "aom_scale/yv12config.h"
|
2014-04-09 03:08:39 +04:00
|
|
|
|
2015-04-21 20:05:37 +03:00
|
|
|
// metrics used for calculating ssim, ssim2, dssim, and ssimc
|
|
|
|
typedef struct {
|
|
|
|
// source sum ( over 8x8 region )
|
2015-08-06 23:46:28 +03:00
|
|
|
uint32_t sum_s;
|
2015-04-21 20:05:37 +03:00
|
|
|
|
|
|
|
// reference sum (over 8x8 region )
|
2015-08-06 23:46:28 +03:00
|
|
|
uint32_t sum_r;
|
2015-04-21 20:05:37 +03:00
|
|
|
|
|
|
|
// source sum squared ( over 8x8 region )
|
2015-08-06 23:46:28 +03:00
|
|
|
uint32_t sum_sq_s;
|
2015-04-21 20:05:37 +03:00
|
|
|
|
|
|
|
// reference sum squared (over 8x8 region )
|
2015-08-06 23:46:28 +03:00
|
|
|
uint32_t sum_sq_r;
|
2015-04-21 20:05:37 +03:00
|
|
|
|
|
|
|
// sum of source times reference (over 8x8 region)
|
2015-08-06 23:46:28 +03:00
|
|
|
uint32_t sum_sxr;
|
2015-04-21 20:05:37 +03:00
|
|
|
|
|
|
|
// calculated ssim score between source and reference
|
|
|
|
double ssim;
|
|
|
|
} Ssimv;
|
|
|
|
|
|
|
|
// metrics collected on a frame basis
|
|
|
|
typedef struct {
|
|
|
|
// ssim consistency error metric ( see code for explanation )
|
|
|
|
double ssimc;
|
|
|
|
|
|
|
|
// standard ssim
|
|
|
|
double ssim;
|
|
|
|
|
|
|
|
// revised ssim ( see code for explanation)
|
|
|
|
double ssim2;
|
|
|
|
|
|
|
|
// ssim restated as an error metric like sse
|
|
|
|
double dssim;
|
|
|
|
|
|
|
|
// dssim converted to decibels
|
|
|
|
double dssimd;
|
|
|
|
|
|
|
|
// ssimc converted to decibels
|
|
|
|
double ssimcd;
|
|
|
|
} Metrics;
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
double aom_get_ssim_metrics(uint8_t *img1, int img1_pitch, uint8_t *img2,
|
2016-08-09 08:59:08 +03:00
|
|
|
int img2_pitch, int width, int height, Ssimv *sv2,
|
|
|
|
Metrics *m, int do_inconsistency);
|
2015-04-21 20:05:37 +03:00
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
double aom_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
2016-08-09 08:59:08 +03:00
|
|
|
const YV12_BUFFER_CONFIG *dest, double *weight);
|
2014-04-09 03:08:39 +04:00
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
double aom_calc_fastssim(const YV12_BUFFER_CONFIG *source,
|
2016-08-09 08:59:08 +03:00
|
|
|
const YV12_BUFFER_CONFIG *dest, double *ssim_y,
|
|
|
|
double *ssim_u, double *ssim_v, uint32_t bd,
|
|
|
|
uint32_t in_bd);
|
2015-04-17 20:23:24 +03:00
|
|
|
|
2017-04-12 17:03:28 +03:00
|
|
|
#if CONFIG_HIGHBITDEPTH
|
2016-08-31 00:01:10 +03:00
|
|
|
double aom_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
2016-08-09 08:59:08 +03:00
|
|
|
const YV12_BUFFER_CONFIG *dest, double *weight,
|
2016-02-23 03:05:19 +03:00
|
|
|
uint32_t bd, uint32_t in_bd);
|
2017-04-12 17:03:28 +03:00
|
|
|
#endif // CONFIG_HIGHBITDEPTH
|
2014-09-20 03:51:59 +04:00
|
|
|
|
2014-04-09 03:08:39 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#endif // AOM_DSP_SSIM_H_
|