Brazzers Premium v2.1.5版本的 MD5 值为:822198ebc1561433ac78052c8b72a0ea
以下内容为反编译后的 g.java 源代码,内容仅作参考
package r0;
import android.content.res.AssetManager;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.system.Os;
import android.system.OsConstants;
import android.util.Log;
import androidx.core.view.InputDeviceCompat;
import com.davemorrissey.labs.subscaleview.BuildConfig;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
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.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
public class g {
public static final byte[] A;
public static final byte[] B;
public static final byte[] C;
public static final byte[] D;
public static final String[] E;
public static final int[] F;
public static final byte[] G;
public static final e H;
public static final e[][] I;
public static final e[] J;
public static final HashMap[] K;
public static final HashMap[] L;
public static final HashSet M;
public static final HashMap N;
public static final Charset O;
public static final byte[] P;
public static final byte[] Q;
public static final boolean f9060o = Log.isLoggable("ExifInterface", 3);
public static final int[] f9061p;
public static final int[] f9062q;
public static final byte[] f9063r;
public static final byte[] f9064s;
public static final byte[] f9065t;
public static final byte[] f9066u;
public static final byte[] f9067v;
public static final byte[] f9068w;
public static final byte[] f9069x;
public static final byte[] f9070y;
public static final byte[] f9071z;
public String f9072a;
public FileDescriptor f9073b;
public AssetManager.AssetInputStream f9074c;
public int f9075d;
public boolean f9076e;
public final HashMap[] f9077f;
public Set f9078g;
public ByteOrder f9079h;
public boolean f9080i;
public int f9081j;
public int f9082k;
public int f9083l;
public int f9084m;
public int f9085n;
static {
e[] eVarArr;
Arrays.asList(1, 6, 3, 8);
Arrays.asList(2, 7, 4, 5);
f9061p = new int[]{8, 8, 8};
f9062q = new int[]{8};
f9063r = new byte[]{-1, -40, -1};
f9064s = new byte[]{102, 116, 121, 112};
f9065t = new byte[]{109, 105, 102, 49};
f9066u = new byte[]{104, 101, 105, 99};
f9067v = new byte[]{79, 76, 89, 77, 80, 0};
f9068w = new byte[]{79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
f9069x = new byte[]{-119, 80, 78, 71, 13, 10, 26, 10};
f9070y = new byte[]{101, 88, 73, 102};
f9071z = new byte[]{73, 72, 68, 82};
A = new byte[]{73, 69, 78, 68};
B = new byte[]{82, 73, 70, 70};
C = new byte[]{87, 69, 66, 80};
D = 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());
E = new String[]{BuildConfig.FLAVOR, "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
F = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
G = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
e[] eVarArr2 = {new e("NewSubfileType", 254, 4), new e("SubfileType", 255, 4), new e("ImageWidth", 256, 3, 4), new e("ImageLength", InputDeviceCompat.SOURCE_KEYBOARD, 3, 4), new e("BitsPerSample", 258, 3), new e("Compression", 259, 3), new e("PhotometricInterpretation", 262, 3), new e("ImageDescription", SubsamplingScaleImageView.ORIENTATION_270, 2), new e("Make", 271, 2), new e("Model", 272, 2), new e("StripOffsets", 273, 3, 4), new e("Orientation", 274, 3), new e("SamplesPerPixel", 277, 3), new e("RowsPerStrip", 278, 3, 4), new e("StripByteCounts", 279, 3, 4), new e("XResolution", 282, 5), new e("YResolution", 283, 5), new e("PlanarConfiguration", 284, 3), new e("ResolutionUnit", 296, 3), new e("TransferFunction", 301, 3), new e("Software", 305, 2), new e("DateTime", 306, 2), new e("Artist", 315, 2), new e("WhitePoint", 318, 5), new e("PrimaryChromaticities", 319, 5), new e("SubIFDPointer", 330, 4), new e("JPEGInterchangeFormat", InputDeviceCompat.SOURCE_DPAD, 4), new e("JPEGInterchangeFormatLength", 514, 4), new e("YCbCrCoefficients", 529, 5), new e("YCbCrSubSampling", 530, 3), new e("YCbCrPositioning", 531, 3), new e("ReferenceBlackWhite", 532, 5), new e("Copyright", 33432, 2), new e("ExifIFDPointer", 34665, 4), new e("GPSInfoIFDPointer", 34853, 4), new e("SensorTopBorder", 4, 4), new e("SensorLeftBorder", 5, 4), new e("SensorBottomBorder", 6, 4), new e("SensorRightBorder", 7, 4), new e("ISO", 23, 3), new e("JpgFromRaw", 46, 7), new e("Xmp", 700, 1)};
e[] eVarArr3 = {new e("ExposureTime", 33434, 5), new e("FNumber", 33437, 5), new e("ExposureProgram", 34850, 3), new e("SpectralSensitivity", 34852, 2), new e("PhotographicSensitivity", 34855, 3), new e("OECF", 34856, 7), new e("SensitivityType", 34864, 3), new e("StandardOutputSensitivity", 34865, 4), new e("RecommendedExposureIndex", 34866, 4), new e("ISOSpeed", 34867, 4), new e("ISOSpeedLatitudeyyy", 34868, 4), new e("ISOSpeedLatitudezzz", 34869, 4), new e("ExifVersion", 36864, 2), new e("DateTimeOriginal", 36867, 2), new e("DateTimeDigitized", 36868, 2), new e("OffsetTime", 36880, 2), new e("OffsetTimeOriginal", 36881, 2), new e("OffsetTimeDigitized", 36882, 2), new e("ComponentsConfiguration", 37121, 7), new e("CompressedBitsPerPixel", 37122, 5), new e("ShutterSpeedValue", 37377, 10), new e("ApertureValue", 37378, 5), new e("BrightnessValue", 37379, 10), new e("ExposureBiasValue", 37380, 10), new e("MaxApertureValue", 37381, 5), new e("SubjectDistance", 37382, 5), new e("MeteringMode", 37383, 3), new e("LightSource", 37384, 3), new e("Flash", 37385, 3), new e("FocalLength", 37386, 5), new e("SubjectArea", 37396, 3), new e("MakerNote", 37500, 7), new e("UserComment", 37510, 7), new e("SubSecTime", 37520, 2), new e("SubSecTimeOriginal", 37521, 2), new e("SubSecTimeDigitized", 37522, 2), new e("FlashpixVersion", 40960, 7), new e("ColorSpace", 40961, 3), new e("PixelXDimension", 40962, 3, 4), new e("PixelYDimension", 40963, 3, 4), new e("RelatedSoundFile", 40964, 2), new e("InteroperabilityIFDPointer", 40965, 4), new e("FlashEnergy", 41483, 5), new e("SpatialFrequencyResponse", 41484, 7), new e("FocalPlaneXResolution", 41486, 5), new e("FocalPlaneYResolution", 41487, 5), new e("FocalPlaneResolutionUnit", 41488, 3), new e("SubjectLocation", 41492, 3), new e("ExposureIndex", 41493, 5), new e("SensingMethod", 41495, 3), new e("FileSource", 41728, 7), new e("SceneType", 41729, 7), new e("CFAPattern", 41730, 7), new e("CustomRendered", 41985, 3), new e("ExposureMode", 41986, 3), new e("WhiteBalance", 41987, 3), new e("DigitalZoomRatio", 41988, 5), new e("FocalLengthIn35mmFilm", 41989, 3), new e("SceneCaptureType", 41990, 3), new e("GainControl", 41991, 3), new e("Contrast", 41992, 3), new e("Saturation", 41993, 3), new e("Sharpness", 41994, 3), new e("DeviceSettingDescription", 41995, 7), new e("SubjectDistanceRange", 41996, 3), new e("ImageUniqueID", 42016, 2), new e("CameraOwnerName", 42032, 2), new e("BodySerialNumber", 42033, 2), new e("LensSpecification", 42034, 5), new e("LensMake", 42035, 2), new e("LensModel", 42036, 2), new e("Gamma", 42240, 5), new e("DNGVersion", 50706, 1), new e("DefaultCropSize", 50720, 3, 4)};
e[] eVarArr4 = {new e("GPSVersionID", 0, 1), new e("GPSLatitudeRef", 1, 2), new e("GPSLatitude", 2, 5), new e("GPSLongitudeRef", 3, 2), new e("GPSLongitude", 4, 5), new e("GPSAltitudeRef", 5, 1), new e("GPSAltitude", 6, 5), new e("GPSTimeStamp", 7, 5), new e("GPSSatellites", 8, 2), new e("GPSStatus", 9, 2), new e("GPSMeasureMode", 10, 2), new e("GPSDOP", 11, 5), new e("GPSSpeedRef", 12, 2), new e("GPSSpeed", 13, 5), new e("GPSTrackRef", 14, 2), new e("GPSTrack", 15, 5), new e("GPSImgDirectionRef", 16, 2), new e("GPSImgDirection", 17, 5), new e("GPSMapDatum", 18, 2), new e("GPSDestLatitudeRef", 19, 2), new e("GPSDestLatitude", 20, 5), new e("GPSDestLongitudeRef", 21, 2), new e("GPSDestLongitude", 22, 5), new e("GPSDestBearingRef", 23, 2), new e("GPSDestBearing", 24, 5), new e("GPSDestDistanceRef", 25, 2), new e("GPSDestDistance", 26, 5), new e("GPSProcessingMethod", 27, 7), new e("GPSAreaInformation", 28, 7), new e("GPSDateStamp", 29, 2), new e("GPSDifferential", 30, 3), new e("GPSHPositioningError", 31, 5)};
e[] eVarArr5 = {new e("InteroperabilityIndex", 1, 2)};
e[] eVarArr6 = {new e("NewSubfileType", 254, 4), new e("SubfileType", 255, 4), new e("ThumbnailImageWidth", 256, 3, 4), new e("ThumbnailImageLength", InputDeviceCompat.SOURCE_KEYBOARD, 3, 4), new e("BitsPerSample", 258, 3), new e("Compression", 259, 3), new e("PhotometricInterpretation", 262, 3), new e("ImageDescription", SubsamplingScaleImageView.ORIENTATION_270, 2), new e("Make", 271, 2), new e("Model", 272, 2), new e("StripOffsets", 273, 3, 4), new e("ThumbnailOrientation", 274, 3), new e("SamplesPerPixel", 277, 3), new e("RowsPerStrip", 278, 3, 4), new e("StripByteCounts", 279, 3, 4), new e("XResolution", 282, 5), new e("YResolution", 283, 5), new e("PlanarConfiguration", 284, 3), new e("ResolutionUnit", 296, 3), new e("TransferFunction", 301, 3), new e("Software", 305, 2), new e("DateTime", 306, 2), new e("Artist", 315, 2), new e("WhitePoint", 318, 5), new e("PrimaryChromaticities", 319, 5), new e("SubIFDPointer", 330, 4), new e("JPEGInterchangeFormat", InputDeviceCompat.SOURCE_DPAD, 4), new e("JPEGInterchangeFormatLength", 514, 4), new e("YCbCrCoefficients", 529, 5), new e("YCbCrSubSampling", 530, 3), new e("YCbCrPositioning", 531, 3), new e("ReferenceBlackWhite", 532, 5), new e("Copyright", 33432, 2), new e("ExifIFDPointer", 34665, 4), new e("GPSInfoIFDPointer", 34853, 4), new e("DNGVersion", 50706, 1), new e("DefaultCropSize", 50720, 3, 4)};
H = new e("StripOffsets", 273, 3);
I = new e[][]{eVarArr2, eVarArr3, eVarArr4, eVarArr5, eVarArr6, eVarArr2, new e[]{new e("ThumbnailImage", 256, 7), new e("CameraSettingsIFDPointer", 8224, 4), new e("ImageProcessingIFDPointer", 8256, 4)}, new e[]{new e("PreviewImageStart", InputDeviceCompat.SOURCE_KEYBOARD, 4), new e("PreviewImageLength", 258, 4)}, new e[]{new e("AspectFrame", 4371, 3)}, new e[]{new e("ColorSpace", 55, 3)}};
J = new e[]{new e("SubIFDPointer", 330, 4), new e("ExifIFDPointer", 34665, 4), new e("GPSInfoIFDPointer", 34853, 4), new e("InteroperabilityIFDPointer", 40965, 4), new e("CameraSettingsIFDPointer", 8224, 1), new e("ImageProcessingIFDPointer", 8256, 1)};
K = new HashMap[10];
L = new HashMap[10];
M = new HashSet(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
N = new HashMap();
Charset forName = Charset.forName("US-ASCII");
O = forName;
P = "Exif\u0000\u0000".getBytes(forName);
Q = "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) {
e[][] eVarArr7 = I;
if (i10 >= eVarArr7.length) {
HashMap hashMap = N;
e[] eVarArr8 = J;
hashMap.put(Integer.valueOf(eVarArr8[0].f9054a), 5);
hashMap.put(Integer.valueOf(eVarArr8[1].f9054a), 1);
hashMap.put(Integer.valueOf(eVarArr8[2].f9054a), 2);
hashMap.put(Integer.valueOf(eVarArr8[3].f9054a), 3);
hashMap.put(Integer.valueOf(eVarArr8[4].f9054a), 7);
hashMap.put(Integer.valueOf(eVarArr8[5].f9054a), 8);
Pattern.compile(".*[1-9].*");
Pattern.compile("^([0-9][0-9]):([0-9][0-9]):([0-9][0-9])$");
return;
}
K[i10] = new HashMap();
L[i10] = new HashMap();
for (e eVar : eVarArr7[i10]) {
K[i10].put(Integer.valueOf(eVar.f9054a), eVar);
L[i10].put(eVar.f9055b, eVar);
}
i10++;
}
}
public g(InputStream inputStream) {
e[][] eVarArr = I;
this.f9077f = new HashMap[eVarArr.length];
this.f9078g = new HashSet(eVarArr.length);
this.f9079h = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(inputStream, "inputStream cannot be null");
this.f9072a = null;
if (inputStream instanceof AssetManager.AssetInputStream) {
this.f9074c = (AssetManager.AssetInputStream) inputStream;
this.f9073b = null;
} else {
if (inputStream instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream) inputStream;
if (r(fileInputStream.getFD())) {
this.f9074c = null;
this.f9073b = fileInputStream.getFD();
}
}
this.f9074c = null;
this.f9073b = null;
}
t(inputStream);
}
public g(String str) {
e[][] eVarArr = I;
this.f9077f = new HashMap[eVarArr.length];
this.f9078g = new HashSet(eVarArr.length);
this.f9079h = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(str, "filename cannot be null");
FileInputStream fileInputStream = null;
this.f9074c = null;
this.f9072a = str;
try {
FileInputStream fileInputStream2 = new FileInputStream(str);
try {
if (r(fileInputStream2.getFD())) {
this.f9073b = fileInputStream2.getFD();
} else {
this.f9073b = null;
}
t(fileInputStream2);
try {
fileInputStream2.close();
} catch (RuntimeException e10) {
throw e10;
} catch (Exception unused) {
}
} catch (Throwable th) {
th = th;
fileInputStream = fileInputStream2;
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (RuntimeException e11) {
throw e11;
} catch (Exception unused2) {
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
public static boolean A(byte[] bArr, byte[] bArr2) {
if (bArr2 != null && bArr.length >= bArr2.length) {
for (int i10 = 0; i10 < bArr2.length; i10++) {
if (bArr[i10] != bArr2[i10]) {
return false;
}
}
return true;
}
return false;
}
public static String b(byte[] bArr) {
StringBuilder sb2 = new StringBuilder(bArr.length * 2);
for (int i10 = 0; i10 < bArr.length; i10++) {
sb2.append(String.format("%02x", Byte.valueOf(bArr[i10])));
}
return sb2.toString();
}
public static long[] c(Object obj) {
if (!(obj instanceof int[])) {
if (obj instanceof long[]) {
return (long[]) obj;
}
return null;
}
int[] iArr = (int[]) obj;
long[] jArr = new long[iArr.length];
for (int i10 = 0; i10 < iArr.length; i10++) {
jArr[i10] = iArr[i10];
}
return jArr;
}
public static boolean r(FileDescriptor fileDescriptor) {
if (Build.VERSION.SDK_INT >= 21) {
try {
Os.lseek(fileDescriptor, 0L, OsConstants.SEEK_CUR);
return true;
} catch (Exception unused) {
if (f9060o) {
Log.d("ExifInterface", "The file descriptor for the given input is not seekable");
}
}
}
return false;
}
public final void B(int i10, int i11) {
if (this.f9077f[i10].isEmpty() || this.f9077f[i11].isEmpty()) {
if (f9060o) {
Log.d("ExifInterface", "Cannot perform swap since only one image data exists");
return;
}
return;
}
d dVar = (d) this.f9077f[i10].get("ImageLength");
d dVar2 = (d) this.f9077f[i10].get("ImageWidth");
d dVar3 = (d) this.f9077f[i11].get("ImageLength");
d dVar4 = (d) this.f9077f[i11].get("ImageWidth");
if (dVar == null || dVar2 == null) {
if (f9060o) {
Log.d("ExifInterface", "First image does not contain valid size information");
}
} else if (dVar3 == null || dVar4 == null) {
if (f9060o) {
Log.d("ExifInterface", "Second image does not contain valid size information");
}
} else {
int f10 = dVar.f(this.f9079h);
int f11 = dVar2.f(this.f9079h);
int f12 = dVar3.f(this.f9079h);
int f13 = dVar4.f(this.f9079h);
if (f10 >= f12 || f11 >= f13) {
return;
}
HashMap[] hashMapArr = this.f9077f;
HashMap hashMap = hashMapArr[i10];
hashMapArr[i10] = hashMapArr[i11];
hashMapArr[i11] = hashMap;
}
}
public final void C(c cVar, int i10) {
d dVar;
d d10;
d d11;
d dVar2 = (d) this.f9077f[i10].get("DefaultCropSize");
d dVar3 = (d) this.f9077f[i10].get("SensorTopBorder");
d dVar4 = (d) this.f9077f[i10].get("SensorLeftBorder");
d dVar5 = (d) this.f9077f[i10].get("SensorBottomBorder");
d dVar6 = (d) this.f9077f[i10].get("SensorRightBorder");
if (dVar2 != null) {
if (dVar2.f9051a == 5) {
f[] fVarArr = (f[]) dVar2.h(this.f9079h);
if (fVarArr == null || fVarArr.length != 2) {
StringBuilder a10 = android.support.v4.media.b.a("Invalid crop size values. cropSize=");
a10.append(Arrays.toString(fVarArr));
Log.w("ExifInterface", a10.toString());
return;
}
d10 = d.c(fVarArr[0], this.f9079h);
d11 = d.c(fVarArr[1], this.f9079h);
} else {
int[] iArr = (int[]) dVar2.h(this.f9079h);
if (iArr == null || iArr.length != 2) {
StringBuilder a11 = android.support.v4.media.b.a("Invalid crop size values. cropSize=");
a11.append(Arrays.toString(iArr));
Log.w("ExifInterface", a11.toString());
return;
}
d10 = d.d(iArr[0], this.f9079h);
d11 = d.d(iArr[1], this.f9079h);
}
this.f9077f[i10].put("ImageWidth", d10);
this.f9077f[i10].put("ImageLength", d11);
} else if (dVar3 == null || dVar4 == null || dVar5 == null || dVar6 == null) {
d dVar7 = (d) this.f9077f[i10].get("ImageLength");
d dVar8 = (d) this.f9077f[i10].get("ImageWidth");
if ((dVar7 == null || dVar8 == null) && (dVar = (d) this.f9077f[i10].get("JPEGInterchangeFormat")) != null) {
h(cVar, dVar.f(this.f9079h), i10);
}
} else {
int f10 = dVar3.f(this.f9079h);
int f11 = dVar5.f(this.f9079h);
int f12 = dVar6.f(this.f9079h);
int f13 = dVar4.f(this.f9079h);
if (f11 <= f10 || f12 <= f13) {
return;
}
d d12 = d.d(f11 - f10, this.f9079h);
d d13 = d.d(f12 - f13, this.f9079h);
this.f9077f[i10].put("ImageLength", d12);
this.f9077f[i10].put("ImageWidth", d13);
}
}
public final void D() {
B(0, 5);
B(0, 4);
B(5, 4);
d dVar = (d) this.f9077f[1].get("PixelXDimension");
d dVar2 = (d) this.f9077f[1].get("PixelYDimension");
if (dVar != null && dVar2 != null) {
this.f9077f[0].put("ImageWidth", dVar);
this.f9077f[0].put("ImageLength", dVar2);
}
if (this.f9077f[4].isEmpty() && s(this.f9077f[5])) {
HashMap[] hashMapArr = this.f9077f;
hashMapArr[4] = hashMapArr[5];
hashMapArr[5] = new HashMap();
}
if (s(this.f9077f[4])) {
return;
}
Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image.");
}
public final void a() {
String d10 = d("DateTimeOriginal");
if (d10 != null && d("DateTime") == null) {
this.f9077f[0].put("DateTime", d.a(d10));
}
if (d("ImageWidth") == null) {
this.f9077f[0].put("ImageWidth", d.b(0L, this.f9079h));
}
if (d("ImageLength") == null) {
this.f9077f[0].put("ImageLength", d.b(0L, this.f9079h));
}
if (d("Orientation") == null) {
this.f9077f[0].put("Orientation", d.b(0L, this.f9079h));
}
if (d("LightSource") == null) {
this.f9077f[1].put("LightSource", d.b(0L, this.f9079h));
}
}
public String d(String str) {
d f10 = f(str);
if (f10 != null) {
if (!M.contains(str)) {
return f10.g(this.f9079h);
}
if (str.equals("GPSTimeStamp")) {
int i10 = f10.f9051a;
if (i10 != 5 && i10 != 10) {
StringBuilder a10 = android.support.v4.media.b.a("GPS Timestamp format is not rational. format=");
a10.append(f10.f9051a);
Log.w("ExifInterface", a10.toString());
return null;
}
f[] fVarArr = (f[]) f10.h(this.f9079h);
if (fVarArr == null || fVarArr.length != 3) {
StringBuilder a11 = android.support.v4.media.b.a("Invalid GPS Timestamp array. array=");
a11.append(Arrays.toString(fVarArr));
Log.w("ExifInterface", a11.toString());
return null;
}
return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) fVarArr[0].f9058a) / ((float) fVarArr[0].f9059b))), Integer.valueOf((int) (((float) fVarArr[1].f9058a) / ((float) fVarArr[1].f9059b))), Integer.valueOf((int) (((float) fVarArr[2].f9058a) / ((float) fVarArr[2].f9059b))));
}
try {
return Double.toString(f10.e(this.f9079h));
} catch (NumberFormatException unused) {
}
}
return null;
}
public int e(String str, int i10) {
d f10 = f(str);
if (f10 == null) {
return i10;
}
try {
return f10.f(this.f9079h);
} catch (NumberFormatException unused) {
return i10;
}
}
public final d f(String str) {
if ("ISOSpeedRatings".equals(str)) {
if (f9060o) {
Log.d("ExifInterface", "getExifAttribute: Replacing TAG_ISO_SPEED_RATINGS with TAG_PHOTOGRAPHIC_SENSITIVITY.");
}
str = "PhotographicSensitivity";
}
for (int i10 = 0; i10 < I.length; i10++) {
d dVar = (d) this.f9077f[i10].get(str);
if (dVar != null) {
return dVar;
}
}
return null;
}
public final void g(c cVar) {
String str;
String str2;
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
try {
if (Build.VERSION.SDK_INT >= 23) {
mediaMetadataRetriever.setDataSource(new b(this, cVar));
} else {
FileDescriptor fileDescriptor = this.f9073b;
if (fileDescriptor != null) {
mediaMetadataRetriever.setDataSource(fileDescriptor);
} else {
String str3 = this.f9072a;
if (str3 == null) {
return;
}
mediaMetadataRetriever.setDataSource(str3);
}
}
String extractMetadata = mediaMetadataRetriever.extractMetadata(33);
String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34);
String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26);
String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17);
String str4 = null;
if ("yes".equals(extractMetadata3)) {
str4 = mediaMetadataRetriever.extractMetadata(29);
str = mediaMetadataRetriever.extractMetadata(30);
str2 = mediaMetadataRetriever.extractMetadata(31);
} else if ("yes".equals(extractMetadata4)) {
str4 = mediaMetadataRetriever.extractMetadata(18);
str = mediaMetadataRetriever.extractMetadata(19);
str2 = mediaMetadataRetriever.extractMetadata(24);
} else {
str = null;
str2 = null;
}
if (str4 != null) {
this.f9077f[0].put("ImageWidth", d.d(Integer.parseInt(str4), this.f9079h));
}
if (str != null) {
this.f9077f[0].put("ImageLength", d.d(Integer.parseInt(str), this.f9079h));
}
if (str2 != null) {
int i10 = 1;
int parseInt = Integer.parseInt(str2);
if (parseInt == 90) {
i10 = 6;
} else if (parseInt == 180) {
i10 = 3;
} else if (parseInt == 270) {
i10 = 8;
}
this.f9077f[0].put("Orientation", d.d(i10, this.f9079h));
}
if (extractMetadata != null && extractMetadata2 != null) {
int parseInt2 = Integer.parseInt(extractMetadata);
int parseInt3 = Integer.parseInt(extractMetadata2);
if (parseInt3 <= 6) {
throw new IOException("Invalid exif length");
}
cVar.l(parseInt2);
byte[] bArr = new byte[6];
if (cVar.read(bArr) != 6) {
throw new IOException("Can't read identifier");
}
int i11 = parseInt2 + 6;
int i12 = parseInt3 - 6;
if (!Arrays.equals(bArr, P)) {
throw new IOException("Invalid identifier");
}
byte[] bArr2 = new byte[i12];
if (cVar.read(bArr2) != i12) {
throw new IOException("Can't read exif");
}
this.f9081j = i11;
x(bArr2, 0);
}
if (f9060o) {
Log.d("ExifInterface", "Heif meta: " + str4 + "x" + str + ", rotation " + str2);
}
} finally {
mediaMetadataRetriever.release();
}
}
public final void h(c cVar, int i10, int i11) {
if (f9060o) {
Log.d("ExifInterface", "getJpegAttributes starting with: " + cVar);
}
cVar.A = ByteOrder.BIG_ENDIAN;
cVar.l(i10);
byte readByte = cVar.readByte();
byte b10 = -1;
if (readByte != -1) {
StringBuilder a10 = android.support.v4.media.b.a("Invalid marker: ");
a10.append(Integer.toHexString(readByte & 255));
throw new IOException(a10.toString());
}
int i12 = 1;
int i13 = i10 + 1;
if (cVar.readByte() != -40) {
StringBuilder a11 = android.support.v4.media.b.a("Invalid marker: ");
a11.append(Integer.toHexString(readByte & 255));
throw new IOException(a11.toString());
}
int i14 = i13 + 1;
while (true) {
byte readByte2 = cVar.readByte();
if (readByte2 != b10) {
StringBuilder a12 = android.support.v4.media.b.a("Invalid marker:");
a12.append(Integer.toHexString(readByte2 & 255));
throw new IOException(a12.toString());
}
int i15 = i14 + i12;
byte readByte3 = cVar.readByte();
boolean z10 = f9060o;
if (z10) {
StringBuilder a13 = android.support.v4.media.b.a("Found JPEG segment indicator: ");
a13.append(Integer.toHexString(readByte3 & 255));
Log.d("ExifInterface", a13.toString());
}
int i16 = i15 + i12;
if (readByte3 != -39 && readByte3 != -38) {
int readUnsignedShort = cVar.readUnsignedShort() - 2;
int i17 = i16 + 2;
if (z10) {
StringBuilder a14 = android.support.v4.media.b.a("JPEG segment: ");
a14.append(Integer.toHexString(readByte3 & 255));
a14.append(" (length: ");
a14.append(readUnsignedShort + 2);
a14.append(")");
Log.d("ExifInterface", a14.toString());
}
if (readUnsignedShort < 0) {
throw new IOException("Invalid length");
}
if (readByte3 == -31) {
byte[] bArr = new byte[readUnsignedShort];
cVar.readFully(bArr);
int i18 = i17 + readUnsignedShort;
byte[] bArr2 = P;
if (A(bArr, bArr2)) {
byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort);
this.f9081j = i17 + bArr2.length;
x(copyOfRange, i11);
} else {
byte[] bArr3 = Q;
if (A(bArr, bArr3)) {
int length = i17 + bArr3.length;
byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort);
if (d("Xmp") == null) {
this.f9077f[0].put("Xmp", new d(1, copyOfRange2.length, length, copyOfRange2));
}
}
}
i17 = i18;
} else if (readByte3 != -2) {
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
}
case -55:
case -54:
case -53:
if (cVar.skipBytes(i12) != i12) {
throw new IOException("Invalid SOFx");
}
this.f9077f[i11].put("ImageLength", d.b(cVar.readUnsignedShort(), this.f9079h));
this.f9077f[i11].put("ImageWidth", d.b(cVar.readUnsignedShort(), this.f9079h));
readUnsignedShort -= 5;
break;
}
case -59:
case -58:
case -57:
break;
}
case -64:
case -63:
case -62:
case -61:
break;
}
if (readUnsignedShort >= 0) {
throw new IOException("Invalid length");
}
if (cVar.skipBytes(readUnsignedShort) != readUnsignedShort) {
throw new IOException("Invalid JPEG segment");
}
i14 = i17 + readUnsignedShort;
b10 = -1;
i12 = 1;
} else {
byte[] bArr4 = new byte[readUnsignedShort];
if (cVar.read(bArr4) != readUnsignedShort) {
throw new IOException("Invalid exif");
}
if (d("UserComment") == null) {
this.f9077f[i12].put("UserComment", d.a(new String(bArr4, O)));
}
}
readUnsignedShort = 0;
if (readUnsignedShort >= 0) {
}
}
}
}
public final int i(BufferedInputStream bufferedInputStream) {
boolean z10;
boolean z11;
c cVar;
c cVar2;
boolean z12;
c cVar3;
c cVar4;
boolean z13;
c cVar5;
c cVar6;
boolean z14;
boolean z15;
boolean z16;
bufferedInputStream.mark(5000);
byte[] bArr = new byte[5000];
bufferedInputStream.read(bArr);
bufferedInputStream.reset();
int i10 = 0;
while (true) {
byte[] bArr2 = f9063r;
if (i10 >= bArr2.length) {
z10 = true;
break;
} else if (bArr[i10] != bArr2[i10]) {
z10 = false;
break;
} else {
i10++;
}
}
if (z10) {
return 4;
}
byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
int i11 = 0;
while (true) {
if (i11 >= bytes.length) {
z11 = true;
break;
} else if (bArr[i11] != bytes[i11]) {
z11 = false;
break;
} else {
i11++;
}
}
if (z11) {
return 9;
}
try {
cVar2 = new c(bArr);
try {
long readInt = cVar2.readInt();
byte[] bArr3 = new byte[4];
cVar2.read(bArr3);
if (Arrays.equals(bArr3, f9064s)) {
long j10 = 16;
if (readInt == 1) {
readInt = cVar2.readLong();
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 z17 = false;
boolean z18 = false;
for (long j13 = 0; j13 < j12 / 4 && cVar2.read(bArr4) == 4; j13++) {
if (j13 != 1) {
if (Arrays.equals(bArr4, f9065t)) {
z17 = true;
} else if (Arrays.equals(bArr4, f9066u)) {
z18 = true;
}
if (z17 && z18) {
cVar2.close();
z12 = true;
break;
}
}
}
}
}
} catch (Exception e10) {
e = e10;
try {
if (f9060o) {
Log.d("ExifInterface", "Exception parsing HEIF file type box.", e);
}
} catch (Throwable th) {
th = th;
cVar = cVar2;
cVar2 = cVar;
if (cVar2 != null) {
cVar2.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
if (cVar2 != null) {
}
throw th;
}
} catch (Exception e11) {
e = e11;
cVar2 = null;
} catch (Throwable th3) {
th = th3;
cVar = null;
cVar2 = cVar;
if (cVar2 != null) {
}
throw th;
}
cVar2.close();
z12 = false;
if (z12) {
return 12;
}
try {
cVar4 = new c(bArr);
try {
ByteOrder w10 = w(cVar4);
this.f9079h = w10;
cVar4.A = w10;
short readShort = cVar4.readShort();
z13 = readShort == 20306 || readShort == 21330;
cVar4.close();
} catch (Exception unused) {
if (cVar4 != null) {
cVar4.close();
}
z13 = false;
if (z13) {
}
} catch (Throwable th4) {
th = th4;
cVar3 = cVar4;
if (cVar3 != null) {
cVar3.close();
}
throw th;
}
} catch (Exception unused2) {
cVar4 = null;
} catch (Throwable th5) {
th = th5;
cVar3 = null;
}
if (z13) {
try {
c cVar7 = new c(bArr);
try {
ByteOrder w11 = w(cVar7);
this.f9079h = w11;
cVar7.A = w11;
z14 = cVar7.readShort() == 85;
cVar7.close();
} catch (Exception unused3) {
cVar6 = cVar7;
if (cVar6 != null) {
cVar6.close();
}
z14 = false;
if (z14) {
}
} catch (Throwable th6) {
th = th6;
cVar5 = cVar7;
if (cVar5 != null) {
cVar5.close();
}
throw th;
}
} catch (Exception unused4) {
cVar6 = null;
} catch (Throwable th7) {
th = th7;
cVar5 = null;
}
if (z14) {
int i12 = 0;
while (true) {
byte[] bArr5 = f9069x;
if (i12 >= bArr5.length) {
z15 = true;
break;
} else if (bArr[i12] != bArr5[i12]) {
z15 = false;
break;
} else {
i12++;
}
}
if (z15) {
return 13;
}
int i13 = 0;
while (true) {
byte[] bArr6 = B;
if (i13 >= bArr6.length) {
int i14 = 0;
while (true) {
byte[] bArr7 = C;
if (i14 >= bArr7.length) {
z16 = true;
break;
} else if (bArr[B.length + i14 + 4] != bArr7[i14]) {
break;
} else {
i14++;
}
}
} else if (bArr[i13] != bArr6[i13]) {
break;
} else {
i13++;
}
}
z16 = false;
return z16 ? 14 : 0;
}
return 10;
}
return 7;
}
public final void j(c cVar) {
m(cVar);
d dVar = (d) this.f9077f[1].get("MakerNote");
if (dVar != null) {
c cVar2 = new c(dVar.f9053c);
cVar2.A = this.f9079h;
byte[] bArr = f9067v;
byte[] bArr2 = new byte[bArr.length];
cVar2.readFully(bArr2);
cVar2.l(0L);
byte[] bArr3 = f9068w;
byte[] bArr4 = new byte[bArr3.length];
cVar2.readFully(bArr4);
if (Arrays.equals(bArr2, bArr)) {
cVar2.l(8L);
} else if (Arrays.equals(bArr4, bArr3)) {
cVar2.l(12L);
}
y(cVar2, 6);
d dVar2 = (d) this.f9077f[7].get("PreviewImageStart");
d dVar3 = (d) this.f9077f[7].get("PreviewImageLength");
if (dVar2 != null && dVar3 != null) {
this.f9077f[5].put("JPEGInterchangeFormat", dVar2);
this.f9077f[5].put("JPEGInterchangeFormatLength", dVar3);
}
d dVar4 = (d) this.f9077f[8].get("AspectFrame");
if (dVar4 != null) {
int[] iArr = (int[]) dVar4.h(this.f9079h);
if (iArr == null || iArr.length != 4) {
StringBuilder a10 = android.support.v4.media.b.a("Invalid aspect frame values. frame=");
a10.append(Arrays.toString(iArr));
Log.w("ExifInterface", a10.toString());
} else if (iArr[2] <= iArr[0] || iArr[3] <= iArr[1]) {
} else {
int i10 = (iArr[2] - iArr[0]) + 1;
int i11 = (iArr[3] - iArr[1]) + 1;
if (i10 < i11) {
int i12 = i10 + i11;
i11 = i12 - i11;
i10 = i12 - i11;
}
d d10 = d.d(i10, this.f9079h);
d d11 = d.d(i11, this.f9079h);
this.f9077f[0].put("ImageWidth", d10);
this.f9077f[0].put("ImageLength", d11);
}
}
}
}
public final void k(c cVar) {
if (f9060o) {
Log.d("ExifInterface", "getPngAttributes starting with: " + cVar);
}
cVar.A = ByteOrder.BIG_ENDIAN;
byte[] bArr = f9069x;
cVar.skipBytes(bArr.length);
int length = bArr.length + 0;
while (true) {
try {
int readInt = cVar.readInt();
int i10 = length + 4;
byte[] bArr2 = new byte[4];
if (cVar.read(bArr2) != 4) {
throw new IOException("Encountered invalid length while parsing PNG chunktype");
}
int i11 = i10 + 4;
if (i11 == 16 && !Arrays.equals(bArr2, f9071z)) {
throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
}
if (Arrays.equals(bArr2, A)) {
return;
}
if (Arrays.equals(bArr2, f9070y)) {
byte[] bArr3 = new byte[readInt];
if (cVar.read(bArr3) != readInt) {
throw new IOException("Failed to read given length for given PNG chunk type: " + b(bArr2));
}
int readInt2 = cVar.readInt();
CRC32 crc32 = new CRC32();
crc32.update(bArr2);
crc32.update(bArr3);
if (((int) crc32.getValue()) == readInt2) {
this.f9081j = i11;
x(bArr3, 0);
D();
return;
}
throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + readInt2 + ", calculated CRC value: " + crc32.getValue());
}
int i12 = readInt + 4;
cVar.skipBytes(i12);
length = i11 + i12;
} catch (EOFException unused) {
throw new IOException("Encountered corrupt PNG file.");
}
}
}
public final void l(c cVar) {
cVar.skipBytes(84);
byte[] bArr = new byte[4];
byte[] bArr2 = new byte[4];
cVar.read(bArr);
cVar.skipBytes(4);
cVar.read(bArr2);
int i10 = ByteBuffer.wrap(bArr).getInt();
int i11 = ByteBuffer.wrap(bArr2).getInt();
h(cVar, i10, 5);
cVar.l(i11);
cVar.A = ByteOrder.BIG_ENDIAN;
int readInt = cVar.readInt();
if (f9060o) {
a.a("numberOfDirectoryEntry: ", readInt, "ExifInterface");
}
for (int i12 = 0; i12 < readInt; i12++) {
int readUnsignedShort = cVar.readUnsignedShort();
int readUnsignedShort2 = cVar.readUnsignedShort();
if (readUnsignedShort == H.f9054a) {
short readShort = cVar.readShort();
short readShort2 = cVar.readShort();
d d10 = d.d(readShort, this.f9079h);
d d11 = d.d(readShort2, this.f9079h);
this.f9077f[0].put("ImageLength", d10);
this.f9077f[0].put("ImageWidth", d11);
if (f9060o) {
Log.d("ExifInterface", "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2));
return;
}
return;
}
cVar.skipBytes(readUnsignedShort2);
}
}
public final void m(c cVar) {
d dVar;
u(cVar, cVar.available());
y(cVar, 0);
C(cVar, 0);
C(cVar, 5);
C(cVar, 4);
D();
if (this.f9075d != 8 || (dVar = (d) this.f9077f[1].get("MakerNote")) == null) {
return;
}
c cVar2 = new c(dVar.f9053c);
cVar2.A = this.f9079h;
cVar2.l(6L);
y(cVar2, 9);
d dVar2 = (d) this.f9077f[9].get("ColorSpace");
if (dVar2 != null) {
this.f9077f[1].put("ColorSpace", dVar2);
}
}
public final void n(c cVar) {
m(cVar);
if (((d) this.f9077f[0].get("JpgFromRaw")) != null) {
h(cVar, this.f9085n, 5);
}
d dVar = (d) this.f9077f[0].get("ISO");
d dVar2 = (d) this.f9077f[1].get("PhotographicSensitivity");
if (dVar == null || dVar2 != null) {
return;
}
this.f9077f[1].put("PhotographicSensitivity", dVar);
}
public final void o(c cVar) {
byte[] bArr = P;
cVar.skipBytes(bArr.length);
byte[] bArr2 = new byte[cVar.available()];
cVar.readFully(bArr2);
this.f9081j = bArr.length;
x(bArr2, 0);
}
public final void p(c cVar) {
if (f9060o) {
Log.d("ExifInterface", "getWebpAttributes starting with: " + cVar);
}
cVar.A = ByteOrder.LITTLE_ENDIAN;
cVar.skipBytes(B.length);
int readInt = cVar.readInt() + 8;
int skipBytes = cVar.skipBytes(C.length) + 8;
while (true) {
try {
byte[] bArr = new byte[4];
if (cVar.read(bArr) != 4) {
throw new IOException("Encountered invalid length while parsing WebP chunktype");
}
int readInt2 = cVar.readInt();
int i10 = skipBytes + 4 + 4;
if (Arrays.equals(D, bArr)) {
byte[] bArr2 = new byte[readInt2];
if (cVar.read(bArr2) == readInt2) {
this.f9081j = i10;
x(bArr2, 0);
this.f9081j = 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) {
throw new IOException("Encountered WebP file with invalid chunk size");
}
int skipBytes2 = cVar.skipBytes(readInt2);
if (skipBytes2 != readInt2) {
throw new IOException("Encountered WebP file with invalid chunk size");
}
skipBytes = i10 + skipBytes2;
} catch (EOFException unused) {
throw new IOException("Encountered corrupt WebP file.");
}
}
}
public final void q(c cVar, HashMap hashMap) {
d dVar = (d) hashMap.get("JPEGInterchangeFormat");
d dVar2 = (d) hashMap.get("JPEGInterchangeFormatLength");
if (dVar == null || dVar2 == null) {
return;
}
int f10 = dVar.f(this.f9079h);
int f11 = dVar2.f(this.f9079h);
if (this.f9075d == 7) {
f10 += this.f9082k;
}
int min = Math.min(f11, cVar.B - f10);
if (f10 > 0 && min > 0) {
int i10 = this.f9081j + f10;
if (this.f9072a == null && this.f9074c == null && this.f9073b == null) {
cVar.l(i10);
cVar.readFully(new byte[min]);
}
}
if (f9060o) {
Log.d("ExifInterface", "Setting thumbnail attributes with offset: " + f10 + ", length: " + min);
}
}
public final boolean s(HashMap hashMap) {
d dVar = (d) hashMap.get("ImageLength");
d dVar2 = (d) hashMap.get("ImageWidth");
if (dVar == null || dVar2 == null) {
return false;
}
return dVar.f(this.f9079h) <= 512 && dVar2.f(this.f9079h) <= 512;
}
public final void t(InputStream inputStream) {
for (int i10 = 0; i10 < I.length; i10++) {
try {
try {
this.f9077f[i10] = new HashMap();
} catch (IOException e10) {
boolean z10 = f9060o;
if (z10) {
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 (!z10) {
return;
}
}
} finally {
a();
if (f9060o) {
v();
}
}
}
if (!this.f9076e) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
this.f9075d = i(bufferedInputStream);
inputStream = bufferedInputStream;
}
c cVar = new c(inputStream);
if (!this.f9076e) {
switch (this.f9075d) {
case 0:
case 1:
case 2:
case 3:
case 5:
case 6:
case 8:
case 11:
m(cVar);
break;
case 4:
h(cVar, 0, 0);
break;
case 7:
j(cVar);
break;
case 9:
l(cVar);
break;
case 10:
n(cVar);
break;
case 12:
g(cVar);
break;
case 13:
k(cVar);
break;
case 14:
p(cVar);
break;
}
} else {
o(cVar);
}
z(cVar);
}
public final void u(c cVar, int i10) {
ByteOrder w10 = w(cVar);
this.f9079h = w10;
cVar.A = w10;
int readUnsignedShort = cVar.readUnsignedShort();
int i11 = this.f9075d;
if (i11 != 7 && i11 != 10 && readUnsignedShort != 42) {
StringBuilder a10 = android.support.v4.media.b.a("Invalid start code: ");
a10.append(Integer.toHexString(readUnsignedShort));
throw new IOException(a10.toString());
}
int readInt = cVar.readInt();
if (readInt < 8 || readInt >= i10) {
throw new IOException(android.support.v4.media.a.a("Invalid first Ifd offset: ", readInt));
}
int i12 = readInt - 8;
if (i12 > 0 && cVar.skipBytes(i12) != i12) {
throw new IOException(android.support.v4.media.a.a("Couldn't jump to first Ifd: ", i12));
}
}
public final void v() {
for (int i10 = 0; i10 < this.f9077f.length; i10++) {
Log.d("ExifInterface", "The size of tag group[" + i10 + "]: " + this.f9077f[i10].size());
for (Map.Entry entry : this.f9077f[i10].entrySet()) {
d dVar = (d) entry.getValue();
StringBuilder a10 = android.support.v4.media.b.a("tagName: ");
a10.append((String) entry.getKey());
a10.append(", tagType: ");
a10.append(dVar.toString());
a10.append(", tagValue: '");
a10.append(dVar.g(this.f9079h));
a10.append("'");
Log.d("ExifInterface", a10.toString());
}
}
}
public final ByteOrder w(c cVar) {
short readShort = cVar.readShort();
if (readShort == 18761) {
if (f9060o) {
Log.d("ExifInterface", "readExifSegment: Byte Align II");
}
return ByteOrder.LITTLE_ENDIAN;
} else if (readShort == 19789) {
if (f9060o) {
Log.d("ExifInterface", "readExifSegment: Byte Align MM");
}
return ByteOrder.BIG_ENDIAN;
} else {
StringBuilder a10 = android.support.v4.media.b.a("Invalid byte order: ");
a10.append(Integer.toHexString(readShort));
throw new IOException(a10.toString());
}
}
public final void x(byte[] bArr, int i10) {
c cVar = new c(bArr);
u(cVar, bArr.length);
y(cVar, i10);
}
public final void y(c cVar, int i10) {
short s10;
short s11;
int[] iArr;
boolean z10;
long j10;
boolean z11;
int i11;
int i12;
int i13;
e eVar;
int readUnsignedShort;
long j11;
this.f9078g.add(Integer.valueOf(cVar.C));
if (cVar.C + 2 > cVar.B) {
return;
}
short readShort = cVar.readShort();
if (f9060o) {
a.a("numberOfDirectoryEntry: ", readShort, "ExifInterface");
}
if ((readShort * 12) + cVar.C > cVar.B || readShort <= 0) {
return;
}
char c10 = 0;
short s12 = 0;
while (s12 < readShort) {
int readUnsignedShort2 = cVar.readUnsignedShort();
int readUnsignedShort3 = cVar.readUnsignedShort();
int readInt = cVar.readInt();
long j12 = cVar.C + 4;
e eVar2 = (e) K[i10].get(Integer.valueOf(readUnsignedShort2));
boolean z12 = f9060o;
if (z12) {
Object[] objArr = new Object[5];
objArr[c10] = Integer.valueOf(i10);
objArr[1] = Integer.valueOf(readUnsignedShort2);
objArr[2] = eVar2 != null ? eVar2.f9055b : null;
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));
}
if (eVar2 == null) {
if (z12) {
a.a("Skip the tag entry since tag number is not defined: ", readUnsignedShort2, "ExifInterface");
}
s10 = readShort;
} else {
if (readUnsignedShort3 > 0) {
if (readUnsignedShort3 < F.length) {
int i14 = eVar2.f9056c;
if (i14 == 7 || readUnsignedShort3 == 7 || i14 == readUnsignedShort3 || (i11 = eVar2.f9057d) == readUnsignedShort3) {
s10 = readShort;
} else {
s10 = readShort;
if (((i14 != 4 && i11 != 4) || readUnsignedShort3 != 3) && (((i14 != 9 && i11 != 9) || readUnsignedShort3 != 8) && ((i14 != 12 && i11 != 12) || readUnsignedShort3 != 11))) {
z10 = false;
if (!z10) {
if (readUnsignedShort3 == 7) {
readUnsignedShort3 = i14;
}
s11 = s12;
j10 = readInt * iArr[readUnsignedShort3];
if (j10 < 0 || j10 > 2147483647L) {
if (z12) {
a.a("Skip the tag entry since the number of components is invalid: ", readInt, "ExifInterface");
}
z11 = false;
} else {
z11 = true;
}
if (z11) {
if (j10 > 4) {
int readInt2 = cVar.readInt();
if (z12) {
a.a("seek to data offset: ", readInt2, "ExifInterface");
}
int i15 = this.f9075d;
i12 = readUnsignedShort3;
if (i15 == 7) {
if ("MakerNote".equals(eVar2.f9055b)) {
this.f9082k = readInt2;
} else if (i10 == 6 && "ThumbnailImage".equals(eVar2.f9055b)) {
this.f9083l = readInt2;
this.f9084m = readInt;
d d10 = d.d(6, this.f9079h);
j11 = j12;
d b10 = d.b(this.f9083l, this.f9079h);
i13 = readInt;
d b11 = d.b(this.f9084m, this.f9079h);
this.f9077f[4].put("Compression", d10);
this.f9077f[4].put("JPEGInterchangeFormat", b10);
this.f9077f[4].put("JPEGInterchangeFormatLength", b11);
}
j11 = j12;
i13 = readInt;
} else {
j11 = j12;
i13 = readInt;
if (i15 == 10 && "JpgFromRaw".equals(eVar2.f9055b)) {
this.f9085n = readInt2;
}
}
long j13 = readInt2;
eVar = eVar2;
if (j13 + j10 <= cVar.B) {
cVar.l(j13);
j12 = j11;
} else {
if (z12) {
a.a("Skip the tag entry since data offset is invalid: ", readInt2, "ExifInterface");
}
cVar.l(j11);
}
} else {
i12 = readUnsignedShort3;
i13 = readInt;
eVar = eVar2;
}
Integer num = (Integer) N.get(Integer.valueOf(readUnsignedShort2));
if (z12) {
Log.d("ExifInterface", "nextIfdType: " + num + " byteCount: " + j10);
}
if (num != null) {
long j14 = -1;
int i16 = i12;
if (i16 != 3) {
if (i16 == 4) {
j14 = cVar.c();
} else if (i16 == 8) {
readUnsignedShort = cVar.readShort();
} else if (i16 == 9 || i16 == 13) {
readUnsignedShort = cVar.readInt();
}
if (z12) {
Log.d("ExifInterface", String.format("Offset: %d, tagName: %s", Long.valueOf(j14), eVar.f9055b));
}
if (j14 > 0 || j14 >= cVar.B) {
if (z12) {
Log.d("ExifInterface", "Skip jump into the IFD since its offset is invalid: " + j14);
}
} else if (!this.f9078g.contains(Integer.valueOf((int) j14))) {
cVar.l(j14);
y(cVar, num.intValue());
} else if (z12) {
Log.d("ExifInterface", "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j14 + ")");
}
cVar.l(j12);
} else {
readUnsignedShort = cVar.readUnsignedShort();
}
j14 = readUnsignedShort;
if (z12) {
}
if (j14 > 0) {
}
if (z12) {
}
cVar.l(j12);
} else {
byte[] bArr = new byte[(int) j10];
cVar.readFully(bArr);
long j15 = j12;
e eVar3 = eVar;
d dVar = new d(i12, i13, cVar.C + this.f9081j, bArr);
this.f9077f[i10].put(eVar3.f9055b, dVar);
if ("DNGVersion".equals(eVar3.f9055b)) {
this.f9075d = 3;
}
if ((("Make".equals(eVar3.f9055b) || "Model".equals(eVar3.f9055b)) && dVar.g(this.f9079h).contains("PENTAX")) || ("Compression".equals(eVar3.f9055b) && dVar.f(this.f9079h) == 65535)) {
this.f9075d = 8;
}
if (cVar.C != j15) {
cVar.l(j15);
}
}
} else {
cVar.l(j12);
}
s12 = (short) (s11 + 1);
c10 = 0;
readShort = s10;
} else if (z12) {
StringBuilder a10 = android.support.v4.media.b.a("Skip the tag entry since data format (");
a10.append(E[readUnsignedShort3]);
a10.append(") is unexpected for tag: ");
a10.append(eVar2.f9055b);
Log.d("ExifInterface", a10.toString());
}
}
}
z10 = true;
if (!z10) {
}
}
}
s10 = readShort;
s11 = s12;
if (z12) {
a.a("Skip the tag entry since data format is invalid: ", readUnsignedShort3, "ExifInterface");
}
z11 = false;
j10 = 0;
if (z11) {
}
s12 = (short) (s11 + 1);
c10 = 0;
readShort = s10;
}
s11 = s12;
z11 = false;
j10 = 0;
if (z11) {
}
s12 = (short) (s11 + 1);
c10 = 0;
readShort = s10;
}
if (cVar.C + 4 <= cVar.B) {
int readInt3 = cVar.readInt();
boolean z13 = f9060o;
if (z13) {
Log.d("ExifInterface", String.format("nextIfdOffset: %d", Integer.valueOf(readInt3)));
}
long j16 = readInt3;
if (j16 <= 0 || readInt3 >= cVar.B) {
if (z13) {
a.a("Stop reading file since a wrong offset may cause an infinite loop: ", readInt3, "ExifInterface");
}
} else if (this.f9078g.contains(Integer.valueOf(readInt3))) {
if (z13) {
a.a("Stop reading file since re-reading an IFD may cause an infinite loop: ", readInt3, "ExifInterface");
}
} else {
cVar.l(j16);
if (this.f9077f[4].isEmpty()) {
y(cVar, 4);
} else if (this.f9077f[5].isEmpty()) {
y(cVar, 5);
}
}
}
}
public final void z(c cVar) {
boolean z10;
d dVar;
int f10;
HashMap hashMap = this.f9077f[4];
d dVar2 = (d) hashMap.get("Compression");
if (dVar2 == null) {
q(cVar, hashMap);
return;
}
int f11 = dVar2.f(this.f9079h);
if (f11 != 1) {
if (f11 == 6) {
q(cVar, hashMap);
return;
} else if (f11 != 7) {
return;
}
}
d dVar3 = (d) hashMap.get("BitsPerSample");
if (dVar3 != null) {
int[] iArr = (int[]) dVar3.h(this.f9079h);
int[] iArr2 = f9061p;
if (Arrays.equals(iArr2, iArr) || (this.f9075d == 3 && (dVar = (d) hashMap.get("PhotometricInterpretation")) != null && (((f10 = dVar.f(this.f9079h)) == 1 && Arrays.equals(iArr, f9062q)) || (f10 == 6 && Arrays.equals(iArr, iArr2))))) {
z10 = true;
if (z10) {
return;
}
d dVar4 = (d) hashMap.get("StripOffsets");
d dVar5 = (d) hashMap.get("StripByteCounts");
if (dVar4 == null || dVar5 == null) {
return;
}
long[] c10 = c(dVar4.h(this.f9079h));
long[] c11 = c(dVar5.h(this.f9079h));
if (c10 == null || c10.length == 0) {
Log.w("ExifInterface", "stripOffsets should not be null or have zero length.");
return;
} else if (c11 == null || c11.length == 0) {
Log.w("ExifInterface", "stripByteCounts should not be null or have zero length.");
return;
} else if (c10.length != c11.length) {
Log.w("ExifInterface", "stripOffsets and stripByteCounts should have same length.");
return;
} else {
long j10 = 0;
for (long j11 : c11) {
j10 += j11;
}
byte[] bArr = new byte[(int) j10];
this.f9080i = 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.f9080i = false;
}
int i15 = i13 - i10;
if (i15 < 0) {
Log.d("ExifInterface", "Invalid strip offset value");
}
cVar.l(i15);
int i16 = i10 + i15;
byte[] bArr2 = new byte[i14];
cVar.read(bArr2);
i10 = i16 + i14;
System.arraycopy(bArr2, 0, bArr, i11, i14);
i11 += i14;
}
if (this.f9080i) {
long j12 = c10[0];
return;
}
return;
}
}
}
if (f9060o) {
Log.d("ExifInterface", "Unsupported data type value");
}
z10 = false;
if (z10) {
}
}
}