- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
52 lines
1.8 KiB
Java
52 lines
1.8 KiB
Java
package com.google.android.exoplayer2.video.spherical;
|
|
|
|
import android.opengl.Matrix;
|
|
import com.google.android.exoplayer2.util.TimedValueQueue;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class FrameRotationQueue {
|
|
public boolean recenterMatrixComputed;
|
|
public final float[] recenterMatrix = new float[16];
|
|
public final float[] rotationMatrix = new float[16];
|
|
public final TimedValueQueue rotations = new TimedValueQueue();
|
|
|
|
public boolean pollRotationMatrix(float[] fArr, long j) {
|
|
float[] fArr2 = (float[]) this.rotations.pollFloor(j);
|
|
if (fArr2 == null) {
|
|
return false;
|
|
}
|
|
getRotationMatrixFromAngleAxis(this.rotationMatrix, fArr2);
|
|
if (!this.recenterMatrixComputed) {
|
|
computeRecenterMatrix(this.recenterMatrix, this.rotationMatrix);
|
|
this.recenterMatrixComputed = true;
|
|
}
|
|
Matrix.multiplyMM(fArr, 0, this.recenterMatrix, 0, this.rotationMatrix, 0);
|
|
return true;
|
|
}
|
|
|
|
public static void computeRecenterMatrix(float[] fArr, float[] fArr2) {
|
|
Matrix.setIdentityM(fArr, 0);
|
|
float f = fArr2[10];
|
|
float f2 = fArr2[8];
|
|
float sqrt = (float) Math.sqrt((f * f) + (f2 * f2));
|
|
float f3 = fArr2[10];
|
|
fArr[0] = f3 / sqrt;
|
|
float f4 = fArr2[8];
|
|
fArr[2] = f4 / sqrt;
|
|
fArr[8] = (-f4) / sqrt;
|
|
fArr[10] = f3 / sqrt;
|
|
}
|
|
|
|
public static void getRotationMatrixFromAngleAxis(float[] fArr, float[] fArr2) {
|
|
float f = fArr2[0];
|
|
float f2 = -fArr2[1];
|
|
float f3 = -fArr2[2];
|
|
float length = Matrix.length(f, f2, f3);
|
|
if (length != 0.0f) {
|
|
Matrix.setRotateM(fArr, 0, (float) Math.toDegrees(length), f / length, f2 / length, f3 / length);
|
|
} else {
|
|
Matrix.setIdentityM(fArr, 0);
|
|
}
|
|
}
|
|
}
|