package defpackage;

import android.content.res.AssetManager;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.system.OsConstants;
import android.util.Log;
import j$.util.DesugarTimeZone;
import j$.util.Objects;
import java.io.BufferedInputStream;
import java.io.EOFException;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.zip.CRC32;

/* renamed from: ᵜᵦᵰ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2845 {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public static final String[] f10957;

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public static final HashMap f10958;

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public static final byte[] f10959;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public static final boolean f10960 = Log.isLoggable("ExifInterface", 3);

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public static final C0465 f10961;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public static final byte[] f10962;

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public static final byte[] f10963;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public static final HashMap[] f10964;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public static final byte[] f10965;

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public static final byte[] f10966;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public static final byte[] f10967;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public static final int[] f10968;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public static final byte[] f10969;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public static final byte[] f10970;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public static final byte[] f10971;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public static final byte[] f10972;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public static final C0465[] f10973;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public static final byte[] f10974;

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public static final byte[] f10975;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public static final int[] f10976;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public static final C0465[][] f10977;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public static final int[] f10978;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public static final byte[] f10979;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public static final HashSet f10980;

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public static final byte[] f10981;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public static final HashMap[] f10982;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public static final byte[] f10983;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public static final byte[] f10984;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public static final Charset f10985;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final HashSet f10986;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public boolean f10987;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public ByteOrder f10988;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public int f10989;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public int f10990;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final FileDescriptor f10991;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final AssetManager.AssetInputStream f10992;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public int f10993;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public int f10994;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public int f10995;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final HashMap[] f10996;

    static {
        Arrays.asList(1, 6, 3, 8);
        Arrays.asList(2, 7, 4, 5);
        f10978 = new int[]{8, 8, 8};
        f10976 = new int[]{8};
        f10979 = new byte[]{-1, -40, -1};
        f10959 = new byte[]{102, 116, 121, 112};
        f10967 = new byte[]{109, 105, 102, 49};
        f10981 = new byte[]{104, 101, 105, 99};
        f10966 = new byte[]{79, 76, 89, 77, 80, 0};
        f10975 = new byte[]{79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
        f10963 = new byte[]{-119, 80, 78, 71, 13, 10, 26, 10};
        f10974 = new byte[]{101, 88, 73, 102};
        f10971 = new byte[]{73, 72, 68, 82};
        f10984 = new byte[]{73, 69, 78, 68};
        f10983 = new byte[]{82, 73, 70, 70};
        f10972 = new byte[]{87, 69, 66, 80};
        f10970 = 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());
        f10957 = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
        f10968 = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
        f10962 = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
        C0465[] c0465Arr = {new C0465(254, 4, "NewSubfileType"), new C0465(255, 4, "SubfileType"), new C0465(256, 3, 4, "ImageWidth"), new C0465(257, 3, 4, "ImageLength"), new C0465(258, 3, "BitsPerSample"), new C0465(259, 3, "Compression"), new C0465(262, 3, "PhotometricInterpretation"), new C0465(270, 2, "ImageDescription"), new C0465(271, 2, "Make"), new C0465(272, 2, "Model"), new C0465(273, 3, 4, "StripOffsets"), new C0465(274, 3, "Orientation"), new C0465(277, 3, "SamplesPerPixel"), new C0465(278, 3, 4, "RowsPerStrip"), new C0465(279, 3, 4, "StripByteCounts"), new C0465(282, 5, "XResolution"), new C0465(283, 5, "YResolution"), new C0465(284, 3, "PlanarConfiguration"), new C0465(296, 3, "ResolutionUnit"), new C0465(301, 3, "TransferFunction"), new C0465(305, 2, "Software"), new C0465(306, 2, "DateTime"), new C0465(315, 2, "Artist"), new C0465(318, 5, "WhitePoint"), new C0465(319, 5, "PrimaryChromaticities"), new C0465(330, 4, "SubIFDPointer"), new C0465(513, 4, "JPEGInterchangeFormat"), new C0465(514, 4, "JPEGInterchangeFormatLength"), new C0465(529, 5, "YCbCrCoefficients"), new C0465(530, 3, "YCbCrSubSampling"), new C0465(531, 3, "YCbCrPositioning"), new C0465(532, 5, "ReferenceBlackWhite"), new C0465(33432, 2, "Copyright"), new C0465(34665, 4, "ExifIFDPointer"), new C0465(34853, 4, "GPSInfoIFDPointer"), new C0465(4, 4, "SensorTopBorder"), new C0465(5, 4, "SensorLeftBorder"), new C0465(6, 4, "SensorBottomBorder"), new C0465(7, 4, "SensorRightBorder"), new C0465(23, 3, "ISO"), new C0465(46, 7, "JpgFromRaw"), new C0465(700, 1, "Xmp")};
        C0465[] c0465Arr2 = {new C0465(33434, 5, "ExposureTime"), new C0465(33437, 5, "FNumber"), new C0465(34850, 3, "ExposureProgram"), new C0465(34852, 2, "SpectralSensitivity"), new C0465(34855, 3, "PhotographicSensitivity"), new C0465(34856, 7, "OECF"), new C0465(34864, 3, "SensitivityType"), new C0465(34865, 4, "StandardOutputSensitivity"), new C0465(34866, 4, "RecommendedExposureIndex"), new C0465(34867, 4, "ISOSpeed"), new C0465(34868, 4, "ISOSpeedLatitudeyyy"), new C0465(34869, 4, "ISOSpeedLatitudezzz"), new C0465(36864, 2, "ExifVersion"), new C0465(36867, 2, "DateTimeOriginal"), new C0465(36868, 2, "DateTimeDigitized"), new C0465(36880, 2, "OffsetTime"), new C0465(36881, 2, "OffsetTimeOriginal"), new C0465(36882, 2, "OffsetTimeDigitized"), new C0465(37121, 7, "ComponentsConfiguration"), new C0465(37122, 5, "CompressedBitsPerPixel"), new C0465(37377, 10, "ShutterSpeedValue"), new C0465(37378, 5, "ApertureValue"), new C0465(37379, 10, "BrightnessValue"), new C0465(37380, 10, "ExposureBiasValue"), new C0465(37381, 5, "MaxApertureValue"), new C0465(37382, 5, "SubjectDistance"), new C0465(37383, 3, "MeteringMode"), new C0465(37384, 3, "LightSource"), new C0465(37385, 3, "Flash"), new C0465(37386, 5, "FocalLength"), new C0465(37396, 3, "SubjectArea"), new C0465(37500, 7, "MakerNote"), new C0465(37510, 7, "UserComment"), new C0465(37520, 2, "SubSecTime"), new C0465(37521, 2, "SubSecTimeOriginal"), new C0465(37522, 2, "SubSecTimeDigitized"), new C0465(40960, 7, "FlashpixVersion"), new C0465(40961, 3, "ColorSpace"), new C0465(40962, 3, 4, "PixelXDimension"), new C0465(40963, 3, 4, "PixelYDimension"), new C0465(40964, 2, "RelatedSoundFile"), new C0465(40965, 4, "InteroperabilityIFDPointer"), new C0465(41483, 5, "FlashEnergy"), new C0465(41484, 7, "SpatialFrequencyResponse"), new C0465(41486, 5, "FocalPlaneXResolution"), new C0465(41487, 5, "FocalPlaneYResolution"), new C0465(41488, 3, "FocalPlaneResolutionUnit"), new C0465(41492, 3, "SubjectLocation"), new C0465(41493, 5, "ExposureIndex"), new C0465(41495, 3, "SensingMethod"), new C0465(41728, 7, "FileSource"), new C0465(41729, 7, "SceneType"), new C0465(41730, 7, "CFAPattern"), new C0465(41985, 3, "CustomRendered"), new C0465(41986, 3, "ExposureMode"), new C0465(41987, 3, "WhiteBalance"), new C0465(41988, 5, "DigitalZoomRatio"), new C0465(41989, 3, "FocalLengthIn35mmFilm"), new C0465(41990, 3, "SceneCaptureType"), new C0465(41991, 3, "GainControl"), new C0465(41992, 3, "Contrast"), new C0465(41993, 3, "Saturation"), new C0465(41994, 3, "Sharpness"), new C0465(41995, 7, "DeviceSettingDescription"), new C0465(41996, 3, "SubjectDistanceRange"), new C0465(42016, 2, "ImageUniqueID"), new C0465(42032, 2, "CameraOwnerName"), new C0465(42033, 2, "BodySerialNumber"), new C0465(42034, 5, "LensSpecification"), new C0465(42035, 2, "LensMake"), new C0465(42036, 2, "LensModel"), new C0465(42240, 5, "Gamma"), new C0465(50706, 1, "DNGVersion"), new C0465(50720, 3, 4, "DefaultCropSize")};
        C0465[] c0465Arr3 = {new C0465(0, 1, "GPSVersionID"), new C0465(1, 2, "GPSLatitudeRef"), new C0465(2, 5, 10, "GPSLatitude"), new C0465(3, 2, "GPSLongitudeRef"), new C0465(4, 5, 10, "GPSLongitude"), new C0465(5, 1, "GPSAltitudeRef"), new C0465(6, 5, "GPSAltitude"), new C0465(7, 5, "GPSTimeStamp"), new C0465(8, 2, "GPSSatellites"), new C0465(9, 2, "GPSStatus"), new C0465(10, 2, "GPSMeasureMode"), new C0465(11, 5, "GPSDOP"), new C0465(12, 2, "GPSSpeedRef"), new C0465(13, 5, "GPSSpeed"), new C0465(14, 2, "GPSTrackRef"), new C0465(15, 5, "GPSTrack"), new C0465(16, 2, "GPSImgDirectionRef"), new C0465(17, 5, "GPSImgDirection"), new C0465(18, 2, "GPSMapDatum"), new C0465(19, 2, "GPSDestLatitudeRef"), new C0465(20, 5, "GPSDestLatitude"), new C0465(21, 2, "GPSDestLongitudeRef"), new C0465(22, 5, "GPSDestLongitude"), new C0465(23, 2, "GPSDestBearingRef"), new C0465(24, 5, "GPSDestBearing"), new C0465(25, 2, "GPSDestDistanceRef"), new C0465(26, 5, "GPSDestDistance"), new C0465(27, 7, "GPSProcessingMethod"), new C0465(28, 7, "GPSAreaInformation"), new C0465(29, 2, "GPSDateStamp"), new C0465(30, 3, "GPSDifferential"), new C0465(31, 5, "GPSHPositioningError")};
        C0465[] c0465Arr4 = {new C0465(1, 2, "InteroperabilityIndex")};
        C0465[] c0465Arr5 = {new C0465(254, 4, "NewSubfileType"), new C0465(255, 4, "SubfileType"), new C0465(256, 3, 4, "ThumbnailImageWidth"), new C0465(257, 3, 4, "ThumbnailImageLength"), new C0465(258, 3, "BitsPerSample"), new C0465(259, 3, "Compression"), new C0465(262, 3, "PhotometricInterpretation"), new C0465(270, 2, "ImageDescription"), new C0465(271, 2, "Make"), new C0465(272, 2, "Model"), new C0465(273, 3, 4, "StripOffsets"), new C0465(274, 3, "ThumbnailOrientation"), new C0465(277, 3, "SamplesPerPixel"), new C0465(278, 3, 4, "RowsPerStrip"), new C0465(279, 3, 4, "StripByteCounts"), new C0465(282, 5, "XResolution"), new C0465(283, 5, "YResolution"), new C0465(284, 3, "PlanarConfiguration"), new C0465(296, 3, "ResolutionUnit"), new C0465(301, 3, "TransferFunction"), new C0465(305, 2, "Software"), new C0465(306, 2, "DateTime"), new C0465(315, 2, "Artist"), new C0465(318, 5, "WhitePoint"), new C0465(319, 5, "PrimaryChromaticities"), new C0465(330, 4, "SubIFDPointer"), new C0465(513, 4, "JPEGInterchangeFormat"), new C0465(514, 4, "JPEGInterchangeFormatLength"), new C0465(529, 5, "YCbCrCoefficients"), new C0465(530, 3, "YCbCrSubSampling"), new C0465(531, 3, "YCbCrPositioning"), new C0465(532, 5, "ReferenceBlackWhite"), new C0465(33432, 2, "Copyright"), new C0465(34665, 4, "ExifIFDPointer"), new C0465(34853, 4, "GPSInfoIFDPointer"), new C0465(50706, 1, "DNGVersion"), new C0465(50720, 3, 4, "DefaultCropSize")};
        f10961 = new C0465(273, 3, "StripOffsets");
        f10977 = new C0465[][]{c0465Arr, c0465Arr2, c0465Arr3, c0465Arr4, c0465Arr5, c0465Arr, new C0465[]{new C0465(256, 7, "ThumbnailImage"), new C0465(8224, 4, "CameraSettingsIFDPointer"), new C0465(8256, 4, "ImageProcessingIFDPointer")}, new C0465[]{new C0465(257, 4, "PreviewImageStart"), new C0465(258, 4, "PreviewImageLength")}, new C0465[]{new C0465(4371, 3, "AspectFrame")}, new C0465[]{new C0465(55, 3, "ColorSpace")}};
        f10973 = new C0465[]{new C0465(330, 4, "SubIFDPointer"), new C0465(34665, 4, "ExifIFDPointer"), new C0465(34853, 4, "GPSInfoIFDPointer"), new C0465(40965, 4, "InteroperabilityIFDPointer"), new C0465(8224, 1, "CameraSettingsIFDPointer"), new C0465(8256, 1, "ImageProcessingIFDPointer")};
        f10982 = new HashMap[10];
        f10964 = new HashMap[10];
        f10980 = new HashSet(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
        f10958 = new HashMap();
        Charset charsetForName = Charset.forName("US-ASCII");
        f10985 = charsetForName;
        f10965 = "Exif\u0000\u0000".getBytes(charsetForName);
        f10969 = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(charsetForName);
        Locale locale = Locale.US;
        new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", locale).setTimeZone(DesugarTimeZone.getTimeZone("UTC"));
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", locale).setTimeZone(DesugarTimeZone.getTimeZone("UTC"));
        int i = 0;
        while (true) {
            C0465[][] c0465Arr6 = f10977;
            if (i >= c0465Arr6.length) {
                HashMap map = f10958;
                C0465[] c0465Arr7 = f10973;
                map.put(Integer.valueOf(c0465Arr7[0].f2530), 5);
                map.put(Integer.valueOf(c0465Arr7[1].f2530), 1);
                map.put(Integer.valueOf(c0465Arr7[2].f2530), 2);
                map.put(Integer.valueOf(c0465Arr7[3].f2530), 3);
                map.put(Integer.valueOf(c0465Arr7[4].f2530), 7);
                map.put(Integer.valueOf(c0465Arr7[5].f2530), 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;
            }
            f10982[i] = new HashMap();
            f10964[i] = new HashMap();
            for (C0465 c0465 : c0465Arr6[i]) {
                f10982[i].put(Integer.valueOf(c0465.f2530), c0465);
                f10964[i].put(c0465.f2531, c0465);
            }
            i++;
        }
    }

    public C2845(InputStream inputStream) throws Throwable {
        C0465[][] c0465Arr = f10977;
        this.f10996 = new HashMap[c0465Arr.length];
        this.f10986 = new HashSet(c0465Arr.length);
        this.f10988 = ByteOrder.BIG_ENDIAN;
        if (inputStream instanceof AssetManager.AssetInputStream) {
            this.f10992 = (AssetManager.AssetInputStream) inputStream;
            this.f10991 = null;
        } else if (inputStream instanceof FileInputStream) {
            FileInputStream fileInputStream = (FileInputStream) inputStream;
            try {
                AbstractC4936.m10378(fileInputStream.getFD(), 0L, OsConstants.SEEK_CUR);
                this.f10992 = null;
                this.f10991 = fileInputStream.getFD();
            } catch (Exception unused) {
            }
        } else {
            this.f10992 = null;
            this.f10991 = null;
        }
        boolean z = f10960;
        for (int i = 0; i < c0465Arr.length; i++) {
            try {
                this.f10996[i] = new HashMap();
            } catch (IOException | UnsupportedOperationException unused2) {
                m6963();
                if (!z) {
                    return;
                }
            } catch (Throwable th) {
                m6963();
                if (z) {
                    m6954();
                }
                throw th;
            }
        }
        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
        int iM6957 = m6957(bufferedInputStream);
        this.f10989 = iM6957;
        if (iM6957 == 4 || iM6957 == 9 || iM6957 == 13 || iM6957 == 14) {
            C2280 c2280 = new C2280(bufferedInputStream);
            int i2 = this.f10989;
            if (i2 == 4) {
                m6953(c2280, 0, 0);
            } else if (i2 == 13) {
                m6973(c2280);
            } else if (i2 == 9) {
                m6960(c2280);
            } else if (i2 == 14) {
                m6955(c2280);
            }
        } else {
            C1157 c1157 = new C1157(bufferedInputStream);
            int i3 = this.f10989;
            if (i3 == 12) {
                m6974(c1157);
            } else if (i3 == 7) {
                m6956(c1157);
            } else if (i3 == 10) {
                m6972(c1157);
            } else {
                m6970(c1157);
            }
            c1157.m3652(this.f10995);
            m6959(c1157);
        }
        m6963();
        if (!z) {
            return;
        }
        m6954();
    }

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public static ByteOrder m6952(C2280 c2280) throws IOException {
        short s = c2280.readShort();
        if (s == 18761) {
            return ByteOrder.LITTLE_ENDIAN;
        }
        if (s == 19789) {
            return ByteOrder.BIG_ENDIAN;
        }
        ᵨᴵᵺ.ᵸʓᵠ(Integer.toHexString(s), "Invalid byte order: ");
        return null;
    }

    /* JADX WARN: Code restructure failed: missing block: B:87:0x0159, code lost:
    
        r23.f8914 = r22.f10988;
     */
    /* JADX WARN: Code restructure failed: missing block: B:88:0x015d, code lost:
    
        return;
     */
    /* JADX WARN: Removed duplicated region for block: B:100:0x0151 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:103:0x0106 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:34:0x006b A[FALL_THROUGH] */
    /* JADX WARN: Removed duplicated region for block: B:71:0x00fc  */
    /* JADX WARN: Removed duplicated region for block: B:82:0x014a A[LOOP:0: B:10:0x0024->B:82:0x014a, LOOP_END] */
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m6953(defpackage.C2280 r23, int r24, int r25) throws java.lang.Throwable {
        /*
            Method dump skipped, instructions count: 424
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C2845.m6953(ᵕˆᵎˌ, int, int):void");
    }

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final void m6954() throws Throwable {
        int i = 0;
        while (true) {
            HashMap[] mapArr = this.f10996;
            if (i >= mapArr.length) {
                return;
            }
            mapArr[i].size();
            for (Map.Entry entry : mapArr[i].entrySet()) {
                C0666 c0666 = (C0666) entry.getValue();
                c0666.toString();
                c0666.m2625(this.f10988);
            }
            i++;
        }
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final void m6955(C2280 c2280) throws Throwable {
        if (f10960) {
            Objects.toString(c2280);
        }
        c2280.f8914 = ByteOrder.LITTLE_ENDIAN;
        c2280.m5981(f10983.length);
        int i = c2280.readInt() + 8;
        byte[] bArr = f10972;
        c2280.m5981(bArr.length);
        int length = bArr.length + 8;
        while (true) {
            try {
                byte[] bArr2 = new byte[4];
                if (c2280.read(bArr2) != 4) {
                    throw new IOException("Encountered invalid length while parsing WebP chunktype");
                }
                int i2 = c2280.readInt();
                int i3 = length + 8;
                if (Arrays.equals(f10970, bArr2)) {
                    byte[] bArr3 = new byte[i2];
                    if (c2280.read(bArr3) == i2) {
                        this.f10995 = i3;
                        m6971(0, bArr3);
                        m6959(new C2280(bArr3));
                        return;
                    } else {
                        throw new IOException("Failed to read given length for given PNG chunk type: " + AbstractC0220.m1509(bArr2));
                    }
                }
                if (i2 % 2 == 1) {
                    i2++;
                }
                length = i3 + i2;
                if (length == i) {
                    return;
                }
                if (length > i) {
                    throw new IOException("Encountered WebP file with invalid chunk size");
                }
                c2280.m5981(i2);
            } catch (EOFException unused) {
                C0910.m3045("Encountered corrupt WebP file.");
                return;
            }
        }
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m6956(C1157 c1157) throws Throwable {
        int i;
        int i2;
        m6970(c1157);
        HashMap[] mapArr = this.f10996;
        C0666 c0666 = (C0666) mapArr[1].get("MakerNote");
        if (c0666 != null) {
            C1157 c11572 = new C1157(c0666.f3303);
            c11572.f8914 = this.f10988;
            byte[] bArr = f10966;
            byte[] bArr2 = new byte[bArr.length];
            c11572.readFully(bArr2);
            c11572.m3652(0L);
            byte[] bArr3 = f10975;
            byte[] bArr4 = new byte[bArr3.length];
            c11572.readFully(bArr4);
            if (Arrays.equals(bArr2, bArr)) {
                c11572.m3652(8L);
            } else if (Arrays.equals(bArr4, bArr3)) {
                c11572.m3652(12L);
            }
            m6961(c11572, 6);
            C0666 c06662 = (C0666) mapArr[7].get("PreviewImageStart");
            C0666 c06663 = (C0666) mapArr[7].get("PreviewImageLength");
            if (c06662 != null && c06663 != null) {
                mapArr[5].put("JPEGInterchangeFormat", c06662);
                mapArr[5].put("JPEGInterchangeFormatLength", c06663);
            }
            C0666 c06664 = (C0666) mapArr[8].get("AspectFrame");
            if (c06664 != null) {
                int[] iArr = (int[]) c06664.m2624(this.f10988);
                if (iArr == null || iArr.length != 4) {
                    Arrays.toString(iArr);
                    return;
                }
                int i3 = iArr[2];
                int i4 = iArr[0];
                if (i3 <= i4 || (i = iArr[3]) <= (i2 = iArr[1])) {
                    return;
                }
                int i5 = (i3 - i4) + 1;
                int i6 = (i - i2) + 1;
                if (i5 < i6) {
                    int i7 = i5 + i6;
                    i6 = i7 - i6;
                    i5 = i7 - i6;
                }
                C0666 c0666M2620 = C0666.m2620(i5, this.f10988);
                C0666 c0666M26202 = C0666.m2620(i6, this.f10988);
                mapArr[0].put("ImageWidth", c0666M2620);
                mapArr[0].put("ImageLength", c0666M26202);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:105:0x0137 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:107:0x013a  */
    /* JADX WARN: Removed duplicated region for block: B:145:0x0106 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:71:0x00e9  */
    /* JADX WARN: Removed duplicated region for block: B:85:0x0104 A[RETURN] */
    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final int m6957(java.io.BufferedInputStream r19) throws java.lang.Throwable {
        /*
            Method dump skipped, instructions count: 389
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C2845.m6957(java.io.BufferedInputStream):int");
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final C0666 m6958(String str) {
        if ("ISOSpeedRatings".equals(str)) {
            str = "PhotographicSensitivity";
        }
        for (int i = 0; i < f10977.length; i++) {
            C0666 c0666 = (C0666) this.f10996[i].get(str);
            if (c0666 != null) {
                return c0666;
            }
        }
        return null;
    }

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public final void m6959(C2280 c2280) throws Throwable {
        C0666 c0666;
        HashMap map = this.f10996[4];
        C0666 c06662 = (C0666) map.get("Compression");
        if (c06662 == null) {
            m6967(c2280, map);
            return;
        }
        int iM2623 = c06662.m2623(this.f10988);
        if (iM2623 != 1) {
            if (iM2623 == 6) {
                m6967(c2280, map);
                return;
            } else if (iM2623 != 7) {
                return;
            }
        }
        C0666 c06663 = (C0666) map.get("BitsPerSample");
        if (c06663 != null) {
            int[] iArr = (int[]) c06663.m2624(this.f10988);
            int[] iArr2 = f10978;
            if (!Arrays.equals(iArr2, iArr)) {
                if (this.f10989 != 3 || (c0666 = (C0666) map.get("PhotometricInterpretation")) == null) {
                    return;
                }
                int iM26232 = c0666.m2623(this.f10988);
                if ((iM26232 != 1 || !Arrays.equals(iArr, f10976)) && (iM26232 != 6 || !Arrays.equals(iArr, iArr2))) {
                    return;
                }
            }
            C0666 c06664 = (C0666) map.get("StripOffsets");
            C0666 c06665 = (C0666) map.get("StripByteCounts");
            if (c06664 == null || c06665 == null) {
                return;
            }
            long[] jArrM1520 = AbstractC0220.m1520(c06664.m2624(this.f10988));
            long[] jArrM15202 = AbstractC0220.m1520(c06665.m2624(this.f10988));
            if (jArrM1520 == null || jArrM1520.length == 0 || jArrM15202 == null || jArrM15202.length == 0 || jArrM1520.length != jArrM15202.length) {
                return;
            }
            long j = 0;
            for (long j2 : jArrM15202) {
                j += j2;
            }
            byte[] bArr = new byte[(int) j];
            this.f10987 = true;
            int i = 0;
            int i2 = 0;
            for (int i3 = 0; i3 < jArrM1520.length; i3++) {
                int i4 = (int) jArrM1520[i3];
                int i5 = (int) jArrM15202[i3];
                if (i3 < jArrM1520.length - 1 && i4 + i5 != jArrM1520[i3 + 1]) {
                    this.f10987 = false;
                }
                int i6 = i4 - i;
                if (i6 < 0) {
                    return;
                }
                long j3 = i6;
                if (c2280.skip(j3) != j3) {
                    return;
                }
                int i7 = i + i6;
                byte[] bArr2 = new byte[i5];
                if (c2280.read(bArr2) != i5) {
                    return;
                }
                i = i7 + i5;
                System.arraycopy(bArr2, 0, bArr, i2, i5);
                i2 += i5;
            }
            if (this.f10987) {
                long j4 = jArrM1520[0];
            }
        }
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final void m6960(C2280 c2280) throws Throwable {
        if (f10960) {
            Objects.toString(c2280);
        }
        c2280.m5981(84);
        byte[] bArr = new byte[4];
        byte[] bArr2 = new byte[4];
        byte[] bArr3 = new byte[4];
        c2280.read(bArr);
        c2280.read(bArr2);
        c2280.read(bArr3);
        int i = ByteBuffer.wrap(bArr).getInt();
        int i2 = ByteBuffer.wrap(bArr2).getInt();
        int i3 = ByteBuffer.wrap(bArr3).getInt();
        byte[] bArr4 = new byte[i2];
        c2280.m5981(i - c2280.f8917);
        c2280.read(bArr4);
        m6953(new C2280(bArr4), i, 5);
        c2280.m5981(i3 - c2280.f8917);
        c2280.f8914 = ByteOrder.BIG_ENDIAN;
        int i4 = c2280.readInt();
        for (int i5 = 0; i5 < i4; i5++) {
            int unsignedShort = c2280.readUnsignedShort();
            int unsignedShort2 = c2280.readUnsignedShort();
            if (unsignedShort == f10961.f2530) {
                short s = c2280.readShort();
                short s2 = c2280.readShort();
                C0666 c0666M2620 = C0666.m2620(s, this.f10988);
                C0666 c0666M26202 = C0666.m2620(s2, this.f10988);
                HashMap[] mapArr = this.f10996;
                mapArr[0].put("ImageLength", c0666M2620);
                mapArr[0].put("ImageWidth", c0666M26202);
                return;
            }
            c2280.m5981(unsignedShort2);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:17:0x007c  */
    /* JADX WARN: Removed duplicated region for block: B:96:0x01a7  */
    /* renamed from: ᵞʡ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m6961(defpackage.C1157 r34, int r35) throws java.io.IOException {
        /*
            Method dump skipped, instructions count: 660
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C2845.m6961(ˉˆ, int):void");
    }

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final void m6962(C1157 c1157, int i) throws Throwable {
        C0666 c0666M2620;
        C0666 c0666M26202;
        HashMap[] mapArr = this.f10996;
        C0666 c0666 = (C0666) mapArr[i].get("DefaultCropSize");
        C0666 c06662 = (C0666) mapArr[i].get("SensorTopBorder");
        C0666 c06663 = (C0666) mapArr[i].get("SensorLeftBorder");
        C0666 c06664 = (C0666) mapArr[i].get("SensorBottomBorder");
        C0666 c06665 = (C0666) mapArr[i].get("SensorRightBorder");
        if (c0666 != null) {
            int i2 = c0666.f3301;
            ByteOrder byteOrder = this.f10988;
            if (i2 == 5) {
                C2080[] c2080Arr = (C2080[]) c0666.m2624(byteOrder);
                if (c2080Arr == null || c2080Arr.length != 2) {
                    Arrays.toString(c2080Arr);
                    return;
                } else {
                    c0666M2620 = C0666.m2622(c2080Arr[0], this.f10988);
                    c0666M26202 = C0666.m2622(c2080Arr[1], this.f10988);
                }
            } else {
                int[] iArr = (int[]) c0666.m2624(byteOrder);
                if (iArr == null || iArr.length != 2) {
                    Arrays.toString(iArr);
                    return;
                } else {
                    c0666M2620 = C0666.m2620(iArr[0], this.f10988);
                    c0666M26202 = C0666.m2620(iArr[1], this.f10988);
                }
            }
            mapArr[i].put("ImageWidth", c0666M2620);
            mapArr[i].put("ImageLength", c0666M26202);
            return;
        }
        if (c06662 != null && c06663 != null && c06664 != null && c06665 != null) {
            int iM2623 = c06662.m2623(this.f10988);
            int iM26232 = c06664.m2623(this.f10988);
            int iM26233 = c06665.m2623(this.f10988);
            int iM26234 = c06663.m2623(this.f10988);
            if (iM26232 <= iM2623 || iM26233 <= iM26234) {
                return;
            }
            C0666 c0666M26203 = C0666.m2620(iM26232 - iM2623, this.f10988);
            C0666 c0666M26204 = C0666.m2620(iM26233 - iM26234, this.f10988);
            mapArr[i].put("ImageLength", c0666M26203);
            mapArr[i].put("ImageWidth", c0666M26204);
            return;
        }
        C0666 c06666 = (C0666) mapArr[i].get("ImageLength");
        C0666 c06667 = (C0666) mapArr[i].get("ImageWidth");
        if (c06666 == null || c06667 == null) {
            C0666 c06668 = (C0666) mapArr[i].get("JPEGInterchangeFormat");
            C0666 c06669 = (C0666) mapArr[i].get("JPEGInterchangeFormatLength");
            if (c06668 == null || c06669 == null) {
                return;
            }
            int iM26235 = c06668.m2623(this.f10988);
            int iM26236 = c06668.m2623(this.f10988);
            c1157.m3652(iM26235);
            byte[] bArr = new byte[iM26236];
            c1157.read(bArr);
            m6953(new C2280(bArr), iM26235, i);
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m6963() {
        String strM6969 = m6969("DateTimeOriginal");
        HashMap[] mapArr = this.f10996;
        if (strM6969 != null && m6969("DateTime") == null) {
            HashMap map = mapArr[0];
            byte[] bytes = strM6969.concat("\u0000").getBytes(f10985);
            map.put("DateTime", new C0666(bytes, 2, bytes.length));
        }
        if (m6969("ImageWidth") == null) {
            mapArr[0].put("ImageWidth", C0666.m2621(0L, this.f10988));
        }
        if (m6969("ImageLength") == null) {
            mapArr[0].put("ImageLength", C0666.m2621(0L, this.f10988));
        }
        if (m6969("Orientation") == null) {
            mapArr[0].put("Orientation", C0666.m2621(0L, this.f10988));
        }
        if (m6969("LightSource") == null) {
            mapArr[1].put("LightSource", C0666.m2621(0L, this.f10988));
        }
    }

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final void m6964(int i, int i2) throws Throwable {
        HashMap[] mapArr = this.f10996;
        if (mapArr[i].isEmpty() || mapArr[i2].isEmpty()) {
            return;
        }
        C0666 c0666 = (C0666) mapArr[i].get("ImageLength");
        C0666 c06662 = (C0666) mapArr[i].get("ImageWidth");
        C0666 c06663 = (C0666) mapArr[i2].get("ImageLength");
        C0666 c06664 = (C0666) mapArr[i2].get("ImageWidth");
        if (c0666 == null || c06662 == null || c06663 == null || c06664 == null) {
            return;
        }
        int iM2623 = c0666.m2623(this.f10988);
        int iM26232 = c06662.m2623(this.f10988);
        int iM26233 = c06663.m2623(this.f10988);
        int iM26234 = c06664.m2623(this.f10988);
        if (iM2623 >= iM26233 || iM26232 >= iM26234) {
            return;
        }
        HashMap map = mapArr[i];
        mapArr[i] = mapArr[i2];
        mapArr[i2] = map;
    }

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public final void m6965(int i, String str, String str2) {
        HashMap[] mapArr = this.f10996;
        if (mapArr[i].isEmpty() || mapArr[i].get(str) == null) {
            return;
        }
        HashMap map = mapArr[i];
        map.put(str2, map.get(str));
        mapArr[i].remove(str);
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final boolean m6966(HashMap map) {
        C0666 c0666 = (C0666) map.get("ImageLength");
        C0666 c06662 = (C0666) map.get("ImageWidth");
        if (c0666 == null || c06662 == null) {
            return false;
        }
        return c0666.m2623(this.f10988) <= 512 && c06662.m2623(this.f10988) <= 512;
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final void m6967(C2280 c2280, HashMap map) throws Throwable {
        C0666 c0666 = (C0666) map.get("JPEGInterchangeFormat");
        C0666 c06662 = (C0666) map.get("JPEGInterchangeFormatLength");
        if (c0666 == null || c06662 == null) {
            return;
        }
        int iM2623 = c0666.m2623(this.f10988);
        int iM26232 = c06662.m2623(this.f10988);
        if (this.f10989 == 7) {
            iM2623 += this.f10990;
        }
        if (iM2623 <= 0 || iM26232 <= 0 || this.f10992 != null || this.f10991 != null) {
            return;
        }
        c2280.skip(iM2623);
        c2280.read(new byte[iM26232]);
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final void m6968(C1157 c1157) throws IOException {
        ByteOrder byteOrderM6952 = m6952(c1157);
        this.f10988 = byteOrderM6952;
        c1157.f8914 = byteOrderM6952;
        int unsignedShort = c1157.readUnsignedShort();
        int i = this.f10989;
        if (i != 7 && i != 10 && unsignedShort != 42) {
            ᵨᴵᵺ.ᵸʓᵠ(Integer.toHexString(unsignedShort), "Invalid start code: ");
            return;
        }
        int i2 = c1157.readInt();
        if (i2 < 8) {
            C0910.m3045(AbstractC2990.m7313(i2, "Invalid first Ifd offset: "));
            return;
        }
        int i3 = i2 - 8;
        if (i3 > 0) {
            c1157.m5981(i3);
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final String m6969(String str) {
        C0666 c0666M6958 = m6958(str);
        if (c0666M6958 != null) {
            if (!f10980.contains(str)) {
                return c0666M6958.m2625(this.f10988);
            }
            if (str.equals("GPSTimeStamp")) {
                int i = c0666M6958.f3301;
                if (i == 5 || i == 10) {
                    C2080[] c2080Arr = (C2080[]) c0666M6958.m2624(this.f10988);
                    if (c2080Arr == null || c2080Arr.length != 3) {
                        Arrays.toString(c2080Arr);
                        return null;
                    }
                    C2080 c2080 = c2080Arr[0];
                    Integer numValueOf = Integer.valueOf((int) (c2080.f8263 / c2080.f8264));
                    C2080 c20802 = c2080Arr[1];
                    Integer numValueOf2 = Integer.valueOf((int) (c20802.f8263 / c20802.f8264));
                    C2080 c20803 = c2080Arr[2];
                    return String.format("%02d:%02d:%02d", numValueOf, numValueOf2, Integer.valueOf((int) (c20803.f8263 / c20803.f8264)));
                }
            } else {
                try {
                    return Double.toString(c0666M6958.m2626(this.f10988));
                } catch (NumberFormatException unused) {
                }
            }
        }
        return null;
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final void m6970(C1157 c1157) throws Throwable {
        m6968(c1157);
        m6961(c1157, 0);
        m6962(c1157, 0);
        m6962(c1157, 5);
        m6962(c1157, 4);
        m6975();
        if (this.f10989 == 8) {
            HashMap[] mapArr = this.f10996;
            C0666 c0666 = (C0666) mapArr[1].get("MakerNote");
            if (c0666 != null) {
                C1157 c11572 = new C1157(c0666.f3303);
                c11572.f8914 = this.f10988;
                c11572.m5981(6);
                m6961(c11572, 9);
                C0666 c06662 = (C0666) mapArr[9].get("ColorSpace");
                if (c06662 != null) {
                    mapArr[1].put("ColorSpace", c06662);
                }
            }
        }
    }

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public final void m6971(int i, byte[] bArr) throws IOException {
        C1157 c1157 = new C1157(bArr);
        m6968(c1157);
        m6961(c1157, i);
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final void m6972(C1157 c1157) throws Throwable {
        if (f10960) {
            Objects.toString(c1157);
        }
        m6970(c1157);
        HashMap[] mapArr = this.f10996;
        C0666 c0666 = (C0666) mapArr[0].get("JpgFromRaw");
        if (c0666 != null) {
            m6953(new C2280(c0666.f3303), (int) c0666.f3300, 5);
        }
        C0666 c06662 = (C0666) mapArr[0].get("ISO");
        C0666 c06663 = (C0666) mapArr[1].get("PhotographicSensitivity");
        if (c06662 == null || c06663 != null) {
            return;
        }
        mapArr[1].put("PhotographicSensitivity", c06662);
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final void m6973(C2280 c2280) throws Throwable {
        if (f10960) {
            Objects.toString(c2280);
        }
        c2280.f8914 = ByteOrder.BIG_ENDIAN;
        byte[] bArr = f10963;
        c2280.m5981(bArr.length);
        int length = bArr.length;
        while (true) {
            try {
                int i = c2280.readInt();
                byte[] bArr2 = new byte[4];
                if (c2280.read(bArr2) != 4) {
                    throw new IOException("Encountered invalid length while parsing PNG chunktype");
                }
                int i2 = length + 8;
                if (i2 == 16 && !Arrays.equals(bArr2, f10971)) {
                    throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
                }
                if (Arrays.equals(bArr2, f10984)) {
                    return;
                }
                if (Arrays.equals(bArr2, f10974)) {
                    byte[] bArr3 = new byte[i];
                    if (c2280.read(bArr3) != i) {
                        throw new IOException("Failed to read given length for given PNG chunk type: " + AbstractC0220.m1509(bArr2));
                    }
                    int i3 = c2280.readInt();
                    CRC32 crc32 = new CRC32();
                    crc32.update(bArr2);
                    crc32.update(bArr3);
                    if (((int) crc32.getValue()) == i3) {
                        this.f10995 = i2;
                        m6971(0, bArr3);
                        m6975();
                        m6959(new C2280(bArr3));
                        return;
                    }
                    throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + i3 + ", calculated CRC value: " + crc32.getValue());
                }
                int i4 = i + 4;
                c2280.m5981(i4);
                length = i2 + i4;
            } catch (EOFException unused) {
                C0910.m3045("Encountered corrupt PNG file.");
                return;
            }
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m6974(C1157 c1157) throws IOException {
        String strExtractMetadata;
        String strExtractMetadata2;
        String strExtractMetadata3;
        if (Build.VERSION.SDK_INT < 28) {
            C0190.m1432("Reading EXIF from HEIF files is supported from SDK 28 and above");
            return;
        }
        MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
        try {
            try {
                AbstractC3384.m7761(mediaMetadataRetriever, new C0934(c1157));
                String strExtractMetadata4 = mediaMetadataRetriever.extractMetadata(33);
                String strExtractMetadata5 = mediaMetadataRetriever.extractMetadata(34);
                String strExtractMetadata6 = mediaMetadataRetriever.extractMetadata(26);
                String strExtractMetadata7 = mediaMetadataRetriever.extractMetadata(17);
                if ("yes".equals(strExtractMetadata6)) {
                    strExtractMetadata = mediaMetadataRetriever.extractMetadata(29);
                    strExtractMetadata2 = mediaMetadataRetriever.extractMetadata(30);
                    strExtractMetadata3 = mediaMetadataRetriever.extractMetadata(31);
                } else if ("yes".equals(strExtractMetadata7)) {
                    strExtractMetadata = mediaMetadataRetriever.extractMetadata(18);
                    strExtractMetadata2 = mediaMetadataRetriever.extractMetadata(19);
                    strExtractMetadata3 = mediaMetadataRetriever.extractMetadata(24);
                } else {
                    strExtractMetadata = null;
                    strExtractMetadata2 = null;
                    strExtractMetadata3 = null;
                }
                HashMap[] mapArr = this.f10996;
                if (strExtractMetadata != null) {
                    mapArr[0].put("ImageWidth", C0666.m2620(Integer.parseInt(strExtractMetadata), this.f10988));
                }
                if (strExtractMetadata2 != null) {
                    mapArr[0].put("ImageLength", C0666.m2620(Integer.parseInt(strExtractMetadata2), this.f10988));
                }
                if (strExtractMetadata3 != null) {
                    int i = Integer.parseInt(strExtractMetadata3);
                    mapArr[0].put("Orientation", C0666.m2620(i != 90 ? i != 180 ? i != 270 ? 1 : 8 : 3 : 6, this.f10988));
                }
                if (strExtractMetadata4 != null && strExtractMetadata5 != null) {
                    int i2 = Integer.parseInt(strExtractMetadata4);
                    int i3 = Integer.parseInt(strExtractMetadata5);
                    if (i3 <= 6) {
                        throw new IOException("Invalid exif length");
                    }
                    c1157.m3652(i2);
                    byte[] bArr = new byte[6];
                    if (c1157.read(bArr) != 6) {
                        throw new IOException("Can't read identifier");
                    }
                    int i4 = i2 + 6;
                    int i5 = i3 - 6;
                    if (!Arrays.equals(bArr, f10965)) {
                        throw new IOException("Invalid identifier");
                    }
                    byte[] bArr2 = new byte[i5];
                    if (c1157.read(bArr2) != i5) {
                        throw new IOException("Can't read exif");
                    }
                    this.f10995 = i4;
                    m6971(0, bArr2);
                }
                mediaMetadataRetriever.release();
            } catch (RuntimeException unused) {
                throw new UnsupportedOperationException("Failed to read EXIF from HEIF file. Given stream is either malformed or unsupported.");
            }
        } catch (Throwable th) {
            mediaMetadataRetriever.release();
            throw th;
        }
    }

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final void m6975() throws Throwable {
        m6964(0, 5);
        m6964(0, 4);
        m6964(5, 4);
        HashMap[] mapArr = this.f10996;
        C0666 c0666 = (C0666) mapArr[1].get("PixelXDimension");
        C0666 c06662 = (C0666) mapArr[1].get("PixelYDimension");
        if (c0666 != null && c06662 != null) {
            mapArr[0].put("ImageWidth", c0666);
            mapArr[0].put("ImageLength", c06662);
        }
        if (mapArr[4].isEmpty() && m6966(mapArr[5])) {
            mapArr[4] = mapArr[5];
            mapArr[5] = new HashMap();
        }
        m6966(mapArr[4]);
        m6965(0, "ThumbnailOrientation", "Orientation");
        m6965(0, "ThumbnailImageLength", "ImageLength");
        m6965(0, "ThumbnailImageWidth", "ImageWidth");
        m6965(5, "ThumbnailOrientation", "Orientation");
        m6965(5, "ThumbnailImageLength", "ImageLength");
        m6965(5, "ThumbnailImageWidth", "ImageWidth");
        m6965(4, "Orientation", "ThumbnailOrientation");
        m6965(4, "ImageLength", "ThumbnailImageLength");
        m6965(4, "ImageWidth", "ThumbnailImageWidth");
    }
}
