what-the-bank/sources/org/jmrtd/lds/iso19794/IrisImageInfo.java

136 lines
5.0 KiB
Java

package org.jmrtd.lds.iso19794;
import io.flutter.embedding.android.KeyboardMap;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.jmrtd.lds.AbstractImageInfo;
import org.jmrtd.lds.ImageInfo;
/* loaded from: classes6.dex */
public class IrisImageInfo extends AbstractImageInfo {
public static int IMAGE_QUAL_HIGH_HI = 100;
public static int IMAGE_QUAL_HIGH_LO = 76;
public static int IMAGE_QUAL_LOW_HI = 50;
public static int IMAGE_QUAL_LOW_LO = 26;
public static int IMAGE_QUAL_MED_HI = 75;
public static int IMAGE_QUAL_MED_LO = 51;
public static int IMAGE_QUAL_UNDEF = 254;
private static final int ROT_ANGLE_UNDEF = 65535;
private static final int ROT_UNCERTAIN_UNDEF = 65535;
private static final long serialVersionUID = 833541246115625112L;
private int imageFormat;
private int imageNumber;
private int quality;
private int rotationAngle;
private int rotationAngleUncertainty;
public IrisImageInfo(int i, int i2, int i3, int i4, int i5, int i6, InputStream inputStream, int i7, int i8) throws IOException {
super(3, i5, i6, inputStream, i7, getMimeTypeFromImageFormat(i8));
if (inputStream == null) {
throw new IllegalArgumentException("Null image bytes");
}
this.imageNumber = i;
this.quality = i2;
this.rotationAngle = i3;
this.rotationAngleUncertainty = i4;
}
public IrisImageInfo(int i, int i2, int i3, InputStream inputStream, int i4, int i5) throws IOException {
this(i, IMAGE_QUAL_UNDEF, 65535, 65535, i2, i3, inputStream, i4, i5);
}
/* JADX INFO: Access modifiers changed from: package-private */
public IrisImageInfo(InputStream inputStream, int i) throws IOException {
super(3);
this.imageFormat = i;
setMimeType(getMimeTypeFromImageFormat(i));
readObject(inputStream);
}
@Override // org.jmrtd.lds.AbstractImageInfo, org.jmrtd.lds.ImageInfo
public long getRecordLength() {
return getImageLength() + 11;
}
@Override // org.jmrtd.lds.AbstractImageInfo
public String toString() {
StringBuffer stringBuffer = new StringBuffer("IrisImageInfo [");
StringBuilder sb = new StringBuilder("image number: ");
sb.append(this.imageNumber);
sb.append(", ");
stringBuffer.append(sb.toString());
StringBuilder sb2 = new StringBuilder("quality: ");
sb2.append(this.quality);
sb2.append(", ");
stringBuffer.append(sb2.toString());
stringBuffer.append("image: ");
StringBuilder sb3 = new StringBuilder();
sb3.append(getWidth());
sb3.append(" x ");
sb3.append(getHeight());
stringBuffer.append(sb3.toString());
StringBuilder sb4 = new StringBuilder("mime-type: ");
sb4.append(getMimeTypeFromImageFormat(this.imageFormat));
stringBuffer.append(sb4.toString());
stringBuffer.append("]");
return stringBuffer.toString();
}
@Override // org.jmrtd.lds.AbstractImageInfo
public void readObject(InputStream inputStream) throws IOException {
DataInputStream dataInputStream = inputStream instanceof DataInputStream ? (DataInputStream) inputStream : new DataInputStream(inputStream);
this.imageNumber = dataInputStream.readUnsignedShort();
this.quality = dataInputStream.readUnsignedByte();
this.rotationAngle = dataInputStream.readShort();
this.rotationAngleUncertainty = dataInputStream.readUnsignedShort();
readImage(inputStream, dataInputStream.readInt() & KeyboardMap.kValueMask);
}
@Override // org.jmrtd.lds.AbstractImageInfo
public void writeObject(OutputStream outputStream) throws IOException {
DataOutputStream dataOutputStream = outputStream instanceof DataOutputStream ? (DataOutputStream) outputStream : new DataOutputStream(outputStream);
dataOutputStream.writeShort(this.imageNumber);
dataOutputStream.writeByte(this.quality);
dataOutputStream.writeShort(this.rotationAngle);
dataOutputStream.writeShort(this.rotationAngleUncertainty);
dataOutputStream.writeInt(getImageLength());
writeImage(dataOutputStream);
}
public int getRotationAngleUncertainty() {
return this.rotationAngleUncertainty;
}
public int getRotationAngle() {
return this.rotationAngle;
}
public int getQuality() {
return this.quality;
}
public int getImageNumber() {
return this.imageNumber;
}
public int getImageFormat() {
return this.imageFormat;
}
private static String getMimeTypeFromImageFormat(int i) {
if (i == 2 || i == 4) {
return ImageInfo.WSQ_MIME_TYPE;
}
if (i == 6 || i == 8 || i == 10 || i == 12) {
return ImageInfo.JPEG_MIME_TYPE;
}
if (i == 14 || i == 16) {
return ImageInfo.JPEG2000_MIME_TYPE;
}
return null;
}
}