-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrixCreationAndOperation.java
More file actions
49 lines (39 loc) · 1.35 KB
/
Copy pathMatrixCreationAndOperation.java
File metadata and controls
49 lines (39 loc) · 1.35 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package cn.edu.ustc.aaron.common;
import Jama.Matrix;
import java.util.*;
public abstract class MatrixCreationAndOperation {
protected int matWidth;
protected int matHeight;
protected int matWidthC;
protected int matHeightC;
protected boolean codeCbCr;
protected double[][] arrY;
protected double[][] arrCb;
protected double[][] arrCr;
protected Matrix[] mat;
protected MatrixCreationAndOperation (int matHeight, int matWidth, boolean codeCbCr) {
this.matHeight = matHeight;
this.matWidth = matWidth;
this.matHeightC = (matHeight >> 2);
this.matWidthC = matWidth;
this.codeCbCr = codeCbCr;
mat = new Matrix[3];
}
protected void allocMemory () {
arrY = new double [matHeight][matWidth];
mat[0] = new Matrix(arrY, matHeight, matWidth);
if (codeCbCr) {
arrCb = new double [matHeightC][matWidthC];
arrCr = new double [matHeightC][matWidthC];
mat[1] = new Matrix(arrCb, matHeightC, matWidthC);
mat[2] = new Matrix(arrCr, matHeightC, matWidthC);
}
}
public Matrix[] getMatrix () {
return mat;
}
public Matrix getMatrix (int color) {
return mat[color];
}
public abstract void operateMatrix (Matrix[]... srcs);
}