@UnstableApi
@RequiresApi(value = 21)
class SsimHelper


A helper for calculating SSIM score for transcoded videos.

SSIM (Structural Similarity) Index is a statistical measurement of the similarity between two images. The mean SSIM score (taken between multiple frames) of two videos is a metric to determine the similarity of the videos. SSIM does not measure the absolute difference of the two images like MSE (mean squared error), but rather outputs the human perceptual difference. A higher SSIM score signifies higher similarity, while a SSIM score of 1 means the two images are exactly the same.

SSIM is traditionally computed with the luminance channel (Y), this class uses the luma channel (Y') because the decoder decodes to luma.

Summary

Constants

const Int

The default comparison interval.

Public functions

java-static Double
calculate(
    context: Context!,
    referenceVideoPath: String!,
    distortedVideoPath: String!
)

Returns the mean SSIM score between the reference and the distorted video.

Constants

DEFAULT_COMPARISON_INTERVAL

const val DEFAULT_COMPARISON_INTERVAL = 11: Int

The default comparison interval.

Public functions

calculate

java-static fun calculate(
    context: Context!,
    referenceVideoPath: String!,
    distortedVideoPath: String!
): Double

Returns the mean SSIM score between the reference and the distorted video.

The method compares every n-th frame from both videos.

Parameters
context: Context!

The Context.

referenceVideoPath: String!

The path to the reference video file, which must be in Assets.

distortedVideoPath: String!

The path to the distorted video file.

Throws
java.io.IOException

When unable to open the provided video paths.

java.lang.InterruptedException