package com.google.zxing.qrcode.decoder;

import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
import java.util.Map;

public final class Decoder
{
  private final ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);

  private void correctErrors(byte[] paramArrayOfByte, int paramInt)
    throws ChecksumException
  {
    int i = paramArrayOfByte.length;
    int[] arrayOfInt = new int[i];
    int j = 0;
    int k;
    if (j >= i)
      k = paramArrayOfByte.length - paramInt;
    while (true)
    {
      int m;
      try
      {
        this.rsDecoder.decode(arrayOfInt, k);
        m = 0;
        if (m >= paramInt)
        {
          return;
          arrayOfInt[j] = (0xFF & paramArrayOfByte[j]);
          j++;
        }
      }
      catch (ReedSolomonException localReedSolomonException)
      {
        throw ChecksumException.getChecksumInstance();
      }
      paramArrayOfByte[m] = ((byte)arrayOfInt[m]);
      m++;
    }
  }

  private DecoderResult decode(BitMatrixParser paramBitMatrixParser, Map<DecodeHintType, ?> paramMap)
    throws FormatException, ChecksumException
  {
    Version localVersion = paramBitMatrixParser.readVersion();
    ErrorCorrectionLevel localErrorCorrectionLevel = paramBitMatrixParser.readFormatInformation().getErrorCorrectionLevel();
    DataBlock[] arrayOfDataBlock = DataBlock.getDataBlocks(paramBitMatrixParser.readCodewords(), localVersion, localErrorCorrectionLevel);
    int i = 0;
    int j = arrayOfDataBlock.length;
    byte[] arrayOfByte1;
    int m;
    int i1;
    for (int k = 0; ; k++)
    {
      if (k >= j)
      {
        arrayOfByte1 = new byte[i];
        m = 0;
        int n = arrayOfDataBlock.length;
        i1 = 0;
        if (i1 < n)
          break;
        return DecodedBitStreamParser.decode(arrayOfByte1, localVersion, localErrorCorrectionLevel, paramMap);
      }
      i += arrayOfDataBlock[k].getNumDataCodewords();
    }
    DataBlock localDataBlock = arrayOfDataBlock[i1];
    byte[] arrayOfByte2 = localDataBlock.getCodewords();
    int i2 = localDataBlock.getNumDataCodewords();
    correctErrors(arrayOfByte2, i2);
    int i3 = 0;
    int i5;
    for (int i4 = m; ; i4 = i5)
    {
      if (i3 >= i2)
      {
        i1++;
        m = i4;
        break;
      }
      i5 = i4 + 1;
      arrayOfByte1[i4] = arrayOfByte2[i3];
      i3++;
    }
  }

  public DecoderResult decode(BitMatrix paramBitMatrix)
    throws ChecksumException, FormatException
  {
    return decode(paramBitMatrix, null);
  }

  // ERROR //
  public DecoderResult decode(BitMatrix paramBitMatrix, Map<DecodeHintType, ?> paramMap)
    throws FormatException, ChecksumException
  {
    // Byte code:
    //   0: new 42	com/google/zxing/qrcode/decoder/BitMatrixParser
    //   3: dup
    //   4: aload_1
    //   5: invokespecial 87	com/google/zxing/qrcode/decoder/BitMatrixParser:<init>	(Lcom/google/zxing/common/BitMatrix;)V
    //   8: astore_3
    //   9: aconst_null
    //   10: astore 4
    //   12: aload_0
    //   13: aload_3
    //   14: aload_2
    //   15: invokespecial 89	com/google/zxing/qrcode/decoder/Decoder:decode	(Lcom/google/zxing/qrcode/decoder/BitMatrixParser;Ljava/util/Map;)Lcom/google/zxing/common/DecoderResult;
    //   18: astore 14
    //   20: aload 14
    //   22: areturn
    //   23: astore 13
    //   25: aload 13
    //   27: astore 6
    //   29: aload_3
    //   30: invokevirtual 92	com/google/zxing/qrcode/decoder/BitMatrixParser:remask	()V
    //   33: aload_3
    //   34: iconst_1
    //   35: invokevirtual 96	com/google/zxing/qrcode/decoder/BitMatrixParser:setMirror	(Z)V
    //   38: aload_3
    //   39: invokevirtual 46	com/google/zxing/qrcode/decoder/BitMatrixParser:readVersion	()Lcom/google/zxing/qrcode/decoder/Version;
    //   42: pop
    //   43: aload_3
    //   44: invokevirtual 50	com/google/zxing/qrcode/decoder/BitMatrixParser:readFormatInformation	()Lcom/google/zxing/qrcode/decoder/FormatInformation;
    //   47: pop
    //   48: aload_3
    //   49: invokevirtual 99	com/google/zxing/qrcode/decoder/BitMatrixParser:mirror	()V
    //   52: aload_0
    //   53: aload_3
    //   54: aload_2
    //   55: invokespecial 89	com/google/zxing/qrcode/decoder/Decoder:decode	(Lcom/google/zxing/qrcode/decoder/BitMatrixParser;Ljava/util/Map;)Lcom/google/zxing/common/DecoderResult;
    //   58: astore 12
    //   60: aload 12
    //   62: new 101	com/google/zxing/qrcode/decoder/QRCodeDecoderMetaData
    //   65: dup
    //   66: iconst_1
    //   67: invokespecial 103	com/google/zxing/qrcode/decoder/QRCodeDecoderMetaData:<init>	(Z)V
    //   70: invokevirtual 109	com/google/zxing/common/DecoderResult:setOther	(Ljava/lang/Object;)V
    //   73: aload 12
    //   75: areturn
    //   76: astore 9
    //   78: aload 9
    //   80: astore 8
    //   82: aload 6
    //   84: ifnull +18 -> 102
    //   87: aload 6
    //   89: athrow
    //   90: astore 5
    //   92: aload 5
    //   94: astore 4
    //   96: aconst_null
    //   97: astore 6
    //   99: goto -70 -> 29
    //   102: aload 4
    //   104: ifnull +6 -> 110
    //   107: aload 4
    //   109: athrow
    //   110: aload 8
    //   112: athrow
    //   113: astore 7
    //   115: aload 7
    //   117: astore 8
    //   119: goto -37 -> 82
    //
    // Exception table:
    //   from	to	target	type
    //   12	20	23	com/google/zxing/FormatException
    //   29	73	76	com/google/zxing/FormatException
    //   12	20	90	com/google/zxing/ChecksumException
    //   29	73	113	com/google/zxing/ChecksumException
  }

  public DecoderResult decode(boolean[][] paramArrayOfBoolean)
    throws ChecksumException, FormatException
  {
    return decode(paramArrayOfBoolean, null);
  }

  public DecoderResult decode(boolean[][] paramArrayOfBoolean, Map<DecodeHintType, ?> paramMap)
    throws ChecksumException, FormatException
  {
    int i = paramArrayOfBoolean.length;
    BitMatrix localBitMatrix = new BitMatrix(i);
    int j = 0;
    if (j >= i)
      return decode(localBitMatrix, paramMap);
    for (int k = 0; ; k++)
    {
      if (k >= i)
      {
        j++;
        break;
      }
      if (paramArrayOfBoolean[j][k] != 0)
        localBitMatrix.set(k, j);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.zxing.qrcode.decoder.Decoder
 * JD-Core Version:    0.6.2
 */