Image Quality Assessment (IQA) 1.1.2
A fast, accurate, and reliable C library for measuring image quality.
Data Structures | Defines | Functions | Variables
source/ms_ssim.c File Reference
#include "iqa.h"
#include "ssim.h"
#include "decimate.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  _context

Defines

#define SCALES   5
#define LPF_LEN   9

Functions

int _ms_ssim_map (const struct _ssim_int *si, void *ctx)
float _ms_ssim_reduce (int w, int h, void *ctx)
void _free_buffers (float **buf, int scales)
int _alloc_buffers (float **buf, int w, int h, int scales)
float iqa_ms_ssim (const unsigned char *ref, const unsigned char *cmp, int w, int h, int stride, const struct iqa_ms_ssim_args *args)

Variables

static const float g_lpf [LPF_LEN][LPF_LEN]
static float g_alphas [] = { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.1333f }
static float g_betas [] = { 0.0448f, 0.2856f, 0.3001f, 0.2363f, 0.1333f }
static float g_gammas [] = { 0.0448f, 0.2856f, 0.3001f, 0.2363f, 0.1333f }

Define Documentation

#define LPF_LEN   9

Definition at line 45 of file ms_ssim.c.

#define SCALES   5

Definition at line 42 of file ms_ssim.c.


Function Documentation

int _alloc_buffers ( float **  buf,
int  w,
int  h,
int  scales 
)

Definition at line 103 of file ms_ssim.c.

void _free_buffers ( float **  buf,
int  scales 
)

Definition at line 95 of file ms_ssim.c.

int _ms_ssim_map ( const struct _ssim_int si,
void *  ctx 
)

Definition at line 74 of file ms_ssim.c.

float _ms_ssim_reduce ( int  w,
int  h,
void *  ctx 
)

Definition at line 84 of file ms_ssim.c.

float iqa_ms_ssim ( const unsigned char *  ref,
const unsigned char *  cmp,
int  w,
int  h,
int  stride,
const struct iqa_ms_ssim_args args 
)

Calculates the Multi-Scale Structural SIMilarity between 2 equal-sized 8-bit images. The default algorithm is MS-SSIM* proposed by Rouse/Hemami 2008.

See https://ece.uwaterloo.ca/~z70wang/publications/msssim.pdf and http://foulard.ece.cornell.edu/publications/dmr_hvei2008_paper.pdf

Note:
1. The images must have the same width, height, and stride.
2. The minimum image width or height is 2^(scales-1) * filter, where 'filter' is 11 if a Gaussian window is being used, or 9 otherwise.
Parameters:
refOriginal reference image
cmpDistorted image
wWidth of the images.
hHeight of the images.
strideThe length (in bytes) of each horizontal line in the image. This may be different from the image width.
argsOptional MS-SSIM arguments for fine control of the algorithm. 0 for defaults. Defaults are wang=0, scales=5, gaussian=1.
Returns:
The mean MS-SSIM over the entire image, or INFINITY if error.

Definition at line 129 of file ms_ssim.c.


Variable Documentation

float g_alphas[] = { 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.1333f } [static]

Definition at line 59 of file ms_ssim.c.

float g_betas[] = { 0.0448f, 0.2856f, 0.3001f, 0.2363f, 0.1333f } [static]

Definition at line 60 of file ms_ssim.c.

float g_gammas[] = { 0.0448f, 0.2856f, 0.3001f, 0.2363f, 0.1333f } [static]

Definition at line 61 of file ms_ssim.c.

const float g_lpf[LPF_LEN][LPF_LEN] [static]
Initial value:
 {
   { 0.000714f,-0.000450f,-0.002090f, 0.007132f, 0.016114f, 0.007132f,-0.002090f,-0.000450f, 0.000714f},
   {-0.000450f, 0.000283f, 0.001316f,-0.004490f,-0.010146f,-0.004490f, 0.001316f, 0.000283f,-0.000450f},
   {-0.002090f, 0.001316f, 0.006115f,-0.020867f,-0.047149f,-0.020867f, 0.006115f, 0.001316f,-0.002090f},
   { 0.007132f,-0.004490f,-0.020867f, 0.071207f, 0.160885f, 0.071207f,-0.020867f,-0.004490f, 0.007132f},
   { 0.016114f,-0.010146f,-0.047149f, 0.160885f, 0.363505f, 0.160885f,-0.047149f,-0.010146f, 0.016114f},
   { 0.007132f,-0.004490f,-0.020867f, 0.071207f, 0.160885f, 0.071207f,-0.020867f,-0.004490f, 0.007132f},
   {-0.002090f, 0.001316f, 0.006115f,-0.020867f,-0.047149f,-0.020867f, 0.006115f, 0.001316f,-0.002090f},
   {-0.000450f, 0.000283f, 0.001316f,-0.004490f,-0.010146f,-0.004490f, 0.001316f, 0.000283f,-0.000450f},
   { 0.000714f,-0.000450f,-0.002090f, 0.007132f, 0.016114f, 0.007132f,-0.002090f,-0.000450f, 0.000714f},
}

Definition at line 46 of file ms_ssim.c.

 All Data Structures Files Functions Variables Typedefs Defines


Copyright (c) 2011 by Tom Distler