QRCodeReader.smali
.class public Lcom/google/zxing/qrcode/QRCodeReader;
.super Ljava/lang/Object;
.source "QRCodeReader.java"
# interfaces
.implements Lcom/google/zxing/Reader;
# static fields
.field private static final NO_POINTS:[Lcom/google/zxing/ResultPoint;
# instance fields
.field private final decoder:Lcom/google/zxing/qrcode/decoder/Decoder;
# direct methods
.method static constructor <clinit>()V
.registers 1
const/4 v0, 0x0
new-array v0, v0, [Lcom/google/zxing/ResultPoint;
.line 46
sput-object v0, Lcom/google/zxing/qrcode/QRCodeReader;->NO_POINTS:[Lcom/google/zxing/ResultPoint;
return-void
.end method
.method public constructor <init>()V
.registers 2
.line 44
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 48
new-instance v0, Lcom/google/zxing/qrcode/decoder/Decoder;
invoke-direct {v0}, Lcom/google/zxing/qrcode/decoder/Decoder;-><init>()V
iput-object v0, p0, Lcom/google/zxing/qrcode/QRCodeReader;->decoder:Lcom/google/zxing/qrcode/decoder/Decoder;
return-void
.end method
.method private static extractPureBits(Lcom/google/zxing/common/BitMatrix;)Lcom/google/zxing/common/BitMatrix;
.registers 12
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/NotFoundException;
}
.end annotation
.line 120
invoke-virtual {p0}, Lcom/google/zxing/common/BitMatrix;->getTopLeftOnBit()[I
move-result-object v0
.line 121
invoke-virtual {p0}, Lcom/google/zxing/common/BitMatrix;->getBottomRightOnBit()[I
move-result-object v1
if-eqz v0, :cond_a9
if-eqz v1, :cond_a9
.line 126
invoke-static {v0, p0}, Lcom/google/zxing/qrcode/QRCodeReader;->moduleSize([ILcom/google/zxing/common/BitMatrix;)F
move-result v2
const/4 v3, 0x1
.line 128
aget v4, v0, v3
.line 129
aget v5, v1, v3
const/4 v6, 0x0
.line 130
aget v0, v0, v6
.line 131
aget v1, v1, v6
if-ge v0, v1, :cond_a4
if-ge v4, v5, :cond_a4
sub-int v7, v5, v4
sub-int v8, v1, v0
if-eq v7, v8, :cond_32
add-int v1, v0, v7
.line 142
invoke-virtual {p0}, Lcom/google/zxing/common/BitMatrix;->getWidth()I
move-result v8
if-ge v1, v8, :cond_2d
goto :goto_32
.line 144
:cond_2d
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
:cond_32
:goto_32
sub-int v8, v1, v0
add-int/2addr v8, v3
int-to-float v8, v8
div-float/2addr v8, v2
.line 148
invoke-static {v8}, Ljava/lang/Math;->round(F)I
move-result v8
add-int/2addr v7, v3
int-to-float v3, v7
div-float/2addr v3, v2
.line 149
invoke-static {v3}, Ljava/lang/Math;->round(F)I
move-result v3
if-lez v8, :cond_9f
if-lez v3, :cond_9f
if-ne v3, v8, :cond_9a
const/high16 v7, 0x40000000 # 2.0f
div-float v7, v2, v7
float-to-int v7, v7
add-int/2addr v4, v7
add-int/2addr v0, v7
add-int/lit8 v9, v8, -0x1
int-to-float v9, v9
mul-float v9, v9, v2
float-to-int v9, v9
add-int/2addr v9, v0
sub-int/2addr v9, v1
if-lez v9, :cond_62
if-gt v9, v7, :cond_5d
sub-int/2addr v0, v9
goto :goto_62
.line 172
:cond_5d
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
:cond_62
:goto_62
add-int/lit8 v1, v3, -0x1
int-to-float v1, v1
mul-float v1, v1, v2
float-to-int v1, v1
add-int/2addr v1, v4
sub-int/2addr v1, v5
if-lez v1, :cond_75
if-gt v1, v7, :cond_70
sub-int/2addr v4, v1
goto :goto_75
.line 181
:cond_70
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
.line 187
:cond_75
:goto_75
new-instance v1, Lcom/google/zxing/common/BitMatrix;
invoke-direct {v1, v8, v3}, Lcom/google/zxing/common/BitMatrix;-><init>(II)V
const/4 v5, 0x0
:goto_7b
if-ge v5, v3, :cond_99
int-to-float v7, v5
mul-float v7, v7, v2
float-to-int v7, v7
add-int/2addr v7, v4
const/4 v9, 0x0
:goto_83
if-ge v9, v8, :cond_96
int-to-float v10, v9
mul-float v10, v10, v2
float-to-int v10, v10
add-int/2addr v10, v0
.line 191
invoke-virtual {p0, v10, v7}, Lcom/google/zxing/common/BitMatrix;->get(II)Z
move-result v10
if-eqz v10, :cond_93
.line 192
invoke-virtual {v1, v9, v5}, Lcom/google/zxing/common/BitMatrix;->set(II)V
:cond_93
add-int/lit8 v9, v9, 0x1
goto :goto_83
:cond_96
add-int/lit8 v5, v5, 0x1
goto :goto_7b
:cond_99
return-object v1
.line 155
:cond_9a
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
.line 151
:cond_9f
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
.line 135
:cond_a4
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
.line 123
:cond_a9
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
.end method
.method private static moduleSize([ILcom/google/zxing/common/BitMatrix;)F
.registers 10
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/NotFoundException;
}
.end annotation
.line 200
invoke-virtual {p1}, Lcom/google/zxing/common/BitMatrix;->getHeight()I
move-result v0
.line 201
invoke-virtual {p1}, Lcom/google/zxing/common/BitMatrix;->getWidth()I
move-result v1
const/4 v2, 0x0
.line 202
aget v3, p0, v2
const/4 v4, 0x1
.line 203
aget v5, p0, v4
const/4 v6, 0x0
:goto_f
if-ge v3, v1, :cond_25
if-ge v5, v0, :cond_25
.line 207
invoke-virtual {p1, v3, v5}, Lcom/google/zxing/common/BitMatrix;->get(II)Z
move-result v7
if-eq v4, v7, :cond_20
add-int/lit8 v6, v6, 0x1
const/4 v7, 0x5
if-eq v6, v7, :cond_25
xor-int/lit8 v4, v4, 0x1
:cond_20
add-int/lit8 v3, v3, 0x1
add-int/lit8 v5, v5, 0x1
goto :goto_f
:cond_25
if-eq v3, v1, :cond_31
if-eq v5, v0, :cond_31
.line 219
aget p0, p0, v2
sub-int/2addr v3, p0
int-to-float p0, v3
const/high16 p1, 0x40e00000 # 7.0f
div-float/2addr p0, p1
return p0
.line 217
:cond_31
invoke-static {}, Lcom/google/zxing/NotFoundException;->getNotFoundInstance()Lcom/google/zxing/NotFoundException;
move-result-object p0
throw p0
.end method
# virtual methods
.method public decode(Lcom/google/zxing/BinaryBitmap;)Lcom/google/zxing/Result;
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/NotFoundException;,
Lcom/google/zxing/ChecksumException;,
Lcom/google/zxing/FormatException;
}
.end annotation
const/4 v0, 0x0
.line 64
invoke-virtual {p0, p1, v0}, Lcom/google/zxing/qrcode/QRCodeReader;->decode(Lcom/google/zxing/BinaryBitmap;Ljava/util/Map;)Lcom/google/zxing/Result;
move-result-object p1
return-object p1
.end method
.method public final decode(Lcom/google/zxing/BinaryBitmap;Ljava/util/Map;)Lcom/google/zxing/Result;
.registers 8
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/google/zxing/BinaryBitmap;",
"Ljava/util/Map<",
"Lcom/google/zxing/DecodeHintType;",
"*>;)",
"Lcom/google/zxing/Result;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/NotFoundException;,
Lcom/google/zxing/ChecksumException;,
Lcom/google/zxing/FormatException;
}
.end annotation
if-eqz p2, :cond_1b
.line 72
sget-object v0, Lcom/google/zxing/DecodeHintType;->PURE_BARCODE:Lcom/google/zxing/DecodeHintType;
invoke-interface {p2, v0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1b
.line 73
invoke-virtual {p1}, Lcom/google/zxing/BinaryBitmap;->getBlackMatrix()Lcom/google/zxing/common/BitMatrix;
move-result-object p1
invoke-static {p1}, Lcom/google/zxing/qrcode/QRCodeReader;->extractPureBits(Lcom/google/zxing/common/BitMatrix;)Lcom/google/zxing/common/BitMatrix;
move-result-object p1
.line 74
iget-object v0, p0, Lcom/google/zxing/qrcode/QRCodeReader;->decoder:Lcom/google/zxing/qrcode/decoder/Decoder;
invoke-virtual {v0, p1, p2}, Lcom/google/zxing/qrcode/decoder/Decoder;->decode(Lcom/google/zxing/common/BitMatrix;Ljava/util/Map;)Lcom/google/zxing/common/DecoderResult;
move-result-object p1
.line 75
sget-object p2, Lcom/google/zxing/qrcode/QRCodeReader;->NO_POINTS:[Lcom/google/zxing/ResultPoint;
goto :goto_39
.line 77
:cond_1b
new-instance v0, Lcom/google/zxing/qrcode/detector/Detector;
invoke-virtual {p1}, Lcom/google/zxing/BinaryBitmap;->getBlackMatrix()Lcom/google/zxing/common/BitMatrix;
move-result-object p1
invoke-direct {v0, p1}, Lcom/google/zxing/qrcode/detector/Detector;-><init>(Lcom/google/zxing/common/BitMatrix;)V
invoke-virtual {v0, p2}, Lcom/google/zxing/qrcode/detector/Detector;->detect(Ljava/util/Map;)Lcom/google/zxing/common/DetectorResult;
move-result-object p1
.line 78
iget-object v0, p0, Lcom/google/zxing/qrcode/QRCodeReader;->decoder:Lcom/google/zxing/qrcode/decoder/Decoder;
invoke-virtual {p1}, Lcom/google/zxing/common/DetectorResult;->getBits()Lcom/google/zxing/common/BitMatrix;
move-result-object v1
invoke-virtual {v0, v1, p2}, Lcom/google/zxing/qrcode/decoder/Decoder;->decode(Lcom/google/zxing/common/BitMatrix;Ljava/util/Map;)Lcom/google/zxing/common/DecoderResult;
move-result-object p2
.line 79
invoke-virtual {p1}, Lcom/google/zxing/common/DetectorResult;->getPoints()[Lcom/google/zxing/ResultPoint;
move-result-object p1
move-object v4, p2
move-object p2, p1
move-object p1, v4
.line 83
:goto_39
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getOther()Ljava/lang/Object;
move-result-object v0
instance-of v0, v0, Lcom/google/zxing/qrcode/decoder/QRCodeDecoderMetaData;
if-eqz v0, :cond_4a
.line 84
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getOther()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/google/zxing/qrcode/decoder/QRCodeDecoderMetaData;
invoke-virtual {v0, p2}, Lcom/google/zxing/qrcode/decoder/QRCodeDecoderMetaData;->applyMirroredCorrection([Lcom/google/zxing/ResultPoint;)V
.line 87
:cond_4a
new-instance v0, Lcom/google/zxing/Result;
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getText()Ljava/lang/String;
move-result-object v1
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getRawBytes()[B
move-result-object v2
sget-object v3, Lcom/google/zxing/BarcodeFormat;->QR_CODE:Lcom/google/zxing/BarcodeFormat;
invoke-direct {v0, v1, v2, p2, v3}, Lcom/google/zxing/Result;-><init>(Ljava/lang/String;[B[Lcom/google/zxing/ResultPoint;Lcom/google/zxing/BarcodeFormat;)V
.line 88
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getByteSegments()Ljava/util/List;
move-result-object p2
if-eqz p2, :cond_64
.line 90
sget-object v1, Lcom/google/zxing/ResultMetadataType;->BYTE_SEGMENTS:Lcom/google/zxing/ResultMetadataType;
invoke-virtual {v0, v1, p2}, Lcom/google/zxing/Result;->putMetadata(Lcom/google/zxing/ResultMetadataType;Ljava/lang/Object;)V
.line 92
:cond_64
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getECLevel()Ljava/lang/String;
move-result-object p2
if-eqz p2, :cond_6f
.line 94
sget-object v1, Lcom/google/zxing/ResultMetadataType;->ERROR_CORRECTION_LEVEL:Lcom/google/zxing/ResultMetadataType;
invoke-virtual {v0, v1, p2}, Lcom/google/zxing/Result;->putMetadata(Lcom/google/zxing/ResultMetadataType;Ljava/lang/Object;)V
.line 96
:cond_6f
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->hasStructuredAppend()Z
move-result p2
if-eqz p2, :cond_8f
.line 97
sget-object p2, Lcom/google/zxing/ResultMetadataType;->STRUCTURED_APPEND_SEQUENCE:Lcom/google/zxing/ResultMetadataType;
.line 98
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getStructuredAppendSequenceNumber()I
move-result v1
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
.line 97
invoke-virtual {v0, p2, v1}, Lcom/google/zxing/Result;->putMetadata(Lcom/google/zxing/ResultMetadataType;Ljava/lang/Object;)V
.line 99
sget-object p2, Lcom/google/zxing/ResultMetadataType;->STRUCTURED_APPEND_PARITY:Lcom/google/zxing/ResultMetadataType;
.line 100
invoke-virtual {p1}, Lcom/google/zxing/common/DecoderResult;->getStructuredAppendParity()I
move-result p1
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p1
.line 99
invoke-virtual {v0, p2, p1}, Lcom/google/zxing/Result;->putMetadata(Lcom/google/zxing/ResultMetadataType;Ljava/lang/Object;)V
:cond_8f
return-object v0
.end method
.method protected final getDecoder()Lcom/google/zxing/qrcode/decoder/Decoder;
.registers 2
.line 51
iget-object v0, p0, Lcom/google/zxing/qrcode/QRCodeReader;->decoder:Lcom/google/zxing/qrcode/decoder/Decoder;
return-object v0
.end method
.method public reset()V
.registers 1
return-void
.end method