Whiux White v3.3版本的 MD5 值为:cb2472159ed9eb4da43a41af3e7eec60
以下内容为反编译后的 g.java 源代码,内容仅作参考
package w0;
import android.content.res.AssetManager;
import android.media.MediaMetadataRetriever;
import android.os.Build;
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.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.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
public final class g {
public static final String[] D;
public static final int[] E;
public static final byte[] F;
public static final d G;
public static final d[][] H;
public static final d[] I;
public static final HashMap[] J;
public static final HashMap[] K;
public static final HashSet L;
public static final HashMap M;
public static final Charset N;
public static final byte[] O;
public static final byte[] P;
public final FileDescriptor a;
public final AssetManager.AssetInputStream f7524b;
public int f7525c;
public final HashMap[] f7526d;
public final HashSet f7527e;
public ByteOrder f7528f;
public boolean f7529g;
public int f7530h;
public int f7531i;
public int f7532j;
public int f7533k;
public static final boolean f7510l = Log.isLoggable("ExifInterface", 3);
public static final List f7511m = Arrays.asList(1, 6, 3, 8);
public static final List f7512n = Arrays.asList(2, 7, 4, 5);
public static final int[] f7513o = {8, 8, 8};
public static final int[] f7514p = {8};
public static final byte[] q = {-1, -40, -1};
public static final byte[] f7515r = {102, 116, 121, 112};
public static final byte[] f7516s = {109, 105, 102, 49};
public static final byte[] f7517t = {104, 101, 105, 99};
public static final byte[] f7518u = {79, 76, 89, 77, 80, 0};
public static final byte[] f7519v = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
public static final byte[] f7520w = {-119, 80, 78, 71, 13, 10, 26, 10};
public static final byte[] f7521x = {101, 88, 73, 102};
public static final byte[] f7522y = {73, 72, 68, 82};
public static final byte[] f7523z = {73, 69, 78, 68};
public static final byte[] A = {82, 73, 70, 70};
public static final byte[] B = {87, 69, 66, 80};
public static final byte[] C = {69, 88, 73, 70};
static {
d[] dVarArr;
"VP8X".getBytes(Charset.defaultCharset());
"VP8L".getBytes(Charset.defaultCharset());
"VP8 ".getBytes(Charset.defaultCharset());
"ANIM".getBytes(Charset.defaultCharset());
"ANMF".getBytes(Charset.defaultCharset());
D = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
E = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
F = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
d[] dVarArr2 = {new d("NewSubfileType", 254, 4), new d("SubfileType", 255, 4), new d("ImageWidth", 256, 3, 4), new d("ImageLength", 257, 3, 4), 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("StripOffsets", 273, 3, 4), new d("Orientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d("RowsPerStrip", 278, 3, 4), new d("StripByteCounts", 279, 3, 4), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", 301, 3), new d("Software", 305, 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[] dVarArr3 = {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("PixelXDimension", 40962, 3, 4), new d("PixelYDimension", 40963, 3, 4), 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("DefaultCropSize", 50720, 3, 4)};
d[] dVarArr4 = {new d("GPSVersionID", 0, 1), new d("GPSLatitudeRef", 1, 2), new d("GPSLatitude", 2, 5, 10), new d("GPSLongitudeRef", 3, 2), new d("GPSLongitude", 4, 5, 10), 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[] dVarArr5 = {new d("InteroperabilityIndex", 1, 2)};
d[] dVarArr6 = {new d("NewSubfileType", 254, 4), new d("SubfileType", 255, 4), new d("ThumbnailImageWidth", 256, 3, 4), new d("ThumbnailImageLength", 257, 3, 4), 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("StripOffsets", 273, 3, 4), new d("ThumbnailOrientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d("RowsPerStrip", 278, 3, 4), new d("StripByteCounts", 279, 3, 4), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", 301, 3), new d("Software", 305, 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("DNGVersion", 50706, 1), new d("DefaultCropSize", 50720, 3, 4)};
G = new d("StripOffsets", 273, 3);
H = new d[][]{dVarArr2, dVarArr3, dVarArr4, dVarArr5, dVarArr6, dVarArr2, 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)}};
I = 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)};
J = new HashMap[10];
K = new HashMap[10];
L = new HashSet(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
M = new HashMap();
Charset forName = Charset.forName("US-ASCII");
N = forName;
O = "Exif\u0000\u0000".getBytes(forName);
P = "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 i6 = 0;
while (true) {
d[][] dVarArr7 = H;
if (i6 >= dVarArr7.length) {
HashMap hashMap = M;
d[] dVarArr8 = I;
hashMap.put(Integer.valueOf(dVarArr8[0].a), 5);
hashMap.put(Integer.valueOf(dVarArr8[1].a), 1);
hashMap.put(Integer.valueOf(dVarArr8[2].a), 2);
hashMap.put(Integer.valueOf(dVarArr8[3].a), 3);
hashMap.put(Integer.valueOf(dVarArr8[4].a), 7);
hashMap.put(Integer.valueOf(dVarArr8[5].a), 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;
}
J[i6] = new HashMap();
K[i6] = new HashMap();
for (d dVar : dVarArr7[i6]) {
J[i6].put(Integer.valueOf(dVar.a), dVar);
K[i6].put(dVar.f7506b, dVar);
}
i6++;
}
}
public g(InputStream inputStream) {
boolean z5;
d[][] dVarArr = H;
this.f7526d = new HashMap[dVarArr.length];
this.f7527e = new HashSet(dVarArr.length);
this.f7528f = ByteOrder.BIG_ENDIAN;
boolean z6 = inputStream instanceof AssetManager.AssetInputStream;
boolean z7 = true;
FileDescriptor fileDescriptor = null;
boolean z8 = f7510l;
if (z6) {
this.f7524b = (AssetManager.AssetInputStream) inputStream;
} else {
if (inputStream instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream) inputStream;
try {
h.c(fileInputStream.getFD(), 0L, OsConstants.SEEK_CUR);
z5 = true;
} catch (Exception unused) {
if (z8) {
Log.d("ExifInterface", "The file descriptor for the given input is not seekable");
}
z5 = false;
}
if (z5) {
this.f7524b = null;
fileDescriptor = fileInputStream.getFD();
}
}
this.f7524b = null;
}
this.a = fileDescriptor;
for (int i6 = 0; i6 < dVarArr.length; i6++) {
try {
try {
this.f7526d[i6] = new HashMap();
} finally {
a();
if (z8) {
q();
}
}
} catch (IOException | UnsupportedOperationException e6) {
if (z8) {
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.", e6);
}
if (!z8) {
return;
}
}
}
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
int g6 = g(bufferedInputStream);
this.f7525c = g6;
if ((g6 == 4 || g6 == 9 || g6 == 13 || g6 == 14) ? false : false) {
f fVar = new f(bufferedInputStream);
int i7 = this.f7525c;
if (i7 == 12) {
e(fVar);
} else if (i7 == 7) {
h(fVar);
} else if (i7 == 10) {
l(fVar);
} else {
k(fVar);
}
fVar.j(this.f7530h);
v(fVar);
} else {
b bVar = new b(bufferedInputStream);
int i8 = this.f7525c;
if (i8 == 4) {
f(bVar, 0, 0);
} else if (i8 == 13) {
i(bVar);
} else if (i8 == 9) {
j(bVar);
} else if (i8 == 14) {
m(bVar);
}
}
a();
if (!z8) {
}
}
public static ByteOrder r(b bVar) {
short readShort = bVar.readShort();
boolean z5 = f7510l;
if (readShort == 18761) {
if (z5) {
Log.d("ExifInterface", "readExifSegment: Byte Align II");
}
return ByteOrder.LITTLE_ENDIAN;
} else if (readShort == 19789) {
if (z5) {
Log.d("ExifInterface", "readExifSegment: Byte Align MM");
}
return ByteOrder.BIG_ENDIAN;
} else {
throw new IOException("Invalid byte order: " + Integer.toHexString(readShort));
}
}
public final void a() {
String b6 = b("DateTimeOriginal");
HashMap[] hashMapArr = this.f7526d;
if (b6 != null && b("DateTime") == null) {
hashMapArr[0].put("DateTime", c.a(b6));
}
if (b("ImageWidth") == null) {
hashMapArr[0].put("ImageWidth", c.b(0L, this.f7528f));
}
if (b("ImageLength") == null) {
hashMapArr[0].put("ImageLength", c.b(0L, this.f7528f));
}
if (b("Orientation") == null) {
hashMapArr[0].put("Orientation", c.b(0L, this.f7528f));
}
if (b("LightSource") == null) {
hashMapArr[1].put("LightSource", c.b(0L, this.f7528f));
}
}
public final String b(String str) {
String str2;
c d6 = d(str);
if (d6 != null) {
if (!L.contains(str)) {
return d6.g(this.f7528f);
}
if (str.equals("GPSTimeStamp")) {
int i6 = d6.a;
if (i6 != 5 && i6 != 10) {
str2 = androidx.activity.f.m("GPS Timestamp format is not rational. format=", i6);
} else {
e[] eVarArr = (e[]) d6.h(this.f7528f);
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.a) / ((float) eVar.f7509b))), Integer.valueOf((int) (((float) eVar2.a) / ((float) eVar2.f7509b))), Integer.valueOf((int) (((float) eVar3.a) / ((float) eVar3.f7509b))));
}
str2 = "Invalid GPS Timestamp array. array=" + Arrays.toString(eVarArr);
}
Log.w("ExifInterface", str2);
return null;
}
try {
return Double.toString(d6.e(this.f7528f));
} catch (NumberFormatException unused) {
}
}
return null;
}
public final int c() {
c d6 = d("Orientation");
if (d6 == null) {
return 1;
}
try {
return d6.f(this.f7528f);
} catch (NumberFormatException unused) {
return 1;
}
}
public void citrus() {
}
public final c d(String str) {
if ("ISOSpeedRatings".equals(str)) {
if (f7510l) {
Log.d("ExifInterface", "getExifAttribute: Replacing TAG_ISO_SPEED_RATINGS with TAG_PHOTOGRAPHIC_SENSITIVITY.");
}
str = "PhotographicSensitivity";
}
for (int i6 = 0; i6 < H.length; i6++) {
c cVar = (c) this.f7526d[i6].get(str);
if (cVar != null) {
return cVar;
}
}
return null;
}
public final void e(f fVar) {
String str;
String str2;
String str3;
if (Build.VERSION.SDK_INT < 28) {
throw new UnsupportedOperationException("Reading EXIF from HEIF files is supported from SDK 28 and above");
}
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.f7526d;
if (str != null) {
hashMapArr[0].put("ImageWidth", c.d(Integer.parseInt(str), this.f7528f));
}
if (str2 != null) {
hashMapArr[0].put("ImageLength", c.d(Integer.parseInt(str2), this.f7528f));
}
if (str3 != null) {
int parseInt = Integer.parseInt(str3);
hashMapArr[0].put("Orientation", c.d(parseInt != 90 ? parseInt != 180 ? parseInt != 270 ? 1 : 8 : 3 : 6, this.f7528f));
}
if (extractMetadata != null && extractMetadata2 != null) {
int parseInt2 = Integer.parseInt(extractMetadata);
int parseInt3 = Integer.parseInt(extractMetadata2);
if (parseInt3 <= 6) {
throw new IOException("Invalid exif length");
}
fVar.j(parseInt2);
byte[] bArr = new byte[6];
if (fVar.read(bArr) != 6) {
throw new IOException("Can't read identifier");
}
int i6 = parseInt2 + 6;
int i7 = parseInt3 - 6;
if (!Arrays.equals(bArr, O)) {
throw new IOException("Invalid identifier");
}
byte[] bArr2 = new byte[i7];
if (fVar.read(bArr2) != i7) {
throw new IOException("Can't read exif");
}
this.f7530h = i6;
s(0, bArr2);
}
if (f7510l) {
Log.d("ExifInterface", "Heif meta: " + str + "x" + str2 + ", rotation " + str3);
}
} catch (RuntimeException unused) {
throw new UnsupportedOperationException("Failed to read EXIF from HEIF file. Given stream is either malformed or unsupported.");
}
} finally {
mediaMetadataRetriever.release();
}
}
public final void f(b bVar, int i6, int i7) {
byte readByte;
byte readByte2;
boolean z5;
boolean z6;
String str;
String str2;
boolean z7 = f7510l;
if (z7) {
Log.d("ExifInterface", "getJpegAttributes starting with: " + bVar);
}
bVar.f7500k = ByteOrder.BIG_ENDIAN;
byte b6 = -1;
if (bVar.readByte() == -1) {
if (bVar.readByte() != -40) {
throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
}
int i8 = 2;
int i9 = 2;
while (true) {
if (bVar.readByte() == b6) {
int i10 = i9 + 1;
byte readByte3 = bVar.readByte();
if (z7) {
Log.d("ExifInterface", "Found JPEG segment indicator: " + Integer.toHexString(readByte3 & 255));
}
int i11 = i10 + 1;
if (readByte3 != -39 && readByte3 != -38) {
int readUnsignedShort = bVar.readUnsignedShort() - i8;
int i12 = i11 + i8;
if (z7) {
Log.d("ExifInterface", "JPEG segment: " + Integer.toHexString(readByte3 & 255) + " (length: " + (readUnsignedShort + 2) + ")");
}
if (readUnsignedShort >= 0) {
HashMap[] hashMapArr = this.f7526d;
if (readByte3 != -31) {
if (readByte3 != -2) {
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
}
case -55:
case -54:
case -53:
bVar.a(1);
HashMap hashMap = hashMapArr[i7];
if (i7 != 4) {
str = "ImageLength";
} else {
str = "ThumbnailImageLength";
}
hashMap.put(str, c.b(bVar.readUnsignedShort(), this.f7528f));
HashMap hashMap2 = hashMapArr[i7];
if (i7 != 4) {
str2 = "ImageWidth";
} else {
str2 = "ThumbnailImageWidth";
}
hashMap2.put(str2, c.b(bVar.readUnsignedShort(), this.f7528f));
readUnsignedShort -= 5;
break;
}
case -59:
case -58:
case -57:
break;
}
case -64:
case -63:
case -62:
case -61:
break;
}
if (readUnsignedShort < 0) {
bVar.a(readUnsignedShort);
i9 = i12 + readUnsignedShort;
i8 = 2;
b6 = -1;
} else {
throw new IOException("Invalid length");
}
} else {
byte[] bArr = new byte[readUnsignedShort];
if (bVar.read(bArr) == readUnsignedShort) {
if (b("UserComment") == null) {
hashMapArr[1].put("UserComment", c.a(new String(bArr, N)));
}
} else {
throw new IOException("Invalid exif");
}
}
} else {
byte[] bArr2 = new byte[readUnsignedShort];
bVar.readFully(bArr2);
int i13 = i12 + readUnsignedShort;
byte[] bArr3 = O;
if (bArr3 != null && readUnsignedShort >= bArr3.length) {
for (int i14 = 0; i14 < bArr3.length; i14++) {
if (bArr2[i14] == bArr3[i14]) {
}
}
z5 = true;
if (!z5) {
byte[] copyOfRange = Arrays.copyOfRange(bArr2, bArr3.length, readUnsignedShort);
this.f7530h = i6 + i12 + bArr3.length;
s(i7, copyOfRange);
v(new b(copyOfRange));
} else {
byte[] bArr4 = P;
if (bArr4 != null && readUnsignedShort >= bArr4.length) {
for (int i15 = 0; i15 < bArr4.length; i15++) {
if (bArr2[i15] == bArr4[i15]) {
}
}
z6 = true;
if (z6) {
int length = bArr4.length + i12;
byte[] copyOfRange2 = Arrays.copyOfRange(bArr2, bArr4.length, readUnsignedShort);
if (b("Xmp") == null) {
hashMapArr[0].put("Xmp", new c(length, copyOfRange2, 1, copyOfRange2.length));
}
}
}
z6 = false;
if (z6) {
}
}
i12 = i13;
}
z5 = false;
if (!z5) {
}
i12 = i13;
}
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));
}
}
public final int g(BufferedInputStream bufferedInputStream) {
boolean z5;
boolean z6;
b bVar;
b bVar2;
boolean z7;
b bVar3;
b bVar4;
boolean z8;
b bVar5;
b bVar6;
boolean z9;
boolean z10;
boolean z11;
long j6;
bufferedInputStream.mark(5000);
byte[] bArr = new byte[5000];
bufferedInputStream.read(bArr);
bufferedInputStream.reset();
int i6 = 0;
while (true) {
byte[] bArr2 = q;
if (i6 >= bArr2.length) {
z5 = true;
break;
} else if (bArr[i6] != bArr2[i6]) {
z5 = false;
break;
} else {
i6++;
}
}
if (z5) {
return 4;
}
byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
int i7 = 0;
while (true) {
if (i7 >= bytes.length) {
z6 = true;
break;
} else if (bArr[i7] != bytes[i7]) {
z6 = false;
break;
} else {
i7++;
}
}
if (z6) {
return 9;
}
try {
bVar2 = new b(bArr);
} catch (Exception e6) {
e = e6;
bVar2 = null;
} catch (Throwable th) {
th = th;
bVar = null;
bVar2 = bVar;
if (bVar2 != null) {
}
throw th;
}
try {
long readInt = bVar2.readInt();
byte[] bArr3 = new byte[4];
bVar2.read(bArr3);
if (Arrays.equals(bArr3, f7515r)) {
if (readInt == 1) {
readInt = bVar2.readLong();
j6 = 16;
if (readInt < 16) {
}
} else {
j6 = 8;
}
long j7 = 5000;
if (readInt > j7) {
readInt = j7;
}
long j8 = readInt - j6;
if (j8 >= 8) {
byte[] bArr4 = new byte[4];
boolean z12 = false;
boolean z13 = false;
for (long j9 = 0; j9 < j8 / 4 && bVar2.read(bArr4) == 4; j9++) {
if (j9 != 1) {
if (Arrays.equals(bArr4, f7516s)) {
z12 = true;
} else if (Arrays.equals(bArr4, f7517t)) {
z13 = true;
}
if (z12 && z13) {
bVar2.close();
z7 = true;
break;
}
}
}
}
}
} catch (Exception e7) {
e = e7;
try {
if (f7510l) {
Log.d("ExifInterface", "Exception parsing HEIF file type box.", e);
}
} catch (Throwable th2) {
th = th2;
bVar = bVar2;
bVar2 = bVar;
if (bVar2 != null) {
bVar2.close();
}
throw th;
}
} catch (Throwable th3) {
th = th3;
if (bVar2 != null) {
}
throw th;
}
bVar2.close();
z7 = false;
if (z7) {
return 12;
}
try {
bVar4 = new b(bArr);
try {
ByteOrder r5 = r(bVar4);
this.f7528f = r5;
bVar4.f7500k = r5;
short readShort = bVar4.readShort();
z8 = readShort == 20306 || readShort == 21330;
bVar4.close();
} catch (Exception unused) {
if (bVar4 != null) {
bVar4.close();
}
z8 = false;
if (z8) {
}
} 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 (z8) {
try {
b bVar7 = new b(bArr);
try {
ByteOrder r6 = r(bVar7);
this.f7528f = r6;
bVar7.f7500k = r6;
z9 = bVar7.readShort() == 85;
bVar7.close();
} catch (Exception unused3) {
bVar6 = bVar7;
if (bVar6 != null) {
bVar6.close();
}
z9 = false;
if (!z9) {
}
} 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 (!z9) {
return 10;
}
int i8 = 0;
while (true) {
byte[] bArr5 = f7520w;
if (i8 >= bArr5.length) {
z10 = true;
break;
} else if (bArr[i8] != bArr5[i8]) {
z10 = false;
break;
} else {
i8++;
}
}
if (z10) {
return 13;
}
int i9 = 0;
while (true) {
byte[] bArr6 = A;
if (i9 >= bArr6.length) {
int i10 = 0;
while (true) {
byte[] bArr7 = B;
if (i10 >= bArr7.length) {
z11 = true;
break;
} else if (bArr[bArr6.length + i10 + 4] != bArr7[i10]) {
break;
} else {
i10++;
}
}
} else if (bArr[i9] != bArr6[i9]) {
break;
} else {
i9++;
}
}
z11 = false;
return z11 ? 14 : 0;
}
return 7;
}
public final void h(f fVar) {
c cVar;
c cVar2;
c cVar3;
int i6;
int i7;
long j6;
k(fVar);
HashMap[] hashMapArr = this.f7526d;
c cVar4 = (c) hashMapArr[1].get("MakerNote");
if (cVar4 != null) {
f fVar2 = new f(cVar4.f7505d);
fVar2.f7500k = this.f7528f;
byte[] bArr = f7518u;
byte[] bArr2 = new byte[bArr.length];
fVar2.readFully(bArr2);
fVar2.j(0L);
byte[] bArr3 = f7519v;
byte[] bArr4 = new byte[bArr3.length];
fVar2.readFully(bArr4);
if (Arrays.equals(bArr2, bArr)) {
j6 = 8;
} else {
j6 = Arrays.equals(bArr4, bArr3) ? 12L : 12L;
t(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.h(this.f7528f);
if (iArr != null && iArr.length == 4) {
int i8 = iArr[2];
int i9 = iArr[0];
if (i8 > i9 && (i6 = iArr[3]) > (i7 = iArr[1])) {
int i10 = (i8 - i9) + 1;
int i11 = (i6 - i7) + 1;
if (i10 < i11) {
int i12 = i10 + i11;
i11 = i12 - i11;
i10 = i12 - i11;
}
c d6 = c.d(i10, this.f7528f);
c d7 = c.d(i11, this.f7528f);
hashMapArr[0].put("ImageWidth", d6);
hashMapArr[0].put("ImageLength", d7);
return;
}
return;
}
Log.w("ExifInterface", "Invalid aspect frame values. frame=" + Arrays.toString(iArr));
return;
}
return;
}
fVar2.j(j6);
t(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 i(b bVar) {
if (f7510l) {
Log.d("ExifInterface", "getPngAttributes starting with: " + bVar);
}
bVar.f7500k = ByteOrder.BIG_ENDIAN;
byte[] bArr = f7520w;
bVar.a(bArr.length);
int length = bArr.length + 0;
while (true) {
try {
int readInt = bVar.readInt();
int i6 = length + 4;
byte[] bArr2 = new byte[4];
if (bVar.read(bArr2) == 4) {
int i7 = i6 + 4;
if (i7 == 16 && !Arrays.equals(bArr2, f7522y)) {
throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
}
if (!Arrays.equals(bArr2, f7523z)) {
if (Arrays.equals(bArr2, f7521x)) {
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.f7530h = i7;
s(0, bArr3);
y();
v(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: " + e2.f.m(bArr2));
}
int i8 = readInt + 4;
bVar.a(i8);
length = i7 + i8;
} 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 j(b bVar) {
boolean z5 = f7510l;
if (z5) {
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 i6 = ByteBuffer.wrap(bArr).getInt();
int i7 = ByteBuffer.wrap(bArr2).getInt();
int i8 = ByteBuffer.wrap(bArr3).getInt();
byte[] bArr4 = new byte[i7];
bVar.a(i6 - bVar.f7501l);
bVar.read(bArr4);
f(new b(bArr4), i6, 5);
bVar.a(i8 - bVar.f7501l);
bVar.f7500k = ByteOrder.BIG_ENDIAN;
int readInt = bVar.readInt();
if (z5) {
Log.d("ExifInterface", "numberOfDirectoryEntry: " + readInt);
}
for (int i9 = 0; i9 < readInt; i9++) {
int readUnsignedShort = bVar.readUnsignedShort();
int readUnsignedShort2 = bVar.readUnsignedShort();
if (readUnsignedShort == G.a) {
short readShort = bVar.readShort();
short readShort2 = bVar.readShort();
c d6 = c.d(readShort, this.f7528f);
c d7 = c.d(readShort2, this.f7528f);
HashMap[] hashMapArr = this.f7526d;
hashMapArr[0].put("ImageLength", d6);
hashMapArr[0].put("ImageWidth", d7);
if (z5) {
Log.d("ExifInterface", "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2));
return;
}
return;
}
bVar.a(readUnsignedShort2);
}
}
public final void k(f fVar) {
p(fVar);
t(fVar, 0);
x(fVar, 0);
x(fVar, 5);
x(fVar, 4);
y();
if (this.f7525c == 8) {
HashMap[] hashMapArr = this.f7526d;
c cVar = (c) hashMapArr[1].get("MakerNote");
if (cVar != null) {
f fVar2 = new f(cVar.f7505d);
fVar2.f7500k = this.f7528f;
fVar2.a(6);
t(fVar2, 9);
c cVar2 = (c) hashMapArr[9].get("ColorSpace");
if (cVar2 != null) {
hashMapArr[1].put("ColorSpace", cVar2);
}
}
}
}
public final void l(f fVar) {
if (f7510l) {
Log.d("ExifInterface", "getRw2Attributes starting with: " + fVar);
}
k(fVar);
HashMap[] hashMapArr = this.f7526d;
c cVar = (c) hashMapArr[0].get("JpgFromRaw");
if (cVar != null) {
f(new b(cVar.f7505d), (int) cVar.f7504c, 5);
}
c cVar2 = (c) hashMapArr[0].get("ISO");
c cVar3 = (c) hashMapArr[1].get("PhotographicSensitivity");
if (cVar2 == null || cVar3 != null) {
return;
}
hashMapArr[1].put("PhotographicSensitivity", cVar2);
}
public final void m(b bVar) {
if (f7510l) {
Log.d("ExifInterface", "getWebpAttributes starting with: " + bVar);
}
bVar.f7500k = ByteOrder.LITTLE_ENDIAN;
bVar.a(A.length);
int readInt = bVar.readInt() + 8;
byte[] bArr = B;
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 i6 = length + 4 + 4;
if (Arrays.equals(C, bArr2)) {
byte[] bArr3 = new byte[readInt2];
if (bVar.read(bArr3) == readInt2) {
this.f7530h = i6;
s(0, bArr3);
v(new b(bArr3));
return;
}
throw new IOException("Failed to read given length for given PNG chunk type: " + e2.f.m(bArr2));
}
if (readInt2 % 2 == 1) {
readInt2++;
}
length = i6 + 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 n(b bVar, HashMap hashMap) {
c cVar = (c) hashMap.get("JPEGInterchangeFormat");
c cVar2 = (c) hashMap.get("JPEGInterchangeFormatLength");
if (cVar == null || cVar2 == null) {
return;
}
int f6 = cVar.f(this.f7528f);
int f7 = cVar2.f(this.f7528f);
if (this.f7525c == 7) {
f6 += this.f7531i;
}
if (f6 > 0 && f7 > 0 && this.f7524b == null && this.a == null) {
bVar.skip(f6);
bVar.read(new byte[f7]);
}
if (f7510l) {
Log.d("ExifInterface", "Setting thumbnail attributes with offset: " + f6 + ", length: " + f7);
}
}
public final boolean o(HashMap hashMap) {
c cVar = (c) hashMap.get("ImageLength");
c cVar2 = (c) hashMap.get("ImageWidth");
if (cVar != null && cVar2 != null) {
int f6 = cVar.f(this.f7528f);
int f7 = cVar2.f(this.f7528f);
if (f6 <= 512 && f7 <= 512) {
return true;
}
}
return false;
}
public final void p(b bVar) {
ByteOrder r5 = r(bVar);
this.f7528f = r5;
bVar.f7500k = r5;
int readUnsignedShort = bVar.readUnsignedShort();
int i6 = this.f7525c;
if (i6 != 7 && i6 != 10 && readUnsignedShort != 42) {
throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort));
}
int readInt = bVar.readInt();
if (readInt >= 8) {
int i7 = readInt - 8;
if (i7 > 0) {
bVar.a(i7);
return;
}
return;
}
throw new IOException(androidx.activity.f.m("Invalid first Ifd offset: ", readInt));
}
public final void q() {
int i6 = 0;
while (true) {
HashMap[] hashMapArr = this.f7526d;
if (i6 >= hashMapArr.length) {
return;
}
Log.d("ExifInterface", "The size of tag group[" + i6 + "]: " + hashMapArr[i6].size());
for (Map.Entry entry : hashMapArr[i6].entrySet()) {
c cVar = (c) entry.getValue();
Log.d("ExifInterface", "tagName: " + ((String) entry.getKey()) + ", tagType: " + cVar.toString() + ", tagValue: '" + cVar.g(this.f7528f) + "'");
}
i6++;
}
}
public final void s(int i6, byte[] bArr) {
f fVar = new f(bArr);
p(fVar);
t(fVar, i6);
}
public final void t(f fVar, int i6) {
int i7;
HashMap[] hashMapArr;
StringBuilder sb;
short s5;
short s6;
long j6;
StringBuilder sb2;
int[] iArr;
boolean z5;
long j7;
boolean z6;
int i8;
HashSet hashSet;
String str;
int i9;
int i10;
String str2;
long j8;
HashSet hashSet2;
int readUnsignedShort;
long j9;
HashSet hashSet3;
StringBuilder sb3;
Integer valueOf = Integer.valueOf(fVar.f7501l);
HashSet hashSet4 = this.f7527e;
hashSet4.add(valueOf);
short readShort = fVar.readShort();
String str3 = "ExifInterface";
boolean z7 = f7510l;
if (z7) {
Log.d("ExifInterface", "numberOfDirectoryEntry: " + ((int) readShort));
}
if (readShort <= 0) {
return;
}
short s7 = 0;
while (true) {
i7 = 5;
hashMapArr = this.f7526d;
if (s7 >= readShort) {
break;
}
int readUnsignedShort2 = fVar.readUnsignedShort();
int readUnsignedShort3 = fVar.readUnsignedShort();
int readInt = fVar.readInt();
long j10 = fVar.f7501l + 4;
d dVar = (d) J[i6].get(Integer.valueOf(readUnsignedShort2));
if (z7) {
Object[] objArr = new Object[5];
objArr[0] = Integer.valueOf(i6);
objArr[1] = Integer.valueOf(readUnsignedShort2);
objArr[2] = dVar != null ? dVar.f7506b : null;
objArr[3] = Integer.valueOf(readUnsignedShort3);
objArr[4] = Integer.valueOf(readInt);
Log.d(str3, String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr));
}
if (dVar == null) {
if (z7) {
Log.d(str3, "Skip the tag entry since tag number is not defined: " + readUnsignedShort2);
}
s5 = readShort;
s6 = s7;
} else {
if (readUnsignedShort3 > 0) {
if (readUnsignedShort3 < E.length) {
int i11 = dVar.f7507c;
s5 = readShort;
if (i11 != 7 && readUnsignedShort3 != 7 && i11 != readUnsignedShort3 && (i8 = dVar.f7508d) != readUnsignedShort3) {
s6 = s7;
if (((i11 != 4 && i8 != 4) || readUnsignedShort3 != 3) && (((i11 != 9 && i8 != 9) || readUnsignedShort3 != 8) && ((i11 != 12 && i8 != 12) || readUnsignedShort3 != 11))) {
z5 = false;
if (z5) {
if (z7) {
sb2 = new StringBuilder("Skip the tag entry since data format (");
sb2.append(D[readUnsignedShort3]);
sb2.append(") is unexpected for tag: ");
sb2.append(dVar.f7506b);
j6 = j10;
Log.d(str3, sb2.toString());
j7 = 0;
z6 = false;
if (!z6) {
hashSet2 = hashSet4;
str2 = str3;
j8 = j6;
} else {
if (j7 > 4) {
int readInt2 = fVar.readInt();
if (z7) {
Log.d(str3, "seek to data offset: " + readInt2);
}
if (this.f7525c == 7) {
if ("MakerNote".equals(dVar.f7506b)) {
this.f7531i = readInt2;
} else if (i6 == 6 && "ThumbnailImage".equals(dVar.f7506b)) {
this.f7532j = readInt2;
this.f7533k = readInt;
c d6 = c.d(6, this.f7528f);
i9 = readUnsignedShort3;
i10 = readInt;
c b6 = c.b(this.f7532j, this.f7528f);
hashSet = hashSet4;
str = str3;
c b7 = c.b(this.f7533k, this.f7528f);
hashMapArr[4].put("Compression", d6);
hashMapArr[4].put("JPEGInterchangeFormat", b6);
hashMapArr[4].put("JPEGInterchangeFormatLength", b7);
fVar.j(readInt2);
}
}
hashSet = hashSet4;
str = str3;
i9 = readUnsignedShort3;
i10 = readInt;
fVar.j(readInt2);
} else {
hashSet = hashSet4;
str = str3;
i9 = readUnsignedShort3;
i10 = readInt;
}
Integer num = (Integer) M.get(Integer.valueOf(readUnsignedShort2));
if (z7) {
str2 = str;
Log.d(str2, "nextIfdType: " + num + " byteCount: " + j7);
} else {
str2 = str;
}
if (num != null) {
int i12 = i9;
if (i12 != 3) {
if (i12 != 4) {
if (i12 != 8) {
if (i12 != 9 && i12 != 13) {
j9 = -1;
} else {
readUnsignedShort = fVar.readInt();
}
} else {
readUnsignedShort = fVar.readShort();
}
} else {
j9 = fVar.readInt() & 4294967295L;
}
if (z7) {
Log.d(str2, String.format("Offset: %d, tagName: %s", Long.valueOf(j9), dVar.f7506b));
}
if (j9 <= 0) {
hashSet3 = hashSet;
if (!hashSet3.contains(Integer.valueOf((int) j9))) {
fVar.j(j9);
t(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(j9);
sb3.append(")");
Log.d(str2, sb3.toString());
}
fVar.j(j6);
hashSet2 = hashSet3;
} else {
hashSet3 = hashSet;
if (z7) {
sb3 = new StringBuilder("Skip jump into the IFD since its offset is invalid: ");
sb3.append(j9);
Log.d(str2, sb3.toString());
}
fVar.j(j6);
hashSet2 = hashSet3;
}
} else {
readUnsignedShort = fVar.readUnsignedShort();
}
j9 = readUnsignedShort;
if (z7) {
}
if (j9 <= 0) {
}
} else {
j8 = j6;
byte[] bArr = new byte[(int) j7];
fVar.readFully(bArr);
hashSet2 = hashSet;
c cVar = new c(fVar.f7501l + this.f7530h, bArr, i9, i10);
hashMapArr[i6].put(dVar.f7506b, cVar);
String str4 = dVar.f7506b;
if ("DNGVersion".equals(str4)) {
this.f7525c = 3;
}
if ((("Make".equals(str4) || "Model".equals(str4)) && cVar.g(this.f7528f).contains("PENTAX")) || ("Compression".equals(str4) && cVar.f(this.f7528f) == 65535)) {
this.f7525c = 8;
}
if (fVar.f7501l == j8) {
}
}
s7 = (short) (s6 + 1);
str3 = str2;
hashSet4 = hashSet2;
readShort = s5;
}
fVar.j(j8);
s7 = (short) (s6 + 1);
str3 = str2;
hashSet4 = hashSet2;
readShort = s5;
}
} else {
if (readUnsignedShort3 == 7) {
readUnsignedShort3 = i11;
}
j6 = j10;
j7 = iArr[readUnsignedShort3] * readInt;
if (j7 < 0 || j7 > 2147483647L) {
if (z7) {
Log.d(str3, "Skip the tag entry since the number of components is invalid: " + readInt);
}
z6 = false;
if (!z6) {
}
fVar.j(j8);
s7 = (short) (s6 + 1);
str3 = str2;
hashSet4 = hashSet2;
readShort = s5;
} else {
z6 = true;
if (!z6) {
}
fVar.j(j8);
s7 = (short) (s6 + 1);
str3 = str2;
hashSet4 = hashSet2;
readShort = s5;
}
}
}
} else {
s6 = s7;
}
z5 = true;
if (z5) {
}
}
}
s5 = readShort;
s6 = s7;
j6 = j10;
if (z7) {
sb2 = new StringBuilder("Skip the tag entry since data format is invalid: ");
sb2.append(readUnsignedShort3);
Log.d(str3, sb2.toString());
}
j7 = 0;
z6 = false;
if (!z6) {
}
fVar.j(j8);
s7 = (short) (s6 + 1);
str3 = str2;
hashSet4 = hashSet2;
readShort = s5;
}
j6 = j10;
j7 = 0;
z6 = false;
if (!z6) {
}
fVar.j(j8);
s7 = (short) (s6 + 1);
str3 = str2;
hashSet4 = hashSet2;
readShort = s5;
}
HashSet hashSet5 = hashSet4;
String str5 = str3;
int readInt3 = fVar.readInt();
if (z7) {
Log.d(str5, String.format("nextIfdOffset: %d", Integer.valueOf(readInt3)));
}
long j11 = readInt3;
if (j11 > 0) {
if (!hashSet5.contains(Integer.valueOf(readInt3))) {
fVar.j(j11);
if (hashMapArr[4].isEmpty()) {
i7 = 4;
} else if (!hashMapArr[5].isEmpty()) {
return;
}
t(fVar, i7);
return;
} else 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(str5, sb.toString());
}
public final void u(int i6, String str, String str2) {
HashMap[] hashMapArr = this.f7526d;
if (hashMapArr[i6].isEmpty() || hashMapArr[i6].get(str) == null) {
return;
}
HashMap hashMap = hashMapArr[i6];
hashMap.put(str2, hashMap.get(str));
hashMapArr[i6].remove(str);
}
public final void v(b bVar) {
boolean z5;
String str;
String str2;
StringBuilder sb;
c cVar;
int f6;
HashMap hashMap = this.f7526d[4];
c cVar2 = (c) hashMap.get("Compression");
if (cVar2 != null) {
int f7 = cVar2.f(this.f7528f);
if (f7 != 1) {
if (f7 != 6) {
if (f7 != 7) {
return;
}
}
}
c cVar3 = (c) hashMap.get("BitsPerSample");
if (cVar3 != null) {
int[] iArr = (int[]) cVar3.h(this.f7528f);
int[] iArr2 = f7513o;
if (Arrays.equals(iArr2, iArr) || (this.f7525c == 3 && (cVar = (c) hashMap.get("PhotometricInterpretation")) != null && (((f6 = cVar.f(this.f7528f)) == 1 && Arrays.equals(iArr, f7514p)) || (f6 == 6 && Arrays.equals(iArr, iArr2))))) {
z5 = true;
if (!z5) {
c cVar4 = (c) hashMap.get("StripOffsets");
c cVar5 = (c) hashMap.get("StripByteCounts");
if (cVar4 != null && cVar5 != null) {
long[] r5 = e2.f.r(cVar4.h(this.f7528f));
long[] r6 = e2.f.r(cVar5.h(this.f7528f));
if (r5 != null && r5.length != 0) {
if (r6 != null && r6.length != 0) {
if (r5.length != r6.length) {
str = "stripOffsets and stripByteCounts should have same length.";
} else {
long j6 = 0;
for (long j7 : r6) {
j6 += j7;
}
byte[] bArr = new byte[(int) j6];
this.f7529g = true;
int i6 = 0;
int i7 = 0;
for (int i8 = 0; i8 < r5.length; i8++) {
int i9 = (int) r5[i8];
int i10 = (int) r6[i8];
if (i8 < r5.length - 1 && i9 + i10 != r5[i8 + 1]) {
this.f7529g = false;
}
int i11 = i9 - i6;
if (i11 < 0) {
str2 = "Invalid strip offset value";
} else {
long j8 = i11;
if (bVar.skip(j8) != j8) {
sb = new StringBuilder("Failed to skip ");
sb.append(i11);
} else {
int i12 = i6 + i11;
byte[] bArr2 = new byte[i10];
if (bVar.read(bArr2) != i10) {
sb = new StringBuilder("Failed to read ");
sb.append(i10);
} else {
i6 = i12 + i10;
System.arraycopy(bArr2, 0, bArr, i7, i10);
i7 += i10;
}
}
sb.append(" bytes.");
str2 = sb.toString();
}
Log.d("ExifInterface", str2);
return;
}
if (this.f7529g) {
long j9 = r5[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;
}
return;
}
}
if (f7510l) {
Log.d("ExifInterface", "Unsupported data type value");
}
z5 = false;
if (!z5) {
}
}
n(bVar, hashMap);
}
public final void w(int i6, int i7) {
String str;
HashMap[] hashMapArr = this.f7526d;
boolean isEmpty = hashMapArr[i6].isEmpty();
boolean z5 = f7510l;
if (isEmpty || hashMapArr[i7].isEmpty()) {
if (z5) {
Log.d("ExifInterface", "Cannot perform swap since only one image data exists");
return;
}
return;
}
c cVar = (c) hashMapArr[i6].get("ImageLength");
c cVar2 = (c) hashMapArr[i6].get("ImageWidth");
c cVar3 = (c) hashMapArr[i7].get("ImageLength");
c cVar4 = (c) hashMapArr[i7].get("ImageWidth");
if (cVar == null || cVar2 == null) {
if (!z5) {
return;
}
str = "First image does not contain valid size information";
} else if (cVar3 != null && cVar4 != null) {
int f6 = cVar.f(this.f7528f);
int f7 = cVar2.f(this.f7528f);
int f8 = cVar3.f(this.f7528f);
int f9 = cVar4.f(this.f7528f);
if (f6 >= f8 || f7 >= f9) {
return;
}
HashMap hashMap = hashMapArr[i6];
hashMapArr[i6] = hashMapArr[i7];
hashMapArr[i7] = hashMap;
return;
} else if (!z5) {
return;
} else {
str = "Second image does not contain valid size information";
}
Log.d("ExifInterface", str);
}
public final void x(f fVar, int i6) {
StringBuilder sb;
String arrays;
c d6;
c d7;
HashMap[] hashMapArr = this.f7526d;
c cVar = (c) hashMapArr[i6].get("DefaultCropSize");
c cVar2 = (c) hashMapArr[i6].get("SensorTopBorder");
c cVar3 = (c) hashMapArr[i6].get("SensorLeftBorder");
c cVar4 = (c) hashMapArr[i6].get("SensorBottomBorder");
c cVar5 = (c) hashMapArr[i6].get("SensorRightBorder");
if (cVar != null) {
if (cVar.a == 5) {
e[] eVarArr = (e[]) cVar.h(this.f7528f);
if (eVarArr != null && eVarArr.length == 2) {
d6 = c.c(eVarArr[0], this.f7528f);
d7 = c.c(eVarArr[1], this.f7528f);
hashMapArr[i6].put("ImageWidth", d6);
hashMapArr[i6].put("ImageLength", d7);
return;
}
sb = new StringBuilder("Invalid crop size values. cropSize=");
arrays = Arrays.toString(eVarArr);
sb.append(arrays);
Log.w("ExifInterface", sb.toString());
}
int[] iArr = (int[]) cVar.h(this.f7528f);
if (iArr != null && iArr.length == 2) {
d6 = c.d(iArr[0], this.f7528f);
d7 = c.d(iArr[1], this.f7528f);
hashMapArr[i6].put("ImageWidth", d6);
hashMapArr[i6].put("ImageLength", d7);
return;
}
sb = new StringBuilder("Invalid crop size values. cropSize=");
arrays = Arrays.toString(iArr);
sb.append(arrays);
Log.w("ExifInterface", sb.toString());
} else if (cVar2 != null && cVar3 != null && cVar4 != null && cVar5 != null) {
int f6 = cVar2.f(this.f7528f);
int f7 = cVar4.f(this.f7528f);
int f8 = cVar5.f(this.f7528f);
int f9 = cVar3.f(this.f7528f);
if (f7 > f6 && f8 > f9) {
c d8 = c.d(f7 - f6, this.f7528f);
c d9 = c.d(f8 - f9, this.f7528f);
hashMapArr[i6].put("ImageLength", d8);
hashMapArr[i6].put("ImageWidth", d9);
}
} else {
c cVar6 = (c) hashMapArr[i6].get("ImageLength");
c cVar7 = (c) hashMapArr[i6].get("ImageWidth");
if (cVar6 == null || cVar7 == null) {
c cVar8 = (c) hashMapArr[i6].get("JPEGInterchangeFormat");
c cVar9 = (c) hashMapArr[i6].get("JPEGInterchangeFormatLength");
if (cVar8 != null && cVar9 != null) {
int f10 = cVar8.f(this.f7528f);
int f11 = cVar8.f(this.f7528f);
fVar.j(f10);
byte[] bArr = new byte[f11];
fVar.read(bArr);
f(new b(bArr), f10, i6);
}
}
}
}
public final void y() {
w(0, 5);
w(0, 4);
w(5, 4);
HashMap[] hashMapArr = this.f7526d;
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() && o(hashMapArr[5])) {
hashMapArr[4] = hashMapArr[5];
hashMapArr[5] = new HashMap();
}
if (!o(hashMapArr[4])) {
Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image.");
}
u(0, "ThumbnailOrientation", "Orientation");
u(0, "ThumbnailImageLength", "ImageLength");
u(0, "ThumbnailImageWidth", "ImageWidth");
u(5, "ThumbnailOrientation", "Orientation");
u(5, "ThumbnailImageLength", "ImageLength");
u(5, "ThumbnailImageWidth", "ImageWidth");
u(4, "Orientation", "ThumbnailOrientation");
u(4, "ImageLength", "ThumbnailImageLength");
u(4, "ImageWidth", "ThumbnailImageWidth");
}
}