int[][]fold_index=null;// index of the source item in 2nx2n array input to mdct_2d.
// First index (0..n^2-1) index in the folded array (dct-iV input)
// Second index(0..3) - item to add (2 vertiacl, 2 - horizontal)
double[][]fold_k=null;// Matching fold_index items. Each is a product of 2 window coefficients and sign
// Second index(0..3) - item to add (2 vertical, 2 - horizontal)
double[][][]fold_k=null;// First index - mode: 0 - CC 1: SC, 2: CS, 3: SS. Other indices matching fold_index items. Each is a product of 2 window coefficients and sign
int[]unfold_index=null;// index for each element of idct(2nx2n)
double[]unfold_k=null;// Matching unfold_index items. Each is a product of 2 window coefficients and sign
double[][]unfold_k=null;// First index - mode: 0 - CC 1: SC, 2: CS, 3: SS. Other indices matching unfold_index items. Each is a product of 2 window coefficients and sign
publicDttRad2(intmaxN){// n - maximal
setup_arrays(maxN);// always setup arrays for fast calculations
...
...
@@ -87,25 +87,31 @@ public class DttRad2 {
// For index in dct-iv input (0..n-1) get 2 variants of index in mdct input array (0..2*n-1)
// second index : 0 - index in X array 2*n long
// 1 - window index (0..n-1), [0] - minimal, [n-1] - max
// 2 - sign of the term
// 2 - sign of the C term (-~c - d, +a -~b)
// 3 - sign of the S term (+~c - d, +a +~b)
privateint[][]get_fold_indices(intx,intn){
intn1=n>>1;
int[][]ind=newint[2][3];
int[][]ind=newint[2][4];
if(x<n1){
ind[0][0]=n+n1-x-1;// -cR
ind[0][0]=n+n1-x-1;// C: -cR, S: +cR
ind[0][1]=n1+x;
ind[0][2]=-1;
ind[1][0]=n+n1+x;// -d
ind[0][3]=1;
ind[1][0]=n+n1+x;// C: -d, S: -d
ind[1][1]=n1-x-1;
ind[1][2]=-1;
ind[1][3]=-1;
}else{
x-=n1;
ind[0][0]=x;// +a
ind[0][0]=x;// C: +a, S: +a
ind[0][1]=x;
ind[0][2]=1;
ind[1][0]=n-x-1;// -bR
ind[0][3]=1;
ind[1][0]=n-x-1;// C: -bR, S: +bR
ind[1][1]=n-x-1;
ind[1][2]=-1;
ind[1][3]=1;
}
returnind;
...
...
@@ -114,49 +120,57 @@ public class DttRad2 {
privatevoidset_fold_2d(intn){// n - DCT and window size