package o; /* loaded from: classes2.dex */ public final class YDE extends AbstractC13394fZQ { private final int b; private final int d; private final int e; private final int g; private final byte[] i; public YDE(int i, int i2, int[] iArr) { super(i, i2); this.d = i; this.b = i2; this.e = 0; this.g = 0; int i3 = i * i2; this.i = new byte[i3]; for (int i4 = 0; i4 < i3; i4++) { int i5 = iArr[i4]; this.i[i4] = (byte) (((((i5 >> 16) & 255) + ((i5 >> 7) & 510)) + (i5 & 255)) / 4); } } @Override // o.AbstractC13394fZQ public final byte[] c() { int i = this.a; int i2 = this.c; int i3 = this.d; if (i == i3 && i2 == this.b) { return this.i; } int i4 = i * i2; byte[] bArr = new byte[i4]; int i5 = (this.g * i3) + this.e; if (i == i3) { System.arraycopy(this.i, i5, bArr, 0, i4); return bArr; } for (int i6 = 0; i6 < i2; i6++) { System.arraycopy(this.i, i5, bArr, i6 * i, i); i5 += this.d; } return bArr; } @Override // o.AbstractC13394fZQ public final byte[] a(int i, byte[] bArr) { if (i < 0 || i >= this.c) { throw new IllegalArgumentException("Requested row is outside the image: ".concat(String.valueOf(i))); } int i2 = this.a; if (bArr == null || bArr.length < i2) { bArr = new byte[i2]; } System.arraycopy(this.i, i * this.d, bArr, 0, i2); return bArr; } }