package s1;

import C3.E;
import C3.G;
import C3.W;
import T0.H;
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.leanback.widget.Q0;
import d5.AbstractC0844a;
import java.util.ArrayList;
import java.util.List;
import q1.C1444a;
import q1.C1455l;
import q1.InterfaceC1447d;
import q1.InterfaceC1456m;
import x0.AbstractC1709a;
import x0.o;
import x0.v;

/* JADX INFO: loaded from: classes.dex */
public final class h implements InterfaceC1456m {

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

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

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

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

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

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

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final C1518b f16785t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final C1517a f16786u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final g f16787v;

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

    public h(List list) {
        o oVar = new o((byte[]) list.get(0));
        int iZ = oVar.z();
        int iZ2 = oVar.z();
        Paint paint = new Paint();
        this.f16782q = paint;
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
        paint.setPathEffect(null);
        Paint paint2 = new Paint();
        this.f16783r = paint2;
        paint2.setStyle(Paint.Style.FILL);
        paint2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OVER));
        paint2.setPathEffect(null);
        this.f16784s = new Canvas();
        this.f16785t = new C1518b(719, 575, 0, 719, 0, 575);
        this.f16786u = new C1517a(0, new int[]{0, -1, -16777216, -8421505}, c(), e());
        this.f16787v = new g(iZ, iZ2);
    }

    public static byte[] b(int i, int i5, H h8) {
        byte[] bArr = new byte[i];
        for (int i8 = 0; i8 < i; i8++) {
            bArr[i8] = (byte) h8.i(i5);
        }
        return bArr;
    }

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

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

    public static int f(int i, int i5, int i8, int i9) {
        return (i << 24) | (i5 << 16) | (i8 << 8) | i9;
    }

    /* JADX WARN: Removed duplicated region for block: B:108:0x01d5 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:112:0x01f2  */
    /* JADX WARN: Removed duplicated region for block: B:116:0x01fe A[LOOP:3: B:86:0x0166->B:116:0x01fe, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:131:0x01fa A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:88:0x016c  */
    /* JADX WARN: Removed duplicated region for block: B:90:0x0174  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void g(byte[] bArr, int[] iArr, int i, int i5, int i8, Paint paint, Canvas canvas) {
        byte[] bArr2;
        byte[] bArr3;
        boolean z8;
        int i9;
        char c3;
        boolean z9;
        int i10;
        int i11;
        int i12;
        int i13;
        boolean z10;
        int i14;
        int i15;
        int i16;
        int i17;
        int i18;
        boolean z11;
        int i19;
        Paint paint2 = paint;
        H h8 = new H(bArr.length, bArr);
        int i20 = i5;
        int i21 = i8;
        byte[] bArrB = null;
        byte[] bArrB2 = null;
        byte[] bArrB3 = null;
        while (h8.b() != 0) {
            int i22 = h8.i(8);
            if (i22 != 240) {
                int i23 = 3;
                int i24 = 4;
                switch (i22) {
                    case 16:
                        if (i == 3) {
                            bArr3 = bArrB == null ? f16780y : bArrB;
                        } else if (i == 2) {
                            bArr3 = bArrB3 == null ? f16779x : bArrB3;
                        } else {
                            bArr2 = null;
                            z8 = false;
                            while (true) {
                                i9 = h8.i(2);
                                if (i9 == 0) {
                                    z9 = z8;
                                    i10 = i9;
                                    i11 = 1;
                                } else {
                                    if (h8.h()) {
                                        i12 = h8.i(3) + 3;
                                        i10 = h8.i(2);
                                    } else if (h8.h()) {
                                        z9 = z8;
                                        i11 = 1;
                                        i10 = 0;
                                    } else {
                                        int i25 = h8.i(2);
                                        if (i25 == 0) {
                                            c3 = 4;
                                            z9 = true;
                                            i10 = 0;
                                            i11 = 0;
                                        } else if (i25 == 1) {
                                            c3 = 4;
                                            z9 = z8;
                                            i11 = 2;
                                            i10 = 0;
                                        } else if (i25 == 2) {
                                            c3 = 4;
                                            z9 = z8;
                                            i11 = h8.i(4) + 12;
                                            i10 = h8.i(2);
                                        } else if (i25 != 3) {
                                            z9 = z8;
                                            i10 = 0;
                                            i11 = 0;
                                        } else {
                                            i12 = h8.i(8) + 29;
                                            i10 = h8.i(2);
                                        }
                                        if (i11 == 0 || paint2 == null) {
                                            i13 = i20;
                                        } else {
                                            if (bArr2 != 0) {
                                                i10 = bArr2[i10];
                                            }
                                            paint2.setColor(iArr[i10]);
                                            i13 = i20;
                                            canvas.drawRect(i20, i21, i20 + i11, i21 + 1, paint2);
                                        }
                                        i20 = i13 + i11;
                                        if (!z9) {
                                            h8.c();
                                        } else {
                                            paint2 = paint;
                                            z8 = z9;
                                        }
                                    }
                                    z9 = z8;
                                    i11 = i12;
                                }
                                c3 = 4;
                                if (i11 == 0) {
                                    i13 = i20;
                                    i20 = i13 + i11;
                                    if (!z9) {
                                    }
                                }
                            }
                        }
                        bArr2 = bArr3;
                        z8 = false;
                        while (true) {
                            i9 = h8.i(2);
                            if (i9 == 0) {
                            }
                            c3 = 4;
                            if (i11 == 0) {
                            }
                            paint2 = paint;
                            z8 = z9;
                        }
                        break;
                    case 17:
                        byte[] bArr4 = i == 3 ? bArrB2 == null ? f16781z : bArrB2 : null;
                        boolean z12 = false;
                        while (true) {
                            int i26 = h8.i(i24);
                            if (i26 != 0) {
                                z10 = z12;
                                i14 = 1;
                            } else if (h8.h()) {
                                if (h8.h()) {
                                    int i27 = h8.i(2);
                                    if (i27 == 0) {
                                        z10 = z12;
                                        i14 = 1;
                                    } else if (i27 == 1) {
                                        z10 = z12;
                                        i14 = 2;
                                    } else if (i27 == 2) {
                                        i15 = h8.i(i24) + 9;
                                        i16 = h8.i(i24);
                                    } else if (i27 != i23) {
                                        z10 = z12;
                                        i26 = 0;
                                        i14 = 0;
                                    } else {
                                        i15 = h8.i(8) + 25;
                                        i16 = h8.i(i24);
                                    }
                                    i26 = 0;
                                } else {
                                    i15 = h8.i(2) + i24;
                                    i16 = h8.i(i24);
                                }
                                i14 = i15;
                                i26 = i16;
                                z10 = z12;
                            } else {
                                int i28 = h8.i(i23);
                                if (i28 != 0) {
                                    z10 = z12;
                                    i14 = i28 + 2;
                                    i26 = 0;
                                } else {
                                    z10 = true;
                                    i26 = 0;
                                    i14 = 0;
                                }
                            }
                            if (i14 == 0 || paint2 == null) {
                                i17 = i20;
                                i18 = i23;
                            } else {
                                if (bArr4 != 0) {
                                    i26 = bArr4[i26];
                                }
                                paint2.setColor(iArr[i26]);
                                i18 = i23;
                                i17 = i20;
                                canvas.drawRect(i20, i21, i20 + i14, i21 + 1, paint2);
                            }
                            i20 = i17 + i14;
                            if (z10) {
                                h8.c();
                            } else {
                                i23 = i18;
                                z12 = z10;
                                i24 = 4;
                            }
                            break;
                        }
                        break;
                    case 18:
                        int i29 = i20;
                        boolean z13 = false;
                        while (true) {
                            int i30 = h8.i(8);
                            if (i30 != 0) {
                                z11 = z13;
                                i19 = 1;
                            } else if (h8.h()) {
                                z11 = z13;
                                i19 = h8.i(7);
                                i30 = h8.i(8);
                            } else {
                                int i31 = h8.i(7);
                                if (i31 != 0) {
                                    z11 = z13;
                                    i19 = i31;
                                    i30 = 0;
                                } else {
                                    z11 = true;
                                    i30 = 0;
                                    i19 = 0;
                                }
                            }
                            if (i19 != 0 && paint2 != null) {
                                paint2.setColor(iArr[i30]);
                                canvas.drawRect(i29, i21, i29 + i19, i21 + 1, paint2);
                            }
                            i29 += i19;
                            if (z11) {
                                i20 = i29;
                            } else {
                                z13 = z11;
                            }
                            break;
                        }
                        break;
                    default:
                        switch (i22) {
                            case 32:
                                bArrB3 = b(4, 4, h8);
                                break;
                            case 33:
                                bArrB = b(4, 8, h8);
                                break;
                            case 34:
                                bArrB2 = b(16, 8, h8);
                                break;
                        }
                        break;
                }
            } else {
                i21 += 2;
                i20 = i5;
            }
            paint2 = paint;
        }
    }

    public static C1517a h(H h8, int i) {
        int i5;
        int i8;
        int i9;
        int i10;
        int i11;
        int i12 = 8;
        int i13 = h8.i(8);
        h8.t(8);
        int i14 = 2;
        int i15 = i - 2;
        int i16 = 0;
        int[] iArr = {0, -1, -16777216, -8421505};
        int[] iArrC = c();
        int[] iArrE = e();
        while (i15 > 0) {
            int i17 = h8.i(i12);
            int i18 = h8.i(i12);
            int[] iArr2 = (i18 & 128) != 0 ? iArr : (i18 & 64) != 0 ? iArrC : iArrE;
            if ((i18 & 1) != 0) {
                i10 = h8.i(i12);
                i11 = h8.i(i12);
                i5 = h8.i(i12);
                i9 = h8.i(i12);
                i8 = i15 - 6;
            } else {
                int i19 = h8.i(6) << i14;
                int i20 = h8.i(4) << 4;
                i5 = h8.i(4) << 4;
                i8 = i15 - 4;
                i9 = h8.i(i14) << 6;
                i10 = i19;
                i11 = i20;
            }
            if (i10 == 0) {
                i11 = i16;
                i5 = i11;
                i9 = 255;
            }
            double d8 = i10;
            double d9 = i11 - 128;
            double d10 = i5 - 128;
            iArr2[i17] = f((byte) (255 - (i9 & 255)), v.i((int) ((1.402d * d9) + d8), 0, 255), v.i((int) ((d8 - (0.34414d * d10)) - (d9 * 0.71414d)), 0, 255), v.i((int) ((d10 * 1.772d) + d8), 0, 255));
            i15 = i8;
            i16 = 0;
            i13 = i13;
            iArrE = iArrE;
            i12 = 8;
            i14 = 2;
        }
        return new C1517a(i13, iArr, iArrC, iArrE);
    }

    public static c i(H h8) {
        byte[] bArr;
        int i = h8.i(16);
        h8.t(4);
        int i5 = h8.i(2);
        boolean zH = h8.h();
        h8.t(1);
        byte[] bArr2 = v.f18555c;
        if (i5 != 1) {
            if (i5 == 0) {
                int i8 = h8.i(16);
                int i9 = h8.i(16);
                if (i8 > 0) {
                    bArr2 = new byte[i8];
                    h8.l(i8, bArr2);
                }
                if (i9 > 0) {
                    bArr = new byte[i9];
                    h8.l(i9, bArr);
                }
            }
            return new c(i, zH, bArr2, bArr);
        }
        h8.t(h8.i(8) * 16);
        bArr = bArr2;
        return new c(i, zH, bArr2, bArr);
    }

    @Override // q1.InterfaceC1456m
    public final void a(byte[] bArr, int i, int i5, C1455l c1455l, x0.d dVar) {
        g gVar;
        C1444a c1444a;
        int i8;
        char c3;
        char c8;
        char c9;
        int i9;
        int i10;
        g gVar2;
        Canvas canvas;
        int i11;
        int i12;
        int i13;
        int i14;
        int i15;
        e eVar;
        int i16;
        int i17;
        int i18;
        int i19;
        int i20 = 8;
        boolean z8 = true;
        H h8 = new H(i + i5, bArr);
        h8.q(i);
        while (true) {
            int iB = h8.b();
            gVar = this.f16787v;
            if (iB >= 48 && h8.i(i20) == 15) {
                int i21 = h8.i(i20);
                int i22 = h8.i(16);
                int i23 = h8.i(16);
                int iF = h8.f() + i23;
                if (i23 * 8 > h8.b()) {
                    AbstractC1709a.B("DvbParser", "Data field length exceeds limit");
                    h8.t(h8.b());
                } else {
                    switch (i21) {
                        case 16:
                            if (i22 == gVar.f16771a) {
                                Q0 q0 = gVar.i;
                                h8.i(i20);
                                int i24 = h8.i(4);
                                int i25 = h8.i(2);
                                h8.t(2);
                                int i26 = i23 - 2;
                                SparseArray sparseArray = new SparseArray();
                                while (i26 > 0) {
                                    int i27 = h8.i(i20);
                                    h8.t(i20);
                                    i26 -= 6;
                                    sparseArray.put(i27, new d(h8.i(16), h8.i(16)));
                                    i20 = 8;
                                }
                                Q0 q02 = new Q0();
                                q02.f8512q = i24;
                                q02.f8513r = i25;
                                q02.f8514s = sparseArray;
                                if (i25 != 0) {
                                    gVar.i = q02;
                                    gVar.f16773c.clear();
                                    gVar.f16774d.clear();
                                    gVar.f16775e.clear();
                                } else if (q0 != null && q0.f8512q != i24) {
                                    gVar.i = q02;
                                }
                            }
                            break;
                        case 17:
                            Q0 q03 = gVar.i;
                            if (i22 == gVar.f16771a && q03 != null) {
                                int i28 = h8.i(i20);
                                h8.t(4);
                                boolean zH = h8.h();
                                h8.t(3);
                                int i29 = h8.i(16);
                                int i30 = h8.i(16);
                                h8.i(3);
                                int i31 = h8.i(3);
                                h8.t(2);
                                int i32 = h8.i(i20);
                                int i33 = h8.i(i20);
                                int i34 = h8.i(4);
                                int i35 = h8.i(2);
                                h8.t(2);
                                int i36 = i23 - 10;
                                SparseArray sparseArray2 = new SparseArray();
                                while (i36 > 0) {
                                    int i37 = h8.i(16);
                                    int i38 = h8.i(2);
                                    h8.i(2);
                                    int i39 = h8.i(12);
                                    h8.t(4);
                                    int i40 = h8.i(12);
                                    int i41 = i36 - 6;
                                    if (i38 == 1 || i38 == 2) {
                                        h8.i(i20);
                                        h8.i(i20);
                                        i36 -= 8;
                                    } else {
                                        i36 = i41;
                                    }
                                    sparseArray2.put(i37, new f(i39, i40));
                                }
                                e eVar2 = new e(i28, zH, i29, i30, i31, i32, i33, i34, i35, sparseArray2);
                                SparseArray sparseArray3 = gVar.f16773c;
                                if (q03.f8513r == 0 && (eVar = (e) sparseArray3.get(i28)) != null) {
                                    int i42 = 0;
                                    while (true) {
                                        SparseArray sparseArray4 = eVar.f16768j;
                                        if (i42 < sparseArray4.size()) {
                                            eVar2.f16768j.put(sparseArray4.keyAt(i42), (f) sparseArray4.valueAt(i42));
                                            i42++;
                                        }
                                    }
                                }
                                sparseArray3.put(eVar2.f16760a, eVar2);
                            }
                            break;
                        case 18:
                            if (i22 == gVar.f16771a) {
                                C1517a c1517aH = h(h8, i23);
                                gVar.f16774d.put(c1517aH.f16744a, c1517aH);
                            } else if (i22 == gVar.f16772b) {
                                C1517a c1517aH2 = h(h8, i23);
                                gVar.f16776f.put(c1517aH2.f16744a, c1517aH2);
                            }
                            break;
                        case 19:
                            if (i22 == gVar.f16771a) {
                                c cVarI = i(h8);
                                gVar.f16775e.put(cVarI.f16754a, cVarI);
                            } else if (i22 == gVar.f16772b) {
                                c cVarI2 = i(h8);
                                gVar.f16777g.put(cVarI2.f16754a, cVarI2);
                            }
                            break;
                        case 20:
                            if (i22 == gVar.f16771a) {
                                h8.t(4);
                                boolean zH2 = h8.h();
                                h8.t(3);
                                int i43 = h8.i(16);
                                int i44 = h8.i(16);
                                if (zH2) {
                                    int i45 = h8.i(16);
                                    int i46 = h8.i(16);
                                    int i47 = h8.i(16);
                                    i16 = i46;
                                    i17 = h8.i(16);
                                    i19 = i47;
                                    i18 = i45;
                                } else {
                                    i16 = i43;
                                    i17 = i44;
                                    i18 = 0;
                                    i19 = 0;
                                }
                                gVar.f16778h = new C1518b(i43, i44, i18, i16, i19, i17);
                            }
                            break;
                    }
                    h8.u(iF - h8.f());
                }
                i20 = 8;
            }
        }
        Q0 q04 = gVar.i;
        if (q04 == null) {
            E e8 = G.f1197r;
            c1444a = new C1444a(-9223372036854775807L, -9223372036854775807L, W.f1225u);
        } else {
            C1518b c1518b = gVar.f16778h;
            if (c1518b == null) {
                c1518b = this.f16785t;
            }
            Bitmap bitmap = this.f16788w;
            Canvas canvas2 = this.f16784s;
            if (bitmap == null || c1518b.f16748a + 1 != bitmap.getWidth() || c1518b.f16749b + 1 != this.f16788w.getHeight()) {
                Bitmap bitmapCreateBitmap = Bitmap.createBitmap(c1518b.f16748a + 1, c1518b.f16749b + 1, Bitmap.Config.ARGB_8888);
                this.f16788w = bitmapCreateBitmap;
                canvas2.setBitmap(bitmapCreateBitmap);
            }
            ArrayList arrayList = new ArrayList();
            int i48 = 0;
            while (true) {
                SparseArray sparseArray5 = (SparseArray) q04.f8514s;
                if (i48 < sparseArray5.size()) {
                    canvas2.save();
                    d dVar2 = (d) sparseArray5.valueAt(i48);
                    e eVar3 = (e) gVar.f16773c.get(sparseArray5.keyAt(i48));
                    int i49 = dVar2.f16758a + c1518b.f16750c;
                    int i50 = dVar2.f16759b + c1518b.f16752e;
                    int iMin = Math.min(eVar3.f16762c + i49, c1518b.f16751d);
                    int i51 = eVar3.f16763d;
                    int i52 = i50 + i51;
                    boolean z9 = z8;
                    canvas2.clipRect(i49, i50, iMin, Math.min(i52, c1518b.f16753f));
                    SparseArray sparseArray6 = gVar.f16774d;
                    int i53 = eVar3.f16765f;
                    C1517a c1517a = (C1517a) sparseArray6.get(i53);
                    if (c1517a == null && (c1517a = (C1517a) gVar.f16776f.get(i53)) == null) {
                        c1517a = this.f16786u;
                    }
                    int i54 = 0;
                    while (true) {
                        SparseArray sparseArray7 = eVar3.f16768j;
                        if (i54 < sparseArray7.size()) {
                            int iKeyAt = sparseArray7.keyAt(i54);
                            f fVar = (f) sparseArray7.valueAt(i54);
                            Q0 q05 = q04;
                            c cVar = (c) gVar.f16775e.get(iKeyAt);
                            if (cVar == null) {
                                cVar = (c) gVar.f16777g.get(iKeyAt);
                            }
                            if (cVar != null) {
                                Paint paint = cVar.f16755b ? null : this.f16782q;
                                i10 = i48;
                                int i55 = fVar.f16769a + i49;
                                int i56 = fVar.f16770b + i50;
                                int i57 = i49;
                                int i58 = eVar3.f16764e;
                                canvas = canvas2;
                                i13 = i54;
                                i11 = i50;
                                int[] iArr = i58 == 3 ? c1517a.f16747d : i58 == 2 ? c1517a.f16746c : c1517a.f16745b;
                                i12 = i57;
                                gVar2 = gVar;
                                i15 = i52;
                                Paint paint2 = paint;
                                i14 = i51;
                                g(cVar.f16756c, iArr, i58, i55, i56, paint2, canvas);
                                g(cVar.f16757d, iArr, i58, i55, i56 + 1, paint2, canvas);
                            } else {
                                i10 = i48;
                                gVar2 = gVar;
                                canvas = canvas2;
                                i11 = i50;
                                i12 = i49;
                                i13 = i54;
                                i14 = i51;
                                i15 = i52;
                            }
                            i54 = i13 + 1;
                            i49 = i12;
                            i50 = i11;
                            i51 = i14;
                            i52 = i15;
                            canvas2 = canvas;
                            q04 = q05;
                            i48 = i10;
                            gVar = gVar2;
                        } else {
                            Q0 q06 = q04;
                            int i59 = i48;
                            g gVar3 = gVar;
                            Canvas canvas3 = canvas2;
                            int i60 = i50;
                            int i61 = i49;
                            int i62 = i51;
                            int i63 = i52;
                            boolean z10 = eVar3.f16761b;
                            int i64 = eVar3.f16762c;
                            if (z10) {
                                int i65 = eVar3.f16764e;
                                if (i65 == 3) {
                                    i9 = c1517a.f16747d[eVar3.f16766g];
                                    c9 = 2;
                                } else {
                                    c9 = 2;
                                    i9 = i65 == 2 ? c1517a.f16746c[eVar3.f16767h] : c1517a.f16745b[eVar3.i];
                                }
                                Paint paint3 = this.f16783r;
                                paint3.setColor(i9);
                                c3 = 3;
                                c8 = c9;
                                i8 = i64;
                                canvas2 = canvas3;
                                canvas2.drawRect(i61, i60, i61 + i64, i63, paint3);
                            } else {
                                i8 = i64;
                                canvas2 = canvas3;
                                c3 = 3;
                                c8 = 2;
                            }
                            Bitmap bitmapCreateBitmap2 = Bitmap.createBitmap(this.f16788w, i61, i60, i8, i62);
                            float f3 = c1518b.f16748a;
                            float f7 = i61 / f3;
                            float f8 = i60;
                            float f9 = c1518b.f16749b;
                            arrayList.add(new w0.b(null, null, null, bitmapCreateBitmap2, f8 / f9, 0, 0, f7, 0, Integer.MIN_VALUE, -3.4028235E38f, i8 / f3, i62 / f9, false, -16777216, Integer.MIN_VALUE, 0.0f));
                            canvas2.drawColor(0, PorterDuff.Mode.CLEAR);
                            canvas2.restore();
                            i48 = i59 + 1;
                            z8 = z9;
                            q04 = q06;
                            gVar = gVar3;
                        }
                    }
                } else {
                    c1444a = new C1444a(-9223372036854775807L, -9223372036854775807L, arrayList);
                }
            }
        }
        dVar.a(c1444a);
    }

    @Override // q1.InterfaceC1456m
    public final /* synthetic */ InterfaceC1447d d(byte[] bArr, int i, int i5) {
        return AbstractC0844a.a(this, bArr, i5);
    }

    @Override // q1.InterfaceC1456m
    public final void reset() {
        g gVar = this.f16787v;
        gVar.f16773c.clear();
        gVar.f16774d.clear();
        gVar.f16775e.clear();
        gVar.f16776f.clear();
        gVar.f16777g.clear();
        gVar.f16778h = null;
        gVar.i = null;
    }
}
