int[][]fold_index=null;// index of the source item in 2nx2n array input to mdct_2d.
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)
// First index (0..n^2-1) index in the folded array (dct-iV input)
// Second index(0..3) - item to add (2 vertical, 2 - horizontal)
// 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
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)
int[]unfold_index=null;// index for each element of idct(2nx2n)
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
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
publicint[][]getFoldIndex(){
publicint[][]getFoldIndex(){
returnfold_index;
returnfold_index;
}
}
publicint[]getUnfoldIndex(){
publicint[]getUnfoldIndex(){
returnunfold_index;
returnunfold_index;
}
}
publicdouble[][][]getFoldK(){
returnfold_k;
}
publicDttRad2(intmaxN){// n - maximal
publicDttRad2(intmaxN){// n - maximal
setup_arrays(maxN);// always setup arrays for fast calculations
setup_arrays(maxN);// always setup arrays for fast calculations
}
}
...
@@ -78,21 +82,21 @@ public class DttRad2 {
...
@@ -78,21 +82,21 @@ public class DttRad2 {
for(inti=0;i<y.length;i++)y[i]*=scale;
for(inti=0;i<y.length;i++)y[i]*=scale;
returny;
returny;
}
}
publicdouble[]dst_iv(double[]x){
publicdouble[]dst_iv(double[]x){
double[]xr=newdouble[x.length];
double[]xr=newdouble[x.length];
intj=x.length-1;
intj=x.length-1;
for(inti=0;i<x.length;i++)xr[i]=x[j--];
for(inti=0;i<x.length;i++)xr[i]=x[j--];
double[]y=_dctiv_recurs(xr);
double[]y=_dctiv_recurs(xr);
doublescale=1.0/Math.sqrt(x.length);
doublescale=1.0/Math.sqrt(x.length);
for(inti=0;i<y.length;i++){
for(inti=0;i<y.length;i++){
y[i]*=scale;
y[i]*=scale;
scale=-scale;
scale=-scale;
}
}
returny;
returny;
}
}
// For index in dct-iv input (0..n-1) get 2 variants of index in mdct input array (0..2*n-1)
// 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
// second index : 0 - index in X array 2*n long
// 1 - window index (0..n-1), [0] - minimal, [n-1] - max
// 1 - window index (0..n-1), [0] - minimal, [n-1] - max
...
@@ -111,7 +115,7 @@ public class DttRad2 {
...
@@ -111,7 +115,7 @@ public class DttRad2 {
ind[0][3]=1;
ind[0][3]=1;
ind[0][4]=n1-x-1;
ind[0][4]=n1-x-1;
ind[0][5]=-1;// c - window derivative over shift is negative
ind[0][5]=-1;// c - window derivative over shift is negative
ind[1][0]=n+n1+x;// C: -d, S: -d
ind[1][0]=n+n1+x;// C: -d, S: -d
ind[1][1]=n1-x-1;
ind[1][1]=n1-x-1;
ind[1][2]=-1;
ind[1][2]=-1;
...
@@ -127,7 +131,7 @@ public class DttRad2 {
...
@@ -127,7 +131,7 @@ public class DttRad2 {
ind[0][3]=1;
ind[0][3]=1;
ind[0][4]=n-x-1;
ind[0][4]=n-x-1;
ind[0][5]=1;// a - window derivative over shift is positive
ind[0][5]=1;// a - window derivative over shift is positive