package o; import com.drew.imaging.jpeg.JpegProcessingException; import java.io.IOException; import java.util.HashSet; import java.util.Iterator; /* loaded from: classes.dex */ public final class LAT { public static C0860Qct e(Eaa eaa, Iterable iterable) throws JpegProcessingException, IOException { int h = eaa.h(); if (h != 65496) { StringBuilder sb = new StringBuilder("JPEG data is expected to begin with 0xFFD8 (ÿØ) not 0x"); sb.append(Integer.toHexString(h)); throw new JpegProcessingException(sb.toString()); } HashSet hashSet = new HashSet(); Iterator it = iterable.iterator(); while (it.hasNext()) { hashSet.add(Byte.valueOf(it.next().byteValue)); } C0860Qct c0860Qct = new C0860Qct(); while (true) { byte b = eaa.b(); byte b2 = eaa.b(); while (true) { if (b == -1 && b2 != -1 && b2 != 0) { break; } byte b3 = b2; b2 = eaa.b(); b = b3; } if (b2 == -38 || b2 == -39) { return c0860Qct; } int h2 = eaa.h() - 2; if (h2 < 0) { throw new JpegProcessingException("JPEG segment size would be less than zero"); } if (hashSet.contains(Byte.valueOf(b2))) { c0860Qct.d(b2, eaa.a(h2)); } else if (!eaa.d(h2)) { return c0860Qct; } } } }