FFmpeg
Macros | Typedefs | Functions
tiny_ssim.c File Reference
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define FFSWAP(type, a, b)   do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
 
#define FFMIN(a, b)   ((a) > (b) ? (b) : (a))
 
#define BIT_DEPTH   8
 
#define PIXEL_MAX   ((1 << BIT_DEPTH)-1)
 

Typedefs

typedef uint8_t pixel
 

Functions

static void ssim_4x4x2_core (const pixel *pix1, intptr_t stride1, const pixel *pix2, intptr_t stride2, int sums[2][4])
 
static float ssim_end1 (int s1, int s2, int ss, int s12)
 
static float ssim_end4 (int sum0[5][4], int sum1[5][4], int width)
 
float ssim_plane (pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int width, int height, void *buf, int *cnt)
 
uint64_t ssd_plane (const uint8_t *pix1, const uint8_t *pix2, int size)
 
static double ssd_to_psnr (uint64_t ssd, uint64_t denom)
 
static double ssim_db (double ssim, double weight)
 
static void print_results (uint64_t ssd[3], double ssim[3], int frames, int w, int h)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ FFSWAP

#define FFSWAP (   type,
  a,
  b 
)    do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)

Definition at line 36 of file tiny_ssim.c.

◆ FFMIN

#define FFMIN (   a,
  b 
)    ((a) > (b) ? (b) : (a))

Definition at line 37 of file tiny_ssim.c.

◆ BIT_DEPTH

#define BIT_DEPTH   8

Definition at line 39 of file tiny_ssim.c.

◆ PIXEL_MAX

#define PIXEL_MAX   ((1 << BIT_DEPTH)-1)

Definition at line 40 of file tiny_ssim.c.

Typedef Documentation

◆ pixel

typedef uint8_t pixel

Definition at line 41 of file tiny_ssim.c.

Function Documentation

◆ ssim_4x4x2_core()

static void ssim_4x4x2_core ( const pixel pix1,
intptr_t  stride1,
const pixel pix2,
intptr_t  stride2,
int  sums[2][4] 
)
static

Definition at line 46 of file tiny_ssim.c.

Referenced by ssim_plane().

◆ ssim_end1()

static float ssim_end1 ( int  s1,
int  s2,
int  ss,
int  s12 
)
static

Definition at line 75 of file tiny_ssim.c.

Referenced by ssim_end4().

◆ ssim_end4()

static float ssim_end4 ( int  sum0[5][4],
int  sum1[5][4],
int  width 
)
static

Definition at line 99 of file tiny_ssim.c.

Referenced by ssim_plane().

◆ ssim_plane()

float ssim_plane ( pixel pix1,
intptr_t  stride1,
pixel pix2,
intptr_t  stride2,
int  width,
int  height,
void *  buf,
int cnt 
)

Definition at line 112 of file tiny_ssim.c.

Referenced by main().

◆ ssd_plane()

uint64_t ssd_plane ( const uint8_t *  pix1,
const uint8_t *  pix2,
int  size 
)

Definition at line 140 of file tiny_ssim.c.

Referenced by main().

◆ ssd_to_psnr()

static double ssd_to_psnr ( uint64_t  ssd,
uint64_t  denom 
)
static

Definition at line 152 of file tiny_ssim.c.

Referenced by print_results().

◆ ssim_db()

static double ssim_db ( double  ssim,
double  weight 
)
static

Definition at line 157 of file tiny_ssim.c.

Referenced by print_results().

◆ print_results()

static void print_results ( uint64_t  ssd[3],
double  ssim[3],
int  frames,
int  w,
int  h 
)
static

Definition at line 162 of file tiny_ssim.c.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 177 of file tiny_ssim.c.