package defpackage;

import android.graphics.Bitmap;
import android.util.Log;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;

/* renamed from: ᵚᵩᵘ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2693 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public byte[] f10430;

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final int f10431;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public C1130 f10432;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public byte[] f10433;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public short[] f10434;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final C2720 f10435;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public byte[] f10436;

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public Boolean f10437;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final int f10438;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public int[] f10439;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final boolean f10441;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public Bitmap f10442;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public int f10443;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final int[] f10445;

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public final int f10446;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public int f10447;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public byte[] f10448;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public ByteBuffer f10449;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int[] f10444 = new int[256];

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public Bitmap.Config f10440 = Bitmap.Config.ARGB_8888;

    public C2693(C2720 c2720, C1130 c1130, ByteBuffer byteBuffer, int i) {
        this.f10435 = c2720;
        this.f10432 = new C1130();
        synchronized (this) {
            try {
                if (i <= 0) {
                    throw new IllegalArgumentException("Sample size must be >=0, not: " + i);
                }
                int iHighestOneBit = Integer.highestOneBit(i);
                int i2 = 0;
                this.f10443 = 0;
                this.f10432 = c1130;
                this.f10447 = -1;
                ByteBuffer byteBufferAsReadOnlyBuffer = byteBuffer.asReadOnlyBuffer();
                this.f10449 = byteBufferAsReadOnlyBuffer;
                byteBufferAsReadOnlyBuffer.position(0);
                this.f10449.order(ByteOrder.LITTLE_ENDIAN);
                this.f10441 = false;
                ArrayList arrayList = c1130.f4846;
                int size = arrayList.size();
                while (true) {
                    if (i2 >= size) {
                        break;
                    }
                    Object obj = arrayList.get(i2);
                    i2++;
                    if (((C5332) obj).f19963 == 3) {
                        this.f10441 = true;
                        break;
                    }
                }
                this.f10431 = iHighestOneBit;
                int i3 = c1130.f4848;
                this.f10446 = i3 / iHighestOneBit;
                int i4 = c1130.f4847;
                this.f10438 = i4 / iHighestOneBit;
                int i5 = i3 * i4;
                C4805 c4805 = (C4805) this.f10435.f10550;
                this.f10436 = c4805 == null ? new byte[i5] : (byte[]) c4805.m10120(i5, byte[].class);
                C2720 c27202 = this.f10435;
                int i6 = this.f10446 * this.f10438;
                C4805 c48052 = (C4805) c27202.f10550;
                this.f10445 = c48052 == null ? new int[i6] : (int[]) c48052.m10120(i6, int[].class);
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m6705(Bitmap.Config config) {
        Bitmap.Config config2;
        Bitmap.Config config3 = Bitmap.Config.ARGB_8888;
        if (config == config3 || config == (config2 = Bitmap.Config.RGB_565)) {
            this.f10440 = config;
            return;
        }
        throw new IllegalArgumentException("Unsupported format: " + config + ", must be one of " + config3 + " or " + config2);
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final Bitmap m6706() {
        Boolean bool = this.f10437;
        Bitmap bitmapMo5788 = ((InterfaceC2157) this.f10435.f10548).mo5788(this.f10446, this.f10438, (bool == null || bool.booleanValue()) ? Bitmap.Config.ARGB_8888 : this.f10440);
        bitmapMo5788.setHasAlpha(true);
        return bitmapMo5788;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final synchronized Bitmap m6707() {
        try {
            if (this.f10432.f4849 <= 0 || this.f10447 < 0) {
                if (Log.isLoggable("ᵚᵩᵘ", 3)) {
                    int i = this.f10432.f4849;
                }
                this.f10443 = 1;
            }
            int i2 = this.f10443;
            if (i2 != 1 && i2 != 2) {
                this.f10443 = 0;
                if (this.f10430 == null) {
                    C4805 c4805 = (C4805) this.f10435.f10550;
                    this.f10430 = c4805 == null ? new byte[255] : (byte[]) c4805.m10120(255, byte[].class);
                }
                C5332 c5332 = (C5332) this.f10432.f4846.get(this.f10447);
                int i3 = this.f10447 - 1;
                C5332 c53322 = i3 >= 0 ? (C5332) this.f10432.f4846.get(i3) : null;
                int[] iArr = c5332.f19970;
                if (iArr == null) {
                    iArr = this.f10432.f4851;
                }
                this.f10439 = iArr;
                if (iArr == null) {
                    Log.isLoggable("ᵚᵩᵘ", 3);
                    this.f10443 = 1;
                    return null;
                }
                if (c5332.f19964) {
                    System.arraycopy(iArr, 0, this.f10444, 0, iArr.length);
                    int[] iArr2 = this.f10444;
                    this.f10439 = iArr2;
                    iArr2[c5332.f19971] = 0;
                    if (c5332.f19963 == 2 && this.f10447 == 0) {
                        this.f10437 = Boolean.TRUE;
                    }
                }
                return m6708(c5332, c53322);
            }
            Log.isLoggable("ᵚᵩᵘ", 3);
            return null;
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:100:0x01e7 A[PHI: r7
      0x01e7: PHI (r7v18 int) = (r7v12 int), (r7v20 int), (r7v20 int) binds: [B:95:0x01d3, B:97:0x01de, B:98:0x01e0] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:26:0x004b  */
    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final android.graphics.Bitmap m6708(defpackage.C5332 r37, defpackage.C5332 r38) {
        /*
            Method dump skipped, instructions count: 1062
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C2693.m6708(ᵽˁˆᵼ, ᵽˁˆᵼ):android.graphics.Bitmap");
    }
}
