200 lines
7.7 KiB
Java
200 lines
7.7 KiB
Java
package c.i.a.c.e2.o;
|
|
|
|
import android.graphics.Bitmap;
|
|
import androidx.annotation.Nullable;
|
|
import c.i.a.c.e2.c;
|
|
import c.i.a.c.e2.d;
|
|
import c.i.a.c.e2.f;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.i2.w;
|
|
import com.google.android.exoplayer2.text.SubtitleDecoderException;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.Objects;
|
|
import java.util.zip.Inflater;
|
|
/* compiled from: PgsDecoder */
|
|
public final class a extends d {
|
|
public final w n = new w();
|
|
public final w o = new w();
|
|
public final C0090a p = new C0090a();
|
|
@Nullable
|
|
public Inflater q;
|
|
|
|
/* compiled from: PgsDecoder */
|
|
/* renamed from: c.i.a.c.e2.o.a$a reason: collision with other inner class name */
|
|
public static final class C0090a {
|
|
public final w a = new w();
|
|
public final int[] b = new int[256];
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public boolean f839c;
|
|
public int d;
|
|
public int e;
|
|
public int f;
|
|
public int g;
|
|
public int h;
|
|
public int i;
|
|
|
|
public void a() {
|
|
this.d = 0;
|
|
this.e = 0;
|
|
this.f = 0;
|
|
this.g = 0;
|
|
this.h = 0;
|
|
this.i = 0;
|
|
this.a.z(0);
|
|
this.f839c = false;
|
|
}
|
|
}
|
|
|
|
public a() {
|
|
super("PgsDecoder");
|
|
}
|
|
|
|
/* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
|
|
@Override // c.i.a.c.e2.d
|
|
public f j(byte[] bArr, int i, boolean z2) throws SubtitleDecoderException {
|
|
c cVar;
|
|
w wVar;
|
|
w wVar2;
|
|
int i2;
|
|
int i3;
|
|
int u;
|
|
a aVar = this;
|
|
w wVar3 = aVar.n;
|
|
wVar3.a = bArr;
|
|
wVar3.f913c = i;
|
|
int i4 = 0;
|
|
wVar3.b = 0;
|
|
if (wVar3.a() > 0 && wVar3.c() == 120) {
|
|
if (aVar.q == null) {
|
|
aVar.q = new Inflater();
|
|
}
|
|
if (f0.x(wVar3, aVar.o, aVar.q)) {
|
|
w wVar4 = aVar.o;
|
|
wVar3.B(wVar4.a, wVar4.f913c);
|
|
}
|
|
}
|
|
aVar.p.a();
|
|
ArrayList arrayList = new ArrayList();
|
|
while (aVar.n.a() >= 3) {
|
|
w wVar5 = aVar.n;
|
|
C0090a aVar2 = aVar.p;
|
|
int i5 = wVar5.f913c;
|
|
int s2 = wVar5.s();
|
|
int x2 = wVar5.x();
|
|
int i6 = wVar5.b + x2;
|
|
if (i6 > i5) {
|
|
wVar5.D(i5);
|
|
cVar = null;
|
|
} else {
|
|
if (s2 != 128) {
|
|
switch (s2) {
|
|
case 20:
|
|
Objects.requireNonNull(aVar2);
|
|
if (x2 % 5 == 2) {
|
|
wVar5.E(2);
|
|
Arrays.fill(aVar2.b, i4);
|
|
int i7 = x2 / 5;
|
|
int i8 = 0;
|
|
while (i8 < i7) {
|
|
int s3 = wVar5.s();
|
|
double s4 = (double) wVar5.s();
|
|
double s5 = (double) (wVar5.s() - 128);
|
|
arrayList = arrayList;
|
|
double s6 = (double) (wVar5.s() - 128);
|
|
aVar2.b[s3] = (f0.h((int) ((1.402d * s5) + s4), 0, 255) << 16) | (wVar5.s() << 24) | (f0.h((int) ((s4 - (0.34414d * s6)) - (s5 * 0.71414d)), 0, 255) << 8) | f0.h((int) ((s6 * 1.772d) + s4), 0, 255);
|
|
i8++;
|
|
wVar5 = wVar5;
|
|
}
|
|
wVar = wVar5;
|
|
aVar2.f839c = true;
|
|
break;
|
|
}
|
|
wVar = wVar5;
|
|
break;
|
|
case 21:
|
|
Objects.requireNonNull(aVar2);
|
|
if (x2 >= 4) {
|
|
wVar5.E(3);
|
|
int i9 = x2 - 4;
|
|
if ((wVar5.s() & 128) != 0) {
|
|
if (i9 >= 7 && (u = wVar5.u()) >= 4) {
|
|
aVar2.h = wVar5.x();
|
|
aVar2.i = wVar5.x();
|
|
aVar2.a.z(u - 4);
|
|
i9 -= 7;
|
|
}
|
|
}
|
|
w wVar6 = aVar2.a;
|
|
int i10 = wVar6.b;
|
|
int i11 = wVar6.f913c;
|
|
if (i10 < i11 && i9 > 0) {
|
|
int min = Math.min(i9, i11 - i10);
|
|
wVar5.e(aVar2.a.a, i10, min);
|
|
aVar2.a.D(i10 + min);
|
|
}
|
|
}
|
|
wVar = wVar5;
|
|
break;
|
|
case 22:
|
|
Objects.requireNonNull(aVar2);
|
|
if (x2 >= 19) {
|
|
aVar2.d = wVar5.x();
|
|
aVar2.e = wVar5.x();
|
|
wVar5.E(11);
|
|
aVar2.f = wVar5.x();
|
|
aVar2.g = wVar5.x();
|
|
}
|
|
wVar = wVar5;
|
|
break;
|
|
default:
|
|
wVar = wVar5;
|
|
break;
|
|
}
|
|
cVar = null;
|
|
} else {
|
|
wVar = wVar5;
|
|
if (aVar2.d == 0 || aVar2.e == 0 || aVar2.h == 0 || aVar2.i == 0 || (i2 = (wVar2 = aVar2.a).f913c) == 0 || wVar2.b != i2 || !aVar2.f839c) {
|
|
cVar = null;
|
|
} else {
|
|
wVar2.D(0);
|
|
int i12 = aVar2.h * aVar2.i;
|
|
int[] iArr = new int[i12];
|
|
int i13 = 0;
|
|
while (i13 < i12) {
|
|
int s7 = aVar2.a.s();
|
|
if (s7 != 0) {
|
|
i3 = i13 + 1;
|
|
iArr[i13] = aVar2.b[s7];
|
|
} else {
|
|
int s8 = aVar2.a.s();
|
|
if (s8 != 0) {
|
|
i3 = ((s8 & 64) == 0 ? s8 & 63 : ((s8 & 63) << 8) | aVar2.a.s()) + i13;
|
|
Arrays.fill(iArr, i13, i3, (s8 & 128) == 0 ? 0 : aVar2.b[aVar2.a.s()]);
|
|
}
|
|
}
|
|
i13 = i3;
|
|
}
|
|
Bitmap createBitmap = Bitmap.createBitmap(iArr, aVar2.h, aVar2.i, Bitmap.Config.ARGB_8888);
|
|
float f = (float) aVar2.d;
|
|
float f2 = ((float) aVar2.f) / f;
|
|
float f3 = (float) aVar2.e;
|
|
cVar = new c(null, null, createBitmap, ((float) aVar2.g) / f3, 0, 0, f2, 0, Integer.MIN_VALUE, -3.4028235E38f, ((float) aVar2.h) / f, ((float) aVar2.i) / f3, false, -16777216, Integer.MIN_VALUE, 0.0f, null);
|
|
}
|
|
aVar2.a();
|
|
}
|
|
wVar.D(i6);
|
|
}
|
|
if (cVar != null) {
|
|
arrayList.add(cVar);
|
|
}
|
|
arrayList = arrayList;
|
|
i4 = 0;
|
|
aVar = this;
|
|
}
|
|
return new b(Collections.unmodifiableList(arrayList));
|
|
}
|
|
}
|