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

import java.nio.ByteBuffer;

/* JADX INFO: loaded from: classes2.dex */
public final class wm2 extends y80 {

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public static final int f18122i = Float.floatToIntBits(Float.NaN);

    public static void i(int i10, ByteBuffer byteBuffer) {
        int iFloatToIntBits = Float.floatToIntBits((float) (((double) i10) * 4.656612875245797E-10d));
        if (iFloatToIntBits == f18122i) {
            iFloatToIntBits = Float.floatToIntBits(0.0f);
        }
        byteBuffer.putInt(iFloatToIntBits);
    }

    @Override // com.google.android.gms.internal.ads.i80
    public final void b(ByteBuffer byteBuffer) {
        ByteBuffer byteBufferD;
        int iPosition = byteBuffer.position();
        int iLimit = byteBuffer.limit();
        int i10 = iLimit - iPosition;
        int i11 = this.f18748b.f16309c;
        if (i11 == 2) {
            byteBufferD = d(i10 + i10);
            while (iPosition < iLimit) {
                i(((byteBuffer.get(iPosition) & 255) << 16) | ((byteBuffer.get(iPosition + 1) & 255) << 24), byteBufferD);
                iPosition += 2;
            }
        } else if (i11 == 1342177280) {
            byteBufferD = d((i10 / 3) * 4);
            while (iPosition < iLimit) {
                i(((byteBuffer.get(iPosition + 2) & 255) << 8) | ((byteBuffer.get(iPosition + 1) & 255) << 16) | ((byteBuffer.get(iPosition) & 255) << 24), byteBufferD);
                iPosition += 3;
            }
        } else if (i11 == 1610612736) {
            byteBufferD = d(i10);
            while (iPosition < iLimit) {
                int i12 = byteBuffer.get(iPosition + 3) & 255;
                int i13 = (byteBuffer.get(iPosition + 2) & 255) << 8;
                i(i12 | i13 | ((byteBuffer.get(iPosition + 1) & 255) << 16) | ((byteBuffer.get(iPosition) & 255) << 24), byteBufferD);
                iPosition += 4;
            }
        } else if (i11 == 21) {
            byteBufferD = d((i10 / 3) * 4);
            while (iPosition < iLimit) {
                i(((byteBuffer.get(iPosition) & 255) << 8) | ((byteBuffer.get(iPosition + 1) & 255) << 16) | ((byteBuffer.get(iPosition + 2) & 255) << 24), byteBufferD);
                iPosition += 3;
            }
        } else {
            if (i11 != 22) {
                throw new IllegalStateException();
            }
            byteBufferD = d(i10);
            while (iPosition < iLimit) {
                int i14 = byteBuffer.get(iPosition) & 255;
                int i15 = (byteBuffer.get(iPosition + 1) & 255) << 8;
                i(i14 | i15 | ((byteBuffer.get(iPosition + 2) & 255) << 16) | ((byteBuffer.get(iPosition + 3) & 255) << 24), byteBufferD);
                iPosition += 4;
            }
        }
        byteBuffer.position(byteBuffer.limit());
        byteBufferD.flip();
    }

    @Override // com.google.android.gms.internal.ads.y80
    public final s60 e(s60 s60Var) throws zzcn {
        String str = bb1.f9474a;
        int i10 = s60Var.f16309c;
        if (i10 != 21 && i10 != 1342177280 && i10 != 22 && i10 != 1610612736) {
            if (i10 == 4) {
                return s60.f16306e;
            }
            if (i10 != 2) {
                throw new zzcn("Unhandled input format:", s60Var);
            }
        }
        return new s60(s60Var.f16307a, s60Var.f16308b, 4);
    }
}
