歌尔基办 v2.7.0版本的 MD5 值为:921fd7c85ec097e8cab7f049269b36e4
以下内容为反编译后的 SSRC.java 源代码,内容仅作参考
package im.ovithmjoec.ui.utils.translate.ssrc;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import im.ovithmjoec.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));
}
i7 = (i5 == 2 || i7 == 6) ? 0 : 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) {
double d2 = d - 21.0d;
return (Math.pow(d2, 0.4d) * 0.5842d) + (d2 * 0.07886d);
}
return (d - 8.7d) * 0.1102d;
}
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)));
} else {
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(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;
Double.isNaN(d14);
double d15 = i34;
Double.isNaN(d15);
dArr9[i53 % i44][i53 / i44] = ((win(i52, i43, alpha, value) * hn_lpf(i55, d13, d14)) * d14) / d15;
i52 = i55 + 1;
ssrc = this;
i38 = i38;
i45 = i45;
iArr2 = iArr2;
i43 = i43;
i51 = i51;
i36 = i36;
iArr = iArr3;
i50 = i54;
i41 = i41;
}
int[] iArr4 = iArr;
int i56 = i45;
int i57 = i36;
int i58 = i38;
int i59 = i51;
int[] iArr5 = 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 win = win(i67, i9, d20, value2);
d4 = d19;
double hn_lpf = win * 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[] iArr6 = new int[(int) (Math.sqrt(i71) + 2.0d)];
iArr6[0] = 0;
int i72 = i71 / 2;
double[] dArr13 = new double[i72];
ssrc4.fft.rdft(i71, 1, dArr12, iArr6, dArr13);
setstarttime();
int i73 = (i72 / i8) + 1;
int[] iArr7 = {r4, i73};
int i74 = i;
double[][] dArr14 = (double[][]) Array.newInstance(double.class, iArr7);
double[][] dArr15 = (double[][]) Array.newInstance(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];
double d24 = i9;
Double.isNaN(d24);
int i78 = i56;
double d25 = i58 / i5;
Double.isNaN(d25);
int i79 = (int) ((d24 / 2.0d) / d25);
int i80 = (i59 / i44) + 1;
ByteBuffer byteBuffer6 = allocate;
int i81 = 0;
int i82 = 0;
int i83 = 0;
int i84 = 0;
int i85 = 0;
int i86 = 0;
boolean z2 = true;
int i87 = i6;
int i88 = 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 d29 = i78;
Double.isNaN(d29);
double floor = Math.floor((d26 * d27) / d23) + 1.0d + d29;
double d30 = i80;
Double.isNaN(d30);
int i89 = (int) (floor - d30);
int i90 = i89 + i81 > i87 ? i87 - i81 : i89;
byteBuffer6.position(0);
int i91 = i76 * i74;
byteBuffer6.limit(Math.min(byteBuffer6.limit(), i90 * i91));
byte[] bArr = new byte[byteBuffer6.limit()];
int read = inputStream.read(bArr);
int i92 = i87;
int i93 = read < 0 ? 0 : read;
int i94 = i93 < byteBuffer6.limit() ? ((i93 / i76) * i74) + i81 : i92;
byteBuffer6.limit(i93);
ByteBuffer wrap = ByteBuffer.wrap(bArr);
wrap.position(i93);
wrap.flip();
int i95 = i93 / i91;
if (i76 != 1) {
if (i76 == 2) {
i11 = i71;
byteBuffer = allocate2;
i12 = 0;
while (i12 < i95 * i74) {
double d31 = wrap.order(ssrc4.byteOrder).asShortBuffer().get(i12);
Double.isNaN(d31);
dArr19[(i74 * i80) + i12] = d31 * 3.051850947599719E-5d;
i12++;
i72 = i72;
}
} else if (i76 == 3) {
byteBuffer = allocate2;
i12 = 0;
while (i12 < i95 * i74) {
int i96 = i12 * 3;
double d32 = (wrap.get(i96 + 1) << 8) | (wrap.get(i96) << 0) | (wrap.get(i96 + 2) << 16);
Double.isNaN(d32);
dArr19[(i74 * i80) + i12] = d32 * 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 < i95 * i74) {
ByteBuffer byteBuffer7 = allocate2;
double d33 = wrap.order(ssrc4.byteOrder).asIntBuffer().get(i12);
Double.isNaN(d33);
dArr19[(i74 * i80) + i12] = d33 * 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 < i95 * i74) {
double d34 = wrap.get(i12);
Double.isNaN(d34);
dArr19[(i74 * i80) + i12] = (d34 - 128.0d) * 0.007874015748031496d;
i12++;
}
}
while (i12 < i74 * i89) {
dArr19[(i74 * i80) + i12] = 0.0d;
i12++;
}
int i97 = i80 + i89;
i81 += i95;
boolean z3 = i81 >= i94;
int i98 = ((((i82 - 1) * i34) + i57) / i57) * i74;
int i99 = i83;
int i100 = i84;
int i101 = i85;
int i102 = 0;
while (i102 < i74) {
int i103 = i98 + i102;
if (i78 == 7) {
i31 = i10;
i32 = i98;
i33 = i61;
int i104 = i84;
for (int i105 = 0; i105 < i31; i105++) {
int i106 = iArr4[i104];
dArr15[i102][i105] = (dArr9[i106][0] * dArr19[i103 + (i74 * 0)]) + (dArr9[i106][1] * dArr19[i103 + (i74 * 1)]) + (dArr9[i106][2] * dArr19[i103 + (i74 * 2)]) + (dArr9[i106][3] * dArr19[i103 + (i74 * 3)]) + (dArr9[i106][4] * dArr19[i103 + (i74 * 4)]) + (dArr9[i106][5] * dArr19[i103 + (i74 * 5)]) + (dArr9[i106][6] * dArr19[i103 + (i74 * 6)]);
i103 += iArr5[i104];
i104++;
if (i104 == i33) {
i104 = 0;
}
}
i100 = i104;
} else if (i78 != 9) {
int i107 = i84;
i31 = i10;
int i108 = 0;
while (i108 < i31) {
int i109 = iArr4[i107];
int i110 = i98;
int i111 = i103;
double d35 = 0.0d;
for (int i112 = 0; i112 < i78; i112++) {
d35 += dArr9[i109][i112] * dArr19[i111];
i111 += i74;
}
dArr15[i102][i108] = d35;
i103 += iArr5[i107];
int i113 = i107 + 1;
int i114 = i61;
i107 = i113 == i114 ? 0 : i113;
i108++;
i61 = i114;
i98 = i110;
}
i32 = i98;
i100 = i107;
i33 = i61;
} else {
i31 = i10;
i32 = i98;
i33 = i61;
int i115 = i84;
for (int i116 = 0; i116 < i31; i116++) {
int i117 = iArr4[i115];
dArr15[i102][i116] = (dArr9[i117][0] * dArr19[i103 + (i74 * 0)]) + (dArr9[i117][1] * dArr19[i103 + (i74 * 1)]) + (dArr9[i117][2] * dArr19[i103 + (i74 * 2)]) + (dArr9[i117][3] * dArr19[i103 + (i74 * 3)]) + (dArr9[i117][4] * dArr19[i103 + (i74 * 4)]) + (dArr9[i117][5] * dArr19[i103 + (i74 * 5)]) + (dArr9[i117][6] * dArr19[i103 + (i74 * 6)]) + (dArr9[i117][7] * dArr19[i103 + (i74 * 7)]) + (dArr9[i117][8] * dArr19[i103 + (i74 * 8)]);
i103 += iArr5[i115];
i115++;
if (i115 == i33) {
i115 = 0;
}
}
i100 = i115;
}
int i118 = i11;
for (int i119 = i31; i119 < i118; i119++) {
dArr15[i102][i119] = 0.0d;
}
ssrc4.fft.rdft(i118, 1, dArr15[i102], iArr6, dArr13);
dArr15[i102][0] = dArr12[0] * dArr15[i102][0];
dArr15[i102][1] = dArr12[1] * dArr15[i102][1];
for (int i120 = 1; i120 < i31; i120++) {
int i121 = i120 * 2;
int i122 = i121 + 1;
double d36 = (dArr12[i121] * dArr15[i102][i121]) - (dArr12[i122] * dArr15[i102][i122]);
double d37 = (dArr12[i122] * dArr15[i102][i121]) + (dArr12[i121] * dArr15[i102][i122]);
dArr15[i102][i121] = d36;
dArr15[i102][i122] = d37;
}
ssrc4.fft.rdft(i118, -1, dArr15[i102], iArr6, dArr13);
int i123 = i85;
i99 = 0;
while (i123 < i31) {
dArr18[i102 + (i99 * i74)] = dArr14[i102][i99] + dArr15[i102][i123];
i123 += i8;
i99++;
}
int i124 = i123 - i31;
int i125 = 0;
while (i123 < i118) {
dArr14[i102][i125] = dArr15[i102][i123];
i123 += i8;
i125++;
}
i102++;
i61 = i33;
i11 = i118;
i12 = i123;
i98 = i32;
i10 = i31;
i101 = i124;
}
int i126 = i61;
int i127 = i11;
int i128 = i10;
int i129 = i82 + ((i128 * gcd) / i8);
byteBuffer.clear();
if (z) {
int i130 = 0;
while (i130 < i99 * i74) {
if (dArr18[i130] > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
byteBuffer5 = wrap;
d7 = dArr18[i130];
} else {
byteBuffer5 = wrap;
d7 = -dArr18[i130];
}
if (dArr8[0] >= d7) {
d7 = dArr8[0];
}
dArr8[0] = d7;
byteBuffer.asDoubleBuffer().put(i130, dArr18[i130]);
i130++;
wrap = byteBuffer5;
i78 = i78;
}
i13 = i78;
i14 = i126;
i70 = i130;
byteBuffer2 = wrap;
} else {
byteBuffer2 = wrap;
i13 = i78;
if (i3 == 1) {
i14 = i126;
i15 = i100;
i16 = i101;
i17 = i127;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
byteBuffer3 = byteBuffer;
i18 = i74;
i19 = i94;
double d38 = d * 127.0d;
i20 = 0;
int i131 = 0;
while (i20 < i99 * i18) {
if (i7 != 0) {
RINT = do_shaping(dArr2[i20] * d38, dArr8, i7, i131);
} else {
RINT = ssrc4.RINT(dArr2[i20] * d38);
if (RINT < -128) {
double d39 = RINT;
Double.isNaN(d39);
double d40 = d39 / (-128.0d);
c = 0;
if (dArr8[0] >= d40) {
d40 = dArr8[0];
}
dArr8[0] = d40;
RINT = -128;
} else {
c = 0;
}
if (127 < RINT) {
double d41 = RINT;
Double.isNaN(d41);
double d42 = d41 / 127.0d;
if (dArr8[c] >= d42) {
d42 = dArr8[c];
}
dArr8[c] = d42;
RINT = 127;
}
}
byteBuffer3.put(i20, (byte) (RINT + 128));
int i132 = i131 + 1;
i131 = i132 == i18 ? 0 : i132;
i20++;
}
} else if (i3 == 2) {
i14 = i126;
i15 = i100;
i16 = i101;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
i18 = i74;
i19 = i94;
ByteBuffer byteBuffer8 = byteBuffer;
double d43 = d * 32767.0d;
i20 = 0;
int i133 = 0;
while (i20 < i99 * i18) {
if (i7 != 0) {
i21 = i127;
byteBuffer4 = byteBuffer8;
RINT2 = do_shaping(dArr2[i20] * d43, dArr8, i7, i133);
} else {
i21 = i127;
byteBuffer4 = byteBuffer8;
RINT2 = ssrc4.RINT(dArr2[i20] * d43);
if (RINT2 < -32768) {
double d44 = RINT2;
Double.isNaN(d44);
double d45 = d44 / (-32768.0d);
c2 = 0;
if (dArr8[0] >= d45) {
d45 = dArr8[0];
}
dArr8[0] = d45;
RINT2 = -32768;
} else {
c2 = 0;
}
if (32767 < RINT2) {
double d46 = RINT2;
Double.isNaN(d46);
double d47 = d46 / 32767.0d;
if (dArr8[c2] >= d47) {
d47 = dArr8[c2];
}
dArr8[c2] = d47;
RINT2 = 32767;
}
}
byteBuffer4.order(ssrc4.byteOrder).asShortBuffer().put(i20, (short) RINT2);
int i134 = i133 + 1;
i133 = i134 == i18 ? 0 : i134;
i20++;
byteBuffer8 = byteBuffer4;
i127 = i21;
}
i17 = i127;
byteBuffer3 = byteBuffer8;
} else if (i3 != 3) {
i14 = i126;
i70 = i12;
} else {
double d48 = d * 8388607.0d;
int i135 = 0;
int i136 = 0;
while (i135 < i99 * i74) {
if (i7 != 0) {
i22 = i126;
dArr4 = dArr18;
d6 = d28;
dArr3 = dArr19;
i23 = i100;
i25 = i74;
i24 = i101;
i26 = i94;
RINT3 = do_shaping(dArr18[i135] * d48, dArr8, i7, i136);
} else {
i22 = i126;
i23 = i100;
i24 = i101;
dArr3 = dArr19;
dArr4 = dArr18;
d6 = d28;
i25 = i74;
i26 = i94;
RINT3 = ssrc4.RINT(dArr4[i135] * d48);
if (RINT3 < -8388608) {
double d49 = RINT3;
Double.isNaN(d49);
double d50 = d49 / (-8388608.0d);
c3 = 0;
if (dArr8[0] >= d50) {
d50 = dArr8[0];
}
dArr8[0] = d50;
RINT3 = -8388608;
} else {
c3 = 0;
}
if (8388607 < RINT3) {
double d51 = RINT3;
Double.isNaN(d51);
double d52 = d51 / 8388607.0d;
if (dArr8[c3] >= d52) {
d52 = dArr8[c3];
}
dArr8[c3] = d52;
RINT3 = 8388607;
}
}
int i137 = i135 * 3;
ByteBuffer byteBuffer9 = byteBuffer;
byteBuffer9.put(i137, (byte) (RINT3 & 255));
int i138 = RINT3 >> 8;
byteBuffer9.put(i137 + 1, (byte) (i138 & 255));
byteBuffer9.put(i137 + 2, (byte) ((i138 >> 8) & 255));
int i139 = i136 + 1;
i136 = i139 == i25 ? 0 : i139;
i135++;
byteBuffer = byteBuffer9;
i74 = i25;
i94 = i26;
dArr19 = dArr3;
i126 = i22;
i100 = i23;
i101 = i24;
d28 = d6;
dArr18 = dArr4;
}
i14 = i126;
i15 = i100;
i16 = i101;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
i18 = i74;
i19 = i94;
i70 = i135;
i17 = i127;
byteBuffer3 = byteBuffer;
if (z2) {
int i140 = i88;
dArr5 = dArr;
int i141 = i79;
if (i99 < i141) {
i79 = i141 - i99;
i29 = i140;
i27 = i19;
i28 = i97;
} else if (z3) {
double d53 = i81;
double d54 = i5;
Double.isNaN(d53);
Double.isNaN(d54);
Double.isNaN(d5);
double d55 = (d53 * d54) / d5;
i27 = i19;
i28 = i97;
if (d55 + 2.0d > (i140 + i99) - i141) {
int i142 = i3 * i18;
byteBuffer3.position(i142 * i141);
int i143 = i99 - i141;
byteBuffer3.limit(i142 * i143);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = i140 + i143;
i79 = i141;
} else {
int i144 = i3 * i18;
byteBuffer3.position(i144 * i141);
double d56 = i144;
double d57 = i140;
Double.isNaN(d57);
double floor2 = Math.floor(d55) + 2.0d + d57;
double d58 = i99;
Double.isNaN(d58);
double d59 = i141;
Double.isNaN(d59);
Double.isNaN(d56);
byteBuffer3.limit((int) (d56 * ((floor2 + d58) - d59)));
ssrc4.writeBuffers(outputStream, byteBuffer3);
break;
}
} else {
i27 = i19;
i28 = i97;
int i145 = i3 * i18;
byteBuffer3.position(i145 * i141);
byteBuffer3.limit(i145 * i99);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = (i99 - i141) + i140;
i79 = i141;
z2 = false;
int i146 = (i129 - 1) / i44;
int i147 = i28 - i146;
double[] dArr20 = dArr5;
System.arraycopy(dArr20, i18 * i146, dArr20, 0, i18 * i147);
i82 = i129 - (i146 * i44);
int i148 = i86 + 1;
if ((i86 & 7) != 7) {
double d60 = i81;
i88 = i29;
i30 = i148;
i87 = i27;
double d61 = i87;
Double.isNaN(d60);
Double.isNaN(d61);
ssrc4.showprogress(d60 / d61);
} else {
i88 = i29;
i30 = i148;
i87 = i27;
}
i34 = i4;
i80 = i147;
i86 = i30;
i74 = i18;
dArr16 = dArr20;
i72 = i128;
byteBuffer6 = byteBuffer2;
i78 = i13;
i84 = i15;
dArr17 = dArr2;
i85 = i16;
i71 = i17;
i83 = i99;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
} else {
if (z3) {
double d62 = i81;
double d63 = i5;
Double.isNaN(d62);
Double.isNaN(d63);
Double.isNaN(d5);
double d64 = (d62 * d63) / d5;
int i149 = i88 + i99;
dArr5 = dArr;
if (d64 + 2.0d > i149) {
byteBuffer3.position(0);
byteBuffer3.limit(i3 * i18 * i99);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = i149;
} else {
byteBuffer3.position(0);
double d65 = i3 * i18;
double d66 = i88;
Double.isNaN(d66);
Double.isNaN(d65);
int floor3 = (int) (d65 * ((Math.floor(d64) + 2.0d) - d66));
if (floor3 > 0) {
byteBuffer3.limit(floor3);
ssrc4.writeBuffers(outputStream, byteBuffer3);
}
}
} else {
dArr5 = dArr;
byteBuffer3.position(0);
byteBuffer3.limit(i3 * i18 * i99);
ssrc4.writeBuffers(outputStream, byteBuffer3);
i29 = i88 + i99;
}
i27 = i19;
i28 = i97;
}
int i1462 = (i129 - 1) / i44;
int i1472 = i28 - i1462;
double[] dArr202 = dArr5;
System.arraycopy(dArr202, i18 * i1462, dArr202, 0, i18 * i1472);
i82 = i129 - (i1462 * i44);
int i1482 = i86 + 1;
if ((i86 & 7) != 7) {
}
i34 = i4;
i80 = i1472;
i86 = i30;
i74 = i18;
dArr16 = dArr202;
i72 = i128;
byteBuffer6 = byteBuffer2;
i78 = i13;
i84 = i15;
dArr17 = dArr2;
i85 = i16;
i71 = i17;
i83 = i99;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
i70 = i20;
if (z2) {
}
int i14622 = (i129 - 1) / i44;
int i14722 = i28 - i14622;
double[] dArr2022 = dArr5;
System.arraycopy(dArr2022, i18 * i14622, dArr2022, 0, i18 * i14722);
i82 = i129 - (i14622 * i44);
int i14822 = i86 + 1;
if ((i86 & 7) != 7) {
}
i34 = i4;
i80 = i14722;
i86 = i30;
i74 = i18;
dArr16 = dArr2022;
i72 = i128;
byteBuffer6 = byteBuffer2;
i78 = i13;
i84 = i15;
dArr17 = dArr2;
i85 = i16;
i71 = i17;
i83 = i99;
allocate2 = byteBuffer3;
i61 = i14;
i76 = i2;
}
i15 = i100;
i16 = i101;
i17 = i127;
dArr = dArr19;
dArr2 = dArr18;
d5 = d28;
byteBuffer3 = byteBuffer;
i18 = i74;
i19 = i94;
if (z2) {
}
int i146222 = (i129 - 1) / i44;
int i147222 = i28 - i146222;
double[] dArr20222 = dArr5;
System.arraycopy(dArr20222, i18 * i146222, dArr20222, 0, i18 * i147222);
i82 = i129 - (i146222 * i44);
int i148222 = i86 + 1;
if ((i86 & 7) != 7) {
}
i34 = i4;
i80 = i147222;
i86 = i30;
i74 = i18;
dArr16 = dArr20222;
i72 = i128;
byteBuffer6 = byteBuffer2;
i78 = i13;
i84 = i15;
dArr17 = dArr2;
i85 = i16;
i71 = i17;
i83 = i99;
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)));
} else {
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.isNaN(d2);
double d12 = i4;
Double.isNaN(d12);
double win = ((win(i59, i63, alpha, value) * hn_lpf(i62, d4, d2)) * d2) / d12;
double d13 = i65;
Double.isNaN(d13);
dArr9[i60] = (win / d13) * 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(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 d14 = 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 d15 = i77 * 2;
Double.isNaN(d15);
double d16 = d15 / 2.0d;
double d17 = i76;
i11 = i71;
double d18 = i77;
Double.isNaN(d18);
Double.isNaN(d17);
double d19 = (d18 / 2.0d) + d17;
double d20 = d14 > 21.0d ? (d14 - 7.95d) / 14.36d : 0.9222d;
double d21 = i75;
Double.isNaN(d21);
int i79 = (int) (((d21 / d16) * d20) + 1.0d);
if (i79 % 2 == 0) {
i79++;
}
int i80 = i79;
double alpha2 = alpha(d14);
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(double.class, i81, i82);
int i86 = i80 / 2;
int i87 = -i86;
while (i87 <= i86) {
int i88 = i87 + i86;
int i89 = i87;
double d22 = d21;
Double.isNaN(d22);
Double.isNaN(d2);
dArr15[i88 % i81][i88 / i81] = ((win(i87, i80, alpha2, value2) * hn_lpf(i89, d19, d22)) * d22) / d2;
i87 = i89 + 1;
iArr7 = iArr7;
i86 = i86;
i75 = i75;
i81 = i81;
dArr14 = dArr14;
iArr6 = iArr6;
d21 = d22;
i78 = i78;
}
int i90 = i87;
int[] iArr8 = iArr6;
dArr = dArr14;
i12 = i78;
int i91 = i75;
int i92 = i81;
i13 = i80;
iArr2 = iArr7;
i14 = i82;
dArr2 = dArr15;
i15 = i91;
i16 = i92;
iArr3 = iArr8;
i17 = i90;
}
setstarttime();
double[][] dArr16 = (double[][]) Array.newInstance(double.class, i, i11);
int i93 = i14 + 1;
int i94 = i93 + i12;
int i95 = i17;
double[][] dArr17 = (double[][]) Array.newInstance(double.class, i, i94);
int i96 = ((i12 / i72) + i72 + 1) * i;
int i97 = i2;
ByteBuffer allocate = ByteBuffer.allocate(i96 * i97);
int i98 = i14;
double[][] dArr18 = dArr2;
double d23 = i12;
Double.isNaN(d23);
Double.isNaN(d3);
int i99 = i93;
int i100 = i16;
double d24 = i4;
Double.isNaN(d24);
double d25 = d24;
double d26 = ((d23 * d3) / d24) + 1.0d;
int i101 = i3 * i;
int[] iArr9 = iArr2;
double d27 = i101;
Double.isNaN(d27);
int[] iArr10 = iArr3;
int i102 = i12;
ByteBuffer allocate2 = ByteBuffer.allocate((int) (d26 * d27));
double[] dArr19 = new double[i96];
double d28 = d27;
double d29 = i;
Double.isNaN(d29);
double[] dArr20 = new double[(int) (d29 * d26)];
double d30 = i70;
Double.isNaN(d30);
Double.isNaN(d2);
Double.isNaN(d3);
double d31 = i13;
Double.isNaN(d31);
int i103 = i101;
double d32 = i15;
Double.isNaN(d32);
Double.isNaN(d3);
int i104 = (int) (((d30 / 2.0d) / (d2 / d3)) + ((d31 / 2.0d) / (d32 / d3)));
int i105 = i95;
ByteBuffer byteBuffer7 = allocate;
int i106 = 0;
int i107 = 0;
int i108 = 0;
int i109 = 0;
int i110 = 0;
boolean z2 = true;
int i111 = i6;
int i112 = 0;
while (true) {
int i113 = (((i102 + 0) - 1) / i72) + 1;
int i114 = i105;
if (i113 + i106 > i111) {
i113 = i111 - i106;
}
byteBuffer7.position(0);
int i115 = i97 * i;
int i116 = i111;
byteBuffer7.limit(i115 * i113);
byte[] bArr = new byte[byteBuffer7.limit()];
int i117 = i104;
int read = inputStream.read(bArr);
int i118 = i107;
int i119 = read < 0 ? 0 : read;
int i120 = i119 < byteBuffer7.limit() ? ((i119 / i97) * i) + i106 : i116;
byteBuffer7.limit(i119);
ByteBuffer wrap = ByteBuffer.wrap(bArr);
wrap.position(i119);
wrap.flip();
int i121 = i119 / i115;
if (i97 == 1) {
ssrc = this;
i18 = i108;
dArr3 = dArr17;
i19 = i15;
byteBuffer = allocate2;
d5 = d28;
i20 = i72;
i21 = 0;
while (i21 < i121 * i) {
double d33 = (wrap.get(i21) & UByte.MAX_VALUE) - 128;
Double.isNaN(d33);
dArr19[(i * 0) + i21] = d33 * 0.007874015748031496d;
i21++;
wrap = wrap;
}
} else if (i97 != 2) {
if (i97 == 3) {
ssrc = this;
i19 = i15;
byteBuffer = allocate2;
d5 = d28;
i21 = 0;
while (i21 < i121 * i) {
int i122 = i21 * 3;
int i123 = i108;
double d34 = ((wrap.get(i122 + 1) & UByte.MAX_VALUE) << 8) | ((wrap.get(i122) & UByte.MAX_VALUE) << 0) | ((wrap.get(i122 + 2) & UByte.MAX_VALUE) << 16);
Double.isNaN(d34);
dArr19[(i * 0) + i21] = d34 * 1.1920930376163766E-7d;
i21++;
i72 = i72;
i108 = i123;
}
i18 = i108;
i20 = i72;
byteBuffer2 = wrap;
} else if (i97 != 4) {
ssrc = this;
byteBuffer2 = wrap;
i18 = i108;
dArr3 = dArr17;
i19 = i15;
byteBuffer = allocate2;
d5 = d28;
i21 = i114;
i20 = i72;
while (i21 < i * i113) {
dArr19[i21] = 0.0d;
i21++;
}
int i124 = i106 + i121;
boolean z3 = inputStream.available() >= 0 || i124 >= i120;
int i125 = i110;
int i126 = i118;
i22 = 0;
while (i22 < i) {
int i127 = i102;
int i128 = 0;
int i129 = 0;
while (i128 < i127) {
dArr16[i22][i128] = dArr19[(i129 * i) + i22];
int i130 = i128 + 1;
while (true) {
i49 = i128 + i20;
if (i130 < i49) {
dArr16[i22][i130] = 0.0d;
i130++;
}
}
i129++;
i128 = i49;
}
int i131 = i11;
for (int i132 = i127; i132 < i131; i132++) {
dArr16[i22][i132] = 0.0d;
}
ssrc.fft.rdft(i131, 1, dArr16[i22], iArr, dArr);
dArr16[i22][0] = dArr10[0] * dArr16[i22][0];
dArr16[i22][1] = dArr10[1] * dArr16[i22][1];
for (int i133 = 1; i133 < i127; i133++) {
int i134 = i133 * 2;
int i135 = i134 + 1;
dArr16[i22][i134] = (dArr10[i134] * dArr16[i22][i134]) - (dArr10[i135] * dArr16[i22][i135]);
dArr16[i22][i135] = (dArr10[i135] * dArr16[i22][i134]) + (dArr10[i134] * dArr16[i22][i135]);
}
ssrc.fft.rdft(i131, -1, dArr16[i22], iArr, dArr);
int i136 = 0;
while (i136 < i127) {
double[] dArr21 = dArr3[i22];
int i137 = i99 + i136;
dArr21[i137] = dArr21[i137] + dArr16[i22][i136];
i136++;
}
int i138 = i19 / i69;
int i139 = i109 / i138;
if (i109 % i138 != 0) {
i139++;
}
int length = (dArr3[0].length * i22) + i139;
int i140 = i136;
int i141 = i118;
int i142 = 0;
for (char c4 = 0; length - (dArr3[c4].length * i22) < i127 + 1; c4 = 0) {
int i143 = iArr10[i141];
int i144 = iArr9[i141] + length;
i141++;
int i145 = i131;
int i146 = i100;
if (i141 == i146) {
i141 = 0;
}
i100 = i146;
double d35 = 0.0d;
int i147 = i98;
int i148 = 0;
while (i148 < i147) {
d35 += dArr18[i143][i148] * dArr3[length / dArr3[0].length][length % dArr3[0].length];
length++;
i148++;
i143 = i143;
i141 = i141;
}
dArr20[0 + (i142 * i) + i22] = d35;
i142++;
i140 = i148;
i98 = i147;
length = i144;
i131 = i145;
}
i11 = i131;
i22++;
ssrc = this;
i126 = i141;
i102 = i127;
i125 = i142;
i21 = i140;
}
int i149 = i98;
int i150 = i102;
int i151 = i109 + ((i19 / i5) * i125);
byteBuffer.clear();
if (z) {
i21 = 0;
while (i21 < i125 * i) {
double d36 = dArr20[i21] > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE ? dArr20[i21] : -dArr20[i21];
if (dArr11[0] >= d36) {
d36 = dArr11[0];
}
dArr11[0] = d36;
byteBuffer.asDoubleBuffer().put(i21, dArr20[i21]);
i21++;
}
} else {
if (i3 == 1) {
i23 = i103;
i24 = i150;
i25 = i149;
i26 = i126;
i27 = i20;
dArr4 = dArr19;
i28 = i100;
d6 = d25;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i152 = i99;
byteBuffer4 = byteBuffer2;
i29 = i152;
double d37 = d * 127.0d;
i30 = 0;
int i153 = 0;
while (i30 < i125 * i) {
if (i7 != 0) {
RINT = do_shaping(dArr20[i30] * d37, dArr11, i7, i153);
} else {
RINT = ssrc2.RINT(dArr20[i30] * d37);
if (RINT < -128) {
double d38 = RINT;
Double.isNaN(d38);
double d39 = d38 / (-128.0d);
c = 0;
if (dArr11[0] >= d39) {
d39 = dArr11[0];
}
dArr11[0] = d39;
RINT = -128;
} else {
c = 0;
}
if (127 < RINT) {
double d40 = RINT;
Double.isNaN(d40);
double d41 = d40 / 127.0d;
if (dArr11[c] >= d41) {
d41 = dArr11[c];
}
dArr11[c] = d41;
RINT = 127;
}
}
byteBuffer3.put(i30, (byte) (RINT + 128));
int i154 = i153 + 1;
i153 = i154 == i ? 0 : i154;
i30++;
}
} else if (i3 == 2) {
i23 = i103;
i24 = i150;
i25 = i149;
i26 = i126;
i27 = i20;
dArr4 = dArr19;
i28 = i100;
d6 = d25;
ByteBuffer byteBuffer8 = byteBuffer;
ssrc2 = this;
int i155 = i99;
byteBuffer4 = byteBuffer2;
i29 = i155;
double d42 = d * 32767.0d;
int i156 = 0;
int i157 = 0;
while (i156 < i125 * i) {
if (i7 != 0) {
i32 = i156;
byteBuffer5 = byteBuffer8;
RINT2 = do_shaping(dArr20[i156] * d42, dArr11, i7, i157);
} else {
i32 = i156;
byteBuffer5 = byteBuffer8;
RINT2 = ssrc2.RINT(dArr20[i32] * d42);
if (RINT2 < -32768) {
double d43 = RINT2;
Double.isNaN(d43);
double d44 = d43 / (-32768.0d);
c2 = 0;
if (dArr11[0] >= d44) {
d44 = dArr11[0];
}
dArr11[0] = d44;
RINT2 = -32768;
} else {
c2 = 0;
}
if (32767 < RINT2) {
double d45 = RINT2;
Double.isNaN(d45);
double d46 = d45 / 32767.0d;
if (dArr11[c2] >= d46) {
d46 = dArr11[c2];
}
dArr11[c2] = d46;
RINT2 = 32767;
}
}
byteBuffer5.order(ssrc2.byteOrder).asShortBuffer().put(i32, (short) RINT2);
int i158 = i157 + 1;
i157 = i158 == i ? 0 : i158;
i156 = i32 + 1;
byteBuffer8 = byteBuffer5;
}
i30 = i156;
byteBuffer3 = byteBuffer8;
} else if (i3 == 3) {
double d47 = d * 8388607.0d;
int i159 = 0;
int i160 = 0;
while (i159 < i125 * i) {
if (i7 != 0) {
i34 = i159;
i37 = i126;
i38 = i20;
dArr5 = dArr19;
d7 = d25;
int i161 = i99;
byteBuffer6 = byteBuffer2;
i40 = i161;
i33 = i103;
i35 = i150;
i39 = i100;
i36 = i149;
RINT3 = do_shaping(dArr20[i159] * d47, dArr11, i7, i160);
} else {
i33 = i103;
i34 = i159;
i35 = i150;
i36 = i149;
i37 = i126;
i38 = i20;
dArr5 = dArr19;
i39 = i100;
d7 = d25;
int i162 = i99;
byteBuffer6 = byteBuffer2;
i40 = i162;
RINT3 = RINT(dArr20[i34] * d47);
if (RINT3 < -8388608) {
double d48 = RINT3;
Double.isNaN(d48);
double d49 = d48 / (-8388608.0d);
c3 = 0;
if (dArr11[0] >= d49) {
d49 = dArr11[0];
}
dArr11[0] = d49;
RINT3 = -8388608;
} else {
c3 = 0;
}
if (8388607 < RINT3) {
double d50 = RINT3;
Double.isNaN(d50);
double d51 = d50 / 8388607.0d;
if (dArr11[c3] >= d51) {
d51 = dArr11[c3];
}
dArr11[c3] = d51;
RINT3 = 8388607;
}
}
int i163 = i34 * 3;
ByteBuffer byteBuffer9 = byteBuffer;
byteBuffer9.put(i163, (byte) (RINT3 & 255));
int i164 = RINT3 >> 8;
byteBuffer9.put(i163 + 1, (byte) (i164 & 255));
byteBuffer9.put(i163 + 2, (byte) ((i164 >> 8) & 255));
int i165 = i160 + 1;
i160 = i165 == i ? 0 : i165;
i159 = i34 + 1;
byteBuffer = byteBuffer9;
i126 = i37;
d25 = d7;
dArr19 = dArr5;
i20 = i38;
i103 = i33;
i100 = i39;
i149 = i36;
i150 = i35;
ByteBuffer byteBuffer10 = byteBuffer6;
i99 = i40;
byteBuffer2 = byteBuffer10;
}
i23 = i103;
i24 = i150;
i25 = i149;
i26 = i126;
i27 = i20;
dArr4 = dArr19;
i28 = i100;
d6 = d25;
ssrc2 = this;
int i166 = i99;
byteBuffer4 = byteBuffer2;
i29 = i166;
i31 = i159;
byteBuffer3 = byteBuffer;
if (z2) {
dArr6 = dArr20;
i41 = i120;
i42 = i18;
if (i125 < i117) {
i104 = i117 - i125;
} else if (z3) {
double d52 = i124;
Double.isNaN(d52);
Double.isNaN(d3);
Double.isNaN(d6);
double d53 = (d52 * d3) / d6;
if (d53 + 2.0d > (i42 + i125) - i117) {
byteBuffer3.position(i23 * i117);
int i167 = i125 - i117;
byteBuffer3.limit(i23 * i167);
ssrc2.writeBuffers(outputStream, byteBuffer3);
i42 += i167;
i104 = i117;
} else {
byteBuffer3.position(i23 * i117);
double d54 = i42;
Double.isNaN(d54);
double floor = Math.floor(d53) + 2.0d + d54;
double d55 = i125;
Double.isNaN(d55);
double d56 = i117;
Double.isNaN(d56);
Double.isNaN(d5);
byteBuffer3.limit((int) (d5 * ((floor + d55) - d56)));
ssrc2.writeBuffers(outputStream, byteBuffer3);
break;
}
} else {
byteBuffer3.position(i23 * i117);
byteBuffer3.limit(i23 * i125);
ssrc2.writeBuffers(outputStream, byteBuffer3);
i42 += i125 - i117;
i104 = i117;
z2 = false;
}
} else {
if (z3) {
double d57 = i124;
Double.isNaN(d57);
Double.isNaN(d3);
Double.isNaN(d6);
double d58 = (d57 * d3) / d6;
i48 = i18 + i125;
dArr6 = dArr20;
i41 = i120;
if (d58 + 2.0d > i48) {
byteBuffer3.position(0);
byteBuffer3.limit(i23 * i125);
ssrc2.writeBuffers(outputStream, byteBuffer3);
} else {
byteBuffer3.position(0);
double d59 = i18;
Double.isNaN(d59);
Double.isNaN(d5);
int floor2 = (int) (d5 * ((Math.floor(d58) + 2.0d) - d59));
if (floor2 > 0) {
byteBuffer3.limit(floor2);
ssrc2.writeBuffers(outputStream, byteBuffer3);
}
}
} else {
dArr6 = dArr20;
i41 = i120;
byteBuffer3.position(0);
byteBuffer3.limit(i23 * i125);
ssrc2.writeBuffers(outputStream, byteBuffer3);
i48 = i18 + i125;
}
i42 = i48;
i104 = i117;
}
int i168 = i19 / i69;
i43 = (i151 - 1) / i168;
i44 = i24;
if (i43 > i44) {
i43 = i44;
}
i45 = 0;
while (i45 < i) {
System.arraycopy(dArr3[i45], i43, dArr3[i45], 0, i94 - i43);
i45++;
i31 = i31;
i42 = i42;
}
int i169 = i31;
int i170 = i42;
i109 = i151 - (i43 * i168);
for (i46 = 0; i46 < i; i46++) {
System.arraycopy(dArr16[i46], i44, dArr3[i46], i29, i44);
}
int i171 = i112 + 1;
if ((i112 & 7) == 7) {
double d60 = i124;
i47 = i41;
double d61 = i47;
Double.isNaN(d60);
Double.isNaN(d61);
ssrc2.showprogress(d60 / d61);
} else {
i47 = i41;
}
i105 = i169;
i111 = i47;
i112 = i171;
i106 = i124;
i102 = i44;
dArr20 = dArr6;
allocate2 = byteBuffer3;
i108 = i170;
i107 = i26;
byteBuffer7 = byteBuffer4;
d25 = d6;
dArr19 = dArr4;
i72 = i27;
i103 = i23;
i100 = i28;
i98 = i25;
d28 = d5;
dArr17 = dArr3;
i110 = i125;
i99 = i29;
i15 = i19;
i97 = i2;
}
i31 = i30;
if (z2) {
}
int i1682 = i19 / i69;
i43 = (i151 - 1) / i1682;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i1692 = i31;
int i1702 = i42;
i109 = i151 - (i43 * i1682);
while (i46 < i) {
}
int i1712 = i112 + 1;
if ((i112 & 7) == 7) {
}
i105 = i1692;
i111 = i47;
i112 = i1712;
i106 = i124;
i102 = i44;
dArr20 = dArr6;
allocate2 = byteBuffer3;
i108 = i1702;
i107 = i26;
byteBuffer7 = byteBuffer4;
d25 = d6;
dArr19 = dArr4;
i72 = i27;
i103 = i23;
i100 = i28;
i98 = i25;
d28 = d5;
dArr17 = dArr3;
i110 = i125;
i99 = i29;
i15 = i19;
i97 = i2;
}
i23 = i103;
i31 = i21;
i24 = i150;
i25 = i149;
i26 = i126;
i27 = i20;
dArr4 = dArr19;
i28 = i100;
d6 = d25;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i172 = i99;
byteBuffer4 = byteBuffer2;
i29 = i172;
if (z2) {
}
int i16822 = i19 / i69;
i43 = (i151 - 1) / i16822;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i16922 = i31;
int i17022 = i42;
i109 = i151 - (i43 * i16822);
while (i46 < i) {
}
int i17122 = i112 + 1;
if ((i112 & 7) == 7) {
}
i105 = i16922;
i111 = i47;
i112 = i17122;
i106 = i124;
i102 = i44;
dArr20 = dArr6;
allocate2 = byteBuffer3;
i108 = i17022;
i107 = i26;
byteBuffer7 = byteBuffer4;
d25 = d6;
dArr19 = dArr4;
i72 = i27;
i103 = i23;
i100 = i28;
i98 = i25;
d28 = d5;
dArr17 = dArr3;
i110 = i125;
i99 = i29;
i15 = i19;
i97 = i2;
} else {
i21 = 0;
while (i21 < i121 * i) {
int i173 = i15;
double d62 = wrap.order(this.byteOrder).getInt(i21);
Double.isNaN(d62);
dArr19[(i * 0) + i21] = d62 * 4.656612875245797E-10d;
i21++;
d28 = d28;
i15 = i173;
allocate2 = allocate2;
}
ssrc = this;
i19 = i15;
byteBuffer = allocate2;
d5 = d28;
byteBuffer2 = wrap;
i18 = i108;
i20 = i72;
}
dArr3 = dArr17;
while (i21 < i * i113) {
}
int i1242 = i106 + i121;
if (inputStream.available() >= 0) {
}
int i1252 = i110;
int i1262 = i118;
i22 = 0;
while (i22 < i) {
}
int i1492 = i98;
int i1502 = i102;
int i1512 = i109 + ((i19 / i5) * i1252);
byteBuffer.clear();
if (z) {
}
i23 = i103;
i31 = i21;
i24 = i1502;
i25 = i1492;
i26 = i1262;
i27 = i20;
dArr4 = dArr19;
i28 = i100;
d6 = d25;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i1722 = i99;
byteBuffer4 = byteBuffer2;
i29 = i1722;
if (z2) {
}
int i168222 = i19 / i69;
i43 = (i1512 - 1) / i168222;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i169222 = i31;
int i170222 = i42;
i109 = i1512 - (i43 * i168222);
while (i46 < i) {
}
int i171222 = i112 + 1;
if ((i112 & 7) == 7) {
}
i105 = i169222;
i111 = i47;
i112 = i171222;
i106 = i1242;
i102 = i44;
dArr20 = dArr6;
allocate2 = byteBuffer3;
i108 = i170222;
i107 = i26;
byteBuffer7 = byteBuffer4;
d25 = d6;
dArr19 = dArr4;
i72 = i27;
i103 = i23;
i100 = i28;
i98 = i25;
d28 = d5;
dArr17 = dArr3;
i110 = i1252;
i99 = i29;
i15 = i19;
i97 = i2;
} else {
ssrc = this;
i18 = i108;
i19 = i15;
byteBuffer = allocate2;
d5 = d28;
i20 = i72;
i21 = 0;
while (i21 < i121 * i) {
double[][] dArr22 = dArr17;
double d63 = wrap.order(ssrc.byteOrder).asShortBuffer().get(i21);
Double.isNaN(d63);
dArr19[(i * 0) + i21] = d63 * 3.051850947599719E-5d;
i21++;
dArr17 = dArr22;
}
dArr3 = dArr17;
}
byteBuffer2 = wrap;
while (i21 < i * i113) {
}
int i12422 = i106 + i121;
if (inputStream.available() >= 0) {
}
int i12522 = i110;
int i12622 = i118;
i22 = 0;
while (i22 < i) {
}
int i14922 = i98;
int i15022 = i102;
int i15122 = i109 + ((i19 / i5) * i12522);
byteBuffer.clear();
if (z) {
}
i23 = i103;
i31 = i21;
i24 = i15022;
i25 = i14922;
i26 = i12622;
i27 = i20;
dArr4 = dArr19;
i28 = i100;
d6 = d25;
byteBuffer3 = byteBuffer;
ssrc2 = this;
int i17222 = i99;
byteBuffer4 = byteBuffer2;
i29 = i17222;
if (z2) {
}
int i1682222 = i19 / i69;
i43 = (i15122 - 1) / i1682222;
i44 = i24;
if (i43 > i44) {
}
i45 = 0;
while (i45 < i) {
}
int i1692222 = i31;
int i1702222 = i42;
i109 = i15122 - (i43 * i1682222);
while (i46 < i) {
}
int i1712222 = i112 + 1;
if ((i112 & 7) == 7) {
}
i105 = i1692222;
i111 = i47;
i112 = i1712222;
i106 = i12422;
i102 = i44;
dArr20 = dArr6;
allocate2 = byteBuffer3;
i108 = i1702222;
i107 = i26;
byteBuffer7 = byteBuffer4;
d25 = d6;
dArr19 = dArr4;
i72 = i27;
i103 = i23;
i100 = i28;
i98 = i25;
d28 = d5;
dArr17 = dArr3;
i110 = i12522;
i99 = i29;
i15 = i19;
i97 = 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++;
i31 = Integer.parseInt(strArr[i29]);
} else if (strArr[i29].equals("--att")) {
i29++;
d11 = Float.parseFloat(strArr[i29]);
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];
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];
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;
i31 = i31;
} else {
i31 = i31;
if (!strArr[i29].equals("standard")) {
throw new IllegalArgumentException("unrecognized profile : " + strArr[i29]);
}
}
} else {
throw new IllegalArgumentException("unrecognized option : " + strArr[i29]);
}
i29 = i27;
i31 = i31;
}
i29 += i26;
i28 = 0;
i31 = i31;
}
i26 = 1;
i29 += i26;
i28 = 0;
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) {
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);
}
} 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) {
i15 = 0;
dArr2[0] = downsample(inputStream, outputStream, i5, i3, i12, i, i11, Math.pow(10.0d, (-d9) / 20.0d), (i6 / i3) / i14, false, i9);
} else {
i15 = 0;
dArr2[0] = no_src(inputStream, outputStream, i5, i3, i12, Math.pow(10.0d, (-d9) / 20.0d), (i6 / i3) / i14, false, i9);
}
}
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) {
}
}
}