-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInverse.java
More file actions
32 lines (28 loc) · 1.17 KB
/
Copy pathInverse.java
File metadata and controls
32 lines (28 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cn.edu.ustc.aaron.common;
import Jama.Matrix;
import java.util.*;
public class Inverse extends MatrixCreationAndOperation {
public Inverse (int matHeight, int matWidth, boolean codeCbCr) {
super(matHeight, matWidth, codeCbCr);
super.matHeightC = matHeight;
}
public void operateMatrix(Matrix[]... srcs) {
if (true) {
Matrix[] coeffMat = srcs[0];
double cf = coeffMat[0].get(0, 0);
super.mat[0] = Matrix.identity(super.matHeight, super.matWidth).timesEquals(cf);
if (super.codeCbCr) {
super.mat[1] = Matrix.identity(super.matHeightC, super.matWidthC).timesEquals(cf);
super.mat[2] = Matrix.identity(super.matHeightC, super.matWidthC).timesEquals(cf);
}
}
else {
Matrix[] coeffUV = srcs[0];
super.mat[0] = coeffUV[0].transpose().times(coeffUV[0]).inverse();
if (super.codeCbCr) {
super.mat[1] = coeffUV[1].transpose().times(coeffUV[1]).inverse();
super.mat[2] = coeffUV[2].transpose().times(coeffUV[2]).inverse();
}
}
}
}