package com.google.android.gms.internal.ads;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.SparseArray;
import androidx.annotation.Nullable;
import androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection;
import java.util.ArrayList;
import java.util.List;

/* JADX INFO: loaded from: classes2.dex */
public final class u8 implements j8 {

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static final byte[] f17123h = {0, 7, 8, 15};

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public static final byte[] f17124i = {0, 119, -120, -1};

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public static final byte[] f17125j = {0, 17, 34, 51, 68, 85, 102, 119, -120, -103, -86, -69, -52, -35, -18, -1};

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Paint f17126a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Paint f17127b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Canvas f17128c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final n8 f17129d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final m8 f17130e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final t8 f17131f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Bitmap f17132g;

    public u8(List list) {
        p01 p01Var = new p01((byte[]) list.get(0));
        int iJ = p01Var.J();
        int iJ2 = p01Var.J();
        Paint paint = new Paint();
        this.f17126a = paint;
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
        paint.setPathEffect(null);
        Paint paint2 = new Paint();
        this.f17127b = paint2;
        paint2.setStyle(Paint.Style.FILL);
        paint2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OVER));
        paint2.setPathEffect(null);
        this.f17128c = new Canvas();
        this.f17129d = new n8(AdaptiveTrackSelection.DEFAULT_MAX_HEIGHT_TO_DISCARD, 575, 0, AdaptiveTrackSelection.DEFAULT_MAX_HEIGHT_TO_DISCARD, 0, 575);
        this.f17130e = new m8(0, new int[]{0, -1, -16777216, -8421505}, d(), e());
        this.f17131f = new t8(iJ, iJ2);
    }

    public static m8 a(int i10, androidx.media3.extractor.b1 b1Var) {
        int iP;
        int iP2;
        int iP3;
        int iP4;
        int i11 = 8;
        int iP5 = b1Var.p(8);
        b1Var.n(8);
        int i12 = 0;
        int[] iArr = {0, -1, -16777216, -8421505};
        int[] iArrD = d();
        int[] iArrE = e();
        int i13 = i10 - 2;
        while (i13 > 0) {
            int iP6 = b1Var.p(i11);
            int iP7 = b1Var.p(i11);
            int[] iArr2 = (iP7 & 128) != 0 ? iArr : (iP7 & 64) != 0 ? iArrD : iArrE;
            if ((iP7 & 1) != 0) {
                iP3 = b1Var.p(i11);
                iP4 = b1Var.p(i11);
                iP = b1Var.p(i11);
                iP2 = b1Var.p(i11);
                i13 -= 6;
            } else {
                int iP8 = b1Var.p(6) << 2;
                int iP9 = b1Var.p(4) << 4;
                i13 -= 4;
                iP = b1Var.p(4) << 4;
                iP2 = b1Var.p(2) << 6;
                iP3 = iP8;
                iP4 = iP9;
            }
            if (iP3 == 0) {
                iP2 = 255;
            }
            if (iP3 == 0) {
                iP = i12;
            }
            if (iP3 == 0) {
                iP4 = i12;
            }
            double d10 = iP3;
            String str = bb1.f9474a;
            double d11 = iP4 - 128;
            double d12 = iP - 128;
            iArr2[iP6] = f((byte) (255 - (iP2 & 255)), Math.max(0, Math.min((int) ((1.402d * d11) + d10), 255)), Math.max(0, Math.min((int) ((d10 - (0.34414d * d12)) - (d11 * 0.71414d)), 255)), Math.max(0, Math.min((int) ((d12 * 1.772d) + d10), 255)));
            i12 = 0;
            iP5 = iP5;
            iArrE = iArrE;
            i11 = 8;
        }
        return new m8(iP5, iArr, iArrD, iArrE);
    }

    public static o8 c(androidx.media3.extractor.b1 b1Var) {
        byte[] bArr;
        int iP = b1Var.p(16);
        b1Var.n(4);
        int iP2 = b1Var.p(2);
        boolean zO = b1Var.o();
        b1Var.n(1);
        byte[] bArr2 = bb1.f9475b;
        if (iP2 != 1) {
            if (iP2 == 0) {
                int iP3 = b1Var.p(16);
                int iP4 = b1Var.p(16);
                if (iP3 > 0) {
                    bArr2 = new byte[iP3];
                    b1Var.t(iP3, bArr2);
                }
                if (iP4 > 0) {
                    bArr = new byte[iP4];
                    b1Var.t(iP4, bArr);
                }
            }
            return new o8(iP, zO, bArr2, bArr);
        }
        b1Var.n(b1Var.p(8) * 16);
        bArr = bArr2;
        return new o8(iP, zO, bArr2, bArr);
    }

    public static int[] d() {
        int[] iArr = new int[16];
        iArr[0] = 0;
        for (int i10 = 1; i10 < 16; i10++) {
            int i11 = i10 & 4;
            int i12 = i10 & 2;
            int i13 = i10 & 1;
            if (i10 < 8) {
                iArr[i10] = f(255, 1 != i13 ? 0 : 255, i12 != 0 ? 255 : 0, i11 != 0 ? 255 : 0);
            } else {
                iArr[i10] = f(255, 1 != i13 ? 0 : 127, i12 != 0 ? 127 : 0, i11 == 0 ? 0 : 127);
            }
        }
        return iArr;
    }

    public static int[] e() {
        int[] iArr = new int[256];
        iArr[0] = 0;
        for (int i10 = 0; i10 < 256; i10++) {
            if (i10 < 8) {
                iArr[i10] = f(63, 1 != (i10 & 1) ? 0 : 255, (i10 & 2) != 0 ? 255 : 0, (i10 & 4) == 0 ? 0 : 255);
            } else {
                int i11 = i10 & 136;
                if (i11 == 0) {
                    iArr[i10] = f(255, (1 != (i10 & 1) ? 0 : 85) + ((i10 & 16) != 0 ? 170 : 0), ((i10 & 2) != 0 ? 85 : 0) + ((i10 & 32) != 0 ? 170 : 0), ((i10 & 4) == 0 ? 0 : 85) + ((i10 & 64) == 0 ? 0 : 170));
                } else if (i11 == 8) {
                    iArr[i10] = f(127, (1 != (i10 & 1) ? 0 : 85) + ((i10 & 16) != 0 ? 170 : 0), ((i10 & 2) != 0 ? 85 : 0) + ((i10 & 32) != 0 ? 170 : 0), ((i10 & 4) == 0 ? 0 : 85) + ((i10 & 64) == 0 ? 0 : 170));
                } else if (i11 == 128) {
                    iArr[i10] = f(255, (1 != (i10 & 1) ? 0 : 43) + 127 + ((i10 & 16) != 0 ? 85 : 0), ((i10 & 2) != 0 ? 43 : 0) + 127 + ((i10 & 32) != 0 ? 85 : 0), ((i10 & 4) == 0 ? 0 : 43) + 127 + ((i10 & 64) == 0 ? 0 : 85));
                } else if (i11 == 136) {
                    iArr[i10] = f(255, (1 != (i10 & 1) ? 0 : 43) + ((i10 & 16) != 0 ? 85 : 0), ((i10 & 2) != 0 ? 43 : 0) + ((i10 & 32) != 0 ? 85 : 0), ((i10 & 4) == 0 ? 0 : 43) + ((i10 & 64) == 0 ? 0 : 85));
                }
            }
        }
        return iArr;
    }

    public static int f(int i10, int i11, int i12, int i13) {
        return (i10 << 24) | (i11 << 16) | (i12 << 8) | i13;
    }

    public static byte[] g(int i10, int i11, androidx.media3.extractor.b1 b1Var) {
        byte[] bArr = new byte[i10];
        for (int i12 = 0; i12 < i10; i12++) {
            bArr[i12] = (byte) b1Var.p(i11);
        }
        return bArr;
    }

    /* JADX WARN: Removed duplicated region for block: B:110:0x01ef A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:115:0x0219  */
    /* JADX WARN: Removed duplicated region for block: B:119:0x0228 A[LOOP:3: B:88:0x0172->B:119:0x0228, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:143:0x0222 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:90:0x0178  */
    /* JADX WARN: Removed duplicated region for block: B:93:0x0181  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static void zzh(byte[] bArr, int[] iArr, int i10, int i11, int i12, @Nullable Paint paint, Canvas canvas) {
        byte[] bArr2;
        byte[] bArr3;
        int i13;
        int iP;
        char c6;
        char c10;
        int i14;
        int iP2;
        int i15;
        int i16;
        boolean z10;
        int iP3;
        int iP4;
        int i17;
        int i18;
        int i19;
        int iP5;
        int i20;
        androidx.media3.extractor.b1 b1Var = new androidx.media3.extractor.b1(bArr, bArr.length);
        int i21 = i11;
        int i22 = i12;
        byte[] bArrG = null;
        byte[] bArrG2 = null;
        byte[] bArrG3 = null;
        while (b1Var.h() != 0) {
            int i23 = 8;
            int iP6 = b1Var.p(8);
            if (iP6 != 240) {
                int i24 = 4;
                int i25 = 1;
                int i26 = 2;
                switch (iP6) {
                    case 16:
                        int i27 = 1;
                        if (i10 != 3) {
                            if (i10 != 2) {
                                bArr2 = null;
                            } else if (bArrG3 == null) {
                                bArr3 = f17123h;
                                bArr2 = bArr3;
                            } else {
                                bArr2 = bArrG3;
                            }
                            int i28 = i21;
                            i13 = 0;
                            while (true) {
                                iP = b1Var.p(2);
                                if (iP != 0) {
                                }
                                i14 = i13;
                                c6 = 4;
                                c10 = '\b';
                                if (iP2 == 0) {
                                }
                                i13 = i14;
                                i27 = 1;
                            }
                        } else if (bArrG == null) {
                            bArr3 = f17124i;
                            bArr2 = bArr3;
                            int i282 = i21;
                            i13 = 0;
                            while (true) {
                                iP = b1Var.p(2);
                                if (iP != 0) {
                                    iP2 = i27;
                                } else if (b1Var.o()) {
                                    iP2 = b1Var.p(3) + 3;
                                    iP = b1Var.p(2);
                                } else {
                                    if (b1Var.o()) {
                                        iP2 = i27;
                                        i14 = i13;
                                        iP = 0;
                                    } else {
                                        int iP7 = b1Var.p(2);
                                        if (iP7 == 0) {
                                            c6 = 4;
                                            c10 = '\b';
                                            i14 = i27;
                                            iP = 0;
                                            iP2 = 0;
                                        } else if (iP7 == i27) {
                                            c6 = 4;
                                            c10 = '\b';
                                            i14 = i13;
                                            iP2 = 2;
                                            iP = 0;
                                        } else if (iP7 == 2) {
                                            c6 = 4;
                                            c10 = '\b';
                                            iP2 = b1Var.p(4) + 12;
                                            iP = b1Var.p(2);
                                            i14 = i13;
                                        } else if (iP7 != 3) {
                                            i14 = i13;
                                            iP = 0;
                                            iP2 = 0;
                                        } else {
                                            c10 = '\b';
                                            iP2 = b1Var.p(8) + 29;
                                            iP = b1Var.p(2);
                                            i14 = i13;
                                            c6 = 4;
                                        }
                                        if (iP2 == 0 || paint == null) {
                                            i15 = i282;
                                        } else {
                                            int i29 = i22 + 1;
                                            float f10 = i22;
                                            if (bArr2 != 0) {
                                                iP = bArr2[iP];
                                            }
                                            paint.setColor(iArr[iP]);
                                            i15 = i282;
                                            canvas.drawRect(i282, f10, i282 + iP2, i29, paint);
                                        }
                                        i282 = i15 + iP2;
                                        if (i14 == 0) {
                                            b1Var.s();
                                            i21 = i282;
                                        } else {
                                            i13 = i14;
                                            i27 = 1;
                                        }
                                    }
                                    c6 = 4;
                                    c10 = '\b';
                                    if (iP2 == 0) {
                                        i15 = i282;
                                        i282 = i15 + iP2;
                                        if (i14 == 0) {
                                        }
                                    }
                                }
                                i14 = i13;
                                c6 = 4;
                                c10 = '\b';
                                if (iP2 == 0) {
                                }
                            }
                        } else {
                            bArr2 = bArrG;
                            int i2822 = i21;
                            i13 = 0;
                            while (true) {
                                iP = b1Var.p(2);
                                if (iP != 0) {
                                }
                                i14 = i13;
                                c6 = 4;
                                c10 = '\b';
                                if (iP2 == 0) {
                                }
                                i13 = i14;
                                i27 = 1;
                            }
                        }
                        break;
                    case 17:
                        byte[] bArr4 = i10 == 3 ? bArrG2 == null ? f17125j : bArrG2 : null;
                        int i30 = i21;
                        boolean z11 = false;
                        while (true) {
                            int iP8 = b1Var.p(i24);
                            if (iP8 != 0) {
                                i16 = 1;
                                z10 = z11;
                            } else if (b1Var.o()) {
                                if (b1Var.o()) {
                                    int iP9 = b1Var.p(i26);
                                    if (iP9 == 0) {
                                        i16 = 1;
                                        z10 = z11;
                                    } else if (iP9 == 1) {
                                        z10 = z11;
                                        i16 = i26;
                                    } else if (iP9 == i26) {
                                        iP3 = b1Var.p(i24) + 9;
                                        iP4 = b1Var.p(i24);
                                    } else if (iP9 != 3) {
                                        z10 = z11;
                                        iP8 = 0;
                                        i16 = 0;
                                    } else {
                                        iP3 = b1Var.p(i23) + 25;
                                        iP4 = b1Var.p(i24);
                                    }
                                    iP8 = 0;
                                } else {
                                    iP3 = b1Var.p(i26) + i24;
                                    iP4 = b1Var.p(i24);
                                }
                                z10 = z11;
                                i16 = iP3;
                                iP8 = iP4;
                            } else {
                                int iP10 = b1Var.p(3);
                                if (iP10 != 0) {
                                    z10 = z11;
                                    i16 = iP10 + 2;
                                    iP8 = 0;
                                } else {
                                    z10 = true;
                                    iP8 = 0;
                                    i16 = 0;
                                }
                            }
                            if (i16 == 0 || paint == null) {
                                i17 = i26;
                                i18 = i30;
                            } else {
                                int i31 = i22 + 1;
                                float f11 = i22;
                                if (bArr4 != 0) {
                                    iP8 = bArr4[iP8];
                                }
                                paint.setColor(iArr[iP8]);
                                i17 = 2;
                                i18 = i30;
                                canvas.drawRect(i30, f11, i30 + i16, i31, paint);
                            }
                            i30 = i18 + i16;
                            if (z10) {
                                b1Var.s();
                                i21 = i30;
                            } else {
                                i26 = i17;
                                z11 = z10;
                                i24 = 4;
                                i23 = 8;
                            }
                            break;
                        }
                        break;
                    case 18:
                        int i32 = i21;
                        int i33 = 0;
                        while (true) {
                            int iP11 = b1Var.p(8);
                            if (iP11 != 0) {
                                i19 = i33;
                                iP5 = i25;
                            } else if (b1Var.o()) {
                                i19 = i33;
                                iP5 = b1Var.p(7);
                                iP11 = b1Var.p(8);
                            } else {
                                int iP12 = b1Var.p(7);
                                if (iP12 != 0) {
                                    i19 = i33;
                                    iP5 = iP12;
                                    iP11 = 0;
                                } else {
                                    i19 = i25;
                                    iP11 = 0;
                                    iP5 = 0;
                                }
                            }
                            if (iP5 == 0 || paint == null) {
                                i20 = i25;
                            } else {
                                paint.setColor(iArr[iP11]);
                                i20 = i25;
                                canvas.drawRect(i32, i22, i32 + iP5, i22 + 1, paint);
                            }
                            i32 += iP5;
                            if (i19 != 0) {
                                i21 = i32;
                            } else {
                                i25 = i20;
                                i33 = i19;
                            }
                            break;
                        }
                        break;
                    default:
                        switch (iP6) {
                            case 32:
                                bArrG3 = g(4, 4, b1Var);
                                break;
                            case 33:
                                bArrG = g(4, 8, b1Var);
                                break;
                            case 34:
                                bArrG2 = g(16, 8, b1Var);
                                break;
                        }
                        break;
                }
            } else {
                i22 += 2;
                i21 = i11;
            }
        }
    }

    @Override // com.google.android.gms.internal.ads.j8
    public final void b(byte[] bArr, int i10, int i11, g7.h hVar) {
        t8 t8Var;
        f8 f8Var;
        char c6;
        char c10;
        char c11;
        int i12;
        int i13;
        n8 n8Var;
        t8 t8Var2;
        int i14;
        int i15;
        int i16;
        int i17;
        r8 r8Var;
        int i18;
        int i19;
        ArrayList arrayList;
        r8 r8Var2;
        int iP;
        int iP2;
        int i20;
        int iP3;
        androidx.media3.extractor.b1 b1Var = new androidx.media3.extractor.b1(bArr, i10 + i11);
        b1Var.l(i10);
        while (true) {
            int iH = b1Var.h();
            t8Var = this.f17131f;
            if (iH >= 48 && b1Var.p(8) == 15) {
                int iP4 = b1Var.p(8);
                int i21 = 16;
                int iP5 = b1Var.p(16);
                int iP6 = b1Var.p(16);
                int iK = b1Var.k() + iP6;
                if (iP6 * 8 > b1Var.h()) {
                    vt0.c("Data field length exceeds limit");
                    b1Var.n(b1Var.h());
                } else {
                    switch (iP4) {
                        case 16:
                            if (iP5 == t8Var.f16755a) {
                                p8 p8Var = t8Var.zzi;
                                b1Var.p(8);
                                int iP7 = b1Var.p(4);
                                int iP8 = b1Var.p(2);
                                b1Var.n(2);
                                SparseArray sparseArray = new SparseArray();
                                for (int i22 = iP6 - 2; i22 > 0; i22 -= 6) {
                                    int iP9 = b1Var.p(8);
                                    b1Var.n(8);
                                    sparseArray.put(iP9, new q8(b1Var.p(16), b1Var.p(16)));
                                }
                                p8 p8Var2 = new p8(iP7, iP8, sparseArray);
                                if (iP8 != 0) {
                                    t8Var.zzi = p8Var2;
                                    t8Var.f16757c.clear();
                                    t8Var.f16758d.clear();
                                    t8Var.f16759e.clear();
                                } else if (p8Var != null && p8Var.f15290a != iP7) {
                                    t8Var.zzi = p8Var2;
                                }
                            }
                            break;
                        case 17:
                            p8 p8Var3 = t8Var.zzi;
                            if (iP5 == t8Var.f16755a && p8Var3 != null) {
                                int iP10 = b1Var.p(8);
                                b1Var.n(4);
                                boolean zO = b1Var.o();
                                b1Var.n(3);
                                int iP11 = b1Var.p(16);
                                int iP12 = b1Var.p(16);
                                b1Var.p(3);
                                int iP13 = b1Var.p(3);
                                b1Var.n(2);
                                int iP14 = b1Var.p(8);
                                int iP15 = b1Var.p(8);
                                int iP16 = b1Var.p(4);
                                int iP17 = b1Var.p(2);
                                b1Var.n(2);
                                int i23 = iP6 - 10;
                                SparseArray sparseArray2 = new SparseArray();
                                while (i23 > 0) {
                                    int iP18 = b1Var.p(i21);
                                    int iP19 = b1Var.p(2);
                                    b1Var.p(2);
                                    int iP20 = b1Var.p(12);
                                    b1Var.n(4);
                                    int iP21 = b1Var.p(12);
                                    int i24 = i23 - 6;
                                    if (iP19 == 1 || iP19 == 2) {
                                        b1Var.p(8);
                                        b1Var.p(8);
                                        i23 -= 8;
                                    } else {
                                        i23 = i24;
                                    }
                                    sparseArray2.put(iP18, new s8(iP20, iP21));
                                    i21 = 16;
                                }
                                r8 r8Var3 = new r8(iP10, zO, iP11, iP12, iP13, iP14, iP15, iP16, iP17, sparseArray2);
                                SparseArray sparseArray3 = t8Var.f16757c;
                                if (p8Var3.f15291b == 0 && (r8Var2 = (r8) sparseArray3.get(iP10)) != null) {
                                    int i25 = 0;
                                    while (true) {
                                        SparseArray sparseArray4 = r8Var2.f16032j;
                                        if (i25 < sparseArray4.size()) {
                                            r8Var3.f16032j.put(sparseArray4.keyAt(i25), (s8) sparseArray4.valueAt(i25));
                                            i25++;
                                        }
                                    }
                                }
                                sparseArray3.put(r8Var3.f16023a, r8Var3);
                            }
                            break;
                        case 18:
                            if (iP5 == t8Var.f16755a) {
                                m8 m8VarA = a(iP6, b1Var);
                                t8Var.f16758d.put(m8VarA.f14001a, m8VarA);
                            } else if (iP5 == t8Var.f16756b) {
                                m8 m8VarA2 = a(iP6, b1Var);
                                t8Var.f16760f.put(m8VarA2.f14001a, m8VarA2);
                            }
                            break;
                        case 19:
                            if (iP5 == t8Var.f16755a) {
                                o8 o8VarC = c(b1Var);
                                t8Var.f16759e.put(o8VarC.f14897a, o8VarC);
                            } else if (iP5 == t8Var.f16756b) {
                                o8 o8VarC2 = c(b1Var);
                                t8Var.f16761g.put(o8VarC2.f14897a, o8VarC2);
                            }
                            break;
                        case 20:
                            if (iP5 == t8Var.f16755a) {
                                b1Var.n(4);
                                boolean zO2 = b1Var.o();
                                b1Var.n(3);
                                int iP22 = b1Var.p(16);
                                int iP23 = b1Var.p(16);
                                if (zO2) {
                                    int iP24 = b1Var.p(16);
                                    iP = b1Var.p(16);
                                    iP3 = b1Var.p(16);
                                    iP2 = b1Var.p(16);
                                    i20 = iP24;
                                } else {
                                    iP = iP22;
                                    iP2 = iP23;
                                    i20 = 0;
                                    iP3 = 0;
                                }
                                t8Var.zzh = new n8(iP22, iP23, i20, iP, iP3, iP2);
                            }
                            break;
                    }
                    b1Var.u(iK - b1Var.k());
                }
            }
        }
        p8 p8Var4 = t8Var.zzi;
        if (p8Var4 == null) {
            bs1 bs1Var = zzguf.f19771b;
            f8Var = new f8(zzgwa.f19786e, -9223372036854775807L, -9223372036854775807L);
        } else {
            n8 n8Var2 = t8Var.zzh;
            if (n8Var2 == null) {
                n8Var2 = this.f17129d;
            }
            Bitmap bitmap = this.f17132g;
            Canvas canvas = this.f17128c;
            if (bitmap == null || n8Var2.f14457a + 1 != bitmap.getWidth() || n8Var2.f14458b + 1 != this.f17132g.getHeight()) {
                Bitmap bitmapCreateBitmap = Bitmap.createBitmap(n8Var2.f14457a + 1, n8Var2.f14458b + 1, Bitmap.Config.ARGB_8888);
                this.f17132g = bitmapCreateBitmap;
                canvas.setBitmap(bitmapCreateBitmap);
            }
            ArrayList arrayList2 = new ArrayList();
            int i26 = 0;
            while (true) {
                SparseArray sparseArray5 = p8Var4.f15292c;
                if (i26 < sparseArray5.size()) {
                    canvas.save();
                    q8 q8Var = (q8) sparseArray5.valueAt(i26);
                    r8 r8Var4 = (r8) t8Var.f16757c.get(sparseArray5.keyAt(i26));
                    int i27 = q8Var.f15616a + n8Var2.f14459c;
                    int i28 = q8Var.f15617b + n8Var2.f14461e;
                    int i29 = r8Var4.f16025c;
                    int i30 = i27 + i29;
                    int iMin = Math.min(i30, n8Var2.f14460d);
                    int i31 = r8Var4.f16026d;
                    int i32 = i28 + i31;
                    canvas.clipRect(i27, i28, iMin, Math.min(i32, n8Var2.f14462f));
                    SparseArray sparseArray6 = t8Var.f16758d;
                    int i33 = r8Var4.f16028f;
                    m8 m8Var = (m8) sparseArray6.get(i33);
                    if (m8Var == null && (m8Var = (m8) t8Var.f16760f.get(i33)) == null) {
                        m8Var = this.f17130e;
                    }
                    p8 p8Var5 = p8Var4;
                    int i34 = 0;
                    while (true) {
                        SparseArray sparseArray7 = r8Var4.f16032j;
                        int i35 = i30;
                        if (i34 < sparseArray7.size()) {
                            int iKeyAt = sparseArray7.keyAt(i34);
                            s8 s8Var = (s8) sparseArray7.valueAt(i34);
                            int i36 = i34;
                            o8 o8Var = (o8) t8Var.f16759e.get(iKeyAt);
                            if (o8Var == null) {
                                o8Var = (o8) t8Var.f16761g.get(iKeyAt);
                            }
                            o8 o8Var2 = o8Var;
                            if (o8Var2 != null) {
                                Paint paint = o8Var2.f14898b ? null : this.f17126a;
                                int i37 = r8Var4.f16027e;
                                t8Var2 = t8Var;
                                int i38 = s8Var.f16345a + i27;
                                int i39 = s8Var.f16346b + i28;
                                int i40 = i29;
                                int[] iArr = i37 == 3 ? m8Var.f14004d : i37 == 2 ? m8Var.f14003c : m8Var.f14002b;
                                arrayList = arrayList2;
                                n8Var = n8Var2;
                                i13 = i31;
                                i15 = i40;
                                i16 = i28;
                                i19 = i35;
                                i17 = i27;
                                i14 = i32;
                                r8Var = r8Var4;
                                i18 = i26;
                                zzh(o8Var2.f14899c, iArr, i37, i38, i39, paint, canvas);
                                zzh(o8Var2.f14900d, iArr, i37, i38, i39 + 1, paint, canvas);
                            } else {
                                i13 = i31;
                                n8Var = n8Var2;
                                t8Var2 = t8Var;
                                i14 = i32;
                                i15 = i29;
                                i16 = i28;
                                i17 = i27;
                                r8Var = r8Var4;
                                i18 = i26;
                                i19 = i35;
                                arrayList = arrayList2;
                            }
                            i34 = i36 + 1;
                            i27 = i17;
                            i28 = i16;
                            r8Var4 = r8Var;
                            arrayList2 = arrayList;
                            t8Var = t8Var2;
                            i31 = i13;
                            n8Var2 = n8Var;
                            i29 = i15;
                            i30 = i19;
                            i32 = i14;
                            i26 = i18;
                        } else {
                            int i41 = i31;
                            n8 n8Var3 = n8Var2;
                            t8 t8Var3 = t8Var;
                            int i42 = i32;
                            int i43 = i29;
                            int i44 = i28;
                            int i45 = i27;
                            r8 r8Var5 = r8Var4;
                            int i46 = i26;
                            ArrayList arrayList3 = arrayList2;
                            float f10 = i44;
                            float f11 = i45;
                            if (r8Var5.f16024b) {
                                int i47 = r8Var5.f16027e;
                                c10 = 3;
                                if (i47 == 3) {
                                    i12 = m8Var.f14004d[r8Var5.f16029g];
                                    c11 = 2;
                                } else {
                                    c11 = 2;
                                    i12 = i47 == 2 ? m8Var.f14003c[r8Var5.f16030h] : m8Var.f14002b[r8Var5.f16031i];
                                }
                                Paint paint2 = this.f17127b;
                                paint2.setColor(i12);
                                c6 = c11;
                                canvas.drawRect(f11, f10, i35, i42, paint2);
                            } else {
                                c6 = 2;
                                c10 = 3;
                            }
                            gc0 gc0Var = new gc0();
                            gc0Var.b(Bitmap.createBitmap(this.f17132g, i45, i44, i43, i41));
                            n8Var2 = n8Var3;
                            float f12 = n8Var2.f14457a;
                            gc0Var.f11708d = f11 / f12;
                            gc0Var.f11709e = 0;
                            float f13 = n8Var2.f14458b;
                            gc0Var.f11705a = f10 / f13;
                            gc0Var.f11706b = 0;
                            gc0Var.f11707c = 0;
                            gc0Var.f11712h = i43 / f12;
                            gc0Var.f11713i = i41 / f13;
                            arrayList3.add(gc0Var.c());
                            canvas.drawColor(0, PorterDuff.Mode.CLEAR);
                            canvas.restore();
                            t8Var = t8Var3;
                            i26 = i46 + 1;
                            p8Var4 = p8Var5;
                            arrayList2 = arrayList3;
                        }
                    }
                } else {
                    f8Var = new f8(arrayList2, -9223372036854775807L, -9223372036854775807L);
                }
            }
        }
        hVar.mo2zza(f8Var);
    }
}
