package o; import android.util.Log; import com.google.common.primitives.UnsignedBytes; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; /* loaded from: classes.dex */ public final class tHq { public ByteBuffer a; public OPq c; public final byte[] e = new byte[256]; public int b = 0; public final int[] d(int i) { byte[] bArr = new byte[i * 3]; int[] iArr = null; try { this.a.get(bArr); iArr = new int[256]; int i2 = 0; int i3 = 0; while (i3 < i) { byte b = bArr[i2]; byte b2 = bArr[i2 + 1]; int i4 = i2 + 3; iArr[i3] = (bArr[i2 + 2] & UnsignedBytes.MAX_VALUE) | ((b & UnsignedBytes.MAX_VALUE) << 16) | (-16777216) | ((b2 & UnsignedBytes.MAX_VALUE) << 8); i3++; i2 = i4; } } catch (BufferUnderflowException unused) { this.c.f8302o = 1; } return iArr; } public final void e() { int d; do { d = d(); this.a.position(Math.min(this.a.position() + d, this.a.limit())); } while (d > 0); } public final void b() { int d = d(); this.b = d; if (d <= 0) { return; } int i = 0; while (true) { try { int i2 = this.b; if (i >= i2) { return; } int i3 = i2 - i; this.a.get(this.e, i, i3); i += i3; } catch (Exception unused) { Log.isLoggable("GifHeaderParser", 3); this.c.f8302o = 1; return; } } } public final int d() { try { return this.a.get() & UnsignedBytes.MAX_VALUE; } catch (Exception unused) { this.c.f8302o = 1; return 0; } } }