Sunflower v2.7.0版本的 MD5 值为:0696e8ce118febedd4bd019622cb23b1
以下内容为反编译后的 SSRC.java 源代码,内容仅作参考
package im.grnuohmoqd.ui.utils.translate.ssrc;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import im.grnuohmoqd.messenger.FileLog;
import io.reactivex.annotations.SchedulerSupport;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.util.Random;
import kotlin.UByte;
import kotlin.jvm.internal.ByteCompanionObject;
public class SSRC {
static final boolean $assertionsDisabled = false;
private static final int POOLSIZE = 97;
private static final int RANDBUFLEN = 65536;
private static final String VERSION = "1.30";
private double AA;
private double DF;
private int FFTFIRLEN;
private ByteOrder byteOrder;
private SplitRadixFft fft;
private long lastshowed;
private int lastshowed2;
private boolean quiet;
private double[] randbuf;
private int randptr;
private double[][] shapebuf;
private int shaper_clipmax;
private int shaper_clipmin;
private int shaper_len;
private int shaper_type;
private long starttime;
private static final int[] scoeffreq = {0, 48000, 44100, 37800, 32000, 22050, 48000, 44100};
private static final int[] scoeflen = {1, 16, 20, 16, 16, 15, 16, 15};
private static final int[] samp = {8, 18, 27, 8, 8, 8, 10, 9};
private static final double[][] shapercoefs = {new double[]{-1.0d}, new double[]{-2.87207293510437d, 5.041323184967041d, -6.244299411773682d, 5.848398685455322d, -3.706754207611084d, 1.0495119094848633d, 1.1830236911773682d, -2.1126792430877686d, 1.9094531536102295d, -0.9991308450698853d, 0.17090806365013123d, 0.32615602016448975d, -0.39127644896507263d, 0.2687646150588989d, -0.0976761057972908d, 0.023473845794796944d}, new double[]{-2.6773197650909424d, 4.830892562866211d, -6.570110321044922d, 7.4572014808654785d, -6.726327419281006d, 4.848165035247803d, -2.0412089824676514d, -0.7006359100341797d, 2.95375657081604d, -4.080038547515869d, 4.184521675109863d, -3.331181287765503d, 2.117992639541626d, -0.879302978515625d, 0.031759146600961685d, 0.4238278865814209d, -0.4788210391998291d, 0.35490813851356506d, -0.1749683916568756d, 0.06090816855430603d}, new double[]{-1.6335992813110352d, 2.261549234390259d, -2.407702922821045d, 2.634171724319458d, -2.144036293029785d, 1.8153258562088013d, -1.0816224813461304d, 0.703026533126831d, -0.15991993248462677d, -0.04154951870441437d, 0.2941657602787018d, -0.25183168053627014d, 0.27766478061676025d, -0.15785403549671173d, 0.10165894031524658d, -0.016833892092108727d}, new double[]{-0.8290129899978638d, 0.9892265796661377d, -0.5982571244239807d, 1.0028809309005737d, -0.5993821620941162d, 0.7950245141983032d, -0.42723315954208374d, 0.5449252724647522d, -0.3079260587692261d, 0.3687179982662201d, -0.187920480966568d, 0.2261127084493637d, -0.10573341697454453d, 0.11435490846633911d, -0.0388006791472435d, 0.040842197835445404d}, new double[]{-0.06522997468709946d, 0.5498126149177551d, 0.4027854800224304d, 0.3178376853466034d, 0.2820179760456085d, 0.16985194385051727d, 0.15433363616466522d, 0.12507140636444092d, 0.08903945237398148d, 0.06441012024879456d, 0.04714600369334221d, 0.03280523791909218d, 0.028495194390416145d, 0.011695005930960178d, 0.011831838637590408d}, new double[]{-2.3925774097442627d, 3.4350297451019287d, -3.185370922088623d, 1.8117271661758423d, 0.2012477070093155d, -1.4759907722473145d, 1.7210904359817505d, -0.9774670004844666d, 0.13790138065814972d, 0.38185903429985046d, -0.27421241998672485d, -0.06658421456813812d, 0.35223302245140076d, -0.37672343850135803d, 0.23964276909828186d, -0.06867482513189316d}, new double[]{-2.0833916664123535d, 3.0418450832366943d, -3.204789876937866d, 2.757192611694336d, -1.4978630542755127d, 0.34275946021080017d, 0.7173374891281128d, -1.073705792427063d, 1.0225815773010254d, -0.5664999485015869d, 0.20968692004680634d, 0.06537853181362152d, -0.10322438180446625d, 0.06744202226400375d, 0.00495197344571352d}};
private static final double[] presets = {0.7d, 0.9d, 0.18d};
private int RINT(double d) {
return (int) (d >= FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE ? d + 0.5d : d - 0.5d);
}
private void quit_shaper(int i) {
}
public int init_shaper(int i, int i2, int i3, int i4, int i5, int i6, double d) {
int[] iArr = new int[97];
int i7 = 1;
while (i7 < 6 && i != scoeffreq[i7]) {
i7++;
}
if ((i5 == 3 || i5 == 4) && i7 == 6) {
System.err.printf("Warning: ATH based noise shaping for destination frequency %dHz is not available, using triangular dither\n", Integer.valueOf(i));
}
if (i5 == 2 || i7 == 6) {
i7 = 0;
}
if (i5 == 4 && (i7 == 1 || i7 == 2)) {
i7 += 5;
}
this.shaper_type = i7;
this.shapebuf = new double[i2];
this.shaper_len = scoeflen[i7];
for (int i8 = 0; i8 < i2; i8++) {
this.shapebuf[i8] = new double[this.shaper_len];
}
this.shaper_clipmin = i3;
this.shaper_clipmax = i4;
this.randbuf = new double[65536];
Random random = new Random(System.currentTimeMillis());
for (int i9 = 0; i9 < 97; i9++) {
iArr[i9] = random.nextInt();
}
if (i6 == 0) {
for (int i10 = 0; i10 < 65536; i10++) {
int nextInt = random.nextInt() % 97;
int i11 = iArr[nextInt];
iArr[nextInt] = random.nextInt();
double[] dArr = this.randbuf;
double d2 = i11;
Double.isNaN(d2);
dArr[i10] = ((d2 / 2.147483647E9d) - 0.5d) * d;
}
} else if (i6 == 1) {
for (int i12 = 0; i12 < 65536; i12++) {
int nextInt2 = random.nextInt() % 97;
int i13 = iArr[nextInt2];
iArr[nextInt2] = random.nextInt();
int nextInt3 = random.nextInt() % 97;
int i14 = iArr[nextInt3];
iArr[nextInt3] = random.nextInt();
double[] dArr2 = this.randbuf;
double d3 = i13;
Double.isNaN(d3);
double d4 = i14;
Double.isNaN(d4);
dArr2[i12] = d * ((d3 / 2.147483647E9d) - (d4 / 2.147483647E9d));
}
} else if (i6 == 2) {
boolean z = false;
double d5 = FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
double d6 = FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
for (int i15 = 0; i15 < 65536; i15++) {
if (!z) {
int nextInt4 = random.nextInt() % 97;
double d7 = iArr[nextInt4];
Double.isNaN(d7);
double d8 = d7 / 2.147483647E9d;
iArr[nextInt4] = random.nextInt();
if (d8 == 1.0d) {
d8 = FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
}
d5 = Math.sqrt(Math.log(1.0d - d8) * (-2.0d));
int nextInt5 = random.nextInt() % 97;
double d9 = iArr[nextInt5];
Double.isNaN(d9);
iArr[nextInt5] = random.nextInt();
d6 = 6.283185307179586d * (d9 / 2.147483647E9d);
this.randbuf[i15] = d * d5 * Math.cos(d6);
z = true;
} else {
this.randbuf[i15] = d * d5 * Math.sin(d6);
z = false;
}
}
}
this.randptr = 0;
if (i5 == 0 || i5 == 1) {
return 1;
}
return samp[this.shaper_type];
}
public int do_shaping(double d, double[] dArr, int i, int i2) {
int i3;
double RINT;
if (i == 1) {
double[] dArr2 = this.randbuf;
int i4 = this.randptr;
this.randptr = i4 + 1;
double d2 = d + dArr2[i4 & 65535];
int i5 = this.shaper_clipmin;
if (d2 < i5) {
double d3 = i5;
Double.isNaN(d3);
double d4 = d2 / d3;
if (dArr[0] >= d4) {
d4 = dArr[0];
}
dArr[0] = d4;
d2 = this.shaper_clipmin;
}
int i6 = this.shaper_clipmax;
if (d2 > i6) {
double d5 = i6;
Double.isNaN(d5);
double d6 = d2 / d5;
if (dArr[0] >= d6) {
d6 = dArr[0];
}
dArr[0] = d6;
d2 = this.shaper_clipmax;
}
return RINT(d2);
}
double d7 = FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
int i7 = 0;
while (true) {
i3 = this.shaper_len;
if (i7 >= i3) {
break;
}
d7 += shapercoefs[this.shaper_type][i7] * this.shapebuf[i2][i7];
i7++;
}
double d8 = d + d7;
double[] dArr3 = this.randbuf;
int i8 = this.randptr;
this.randptr = i8 + 1;
double d9 = dArr3[65535 & i8] + d8;
for (int i9 = i3 - 2; i9 >= 0; i9--) {
double[][] dArr4 = this.shapebuf;
dArr4[i2][i9 + 1] = dArr4[i2][i9];
}
int i10 = this.shaper_clipmin;
if (d9 < i10) {
double d10 = i10;
Double.isNaN(d10);
double d11 = d9 / d10;
if (dArr[0] >= d11) {
d11 = dArr[0];
}
dArr[0] = d11;
RINT = this.shaper_clipmin;
double[][] dArr5 = this.shapebuf;
double[] dArr6 = dArr5[i2];
Double.isNaN(RINT);
dArr6[0] = RINT - d8;
if (dArr5[i2][0] > 1.0d) {
dArr5[i2][0] = 1.0d;
}
double[][] dArr7 = this.shapebuf;
if (dArr7[i2][0] < -1.0d) {
dArr7[i2][0] = -1.0d;
}
} else {
int i11 = this.shaper_clipmax;
if (d9 > i11) {
double d12 = i11;
Double.isNaN(d12);
double d13 = d9 / d12;
if (dArr[0] >= d13) {
d13 = dArr[0];
}
dArr[0] = d13;
RINT = this.shaper_clipmax;
double[][] dArr8 = this.shapebuf;
double[] dArr9 = dArr8[i2];
Double.isNaN(RINT);
dArr9[0] = RINT - d8;
if (dArr8[i2][0] > 1.0d) {
dArr8[i2][0] = 1.0d;
}
double[][] dArr10 = this.shapebuf;
if (dArr10[i2][0] < -1.0d) {
dArr10[i2][0] = -1.0d;
}
} else {
RINT = RINT(d9);
double[] dArr11 = this.shapebuf[i2];
Double.isNaN(RINT);
dArr11[0] = RINT - d8;
}
}
return (int) RINT;
}
private double alpha(double d) {
if (d <= 21.0d) {
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
}
if (d > 50.0d) {
return (d - 8.7d) * 0.1102d;
}
double d2 = d - 21.0d;
return (Math.pow(d2, 0.4d) * 0.5842d) + (d2 * 0.07886d);
}
private double win(double d, int i, double d2, double d3) {
double d4 = 4.0d * d * d;
double d5 = i;
Double.isNaN(d5);
double d6 = d5 - 1.0d;
return I0Bessel.value(d2 * Math.sqrt(1.0d - (d4 / (d6 * d6)))) / d3;
}
private double sinc(double d) {
if (d == FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
return 1.0d;
}
return Math.sin(d) / d;
}
private double hn_lpf(int i, double d, double d2) {
double d3 = 1.0d / d2;
double d4 = 6.283185307179586d * d;
double d5 = i;
Double.isNaN(d5);
return d * 2.0d * d3 * sinc(d5 * d4 * d3);
}
private void usage() {
System.err.printf("http://shibatch.sourceforge.net/\n\n", new Object[0]);
System.err.printf("usage: ssrc [<options>] <source wav file> <destination wav file>\n", new Object[0]);
System.err.printf("options : --rate <sampling rate> output sample rate\n", new Object[0]);
System.err.printf(" --att <attenuation(dB)> attenuate signal\n", new Object[0]);
System.err.printf(" --bits <number of bits> output quantization bit length\n", new Object[0]);
System.err.printf(" --tmpfile <file name> specify temporal file\n", new Object[0]);
System.err.printf(" --twopass two pass processing to avoid clipping\n", new Object[0]);
System.err.printf(" --normalize normalize the wave file\n", new Object[0]);
System.err.printf(" --quiet nothing displayed except error\n", new Object[0]);
System.err.printf(" --dither [<type>] dithering\n", new Object[0]);
System.err.printf(" 0 : no dither\n", new Object[0]);
System.err.printf(" 1 : no noise shaping\n", new Object[0]);
System.err.printf(" 2 : triangular spectral shape\n", new Object[0]);
System.err.printf(" 3 : ATH based noise shaping\n", new Object[0]);
System.err.printf(" 4 : less dither amplitude than type 3\n", new Object[0]);
System.err.printf(" --pdf <type> [<amp>] select p.d.f. of noise\n", new Object[0]);
System.err.printf(" 0 : rectangular\n", new Object[0]);
System.err.printf(" 1 : triangular\n", new Object[0]);
System.err.printf(" 2 : Gaussian\n", new Object[0]);
System.err.printf(" --profile <type> specify profile\n", new Object[0]);
System.err.printf(" standard : the default quality\n", new Object[0]);
System.err.printf(" fast : fast, not so bad quality\n", new Object[0]);
}
private void fmterr(int i) {
throw new IllegalStateException("unknown error " + i);
}
private void setstarttime() {
this.starttime = System.currentTimeMillis();
this.lastshowed = 0L;
this.lastshowed2 = -1;
}
private void showprogress(double d) {
int i;
if (this.quiet) {
return;
}
long currentTimeMillis = System.currentTimeMillis() - this.starttime;
if (d == FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
i = 0;
} else {
double d2 = currentTimeMillis;
Double.isNaN(d2);
i = (int) ((d2 * (1.0d - d)) / d);
}
int i2 = (int) (d * 100.0d);
if (i2 != this.lastshowed2 || currentTimeMillis != this.lastshowed) {
System.err.printf(" %3d%% processed", Integer.valueOf(i2));
this.lastshowed2 = i2;
}
if (currentTimeMillis != this.lastshowed) {
System.err.printf(", ETA =%4dmsec", Integer.valueOf(i));
this.lastshowed = currentTimeMillis;
}
System.err.printf("\r", new Object[0]);
System.err.flush();
}
private int gcd(int i, int i2) {
while (true) {
int i3 = i2;
int i4 = i;
i = i3;
if (i == 0) {
return i4;
}
i2 = i4 % i;
}
}
public double upsample(InputStream inputStream, OutputStream outputStream, int i, int i2, int i3, int i4, int i5, double d, int i6, boolean z, int i7) throws IOException {
int i8;
double d2;
double d3;
int i9;
double d4;
int i10;
int i11;
ByteBuffer byteBuffer;
int i12;
ByteBuffer byteBuffer2;
int i13;
int i14;
int i15;
int i16;
int i17;
double[] dArr;
double[] dArr2;
double d5;
ByteBuffer byteBuffer3;
int i18;
int i19;
int i20;
int RINT;
char c;
int i21;
ByteBuffer byteBuffer4;
int RINT2;
char c2;
int i22;
int i23;
int i24;
double[] dArr3;
double[] dArr4;
double d6;
int i25;
int i26;
int RINT3;
char c3;
double[] dArr5;
int i27;
int i28;
int i29;
int i30;
ByteBuffer byteBuffer5;
double d7;
int i31;
int i32;
int i33;
SSRC ssrc = this;
int i34 = i4;
double[] dArr6 = {FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE};
int i35 = ssrc.FFTFIRLEN;
double d8 = ssrc.AA;
int gcd = i34 / ssrc.gcd(i34, i5);
int i36 = gcd * i5;
int i37 = i36 / i5;
if (i37 == 1) {
i8 = 1;
} else if (i37 % 2 == 0) {
i8 = 2;
} else {
if (i37 % 3 != 0) {
throw new IllegalArgumentException(String.format("Resampling from %dHz to %dHz is not supported.\n%d/gcd(%d,%d)=%d must be divided by 2 or 3.\n", Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i4), Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i37)));
}
i8 = 3;
}
int i38 = i5 * i8;
int i39 = i34 / 2;
int i40 = (i38 / 2) - i39;
double d9 = i40 * 2;
Double.isNaN(d9);
double d10 = d9 / 2.0d;
double d11 = i39;
int i41 = i35;
double d12 = i40;
Double.isNaN(d12);
Double.isNaN(d11);
double d13 = d11 + (d12 / 2.0d);
if (d8 <= 21.0d) {
d3 = d11;
d2 = 0.9222d;
} else {
d2 = (d8 - 7.95d) / 14.36d;
d3 = d11;
}
double d14 = i36;
Double.isNaN(d14);
int i42 = (int) (((d14 / d10) * d2) + 1.0d);
if (i42 % 2 == 0) {
i42++;
}
int i43 = i42;
double alpha = ssrc.alpha(d8);
double value = I0Bessel.value(alpha);
int i44 = i36 / i34;
int i45 = (i43 / i44) + 1;
int i46 = i44 * i8;
int[] iArr = new int[i46];
for (int i47 = 0; i47 < i46; i47++) {
iArr[i47] = i44 - (((i36 / i38) * i47) % i44);
if (iArr[i47] == i44) {
iArr[i47] = 0;
}
}
int[] iArr2 = new int[i46];
int i48 = 0;
while (i48 < i46) {
int i49 = i46;
double[] dArr7 = dArr6;
iArr2[i48] = iArr[i48] < i36 / i38 ? i : 0;
if (iArr[i48] == i44) {
iArr[i48] = 0;
}
i48++;
i46 = i49;
dArr6 = dArr7;
}
int i50 = i46;
double[] dArr8 = dArr6;
double[][] dArr9 = (double[][]) Array.newInstance((Class<?>) double.class, i44, i45);
int i51 = i43 / 2;
int i52 = -i51;
while (i52 <= i51) {
int i53 = i52 + i51;
int[] iArr3 = iArr;
int i54 = i50;
int i55 = i52;
int[] iArr4 = iArr2;
double win = win(i52, i43, alpha, value) * hn_lpf(i55, d13, d14);
Double.isNaN(d14);
double d15 = i34;
Double.isNaN(d15);
dArr9[i53 % i44][i53 / i44] = (win * d14) / d15;
i52 = i55 + 1;
ssrc = this;
i38 = i38;
i45 = i45;
iArr2 = iArr4;
i43 = i43;
i51 = i51;
i36 = i36;
iArr = iArr3;
i50 = i54;
i41 = i41;
}
int[] iArr5 = iArr;
int i56 = i45;
int i57 = i36;
int i58 = i38;
int i59 = i51;
int[] iArr6 = iArr2;
SSRC ssrc2 = ssrc;
int i60 = i41;
int i61 = i50;
double d16 = ssrc2.AA;
double d17 = d16 > 21.0d ? (d16 - 7.95d) / 14.36d : 0.9222d;
int i62 = 1;
while (true) {
int i63 = i60 * i62;
if (i63 % 2 == 0) {
i63--;
}
i9 = i63;
d4 = i58;
Double.isNaN(d4);
double d18 = i9 - 1;
Double.isNaN(d18);
if ((d4 * d17) / d18 < ssrc2.DF) {
break;
}
i62 *= 2;
i34 = i4;
}
double alpha2 = ssrc2.alpha(d16);
double value2 = I0Bessel.value(alpha2);
int i64 = 1;
while (i64 < i9) {
i64 *= 2;
}
int i65 = i64 * 2;
double[] dArr10 = new double[i65];
int i66 = i9 / 2;
int i67 = -i66;
while (i67 <= i66) {
double d19 = d4;
double[] dArr11 = dArr10;
int i68 = i67;
double d20 = alpha2;
double d21 = alpha2;
SSRC ssrc3 = ssrc2;
int i69 = i65;
double win2 = win(i67, i9, d20, value2);
d4 = d19;
double hn_lpf = win2 * hn_lpf(i68, d3, d4);
double d22 = i69;
Double.isNaN(d22);
dArr11[i67 + i66] = (hn_lpf / d22) * 2.0d;
i67 = i68 + 1;
ssrc2 = ssrc3;
i65 = i69;
i66 = i66;
alpha2 = d21;
dArr10 = dArr11;
}
int i70 = i67;
double[] dArr12 = dArr10;
double d23 = d4;
SSRC ssrc4 = ssrc2;
int i71 = i65;
int[] iArr7 = new int[(int) (Math.sqrt(i71) + 2.0d)];
iArr7[0] = 0;
int i72 = i71 / 2;
double[] dArr13 = new double[i72];
ssrc4.fft.rdft(i71, 1, dArr12, iArr7, dArr13);
setstarttime();
int i73 = (i72 / i8) + 1;
int[] iArr8 = {r4, i73};
int i74 = i;
double[][] dArr14 = (double[][]) Array.newInstance((Class<?>) double.class, iArr8);
double[][] dArr15 = (double[][]) Array.newInstance((Class<?>) double.class, i74, i71);
int i75 = i74 * (i72 + i56);
int i76 = i2;
ByteBuffer allocate = ByteBuffer.allocate(i75 * i76);
int i77 = i73 * i74;
ByteBuffer allocate2 = ByteBuffer.allocate(i77 * i3);
double[] dArr16 = new double[i75];
double[] dArr17 = new double[i77];
int i78 = (i59 / i44) + 1;
double d24 = i9;
Double.isNaN(d24);
int i79 = i56;
double d25 = i58 / i5;
Double.isNaN(d25);
int i80 = (int) ((d24 / 2.0d) / d25);
int i81 = i78;
ByteBuffer byteBuffer6 = allocate;
int i82 = 0;
int i83 = 0;
int i84 = 0;
int i85 = 0;
int i86 = 0;
int i87 = 0;
boolean z2 = true;
int i88 = i6;
int i89 = 0;
while (true) {
double d26 = i72;
double[] dArr18 = dArr17;
double[] dArr19 = dArr16;
double d27 = i34;
Double.isNaN(d26);
Double.isNaN(d27);
Double.isNaN(d23);
double d28 = d27;
double floor = Math.floor((d26 * d27) / d23) + 1.0d;
double d29 = i79;
Double.isNaN(d29);
double d30 = floor + d29;
double d31 = i81;
Double.isNaN(d31);
int i90 = (int) (d30 - d31);
int i91 = i90 + i82 > i88 ? i88 - i82 : i90;
byteBuffer6.position(0);
int i92 = i76 * i74;
byteBuffer6.limit(Math.min(byteBuffer6.limit(), i91 * i92));
byte[] bArr = new byte[byteBuffer6.limit()];
int read = inputStream.read(bArr);
int i93 = i88;
int i94 = read < 0 ? 0 : read;
int i95 = i94 < byteBuffer6.limit() ? ((i94 / i76) * i74) + i82 : i93;
byteBuffer6.limit(i94);
ByteBuffer wrap = ByteBuffer.wrap(bArr);
wrap.position(i94);
wrap.flip();
int i96 = i94 / i92;
if (i76 != 1) {
if (i76 == 2) {
i11 = i71;
byteBuffer = allocate2;
i12 = 0;
while (i12 < i96 * i74) {
double d32 = wrap.order(ssrc4.byteOrder).asShortBuffer().get(i12);
Double.isNaN(d32);
dArr19[(i74 * i81) + i12] = d32 * 3.051850947599719E-5d;
i12++;
i72 = i72;
}
} else if (i76 == 3) {
byteBuffer = allocate2;
i12 = 0;
while (i12 < i96 * i74) {
int i97 = i12 * 3;
double d33 = (wrap.get(i97 + 1) << 8) | (wrap.get(i97) << 0) | (wrap.get(i97 + 2) << 16);
Double.isNaN(d33);
dArr19[(i74 * i81) + i12] = d33 * 1.1920930376163766E-7d;
i12++;
i71 = i71;
}
i11 = i71;
} else if (i76 != 4) {
i10 = i72;
i11 = i71;
byteBuffer = allocate2;
i12 = i70;
} else {
i12 = 0;
while (i12 < i96 * i74) {
ByteBuffer byteBuffer7 = allocate2;
double d34 = wrap.order(ssrc4.byteOrder).asIntBuffer().get(i12);
Double.isNaN(d34);
dArr19[(i74 * i81) + i12] = d34 * 4.656612875245797E-10d;
i12++;
allocate2 = byteBuffer7;
}
byteBuffer = allocate2;
i10 = i72;
i11 = i71;
}
i10 = i72;
} else {
i10 = i72;
i11 = i71;
byteBuffer = allocate2;
i12 = 0;
while (i12 < i96 * i74) {
double d35 = wrap.get(i12);
Double.isNaN(d35);
dArr19[(i74 * i81) + i12] = (d35 - 128.0d) * 0.007874015748031496d;
i12++;
}
}
while (i12 < i74 * i90) {
dArr19[(i74 * i81) + i12] = 0.0d;
i12++;
}
int i98 = i81 + i90;
i82 += i96;
boolean z3 = i82 >= i95;
int i99 = ((((i83 - 1) * i34) + i57) / i57) * i74;
int i100 = i84;
int i101 = i85;
int i102 = i86;
int i103 = 0;
while (i103 < i74) {
int i104 = i99 + i103;
if (i79 == 7) {
i31 = i10;
i32 = i99;
i33 = i61;
int i105 = i85;
for (int i106 = 0; i106 < i31; i106++) {
int i107 = iArr5[i105];
dArr15[i103][i106] = (dArr9[i107][0] * dArr19[i104 + (i74 * 0)]) + (dArr9[i107][1] * dArr19[i104 + (i74 * 1)]) + (dArr9[i107][2] * dArr19[i104 + (i74 * 2)]) + (dArr9[i107][3] * dArr19[i104 + (i74 * 3)]) + (dArr9[i107][4] * dArr19[i104 + (i74 * 4)]) + (dArr9[i107][5] * dArr19[i104 + (i74 * 5)]) + (dArr9[i107][6] * dArr19[i104 + (i74 * 6)]);
i104 += iArr6[i105];
i105++;
if (i105 == i33) {
i105 = 0;
}
}
i101 = i105;
} else if (i79 != 9) {
int i108 = i85;
i31 = i10;
int i109 = 0;
while (i109 < i31) {
int i110 = iArr5[i108];
int i111 = i99;
int i112 = i104;
double d36 = 0.0d;
for (int i113 = 0; i113 < i79; i113++) {
d36 += dArr9[i110][i113] * dArr19[i112];
i112 += i74;
}
dArr15[i103][i109] = d36;
i104 += iArr6[i108];
int i114 = i108 + 1;
int i115 = i61;
i108 = i114 == i115 ? 0 : i114;
i109++;
i61 = i115;
i99 = i111;
}
i32 = i99;
i101 = i108;
i33 = i61;
} else {
i31 = i10;
i32 = i99;
i33 = i61;
int i116 = i85;
for (int i117 = 0; i117 < i31; i117++) {
int i118 = iArr5[i116];
dArr15[i103][i117] = (dArr9[i118][0] * dArr19[i104 + (i74 * 0)]) + (dArr9[i118][1] * dArr19[i104 + (i74 * 1)]) + (dArr9[i118][2] * dArr19[i104 + (i74 * 2)]) + (dArr9[i118][3] * dArr19[i104 + (i74 * 3)]) + (dArr9[i118][4] * dArr19[i104 + (i74 * 4)]) + (dArr9[i118][5] * dArr19[i104 + (i74 * 5)]) + (dArr9[i118][6] * dArr19[i104 + (i74 * 6)]) + (dArr9[i118][7] * dArr19[i104 + (i74 * 7)]) + (dArr9[i118][8] * dArr19[i104 + (i74 * 8)]);
i104 += iArr6[i116];
i116++;
if (i116 == i33) {
i116 = 0;
}
}
i101 = i116;
}
int i119 = i11;
for (int i120 = i31; i120 < i119; i120++) {
dArr15[i103][i120] = 0.0d;
}
ssrc4.fft.rdft(i119, 1, dArr15[i103], iArr7, dArr13);
dArr15[i103][0] = dArr12[0] * dArr15[i103][0];
dArr15[i103][1] = dArr12[1] * dArr15[i103][1];
for (int i121 = 1; i121 < i31; i121++) {
int i122 = i121 * 2;
int i123 = i122 + 1;
double d37 = (dArr12[i122] * dArr15[i103][i122]) - (dArr12[i123] * dArr15[i103][i123]);
double d38 = (dArr12[i123] * dArr15[i103][i122]) + (dArr12[i122] * dArr15[i103][i123]);
dArr15[i103][i122] = d37;
dArr15[i103][i123] = d38;
}
ssrc4.fft.rdft(i119, -1, dArr15[i103], iArr7, dArr13);
int i124 = i86;
i100 = 0;
while (i124 < i31) {
dArr18[i103 + (i100 * i74)] = dArr14[i103][i100] + dArr15[i103][i124];
i124 += i8;
i100++;
}
int i125 = i124 - i31;
int i126 = 0;
while (i124 < i119) {
dArr14[i103][i126] = dArr15[i103][i124];
i124 += i8;
i126++;
}
i103++;
i61 = i33;
i11 = i119;
i12 = i124;
i99 = i32;
i10 = i31;
i102 = i125;
}
int i127 = i61;
int i128 = i11;
int i129 = i10;
int i130 = i83 + ((i129 * gcd) / i8);
byteBuffer.clear();
if (z) {
int i131 = 0;
while (i131 < i100 * i74) {
if (dArr18[i131] > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
byteBuffer5 = wrap;
d7 = dArr18[i131];
} else {
byteBuffer5 = wrap;
d7 = -dArr18[i131];
}
if (dArr8[0] >= d7) {
d7 = dArr8[0];
}
dArr8[0] = d7;
byteBuffer.asDoubleBuffer().put(i131, dArr18[i131]);
i131++;
wrap = byteBuffer5;
i79 = i79;
}
i13 = i79;
i14 = i127;
i70 = i131;
byteBuffer2 = wrap;
} else {
byteBuffer2 = wrap;
i13 = i79;
if (i3 == 1) {
i14 = i127;
i15 = i101;
i16 = i102;
i17 = i128;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
byteBuffer3 = byteBuffer;
i18 = i74;
i19 = i95;
double d39 = d * 127.0d;
i20 = 0;
int i132 = 0;
while (i20 < i100 * i18) {
if (i7 != 0) {
RINT = do_shaping(dArr2[i20] * d39, dArr8, i7, i132);
} else {
RINT = ssrc4.RINT(dArr2[i20] * d39);
if (RINT < -128) {
double d40 = RINT;
Double.isNaN(d40);
double d41 = d40 / (-128.0d);
c = 0;
if (dArr8[0] >= d41) {
d41 = dArr8[0];
}
dArr8[0] = d41;
RINT = -128;
} else {
c = 0;
}
if (127 < RINT) {
double d42 = RINT;
Double.isNaN(d42);
double d43 = d42 / 127.0d;
if (dArr8[c] >= d43) {
d43 = dArr8[c];
}
dArr8[c] = d43;
RINT = 127;
}
}
byteBuffer3.put(i20, (byte) (RINT + 128));
int i133 = i132 + 1;
i132 = i133 == i18 ? 0 : i133;
i20++;
}
} else if (i3 == 2) {
i14 = i127;
i15 = i101;
i16 = i102;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
i18 = i74;
i19 = i95;
ByteBuffer byteBuffer8 = byteBuffer;
double d44 = d * 32767.0d;
i20 = 0;
int i134 = 0;
while (i20 < i100 * i18) {
if (i7 != 0) {
i21 = i128;
byteBuffer4 = byteBuffer8;
RINT2 = do_shaping(dArr2[i20] * d44, dArr8, i7, i134);
} else {
i21 = i128;
byteBuffer4 = byteBuffer8;
RINT2 = ssrc4.RINT(dArr2[i20] * d44);
if (RINT2 < -32768) {
double d45 = RINT2;
Double.isNaN(d45);
double d46 = d45 / (-32768.0d);
c2 = 0;
if (dArr8[0] >= d46) {
d46 = dArr8[0];
}
dArr8[0] = d46;
RINT2 = -32768;
} else {
c2 = 0;
}
if (32767 < RINT2) {
double d47 = RINT2;
Double.isNaN(d47);
double d48 = d47 / 32767.0d;
if (dArr8[c2] >= d48) {
d48 = dArr8[c2];
}
dArr8[c2] = d48;
RINT2 = 32767;
}
}
byteBuffer4.order(ssrc4.byteOrder).asShortBuffer().put(i20, (short) RINT2);
int i135 = i134 + 1;
i134 = i135 == i18 ? 0 : i135;
i20++;
byteBuffer8 = byteBuffer4;
i128 = i21;
}
i17 = i128;
byteBuffer3 = byteBuffer8;
} else if (i3 != 3) {
i14 = i127;
i70 = i12;
} else {
double d49 = d * 8388607.0d;
int i136 = 0;
int i137 = 0;
while (i136 < i100 * i74) {
if (i7 != 0) {
i22 = i127;
dArr4 = dArr18;
d6 = d28;
dArr3 = dArr19;
i23 = i101;
i25 = i74;
i24 = i102;
i26 = i95;
RINT3 = do_shaping(dArr18[i136] * d49, dArr8, i7, i137);
} else {
i22 = i127;
i23 = i101;
i24 = i102;
dArr3 = dArr19;
dArr4 = dArr18;
d6 = d28;
i25 = i74;
i26 = i95;
RINT3 = ssrc4.RINT(dArr4[i136] * d49);
if (RINT3 < -8388608) {
double d50 = RINT3;
Double.isNaN(d50);
double d51 = d50 / (-8388608.0d);
c3 = 0;
if (dArr8[0] >= d51) {
d51 = dArr8[0];
}
dArr8[0] = d51;
RINT3 = -8388608;
} else {
c3 = 0;
}
if (8388607 < RINT3) {
double d52 = RINT3;
Double.isNaN(d52);
double d53 = d52 / 8388607.0d;
if (dArr8[c3] >= d53) {
d53 = dArr8[c3];
}
dArr8[c3] = d53;
RINT3 = 8388607;
}
}
int i138 = i136 * 3;
ByteBuffer byteBuffer9 = byteBuffer;
byteBuffer9.put(i138, (byte) (RINT3 & 255));
int i139 = RINT3 >> 8;
byteBuffer9.put(i138 + 1, (byte) (i139 & 255));
byteBuffer9.put(i138 + 2, (byte) ((i139 >> 8) & 255));
int i140 = i137 + 1;
i137 = i140 == i25 ? 0 : i140;
i136++;
byteBuffer = byteBuffer9;
i74 = i25;
i95 = i26;
dArr19 = dArr3;
i127 = i22;
i101 = i23;
i102 = i24;
d28 = d6;
dArr18 = dArr4;
}
i14 = i127;
i15 = i101;
i16 = i102;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
i18 = i74;
i19 = i95;
i70 = i136;
i17 = i128;
byteBuffer3 = byteBuffer;
if (z2) {
int i141 = i89;
dArr5 = dArr;
int i142 = i80;
if (i100 < i142) {
i80 = i142 - i100;
i29 = i141;
i27 = i19;
i28 = i98;
} else if (z3) {
double d54 = i82;
double d55 = i5;
Double.isNaN(d54);
Double.isNaN(d55);
Double.isNaN(d5);
double d56 = (d54 * d55) / d5;
i27 = i19;
i28 = i98;
if (d56 + 2.0d > (i141 + i100) - i142) {
int i143 = i3 * i18;
byteBuffer3.position(i143 * i142);
int i144 = i100 - i142;
byteBuffer3.limit(i143 * i144);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = i141 + i144;
i80 = i142;
} else {
int i145 = i3 * i18;
byteBuffer3.position(i145 * i142);
double d57 = i145;
double floor2 = Math.floor(d56) + 2.0d;
double d58 = i141;
Double.isNaN(d58);
double d59 = floor2 + d58;
double d60 = i100;
Double.isNaN(d60);
double d61 = i142;
Double.isNaN(d61);
Double.isNaN(d57);
byteBuffer3.limit((int) (d57 * ((d59 + d60) - d61)));
ssrc4.writeBuffers(outputStream, byteBuffer3);
break;
}
} else {
i27 = i19;
i28 = i98;
int i146 = i3 * i18;
byteBuffer3.position(i146 * i142);
byteBuffer3.limit(i146 * i100);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = (i100 - i142) + i141;
i80 = i142;
z2 = false;
int i147 = (i130 - 1) / i44;
int i148 = i28 - i147;
double[] dArr20 = dArr5;
System.arraycopy(dArr20, i18 * i147, dArr20, 0, i18 * i148);
i83 = i130 - (i147 * i44);
int i149 = i87 + 1;
if ((i87 & 7) != 7) {
double d62 = i82;
i89 = i29;
i30 = i149;
i88 = i27;
double d63 = i88;
Double.isNaN(d62);
Double.isNaN(d63);
ssrc4.showprogress(d62 / d63);
} else {
i89 = i29;
i30 = i149;
i88 = i27;
}
i34 = i4;
i81 = i148;
i87 = i30;
i74 = i18;
dArr16 = dArr20;
i72 = i129;
byteBuffer6 = byteBuffer2;
i79 = i13;
i85 = i15;
dArr17 = dArr2;
i86 = i16;
i71 = i17;
i84 = i100;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
} else {
if (z3) {
double d64 = i82;
double d65 = i5;
Double.isNaN(d64);
Double.isNaN(d65);
Double.isNaN(d5);
double d66 = (d64 * d65) / d5;
int i150 = i89 + i100;
dArr5 = dArr;
if (d66 + 2.0d > i150) {
byteBuffer3.position(0);
byteBuffer3.limit(i3 * i18 * i100);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = i150;
} else {
byteBuffer3.position(0);
double d67 = i3 * i18;
double floor3 = Math.floor(d66) + 2.0d;
double d68 = i89;
Double.isNaN(d68);
Double.isNaN(d67);
int i151 = (int) (d67 * (floor3 - d68));
if (i151 > 0) {
byteBuffer3.limit(i151);
ssrc4.writeBuffers(outputStream, byteBuffer3);
}
}
} else {
dArr5 = dArr;
byteBuffer3.position(0);
byteBuffer3.limit(i3 * i18 * i100);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = i89 + i100;
}
i27 = i19;
i28 = i98;
}
int i1472 = (i130 - 1) / i44;
int i1482 = i28 - i1472;
double[] dArr202 = dArr5;
System.arraycopy(dArr202, i18 * i1472, dArr202, 0, i18 * i1482);
i83 = i130 - (i1472 * i44);
int i1492 = i87 + 1;
if ((i87 & 7) != 7) {
}
i34 = i4;
i81 = i1482;
i87 = i30;
i74 = i18;
dArr16 = dArr202;
i72 = i129;
byteBuffer6 = byteBuffer2;
i79 = i13;
i85 = i15;
dArr17 = dArr2;
i86 = i16;
i71 = i17;
i84 = i100;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
i70 = i20;
if (z2) {
}
int i14722 = (i130 - 1) / i44;
int i14822 = i28 - i14722;
double[] dArr2022 = dArr5;
System.arraycopy(dArr2022, i18 * i14722, dArr2022, 0, i18 * i14822);
i83 = i130 - (i14722 * i44);
int i14922 = i87 + 1;
if ((i87 & 7) != 7) {
}
i34 = i4;
i81 = i14822;
i87 = i30;
i74 = i18;
dArr16 = dArr2022;
i72 = i129;
byteBuffer6 = byteBuffer2;
i79 = i13;
i85 = i15;
dArr17 = dArr2;
i86 = i16;
i71 = i17;
i84 = i100;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
i15 = i101;
i16 = i102;
i17 = i128;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
byteBuffer3 = byteBuffer;
i18 = i74;
i19 = i95;
if (z2) {
}
int i147222 = (i130 - 1) / i44;
int i148222 = i28 - i147222;
double[] dArr20222 = dArr5;
System.arraycopy(dArr20222, i18 * i147222, dArr20222, 0, i18 * i148222);
i83 = i130 - (i147222 * i44);
int i149222 = i87 + 1;
if ((i87 & 7) != 7) {
}
i34 = i4;
i81 = i148222;
i87 = i30;
i74 = i18;
dArr16 = dArr20222;
i72 = i129;
byteBuffer6 = byteBuffer2;
i79 = i13;
i85 = i15;
dArr17 = dArr2;
i86 = i16;
i71 = i17;
i84 = i100;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
ssrc4.showprogress(1.0d);
return dArr8[0];
}
public double downsample(InputStream inputStream, OutputStream outputStream, int i, int i2, int i3, int i4, int i5, double d, int i6, boolean z, int i7) throws IOException {
int i8;
int i9;
double d2;
double d3;
double d4;
int i10;
int[] iArr;
int i11;
double[] dArr;
int i12;
int i13;
int[] iArr2;
int i14;
double[][] dArr2;
int i15;
int i16;
int[] iArr3;
int i17;
SSRC ssrc;
int i18;
double[][] dArr3;
int i19;
ByteBuffer byteBuffer;
double d5;
int i20;
int i21;
ByteBuffer byteBuffer2;
int i22;
int i23;
int i24;
int i25;
int i26;
int i27;
double[] dArr4;
int i28;
double d6;
ByteBuffer byteBuffer3;
SSRC ssrc2;
ByteBuffer byteBuffer4;
int i29;
int i30;
int RINT;
char c;
int i31;
int i32;
ByteBuffer byteBuffer5;
int RINT2;
char c2;
int i33;
int i34;
int i35;
int i36;
int i37;
int i38;
double[] dArr5;
int i39;
double d7;
ByteBuffer byteBuffer6;
int i40;
int RINT3;
char c3;
double[] dArr6;
int i41;
int i42;
int i43;
int i44;
int i45;
int i46;
int i47;
int i48;
int i49;
int i50 = i5;
double[] dArr7 = {FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE};
int i51 = this.FFTFIRLEN;
double d8 = this.AA;
int gcd = gcd(i4, i50);
int i52 = i50 / gcd;
if (i52 == 1) {
i8 = 1;
} else if (i52 % 2 == 0) {
i8 = 2;
} else {
if (i52 % 3 != 0) {
throw new IllegalArgumentException(String.format("Resampling from %dHz to %dHz is not supported.\n%d/gcd(%d,%d)=%d must be divided by 2 or 3.", Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i5), Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i52)));
}
i8 = 3;
}
int i53 = i4 * i8;
double d9 = d8 <= 21.0d ? 0.9222d : (d8 - 7.95d) / 14.36d;
int i54 = 1;
while (true) {
int i55 = i51 * i54;
if (i55 % 2 == 0) {
i55--;
}
i9 = i55;
d2 = i53;
Double.isNaN(d2);
double d10 = i9 - 1;
Double.isNaN(d10);
double d11 = (d2 * d9) / d10;
d3 = i50;
Double.isNaN(d3);
d4 = (d3 - d11) / 2.0d;
i10 = i8;
if (d11 < this.DF) {
break;
}
i54 *= 2;
i50 = i5;
d8 = d8;
i8 = i10;
}
double alpha = alpha(d8);
double value = I0Bessel.value(alpha);
FileLog.e("须打log, 不打的话在某些机型上会卡住");
int i56 = 1;
while (i56 < i9) {
i56 *= 2;
}
int i57 = i56 * 2;
double[] dArr8 = new double[i57];
int i58 = i9 / 2;
int i59 = -i58;
while (i59 <= i58) {
int i60 = i59 + i58;
int i61 = i58;
int i62 = i59;
int i63 = i9;
double[] dArr9 = dArr8;
int i64 = i9;
int i65 = i57;
int i66 = i53;
int i67 = i10;
double win = win(i59, i63, alpha, value) * hn_lpf(i62, d4, d2);
Double.isNaN(d2);
double d12 = i4;
Double.isNaN(d12);
double d13 = (win * d2) / d12;
double d14 = i65;
Double.isNaN(d14);
dArr9[i60] = (d13 / d14) * 2.0d;
i59 = i62 + 1;
i10 = i67;
i57 = i65;
dArr7 = dArr7;
dArr8 = dArr9;
i58 = i61;
i9 = i64;
i53 = i66;
}
int i68 = i59;
double[] dArr10 = dArr8;
double[] dArr11 = dArr7;
int i69 = i53;
int i70 = i9;
int i71 = i57;
int i72 = i10;
int[] iArr4 = new int[(int) (Math.sqrt(i71) + 2.0d)];
iArr4[0] = 0;
int i73 = i71 / 2;
double[] dArr12 = new double[i73];
this.fft.rdft(i71, 1, dArr10, iArr4, dArr12);
if (i72 == 1) {
int i74 = (i4 / gcd) * i50;
int[] iArr5 = {i4 / i50};
double[][] dArr13 = (double[][]) Array.newInstance((Class<?>) double.class, 1, 1);
dArr13[0][0] = 1.0d;
dArr = dArr12;
iArr3 = new int[]{0};
iArr = iArr4;
i12 = i73;
i11 = i71;
i16 = 1;
i14 = 1;
dArr2 = dArr13;
iArr2 = iArr5;
i15 = i74;
i17 = i68;
i13 = 1;
} else {
double d15 = this.AA;
int i75 = (i4 / gcd) * i50;
int i76 = i4 / 2;
int i77 = (i69 / 2) - i76;
double[] dArr14 = dArr12;
iArr = iArr4;
int i78 = i73;
double d16 = i77 * 2;
Double.isNaN(d16);
double d17 = d16 / 2.0d;
double d18 = i76;
i11 = i71;
double d19 = i77;
Double.isNaN(d19);
Double.isNaN(d18);
double d20 = (d19 / 2.0d) + d18;
double d21 = d15 > 21.0d ? (d15 - 7.95d) / 14.36d : 0.9222d;
double d22 = i75;
Double.isNaN(d22);
int i79 = (int) (((d22 / d17) * d21) + 1.0d);
if (i79 % 2 == 0) {
i79++;
}
int i80 = i79;
double alpha2 = alpha(d15);
double value2 = I0Bessel.value(alpha2);
int i81 = i75 / i69;
int i82 = (i80 / i81) + 1;
int[] iArr6 = new int[i81];
for (int i83 = 0; i83 < i81; i83++) {
iArr6[i83] = i81 - (((i75 / i50) * i83) % i81);
if (iArr6[i83] == i81) {
iArr6[i83] = 0;
}
}
int[] iArr7 = new int[i81];
int i84 = 0;
while (i84 < i81) {
iArr7[i84] = (((i75 / i50) - iArr6[i84]) / i81) + 1;
int i85 = i84 + 1;
if (iArr6[i85 == i81 ? 0 : i85] == 0) {
iArr7[i84] = iArr7[i84] - 1;
}
i84 = i85;
}
double[][] dArr15 = (double[][]) Array.newInstance((Class<?>) double.class, i81, i82);
int i86 = i80 / 2;
int i87 = -i86;
while (i87 <= i86) {
int i88 = i87 + i86;
double[] dArr16 = dArr15[i88 % i81];
int i89 = i88 / i81;
int i90 = i87;
double d23 = d22;
int i91 = i78;
int i92 = i81;
double win2 = win(i87, i80, alpha2, value2) * hn_lpf(i90, d20, d23);
Double.isNaN(d23);
Double.isNaN(d2);
dArr16[i89] = (win2 * d23) / d2;
i87 = i90 + 1;
iArr7 = iArr7;
i86 = i86;
i75 = i75;
i81 = i92;
dArr14 = dArr14;
iArr6 = iArr6;
d22 = d23;
i78 = i91;
}
int i93 = i87;
int[] iArr8 = iArr6;
dArr = dArr14;
i12 = i78;
int i94 = i75;
int i95 = i81;
i13 = i80;
iArr2 = iArr7;
i14 = i82;
dArr2 = dArr15;
i15 = i94;
i16 = i95;
iArr3 = iArr8;
i17 = i93;
}
setstarttime();
double[][] dArr17 = (double[][]) Array.newInstance((Class<?>) double.class, i, i11);
int i96 = i14 + 1;
int i97 = i96 + i12;
int i98 = i17;
double[][] dArr18 = (double[][]) Array.newInstance((Class<?>) double.class, i, i97);
int i99 = ((i12 / i72) + i72 + 1) * i;
int i100 = i2;
ByteBuffer allocate = ByteBuffer.allocate(i99 * i100);
int i101 = i14;
double[][] dArr19 = dArr2;
double d24 = i12;
Double.isNaN(d24);
Double.isNaN(d3);
int i102 = i96;
int i103 = i16;
double d25 = i4;
Double.isNaN(d25);
double d26 = d25;
double d27 = ((d24 * d3) / d25) + 1.0d;
int i104 = i3 * i;
int[] iArr9 = iArr2;
double d28 = i104;
Double.isNaN(d28);
int[] iArr10 = iArr3;
int i105 = i12;
ByteBuffer allocate2 = ByteBuffer.allocate((int) (d27 * d28));
double[] dArr20 = new double[i99];
double d29 = d28;
double d30 = i;
Double.isNaN(d30);
double[] dArr21 = new double[(int) (d30 * d27)];
double d31 = i70;
Double.isNaN(d31);
Double.isNaN(d2);
Double.isNaN(d3);
double d32 = i13;
Double.isNaN(d32);
int i106 = i104;
double d33 = i15;
Double.isNaN(d33);
Double.isNaN(d3);
int i107 = (int) (((d31 / 2.0d) / (d2 / d3)) + ((d32 / 2.0d) / (d33 / d3)));
int i108 = i98;
ByteBuffer byteBuffer7 = allocate;
int i109 = 0;
int i110 = 0;
int i111 = 0;
int i112 = 0;
int i113 = 0;
boolean z2 = true;
int i114 = i6;
int i115 = 0;
while (true) {
int i116 = (((i105 + 0) - 1) / i72) + 1;
int i117 = i108;
if (i116 + i109 > i114) {
i116 = i114 - i109;
}
byteBuffer7.position(0);
int i118 = i100 * i;
int i119 = i114;
byteBuffer7.limit(i118 * i116);
byte[] bArr = new byte[byteBuffer7.limit()];
int i120 = i107;
int read = inputStream.read(bArr);
int i121 = i110;
int i122 = read < 0 ? 0 : read;
int i123 = i122 < byteBuffer7.limit() ? ((i122 / i100) * i) + i109 : i119;
byteBuffer7.limit(i122);
ByteBuffer wrap = ByteBuffer.wrap(bArr);
wrap.position(i122);
wrap.flip();
int i124 = i122 / i118;
if (i100 == 1) {
ssrc = this;
i18 = i111;
dArr3 = dArr18;
i19 = i15;
byteBuffer = allocate2;
d5 = d29;
i20 = i72;
i21 = 0;
while (i21 < i124 * i) {
double d34 = (wrap.get(i21) & UByte.MAX_VALUE) - 128;
Double.isNaN(d34);
dArr20[(i * 0) + i21] = d34 * 0.007874015748031496d;
i21++;
wrap = wrap;
}
} else if (i100 != 2) {
if (i100 == 3) {
ssrc = this;
i19 = i15;
byteBuffer = allocate2;
d5 = d29;
i21 = 0;
while (i21 < i124 * i) {
int i125 = i21 * 3;
int i126 = i111;
double d35 = ((wrap.get(i125 + 1) & UByte.MAX_VALUE) << 8) | ((wrap.get(i125) & UByte.MAX_VALUE) << 0) | ((wrap.get(i125 + 2) & UByte.MAX_VALUE) << 16);
Double.isNaN(d35);
dArr20[(i * 0) + i21] = d35 * 1.1920930376163766E-7d;
i21++;
i72 = i72;
i111 = i126;
}
i18 = i111;
i20 = i72;
byteBuffer2 = wrap;
} else if (i100 != 4) {
ssrc = this;
byteBuffer2 = wrap;
i18 = i111;
dArr3 = dArr18;
i19 = i15;
byteBuffer = allocate2;
d5 = d29;
i21 = i117;
i20 = i72;
while (i21 < i * i116) {
dArr20[i21] = 0.0d;
i21++;
}
int i127 = i109 + i124;
boolean z3 = inputStream.available() >= 0 || i127 >= i123;
int i128 = i113;
int i129 = i121;
i22 = 0;
while (i22 < i) {
int i130 = i105;
int i131 = 0;
int i132 = 0;
while (i131 < i130) {
dArr17[i22][i131] = dArr20[(i132 * i) + i22];
int i133 = i131 + 1;
while (true) {
i49 = i131 + i20;
if (i133 < i49) {
dArr17[i22][i133] = 0.0d;
i133++;
}
}
i132++;
i131 = i49;
}
int i134 = i11;
for (int i135 = i130; i135 < i134; i135++) {
dArr17[i22][i135] = 0.0d;
}
ssrc.fft.rdft(i134, 1, dArr17[i22], iArr, dArr);
dArr17[i22][0] = dArr10[0] * dArr17[i22][0];
dArr17[i22][1] = dArr10[1] * dArr17[i22][1];
for (int i136 = 1; i136 < i130; i136++) {
int i137 = i136 * 2;
int i138 = i137 + 1;
double d36 = (dArr10[i137] * dArr17[i22][i137]) - (dArr10[i138] * dArr17[i22][i138]);
double d37 = (dArr10[i138] * dArr17[i22][i137]) + (dArr10[i137] * dArr17[i22][i138]);
dArr17[i22][i137] = d36;
dArr17[i22][i138] = d37;
}
ssrc.fft.rdft(i134, -1, dArr17[i22], iArr, dArr);
int i139 = 0;
while (i139 < i130) {
double[] dArr22 = dArr3[i22];
int i140 = i102 + i139;
dArr22[i140] = dArr22[i140] + dArr17[i22][i139];
i139++;
}
int i141 = i19 / i69;
int i142 = i112 / i141;
if (i112 % i141 != 0) {
i142++;
}
int length = (dArr3[0].length * i22) + i142;
int i143 = i139;
int i144 = i121;
int i145 = 0;
for (char c4 = 0; length - (dArr3[c4].length * i22) < i130 + 1; c4 = 0) {
int i146 = iArr10[i144];
int i147 = iArr9[i144] + length;
i144++;
int i148 = i134;
int i149 = i103;
if (i144 == i149) {
i144 = 0;
}
i103 = i149;
double d38 = 0.0d;
int i150 = i101;
int i151 = 0;
while (i151 < i150) {
d38 += dArr19[i146][i151] * dArr3[length / dArr3[0].length][length % dArr3[0].length];
length++;
i151++;
i146 = i146;
i144 = i144;
}
dArr21[0 + (i145 * i) + i22] = d38;
i145++;
i143 = i151;
i101 = i150;
length = i147;
i134 = i148;
}
i11 = i134;
i22++;
ssrc = this;
i129 = i144;
i105 = i130;
i128 = i145;
i21 = i143;
}
int i152 = i101;
int i153 = i105;
int i154 = i112 + ((i19 / i5) * i128);
byteBuffer.clear();
if (z) {
i21 = 0;
while (i21 < i128 * i) {
double d39 = dArr21[i21] > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE ? dArr21[i21] : -dArr21[i21];
if (dArr11[0] >= d39) {
d39 = dArr11[0];
}
dArr11[0] = d39;
byteBuffer.asDoubleBuffer().put(i21, dArr21[i21]);
i21++;
}
} else {
if (i3 == 1) {
i23 = i106;
i24 = i153;
i25 = i152;
i26 = i129;
i27 = i20;
dArr4 = dArr20;
i28 = i103;
d6 = d26;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i155 = i102;
byteBuffer4 = byteBuffer2;
i29 = i155;
double d40 = d * 127.0d;
i30 = 0;
int i156 = 0;
while (i30 < i128 * i) {
if (i7 != 0) {
RINT = do_shaping(dArr21[i30] * d40, dArr11, i7, i156);
} else {
RINT = ssrc2.RINT(dArr21[i30] * d40);
if (RINT < -128) {
double d41 = RINT;
Double.isNaN(d41);
double d42 = d41 / (-128.0d);
c = 0;
if (dArr11[0] >= d42) {
d42 = dArr11[0];
}
dArr11[0] = d42;
RINT = -128;
} else {
c = 0;
}
if (127 < RINT) {
double d43 = RINT;
Double.isNaN(d43);
double d44 = d43 / 127.0d;
if (dArr11[c] >= d44) {
d44 = dArr11[c];
}
dArr11[c] = d44;
RINT = 127;
}
}
byteBuffer3.put(i30, (byte) (RINT + 128));
int i157 = i156 + 1;
i156 = i157 == i ? 0 : i157;
i30++;
}
} else if (i3 == 2) {
i23 = i106;
i24 = i153;
i25 = i152;
i26 = i129;
i27 = i20;
dArr4 = dArr20;
i28 = i103;
d6 = d26;
ByteBuffer byteBuffer8 = byteBuffer;
ssrc2 = this;
int i158 = i102;
byteBuffer4 = byteBuffer2;
i29 = i158;
double d45 = d * 32767.0d;
int i159 = 0;
int i160 = 0;
while (i159 < i128 * i) {
if (i7 != 0) {
i32 = i159;
byteBuffer5 = byteBuffer8;
RINT2 = do_shaping(dArr21[i159] * d45, dArr11, i7, i160);
} else {
i32 = i159;
byteBuffer5 = byteBuffer8;
RINT2 = ssrc2.RINT(dArr21[i32] * d45);
if (RINT2 < -32768) {
double d46 = RINT2;
Double.isNaN(d46);
double d47 = d46 / (-32768.0d);
c2 = 0;
if (dArr11[0] >= d47) {
d47 = dArr11[0];
}
dArr11[0] = d47;
RINT2 = -32768;
} else {
c2 = 0;
}
if (32767 < RINT2) {
double d48 = RINT2;
Double.isNaN(d48);
double d49 = d48 / 32767.0d;
if (dArr11[c2] >= d49) {
d49 = dArr11[c2];
}
dArr11[c2] = d49;
RINT2 = 32767;
}
}
byteBuffer5.order(ssrc2.byteOrder).asShortBuffer().put(i32, (short) RINT2);
int i161 = i160 + 1;
i160 = i161 == i ? 0 : i161;
i159 = i32 + 1;
byteBuffer8 = byteBuffer5;
}
i30 = i159;
byteBuffer3 = byteBuffer8;
} else if (i3 == 3) {
double d50 = d * 8388607.0d;
int i162 = 0;
int i163 = 0;
while (i162 < i128 * i) {
if (i7 != 0) {
i34 = i162;
i37 = i129;
i38 = i20;
dArr5 = dArr20;
d7 = d26;
int i164 = i102;
byteBuffer6 = byteBuffer2;
i40 = i164;
i33 = i106;
i35 = i153;
i39 = i103;
i36 = i152;
RINT3 = do_shaping(dArr21[i162] * d50, dArr11, i7, i163);
} else {
i33 = i106;
i34 = i162;
i35 = i153;
i36 = i152;
i37 = i129;
i38 = i20;
dArr5 = dArr20;
i39 = i103;
d7 = d26;
int i165 = i102;
byteBuffer6 = byteBuffer2;
i40 = i165;
RINT3 = RINT(dArr21[i34] * d50);
if (RINT3 < -8388608) {
double d51 = RINT3;
Double.isNaN(d51);
double d52 = d51 / (-8388608.0d);
c3 = 0;
if (dArr11[0] >= d52) {
d52 = dArr11[0];
}
dArr11[0] = d52;
RINT3 = -8388608;
} else {
c3 = 0;
}
if (8388607 < RINT3) {
double d53 = RINT3;
Double.isNaN(d53);
double d54 = d53 / 8388607.0d;
if (dArr11[c3] >= d54) {
d54 = dArr11[c3];
}
dArr11[c3] = d54;
RINT3 = 8388607;
}
}
int i166 = i34 * 3;
ByteBuffer byteBuffer9 = byteBuffer;
byteBuffer9.put(i166, (byte) (RINT3 & 255));
int i167 = RINT3 >> 8;
byteBuffer9.put(i166 + 1, (byte) (i167 & 255));
byteBuffer9.put(i166 + 2, (byte) ((i167 >> 8) & 255));
int i168 = i163 + 1;
i163 = i168 == i ? 0 : i168;
i162 = i34 + 1;
byteBuffer = byteBuffer9;
i129 = i37;
d26 = d7;
dArr20 = dArr5;
i20 = i38;
i106 = i33;
i103 = i39;
i152 = i36;
i153 = i35;
ByteBuffer byteBuffer10 = byteBuffer6;
i102 = i40;
byteBuffer2 = byteBuffer10;
}
i23 = i106;
i24 = i153;
i25 = i152;
i26 = i129;
i27 = i20;
dArr4 = dArr20;
i28 = i103;
d6 = d26;
ssrc2 = this;
int i169 = i102;
byteBuffer4 = byteBuffer2;
i29 = i169;
i31 = i162;
byteBuffer3 = byteBuffer;
if (z2) {
dArr6 = dArr21;
i41 = i123;
i42 = i18;
if (i128 < i120) {
i107 = i120 - i128;
} else if (z3) {
double d55 = i127;
Double.isNaN(d55);
Double.isNaN(d3);
Double.isNaN(d6);
double d56 = (d55 * d3) / d6;
if (d56 + 2.0d > (i42 + i128) - i120) {
byteBuffer3.position(i23 * i120);
int i170 = i128 - i120;
byteBuffer3.limit(i23 * i170);
ssrc2.writeBuffers(outputStream, byteBuffer3);
i42 += i170;
i107 = i120;
} else {
byteBuffer3.position(i23 * i120);
double floor = Math.floor(d56) + 2.0d;
double d57 = i42;
Double.isNaN(d57);
double d58 = floor + d57;
double d59 = i128;
Double.isNaN(d59);
double d60 = i120;
Double.isNaN(d60);
Double.isNaN(d5);
byteBuffer3.limit((int) (d5 * ((d58 + d59) - d60)));
ssrc2.writeBuffers(outputStream, byteBuffer3);
break;
}
} else {
byteBuffer3.position(i23 * i120);
byteBuffer3.limit(i23 * i128);
ssrc2.writeBuffers(outputStream, byteBuffer3);
i42 += i128 - i120;
i107 = i120;
z2 = false;
}
} else {
if (z3) {
double d61 = i127;
Double.isNaN(d61);
Double.isNaN(d3);
Double.isNaN(d6);
double d62 = (d61 * d3) / d6;
i48 = i18 + i128;
dArr6 = dArr21;
i41 = i123;
if (d62 + 2.0d > i48) {
byteBuffer3.position(0);
byteBuffer3.limit(i23 * i128);
ssrc2.writeBuffers(outputStream, byteBuffer3);
} else {
byteBuffer3.position(0);
double floor2 = Math.floor(d62) + 2.0d;
double d63 = i18;
Double.isNaN(d63);
Double.isNaN(d5);
int i171 = (int) (d5 * (floor2 - d63));
if (i171 > 0) {
byteBuffer3.limit(i171);
ssrc2.writeBuffers(outputStream, byteBuffer3);
}
}
} else {
dArr6 = dArr21;
i41 = i123;
byteBuffer3.position(0);
byteBuffer3.limit(i23 * i128);
ssrc2.writeBuffers(outputStream, byteBuffer3);
i48 = i18 + i128;
}
i42 = i48;
i107 = i120;
}
int i172 = i19 / i69;
i43 = (i154 - 1) / i172;
i44 = i24;
if (i43 > i44) {
i43 = i44;
}
i45 = 0;
while (i45 < i) {
System.arraycopy(dArr3[i45], i43, dArr3[i45], 0, i97 - i43);
i45++;
i31 = i31;
i42 = i42;
}
int i173 = i31;
int i174 = i42;
i112 = i154 - (i43 * i172);
for (i46 = 0; i46 < i; i46++) {
System.arraycopy(dArr17[i46], i44, dArr3[i46], i29, i44);
}
int i175 = i115 + 1;
if ((i115 & 7) == 7) {
double d64 = i127;
i47 = i41;
double d65 = i47;
Double.isNaN(d64);
Double.isNaN(d65);
ssrc2.showprogress(d64 / d65);
} else {
i47 = i41;
}
i108 = i173;
i114 = i47;
i115 = i175;
i109 = i127;
i105 = i44;
dArr21 = dArr6;
allocate2 = byteBuffer3;
i111 = i174;
i110 = i26;
byteBuffer7 = byteBuffer4;
d26 = d6;
dArr20 = dArr4;
i72 = i27;
i106 = i23;
i103 = i28;
i101 = i25;
d29 = d5;
dArr18 = dArr3;
i113 = i128;
i102 = i29;
i15 = i19;
i100 = i2;
}
i31 = i30;
if (z2) {
}
int i1722 = i19 / i69;
i43 = (i154 - 1) / i1722;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i1732 = i31;
int i1742 = i42;
i112 = i154 - (i43 * i1722);
while (i46 < i) {
}
int i1752 = i115 + 1;
if ((i115 & 7) == 7) {
}
i108 = i1732;
i114 = i47;
i115 = i1752;
i109 = i127;
i105 = i44;
dArr21 = dArr6;
allocate2 = byteBuffer3;
i111 = i1742;
i110 = i26;
byteBuffer7 = byteBuffer4;
d26 = d6;
dArr20 = dArr4;
i72 = i27;
i106 = i23;
i103 = i28;
i101 = i25;
d29 = d5;
dArr18 = dArr3;
i113 = i128;
i102 = i29;
i15 = i19;
i100 = i2;
}
i23 = i106;
i31 = i21;
i24 = i153;
i25 = i152;
i26 = i129;
i27 = i20;
dArr4 = dArr20;
i28 = i103;
d6 = d26;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i176 = i102;
byteBuffer4 = byteBuffer2;
i29 = i176;
if (z2) {
}
int i17222 = i19 / i69;
i43 = (i154 - 1) / i17222;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i17322 = i31;
int i17422 = i42;
i112 = i154 - (i43 * i17222);
while (i46 < i) {
}
int i17522 = i115 + 1;
if ((i115 & 7) == 7) {
}
i108 = i17322;
i114 = i47;
i115 = i17522;
i109 = i127;
i105 = i44;
dArr21 = dArr6;
allocate2 = byteBuffer3;
i111 = i17422;
i110 = i26;
byteBuffer7 = byteBuffer4;
d26 = d6;
dArr20 = dArr4;
i72 = i27;
i106 = i23;
i103 = i28;
i101 = i25;
d29 = d5;
dArr18 = dArr3;
i113 = i128;
i102 = i29;
i15 = i19;
i100 = i2;
} else {
i21 = 0;
while (i21 < i124 * i) {
int i177 = i15;
double d66 = wrap.order(this.byteOrder).getInt(i21);
Double.isNaN(d66);
dArr20[(i * 0) + i21] = d66 * 4.656612875245797E-10d;
i21++;
d29 = d29;
i15 = i177;
allocate2 = allocate2;
}
ssrc = this;
i19 = i15;
byteBuffer = allocate2;
d5 = d29;
byteBuffer2 = wrap;
i18 = i111;
i20 = i72;
}
dArr3 = dArr18;
while (i21 < i * i116) {
}
int i1272 = i109 + i124;
if (inputStream.available() >= 0) {
}
int i1282 = i113;
int i1292 = i121;
i22 = 0;
while (i22 < i) {
}
int i1522 = i101;
int i1532 = i105;
int i1542 = i112 + ((i19 / i5) * i1282);
byteBuffer.clear();
if (z) {
}
i23 = i106;
i31 = i21;
i24 = i1532;
i25 = i1522;
i26 = i1292;
i27 = i20;
dArr4 = dArr20;
i28 = i103;
d6 = d26;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i1762 = i102;
byteBuffer4 = byteBuffer2;
i29 = i1762;
if (z2) {
}
int i172222 = i19 / i69;
i43 = (i1542 - 1) / i172222;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i173222 = i31;
int i174222 = i42;
i112 = i1542 - (i43 * i172222);
while (i46 < i) {
}
int i175222 = i115 + 1;
if ((i115 & 7) == 7) {
}
i108 = i173222;
i114 = i47;
i115 = i175222;
i109 = i1272;
i105 = i44;
dArr21 = dArr6;
allocate2 = byteBuffer3;
i111 = i174222;
i110 = i26;
byteBuffer7 = byteBuffer4;
d26 = d6;
dArr20 = dArr4;
i72 = i27;
i106 = i23;
i103 = i28;
i101 = i25;
d29 = d5;
dArr18 = dArr3;
i113 = i1282;
i102 = i29;
i15 = i19;
i100 = i2;
} else {
ssrc = this;
i18 = i111;
i19 = i15;
byteBuffer = allocate2;
d5 = d29;
i20 = i72;
i21 = 0;
while (i21 < i124 * i) {
double[][] dArr23 = dArr18;
double d67 = wrap.order(ssrc.byteOrder).asShortBuffer().get(i21);
Double.isNaN(d67);
dArr20[(i * 0) + i21] = d67 * 3.051850947599719E-5d;
i21++;
dArr18 = dArr23;
}
dArr3 = dArr18;
}
byteBuffer2 = wrap;
while (i21 < i * i116) {
}
int i12722 = i109 + i124;
if (inputStream.available() >= 0) {
}
int i12822 = i113;
int i12922 = i121;
i22 = 0;
while (i22 < i) {
}
int i15222 = i101;
int i15322 = i105;
int i15422 = i112 + ((i19 / i5) * i12822);
byteBuffer.clear();
if (z) {
}
i23 = i106;
i31 = i21;
i24 = i15322;
i25 = i15222;
i26 = i12922;
i27 = i20;
dArr4 = dArr20;
i28 = i103;
d6 = d26;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i17622 = i102;
byteBuffer4 = byteBuffer2;
i29 = i17622;
if (z2) {
}
int i1722222 = i19 / i69;
i43 = (i15422 - 1) / i1722222;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i1732222 = i31;
int i1742222 = i42;
i112 = i15422 - (i43 * i1722222);
while (i46 < i) {
}
int i1752222 = i115 + 1;
if ((i115 & 7) == 7) {
}
i108 = i1732222;
i114 = i47;
i115 = i1752222;
i109 = i12722;
i105 = i44;
dArr21 = dArr6;
allocate2 = byteBuffer3;
i111 = i1742222;
i110 = i26;
byteBuffer7 = byteBuffer4;
d26 = d6;
dArr20 = dArr4;
i72 = i27;
i106 = i23;
i103 = i28;
i101 = i25;
d29 = d5;
dArr18 = dArr3;
i113 = i12822;
i102 = i29;
i15 = i19;
i100 = i2;
}
ssrc2.showprogress(1.0d);
return dArr11[0];
}
public double no_src(InputStream inputStream, OutputStream outputStream, int i, int i2, int i3, double d, int i4, boolean z, int i5) throws IOException {
double[] dArr;
int i6;
double d2;
ByteBuffer byteBuffer;
double d3;
double d4;
ByteBuffer byteBuffer2;
int i7;
ByteBuffer byteBuffer3;
int i8;
int i9;
int RINT;
double d5;
int i10 = 1;
int i11 = 0;
double[] dArr2 = {FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE};
setstarttime();
ByteBuffer allocate = z ? ByteBuffer.allocate(8) : null;
int i12 = 4;
ByteBuffer allocate2 = ByteBuffer.allocate(4);
int i13 = 0;
int i14 = 0;
while (true) {
int i15 = i4 * i;
if (i13 >= i15) {
dArr = dArr2;
break;
}
if (i2 == i10) {
i6 = i13;
dArr = dArr2;
allocate2.position(0);
allocate2.limit(1);
byte[] bArr = new byte[allocate2.limit()];
inputStream.read(bArr);
ByteBuffer wrap = ByteBuffer.wrap(bArr);
wrap.position(wrap.limit());
wrap.flip();
d2 = 0.007874015748031496d;
byteBuffer = wrap;
d3 = wrap.get(0) + ByteCompanionObject.MIN_VALUE;
Double.isNaN(d3);
} else if (i2 == 2) {
i6 = i13;
dArr = dArr2;
allocate2.position(0);
allocate2.limit(2);
byte[] bArr2 = new byte[allocate2.limit()];
inputStream.read(bArr2);
ByteBuffer wrap2 = ByteBuffer.wrap(bArr2);
wrap2.position(wrap2.limit());
wrap2.flip();
d2 = 3.051850947599719E-5d;
byteBuffer = wrap2;
d3 = wrap2.order(this.byteOrder).asShortBuffer().get(0);
Double.isNaN(d3);
} else {
if (i2 == 3) {
dArr = dArr2;
allocate2.position(i11);
allocate2.limit(3);
byte[] bArr3 = new byte[allocate2.limit()];
inputStream.read(bArr3);
ByteBuffer wrap3 = ByteBuffer.wrap(bArr3);
wrap3.position(wrap3.limit());
wrap3.flip();
int i16 = ((wrap3.get(i11) & UByte.MAX_VALUE) << i11) | ((wrap3.get(1) & UByte.MAX_VALUE) << 8) | ((wrap3.get(2) & UByte.MAX_VALUE) << 16);
byteBuffer2 = wrap3;
i6 = i13;
double d6 = i16;
Double.isNaN(d6);
d5 = 1.1920930376163766E-7d * d6;
} else if (i2 == i12) {
allocate2.position(i11);
allocate2.limit(i12);
byte[] bArr4 = new byte[allocate2.limit()];
inputStream.read(bArr4);
ByteBuffer wrap4 = ByteBuffer.wrap(bArr4);
wrap4.position(wrap4.limit());
wrap4.flip();
dArr = dArr2;
double d7 = wrap4.order(this.byteOrder).asIntBuffer().get(i11);
Double.isNaN(d7);
d5 = d7 * 4.656612875245797E-10d;
byteBuffer2 = wrap4;
i6 = i13;
} else {
byteBuffer2 = allocate2;
i6 = i13;
dArr = dArr2;
d4 = FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
if (inputStream.available() == 0) {
break;
}
double d8 = d4 * d;
if (z) {
i7 = i15;
byteBuffer3 = allocate;
i8 = i6;
double d9 = d8 > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE ? d8 : -d8;
if (dArr[0] >= d9) {
d9 = dArr[0];
}
dArr[0] = d9;
byteBuffer3.position(0);
byteBuffer3.putDouble(d8);
byteBuffer3.flip();
writeBuffers(outputStream, byteBuffer3);
} else if (i3 == 1) {
i7 = i15;
byteBuffer3 = allocate;
i8 = i6;
double d10 = d8 * 127.0d;
int do_shaping = i5 != 0 ? do_shaping(d10, dArr, i5, i14) : RINT(d10);
byteBuffer2.position(0);
byteBuffer2.limit(1);
byteBuffer2.put(0, (byte) (do_shaping + 128));
byteBuffer2.flip();
writeBuffers(outputStream, byteBuffer2);
} else if (i3 == 2) {
i7 = i15;
byteBuffer3 = allocate;
i8 = i6;
double d11 = d8 * 32767.0d;
int do_shaping2 = i5 != 0 ? do_shaping(d11, dArr, i5, i14) : RINT(d11);
byteBuffer2.position(0);
byteBuffer2.limit(2);
byteBuffer2.asShortBuffer().put(0, (short) do_shaping2);
byteBuffer2.flip();
writeBuffers(outputStream, byteBuffer2);
} else if (i3 != 3) {
i7 = i15;
byteBuffer3 = allocate;
i8 = i6;
} else {
double d12 = d8 * 8388607.0d;
if (i5 != 0) {
i8 = i6;
byteBuffer3 = allocate;
i7 = i15;
i9 = 0;
RINT = do_shaping(d12, dArr, i5, i14);
} else {
i7 = i15;
byteBuffer3 = allocate;
i8 = i6;
i9 = 0;
RINT = RINT(d12);
}
byteBuffer2.position(i9);
byteBuffer2.limit(3);
byteBuffer2.put(i9, (byte) (RINT & 255));
int i17 = RINT >> 8;
byteBuffer2.put(1, (byte) (i17 & 255));
byteBuffer2.put(2, (byte) ((i17 >> 8) & 255));
byteBuffer2.flip();
writeBuffers(outputStream, byteBuffer2);
}
int i18 = i14 + 1;
i14 = i18 == i ? 0 : i18;
i13 = i8 + 1;
if ((262143 & i13) == 0) {
double d13 = i13;
double d14 = i7;
Double.isNaN(d13);
Double.isNaN(d14);
showprogress(d13 / d14);
}
allocate = byteBuffer3;
allocate2 = byteBuffer2;
dArr2 = dArr;
i12 = 4;
i11 = 0;
i10 = 1;
}
d4 = d5;
if (inputStream.available() == 0) {
}
}
d4 = d3 * d2;
byteBuffer2 = byteBuffer;
if (inputStream.available() == 0) {
}
}
showprogress(1.0d);
return dArr[0];
}
public static void main(String[] strArr) throws Exception {
new SSRC(strArr);
}
public SSRC() {
this.byteOrder = ByteOrder.LITTLE_ENDIAN;
this.fft = new SplitRadixFft();
this.AA = 170.0d;
this.DF = 100.0d;
this.FFTFIRLEN = 65536;
this.quiet = false;
}
SSRC(String[] strArr) throws IOException {
int i;
double d;
String str;
int i2;
int i3;
String str2;
int i4;
int i5;
int i6;
FileOutputStream fileOutputStream;
String str3;
String str4;
int i7;
int i8;
int i9;
String str5;
double d2;
FileOutputStream fileOutputStream2;
SSRC ssrc;
String str6;
int i10;
String str7;
SSRC ssrc2;
File createTempFile;
FileOutputStream fileOutputStream3;
File file;
int i11;
int i12;
String str8;
double d3;
double d4;
int i13;
double d5;
int i14;
int i15;
int i16;
int i17;
int length;
File file2;
int i18;
char c;
int i19;
ByteBuffer byteBuffer;
FileOutputStream fileOutputStream4;
int RINT;
ByteBuffer byteBuffer2;
FileOutputStream fileOutputStream5;
int RINT2;
FileOutputStream fileOutputStream6;
int RINT3;
double d6;
double d7;
int i20;
char c2;
double d8;
int i21;
int i22;
int i23;
int i24;
int i25;
int i26;
int i27;
SSRC ssrc3 = this;
ssrc3.byteOrder = ByteOrder.LITTLE_ENDIAN;
ssrc3.fft = new SplitRadixFft();
ssrc3.AA = 170.0d;
ssrc3.DF = 100.0d;
ssrc3.FFTFIRLEN = 65536;
int i28 = 0;
ssrc3.quiet = false;
double d9 = FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
double[] dArr = {FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE};
String str9 = null;
double d10 = 0.18d;
double d11 = 0.0d;
int i29 = 0;
int i30 = -1;
int i31 = -1;
int i32 = 0;
int i33 = 0;
boolean z = false;
boolean z2 = false;
while (i29 < strArr.length && strArr[i29].charAt(i28) == '-') {
if (strArr[i29].equals("--rate")) {
i29++;
i30 = i30;
i31 = Integer.parseInt(strArr[i29]);
} else if (strArr[i29].equals("--att")) {
i29++;
d11 = Float.parseFloat(strArr[i29]);
i30 = i30;
i31 = i31;
} else if (strArr[i29].equals("--bits")) {
i29++;
int parseInt = Integer.parseInt(strArr[i29]);
if (parseInt != 8 && parseInt != 16 && parseInt != 24) {
throw new IllegalArgumentException("Error: Only 8bit, 16bit and 24bit PCM are supported.");
}
i30 = parseInt / 8;
i31 = i31;
} else {
if (strArr[i29].equals("--twopass")) {
i26 = 1;
z = true;
} else if (strArr[i29].equals("--normalize")) {
i26 = 1;
z = true;
z2 = true;
} else {
if (strArr[i29].equals("--dither")) {
i27 = i29 + 1;
try {
i33 = Integer.parseInt(strArr[i27]);
if (i33 < 0 || i33 > 4) {
throw new IllegalArgumentException("unrecognized dither type : " + strArr[i27]);
break;
}
} catch (NumberFormatException unused) {
i26 = 1;
i33 = -1;
}
} else if (strArr[i29].equals("--pdf")) {
i29++;
try {
i32 = Integer.parseInt(strArr[i29]);
if (i32 < 0 || i32 > 2) {
throw new IllegalArgumentException("unrecognized p.d.f. type : " + strArr[i29]);
}
i27 = i29 + 1;
try {
d10 = Double.parseDouble(strArr[i27]);
} catch (NumberFormatException unused2) {
d10 = presets[i32];
i30 = i30;
i31 = i31;
}
} catch (NumberFormatException unused3) {
throw new IllegalArgumentException("unrecognized p.d.f. type : " + strArr[i29]);
}
} else if (strArr[i29].equals("--quiet")) {
i26 = 1;
ssrc3.quiet = true;
} else if (strArr[i29].equals("--tmpfile")) {
i29++;
str9 = strArr[i29];
i30 = i30;
i31 = i31;
} else if (strArr[i29].equals("--profile")) {
i29++;
if (strArr[i29].equals("fast")) {
ssrc3.AA = 96.0d;
ssrc3.DF = 8000.0d;
ssrc3.FFTFIRLEN = 1024;
i30 = i30;
i31 = i31;
} else {
i30 = i30;
i31 = i31;
if (!strArr[i29].equals("standard")) {
throw new IllegalArgumentException("unrecognized profile : " + strArr[i29]);
}
}
} else {
throw new IllegalArgumentException("unrecognized option : " + strArr[i29]);
}
i29 = i27;
i30 = i30;
i31 = i31;
}
i29 += i26;
i28 = 0;
i30 = i30;
i31 = i31;
}
i26 = 1;
i29 += i26;
i28 = 0;
i30 = i30;
i31 = i31;
}
if (!ssrc3.quiet) {
System.err.printf("Shibatch sampling rate converter version 1.30(high precision/nio)\n\n", new Object[0]);
}
if (strArr.length - i29 != 2) {
usage();
throw new IllegalStateException("too few arguments");
}
String str10 = strArr[i29];
String str11 = strArr[i29 + 1];
try {
FileInputStream fileInputStream = new FileInputStream(str10);
ByteBuffer order = ByteBuffer.allocate(256).order(ByteOrder.LITTLE_ENDIAN);
order.limit(36);
fileInputStream.getChannel().read(order);
order.flip();
System.err.println("p: " + order.position() + ", l: " + order.limit());
if (order.get() != 82) {
i = 1;
ssrc3.fmterr(1);
} else {
i = 1;
}
if (order.get() != 73) {
ssrc3.fmterr(i);
}
if (order.get() != 70) {
ssrc3.fmterr(i);
}
if (order.get() != 70) {
ssrc3.fmterr(i);
}
order.getInt();
if (order.get() != 87) {
ssrc3.fmterr(2);
}
if (order.get() != 65) {
ssrc3.fmterr(2);
}
if (order.get() != 86) {
ssrc3.fmterr(2);
}
if (order.get() != 69) {
ssrc3.fmterr(2);
}
if (order.get() != 102) {
ssrc3.fmterr(2);
}
if (order.get() != 109) {
ssrc3.fmterr(2);
}
if (order.get() != 116) {
ssrc3.fmterr(2);
}
if (order.get() != 32) {
ssrc3.fmterr(2);
}
int i34 = order.getInt();
if (order.getShort() != 1) {
throw new IllegalStateException("Error: Only PCM is supported.");
}
int i35 = order.getShort();
int i36 = order.getInt();
int i37 = order.getInt();
if ((i37 % i36) * i35 != 0) {
ssrc3.fmterr(4);
}
order.getShort();
order.getShort();
int i38 = i37 / (i36 * i35);
if (i34 > 16) {
order.position(0);
order.limit(2);
fileInputStream.read(ssrc3.getDataFromByteBuffer(order));
order.flip();
d = d10;
fileInputStream.getChannel().position(fileInputStream.getChannel().position() + order.getShort());
} else {
d = d10;
}
int i39 = 0;
while (true) {
order.position(i39);
order.limit(8);
fileInputStream.getChannel().read(order);
order.flip();
byte b = order.get();
byte b2 = order.get();
byte b3 = order.get();
byte b4 = order.get();
str = str9;
i2 = order.getInt();
ByteBuffer byteBuffer3 = order;
i3 = i32;
str2 = str11;
System.err.printf("chunk: %c%c%c%c\n", Integer.valueOf(b), Integer.valueOf(b2), Integer.valueOf(b3), Integer.valueOf(b4));
if ((b != 100 || b2 != 97 || b3 != 116 || b4 != 97) && fileInputStream.getChannel().position() != fileInputStream.getChannel().size()) {
fileInputStream.getChannel().position(fileInputStream.getChannel().position() + i2);
order = byteBuffer3;
i33 = i33;
i32 = i3;
i38 = i38;
i39 = 0;
d11 = d11;
str11 = str2;
ssrc3 = this;
str9 = str;
i36 = i36;
}
}
if (fileInputStream.getChannel().position() == fileInputStream.getChannel().size()) {
throw new IllegalStateException("Couldn't find data chank");
}
if (i38 != 1 && i38 != 2 && i38 != 3 && i38 != 4) {
throw new IllegalStateException("Error : Only 8bit, 16bit, 24bit and 32bit PCM are supported.");
}
if (i30 == -1) {
int i40 = i38 != 1 ? i38 : 2;
i4 = i40 == 4 ? 3 : i40;
} else {
i4 = i30;
}
int i41 = i31 == -1 ? i36 : i31;
int i42 = i33 == -1 ? i4 < i38 ? i4 == 1 ? 4 : 3 : 1 : i33;
String str12 = "\n";
if (ssrc3.quiet) {
i5 = i2;
} else {
String[] strArr2 = {SchedulerSupport.NONE, "no noise shaping", "triangular spectral shape", "ATH based noise shaping", "ATH based noise shaping(less amplitude)"};
String[] strArr3 = {"rectangular", "triangular", "gaussian"};
System.err.printf("frequency : %d -> %d\n", Integer.valueOf(i36), Integer.valueOf(i41));
System.err.printf("attenuation : %gdB\n", Double.valueOf(d11));
System.err.printf("bits per sample : %d -> %d\n", Integer.valueOf(i38 * 8), Integer.valueOf(i4 * 8));
System.err.printf("nchannels : %d\n", Integer.valueOf(i35));
PrintStream printStream = System.err;
double d12 = i2;
i5 = i2;
double d13 = i38;
Double.isNaN(d12);
Double.isNaN(d13);
double d14 = d12 / d13;
double d15 = i35;
Double.isNaN(d15);
double d16 = d14 / d15;
double d17 = i36;
Double.isNaN(d17);
printStream.printf("length : %d bytes, %g secs\n", Integer.valueOf(i2), Double.valueOf(d16 / d17));
if (i42 == 0) {
i25 = 0;
System.err.printf("dither type : none\n", new Object[0]);
} else {
i25 = 0;
System.err.printf("dither type : %s, %s p.d.f, amp = %g\n", strArr2[i42], strArr3[i3], Double.valueOf(d));
}
str12 = "\n";
System.err.printf(str12, new Object[i25]);
}
try {
FileOutputStream fileOutputStream7 = new FileOutputStream(new File(str2));
ByteBuffer order2 = ByteBuffer.allocate(44).order(ByteOrder.LITTLE_ENDIAN);
order2.put("RIFF".getBytes());
order2.putInt(0);
order2.put("WAVEfmt ".getBytes());
order2.putInt(16);
order2.putShort((short) 1);
order2.putShort((short) i35);
order2.putInt(i41);
order2.putInt(i41 * i35 * i4);
order2.putShort((short) (i4 * i35));
order2.putShort((short) (i4 * 8));
order2.put("data".getBytes());
order2.putInt(0);
order2.flip();
ssrc3.writeBuffers(fileOutputStream7, order2);
if (i42 != 0) {
if (i4 == 1) {
i21 = -128;
i22 = 127;
} else {
i21 = 0;
i22 = 0;
}
if (i4 == 2) {
i21 = -32768;
i22 = 32767;
}
if (i4 == 3) {
i21 = -8388608;
i22 = 8388607;
}
if (i4 == 4) {
i23 = Integer.MIN_VALUE;
i24 = Integer.MAX_VALUE;
} else {
i23 = i21;
i24 = i22;
}
i6 = i38;
str3 = str2;
i8 = i36;
fileOutputStream = fileOutputStream7;
str4 = str12;
i7 = i5;
i9 = init_shaper(i41, i35, i23, i24, i42, i3, d);
} else {
i6 = i38;
fileOutputStream = fileOutputStream7;
str3 = str2;
str4 = str12;
i7 = i5;
i8 = i36;
i9 = 0;
}
if (z) {
if (!ssrc3.quiet) {
System.err.printf("Pass 1\n", new Object[0]);
}
try {
if (str != null) {
createTempFile = new File(str);
} else {
createTempFile = File.createTempFile("ssrc_", ".tmp");
}
File file3 = createTempFile;
FileOutputStream fileOutputStream8 = new FileOutputStream(file3);
if (z2) {
if (i8 < i41) {
fileOutputStream3 = fileOutputStream8;
i12 = i4;
d8 = 10.0d;
int i43 = i41;
String str13 = str3;
i11 = i9;
str8 = str4;
file = file3;
str5 = str13;
double upsample = upsample(fileInputStream, fileOutputStream8, i35, i6, 8, i8, i43, 1.0d, (i7 / i6) / i35, z, i42);
i13 = 0;
dArr[0] = upsample;
} else {
str5 = str3;
fileOutputStream3 = fileOutputStream8;
file = file3;
i11 = i9;
i12 = i4;
str8 = str4;
d8 = 10.0d;
if (i8 > i41) {
i13 = 0;
dArr[0] = downsample(fileInputStream, fileOutputStream3, i35, i6, 8, i8, i41, 1.0d, (i7 / i6) / i35, z, i42);
} else {
i13 = 0;
dArr[0] = no_src(fileInputStream, fileOutputStream3, i35, i6, 8, 1.0d, (i7 / i6) / i35, z, i42);
}
}
d4 = d8;
d3 = d11;
} else {
str5 = str3;
fileOutputStream3 = fileOutputStream8;
file = file3;
i11 = i9;
i12 = i4;
str8 = str4;
if (i8 < i41) {
double d18 = d11;
d3 = d18;
i13 = 0;
dArr[0] = upsample(fileInputStream, fileOutputStream3, i35, i6, 8, i8, i41, Math.pow(10.0d, (-d18) / 20.0d), (i7 / i6) / i35, z, i42);
} else {
d3 = d11;
if (i8 > i41) {
i13 = 0;
dArr[0] = downsample(fileInputStream, fileOutputStream3, i35, i6, 8, i8, i41, Math.pow(10.0d, (-d3) / 20.0d), (i7 / i6) / i35, z, i42);
} else {
d4 = 10.0d;
i13 = 0;
dArr[0] = no_src(fileInputStream, fileOutputStream3, i35, i6, 8, Math.pow(10.0d, (-d3) / 20.0d), (i7 / i6) / i35, z, i42);
}
}
d4 = 10.0d;
}
fileOutputStream3.close();
double d19 = d4;
if (!this.quiet) {
PrintStream printStream2 = System.err;
Object[] objArr = new Object[1];
objArr[i13] = Double.valueOf(Math.log10(dArr[i13]) * 20.0d);
printStream2.printf("\npeak : %gdB\n", objArr);
}
if (z2) {
d5 = 1.0d;
dArr[i13] = dArr[i13] * Math.pow(d19, d3 / 20.0d);
} else if (dArr[i13] < Math.pow(d19, (-d3) / 20.0d)) {
d5 = 1.0d;
dArr[i13] = 1.0d;
} else {
d5 = 1.0d;
dArr[i13] = dArr[i13] * Math.pow(d19, d3 / 20.0d);
}
if (!this.quiet) {
System.err.printf("\nPass 2\n", new Object[i13]);
}
double d20 = 8388607.0d;
if (i42 != 0) {
i14 = i12;
if (i14 != 1) {
i16 = 2;
if (i14 != 2) {
i15 = 3;
if (i14 == 3) {
if (z2) {
i20 = i11;
c2 = 0;
} else {
c2 = 0;
double d21 = dArr[0];
i20 = i11;
double d22 = 8388607 - i20;
Double.isNaN(d22);
if (d21 < d22 / 8388607.0d) {
d6 = d5 / dArr[0];
}
}
d6 = d5 / dArr[c2];
d20 = 8388607 - i20;
Double.isNaN(d20);
}
} else {
int i44 = i11;
i15 = 3;
if (!z2) {
double d23 = dArr[0];
double d24 = 32767 - i44;
Double.isNaN(d24);
if (d23 < d24 / 32767.0d) {
d7 = (d5 / dArr[0]) * 32767.0d;
d9 = d7;
}
}
d6 = d5 / dArr[0];
d20 = 32767 - i44;
Double.isNaN(d20);
}
d7 = d6 * d20;
d9 = d7;
} else {
int i45 = i11;
i15 = 3;
i16 = 2;
if (!z2) {
double d25 = dArr[0];
double d26 = 127 - i45;
Double.isNaN(d26);
if (d25 < d26 / 127.0d) {
d9 = (d5 / dArr[0]) * 127.0d;
}
}
d6 = d5 / dArr[0];
d20 = 127 - i45;
Double.isNaN(d20);
d7 = d6 * d20;
d9 = d7;
}
this.randptr = i17;
setstarttime();
length = (int) (file.length() / 8);
file2 = file;
FileChannel channel = new FileInputStream(file2).getChannel();
ByteBuffer allocate = ByteBuffer.allocate(8);
i18 = 0;
int i46 = 0;
while (i18 < length) {
allocate.clear();
channel.read(allocate);
allocate.flip();
double d27 = allocate.getDouble() * d9;
int i47 = i18 + 1;
if (i14 != 1) {
if (i14 == i16) {
i19 = i47;
byteBuffer2 = allocate;
FileOutputStream fileOutputStream9 = fileOutputStream;
if (i42 != 0) {
fileOutputStream5 = fileOutputStream9;
RINT2 = do_shaping(d27, dArr, i42, i46);
} else {
fileOutputStream5 = fileOutputStream9;
RINT2 = RINT(d27);
}
ByteBuffer order3 = ByteBuffer.allocate(i16).order(ByteOrder.LITTLE_ENDIAN);
order3.putShort((short) RINT2);
order3.flip();
fileOutputStream6 = fileOutputStream5;
writeBuffers(fileOutputStream6, order3);
} else if (i14 != i15) {
i19 = i47;
byteBuffer = allocate;
fileOutputStream4 = fileOutputStream;
} else {
if (i42 != 0) {
i19 = i47;
byteBuffer2 = allocate;
RINT3 = do_shaping(d27, dArr, i42, i46);
} else {
i19 = i47;
byteBuffer2 = allocate;
RINT3 = RINT(d27);
}
ByteBuffer allocate2 = ByteBuffer.allocate(i15);
allocate2.put((byte) (RINT3 & 255));
int i48 = RINT3 >> 8;
allocate2.put((byte) (i48 & 255));
allocate2.put((byte) ((i48 >> 8) & 255));
allocate2.flip();
fileOutputStream6 = fileOutputStream;
writeBuffers(fileOutputStream6, allocate2);
}
byteBuffer = byteBuffer2;
fileOutputStream4 = fileOutputStream6;
} else {
i19 = i47;
ByteBuffer byteBuffer4 = allocate;
FileOutputStream fileOutputStream10 = fileOutputStream;
if (i42 != 0) {
byteBuffer = byteBuffer4;
fileOutputStream4 = fileOutputStream10;
RINT = do_shaping(d27, dArr, i42, i46);
} else {
byteBuffer = byteBuffer4;
fileOutputStream4 = fileOutputStream10;
RINT = RINT(d27);
}
ByteBuffer allocate3 = ByteBuffer.allocate(1);
allocate3.put((byte) (RINT + 128));
allocate3.flip();
writeBuffers(fileOutputStream4, allocate3);
}
int i49 = i46 + 1;
i46 = i49 == i35 ? 0 : i49;
if ((262143 & i19) == 0) {
double d28 = i19;
double d29 = length;
Double.isNaN(d28);
Double.isNaN(d29);
showprogress(d28 / d29);
}
allocate = byteBuffer;
i18 = i19;
fileOutputStream = fileOutputStream4;
d5 = 1.0d;
}
double d30 = d5;
FileOutputStream fileOutputStream11 = fileOutputStream;
showprogress(d30);
if (this.quiet) {
c = 0;
} else {
c = 0;
System.err.printf(str8, new Object[0]);
}
channel.close();
if (file2 != null && !file2.delete()) {
PrintStream printStream3 = System.err;
Object[] objArr2 = new Object[1];
objArr2[c] = file2;
printStream3.printf("Failed to remove %s\n", objArr2);
}
d2 = d30;
fileOutputStream2 = fileOutputStream11;
ssrc = this;
i10 = 0;
} else {
i14 = i12;
i15 = 3;
i16 = 2;
if (i14 == 1) {
i17 = 0;
d9 = (d5 / dArr[0]) * 127.0d;
} else if (i14 == 2) {
i17 = 0;
d9 = (d5 / dArr[0]) * 32767.0d;
} else if (i14 == 3) {
i17 = 0;
d9 = (d5 / dArr[0]) * 8388607.0d;
}
this.randptr = i17;
setstarttime();
length = (int) (file.length() / 8);
file2 = file;
FileChannel channel2 = new FileInputStream(file2).getChannel();
ByteBuffer allocate4 = ByteBuffer.allocate(8);
i18 = 0;
int i462 = 0;
while (i18 < length) {
}
double d302 = d5;
FileOutputStream fileOutputStream112 = fileOutputStream;
showprogress(d302);
if (this.quiet) {
}
channel2.close();
if (file2 != null) {
PrintStream printStream32 = System.err;
Object[] objArr22 = new Object[1];
objArr22[c] = file2;
printStream32.printf("Failed to remove %s\n", objArr22);
}
d2 = d302;
fileOutputStream2 = fileOutputStream112;
ssrc = this;
i10 = 0;
}
i17 = 0;
this.randptr = i17;
setstarttime();
length = (int) (file.length() / 8);
file2 = file;
FileChannel channel22 = new FileInputStream(file2).getChannel();
ByteBuffer allocate42 = ByteBuffer.allocate(8);
i18 = 0;
int i4622 = 0;
while (i18 < length) {
}
double d3022 = d5;
FileOutputStream fileOutputStream1122 = fileOutputStream;
showprogress(d3022);
if (this.quiet) {
}
channel22.close();
if (file2 != null) {
}
d2 = d3022;
fileOutputStream2 = fileOutputStream1122;
ssrc = this;
i10 = 0;
} catch (IOException unused4) {
throw new IllegalStateException("cannot open temporary file.");
}
} else {
str5 = str3;
SSRC ssrc4 = ssrc3;
int i50 = i4;
double d31 = d11;
FileOutputStream fileOutputStream12 = fileOutputStream;
String str14 = str4;
if (i8 < i41) {
d2 = 1.0d;
fileOutputStream2 = fileOutputStream12;
str7 = str14;
ssrc2 = ssrc4;
i10 = 0;
dArr[0] = upsample(fileInputStream, fileOutputStream12, i35, i6, i50, i8, i41, Math.pow(10.0d, (-d31) / 20.0d), (i7 / i6) / i35, z, i42);
} else {
d2 = 1.0d;
fileOutputStream2 = fileOutputStream12;
if (i8 > i41) {
str7 = str14;
ssrc2 = ssrc4;
i10 = 0;
dArr[0] = downsample(fileInputStream, fileOutputStream2, i35, i6, i50, i8, i41, Math.pow(10.0d, (-d31) / 20.0d), (i7 / i6) / i35, z, i42);
} else {
ssrc = ssrc4;
str6 = str14;
i10 = 0;
dArr[0] = no_src(fileInputStream, fileOutputStream2, i35, i6, i50, Math.pow(10.0d, (-d31) / 20.0d), (i7 / i6) / i35, z, i42);
if (!ssrc.quiet) {
System.err.printf(str6, new Object[i10]);
}
}
}
str6 = str7;
ssrc = ssrc2;
if (!ssrc.quiet) {
}
}
if (i42 != 0) {
ssrc.quit_shaper(i35);
}
if (!z && dArr[i10] > d2 && !ssrc.quiet) {
PrintStream printStream4 = System.err;
Object[] objArr3 = new Object[1];
objArr3[i10] = Double.valueOf(Math.log10(dArr[i10]) * 20.0d);
printStream4.printf("clipping detected : %gdB\n", objArr3);
}
fileOutputStream2.close();
File file4 = new File(str5);
int length2 = (int) file4.length();
FileChannel channel3 = new RandomAccessFile(file4, "rw").getChannel();
ByteBuffer order4 = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN);
order4.position(0);
order4.limit(4);
order4.putInt(length2 - 8);
order4.flip();
channel3.write(order4, 4L);
order4.position(0);
order4.limit(4);
order4.putInt(length2 - 44);
order4.flip();
channel3.write(order4, 40L);
channel3.close();
} catch (IOException unused5) {
throw new IllegalArgumentException("cannot open output file.");
}
} catch (IOException unused6) {
throw new IllegalArgumentException("cannot open input file.");
}
}
public SSRC(InputStream inputStream, OutputStream outputStream, int i, int i2, int i3, int i4, int i5, int i6, double d, int i7, boolean z) throws IOException {
int i8;
int i9;
int i10;
double[] dArr;
int i11;
double d2;
String str;
int i12;
double[] dArr2;
int i13;
int i14;
int i15;
int i16;
int i17;
int i18;
int i19;
int i20;
this.byteOrder = ByteOrder.LITTLE_ENDIAN;
this.fft = new SplitRadixFft();
this.AA = 170.0d;
this.DF = 100.0d;
this.FFTFIRLEN = 65536;
this.quiet = false;
double[] dArr3 = {FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE};
if (i7 < 0 || i7 > 4) {
throw new IllegalArgumentException("unrecognized dither type : " + i7);
}
this.quiet = z;
if (i3 != 1 && i3 != 2 && i3 != 3 && i3 != 4) {
throw new IllegalStateException("Error : Only 8bit, 16bit, 24bit and 32bit PCM are supported.");
}
int i21 = i4;
if (i21 == -1) {
i21 = i3 != 1 ? i3 : 2;
if (i21 == 4) {
i8 = i2;
i21 = 3;
i8 = i8 == -1 ? i : i8;
i9 = i7 != -1 ? i21 < i3 ? i21 == 1 ? 4 : 3 : 1 : i7;
String str2 = "\n";
if (this.quiet) {
String[] strArr = {SchedulerSupport.NONE, "no noise shaping", "triangular spectral shape", "ATH based noise shaping", "ATH based noise shaping(less amplitude)"};
String[] strArr2 = {"rectangular", "triangular", "gaussian"};
i10 = i8;
System.err.printf("frequency : %d -> %d\n", Integer.valueOf(i), Integer.valueOf(i8));
System.err.printf("attenuation : %gdB\n", Double.valueOf(d));
System.err.printf("bits per sample : %d -> %d\n", Integer.valueOf(i3 * 8), Integer.valueOf(i21 * 8));
System.err.printf("nchannels : %d\n", Integer.valueOf(i5));
PrintStream printStream = System.err;
dArr = dArr3;
double d3 = i6;
double d4 = i3;
Double.isNaN(d3);
Double.isNaN(d4);
double d5 = d3 / d4;
double d6 = i5;
Double.isNaN(d6);
double d7 = d5 / d6;
double d8 = i;
Double.isNaN(d8);
printStream.printf("length : %d bytes, %g secs\n", Integer.valueOf(i6), Double.valueOf(d7 / d8));
if (i9 == 0) {
i20 = 0;
System.err.printf("dither type : none\n", new Object[0]);
} else {
i20 = 0;
System.err.printf("dither type : %s, %s p.d.f, amp = %g\n", strArr[i9], strArr2[0], Double.valueOf(0.18d));
}
str2 = "\n";
System.err.printf(str2, new Object[i20]);
} else {
i10 = i8;
dArr = dArr3;
}
if (i9 == 0) {
if (i21 == 1) {
i16 = -128;
i17 = 127;
} else {
i16 = 0;
i17 = 0;
}
if (i21 == 2) {
i16 = -32768;
i17 = 32767;
}
if (i21 == 3) {
i16 = -8388608;
i17 = 8388607;
}
if (i21 == 4) {
i18 = Integer.MIN_VALUE;
i19 = Integer.MAX_VALUE;
} else {
i18 = i16;
i19 = i17;
}
int i22 = i10;
i11 = i22;
str = str2;
i12 = i21;
dArr2 = dArr;
d2 = d;
init_shaper(i22, i5, i18, i19, i9, 0, 0.18d);
} else {
i11 = i10;
d2 = d;
str = str2;
i12 = i21;
dArr2 = dArr;
}
if (i >= i11) {
i14 = i5;
i13 = 1;
i15 = 0;
dArr2[0] = upsample(inputStream, outputStream, i5, i3, i12, i, i11, Math.pow(10.0d, (-d2) / 20.0d), (i6 / i3) / i5, false, i9);
} else {
double d9 = d2;
i13 = 1;
i14 = i5;
if (i > i11) {
double downsample = downsample(inputStream, outputStream, i5, i3, i12, i, i11, Math.pow(10.0d, (-d9) / 20.0d), (i6 / i3) / i14, false, i9);
i15 = 0;
dArr2[0] = downsample;
} else {
double no_src = no_src(inputStream, outputStream, i5, i3, i12, Math.pow(10.0d, (-d9) / 20.0d), (i6 / i3) / i14, false, i9);
i15 = 0;
dArr2[0] = no_src;
}
}
if (!this.quiet) {
System.err.printf(str, new Object[i15]);
}
if (i9 != 0) {
quit_shaper(i14);
}
if (dArr2[i15] > 1.0d || this.quiet) {
}
PrintStream printStream2 = System.err;
Object[] objArr = new Object[i13];
objArr[i15] = Double.valueOf(Math.log10(dArr2[i15]) * 20.0d);
printStream2.printf("clipping detected : %gdB\n", objArr);
return;
}
}
i8 = i2;
if (i8 == -1) {
}
if (i7 != -1) {
}
String str22 = "\n";
if (this.quiet) {
}
if (i9 == 0) {
}
if (i >= i11) {
}
if (!this.quiet) {
}
if (i9 != 0) {
}
if (dArr2[i15] > 1.0d) {
}
}
protected byte[] getDataFromByteBuffer(ByteBuffer byteBuffer) {
int limit = byteBuffer.limit() - byteBuffer.position();
byte[] bArr = new byte[limit];
byteBuffer.get(bArr, 0, limit);
return bArr;
}
protected void writeBuffers(OutputStream outputStream, ByteBuffer byteBuffer) {
try {
outputStream.write(getDataFromByteBuffer(byteBuffer));
} catch (IOException unused) {
}
}
}