2014-04-09 03:08:39 +04:00
|
|
|
/*
|
2016-03-24 22:08:51 +03:00
|
|
|
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
2014-04-09 03:08:39 +04:00
|
|
|
*
|
2016-03-24 22:08:51 +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-03-25 22:57:08 +03:00
|
|
|
#ifndef AOM_DSP_SSIM_H_
|
|
|
|
#define AOM_DSP_SSIM_H_
|
2014-04-09 03:08:39 +04:00
|
|
|
|
2016-04-30 03:04:46 +03:00
|
|
|
#define MAX_SSIM_DB 100.0;
|
|
|
|
|
2014-04-09 03:08:39 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
#include "./aom_config.h"
|
2016-03-22 01:15:19 +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-03-25 22:11:05 +03:00
|
|
|
double aom_get_ssim_metrics(uint8_t *img1, int img1_pitch, uint8_t *img2,
|
2016-01-27 23:42:45 +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-03-25 22:11:05 +03:00
|
|
|
double aom_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
2016-01-27 23:42:45 +03:00
|
|
|
const YV12_BUFFER_CONFIG *dest, double *weight);
|
2014-04-09 03:08:39 +04:00
|
|
|
|
2016-03-25 22:11:05 +03:00
|
|
|
double aom_calc_fastssim(const YV12_BUFFER_CONFIG *source,
|
2016-01-27 23:42:45 +03:00
|
|
|
const YV12_BUFFER_CONFIG *dest, double *ssim_y,
|
2016-05-02 21:50:56 +03:00
|
|
|
double *ssim_u, double *ssim_v, uint32_t bd,
|
|
|
|
uint32_t in_bd);
|
2015-04-17 20:23:24 +03:00
|
|
|
|
2016-03-25 22:43:01 +03:00
|
|
|
#if CONFIG_AOM_HIGHBITDEPTH
|
2016-03-25 22:11:05 +03:00
|
|
|
double aom_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
2016-01-27 23:42:45 +03:00
|
|
|
const YV12_BUFFER_CONFIG *dest, double *weight,
|
2016-05-03 00:53:28 +03:00
|
|
|
uint32_t bd, uint32_t in_bd);
|
2016-03-25 22:43:01 +03:00
|
|
|
#endif // CONFIG_AOM_HIGHBITDEPTH
|
2014-09-20 03:51:59 +04:00
|
|
|
|
2014-04-09 03:08:39 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2016-03-25 22:57:08 +03:00
|
|
|
#endif // AOM_DSP_SSIM_H_
|