Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
38720a6b
authored
May 27, 2022
by
samrobinson
Committed by
Marc Baechinger
May 30, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Treat pixels as unsigned and correct pixel count division.
PiperOrigin-RevId: 451428202
parent
983e074f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/SsimHelper.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/SsimHelper.java
View file @
38720a6b
...
@@ -454,10 +454,10 @@ public final class SsimHelper {
...
@@ -454,10 +454,10 @@ public final class SsimHelper {
double
total
=
0
;
double
total
=
0
;
for
(
int
y
=
0
;
y
<
windowHeight
;
y
++)
{
for
(
int
y
=
0
;
y
<
windowHeight
;
y
++)
{
for
(
int
x
=
0
;
x
<
windowWidth
;
x
++)
{
for
(
int
x
=
0
;
x
<
windowWidth
;
x
++)
{
total
+=
pixelBuffer
[
get1dIndex
(
x
,
y
,
stride
,
bufferIndexOffset
)];
total
+=
pixelBuffer
[
get1dIndex
(
x
,
y
,
stride
,
bufferIndexOffset
)]
&
0xFF
;
}
}
}
}
return
total
/
windowWidth
*
windowHeight
;
return
total
/
(
windowWidth
*
windowHeight
)
;
}
}
/** Calculates the variances and covariance of the pixels in the window for both buffers. */
/** Calculates the variances and covariance of the pixels in the window for both buffers. */
...
@@ -476,8 +476,8 @@ public final class SsimHelper {
...
@@ -476,8 +476,8 @@ public final class SsimHelper {
for
(
int
y
=
0
;
y
<
windowHeight
;
y
++)
{
for
(
int
y
=
0
;
y
<
windowHeight
;
y
++)
{
for
(
int
x
=
0
;
x
<
windowWidth
;
x
++)
{
for
(
int
x
=
0
;
x
<
windowWidth
;
x
++)
{
int
index
=
get1dIndex
(
x
,
y
,
stride
,
bufferIndexOffset
);
int
index
=
get1dIndex
(
x
,
y
,
stride
,
bufferIndexOffset
);
double
referencePixelDeviation
=
referenceBuffer
[
index
]
-
referenceMean
;
double
referencePixelDeviation
=
(
referenceBuffer
[
index
]
&
0xFF
)
-
referenceMean
;
double
distortedPixelDeviation
=
distortedBuffer
[
index
]
-
distortedMean
;
double
distortedPixelDeviation
=
(
distortedBuffer
[
index
]
&
0xFF
)
-
distortedMean
;
referenceVariance
+=
referencePixelDeviation
*
referencePixelDeviation
;
referenceVariance
+=
referencePixelDeviation
*
referencePixelDeviation
;
distortedVariance
+=
distortedPixelDeviation
*
distortedPixelDeviation
;
distortedVariance
+=
distortedPixelDeviation
*
distortedPixelDeviation
;
referenceDistortedCovariance
+=
referencePixelDeviation
*
distortedPixelDeviation
;
referenceDistortedCovariance
+=
referencePixelDeviation
*
distortedPixelDeviation
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment