Banesco VE v1.23.11版本的 MD5 值为:a4aa3f1f54e4fbb4921e2e1235e636aa
以下内容为反编译后的 f.java 源代码,内容仅作参考
package u0;
import android.content.res.AssetManager;
import android.media.MediaMetadataRetriever;
import android.system.Os;
import android.system.OsConstants;
import android.util.Log;
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.io.Serializable;
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.Map;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
public final class f {
public static final byte[] A;
public static final byte[] B;
public static final String[] C;
public static final int[] D;
public static final byte[] E;
public static final d F;
public static final d[][] G;
public static final d[] H;
public static final HashMap[] I;
public static final HashMap[] J;
public static final HashSet K;
public static final HashMap L;
public static final Charset M;
public static final byte[] N;
public static final byte[] O;
public static final boolean f11488m = Log.isLoggable("ExifInterface", 3);
public static final int[] f11489n;
public static final int[] f11490o;
public static final byte[] f11491p;
public static final byte[] f11492q;
public static final byte[] f11493r;
public static final byte[] f11494s;
public static final byte[] f11495t;
public static final byte[] f11496u;
public static final byte[] f11497v;
public static final byte[] f11498w;
public static final byte[] f11499x;
public static final byte[] f11500y;
public static final byte[] f11501z;
public final FileDescriptor f11502a;
public final AssetManager.AssetInputStream f11503b;
public int f11504c;
public final HashMap[] f11505d;
public final HashSet f11506e;
public ByteOrder f11507f;
public boolean f11508g;
public int f11509h;
public int f11510i;
public int f11511j;
public int f11512k;
public int f11513l;
static {
d[] dVarArr;
Arrays.asList(1, 6, 3, 8);
Arrays.asList(2, 7, 4, 5);
f11489n = new int[]{8, 8, 8};
f11490o = new int[]{8};
f11491p = new byte[]{-1, -40, -1};
f11492q = new byte[]{102, 116, 121, 112};
f11493r = new byte[]{109, 105, 102, 49};
f11494s = new byte[]{104, 101, 105, 99};
f11495t = new byte[]{79, 76, 89, 77, 80, 0};
f11496u = new byte[]{79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
f11497v = new byte[]{-119, 80, 78, 71, 13, 10, 26, 10};
f11498w = new byte[]{101, 88, 73, 102};
f11499x = new byte[]{73, 72, 68, 82};
f11500y = new byte[]{73, 69, 78, 68};
f11501z = new byte[]{82, 73, 70, 70};
A = new byte[]{87, 69, 66, 80};
B = 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());
"XMP ".getBytes(Charset.defaultCharset());
C = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
D = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
E = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
d[] dVarArr2 = {new d(254, 4, "NewSubfileType"), new d(255, 4, "SubfileType"), new d(256, "ImageWidth"), new d(257, "ImageLength"), new d(258, 3, "BitsPerSample"), new d(259, 3, "Compression"), new d(262, 3, "PhotometricInterpretation"), new d(270, 2, "ImageDescription"), new d(271, 2, "Make"), new d(272, 2, "Model"), new d(273, "StripOffsets"), new d(274, 3, "Orientation"), new d(277, 3, "SamplesPerPixel"), new d(278, "RowsPerStrip"), new d(279, "StripByteCounts"), new d(282, 5, "XResolution"), new d(283, 5, "YResolution"), new d(284, 3, "PlanarConfiguration"), new d(296, 3, "ResolutionUnit"), new d(301, 3, "TransferFunction"), new d(305, 2, "Software"), new d(306, 2, "DateTime"), new d(315, 2, "Artist"), new d(318, 5, "WhitePoint"), new d(319, 5, "PrimaryChromaticities"), new d(330, 4, "SubIFDPointer"), new d(513, 4, "JPEGInterchangeFormat"), new d(514, 4, "JPEGInterchangeFormatLength"), new d(529, 5, "YCbCrCoefficients"), new d(530, 3, "YCbCrSubSampling"), new d(531, 3, "YCbCrPositioning"), new d(532, 5, "ReferenceBlackWhite"), new d(33432, 2, "Copyright"), new d(34665, 4, "ExifIFDPointer"), new d(34853, 4, "GPSInfoIFDPointer"), new d(4, 4, "SensorTopBorder"), new d(5, 4, "SensorLeftBorder"), new d(6, 4, "SensorBottomBorder"), new d(7, 4, "SensorRightBorder"), new d(23, 3, "ISO"), new d(46, 7, "JpgFromRaw"), new d(700, 1, "Xmp")};
d[] dVarArr3 = {new d(33434, 5, "ExposureTime"), new d(33437, 5, "FNumber"), new d(34850, 3, "ExposureProgram"), new d(34852, 2, "SpectralSensitivity"), new d(34855, 3, "PhotographicSensitivity"), new d(34856, 7, "OECF"), new d(34864, 3, "SensitivityType"), new d(34865, 4, "StandardOutputSensitivity"), new d(34866, 4, "RecommendedExposureIndex"), new d(34867, 4, "ISOSpeed"), new d(34868, 4, "ISOSpeedLatitudeyyy"), new d(34869, 4, "ISOSpeedLatitudezzz"), new d(36864, 2, "ExifVersion"), new d(36867, 2, "DateTimeOriginal"), new d(36868, 2, "DateTimeDigitized"), new d(36880, 2, "OffsetTime"), new d(36881, 2, "OffsetTimeOriginal"), new d(36882, 2, "OffsetTimeDigitized"), new d(37121, 7, "ComponentsConfiguration"), new d(37122, 5, "CompressedBitsPerPixel"), new d(37377, 10, "ShutterSpeedValue"), new d(37378, 5, "ApertureValue"), new d(37379, 10, "BrightnessValue"), new d(37380, 10, "ExposureBiasValue"), new d(37381, 5, "MaxApertureValue"), new d(37382, 5, "SubjectDistance"), new d(37383, 3, "MeteringMode"), new d(37384, 3, "LightSource"), new d(37385, 3, "Flash"), new d(37386, 5, "FocalLength"), new d(37396, 3, "SubjectArea"), new d(37500, 7, "MakerNote"), new d(37510, 7, "UserComment"), new d(37520, 2, "SubSecTime"), new d(37521, 2, "SubSecTimeOriginal"), new d(37522, 2, "SubSecTimeDigitized"), new d(40960, 7, "FlashpixVersion"), new d(40961, 3, "ColorSpace"), new d(40962, "PixelXDimension"), new d(40963, "PixelYDimension"), new d(40964, 2, "RelatedSoundFile"), new d(40965, 4, "InteroperabilityIFDPointer"), new d(41483, 5, "FlashEnergy"), new d(41484, 7, "SpatialFrequencyResponse"), new d(41486, 5, "FocalPlaneXResolution"), new d(41487, 5, "FocalPlaneYResolution"), new d(41488, 3, "FocalPlaneResolutionUnit"), new d(41492, 3, "SubjectLocation"), new d(41493, 5, "ExposureIndex"), new d(41495, 3, "SensingMethod"), new d(41728, 7, "FileSource"), new d(41729, 7, "SceneType"), new d(41730, 7, "CFAPattern"), new d(41985, 3, "CustomRendered"), new d(41986, 3, "ExposureMode"), new d(41987, 3, "WhiteBalance"), new d(41988, 5, "DigitalZoomRatio"), new d(41989, 3, "FocalLengthIn35mmFilm"), new d(41990, 3, "SceneCaptureType"), new d(41991, 3, "GainControl"), new d(41992, 3, "Contrast"), new d(41993, 3, "Saturation"), new d(41994, 3, "Sharpness"), new d(41995, 7, "DeviceSettingDescription"), new d(41996, 3, "SubjectDistanceRange"), new d(42016, 2, "ImageUniqueID"), new d(42032, 2, "CameraOwnerName"), new d(42033, 2, "BodySerialNumber"), new d(42034, 5, "LensSpecification"), new d(42035, 2, "LensMake"), new d(42036, 2, "LensModel"), new d(42240, 5, "Gamma"), new d(50706, 1, "DNGVersion"), new d(50720, "DefaultCropSize")};
d[] dVarArr4 = {new d(0, 1, "GPSVersionID"), new d(1, 2, "GPSLatitudeRef"), new d(2, 5, "GPSLatitude"), new d(3, 2, "GPSLongitudeRef"), new d(4, 5, "GPSLongitude"), new d(5, 1, "GPSAltitudeRef"), new d(6, 5, "GPSAltitude"), new d(7, 5, "GPSTimeStamp"), new d(8, 2, "GPSSatellites"), new d(9, 2, "GPSStatus"), new d(10, 2, "GPSMeasureMode"), new d(11, 5, "GPSDOP"), new d(12, 2, "GPSSpeedRef"), new d(13, 5, "GPSSpeed"), new d(14, 2, "GPSTrackRef"), new d(15, 5, "GPSTrack"), new d(16, 2, "GPSImgDirectionRef"), new d(17, 5, "GPSImgDirection"), new d(18, 2, "GPSMapDatum"), new d(19, 2, "GPSDestLatitudeRef"), new d(20, 5, "GPSDestLatitude"), new d(21, 2, "GPSDestLongitudeRef"), new d(22, 5, "GPSDestLongitude"), new d(23, 2, "GPSDestBearingRef"), new d(24, 5, "GPSDestBearing"), new d(25, 2, "GPSDestDistanceRef"), new d(26, 5, "GPSDestDistance"), new d(27, 7, "GPSProcessingMethod"), new d(28, 7, "GPSAreaInformation"), new d(29, 2, "GPSDateStamp"), new d(30, 3, "GPSDifferential"), new d(31, 5, "GPSHPositioningError")};
d[] dVarArr5 = {new d(1, 2, "InteroperabilityIndex")};
d[] dVarArr6 = {new d(254, 4, "NewSubfileType"), new d(255, 4, "SubfileType"), new d(256, "ThumbnailImageWidth"), new d(257, "ThumbnailImageLength"), new d(258, 3, "BitsPerSample"), new d(259, 3, "Compression"), new d(262, 3, "PhotometricInterpretation"), new d(270, 2, "ImageDescription"), new d(271, 2, "Make"), new d(272, 2, "Model"), new d(273, "StripOffsets"), new d(274, 3, "ThumbnailOrientation"), new d(277, 3, "SamplesPerPixel"), new d(278, "RowsPerStrip"), new d(279, "StripByteCounts"), new d(282, 5, "XResolution"), new d(283, 5, "YResolution"), new d(284, 3, "PlanarConfiguration"), new d(296, 3, "ResolutionUnit"), new d(301, 3, "TransferFunction"), new d(305, 2, "Software"), new d(306, 2, "DateTime"), new d(315, 2, "Artist"), new d(318, 5, "WhitePoint"), new d(319, 5, "PrimaryChromaticities"), new d(330, 4, "SubIFDPointer"), new d(513, 4, "JPEGInterchangeFormat"), new d(514, 4, "JPEGInterchangeFormatLength"), new d(529, 5, "YCbCrCoefficients"), new d(530, 3, "YCbCrSubSampling"), new d(531, 3, "YCbCrPositioning"), new d(532, 5, "ReferenceBlackWhite"), new d(33432, 2, "Copyright"), new d(34665, 4, "ExifIFDPointer"), new d(34853, 4, "GPSInfoIFDPointer"), new d(50706, 1, "DNGVersion"), new d(50720, "DefaultCropSize")};
F = new d(273, 3, "StripOffsets");
G = new d[][]{dVarArr2, dVarArr3, dVarArr4, dVarArr5, dVarArr6, dVarArr2, new d[]{new d(256, 7, "ThumbnailImage"), new d(8224, 4, "CameraSettingsIFDPointer"), new d(8256, 4, "ImageProcessingIFDPointer")}, new d[]{new d(257, 4, "PreviewImageStart"), new d(258, 4, "PreviewImageLength")}, new d[]{new d(4371, 3, "AspectFrame")}, new d[]{new d(55, 3, "ColorSpace")}};
H = new d[]{new d(330, 4, "SubIFDPointer"), new d(34665, 4, "ExifIFDPointer"), new d(34853, 4, "GPSInfoIFDPointer"), new d(40965, 4, "InteroperabilityIFDPointer"), new d(8224, 1, "CameraSettingsIFDPointer"), new d(8256, 1, "ImageProcessingIFDPointer")};
I = new HashMap[10];
J = new HashMap[10];
K = new HashSet(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
L = new HashMap();
Charset forName = Charset.forName("US-ASCII");
M = forName;
N = "Exif\u0000\u0000".getBytes(forName);
O = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName);
new SimpleDateFormat("yyyy:MM:dd HH:mm:ss").setTimeZone(TimeZone.getTimeZone("UTC"));
int i10 = 0;
while (true) {
d[][] dVarArr7 = G;
if (i10 < dVarArr7.length) {
I[i10] = new HashMap();
J[i10] = new HashMap();
for (d dVar : dVarArr7[i10]) {
I[i10].put(Integer.valueOf(dVar.f11482a), dVar);
J[i10].put(dVar.f11483b, dVar);
}
i10++;
} else {
HashMap hashMap = L;
d[] dVarArr8 = H;
hashMap.put(Integer.valueOf(dVarArr8[0].f11482a), 5);
hashMap.put(Integer.valueOf(dVarArr8[1].f11482a), 1);
hashMap.put(Integer.valueOf(dVarArr8[2].f11482a), 2);
hashMap.put(Integer.valueOf(dVarArr8[3].f11482a), 3);
hashMap.put(Integer.valueOf(dVarArr8[4].f11482a), 7);
hashMap.put(Integer.valueOf(dVarArr8[5].f11482a), 8);
Pattern.compile(".*[1-9].*");
Pattern.compile("^([0-9][0-9]):([0-9][0-9]):([0-9][0-9])$");
return;
}
}
}
public f(InputStream inputStream) {
boolean z6;
d[][] dVarArr = G;
this.f11505d = new HashMap[dVarArr.length];
this.f11506e = new HashSet(dVarArr.length);
this.f11507f = ByteOrder.BIG_ENDIAN;
if (inputStream != null) {
boolean z10 = inputStream instanceof AssetManager.AssetInputStream;
boolean z11 = f11488m;
if (z10) {
this.f11503b = (AssetManager.AssetInputStream) inputStream;
this.f11502a = null;
} else {
if (inputStream instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream) inputStream;
try {
Os.lseek(fileInputStream.getFD(), 0L, OsConstants.SEEK_CUR);
z6 = true;
} catch (Exception unused) {
if (z11) {
Log.d("ExifInterface", "The file descriptor for the given input is not seekable");
}
z6 = false;
}
if (z6) {
this.f11503b = null;
this.f11502a = fileInputStream.getFD();
}
}
this.f11503b = null;
this.f11502a = null;
}
for (int i10 = 0; i10 < dVarArr.length; i10++) {
try {
try {
this.f11505d[i10] = new HashMap();
} catch (IOException e10) {
if (z11) {
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.", e10);
}
a();
if (!z11) {
return;
}
}
} catch (Throwable th) {
a();
if (z11) {
r();
}
throw th;
}
}
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
this.f11504c = h(bufferedInputStream);
b bVar = new b(bufferedInputStream);
switch (this.f11504c) {
case 0:
case 1:
case 2:
case 3:
case 5:
case 6:
case 8:
case 11:
l(bVar);
break;
case 4:
g(bVar, 0, 0);
break;
case 7:
i(bVar);
break;
case 9:
k(bVar);
break;
case 10:
m(bVar);
break;
case 12:
f(bVar);
break;
case 13:
j(bVar);
break;
case 14:
n(bVar);
break;
}
v(bVar);
a();
if (!z11) {
return;
}
r();
return;
}
throw new NullPointerException("inputStream cannot be null");
}
public static String b(byte[] bArr) {
StringBuilder sb = new StringBuilder(bArr.length * 2);
for (int i10 = 0; i10 < bArr.length; i10++) {
sb.append(String.format("%02x", Byte.valueOf(bArr[i10])));
}
return sb.toString();
}
public static long[] c(Serializable serializable) {
if (serializable instanceof int[]) {
int[] iArr = (int[]) serializable;
long[] jArr = new long[iArr.length];
for (int i10 = 0; i10 < iArr.length; i10++) {
jArr[i10] = iArr[i10];
}
return jArr;
} else if (serializable instanceof long[]) {
return (long[]) serializable;
} else {
return null;
}
}
public static ByteOrder s(b bVar) {
short readShort = bVar.readShort();
boolean z6 = f11488m;
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 d10 = d("DateTimeOriginal");
HashMap[] hashMapArr = this.f11505d;
if (d10 != null && d("DateTime") == null) {
hashMapArr[0].put("DateTime", c.a(d10));
}
if (d("ImageWidth") == null) {
hashMapArr[0].put("ImageWidth", c.b(0L, this.f11507f));
}
if (d("ImageLength") == null) {
hashMapArr[0].put("ImageLength", c.b(0L, this.f11507f));
}
if (d("Orientation") == null) {
hashMapArr[0].put("Orientation", c.b(0L, this.f11507f));
}
if (d("LightSource") == null) {
hashMapArr[1].put("LightSource", c.b(0L, this.f11507f));
}
}
public final String d(String str) {
c e10 = e(str);
if (e10 != null) {
if (!K.contains(str)) {
return e10.g(this.f11507f);
}
if (str.equals("GPSTimeStamp")) {
int i10 = e10.f11479a;
if (i10 != 5 && i10 != 10) {
Log.w("ExifInterface", "GPS Timestamp format is not rational. format=" + i10);
return null;
}
e[] eVarArr = (e[]) e10.h(this.f11507f);
if (eVarArr != null && eVarArr.length == 3) {
e eVar = eVarArr[0];
e eVar2 = eVarArr[1];
e eVar3 = eVarArr[2];
return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) eVar.f11486a) / ((float) eVar.f11487b))), Integer.valueOf((int) (((float) eVar2.f11486a) / ((float) eVar2.f11487b))), Integer.valueOf((int) (((float) eVar3.f11486a) / ((float) eVar3.f11487b))));
}
Log.w("ExifInterface", "Invalid GPS Timestamp array. array=" + Arrays.toString(eVarArr));
return null;
}
try {
return Double.toString(e10.e(this.f11507f));
} catch (NumberFormatException unused) {
}
}
return null;
}
public final c e(String str) {
if ("ISOSpeedRatings".equals(str)) {
if (f11488m) {
Log.d("ExifInterface", "getExifAttribute: Replacing TAG_ISO_SPEED_RATINGS with TAG_PHOTOGRAPHIC_SENSITIVITY.");
}
str = "PhotographicSensitivity";
}
for (int i10 = 0; i10 < G.length; i10++) {
c cVar = (c) this.f11505d[i10].get(str);
if (cVar != null) {
return cVar;
}
}
return null;
}
public final void f(b bVar) {
String str;
String str2;
String str3;
int i10;
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
try {
mediaMetadataRetriever.setDataSource(new a(bVar));
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.f11505d;
if (str != null) {
hashMapArr[0].put("ImageWidth", c.d(Integer.parseInt(str), this.f11507f));
}
if (str2 != null) {
hashMapArr[0].put("ImageLength", c.d(Integer.parseInt(str2), this.f11507f));
}
if (str3 != null) {
int parseInt = Integer.parseInt(str3);
if (parseInt != 90) {
if (parseInt != 180) {
if (parseInt != 270) {
i10 = 1;
} else {
i10 = 8;
}
} else {
i10 = 3;
}
} else {
i10 = 6;
}
hashMapArr[0].put("Orientation", c.d(i10, this.f11507f));
}
if (extractMetadata != null && extractMetadata2 != null) {
int parseInt2 = Integer.parseInt(extractMetadata);
int parseInt3 = Integer.parseInt(extractMetadata2);
if (parseInt3 > 6) {
bVar.a(parseInt2);
byte[] bArr = new byte[6];
if (bVar.read(bArr) == 6) {
int i11 = parseInt2 + 6;
int i12 = parseInt3 - 6;
if (Arrays.equals(bArr, N)) {
byte[] bArr2 = new byte[i12];
if (bVar.read(bArr2) == i12) {
this.f11509h = i11;
t(0, bArr2);
} 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 (f11488m) {
Log.d("ExifInterface", "Heif meta: " + str + "x" + str2 + ", rotation " + str3);
}
} finally {
mediaMetadataRetriever.release();
}
}
public final void g(b bVar, int i10, int i11) {
byte readByte;
byte readByte2;
boolean z6;
boolean z10;
int i12;
boolean z11 = f11488m;
if (z11) {
Log.d("ExifInterface", "getJpegAttributes starting with: " + bVar);
}
bVar.f11476l = ByteOrder.BIG_ENDIAN;
bVar.a(i10);
byte b10 = -1;
if (bVar.readByte() == -1) {
int i13 = 1;
int i14 = i10 + 1;
if (bVar.readByte() == -40) {
int i15 = i14 + 1;
while (true) {
if (bVar.readByte() == b10) {
int i16 = i15 + i13;
byte readByte3 = bVar.readByte();
if (z11) {
Log.d("ExifInterface", "Found JPEG segment indicator: " + Integer.toHexString(readByte3 & 255));
}
int i17 = i16 + i13;
if (readByte3 != -39 && readByte3 != -38) {
int readUnsignedShort = bVar.readUnsignedShort() - 2;
int i18 = i17 + 2;
if (z11) {
Log.d("ExifInterface", "JPEG segment: " + Integer.toHexString(readByte3 & 255) + " (length: " + (readUnsignedShort + 2) + ")");
}
if (readUnsignedShort >= 0) {
HashMap[] hashMapArr = this.f11505d;
if (readByte3 != -31) {
if (readByte3 != -2) {
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
}
case -55:
case -54:
case -53:
if (bVar.skipBytes(i13) == i13) {
hashMapArr[i11].put("ImageLength", c.b(bVar.readUnsignedShort(), this.f11507f));
hashMapArr[i11].put("ImageWidth", c.b(bVar.readUnsignedShort(), this.f11507f));
readUnsignedShort -= 5;
break;
} else {
throw new IOException("Invalid SOFx");
}
}
case -59:
case -58:
case -57:
break;
}
case -64:
case -63:
case -62:
case -61:
break;
}
i12 = i13;
if (readUnsignedShort < 0) {
if (bVar.skipBytes(readUnsignedShort) == readUnsignedShort) {
i15 = i18 + readUnsignedShort;
i13 = i12;
b10 = -1;
} else {
throw new IOException("Invalid JPEG segment");
}
} else {
throw new IOException("Invalid length");
}
} else {
byte[] bArr = new byte[readUnsignedShort];
if (bVar.read(bArr) == readUnsignedShort) {
if (d("UserComment") == null) {
hashMapArr[i13].put("UserComment", c.a(new String(bArr, M)));
}
i12 = i13;
} else {
throw new IOException("Invalid exif");
}
}
} else {
byte[] bArr2 = new byte[readUnsignedShort];
bVar.readFully(bArr2);
int i19 = i18 + readUnsignedShort;
byte[] bArr3 = N;
if (bArr3 != null && readUnsignedShort >= bArr3.length) {
for (int i20 = 0; i20 < bArr3.length; i20++) {
if (bArr2[i20] == bArr3[i20]) {
}
}
z6 = true;
if (!z6) {
int length = i18 + bArr3.length;
byte[] copyOfRange = Arrays.copyOfRange(bArr2, bArr3.length, readUnsignedShort);
this.f11509h = length;
t(i11, copyOfRange);
} else {
byte[] bArr4 = O;
if (bArr4 != null && readUnsignedShort >= bArr4.length) {
for (int i21 = 0; i21 < bArr4.length; i21++) {
if (bArr2[i21] == bArr4[i21]) {
}
}
z10 = true;
if (z10) {
int length2 = bArr4.length;
byte[] copyOfRange2 = Arrays.copyOfRange(bArr2, bArr4.length, readUnsignedShort);
if (d("Xmp") == null) {
i12 = 1;
hashMapArr[0].put("Xmp", new c(copyOfRange2, 1, copyOfRange2.length, 0));
i18 = i19;
}
}
}
z10 = false;
if (z10) {
}
}
i12 = 1;
i18 = i19;
}
z6 = false;
if (!z6) {
}
i12 = 1;
i18 = i19;
}
readUnsignedShort = 0;
if (readUnsignedShort < 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 h(BufferedInputStream bufferedInputStream) {
boolean z6;
boolean z10;
b bVar;
b bVar2;
boolean z11;
b bVar3;
b bVar4;
boolean z12;
b bVar5;
b bVar6;
boolean z13;
boolean z14;
boolean z15;
long j10;
bufferedInputStream.mark(5000);
byte[] bArr = new byte[5000];
bufferedInputStream.read(bArr);
bufferedInputStream.reset();
int i10 = 0;
while (true) {
byte[] bArr2 = f11491p;
if (i10 < bArr2.length) {
if (bArr[i10] != bArr2[i10]) {
z6 = false;
break;
}
i10++;
} else {
z6 = true;
break;
}
}
if (z6) {
return 4;
}
byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
int i11 = 0;
while (true) {
if (i11 < bytes.length) {
if (bArr[i11] != bytes[i11]) {
z10 = false;
break;
}
i11++;
} else {
z10 = true;
break;
}
}
if (z10) {
return 9;
}
try {
bVar2 = new b(bArr);
try {
long readInt = bVar2.readInt();
byte[] bArr3 = new byte[4];
bVar2.read(bArr3);
if (Arrays.equals(bArr3, f11492q)) {
if (readInt == 1) {
readInt = bVar2.readLong();
j10 = 16;
if (readInt < 16) {
}
} else {
j10 = 8;
}
long j11 = 5000;
if (readInt > j11) {
readInt = j11;
}
long j12 = readInt - j10;
if (j12 >= 8) {
byte[] bArr4 = new byte[4];
boolean z16 = false;
boolean z17 = false;
for (long j13 = 0; j13 < j12 / 4 && bVar2.read(bArr4) == 4; j13++) {
if (j13 != 1) {
if (Arrays.equals(bArr4, f11493r)) {
z16 = true;
} else if (Arrays.equals(bArr4, f11494s)) {
z17 = true;
}
if (z16 && z17) {
bVar2.close();
z11 = true;
break;
}
}
}
}
}
} catch (Exception e10) {
e = e10;
try {
if (f11488m) {
Log.d("ExifInterface", "Exception parsing HEIF file type box.", e);
}
} catch (Throwable th) {
th = th;
bVar = bVar2;
bVar2 = bVar;
if (bVar2 != null) {
bVar2.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
if (bVar2 != null) {
}
throw th;
}
} catch (Exception e11) {
e = e11;
bVar2 = null;
} catch (Throwable th3) {
th = th3;
bVar = null;
bVar2 = bVar;
if (bVar2 != null) {
}
throw th;
}
bVar2.close();
z11 = false;
if (z11) {
return 12;
}
try {
bVar4 = new b(bArr);
try {
ByteOrder s7 = s(bVar4);
this.f11507f = s7;
bVar4.f11476l = s7;
short readShort = bVar4.readShort();
if (readShort != 20306 && readShort != 21330) {
z12 = false;
} else {
z12 = true;
}
bVar4.close();
} catch (Exception unused) {
if (bVar4 != null) {
bVar4.close();
}
z12 = false;
if (!z12) {
}
} catch (Throwable th4) {
th = th4;
bVar3 = bVar4;
if (bVar3 != null) {
bVar3.close();
}
throw th;
}
} catch (Exception unused2) {
bVar4 = null;
} catch (Throwable th5) {
th = th5;
bVar3 = null;
}
if (!z12) {
return 7;
}
try {
b bVar7 = new b(bArr);
try {
ByteOrder s10 = s(bVar7);
this.f11507f = s10;
bVar7.f11476l = s10;
if (bVar7.readShort() == 85) {
z13 = true;
} else {
z13 = false;
}
bVar7.close();
} catch (Exception unused3) {
bVar6 = bVar7;
if (bVar6 != null) {
bVar6.close();
}
z13 = false;
if (!z13) {
}
} catch (Throwable th6) {
th = th6;
bVar5 = bVar7;
if (bVar5 != null) {
bVar5.close();
}
throw th;
}
} catch (Exception unused4) {
bVar6 = null;
} catch (Throwable th7) {
th = th7;
bVar5 = null;
}
if (!z13) {
return 10;
}
int i12 = 0;
while (true) {
byte[] bArr5 = f11497v;
if (i12 < bArr5.length) {
if (bArr[i12] != bArr5[i12]) {
z14 = false;
break;
}
i12++;
} else {
z14 = true;
break;
}
}
if (z14) {
return 13;
}
int i13 = 0;
while (true) {
byte[] bArr6 = f11501z;
if (i13 < bArr6.length) {
if (bArr[i13] != bArr6[i13]) {
break;
}
i13++;
} else {
int i14 = 0;
while (true) {
byte[] bArr7 = A;
if (i14 < bArr7.length) {
if (bArr[bArr6.length + i14 + 4] != bArr7[i14]) {
break;
}
i14++;
} else {
z15 = true;
break;
}
}
}
}
z15 = false;
if (!z15) {
return 0;
}
return 14;
}
public final void i(b bVar) {
int i10;
int i11;
l(bVar);
HashMap[] hashMapArr = this.f11505d;
c cVar = (c) hashMapArr[1].get("MakerNote");
if (cVar != null) {
b bVar2 = new b(cVar.f11481c);
bVar2.f11476l = this.f11507f;
byte[] bArr = f11495t;
byte[] bArr2 = new byte[bArr.length];
bVar2.readFully(bArr2);
bVar2.a(0L);
byte[] bArr3 = f11496u;
byte[] bArr4 = new byte[bArr3.length];
bVar2.readFully(bArr4);
if (Arrays.equals(bArr2, bArr)) {
bVar2.a(8L);
} else if (Arrays.equals(bArr4, bArr3)) {
bVar2.a(12L);
}
u(bVar2, 6);
c cVar2 = (c) hashMapArr[7].get("PreviewImageStart");
c cVar3 = (c) hashMapArr[7].get("PreviewImageLength");
if (cVar2 != null && cVar3 != null) {
hashMapArr[5].put("JPEGInterchangeFormat", cVar2);
hashMapArr[5].put("JPEGInterchangeFormatLength", cVar3);
}
c cVar4 = (c) hashMapArr[8].get("AspectFrame");
if (cVar4 != null) {
int[] iArr = (int[]) cVar4.h(this.f11507f);
if (iArr != null && iArr.length == 4) {
int i12 = iArr[2];
int i13 = iArr[0];
if (i12 > i13 && (i10 = iArr[3]) > (i11 = iArr[1])) {
int i14 = (i12 - i13) + 1;
int i15 = (i10 - i11) + 1;
if (i14 < i15) {
int i16 = i14 + i15;
i15 = i16 - i15;
i14 = i16 - i15;
}
c d10 = c.d(i14, this.f11507f);
c d11 = c.d(i15, this.f11507f);
hashMapArr[0].put("ImageWidth", d10);
hashMapArr[0].put("ImageLength", d11);
return;
}
return;
}
Log.w("ExifInterface", "Invalid aspect frame values. frame=" + Arrays.toString(iArr));
}
}
}
public final void j(b bVar) {
if (f11488m) {
Log.d("ExifInterface", "getPngAttributes starting with: " + bVar);
}
bVar.f11476l = ByteOrder.BIG_ENDIAN;
byte[] bArr = f11497v;
bVar.skipBytes(bArr.length);
int length = bArr.length + 0;
while (true) {
try {
int readInt = bVar.readInt();
int i10 = length + 4;
byte[] bArr2 = new byte[4];
if (bVar.read(bArr2) == 4) {
int i11 = i10 + 4;
if (i11 == 16 && !Arrays.equals(bArr2, f11499x)) {
throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
}
if (!Arrays.equals(bArr2, f11500y)) {
if (Arrays.equals(bArr2, f11498w)) {
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.f11509h = i11;
t(0, bArr3);
y();
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: " + b(bArr2));
}
int i12 = readInt + 4;
bVar.skipBytes(i12);
length = i11 + i12;
} 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 k(b bVar) {
bVar.skipBytes(84);
byte[] bArr = new byte[4];
byte[] bArr2 = new byte[4];
bVar.read(bArr);
bVar.skipBytes(4);
bVar.read(bArr2);
int i10 = ByteBuffer.wrap(bArr).getInt();
int i11 = ByteBuffer.wrap(bArr2).getInt();
g(bVar, i10, 5);
bVar.a(i11);
bVar.f11476l = ByteOrder.BIG_ENDIAN;
int readInt = bVar.readInt();
boolean z6 = f11488m;
if (z6) {
Log.d("ExifInterface", "numberOfDirectoryEntry: " + readInt);
}
for (int i12 = 0; i12 < readInt; i12++) {
int readUnsignedShort = bVar.readUnsignedShort();
int readUnsignedShort2 = bVar.readUnsignedShort();
if (readUnsignedShort == F.f11482a) {
short readShort = bVar.readShort();
short readShort2 = bVar.readShort();
c d10 = c.d(readShort, this.f11507f);
c d11 = c.d(readShort2, this.f11507f);
HashMap[] hashMapArr = this.f11505d;
hashMapArr[0].put("ImageLength", d10);
hashMapArr[0].put("ImageWidth", d11);
if (z6) {
Log.d("ExifInterface", "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2));
return;
}
return;
}
bVar.skipBytes(readUnsignedShort2);
}
}
public final void l(b bVar) {
q(bVar, bVar.available());
u(bVar, 0);
x(bVar, 0);
x(bVar, 5);
x(bVar, 4);
y();
if (this.f11504c == 8) {
HashMap[] hashMapArr = this.f11505d;
c cVar = (c) hashMapArr[1].get("MakerNote");
if (cVar != null) {
b bVar2 = new b(cVar.f11481c);
bVar2.f11476l = this.f11507f;
bVar2.a(6L);
u(bVar2, 9);
c cVar2 = (c) hashMapArr[9].get("ColorSpace");
if (cVar2 != null) {
hashMapArr[1].put("ColorSpace", cVar2);
}
}
}
}
public final void m(b bVar) {
l(bVar);
HashMap[] hashMapArr = this.f11505d;
if (((c) hashMapArr[0].get("JpgFromRaw")) != null) {
g(bVar, this.f11513l, 5);
}
c cVar = (c) hashMapArr[0].get("ISO");
c cVar2 = (c) hashMapArr[1].get("PhotographicSensitivity");
if (cVar != null && cVar2 == null) {
hashMapArr[1].put("PhotographicSensitivity", cVar);
}
}
public final void n(b bVar) {
if (f11488m) {
Log.d("ExifInterface", "getWebpAttributes starting with: " + bVar);
}
bVar.f11476l = ByteOrder.LITTLE_ENDIAN;
bVar.skipBytes(f11501z.length);
int readInt = bVar.readInt() + 8;
int skipBytes = bVar.skipBytes(A.length) + 8;
while (true) {
try {
byte[] bArr = new byte[4];
if (bVar.read(bArr) == 4) {
int readInt2 = bVar.readInt();
int i10 = skipBytes + 4 + 4;
if (Arrays.equals(B, bArr)) {
byte[] bArr2 = new byte[readInt2];
if (bVar.read(bArr2) == readInt2) {
this.f11509h = i10;
t(0, bArr2);
this.f11509h = i10;
return;
}
throw new IOException("Failed to read given length for given PNG chunk type: " + b(bArr));
}
if (readInt2 % 2 == 1) {
readInt2++;
}
int i11 = i10 + readInt2;
if (i11 == readInt) {
return;
}
if (i11 <= readInt) {
int skipBytes2 = bVar.skipBytes(readInt2);
if (skipBytes2 == readInt2) {
skipBytes = i10 + skipBytes2;
} else {
throw new IOException("Encountered WebP file with invalid chunk size");
}
} 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 o(b bVar, HashMap hashMap) {
c cVar = (c) hashMap.get("JPEGInterchangeFormat");
c cVar2 = (c) hashMap.get("JPEGInterchangeFormatLength");
if (cVar != null && cVar2 != null) {
int f10 = cVar.f(this.f11507f);
int f11 = cVar2.f(this.f11507f);
if (this.f11504c == 7) {
f10 += this.f11510i;
}
int min = Math.min(f11, bVar.f11477m - f10);
if (f10 > 0 && min > 0) {
int i10 = this.f11509h + f10;
if (this.f11503b == null && this.f11502a == null) {
bVar.a(i10);
bVar.readFully(new byte[min]);
}
}
if (f11488m) {
Log.d("ExifInterface", "Setting thumbnail attributes with offset: " + f10 + ", length: " + min);
}
}
}
public final boolean p(HashMap hashMap) {
c cVar = (c) hashMap.get("ImageLength");
c cVar2 = (c) hashMap.get("ImageWidth");
if (cVar != null && cVar2 != null) {
int f10 = cVar.f(this.f11507f);
int f11 = cVar2.f(this.f11507f);
if (f10 <= 512 && f11 <= 512) {
return true;
}
return false;
}
return false;
}
public final void q(b bVar, int i10) {
ByteOrder s7 = s(bVar);
this.f11507f = s7;
bVar.f11476l = s7;
int readUnsignedShort = bVar.readUnsignedShort();
int i11 = this.f11504c;
if (i11 != 7 && i11 != 10 && readUnsignedShort != 42) {
throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort));
}
int readInt = bVar.readInt();
if (readInt >= 8 && readInt < i10) {
int i12 = readInt - 8;
if (i12 > 0 && bVar.skipBytes(i12) != i12) {
throw new IOException(androidx.activity.f.i("Couldn't jump to first Ifd: ", i12));
}
return;
}
throw new IOException(androidx.activity.f.i("Invalid first Ifd offset: ", readInt));
}
public final void r() {
int i10 = 0;
while (true) {
HashMap[] hashMapArr = this.f11505d;
if (i10 < hashMapArr.length) {
Log.d("ExifInterface", "The size of tag group[" + i10 + "]: " + hashMapArr[i10].size());
for (Map.Entry entry : hashMapArr[i10].entrySet()) {
c cVar = (c) entry.getValue();
Log.d("ExifInterface", "tagName: " + ((String) entry.getKey()) + ", tagType: " + cVar.toString() + ", tagValue: '" + cVar.g(this.f11507f) + "'");
}
i10++;
} else {
return;
}
}
}
public final void t(int i10, byte[] bArr) {
b bVar = new b(bArr);
q(bVar, bArr.length);
u(bVar, i10);
}
public final void u(b bVar, int i10) {
HashMap[] hashMapArr;
short s7;
HashSet hashSet;
int i11;
int[] iArr;
boolean z6;
long j10;
boolean z10;
int i12;
HashMap[] hashMapArr2;
int i13;
long j11;
b bVar2;
HashSet hashSet2;
int readUnsignedShort;
long j12;
long j13;
int i14;
String str;
b bVar3 = bVar;
int i15 = i10;
Integer valueOf = Integer.valueOf(bVar3.f11478n);
HashSet hashSet3 = this.f11506e;
hashSet3.add(valueOf);
int i16 = bVar3.f11478n + 2;
int i17 = bVar3.f11477m;
if (i16 > i17) {
return;
}
short readShort = bVar.readShort();
boolean z11 = f11488m;
if (z11) {
Log.d("ExifInterface", "numberOfDirectoryEntry: " + ((int) readShort));
}
if ((readShort * 12) + bVar3.f11478n <= i17 && readShort > 0) {
b bVar4 = bVar3;
short s10 = 0;
while (true) {
hashMapArr = this.f11505d;
if (s10 >= readShort) {
break;
}
int readUnsignedShort2 = bVar.readUnsignedShort();
int readUnsignedShort3 = bVar.readUnsignedShort();
int readInt = bVar.readInt();
long j14 = bVar4.f11478n + 4;
short s11 = readShort;
d dVar = (d) I[i15].get(Integer.valueOf(readUnsignedShort2));
if (z11) {
Object[] objArr = new Object[5];
objArr[0] = Integer.valueOf(i10);
objArr[1] = Integer.valueOf(readUnsignedShort2);
s7 = s10;
if (dVar != null) {
str = dVar.f11483b;
} else {
str = null;
}
objArr[2] = str;
objArr[3] = Integer.valueOf(readUnsignedShort3);
objArr[4] = Integer.valueOf(readInt);
Log.d("ExifInterface", String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr));
} else {
s7 = s10;
}
if (dVar == null) {
if (z11) {
StringBuilder sb = new StringBuilder("Skip the tag entry since tag number is not defined: ");
i14 = readUnsignedShort2;
sb.append(i14);
Log.d("ExifInterface", sb.toString());
} else {
i14 = readUnsignedShort2;
}
hashSet = hashSet3;
i11 = i14;
} else {
if (readUnsignedShort3 > 0) {
hashSet = hashSet3;
if (readUnsignedShort3 < D.length) {
int i18 = dVar.f11484c;
i11 = readUnsignedShort2;
if (i18 != 7 && readUnsignedShort3 != 7 && i18 != readUnsignedShort3 && (i12 = dVar.f11485d) != readUnsignedShort3 && (((i18 != 4 && i12 != 4) || readUnsignedShort3 != 3) && (((i18 != 9 && i12 != 9) || readUnsignedShort3 != 8) && ((i18 != 12 && i12 != 12) || readUnsignedShort3 != 11)))) {
z6 = false;
} else {
z6 = true;
}
if (!z6) {
if (z11) {
Log.d("ExifInterface", "Skip the tag entry since data format (" + C[readUnsignedShort3] + ") is unexpected for tag: " + dVar.f11483b);
}
} else {
if (readUnsignedShort3 == 7) {
readUnsignedShort3 = i18;
}
j10 = readInt * iArr[readUnsignedShort3];
if (j10 >= 0 && j10 <= 2147483647L) {
z10 = true;
if (!z10) {
}
hashSet2 = hashSet;
i15 = i10;
hashSet3 = hashSet2;
readShort = s11;
s10 = (short) (s7 + 1);
bVar3 = bVar2;
} else {
if (z11) {
Log.d("ExifInterface", "Skip the tag entry since the number of components is invalid: " + readInt);
}
z10 = false;
if (!z10) {
bVar4.a(j14);
bVar2 = bVar;
} else {
if (j10 > 4) {
int readInt2 = bVar.readInt();
if (z11) {
Log.d("ExifInterface", "seek to data offset: " + readInt2);
}
int i19 = this.f11504c;
if (i19 == 7) {
if ("MakerNote".equals(dVar.f11483b)) {
this.f11510i = readInt2;
} else if (i10 == 6 && "ThumbnailImage".equals(dVar.f11483b)) {
this.f11511j = readInt2;
this.f11512k = readInt;
c d10 = c.d(6, this.f11507f);
j13 = j14;
c b10 = c.b(this.f11511j, this.f11507f);
i13 = readInt;
c b11 = c.b(this.f11512k, this.f11507f);
hashMapArr[4].put("Compression", d10);
hashMapArr[4].put("JPEGInterchangeFormat", b10);
hashMapArr[4].put("JPEGInterchangeFormatLength", b11);
}
j13 = j14;
i13 = readInt;
} else {
j13 = j14;
i13 = readInt;
if (i19 == 10 && "JpgFromRaw".equals(dVar.f11483b)) {
this.f11513l = readInt2;
}
}
long j15 = readInt2;
hashMapArr2 = hashMapArr;
if (j15 + j10 <= i17) {
bVar2 = bVar;
bVar2.a(j15);
bVar4 = bVar2;
j11 = j13;
} else {
bVar2 = bVar;
if (z11) {
Log.d("ExifInterface", "Skip the tag entry since data offset is invalid: " + readInt2);
}
bVar2.a(j13);
bVar4 = bVar2;
}
} else {
hashMapArr2 = hashMapArr;
i13 = readInt;
j11 = j14;
bVar2 = bVar;
}
Integer num = (Integer) L.get(Integer.valueOf(i11));
if (z11) {
Log.d("ExifInterface", "nextIfdType: " + num + " byteCount: " + j10);
}
if (num != null) {
if (readUnsignedShort3 != 3) {
if (readUnsignedShort3 != 4) {
if (readUnsignedShort3 != 8) {
if (readUnsignedShort3 != 9 && readUnsignedShort3 != 13) {
j12 = -1;
} else {
readUnsignedShort = bVar.readInt();
}
} else {
readUnsignedShort = bVar.readShort();
}
} else {
j12 = bVar.readInt() & 4294967295L;
}
if (z11) {
Log.d("ExifInterface", String.format("Offset: %d, tagName: %s", Long.valueOf(j12), dVar.f11483b));
}
if (j12 > 0) {
b bVar5 = bVar4;
if (j12 < i17) {
hashSet2 = hashSet;
if (!hashSet2.contains(Integer.valueOf((int) j12))) {
bVar4 = bVar5;
bVar4.a(j12);
u(bVar4, num.intValue());
} else {
bVar4 = bVar5;
if (z11) {
Log.d("ExifInterface", "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j12 + ")");
}
}
bVar4.a(j11);
} else {
bVar4 = bVar5;
}
}
hashSet2 = hashSet;
if (z11) {
Log.d("ExifInterface", "Skip jump into the IFD since its offset is invalid: " + j12);
}
bVar4.a(j11);
} else {
readUnsignedShort = bVar.readUnsignedShort();
}
j12 = readUnsignedShort;
if (z11) {
}
if (j12 > 0) {
}
hashSet2 = hashSet;
if (z11) {
}
bVar4.a(j11);
} else {
hashSet2 = hashSet;
byte[] bArr = new byte[(int) j10];
bVar4.readFully(bArr);
c cVar = new c(bArr, readUnsignedShort3, i13, 0);
hashMapArr2[i10].put(dVar.f11483b, cVar);
String str2 = dVar.f11483b;
if ("DNGVersion".equals(str2)) {
this.f11504c = 3;
}
if ((("Make".equals(str2) || "Model".equals(str2)) && cVar.g(this.f11507f).contains("PENTAX")) || ("Compression".equals(str2) && cVar.f(this.f11507f) == 65535)) {
this.f11504c = 8;
}
if (bVar4.f11478n != j11) {
bVar4.a(j11);
}
}
i15 = i10;
hashSet3 = hashSet2;
readShort = s11;
s10 = (short) (s7 + 1);
bVar3 = bVar2;
}
hashSet2 = hashSet;
i15 = i10;
hashSet3 = hashSet2;
readShort = s11;
s10 = (short) (s7 + 1);
bVar3 = bVar2;
}
}
}
} else {
hashSet = hashSet3;
}
i11 = readUnsignedShort2;
if (z11) {
Log.d("ExifInterface", "Skip the tag entry since data format is invalid: " + readUnsignedShort3);
}
}
j10 = 0;
z10 = false;
if (!z10) {
}
hashSet2 = hashSet;
i15 = i10;
hashSet3 = hashSet2;
readShort = s11;
s10 = (short) (s7 + 1);
bVar3 = bVar2;
}
HashSet hashSet4 = hashSet3;
if (bVar4.f11478n + 4 <= i17) {
int readInt3 = bVar.readInt();
if (z11) {
Log.d("ExifInterface", String.format("nextIfdOffset: %d", Integer.valueOf(readInt3)));
}
long j16 = readInt3;
if (j16 > 0 && readInt3 < i17) {
if (!hashSet4.contains(Integer.valueOf(readInt3))) {
bVar4.a(j16);
if (hashMapArr[4].isEmpty()) {
u(bVar4, 4);
} else if (hashMapArr[5].isEmpty()) {
u(bVar4, 5);
}
} else if (z11) {
Log.d("ExifInterface", "Stop reading file since re-reading an IFD may cause an infinite loop: " + readInt3);
}
} else if (z11) {
Log.d("ExifInterface", "Stop reading file since a wrong offset may cause an infinite loop: " + readInt3);
}
}
}
}
public final void v(b bVar) {
boolean z6;
c cVar;
int f10;
HashMap hashMap = this.f11505d[4];
c cVar2 = (c) hashMap.get("Compression");
if (cVar2 != null) {
int f11 = cVar2.f(this.f11507f);
if (f11 != 1) {
if (f11 != 6) {
if (f11 != 7) {
return;
}
} else {
o(bVar, hashMap);
return;
}
}
c cVar3 = (c) hashMap.get("BitsPerSample");
if (cVar3 != null) {
int[] iArr = (int[]) cVar3.h(this.f11507f);
int[] iArr2 = f11489n;
if (Arrays.equals(iArr2, iArr) || (this.f11504c == 3 && (cVar = (c) hashMap.get("PhotometricInterpretation")) != null && (((f10 = cVar.f(this.f11507f)) == 1 && Arrays.equals(iArr, f11490o)) || (f10 == 6 && Arrays.equals(iArr, iArr2))))) {
z6 = true;
if (!z6) {
c cVar4 = (c) hashMap.get("StripOffsets");
c cVar5 = (c) hashMap.get("StripByteCounts");
if (cVar4 != null && cVar5 != null) {
long[] c10 = c(cVar4.h(this.f11507f));
long[] c11 = c(cVar5.h(this.f11507f));
if (c10 != null && c10.length != 0) {
if (c11 != null && c11.length != 0) {
if (c10.length != c11.length) {
Log.w("ExifInterface", "stripOffsets and stripByteCounts should have same length.");
return;
}
long j10 = 0;
for (long j11 : c11) {
j10 += j11;
}
byte[] bArr = new byte[(int) j10];
this.f11508g = true;
int i10 = 0;
int i11 = 0;
for (int i12 = 0; i12 < c10.length; i12++) {
int i13 = (int) c10[i12];
int i14 = (int) c11[i12];
if (i12 < c10.length - 1 && i13 + i14 != c10[i12 + 1]) {
this.f11508g = false;
}
int i15 = i13 - i10;
if (i15 < 0) {
Log.d("ExifInterface", "Invalid strip offset value");
}
bVar.a(i15);
int i16 = i10 + i15;
byte[] bArr2 = new byte[i14];
bVar.read(bArr2);
i10 = i16 + i14;
System.arraycopy(bArr2, 0, bArr, i11, i14);
i11 += i14;
}
if (this.f11508g) {
long j12 = c10[0];
return;
}
return;
}
Log.w("ExifInterface", "stripByteCounts should not be null or have zero length.");
return;
}
Log.w("ExifInterface", "stripOffsets should not be null or have zero length.");
return;
}
return;
}
return;
}
}
if (f11488m) {
Log.d("ExifInterface", "Unsupported data type value");
}
z6 = false;
if (!z6) {
}
} else {
o(bVar, hashMap);
}
}
public final void w(int i10, int i11) {
HashMap[] hashMapArr = this.f11505d;
boolean isEmpty = hashMapArr[i10].isEmpty();
boolean z6 = f11488m;
if (!isEmpty && !hashMapArr[i11].isEmpty()) {
c cVar = (c) hashMapArr[i10].get("ImageLength");
c cVar2 = (c) hashMapArr[i10].get("ImageWidth");
c cVar3 = (c) hashMapArr[i11].get("ImageLength");
c cVar4 = (c) hashMapArr[i11].get("ImageWidth");
if (cVar != null && cVar2 != null) {
if (cVar3 != null && cVar4 != null) {
int f10 = cVar.f(this.f11507f);
int f11 = cVar2.f(this.f11507f);
int f12 = cVar3.f(this.f11507f);
int f13 = cVar4.f(this.f11507f);
if (f10 < f12 && f11 < f13) {
HashMap hashMap = hashMapArr[i10];
hashMapArr[i10] = hashMapArr[i11];
hashMapArr[i11] = hashMap;
}
} else if (z6) {
Log.d("ExifInterface", "Second image does not contain valid size information");
}
} else if (z6) {
Log.d("ExifInterface", "First image does not contain valid size information");
}
} else if (z6) {
Log.d("ExifInterface", "Cannot perform swap since only one image data exists");
}
}
public final void x(b bVar, int i10) {
c cVar;
c d10;
c d11;
HashMap[] hashMapArr = this.f11505d;
c cVar2 = (c) hashMapArr[i10].get("DefaultCropSize");
c cVar3 = (c) hashMapArr[i10].get("SensorTopBorder");
c cVar4 = (c) hashMapArr[i10].get("SensorLeftBorder");
c cVar5 = (c) hashMapArr[i10].get("SensorBottomBorder");
c cVar6 = (c) hashMapArr[i10].get("SensorRightBorder");
if (cVar2 != null) {
if (cVar2.f11479a == 5) {
e[] eVarArr = (e[]) cVar2.h(this.f11507f);
if (eVarArr != null && eVarArr.length == 2) {
d10 = c.c(eVarArr[0], this.f11507f);
d11 = c.c(eVarArr[1], this.f11507f);
} else {
Log.w("ExifInterface", "Invalid crop size values. cropSize=" + Arrays.toString(eVarArr));
return;
}
} else {
int[] iArr = (int[]) cVar2.h(this.f11507f);
if (iArr != null && iArr.length == 2) {
d10 = c.d(iArr[0], this.f11507f);
d11 = c.d(iArr[1], this.f11507f);
} else {
Log.w("ExifInterface", "Invalid crop size values. cropSize=" + Arrays.toString(iArr));
return;
}
}
hashMapArr[i10].put("ImageWidth", d10);
hashMapArr[i10].put("ImageLength", d11);
} else if (cVar3 != null && cVar4 != null && cVar5 != null && cVar6 != null) {
int f10 = cVar3.f(this.f11507f);
int f11 = cVar5.f(this.f11507f);
int f12 = cVar6.f(this.f11507f);
int f13 = cVar4.f(this.f11507f);
if (f11 > f10 && f12 > f13) {
c d12 = c.d(f11 - f10, this.f11507f);
c d13 = c.d(f12 - f13, this.f11507f);
hashMapArr[i10].put("ImageLength", d12);
hashMapArr[i10].put("ImageWidth", d13);
}
} else {
c cVar7 = (c) hashMapArr[i10].get("ImageLength");
c cVar8 = (c) hashMapArr[i10].get("ImageWidth");
if ((cVar7 == null || cVar8 == null) && (cVar = (c) hashMapArr[i10].get("JPEGInterchangeFormat")) != null) {
g(bVar, cVar.f(this.f11507f), i10);
}
}
}
public final void y() {
w(0, 5);
w(0, 4);
w(5, 4);
HashMap[] hashMapArr = this.f11505d;
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() && p(hashMapArr[5])) {
hashMapArr[4] = hashMapArr[5];
hashMapArr[5] = new HashMap();
}
if (!p(hashMapArr[4])) {
Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image.");
}
}
}