179 lines
3.9 KiB
Java
179 lines
3.9 KiB
Java
package c.i.a.c.i2;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
/* compiled from: ParsableNalUnitBitArray */
|
|
public final class x {
|
|
public byte[] a;
|
|
public int b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public int f914c;
|
|
public int d = 0;
|
|
|
|
public x(byte[] bArr, int i, int i2) {
|
|
this.a = bArr;
|
|
this.f914c = i;
|
|
this.b = i2;
|
|
a();
|
|
}
|
|
|
|
public final void a() {
|
|
int i;
|
|
int i2 = this.f914c;
|
|
AnimatableValueParser.D(i2 >= 0 && (i2 < (i = this.b) || (i2 == i && this.d == 0)));
|
|
}
|
|
|
|
public boolean b(int i) {
|
|
int i2 = this.f914c;
|
|
int i3 = i / 8;
|
|
int i4 = i2 + i3;
|
|
int i5 = (this.d + i) - (i3 * 8);
|
|
if (i5 > 7) {
|
|
i4++;
|
|
i5 -= 8;
|
|
}
|
|
while (true) {
|
|
i2++;
|
|
if (i2 > i4 || i4 >= this.b) {
|
|
break;
|
|
} else if (i(i2)) {
|
|
i4++;
|
|
i2 += 2;
|
|
}
|
|
}
|
|
int i6 = this.b;
|
|
if (i4 >= i6) {
|
|
return i4 == i6 && i5 == 0;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public boolean c() {
|
|
int i = this.f914c;
|
|
int i2 = this.d;
|
|
int i3 = 0;
|
|
while (this.f914c < this.b && !d()) {
|
|
i3++;
|
|
}
|
|
boolean z2 = this.f914c == this.b;
|
|
this.f914c = i;
|
|
this.d = i2;
|
|
return !z2 && b((i3 * 2) + 1);
|
|
}
|
|
|
|
public boolean d() {
|
|
boolean z2 = (this.a[this.f914c] & (128 >> this.d)) != 0;
|
|
j();
|
|
return z2;
|
|
}
|
|
|
|
public int e(int i) {
|
|
int i2;
|
|
int i3;
|
|
this.d += i;
|
|
int i4 = 0;
|
|
while (true) {
|
|
i2 = this.d;
|
|
i3 = 2;
|
|
if (i2 <= 8) {
|
|
break;
|
|
}
|
|
int i5 = i2 - 8;
|
|
this.d = i5;
|
|
byte[] bArr = this.a;
|
|
int i6 = this.f914c;
|
|
i4 |= (bArr[i6] & 255) << i5;
|
|
if (!i(i6 + 1)) {
|
|
i3 = 1;
|
|
}
|
|
this.f914c = i6 + i3;
|
|
}
|
|
byte[] bArr2 = this.a;
|
|
int i7 = this.f914c;
|
|
int i8 = (-1 >>> (32 - i)) & (i4 | ((bArr2[i7] & 255) >> (8 - i2)));
|
|
if (i2 == 8) {
|
|
this.d = 0;
|
|
if (!i(i7 + 1)) {
|
|
i3 = 1;
|
|
}
|
|
this.f914c = i7 + i3;
|
|
}
|
|
a();
|
|
return i8;
|
|
}
|
|
|
|
public final int f() {
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (!d()) {
|
|
i2++;
|
|
}
|
|
int i3 = (1 << i2) - 1;
|
|
if (i2 > 0) {
|
|
i = e(i2);
|
|
}
|
|
return i3 + i;
|
|
}
|
|
|
|
public int g() {
|
|
int f = f();
|
|
return ((f + 1) / 2) * (f % 2 == 0 ? -1 : 1);
|
|
}
|
|
|
|
public void h(byte[] bArr, int i, int i2) {
|
|
this.a = bArr;
|
|
this.f914c = i;
|
|
this.b = i2;
|
|
this.d = 0;
|
|
a();
|
|
}
|
|
|
|
public final boolean i(int i) {
|
|
if (2 <= i && i < this.b) {
|
|
byte[] bArr = this.a;
|
|
if (bArr[i] == 3 && bArr[i - 2] == 0 && bArr[i - 1] == 0) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void j() {
|
|
int i = 1;
|
|
int i2 = this.d + 1;
|
|
this.d = i2;
|
|
if (i2 == 8) {
|
|
this.d = 0;
|
|
int i3 = this.f914c;
|
|
if (i(i3 + 1)) {
|
|
i = 2;
|
|
}
|
|
this.f914c = i3 + i;
|
|
}
|
|
a();
|
|
}
|
|
|
|
public void k(int i) {
|
|
int i2 = this.f914c;
|
|
int i3 = i / 8;
|
|
int i4 = i2 + i3;
|
|
this.f914c = i4;
|
|
int i5 = (i - (i3 * 8)) + this.d;
|
|
this.d = i5;
|
|
if (i5 > 7) {
|
|
this.f914c = i4 + 1;
|
|
this.d = i5 - 8;
|
|
}
|
|
while (true) {
|
|
i2++;
|
|
if (i2 > this.f914c) {
|
|
a();
|
|
return;
|
|
} else if (i(i2)) {
|
|
this.f914c++;
|
|
i2 += 2;
|
|
}
|
|
}
|
|
}
|
|
}
|