MD5 校验值:61e58c10a11e4adec8760ee3854e996a
g.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package V; import android.content.res.AssetManager; import android.media.MediaMetadataRetriever; import android.os.Build; import android.system.OsConstants; import android.util.Log; import androidx.fragment.app.X; import f0.AbstractC1761a; import java.io.BufferedInputStream; import java.io.EOFException; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.TimeZone; import java.util.regex.Pattern; import java.util.zip.CRC32; import org.apache.http.HttpStatus; import org.mozilla.classfile.ByteCode; public final class g { public static final byte[] f3830A; public static final String[] f3831B; public static final int[] f3832C; public static final byte[] f3833D; public static final d f3834E; public static final d[][] f3835F; public static final d[] G; public static final HashMap[] f3836H; public static final HashMap[] f3837I; public static final HashSet f3838J; public static final HashMap f3839K; public static final Charset f3840L; public static final byte[] f3841M; public static final byte[] f3842N; public static final boolean f3843l = Log.isLoggable("ExifInterface", 3); public static final int[] f3844m; public static final int[] f3845n; public static final byte[] f3846o; public static final byte[] f3847p; public static final byte[] f3848q; public static final byte[] f3849r; public static final byte[] f3850s; public static final byte[] f3851t; public static final byte[] f3852u; public static final byte[] f3853v; public static final byte[] f3854w; public static final byte[] f3855x; public static final byte[] f3856y; public static final byte[] f3857z; public final FileDescriptor f3858a; public final AssetManager.AssetInputStream f3859b; public int f3860c; public final HashMap[] d; public final HashSet e; public ByteOrder f3861f; public boolean f3862g; public int f3863h; public int f3864i; public int f3865j; public int f3866k; static { Arrays.asList(1, 6, 3, 8); Arrays.asList(2, 7, 4, 5); f3844m = new int[]{8, 8, 8}; f3845n = new int[]{8}; f3846o = new byte[]{-1, -40, -1}; f3847p = new byte[]{102, 116, 121, 112}; f3848q = new byte[]{109, 105, 102, 49}; f3849r = new byte[]{104, 101, 105, 99}; f3850s = new byte[]{79, 76, 89, 77, 80, 0}; f3851t = new byte[]{79, 76, 89, 77, 80, 85, 83, 0, 73, 73}; f3852u = new byte[]{-119, 80, 78, 71, 13, 10, 26, 10}; f3853v = new byte[]{101, 88, 73, 102}; f3854w = new byte[]{73, 72, 68, 82}; f3855x = new byte[]{73, 69, 78, 68}; f3856y = new byte[]{82, 73, 70, 70}; f3857z = new byte[]{87, 69, 66, 80}; f3830A = new byte[]{69, 88, 73, 70}; "VP8X".getBytes(Charset.defaultCharset()); "VP8L".getBytes(Charset.defaultCharset()); "VP8 ".getBytes(Charset.defaultCharset()); "ANIM".getBytes(Charset.defaultCharset()); "ANMF".getBytes(Charset.defaultCharset()); f3831B = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"}; f3832C = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1}; f3833D = new byte[]{65, 83, 67, 73, 73, 0, 0, 0}; d[] dVarArr = {new d("NewSubfileType", ByteCode.IMPDEP1, 4), new d("SubfileType", 255, 4), new d(256, 3, 4, "ImageWidth"), new d(257, 3, 4, "ImageLength"), new d("BitsPerSample", 258, 3), new d("Compression", 259, 3), new d("PhotometricInterpretation", 262, 3), new d("ImageDescription", 270, 2), new d("Make", 271, 2), new d("Model", 272, 2), new d(273, 3, 4, "StripOffsets"), new d("Orientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d(278, 3, 4, "RowsPerStrip"), new d(279, 3, 4, "StripByteCounts"), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", HttpStatus.SC_MOVED_PERMANENTLY, 3), new d("Software", HttpStatus.SC_USE_PROXY, 2), new d("DateTime", 306, 2), new d("Artist", 315, 2), new d("WhitePoint", 318, 5), new d("PrimaryChromaticities", 319, 5), new d("SubIFDPointer", 330, 4), new d("JPEGInterchangeFormat", 513, 4), new d("JPEGInterchangeFormatLength", 514, 4), new d("YCbCrCoefficients", 529, 5), new d("YCbCrSubSampling", 530, 3), new d("YCbCrPositioning", 531, 3), new d("ReferenceBlackWhite", 532, 5), new d("Copyright", 33432, 2), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("SensorTopBorder", 4, 4), new d("SensorLeftBorder", 5, 4), new d("SensorBottomBorder", 6, 4), new d("SensorRightBorder", 7, 4), new d("ISO", 23, 3), new d("JpgFromRaw", 46, 7), new d("Xmp", 700, 1)}; d[] dVarArr2 = {new d("ExposureTime", 33434, 5), new d("FNumber", 33437, 5), new d("ExposureProgram", 34850, 3), new d("SpectralSensitivity", 34852, 2), new d("PhotographicSensitivity", 34855, 3), new d("OECF", 34856, 7), new d("SensitivityType", 34864, 3), new d("StandardOutputSensitivity", 34865, 4), new d("RecommendedExposureIndex", 34866, 4), new d("ISOSpeed", 34867, 4), new d("ISOSpeedLatitudeyyy", 34868, 4), new d("ISOSpeedLatitudezzz", 34869, 4), new d("ExifVersion", 36864, 2), new d("DateTimeOriginal", 36867, 2), new d("DateTimeDigitized", 36868, 2), new d("OffsetTime", 36880, 2), new d("OffsetTimeOriginal", 36881, 2), new d("OffsetTimeDigitized", 36882, 2), new d("ComponentsConfiguration", 37121, 7), new d("CompressedBitsPerPixel", 37122, 5), new d("ShutterSpeedValue", 37377, 10), new d("ApertureValue", 37378, 5), new d("BrightnessValue", 37379, 10), new d("ExposureBiasValue", 37380, 10), new d("MaxApertureValue", 37381, 5), new d("SubjectDistance", 37382, 5), new d("MeteringMode", 37383, 3), new d("LightSource", 37384, 3), new d("Flash", 37385, 3), new d("FocalLength", 37386, 5), new d("SubjectArea", 37396, 3), new d("MakerNote", 37500, 7), new d("UserComment", 37510, 7), new d("SubSecTime", 37520, 2), new d("SubSecTimeOriginal", 37521, 2), new d("SubSecTimeDigitized", 37522, 2), new d("FlashpixVersion", 40960, 7), new d("ColorSpace", 40961, 3), new d(40962, 3, 4, "PixelXDimension"), new d(40963, 3, 4, "PixelYDimension"), new d("RelatedSoundFile", 40964, 2), new d("InteroperabilityIFDPointer", 40965, 4), new d("FlashEnergy", 41483, 5), new d("SpatialFrequencyResponse", 41484, 7), new d("FocalPlaneXResolution", 41486, 5), new d("FocalPlaneYResolution", 41487, 5), new d("FocalPlaneResolutionUnit", 41488, 3), new d("SubjectLocation", 41492, 3), new d("ExposureIndex", 41493, 5), new d("SensingMethod", 41495, 3), new d("FileSource", 41728, 7), new d("SceneType", 41729, 7), new d("CFAPattern", 41730, 7), new d("CustomRendered", 41985, 3), new d("ExposureMode", 41986, 3), new d("WhiteBalance", 41987, 3), new d("DigitalZoomRatio", 41988, 5), new d("FocalLengthIn35mmFilm", 41989, 3), new d("SceneCaptureType", 41990, 3), new d("GainControl", 41991, 3), new d("Contrast", 41992, 3), new d("Saturation", 41993, 3), new d("Sharpness", 41994, 3), new d("DeviceSettingDescription", 41995, 7), new d("SubjectDistanceRange", 41996, 3), new d("ImageUniqueID", 42016, 2), new d("CameraOwnerName", 42032, 2), new d("BodySerialNumber", 42033, 2), new d("LensSpecification", 42034, 5), new d("LensMake", 42035, 2), new d("LensModel", 42036, 2), new d("Gamma", 42240, 5), new d("DNGVersion", 50706, 1), new d(50720, 3, 4, "DefaultCropSize")}; d[] dVarArr3 = {new d("GPSVersionID", 0, 1), new d("GPSLatitudeRef", 1, 2), new d(2, 5, 10, "GPSLatitude"), new d("GPSLongitudeRef", 3, 2), new d(4, 5, 10, "GPSLongitude"), new d("GPSAltitudeRef", 5, 1), new d("GPSAltitude", 6, 5), new d("GPSTimeStamp", 7, 5), new d("GPSSatellites", 8, 2), new d("GPSStatus", 9, 2), new d("GPSMeasureMode", 10, 2), new d("GPSDOP", 11, 5), new d("GPSSpeedRef", 12, 2), new d("GPSSpeed", 13, 5), new d("GPSTrackRef", 14, 2), new d("GPSTrack", 15, 5), new d("GPSImgDirectionRef", 16, 2), new d("GPSImgDirection", 17, 5), new d("GPSMapDatum", 18, 2), new d("GPSDestLatitudeRef", 19, 2), new d("GPSDestLatitude", 20, 5), new d("GPSDestLongitudeRef", 21, 2), new d("GPSDestLongitude", 22, 5), new d("GPSDestBearingRef", 23, 2), new d("GPSDestBearing", 24, 5), new d("GPSDestDistanceRef", 25, 2), new d("GPSDestDistance", 26, 5), new d("GPSProcessingMethod", 27, 7), new d("GPSAreaInformation", 28, 7), new d("GPSDateStamp", 29, 2), new d("GPSDifferential", 30, 3), new d("GPSHPositioningError", 31, 5)}; d[] dVarArr4 = {new d("InteroperabilityIndex", 1, 2)}; d[] dVarArr5 = {new d("NewSubfileType", ByteCode.IMPDEP1, 4), new d("SubfileType", 255, 4), new d(256, 3, 4, "ThumbnailImageWidth"), new d(257, 3, 4, "ThumbnailImageLength"), new d("BitsPerSample", 258, 3), new d("Compression", 259, 3), new d("PhotometricInterpretation", 262, 3), new d("ImageDescription", 270, 2), new d("Make", 271, 2), new d("Model", 272, 2), new d(273, 3, 4, "StripOffsets"), new d("ThumbnailOrientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d(278, 3, 4, "RowsPerStrip"), new d(279, 3, 4, "StripByteCounts"), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", HttpStatus.SC_MOVED_PERMANENTLY, 3), new d("Software", HttpStatus.SC_USE_PROXY, 2), new d("DateTime", 306, 2), new d("Artist", 315, 2), new d("WhitePoint", 318, 5), new d("PrimaryChromaticities", 319, 5), new d("SubIFDPointer", 330, 4), new d("JPEGInterchangeFormat", 513, 4), new d("JPEGInterchangeFormatLength", 514, 4), new d("YCbCrCoefficients", 529, 5), new d("YCbCrSubSampling", 530, 3), new d("YCbCrPositioning", 531, 3), new d("ReferenceBlackWhite", 532, 5), new d("Xmp", 700, 1), new d("Copyright", 33432, 2), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("DNGVersion", 50706, 1), new d(50720, 3, 4, "DefaultCropSize")}; f3834E = new d("StripOffsets", 273, 3); f3835F = new d[][]{dVarArr, dVarArr2, dVarArr3, dVarArr4, dVarArr5, dVarArr, new d[]{new d("ThumbnailImage", 256, 7), new d("CameraSettingsIFDPointer", 8224, 4), new d("ImageProcessingIFDPointer", 8256, 4)}, new d[]{new d("PreviewImageStart", 257, 4), new d("PreviewImageLength", 258, 4)}, new d[]{new d("AspectFrame", 4371, 3)}, new d[]{new d("ColorSpace", 55, 3)}}; G = new d[]{new d("SubIFDPointer", 330, 4), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("InteroperabilityIFDPointer", 40965, 4), new d("CameraSettingsIFDPointer", 8224, 1), new d("ImageProcessingIFDPointer", 8256, 1)}; f3836H = new HashMap[10]; f3837I = new HashMap[10]; f3838J = new HashSet(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp")); f3839K = new HashMap(); Charset forName = Charset.forName("US-ASCII"); f3840L = forName; f3841M = "Exif\u0000\u0000".getBytes(forName); f3842N = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName); Locale locale = Locale.US; new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", locale).setTimeZone(TimeZone.getTimeZone("UTC")); new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", locale).setTimeZone(TimeZone.getTimeZone("UTC")); int i5 = 0; while (true) { d[][] dVarArr6 = f3835F; if (i5 >= dVarArr6.length) { HashMap hashMap = f3839K; d[] dVarArr7 = G; hashMap.put(Integer.valueOf(dVarArr7[0].f3825a), 5); hashMap.put(Integer.valueOf(dVarArr7[1].f3825a), 1); hashMap.put(Integer.valueOf(dVarArr7[2].f3825a), 2); hashMap.put(Integer.valueOf(dVarArr7[3].f3825a), 3); hashMap.put(Integer.valueOf(dVarArr7[4].f3825a), 7); hashMap.put(Integer.valueOf(dVarArr7[5].f3825a), 8); Pattern.compile(".*[1-9].*"); Pattern.compile("^(\\d{2}):(\\d{2}):(\\d{2})$"); Pattern.compile("^(\\d{4}):(\\d{2}):(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$"); Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$"); return; } f3836H[i5] = new HashMap(); f3837I[i5] = new HashMap(); for (d dVar : dVarArr6[i5]) { f3836H[i5].put(Integer.valueOf(dVar.f3825a), dVar); f3837I[i5].put(dVar.f3826b, dVar); } i5++; } } public g(InputStream inputStream) { int i5; BufferedInputStream bufferedInputStream; int f7; int i6; int i7; d[][] dVarArr = f3835F; this.d = new HashMap[dVarArr.length]; this.e = new HashSet(dVarArr.length); this.f3861f = ByteOrder.BIG_ENDIAN; if (inputStream != null) { boolean z6 = inputStream instanceof AssetManager.AssetInputStream; boolean z7 = f3843l; if (z6) { this.f3859b = (AssetManager.AssetInputStream) inputStream; } else { if (inputStream instanceof FileInputStream) { FileInputStream fileInputStream = (FileInputStream) inputStream; try { h.c(fileInputStream.getFD(), 0L, OsConstants.SEEK_CUR); this.f3859b = null; this.f3858a = fileInputStream.getFD(); } catch (Exception unused) { if (z7) { Log.d("ExifInterface", "The file descriptor for the given input is not seekable"); } } for (i5 = 0; i5 < dVarArr.length; i5++) { try { try { this.d[i5] = new HashMap(); } catch (Throwable th) { a(); if (z7) { p(); } throw th; } } catch (IOException e) { e = e; if (z7) { Log.w("ExifInterface", "Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.", e); } a(); if (!z7) { return; } p(); return; } catch (UnsupportedOperationException e7) { e = e7; if (z7) { } a(); if (!z7) { } p(); return; } } bufferedInputStream = new BufferedInputStream(inputStream, 5000); f7 = f(bufferedInputStream); this.f3860c = f7; if (f7 != 4 && f7 != 9 && f7 != 13 && f7 != 14) { f fVar = new f(bufferedInputStream); i7 = this.f3860c; if (i7 != 12) { d(fVar); } else if (i7 == 7) { g(fVar); } else if (i7 == 10) { k(fVar); } else { j(fVar); } fVar.b(this.f3863h); u(fVar); a(); if (!z7) { return; } p(); return; } b bVar = new b(bufferedInputStream); i6 = this.f3860c; if (i6 != 4) { e(bVar, 0, 0); } else if (i6 == 13) { h(bVar); } else if (i6 == 9) { i(bVar); } else if (i6 == 14) { l(bVar); } a(); if (!z7) { } p(); return; } this.f3859b = null; } this.f3858a = null; while (i5 < dVarArr.length) { } bufferedInputStream = new BufferedInputStream(inputStream, 5000); f7 = f(bufferedInputStream); this.f3860c = f7; if (f7 != 4) { f fVar2 = new f(bufferedInputStream); i7 = this.f3860c; if (i7 != 12) { } fVar2.b(this.f3863h); u(fVar2); a(); if (!z7) { } p(); return; } b bVar2 = new b(bufferedInputStream); i6 = this.f3860c; if (i6 != 4) { } a(); if (!z7) { } p(); return; } throw new NullPointerException("inputStream cannot be null"); } public static ByteOrder q(b bVar) { short readShort = bVar.readShort(); boolean z6 = f3843l; if (readShort != 18761) { if (readShort == 19789) { if (z6) { Log.d("ExifInterface", "readExifSegment: Byte Align MM"); } return ByteOrder.BIG_ENDIAN; } throw new IOException("Invalid byte order: " + Integer.toHexString(readShort)); } if (z6) { Log.d("ExifInterface", "readExifSegment: Byte Align II"); } return ByteOrder.LITTLE_ENDIAN; } public final void a() { String b7 = b("DateTimeOriginal"); HashMap[] hashMapArr = this.d; if (b7 != null && b("DateTime") == null) { HashMap hashMap = hashMapArr[0]; byte[] bytes = b7.concat("\u0000").getBytes(f3840L); hashMap.put("DateTime", new c(2, bytes, bytes.length)); } if (b("ImageWidth") == null) { hashMapArr[0].put("ImageWidth", c.a(0L, this.f3861f)); } if (b("ImageLength") == null) { hashMapArr[0].put("ImageLength", c.a(0L, this.f3861f)); } if (b("Orientation") == null) { hashMapArr[0].put("Orientation", c.a(0L, this.f3861f)); } if (b("LightSource") == null) { hashMapArr[1].put("LightSource", c.a(0L, this.f3861f)); } } public final String b(String str) { c c7 = c(str); if (c7 != null) { if (!f3838J.contains(str)) { return c7.f(this.f3861f); } if (str.equals("GPSTimeStamp")) { int i5 = c7.f3822a; if (i5 != 5 && i5 != 10) { AbstractC1761a.p(i5, "GPS Timestamp format is not rational. format=", "ExifInterface"); return null; } e[] eVarArr = (e[]) c7.g(this.f3861f); if (eVarArr != null && eVarArr.length == 3) { e eVar = eVarArr[0]; Integer valueOf = Integer.valueOf((int) (((float) eVar.f3828a) / ((float) eVar.f3829b))); e eVar2 = eVarArr[1]; Integer valueOf2 = Integer.valueOf((int) (((float) eVar2.f3828a) / ((float) eVar2.f3829b))); e eVar3 = eVarArr[2]; return String.format("%02d:%02d:%02d", valueOf, valueOf2, Integer.valueOf((int) (((float) eVar3.f3828a) / ((float) eVar3.f3829b)))); } Log.w("ExifInterface", "Invalid GPS Timestamp array. array=" + Arrays.toString(eVarArr)); return null; } try { return Double.toString(c7.d(this.f3861f)); } catch (NumberFormatException unused) { } } return null; } public final c c(String str) { if ("ISOSpeedRatings".equals(str)) { if (f3843l) { Log.d("ExifInterface", "getExifAttribute: Replacing TAG_ISO_SPEED_RATINGS with TAG_PHOTOGRAPHIC_SENSITIVITY."); } str = "PhotographicSensitivity"; } for (int i5 = 0; i5 < f3835F.length; i5++) { c cVar = (c) this.d[i5].get(str); if (cVar != null) { return cVar; } } return null; } public final void d(f fVar) { String str; String str2; String str3; int i5; if (Build.VERSION.SDK_INT >= 28) { MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); try { try { i.a(mediaMetadataRetriever, new a(fVar)); String extractMetadata = mediaMetadataRetriever.extractMetadata(33); String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34); String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26); String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17); if ("yes".equals(extractMetadata3)) { str = mediaMetadataRetriever.extractMetadata(29); str2 = mediaMetadataRetriever.extractMetadata(30); str3 = mediaMetadataRetriever.extractMetadata(31); } else if ("yes".equals(extractMetadata4)) { str = mediaMetadataRetriever.extractMetadata(18); str2 = mediaMetadataRetriever.extractMetadata(19); str3 = mediaMetadataRetriever.extractMetadata(24); } else { str = null; str2 = null; str3 = null; } HashMap[] hashMapArr = this.d; if (str != null) { hashMapArr[0].put("ImageWidth", c.c(Integer.parseInt(str), this.f3861f)); } if (str2 != null) { hashMapArr[0].put("ImageLength", c.c(Integer.parseInt(str2), this.f3861f)); } if (str3 != null) { int parseInt = Integer.parseInt(str3); if (parseInt != 90) { if (parseInt != 180) { if (parseInt != 270) { i5 = 1; } else { i5 = 8; } } else { i5 = 3; } } else { i5 = 6; } hashMapArr[0].put("Orientation", c.c(i5, this.f3861f)); } if (extractMetadata != null && extractMetadata2 != null) { int parseInt2 = Integer.parseInt(extractMetadata); int parseInt3 = Integer.parseInt(extractMetadata2); if (parseInt3 > 6) { fVar.b(parseInt2); byte[] bArr = new byte[6]; if (fVar.read(bArr) == 6) { int i6 = parseInt2 + 6; int i7 = parseInt3 - 6; if (Arrays.equals(bArr, f3841M)) { byte[] bArr2 = new byte[i7]; if (fVar.read(bArr2) == i7) { this.f3863h = i6; r(bArr2, 0); } else { throw new IOException("Can't read exif"); } } else { throw new IOException("Invalid identifier"); } } else { throw new IOException("Can't read identifier"); } } else { throw new IOException("Invalid exif length"); } } if (f3843l) { Log.d("ExifInterface", "Heif meta: " + str + "x" + str2 + ", rotation " + str3); } mediaMetadataRetriever.release(); return; } catch (RuntimeException unused) { throw new UnsupportedOperationException("Failed to read EXIF from HEIF file. Given stream is either malformed or unsupported."); } } catch (Throwable th) { mediaMetadataRetriever.release(); throw th; } } throw new UnsupportedOperationException("Reading EXIF from HEIF files is supported from SDK 28 and above"); } public final void e(b bVar, int i5, int i6) { String str; String str2; boolean z6 = f3843l; if (z6) { Log.d("ExifInterface", "getJpegAttributes starting with: " + bVar); } bVar.e = ByteOrder.BIG_ENDIAN; byte readByte = bVar.readByte(); byte b7 = -1; if (readByte == -1) { if (bVar.readByte() == -40) { int i7 = 2; int i8 = 2; while (true) { byte readByte2 = bVar.readByte(); if (readByte2 == b7) { byte readByte3 = bVar.readByte(); if (z6) { Log.d("ExifInterface", "Found JPEG segment indicator: " + Integer.toHexString(readByte3 & 255)); } if (readByte3 != -39 && readByte3 != -38) { int readUnsignedShort = bVar.readUnsignedShort(); int i9 = readUnsignedShort - 2; int i10 = i8 + 4; if (z6) { Log.d("ExifInterface", "JPEG segment: " + Integer.toHexString(readByte3 & 255) + " (length: " + readUnsignedShort + ")"); } if (i9 >= 0) { HashMap[] hashMapArr = this.d; if (readByte3 != -31) { if (readByte3 != -2) { switch (readByte3) { case -64: case -63: case -62: case -61: break; default: switch (readByte3) { case -59: case -58: case -57: break; default: switch (readByte3) { case -55: case -54: case -53: break; default: switch (readByte3) { } } } } bVar.a(1); HashMap hashMap = hashMapArr[i6]; if (i6 != 4) { str = "ImageLength"; } else { str = "ThumbnailImageLength"; } hashMap.put(str, c.a(bVar.readUnsignedShort(), this.f3861f)); HashMap hashMap2 = hashMapArr[i6]; if (i6 != 4) { str2 = "ImageWidth"; } else { str2 = "ThumbnailImageWidth"; } hashMap2.put(str2, c.a(bVar.readUnsignedShort(), this.f3861f)); i9 = readUnsignedShort - 7; if (i9 < 0) { bVar.a(i9); i8 = i10 + i9; i7 = 2; b7 = -1; } else { throw new IOException("Invalid length"); } } else { byte[] bArr = new byte[i9]; if (bVar.read(bArr) == i9) { if (b("UserComment") == null) { HashMap hashMap3 = hashMapArr[1]; Charset charset = f3840L; byte[] bytes = new String(bArr, charset).concat("\u0000").getBytes(charset); hashMap3.put("UserComment", new c(i7, bytes, bytes.length)); } } else { throw new IOException("Invalid exif"); } } } else { byte[] bArr2 = new byte[i9]; bVar.readFully(bArr2); int i11 = i10 + i9; byte[] bArr3 = f3841M; if (bArr3 != null && i9 >= bArr3.length) { for (int i12 = 0; i12 < bArr3.length; i12++) { if (bArr2[i12] == bArr3[i12]) { } } byte[] copyOfRange = Arrays.copyOfRange(bArr2, bArr3.length, i9); this.f3863h = i5 + i10 + bArr3.length; r(copyOfRange, i6); u(new b(copyOfRange)); i10 = i11; } byte[] bArr4 = f3842N; if (bArr4 != null && i9 >= bArr4.length) { int i13 = 0; while (true) { if (i13 < bArr4.length) { if (bArr2[i13] == bArr4[i13]) { i13++; } } else { int length = i10 + bArr4.length; byte[] copyOfRange2 = Arrays.copyOfRange(bArr2, bArr4.length, i9); if (b("Xmp") == null) { hashMapArr[0].put("Xmp", new c(length, copyOfRange2, 1, copyOfRange2.length)); } } } } i10 = i11; } i9 = 0; if (i9 < 0) { } } else { throw new IOException("Invalid length"); } } } else { throw new IOException("Invalid marker:" + Integer.toHexString(readByte2 & 255)); } } } else { throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255)); } } else { throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255)); } } public final int f(BufferedInputStream bufferedInputStream) { InputStream inputStream; b bVar; b bVar2; b bVar3; boolean z6; b bVar4; b bVar5; boolean z7; boolean z8; boolean z9; b bVar6; long j5; bufferedInputStream.mark(5000); byte[] bArr = new byte[5000]; bufferedInputStream.read(bArr); bufferedInputStream.reset(); int i5 = 0; while (true) { byte[] bArr2 = f3846o; if (i5 >= bArr2.length) { return 4; } if (bArr[i5] != bArr2[i5]) { byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset()); for (int i6 = 0; i6 < bytes.length; i6++) { byte b7 = bArr[i6]; ?? r8 = bytes[i6]; try { if (b7 != r8) { try { bVar = new b(bArr); try { long readInt = bVar.readInt(); byte[] bArr3 = new byte[4]; bVar.read(bArr3); if (Arrays.equals(bArr3, f3847p)) { if (readInt == 1) { readInt = bVar.readLong(); j5 = 16; if (readInt < 16) { } } else { j5 = 8; } long j6 = 5000; if (readInt > j6) { readInt = j6; } long j7 = readInt - j5; if (j7 >= 8) { byte[] bArr4 = new byte[4]; boolean z10 = false; boolean z11 = false; for (long j8 = 0; j8 < j7 / 4 && bVar.read(bArr4) == 4; j8++) { if (j8 != 1) { if (Arrays.equals(bArr4, f3848q)) { z10 = true; } else if (Arrays.equals(bArr4, f3849r)) { z11 = true; } if (z10 && z11) { bVar.close(); return 12; } } } } } } catch (Exception e) { e = e; if (f3843l) { Log.d("ExifInterface", "Exception parsing HEIF file type box.", e); } } } catch (Exception e7) { e = e7; bVar = null; } catch (Throwable th) { th = th; inputStream = null; if (inputStream != null) { inputStream.close(); } throw th; } bVar.close(); try { bVar3 = new b(bArr); try { ByteOrder q6 = q(bVar3); this.f3861f = q6; bVar3.e = q6; short readShort = bVar3.readShort(); if (readShort != 20306 && readShort != 21330) { z6 = false; } else { z6 = true; } bVar3.close(); } catch (Exception unused) { if (bVar3 != null) { bVar3.close(); } z6 = false; if (!z6) { } } catch (Throwable th2) { th = th2; bVar2 = bVar3; if (bVar2 != null) { bVar2.close(); } throw th; } } catch (Exception unused2) { bVar3 = null; } catch (Throwable th3) { th = th3; bVar2 = null; } if (!z6) { return 7; } try { bVar6 = new b(bArr); } catch (Exception unused3) { bVar5 = null; } catch (Throwable th4) { th = th4; bVar4 = null; } try { ByteOrder q7 = q(bVar6); this.f3861f = q7; bVar6.e = q7; if (bVar6.readShort() == 85) { z7 = true; } else { z7 = false; } bVar6.close(); } catch (Exception unused4) { bVar5 = bVar6; if (bVar5 != null) { bVar5.close(); } z7 = false; if (!z7) { } } catch (Throwable th5) { th = th5; bVar4 = bVar6; if (bVar4 != null) { bVar4.close(); } throw th; } if (!z7) { return 10; } int i7 = 0; while (true) { byte[] bArr5 = f3852u; if (i7 < bArr5.length) { if (bArr[i7] != bArr5[i7]) { z8 = false; break; } i7++; } else { z8 = true; break; } } if (z8) { return 13; } int i8 = 0; while (true) { byte[] bArr6 = f3856y; if (i8 < bArr6.length) { if (bArr[i8] != bArr6[i8]) { break; } i8++; } else { int i9 = 0; while (true) { byte[] bArr7 = f3857z; if (i9 < bArr7.length) { if (bArr[bArr6.length + i9 + 4] != bArr7[i9]) { break; } i9++; } else { z9 = true; break; } } } } if (!z9) { return 0; } return 14; } } catch (Throwable th6) { th = th6; inputStream = r8; } } return 9; } i5++; } } public final void g(f fVar) { long j5; c cVar; c cVar2; c cVar3; int i5; int i6; j(fVar); HashMap[] hashMapArr = this.d; c cVar4 = (c) hashMapArr[1].get("MakerNote"); if (cVar4 != null) { f fVar2 = new f(cVar4.d); fVar2.e = this.f3861f; byte[] bArr = f3850s; byte[] bArr2 = new byte[bArr.length]; fVar2.readFully(bArr2); fVar2.b(0L); byte[] bArr3 = f3851t; byte[] bArr4 = new byte[bArr3.length]; fVar2.readFully(bArr4); if (Arrays.equals(bArr2, bArr)) { j5 = 8; } else { if (Arrays.equals(bArr4, bArr3)) { j5 = 12; } s(fVar2, 6); cVar = (c) hashMapArr[7].get("PreviewImageStart"); cVar2 = (c) hashMapArr[7].get("PreviewImageLength"); if (cVar != null && cVar2 != null) { hashMapArr[5].put("JPEGInterchangeFormat", cVar); hashMapArr[5].put("JPEGInterchangeFormatLength", cVar2); } cVar3 = (c) hashMapArr[8].get("AspectFrame"); if (cVar3 == null) { int[] iArr = (int[]) cVar3.g(this.f3861f); if (iArr != null && iArr.length == 4) { int i7 = iArr[2]; int i8 = iArr[0]; if (i7 > i8 && (i5 = iArr[3]) > (i6 = iArr[1])) { int i9 = (i7 - i8) + 1; int i10 = (i5 - i6) + 1; if (i9 < i10) { int i11 = i9 + i10; i10 = i11 - i10; i9 = i11 - i10; } c c7 = c.c(i9, this.f3861f); c c8 = c.c(i10, this.f3861f); hashMapArr[0].put("ImageWidth", c7); hashMapArr[0].put("ImageLength", c8); return; } return; } Log.w("ExifInterface", "Invalid aspect frame values. frame=" + Arrays.toString(iArr)); return; } return; } fVar2.b(j5); s(fVar2, 6); cVar = (c) hashMapArr[7].get("PreviewImageStart"); cVar2 = (c) hashMapArr[7].get("PreviewImageLength"); if (cVar != null) { hashMapArr[5].put("JPEGInterchangeFormat", cVar); hashMapArr[5].put("JPEGInterchangeFormatLength", cVar2); } cVar3 = (c) hashMapArr[8].get("AspectFrame"); if (cVar3 == null) { } } } public final void h(b bVar) { if (f3843l) { Log.d("ExifInterface", "getPngAttributes starting with: " + bVar); } bVar.e = ByteOrder.BIG_ENDIAN; byte[] bArr = f3852u; bVar.a(bArr.length); int length = bArr.length; while (true) { try { int readInt = bVar.readInt(); byte[] bArr2 = new byte[4]; if (bVar.read(bArr2) == 4) { int i5 = length + 8; if (i5 == 16 && !Arrays.equals(bArr2, f3854w)) { throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk"); } if (!Arrays.equals(bArr2, f3855x)) { if (Arrays.equals(bArr2, f3853v)) { byte[] bArr3 = new byte[readInt]; if (bVar.read(bArr3) == readInt) { int readInt2 = bVar.readInt(); CRC32 crc32 = new CRC32(); crc32.update(bArr2); crc32.update(bArr3); if (((int) crc32.getValue()) == readInt2) { this.f3863h = i5; r(bArr3, 0); x(); u(new b(bArr3)); return; } throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + readInt2 + ", calculated CRC value: " + crc32.getValue()); } throw new IOException("Failed to read given length for given PNG chunk type: " + Q5.b.c(bArr2)); } int i6 = readInt + 4; bVar.a(i6); length = i5 + i6; } else { return; } } else { throw new IOException("Encountered invalid length while parsing PNG chunktype"); } } catch (EOFException unused) { throw new IOException("Encountered corrupt PNG file."); } } } public final void i(b bVar) { boolean z6 = f3843l; if (z6) { Log.d("ExifInterface", "getRafAttributes starting with: " + bVar); } bVar.a(84); byte[] bArr = new byte[4]; byte[] bArr2 = new byte[4]; byte[] bArr3 = new byte[4]; bVar.read(bArr); bVar.read(bArr2); bVar.read(bArr3); int i5 = ByteBuffer.wrap(bArr).getInt(); int i6 = ByteBuffer.wrap(bArr2).getInt(); int i7 = ByteBuffer.wrap(bArr3).getInt(); byte[] bArr4 = new byte[i6]; bVar.a(i5 - bVar.f3820f); bVar.read(bArr4); e(new b(bArr4), i5, 5); bVar.a(i7 - bVar.f3820f); bVar.e = ByteOrder.BIG_ENDIAN; int readInt = bVar.readInt(); if (z6) { Log.d("ExifInterface", "numberOfDirectoryEntry: " + readInt); } for (int i8 = 0; i8 < readInt; i8++) { int readUnsignedShort = bVar.readUnsignedShort(); int readUnsignedShort2 = bVar.readUnsignedShort(); if (readUnsignedShort == f3834E.f3825a) { short readShort = bVar.readShort(); short readShort2 = bVar.readShort(); c c7 = c.c(readShort, this.f3861f); c c8 = c.c(readShort2, this.f3861f); HashMap[] hashMapArr = this.d; hashMapArr[0].put("ImageLength", c7); hashMapArr[0].put("ImageWidth", c8); if (z6) { Log.d("ExifInterface", "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2)); return; } return; } bVar.a(readUnsignedShort2); } } public final void j(f fVar) { o(fVar); s(fVar, 0); w(fVar, 0); w(fVar, 5); w(fVar, 4); x(); if (this.f3860c == 8) { HashMap[] hashMapArr = this.d; c cVar = (c) hashMapArr[1].get("MakerNote"); if (cVar != null) { f fVar2 = new f(cVar.d); fVar2.e = this.f3861f; fVar2.a(6); s(fVar2, 9); c cVar2 = (c) hashMapArr[9].get("ColorSpace"); if (cVar2 != null) { hashMapArr[1].put("ColorSpace", cVar2); } } } } public final void k(f fVar) { if (f3843l) { Log.d("ExifInterface", "getRw2Attributes starting with: " + fVar); } j(fVar); HashMap[] hashMapArr = this.d; c cVar = (c) hashMapArr[0].get("JpgFromRaw"); if (cVar != null) { e(new b(cVar.d), (int) cVar.f3824c, 5); } c cVar2 = (c) hashMapArr[0].get("ISO"); c cVar3 = (c) hashMapArr[1].get("PhotographicSensitivity"); if (cVar2 != null && cVar3 == null) { hashMapArr[1].put("PhotographicSensitivity", cVar2); } } public final void l(b bVar) { if (f3843l) { Log.d("ExifInterface", "getWebpAttributes starting with: " + bVar); } bVar.e = ByteOrder.LITTLE_ENDIAN; bVar.a(f3856y.length); int readInt = bVar.readInt() + 8; byte[] bArr = f3857z; bVar.a(bArr.length); int length = bArr.length + 8; while (true) { try { byte[] bArr2 = new byte[4]; if (bVar.read(bArr2) == 4) { int readInt2 = bVar.readInt(); int i5 = length + 8; if (Arrays.equals(f3830A, bArr2)) { byte[] bArr3 = new byte[readInt2]; if (bVar.read(bArr3) == readInt2) { this.f3863h = i5; r(bArr3, 0); u(new b(bArr3)); return; } else { throw new IOException("Failed to read given length for given PNG chunk type: " + Q5.b.c(bArr2)); } } if (readInt2 % 2 == 1) { readInt2++; } length = i5 + readInt2; if (length == readInt) { return; } if (length <= readInt) { bVar.a(readInt2); } else { throw new IOException("Encountered WebP file with invalid chunk size"); } } else { throw new IOException("Encountered invalid length while parsing WebP chunktype"); } } catch (EOFException unused) { throw new IOException("Encountered corrupt WebP file."); } } } public final void m(b bVar, HashMap hashMap) { c cVar = (c) hashMap.get("JPEGInterchangeFormat"); c cVar2 = (c) hashMap.get("JPEGInterchangeFormatLength"); if (cVar != null && cVar2 != null) { int e = cVar.e(this.f3861f); int e7 = cVar2.e(this.f3861f); if (this.f3860c == 7) { e += this.f3864i; } if (e > 0 && e7 > 0 && this.f3859b == null && this.f3858a == null) { bVar.skip(e); bVar.read(new byte[e7]); } if (f3843l) { Log.d("ExifInterface", "Setting thumbnail attributes with offset: " + e + ", length: " + e7); } } } public final boolean n(HashMap hashMap) { c cVar = (c) hashMap.get("ImageLength"); c cVar2 = (c) hashMap.get("ImageWidth"); if (cVar != null && cVar2 != null) { int e = cVar.e(this.f3861f); int e7 = cVar2.e(this.f3861f); if (e <= 512 && e7 <= 512) { return true; } return false; } return false; } public final void o(b bVar) { ByteOrder q6 = q(bVar); this.f3861f = q6; bVar.e = q6; int readUnsignedShort = bVar.readUnsignedShort(); int i5 = this.f3860c; if (i5 != 7 && i5 != 10 && readUnsignedShort != 42) { throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort)); } int readInt = bVar.readInt(); if (readInt >= 8) { int i6 = readInt - 8; if (i6 > 0) { bVar.a(i6); return; } return; } throw new IOException(AbstractC1761a.e(readInt, "Invalid first Ifd offset: ")); } public final void p() { int i5 = 0; while (true) { HashMap[] hashMapArr = this.d; if (i5 < hashMapArr.length) { StringBuilder u3 = X.u(i5, "The size of tag group[", "]: "); u3.append(hashMapArr[i5].size()); Log.d("ExifInterface", u3.toString()); for (Map.Entry entry : hashMapArr[i5].entrySet()) { c cVar = (c) entry.getValue(); Log.d("ExifInterface", "tagName: " + ((String) entry.getKey()) + ", tagType: " + cVar.toString() + ", tagValue: '" + cVar.f(this.f3861f) + "'"); } i5++; } else { return; } } } public final void r(byte[] bArr, int i5) { f fVar = new f(bArr); o(fVar); s(fVar, i5); } public final void s(f fVar, int i5) { HashMap[] hashMapArr; StringBuilder sb; short s3; HashSet hashSet; short s4; HashMap[] hashMapArr2; StringBuilder sb2; long j5; boolean z6; int i6; long j6; int i7; int i8; int readUnsignedShort; long j7; HashSet hashSet2; StringBuilder sb3; String str; Integer valueOf = Integer.valueOf(fVar.f3820f); HashSet hashSet3 = this.e; hashSet3.add(valueOf); short readShort = fVar.readShort(); boolean z7 = f3843l; if (z7) { Log.d("ExifInterface", "numberOfDirectoryEntry: " + ((int) readShort)); } if (readShort <= 0) { return; } short s6 = 0; while (true) { hashMapArr = this.d; if (s6 >= readShort) { break; } int readUnsignedShort2 = fVar.readUnsignedShort(); int readUnsignedShort3 = fVar.readUnsignedShort(); int readInt = fVar.readInt(); long j8 = fVar.f3820f + 4; d dVar = (d) f3836H[i5].get(Integer.valueOf(readUnsignedShort2)); if (z7) { Integer valueOf2 = Integer.valueOf(i5); s3 = readShort; Integer valueOf3 = Integer.valueOf(readUnsignedShort2); s4 = s6; if (dVar != null) { str = dVar.f3826b; } else { str = null; } hashSet = hashSet3; hashMapArr2 = hashMapArr; Log.d("ExifInterface", String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", valueOf2, valueOf3, str, Integer.valueOf(readUnsignedShort3), Integer.valueOf(readInt))); } else { s3 = readShort; hashSet = hashSet3; s4 = s6; hashMapArr2 = hashMapArr; } if (dVar == null) { if (z7) { Log.d("ExifInterface", "Skip the tag entry since tag number is not defined: " + readUnsignedShort2); } } else { if (readUnsignedShort3 > 0) { if (readUnsignedShort3 < f3832C.length) { int i9 = dVar.f3827c; if (i9 != 7 && readUnsignedShort3 != 7 && i9 != readUnsignedShort3 && (i6 = dVar.d) != readUnsignedShort3 && (((i9 != 4 && i6 != 4) || readUnsignedShort3 != 3) && (((i9 != 9 && i6 != 9) || readUnsignedShort3 != 8) && ((i9 != 12 && i6 != 12) || readUnsignedShort3 != 11)))) { if (z7) { sb2 = new StringBuilder("Skip the tag entry since data format ("); sb2.append(f3831B[readUnsignedShort3]); sb2.append(") is unexpected for tag: "); sb2.append(dVar.f3826b); Log.d("ExifInterface", sb2.toString()); } } else { if (readUnsignedShort3 == 7) { readUnsignedShort3 = i9; } j5 = r4[readUnsignedShort3] * readInt; if (j5 >= 0 && j5 <= 2147483647L) { z6 = true; if (!z6) { } s6 = (short) (s4 + 1); readShort = s3; hashSet3 = hashSet; } else { if (z7) { Log.d("ExifInterface", "Skip the tag entry since the number of components is invalid: " + readInt); } z6 = false; if (!z6) { fVar.b(j8); } else { if (j5 > 4) { int readInt2 = fVar.readInt(); if (z7) { j6 = j8; Log.d("ExifInterface", "seek to data offset: " + readInt2); } else { j6 = j8; } if (this.f3860c == 7) { if ("MakerNote".equals(dVar.f3826b)) { this.f3864i = readInt2; } else if (i5 == 6 && "ThumbnailImage".equals(dVar.f3826b)) { this.f3865j = readInt2; this.f3866k = readInt; c c7 = c.c(6, this.f3861f); i8 = readInt; c a6 = c.a(this.f3865j, this.f3861f); i7 = readUnsignedShort3; c a7 = c.a(this.f3866k, this.f3861f); hashMapArr2[4].put("Compression", c7); hashMapArr2[4].put("JPEGInterchangeFormat", a6); hashMapArr2[4].put("JPEGInterchangeFormatLength", a7); fVar.b(readInt2); } } i7 = readUnsignedShort3; i8 = readInt; fVar.b(readInt2); } else { j6 = j8; i7 = readUnsignedShort3; i8 = readInt; } Integer num = (Integer) f3839K.get(Integer.valueOf(readUnsignedShort2)); if (z7) { Log.d("ExifInterface", "nextIfdType: " + num + " byteCount: " + j5); } if (num != null) { int i10 = i7; if (i10 != 3) { if (i10 != 4) { if (i10 != 8) { if (i10 != 9 && i10 != 13) { j7 = -1; } else { readUnsignedShort = fVar.readInt(); } } else { readUnsignedShort = fVar.readShort(); } } else { j7 = fVar.readInt() & 4294967295L; } if (z7) { Log.d("ExifInterface", String.format("Offset: %d, tagName: %s", Long.valueOf(j7), dVar.f3826b)); } if (j7 <= 0) { hashSet2 = hashSet; if (!hashSet2.contains(Integer.valueOf((int) j7))) { fVar.b(j7); s(fVar, num.intValue()); } else if (z7) { sb3 = new StringBuilder("Skip jump into the IFD since it has already been read: IfdType "); sb3.append(num); sb3.append(" (at "); sb3.append(j7); sb3.append(")"); Log.d("ExifInterface", sb3.toString()); } fVar.b(j6); hashSet = hashSet2; } else { hashSet2 = hashSet; if (z7) { sb3 = new StringBuilder("Skip jump into the IFD since its offset is invalid: "); sb3.append(j7); Log.d("ExifInterface", sb3.toString()); } fVar.b(j6); hashSet = hashSet2; } } else { readUnsignedShort = fVar.readUnsignedShort(); } j7 = readUnsignedShort; if (z7) { } if (j7 <= 0) { } } else { long j9 = j6; int i11 = fVar.f3820f + this.f3863h; byte[] bArr = new byte[(int) j5]; fVar.readFully(bArr); hashSet = hashSet; c cVar = new c(i11, bArr, i7, i8); hashMapArr2[i5].put(dVar.f3826b, cVar); String str2 = dVar.f3826b; if ("DNGVersion".equals(str2)) { this.f3860c = 3; } if ((("Make".equals(str2) || "Model".equals(str2)) && cVar.f(this.f3861f).contains("PENTAX")) || ("Compression".equals(str2) && cVar.e(this.f3861f) == 65535)) { this.f3860c = 8; } if (fVar.f3820f != j9) { fVar.b(j9); } } } s6 = (short) (s4 + 1); readShort = s3; hashSet3 = hashSet; } } } } if (z7) { sb2 = new StringBuilder("Skip the tag entry since data format is invalid: "); sb2.append(readUnsignedShort3); Log.d("ExifInterface", sb2.toString()); } } j5 = 0; z6 = false; if (!z6) { } s6 = (short) (s4 + 1); readShort = s3; hashSet3 = hashSet; } HashSet hashSet4 = hashSet3; int readInt3 = fVar.readInt(); if (z7) { Log.d("ExifInterface", String.format("nextIfdOffset: %d", Integer.valueOf(readInt3))); } long j10 = readInt3; if (j10 > 0) { if (!hashSet4.contains(Integer.valueOf(readInt3))) { fVar.b(j10); int i12 = 4; if (!hashMapArr[4].isEmpty()) { i12 = 5; if (!hashMapArr[5].isEmpty()) { return; } } s(fVar, i12); return; } if (z7) { sb = new StringBuilder("Stop reading file since re-reading an IFD may cause an infinite loop: "); } else { return; } } else if (z7) { sb = new StringBuilder("Stop reading file since a wrong offset may cause an infinite loop: "); } else { return; } sb.append(readInt3); Log.d("ExifInterface", sb.toString()); } public final void t(int i5, String str, String str2) { HashMap[] hashMapArr = this.d; if (!hashMapArr[i5].isEmpty() && hashMapArr[i5].get(str) != null) { HashMap hashMap = hashMapArr[i5]; hashMap.put(str2, hashMap.get(str)); hashMapArr[i5].remove(str); } } public final void u(b bVar) { String str; String str2; StringBuilder sb; c cVar; int e; HashMap hashMap = this.d[4]; c cVar2 = (c) hashMap.get("Compression"); if (cVar2 != null) { int e7 = cVar2.e(this.f3861f); if (e7 != 1) { if (e7 != 6) { if (e7 != 7) { return; } } else { m(bVar, hashMap); return; } } c cVar3 = (c) hashMap.get("BitsPerSample"); if (cVar3 != null) { int[] iArr = (int[]) cVar3.g(this.f3861f); int[] iArr2 = f3844m; if (Arrays.equals(iArr2, iArr) || (this.f3860c == 3 && (cVar = (c) hashMap.get("PhotometricInterpretation")) != null && (((e = cVar.e(this.f3861f)) == 1 && Arrays.equals(iArr, f3845n)) || (e == 6 && Arrays.equals(iArr, iArr2))))) { c cVar4 = (c) hashMap.get("StripOffsets"); c cVar5 = (c) hashMap.get("StripByteCounts"); if (cVar4 != null && cVar5 != null) { long[] i5 = Q5.b.i(cVar4.g(this.f3861f)); long[] i6 = Q5.b.i(cVar5.g(this.f3861f)); if (i5 != null && i5.length != 0) { if (i6 != null && i6.length != 0) { if (i5.length != i6.length) { str = "stripOffsets and stripByteCounts should have same length."; } else { long j5 = 0; for (long j6 : i6) { j5 += j6; } byte[] bArr = new byte[(int) j5]; this.f3862g = true; int i7 = 0; int i8 = 0; for (int i9 = 0; i9 < i5.length; i9++) { int i10 = (int) i5[i9]; int i11 = (int) i6[i9]; if (i9 < i5.length - 1 && i10 + i11 != i5[i9 + 1]) { this.f3862g = false; } int i12 = i10 - i7; if (i12 < 0) { str2 = "Invalid strip offset value"; } else { long j7 = i12; if (bVar.skip(j7) != j7) { sb = new StringBuilder("Failed to skip "); sb.append(i12); } else { int i13 = i7 + i12; byte[] bArr2 = new byte[i11]; if (bVar.read(bArr2) != i11) { sb = new StringBuilder("Failed to read "); sb.append(i11); } else { i7 = i13 + i11; System.arraycopy(bArr2, 0, bArr, i8, i11); i8 += i11; } } sb.append(" bytes."); str2 = sb.toString(); } Log.d("ExifInterface", str2); return; } if (this.f3862g) { long j8 = i5[0]; return; } return; } } else { str = "stripByteCounts should not be null or have zero length."; } } else { str = "stripOffsets should not be null or have zero length."; } Log.w("ExifInterface", str); return; } return; } } if (f3843l) { Log.d("ExifInterface", "Unsupported data type value"); return; } return; } m(bVar, hashMap); } public final void v(int i5, int i6) { String str; HashMap[] hashMapArr = this.d; boolean isEmpty = hashMapArr[i5].isEmpty(); boolean z6 = f3843l; if (!isEmpty && !hashMapArr[i6].isEmpty()) { c cVar = (c) hashMapArr[i5].get("ImageLength"); c cVar2 = (c) hashMapArr[i5].get("ImageWidth"); c cVar3 = (c) hashMapArr[i6].get("ImageLength"); c cVar4 = (c) hashMapArr[i6].get("ImageWidth"); if (cVar != null && cVar2 != null) { if (cVar3 != null && cVar4 != null) { int e = cVar.e(this.f3861f); int e7 = cVar2.e(this.f3861f); int e8 = cVar3.e(this.f3861f); int e9 = cVar4.e(this.f3861f); if (e < e8 && e7 < e9) { HashMap hashMap = hashMapArr[i5]; hashMapArr[i5] = hashMapArr[i6]; hashMapArr[i6] = hashMap; return; } return; } if (z6) { str = "Second image does not contain valid size information"; } else { return; } } else if (z6) { str = "First image does not contain valid size information"; } else { return; } Log.d("ExifInterface", str); return; } if (z6) { Log.d("ExifInterface", "Cannot perform swap since only one image data exists"); } } public final void w(f fVar, int i5) { StringBuilder sb; String arrays; c c7; c c8; HashMap[] hashMapArr = this.d; c cVar = (c) hashMapArr[i5].get("DefaultCropSize"); c cVar2 = (c) hashMapArr[i5].get("SensorTopBorder"); c cVar3 = (c) hashMapArr[i5].get("SensorLeftBorder"); c cVar4 = (c) hashMapArr[i5].get("SensorBottomBorder"); c cVar5 = (c) hashMapArr[i5].get("SensorRightBorder"); if (cVar != null) { if (cVar.f3822a == 5) { e[] eVarArr = (e[]) cVar.g(this.f3861f); if (eVarArr != null && eVarArr.length == 2) { c7 = c.b(eVarArr[0], this.f3861f); c8 = c.b(eVarArr[1], this.f3861f); hashMapArr[i5].put("ImageWidth", c7); hashMapArr[i5].put("ImageLength", c8); return; } sb = new StringBuilder("Invalid crop size values. cropSize="); arrays = Arrays.toString(eVarArr); sb.append(arrays); Log.w("ExifInterface", sb.toString()); return; } int[] iArr = (int[]) cVar.g(this.f3861f); if (iArr != null && iArr.length == 2) { c7 = c.c(iArr[0], this.f3861f); c8 = c.c(iArr[1], this.f3861f); hashMapArr[i5].put("ImageWidth", c7); hashMapArr[i5].put("ImageLength", c8); return; } sb = new StringBuilder("Invalid crop size values. cropSize="); arrays = Arrays.toString(iArr); sb.append(arrays); Log.w("ExifInterface", sb.toString()); return; } if (cVar2 != null && cVar3 != null && cVar4 != null && cVar5 != null) { int e = cVar2.e(this.f3861f); int e7 = cVar4.e(this.f3861f); int e8 = cVar5.e(this.f3861f); int e9 = cVar3.e(this.f3861f); if (e7 > e && e8 > e9) { c c9 = c.c(e7 - e, this.f3861f); c c10 = c.c(e8 - e9, this.f3861f); hashMapArr[i5].put("ImageLength", c9); hashMapArr[i5].put("ImageWidth", c10); return; } return; } c cVar6 = (c) hashMapArr[i5].get("ImageLength"); c cVar7 = (c) hashMapArr[i5].get("ImageWidth"); if (cVar6 == null || cVar7 == null) { c cVar8 = (c) hashMapArr[i5].get("JPEGInterchangeFormat"); c cVar9 = (c) hashMapArr[i5].get("JPEGInterchangeFormatLength"); if (cVar8 != null && cVar9 != null) { int e10 = cVar8.e(this.f3861f); int e11 = cVar8.e(this.f3861f); fVar.b(e10); byte[] bArr = new byte[e11]; fVar.read(bArr); e(new b(bArr), e10, i5); } } } public final void x() { v(0, 5); v(0, 4); v(5, 4); HashMap[] hashMapArr = this.d; c cVar = (c) hashMapArr[1].get("PixelXDimension"); c cVar2 = (c) hashMapArr[1].get("PixelYDimension"); if (cVar != null && cVar2 != null) { hashMapArr[0].put("ImageWidth", cVar); hashMapArr[0].put("ImageLength", cVar2); } if (hashMapArr[4].isEmpty() && n(hashMapArr[5])) { hashMapArr[4] = hashMapArr[5]; hashMapArr[5] = new HashMap(); } if (!n(hashMapArr[4])) { Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image."); } t(0, "ThumbnailOrientation", "Orientation"); t(0, "ThumbnailImageLength", "ImageLength"); t(0, "ThumbnailImageWidth", "ImageWidth"); t(5, "ThumbnailOrientation", "Orientation"); t(5, "ThumbnailImageLength", "ImageLength"); t(5, "ThumbnailImageWidth", "ImageWidth"); t(4, "Orientation", "ThumbnailOrientation"); t(4, "ImageLength", "ThumbnailImageLength"); t(4, "ImageWidth", "ThumbnailImageWidth"); } }