#include "iqa.h"
#include "convolve.h"
#include "decimate.h"
#include "math_utils.h"
#include "ssim.h"
#include <stdlib.h>
#include <math.h>
Go to the source code of this file.
Functions |
| static IQA_INLINE double | _calc_luminance (float, float, float, float) |
| static IQA_INLINE double | _calc_contrast (double, float, float, float, float) |
| static IQA_INLINE double | _calc_structure (float, double, float, float, float, float) |
| static int | _ssim_map (const struct _ssim_int *, void *) |
| static float | _ssim_reduce (int, int, void *) |
| float | iqa_ssim (const unsigned char *ref, const unsigned char *cmp, int w, int h, int stride, int gaussian, const struct iqa_ssim_args *args) |
| float | _iqa_ssim (float *ref, float *cmp, int w, int h, const struct _kernel *k, const struct _map_reduce *mr, const struct iqa_ssim_args *args) |
Function Documentation
| static IQA_INLINE double _calc_contrast |
( |
double |
sigma_comb_12, |
|
|
float |
sigma1_sqd, |
|
|
float |
sigma2_sqd, |
|
|
float |
C2, |
|
|
float |
beta |
|
) |
| [static] |
| static IQA_INLINE double _calc_luminance |
( |
float |
mu1, |
|
|
float |
mu2, |
|
|
float |
C1, |
|
|
float |
alpha |
|
) |
| [static] |
| static IQA_INLINE double _calc_structure |
( |
float |
sigma_12, |
|
|
double |
sigma_comb_12, |
|
|
float |
sigma1, |
|
|
float |
sigma2, |
|
|
float |
C3, |
|
|
float |
gamma |
|
) |
| [static] |
Private method that calculates the SSIM value on a pre-processed image.
The input images must have stride==width. This method does not scale.
- Note:
- Image buffers are modified.
Map-reduce is used for doing the final SSIM calculation. The map function is called for every pixel, and the reduce is called at the end. The context is caller-defined and *not* modified by this method.
- Parameters:
-
| ref | Original reference image |
| cmp | Distorted image |
| w | Width of the images |
| h | Height of the images |
| k | The kernel used as the window function |
| mr | Optional map-reduce functions to use to calculate SSIM. Required if 'args' is not null. Ignored if 'args' is null. |
| args | Optional SSIM arguments for fine control of the algorithm. 0 for defaults. Defaults are a=b=g=1.0, L=255, K1=0.01, K2=0.03 |
- Returns:
- The mean SSIM over the entire image (MSSIM), or NAN if error.
Definition at line 142 of file ssim.c.
| int _ssim_map |
( |
const struct _ssim_int * |
si, |
|
|
void * |
ctx |
|
) |
| [static] |
| float _ssim_reduce |
( |
int |
w, |
|
|
int |
h, |
|
|
void * |
ctx |
|
) |
| [static] |
| float iqa_ssim |
( |
const unsigned char * |
ref, |
|
|
const unsigned char * |
cmp, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
stride, |
|
|
int |
gaussian, |
|
|
const struct iqa_ssim_args * |
args |
|
) |
| |
Calculates the Structural SIMilarity between 2 equal-sized 8-bit images.
See https://ece.uwaterloo.ca/~z70wang/publications/ssim.html
- Note:
- The images must have the same width, height, and stride.
- Parameters:
-
| ref | Original reference image |
| cmp | Distorted image |
| w | Width of the images |
| h | Height of the images |
| stride | The length (in bytes) of each horizontal line in the image. This may be different from the image width. |
| gaussian | 0 = 8x8 square window, 1 = 11x11 circular-symmetric Gaussian weighting. |
| args | Optional SSIM arguments for fine control of the algorithm. 0 for defaults. Defaults are a=b=g=1.0, L=255, K1=0.01, K2=0.03 |
- Returns:
- The mean SSIM over the entire image (MSSIM), or INFINITY if error.
Definition at line 59 of file ssim.c.