Expose MssimCaluclator for use in Duetdev tests

Child: <unknown commit>

PiperOrigin-RevId: 524876651
This commit is contained in:
Googler 2023-04-17 18:03:00 +01:00 committed by Rohit Singh
parent 6f4fca8cbf
commit ffa969f97c

View File

@ -17,6 +17,8 @@ package androidx.media3.transformer;
import static java.lang.Math.pow;
import androidx.media3.common.util.UnstableApi;
/**
* Image comparison tool that calculates the Mean Structural Similarity (MSSIM) of two images,
* developed by Wang, Bovik, Sheikh, and Simoncelli.
@ -25,7 +27,8 @@ import static java.lang.Math.pow;
*
* <p>See <a href=https://ece.uwaterloo.ca/~z70wang/publications/ssim.pdf>the SSIM paper</a>.
*/
/* package */ final class MssimCalculator {
@UnstableApi
public final class MssimCalculator {
// Referred to as 'L' in the SSIM paper, this constant defines the maximum pixel values. The
// range of pixel values is 0 to 255 (8 bit unsigned range).
private static final int PIXEL_MAX_VALUE = 255;
@ -47,7 +50,7 @@ import static java.lang.Math.pow;
/**
* Calculates the Mean Structural Similarity (MSSIM) between two images with window skipping.
*
* @see #calculate(byte[], byte[], int, int, boolean).
* @see #calculate(byte[], byte[], int, int, boolean)
*/
public static double calculate(
byte[] referenceBuffer, byte[] distortedBuffer, int width, int height) {