PDF417CodewordDecoder.smali

.class final Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;
.super Ljava/lang/Object;
.source "PDF417CodewordDecoder.java"


# static fields
.field private static final RATIOS_TABLE:[[F


# direct methods
.method static constructor <clinit>()V
    .registers 10

    .line 28
    sget-object v0, Lcom/google/zxing/pdf417/PDF417Common;->SYMBOL_TABLE:[I

    array-length v0, v0

    const/4 v1, 0x2

    new-array v1, v1, [I

    const/16 v2, 0x8

    const/4 v3, 0x1

    aput v2, v1, v3

    const/4 v4, 0x0

    aput v0, v1, v4

    const-class v0, F

    invoke-static {v0, v1}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [[F

    sput-object v0, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->RATIOS_TABLE:[[F

    .line 33
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_19
    sget-object v1, Lcom/google/zxing/pdf417/PDF417Common;->SYMBOL_TABLE:[I

    array-length v1, v1

    if-ge v0, v1, :cond_47

    .line 34
    sget-object v1, Lcom/google/zxing/pdf417/PDF417Common;->SYMBOL_TABLE:[I

    aget v1, v1, v0

    .line 35
    .local v4, "currentSymbol":I
    move v4, v1

    and-int/2addr v1, v3

    .line 36
    .local v1, "currentBit":I
    const/4 v5, 0x0

    .local v5, "j":I
    :goto_25
    if-ge v5, v2, :cond_44

    .line 37
    const/4 v6, 0x0

    .line 38
    .local v6, "size":F
    :goto_28
    and-int/lit8 v7, v4, 0x1

    if-ne v7, v1, :cond_32

    .line 39
    const/high16 v7, 0x3f800000    # 1.0f

    add-float/2addr v6, v7

    .line 40
    shr-int/lit8 v4, v4, 0x1

    goto :goto_28

    .line 42
    :cond_32
    and-int/lit8 v1, v4, 0x1

    .line 43
    sget-object v7, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->RATIOS_TABLE:[[F

    aget-object v7, v7, v0

    rsub-int/lit8 v8, v5, 0x8

    sub-int/2addr v8, v3

    const/high16 v9, 0x41880000    # 17.0f

    div-float v9, v6, v9

    aput v9, v7, v8

    .line 36
    .end local v6    # "size":F
    add-int/lit8 v5, v5, 0x1

    goto :goto_25

    .line 33
    .end local v1    # "currentBit":I
    .end local v4    # "currentSymbol":I
    .end local v5    # "j":I
    :cond_44
    add-int/lit8 v0, v0, 0x1

    goto :goto_19

    .line 46
    .end local v0    # "i":I
    :cond_47
    return-void
.end method

.method private constructor <init>()V
    .registers 1

    .line 48
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 49
    return-void
.end method

.method private static getBitValue([I)I
    .registers 10
    .param p0, "moduleBitCount"    # [I

    .line 83
    const-wide/16 v0, 0x0

    .line 84
    .local v0, "result":J
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_3
    array-length v3, p0

    if-ge v2, v3, :cond_1d

    .line 85
    const/4 v3, 0x0

    .local v3, "bit":I
    :goto_7
    aget v4, p0, v2

    if-ge v3, v4, :cond_1a

    .line 86
    const/4 v4, 0x1

    shl-long v5, v0, v4

    rem-int/lit8 v7, v2, 0x2

    if-nez v7, :cond_13

    goto :goto_14

    :cond_13
    const/4 v4, 0x0

    :goto_14
    int-to-long v7, v4

    or-long v0, v5, v7

    .line 85
    add-int/lit8 v3, v3, 0x1

    goto :goto_7

    .line 84
    .end local v3    # "bit":I
    :cond_1a
    add-int/lit8 v2, v2, 0x1

    goto :goto_3

    .line 89
    .end local v2    # "i":I
    :cond_1d
    long-to-int v2, v0

    return v2
.end method

.method private static getClosestDecodedValue([I)I
    .registers 12
    .param p0, "moduleBitCount"    # [I

    .line 93
    invoke-static {p0}, Lcom/google/zxing/common/detector/MathUtils;->sum([I)I

    move-result v0

    .line 94
    .local v0, "bitCountSum":I
    const/16 v1, 0x8

    new-array v2, v1, [F

    .line 95
    .local v2, "bitCountRatios":[F
    const/4 v3, 0x1

    if-le v0, v3, :cond_18

    .line 96
    const/4 v3, 0x0

    .local v3, "i":I
    :goto_c
    if-ge v3, v1, :cond_18

    .line 97
    aget v4, p0, v3

    int-to-float v4, v4

    int-to-float v5, v0

    div-float/2addr v4, v5

    aput v4, v2, v3

    .line 96
    add-int/lit8 v3, v3, 0x1

    goto :goto_c

    .line 100
    .end local v3    # "i":I
    :cond_18
    const v3, 0x7f7fffff    # Float.MAX_VALUE

    .line 101
    .local v3, "bestMatchError":F
    const/4 v4, -0x1

    .line 102
    .local v4, "bestMatch":I
    const/4 v5, 0x0

    .local v5, "j":I
    :goto_1d
    sget-object v6, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->RATIOS_TABLE:[[F

    array-length v7, v6

    if-ge v5, v7, :cond_44

    .line 103
    const/4 v7, 0x0

    .line 104
    .local v7, "error":F
    aget-object v6, v6, v5

    .line 105
    .local v6, "ratioTableRow":[F
    const/4 v8, 0x0

    .local v8, "k":I
    :goto_26
    if-ge v8, v1, :cond_38

    .line 106
    aget v9, v6, v8

    aget v10, v2, v8

    sub-float/2addr v9, v10

    .line 107
    .local v9, "diff":F
    mul-float v10, v9, v9

    add-float/2addr v10, v7

    .line 108
    move v7, v10

    cmpl-float v10, v10, v3

    if-gez v10, :cond_38

    .line 105
    .end local v9    # "diff":F
    add-int/lit8 v8, v8, 0x1

    goto :goto_26

    .line 112
    .end local v8    # "k":I
    :cond_38
    cmpg-float v8, v7, v3

    if-gez v8, :cond_41

    .line 113
    move v3, v7

    .line 114
    sget-object v8, Lcom/google/zxing/pdf417/PDF417Common;->SYMBOL_TABLE:[I

    aget v4, v8, v5

    .line 102
    .end local v6    # "ratioTableRow":[F
    .end local v7    # "error":F
    :cond_41
    add-int/lit8 v5, v5, 0x1

    goto :goto_1d

    .line 117
    .end local v5    # "j":I
    :cond_44
    return v4
.end method

.method private static getDecodedCodewordValue([I)I
    .registers 4
    .param p0, "moduleBitCount"    # [I

    .line 78
    invoke-static {p0}, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->getBitValue([I)I

    move-result v0

    const/4 v1, 0x0

    .line 79
    .local v1, "decodedValue":I
    move v1, v0

    invoke-static {v0}, Lcom/google/zxing/pdf417/PDF417Common;->getCodeword(I)I

    move-result v0

    const/4 v2, -0x1

    if-ne v0, v2, :cond_e

    return v2

    :cond_e
    return v1
.end method

.method static getDecodedValue([I)I
    .registers 4
    .param p0, "moduleBitCount"    # [I

    .line 52
    invoke-static {p0}, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->sampleBitCounts([I)[I

    move-result-object v0

    invoke-static {v0}, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->getDecodedCodewordValue([I)I

    move-result v0

    const/4 v1, 0x0

    .line 53
    .local v1, "decodedValue":I
    move v1, v0

    const/4 v2, -0x1

    if-eq v0, v2, :cond_e

    .line 54
    return v1

    .line 56
    :cond_e
    invoke-static {p0}, Lcom/google/zxing/pdf417/decoder/PDF417CodewordDecoder;->getClosestDecodedValue([I)I

    move-result v0

    return v0
.end method

.method private static sampleBitCounts([I)[I
    .registers 9
    .param p0, "moduleBitCount"    # [I

    .line 60
    invoke-static {p0}, Lcom/google/zxing/common/detector/MathUtils;->sum([I)I

    move-result v0

    int-to-float v0, v0

    .line 61
    .local v0, "bitCountSum":F
    const/16 v1, 0x8

    new-array v1, v1, [I

    .line 62
    .local v1, "result":[I
    const/4 v2, 0x0

    .line 63
    .local v2, "bitCountIndex":I
    const/4 v3, 0x0

    .line 64
    .local v3, "sumPreviousBits":I
    const/4 v4, 0x0

    .local v4, "i":I
    :goto_c
    const/16 v5, 0x11

    if-ge v4, v5, :cond_31

    .line 65
    const/high16 v5, 0x42080000    # 34.0f

    div-float v5, v0, v5

    int-to-float v6, v4

    mul-float v6, v6, v0

    const/high16 v7, 0x41880000    # 17.0f

    div-float/2addr v6, v7

    add-float/2addr v5, v6

    .line 68
    .local v5, "sampleIndex":F
    aget v6, p0, v2

    add-int/2addr v6, v3

    int-to-float v6, v6

    cmpg-float v6, v6, v5

    if-gtz v6, :cond_28

    .line 69
    aget v6, p0, v2

    add-int/2addr v3, v6

    .line 70
    add-int/lit8 v2, v2, 0x1

    .line 72
    :cond_28
    aget v6, v1, v2

    add-int/lit8 v6, v6, 0x1

    aput v6, v1, v2

    .line 64
    .end local v5    # "sampleIndex":F
    add-int/lit8 v4, v4, 0x1

    goto :goto_c

    .line 74
    .end local v4    # "i":I
    :cond_31
    return-object v1
.end method