package com.ss.android.ttve.nativePort;

import X.8XX;
import X.C0347IDi;
import X.C0538IKr;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;

public class VEBingoManager {
    public static int Bingo_TransBlack = 2;
    public static int Bingo_TransDissolve = 1;
    public static int Bingo_TransNull = 0;
    public static int Bingo_TransWhite = 3;
    public static int Bingo_TransZoomIn = 5;
    public static int Bingo_TransZoomOut = 4;
    public Handler imageHandler;
    public HandlerThread imageHandlerThread;
    public volatile long mNative = 0;
    public Map<Integer, Handler> workThreadHandlerMap = new HashMap();
    public Map<Integer, HandlerThread> workThreadMap = new HashMap();

    private native int[] addVideoClipsByNative(long j, String[] strArr, int i);

    private native VETransitionResult[] getBingoTransitionResultsByNative(long j);

    private native long init(int i);

    private native int processBingoImageFrameByNative(long j, Bitmap bitmap, float f, String str);

    private native int processBingoVideoFrameByNative(long j, ByteBuffer byteBuffer, int i, int i2, float f, String str);

    public native int destroy(long j);

    static {
        Covode.recordClassIndex(49454);
        8XX.LIZ();
    }

    public void destroy() {
        MethodCollector.i(3974);
        reset();
        if (this.mNative > 0) {
            destroy(this.mNative);
            this.mNative = 0;
        }
        MethodCollector.o(3974);
    }

    public VETransitionResult[] getBingoTransitionResults() {
        MethodCollector.i(4487);
        if (this.mNative <= 0) {
            MethodCollector.o(4487);
            return null;
        }
        VETransitionResult[] bingoTransitionResultsByNative = getBingoTransitionResultsByNative(this.mNative);
        MethodCollector.o(4487);
        return bingoTransitionResultsByNative;
    }

    private void reset() {
        for (HandlerThread next : this.workThreadMap.values()) {
            if (next != null) {
                next.quit();
            }
        }
        this.workThreadMap.clear();
        this.workThreadHandlerMap.clear();
        HandlerThread handlerThread = this.imageHandlerThread;
        if (handlerThread != null) {
            handlerThread.quit();
        }
        this.imageHandlerThread = null;
        this.imageHandler = null;
    }

    public long initBingoWithTransition() {
        MethodCollector.i(1386);
        reset();
        if (this.mNative > 0) {
            long j = this.mNative;
            MethodCollector.o(1386);
            return j;
        }
        this.mNative = init(C0538IKr.BingoModelVideoTrans.value);
        long j2 = this.mNative;
        MethodCollector.o(1386);
        return j2;
    }

    public Bitmap decodeBitmap(String str) {
        int i;
        int i2;
        MethodCollector.i(4605);
        if (TextUtils.isEmpty(str)) {
            MethodCollector.o(4605);
            return null;
        }
        try {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            BitmapFactory.decodeFile(str, options);
            if (options.outWidth <= 0 || options.outHeight <= 0) {
                C0347IDi.LIZLLL("VEBingoManager", "inJustDecodeBounds true, invalid out size, outWidth: " + options.outWidth + ", outHeight: " + options.outHeight);
                MethodCollector.o(4605);
                return null;
            }
            int i3 = options.outWidth;
            int i4 = options.outHeight;
            int i5 = 320;
            if (i3 > i4) {
                float f = (((float) i3) * 1.0f) / 320.0f;
                i = (int) f;
                int i6 = (int) (((float) i4) / f);
                int i7 = i6 % 16;
                if (i7 >= 8) {
                    i6 += 16;
                }
                i2 = i6 - i7;
            } else {
                float f2 = (((float) i4) * 1.0f) / 320.0f;
                i = (int) f2;
                int i8 = (int) (((float) i3) / f2);
                int i9 = i8 % 16;
                if (i9 >= 8) {
                    i8 += 16;
                }
                i5 = i8 - i9;
                i2 = 320;
            }
            if (i5 <= 0 || i2 <= 0) {
                C0347IDi.LIZLLL("VEBingoManager", "imagePath: " + str + " invalid scale size, scaleWidth: " + i5 + ", scaleHeight: " + i2 + ", bitmap origin width: " + i3 + ", height: " + i4);
                MethodCollector.o(4605);
                return null;
            }
            if (i > 1) {
                options.inSampleSize = i;
            }
            options.inJustDecodeBounds = false;
            options.inPreferredConfig = Bitmap.Config.ARGB_8888;
            Bitmap decodeFile = BitmapFactory.decodeFile(str, options);
            if (decodeFile == null) {
                C0347IDi.LIZLLL("VEBingoManager", "BitmapFactory.decodeFile(inJustDecodeBounds false) failed: ".concat(String.valueOf(str)));
                MethodCollector.o(4605);
                return null;
            }
            C0347IDi.LIZ("VEBingoManager", "imagePath: " + str + ", origin size: " + i3 + "*" + i4 + ", scale size: " + i5 + "*" + i2 + ", inSampleSize: " + i + ", final size: " + decodeFile.getWidth() + "*" + decodeFile.getHeight() + ", thread: " + Thread.currentThread().getName());
            if (!(decodeFile.getConfig() == Bitmap.Config.ARGB_8888 && decodeFile.getWidth() == i5 && decodeFile.getHeight() == i2)) {
                C0347IDi.LIZ("VEBingoManager", "switch bitmap, config from " + decodeFile.getConfig().name() + " to " + Bitmap.Config.ARGB_8888.name() + ", size from " + decodeFile.getWidth() + "*" + decodeFile.getHeight() + " to " + i5 + "*" + i2);
                Bitmap createBitmap = Bitmap.createBitmap(i5, i2, Bitmap.Config.ARGB_8888);
                new Canvas(createBitmap).drawBitmap(decodeFile, (Rect) null, new RectF(0.0f, 0.0f, (float) i5, (float) i2), (Paint) null);
                decodeFile.recycle();
                decodeFile = createBitmap;
            }
            MethodCollector.o(4605);
            return decodeFile;
        } catch (Exception e) {
            C0347IDi.LIZLLL("VEBingoManager", "decodeBitmap, imagePath: " + str + ", exception: " + e.toString());
            MethodCollector.o(4605);
            return null;
        }
    }

    private int[] addVideoClips(String[] strArr, int i) {
        MethodCollector.i(4338);
        if (this.mNative <= 0) {
            C0347IDi.LIZLLL("VEBingoManager", "addVideoClips, invalid mNative: " + this.mNative);
            MethodCollector.o(4338);
            return null;
        }
        int[] addVideoClipsByNative = addVideoClipsByNative(this.mNative, strArr, i);
        MethodCollector.o(4338);
        return addVideoClipsByNative;
    }

    /* JADX WARNING: Removed duplicated region for block: B:27:0x004d A[SYNTHETIC, Splitter:B:27:0x004d] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private void saveBitmap(java.lang.String r6, android.graphics.Bitmap r7) {
        /*
            r5 = this;
            r4 = 4633(0x1219, float:6.492E-42)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r4)
            java.io.File r3 = new java.io.File
            r3.<init>(r6)
            java.io.File r0 = r3.getParentFile()
            boolean r0 = r0.exists()
            if (r0 != 0) goto L_0x001b
            java.io.File r0 = r3.getParentFile()
            r0.mkdir()
        L_0x001b:
            r1 = 0
            java.io.FileOutputStream r2 = new java.io.FileOutputStream     // Catch:{ Exception -> 0x0034, all -> 0x0046 }
            r2.<init>(r3)     // Catch:{ Exception -> 0x0034, all -> 0x0046 }
            android.graphics.Bitmap$CompressFormat r1 = android.graphics.Bitmap.CompressFormat.JPEG     // Catch:{ Exception -> 0x0032 }
            r0 = 100
            r7.compress(r1, r0, r2)     // Catch:{ Exception -> 0x0032 }
            r2.flush()     // Catch:{ Exception -> 0x0032 }
            r2.close()     // Catch:{ IOException -> 0x0051 }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)
            return
        L_0x0032:
            r0 = move-exception
            goto L_0x0036
        L_0x0034:
            r0 = move-exception
            r2 = r1
        L_0x0036:
            X.0HH.LIZ(r0)     // Catch:{ all -> 0x003a }
            goto L_0x004b
        L_0x003a:
            r0 = move-exception
            if (r2 == 0) goto L_0x0047
            r2.close()     // Catch:{ IOException -> 0x0041 }
            goto L_0x0047
        L_0x0041:
            r1 = move-exception
            X.0HH.LIZ(r1)
            goto L_0x0047
        L_0x0046:
            r0 = move-exception
        L_0x0047:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)
            throw r0
        L_0x004b:
            if (r2 == 0) goto L_0x0059
            r2.close()     // Catch:{ IOException -> 0x0051 }
            goto L_0x0059
        L_0x0051:
            r0 = move-exception
            X.0HH.LIZ(r0)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)
            return
        L_0x0059:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ttve.nativePort.VEBingoManager.saveBitmap(java.lang.String, android.graphics.Bitmap):void");
    }

    public int processBingoImageFrame(Bitmap bitmap, float f, String str) {
        MethodCollector.i(4424);
        if (this.mNative <= 0) {
            MethodCollector.o(4424);
            return -112;
        }
        int processBingoImageFrameByNative = processBingoImageFrameByNative(this.mNative, bitmap, f, str);
        MethodCollector.o(4424);
        return processBingoImageFrameByNative;
    }

    /*  JADX ERROR: JadxRuntimeException in pass: CodeShrinkVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Don't wrap MOVE or CONST insns: 0x000a: MOVE  (r14v0 int) = (r33v0 int)
        	at jadx.core.dex.instructions.args.InsnArg.wrapArg(InsnArg.java:164)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.assignInline(CodeShrinkVisitor.java:133)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.checkInline(CodeShrinkVisitor.java:118)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkBlock(CodeShrinkVisitor.java:65)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkMethod(CodeShrinkVisitor.java:43)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.visit(CodeShrinkVisitor.java:35)
        */
    public void detectTransition(java.lang.String[] r32, int r33, int r34, X.C0546IKz r35) {
        /*
            r31 = this;
            r1 = r31
            r9 = r32
            if (r9 == 0) goto L_0x0010
            int r0 = r9.length
            r2 = 2
            if (r0 < r2) goto L_0x0010
            r14 = r33
            if (r14 <= 0) goto L_0x0010
            if (r34 > 0) goto L_0x0011
        L_0x0010:
            return
        L_0x0011:
            r31.reset()
            r0 = 1000(0x3e8, float:1.401E-42)
            int r0 = r0 / r34
            int[] r23 = r1.addVideoClips(r9, r0)
            if (r23 == 0) goto L_0x0024
            r0 = r23
            int r1 = r0.length
            int r0 = r9.length
            if (r1 == r0) goto L_0x0025
        L_0x0024:
            return
        L_0x0025:
            java.util.HashMap r22 = new java.util.HashMap
            r22.<init>()
            java.util.HashMap r21 = new java.util.HashMap
            r21.<init>()
            java.util.ArrayList r20 = new java.util.ArrayList
            r20.<init>()
            java.util.ArrayList r13 = new java.util.ArrayList
            r13.<init>()
            r12 = 0
            r11 = 0
            r19 = 0
        L_0x003d:
            int r0 = r9.length
            java.lang.String r18 = "VEBingoManager"
            r1 = 1
            if (r12 >= r0) goto L_0x021e
            r10 = r9[r12]
            r0 = r23[r12]
            if (r2 != r0) goto L_0x005a
            java.lang.Integer r1 = java.lang.Integer.valueOf(r12)
            r0 = r20
            r0.add(r1)
            int r19 = r19 + 1
        L_0x0054:
            int r12 = r12 + 1
            r0 = r31
            r2 = 2
            goto L_0x003d
        L_0x005a:
            if (r1 != r0) goto L_0x00b8
            java.lang.Integer r0 = java.lang.Integer.valueOf(r12)
            r13.add(r0)
            r0 = 10
            int[] r8 = new int[r0]
            com.ss.android.ttve.nativePort.TEVideoUtils.getVideoFileInfo(r10, r8)
            r16 = 0
            r0 = r8[r16]
            java.lang.String r2 = ", size: "
            java.lang.String r17 = ", duration: "
            java.lang.String r7 = ", videoPath: "
            java.lang.String r6 = "*"
            if (r0 <= 0) goto L_0x0082
            r15 = 1
            r0 = r8[r15]
            if (r0 <= 0) goto L_0x0082
            r0 = 3
            r0 = r8[r0]
            if (r0 > 0) goto L_0x00b9
        L_0x0082:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "invalid video info, index: "
            r1.<init>(r0)
            r1.append(r12)
            r1.append(r7)
            r1.append(r10)
            r0 = r17
            r1.append(r0)
            r0 = 3
            r0 = r8[r0]
            r1.append(r0)
            r1.append(r2)
            r0 = 0
            r0 = r8[r0]
            r1.append(r0)
            r1.append(r6)
            r0 = 1
            r0 = r8[r0]
            r1.append(r0)
            java.lang.String r1 = r1.toString()
            r0 = r18
            X.C0347IDi.LIZLLL(r0, r1)
        L_0x00b8:
            return
        L_0x00b9:
            r3 = r8[r16]
            r0 = r8[r15]
            r1 = 320(0x140, float:4.48E-43)
            r1 = 8
            r5 = 1134559232(0x43a00000, float:320.0)
            r4 = 1065353216(0x3f800000, float:1.0)
            if (r3 <= r0) goto L_0x0102
            r0 = r8[r16]
            float r3 = (float) r0
            float r3 = r3 * r4
            float r3 = r3 / r5
            r0 = r8[r15]
            float r0 = (float) r0
            float r0 = r0 / r3
            int r5 = (int) r0
            int r0 = r5 % 16
            if (r0 < r1) goto L_0x00d7
            int r5 = r5 + 16
        L_0x00d7:
            int r5 = r5 - r0
            r4 = 320(0x140, float:4.48E-43)
        L_0x00da:
            if (r5 > 0) goto L_0x011c
        L_0x00dc:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "invalid scale size, index: "
            r1.<init>(r0)
            r1.append(r12)
            r1.append(r7)
            r1.append(r10)
            r1.append(r2)
            r1.append(r4)
            r1.append(r6)
            r1.append(r5)
            java.lang.String r1 = r1.toString()
            r0 = r18
            X.C0347IDi.LIZLLL(r0, r1)
            return
        L_0x0102:
            r0 = 1
            r0 = r8[r0]
            float r1 = (float) r0
            float r1 = r1 * r4
            float r1 = r1 / r5
            r0 = 0
            r0 = r8[r0]
            float r0 = (float) r0
            float r0 = r0 / r1
            int r4 = (int) r0
            int r1 = r4 % 16
            r0 = 8
            if (r1 < r0) goto L_0x0116
            int r4 = r4 + 16
        L_0x0116:
            int r4 = r4 - r1
            r5 = 320(0x140, float:4.48E-43)
            if (r4 <= 0) goto L_0x00dc
            goto L_0x00da
        L_0x011c:
            java.lang.Integer r1 = java.lang.Integer.valueOf(r12)
            X.IKs r0 = new X.IKs
            r0.<init>(r4, r5)
            r24 = r21
            r25 = r1
            r26 = r0
            r24.put(r25, r26)
            r0 = 3
            r3 = r8[r0]
            java.util.LinkedList r2 = new java.util.LinkedList
            r2.<init>()
            if (r12 != 0) goto L_0x014b
            r1 = 0
        L_0x0139:
            if (r1 >= r14) goto L_0x019f
            int r0 = r1 * r34
            int r0 = r3 - r0
            if (r0 < 0) goto L_0x019f
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
            r2.add(r0)
            int r1 = r1 + 1
            goto L_0x0139
        L_0x014b:
            int r1 = r9.length
            r0 = 1
            int r1 = r1 - r0
            if (r12 != r1) goto L_0x0161
            r1 = 0
        L_0x0151:
            if (r1 >= r14) goto L_0x019f
            int r0 = r1 * r34
            if (r0 > r3) goto L_0x019f
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
            r2.add(r0)
            int r1 = r1 + 1
            goto L_0x0151
        L_0x0161:
            r1 = 0
            r16 = 0
        L_0x0164:
            if (r1 >= r14) goto L_0x017a
            int r15 = r1 * r34
            if (r15 > r3) goto L_0x017a
            r0 = r16
            if (r15 <= r0) goto L_0x0170
            r16 = r15
        L_0x0170:
            java.lang.Integer r0 = java.lang.Integer.valueOf(r15)
            r2.add(r0)
            int r1 = r1 + 1
            goto L_0x0164
        L_0x017a:
            r1 = 0
        L_0x017b:
            if (r1 >= r14) goto L_0x019f
            int r0 = r1 * r34
            int r15 = r3 - r0
            if (r15 < 0) goto L_0x019f
            r0 = r16
            if (r15 <= r0) goto L_0x019f
            java.lang.Integer r0 = java.lang.Integer.valueOf(r15)
            r24 = r2
            r25 = r0
            boolean r0 = r24.contains(r25)
            if (r0 != 0) goto L_0x019c
            java.lang.Integer r0 = java.lang.Integer.valueOf(r15)
            r2.add(r0)
        L_0x019c:
            int r1 = r1 + 1
            goto L_0x017b
        L_0x019f:
            java.util.Collections.sort(r2)
            int r16 = r2.size()
            r0 = r16
            int[] r0 = new int[r0]
            r15 = r0
            r1 = 0
        L_0x01ac:
            int r0 = r2.size()
            if (r1 >= r0) goto L_0x01c1
            java.lang.Object r0 = r2.get(r1)
            java.lang.Integer r0 = (java.lang.Integer) r0
            int r0 = r0.intValue()
            r15[r1] = r0
            int r1 = r1 + 1
            goto L_0x01ac
        L_0x01c1:
            java.lang.Integer r0 = java.lang.Integer.valueOf(r12)
            r24 = r22
            r25 = r0
            r26 = r15
            r24.put(r25, r26)
            int r11 = r11 + r16
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "video clip, index: "
            r1.<init>(r0)
            r1.append(r12)
            r1.append(r7)
            r1.append(r10)
            r15 = r1
            r16 = r17
            r15.append(r16)
            r1.append(r3)
            java.lang.String r0 = ", origin size: "
            r1.append(r0)
            r0 = 0
            r0 = r8[r0]
            r1.append(r0)
            r1.append(r6)
            r0 = 1
            r0 = r8[r0]
            r1.append(r0)
            java.lang.String r0 = ", scale size: "
            r1.append(r0)
            r1.append(r4)
            r1.append(r6)
            r1.append(r5)
            java.lang.String r0 = ", ptsList: "
            r1.append(r0)
            r1.append(r2)
            java.lang.String r1 = r1.toString()
            r0 = r18
            X.C0347IDi.LIZ(r0, r1)
            goto L_0x0054
        L_0x021e:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "total video frame num: "
            r1.<init>(r0)
            r1.append(r11)
            java.lang.String r0 = ", total image frame num: "
            r1.append(r0)
            r0 = r19
            r1.append(r0)
            java.lang.String r0 = ", image clip: "
            r1.append(r0)
            r0 = r20
            r1.append(r0)
            java.lang.String r1 = r1.toString()
            r0 = r18
            X.C0347IDi.LIZ(r0, r1)
            X.IKw r3 = new X.IKw
            int r11 = r11 + r19
            r0 = 0
            r2 = r31
            r1 = r35
            r3.<init>(r2, r11, r1, r0)
            java.util.HashMap r4 = new java.util.HashMap
            r4.<init>()
            int r1 = r13.size()
            r0 = 2
            if (r1 <= r0) goto L_0x0379
            int r10 = r13.size()
            r0 = 3
            int r10 = r10 / r0
            int r8 = r13.size()
            int r8 = r8 % r0
            if (r10 <= 0) goto L_0x02b2
            r7 = 0
        L_0x026b:
            java.util.ArrayList r5 = new java.util.ArrayList
            r5.<init>()
            int r6 = r7 * r10
        L_0x0272:
            int r1 = r7 + 1
            int r0 = r1 * r10
            if (r6 >= r0) goto L_0x0288
            int r0 = r13.size()
            if (r6 >= r0) goto L_0x0288
            java.lang.Object r0 = r13.get(r6)
            r5.add(r0)
            int r6 = r6 + 1
            goto L_0x0272
        L_0x0288:
            int r0 = r5.size()
            if (r0 <= 0) goto L_0x029f
            java.lang.Integer r0 = java.lang.Integer.valueOf(r7)
            java.lang.Object r0 = r4.get(r0)
            if (r0 != 0) goto L_0x02a4
            java.lang.Integer r0 = java.lang.Integer.valueOf(r7)
            r4.put(r0, r5)
        L_0x029f:
            r7 = r1
            r0 = 3
            if (r7 >= r0) goto L_0x02b2
            goto L_0x026b
        L_0x02a4:
            java.lang.Integer r0 = java.lang.Integer.valueOf(r7)
            java.lang.Object r0 = r4.get(r0)
            java.util.List r0 = (java.util.List) r0
            r0.addAll(r5)
            goto L_0x029f
        L_0x02b2:
            if (r8 <= 0) goto L_0x02f6
            int r6 = r13.size()
            int r6 = r6 - r8
            r5 = 0
        L_0x02ba:
            int r0 = r13.size()
            if (r6 >= r0) goto L_0x02f6
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            java.lang.Object r0 = r4.get(r0)
            if (r0 != 0) goto L_0x02e4
            java.util.ArrayList r1 = new java.util.ArrayList
            r1.<init>()
            java.lang.Object r0 = r13.get(r6)
            r1.add(r0)
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            r4.put(r0, r1)
        L_0x02dd:
            int r5 = r5 + 1
            r0 = 3
            int r5 = r5 % r0
            int r6 = r6 + 1
            goto L_0x02ba
        L_0x02e4:
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            java.lang.Object r1 = r4.get(r0)
            java.util.List r1 = (java.util.List) r1
            java.lang.Object r0 = r13.get(r6)
            r1.add(r0)
            goto L_0x02dd
        L_0x02f6:
            r0 = 3
            r5 = 0
        L_0x02f8:
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            java.lang.Object r6 = r4.get(r0)
            java.util.List r6 = (java.util.List) r6
            if (r6 == 0) goto L_0x0372
            int r0 = r6.size()
            if (r0 <= 0) goto L_0x0372
            android.os.HandlerThread r11 = new android.os.HandlerThread
            java.lang.String r0 = java.lang.String.valueOf(r5)
            java.lang.String r7 = "HandlerThread_Video_"
            java.lang.String r0 = r7.concat(r0)
            r11.<init>(r0)
            r11.start()
            X.IKt r23 = new X.IKt
            android.os.Looper r25 = r11.getLooper()
            r24 = r31
            r10 = r23
            r12 = r22
            r8 = 1
            r0 = 3
            r26 = r22
            r27 = r9
            r28 = r21
            r29 = r6
            r30 = r3
            r23.<init>(r24, r25, r26, r27, r28, r29, r30)
            java.util.Map<java.lang.Integer, android.os.HandlerThread> r1 = r2.workThreadMap
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            r1.put(r0, r11)
            java.util.Map<java.lang.Integer, android.os.Handler> r1 = r2.workThreadHandlerMap
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            r1.put(r0, r10)
            android.os.Message r0 = android.os.Message.obtain(r10, r8)
            r0.sendToTarget()
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>(r7)
            r1.append(r5)
            java.lang.String r0 = " is responsible for "
            r1.append(r0)
            r1.append(r6)
            java.lang.String r1 = r1.toString()
            r0 = r18
            X.C0347IDi.LIZ(r0, r1)
        L_0x0369:
            int r5 = r5 + 1
            r22 = r12
            r0 = 1
            r0 = 3
            if (r5 >= r0) goto L_0x0377
            goto L_0x02f8
        L_0x0372:
            r12 = r22
            r0 = 1
            r0 = 3
            goto L_0x0369
        L_0x0377:
            r4 = 1
            goto L_0x03ca
        L_0x0379:
            r4 = 1
            int r0 = r13.size()
            if (r0 <= 0) goto L_0x03ca
            android.os.HandlerThread r7 = new android.os.HandlerThread
            java.lang.String r0 = "HandlerThread_Video_Single"
            r7.<init>(r0)
            r7.start()
            X.IKt r6 = new X.IKt
            android.os.Looper r24 = r7.getLooper()
            r23 = r31
            r25 = r22
            r26 = r9
            r27 = r21
            r28 = r13
            r29 = r3
            r22 = r6
            r22.<init>(r23, r24, r25, r26, r27, r28, r29)
            java.util.Map<java.lang.Integer, android.os.HandlerThread> r1 = r2.workThreadMap
            r5 = 0
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            r1.put(r0, r7)
            java.util.Map<java.lang.Integer, android.os.Handler> r1 = r2.workThreadHandlerMap
            java.lang.Integer r0 = java.lang.Integer.valueOf(r5)
            r1.put(r0, r6)
            android.os.Message r0 = android.os.Message.obtain(r6, r4)
            r0.sendToTarget()
            java.lang.String r1 = java.lang.String.valueOf(r13)
            java.lang.String r0 = "HandlerThread_Single  is responsible for "
            java.lang.String r1 = r0.concat(r1)
            r0 = r18
            X.C0347IDi.LIZ(r0, r1)
        L_0x03ca:
            int r0 = r20.size()
            if (r0 <= 0) goto L_0x03f6
            android.os.HandlerThread r1 = new android.os.HandlerThread
            java.lang.String r0 = "HandlerThread_Image"
            r1.<init>(r0)
            r2.imageHandlerThread = r1
            r1.start()
            X.IKu r5 = new X.IKu
            android.os.HandlerThread r0 = r2.imageHandlerThread
            android.os.Looper r7 = r0.getLooper()
            r6 = r31
            r8 = r9
            r9 = r20
            r10 = r3
            r5.<init>(r6, r7, r8, r9, r10)
            r2.imageHandler = r5
            android.os.Message r0 = android.os.Message.obtain(r5, r4)
            r0.sendToTarget()
        L_0x03f6:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ttve.nativePort.VEBingoManager.detectTransition(java.lang.String[], int, int, X.IKz):void");
    }

    public int processBingoVideoFrame(ByteBuffer byteBuffer, int i, int i2, float f, String str) {
        MethodCollector.i(4342);
        if (this.mNative <= 0) {
            MethodCollector.o(4342);
            return -112;
        }
        int processBingoVideoFrameByNative = processBingoVideoFrameByNative(this.mNative, byteBuffer, i, i2, f, str);
        MethodCollector.o(4342);
        return processBingoVideoFrameByNative;
    }
}
