Java 类com.google.zxing.common.reedsolomon.GenericGF 实例源码

项目:weex-3d-map    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:boohee_v5.6    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
    switch (wordSize) {
        case 4:
            return GenericGF.AZTEC_PARAM;
        case 6:
            return GenericGF.AZTEC_DATA_6;
        case 8:
            return GenericGF.AZTEC_DATA_8;
        case 10:
            return GenericGF.AZTEC_DATA_10;
        case 12:
            return GenericGF.AZTEC_DATA_12;
        default:
            throw new IllegalArgumentException("Unsupported word size " + wordSize);
    }
}
项目:PortraitZXing    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:PortraitZXing    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:ZXing-Orient    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      return null;
  }
}
项目:event-app    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:weex-analyzer-android    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:weex-3d-map    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:Weex-TestDemo    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:Cardstore    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:QrScan_Demo    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      return null;
  }
}
项目:weex    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:TrueTone    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
    switch (wordSize) {
        case 4:
            return GenericGF.AZTEC_PARAM;
        case 6:
            return GenericGF.AZTEC_DATA_6;
        case 8:
            return GenericGF.AZTEC_DATA_8;
        case 10:
            return GenericGF.AZTEC_DATA_10;
        case 12:
            return GenericGF.AZTEC_DATA_12;
        default:
            return null;
    }
}
项目:Discounty    文件:Encoder.java   
static GenericGF getGF(int wordSize) {
    switch (wordSize) {
        case 4:
            return GenericGF.AZTEC_PARAM;
        case 6:
            return GenericGF.AZTEC_DATA_6;
        case 8:
            return GenericGF.AZTEC_DATA_8;
        case 10:
            return GenericGF.AZTEC_DATA_10;
        case 12:
            return GenericGF.AZTEC_DATA_12;
        default:
            return null;
    }
}
项目:bushido-android-app    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      return null;
  }
}
项目:Android-Birdcopy-Application    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      return null;
  }
}
项目:MiBandDecompiled    文件:Encoder.java   
static byte[] a(byte abyte0[], int i)
{
    int j = 0;
    int k = abyte0.length;
    int ai[] = new int[k + i];
    for (int l = 0; l < k; l++)
    {
        ai[l] = 0xff & abyte0[l];
    }

    (new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256)).encode(ai, i);
    byte abyte1[] = new byte[i];
    for (; j < i; j++)
    {
        abyte1[j] = (byte)ai[k + j];
    }

    return abyte1;
}
项目:zxing-bsplus    文件:Encoder.java   
private static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      throw new IllegalArgumentException("Unsupported word size " + wordSize);
  }
}
项目:ZxingCore    文件:Encoder.java   
static GenericGF getGF(int wordSize) {
  switch (wordSize) {
    case 4:
      return GenericGF.AZTEC_PARAM;
    case 6:
      return GenericGF.AZTEC_DATA_6;
    case 8:
      return GenericGF.AZTEC_DATA_8;
    case 10:
      return GenericGF.AZTEC_DATA_10;
    case 12:
      return GenericGF.AZTEC_DATA_12;
    default:
      return null;
  }
}
项目:qrcodegenerator    文件:QRCodeGenerator.java   
/**
    * Generate the Error correction codewords thanks to the Zxing external library.
    *
    * @todo auto convert int array to byte string
    *
    * @param dataBytes
    * @param numEcBytesInBlock
    * @return ecInt
    */
public int[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
    int numDataBytes = dataBytes.length;
    int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
    for (int i = 0; i < numDataBytes; i++) {
      toEncode[i] = dataBytes[i] & 0xFF;
    }
    new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

    int[] ecInt = new int[numEcBytesInBlock];

    for (int i = 0; i < numEcBytesInBlock; i++) {
        ecInt[i] = (int) ((byte) toEncode[numDataBytes + i] & 0xFF) ;
    }
    return ecInt;
}
项目:weex-3d-map    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:weex-3d-map    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}
项目:QrCode    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:boohee_v5.6    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
    int i;
    int numDataBytes = dataBytes.length;
    int[] toEncode = new int[(numDataBytes + numEcBytesInBlock)];
    for (i = 0; i < numDataBytes; i++) {
        toEncode[i] = dataBytes[i] & 255;
    }
    new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);
    byte[] ecBytes = new byte[numEcBytesInBlock];
    for (i = 0; i < numEcBytesInBlock; i++) {
        ecBytes[i] = (byte) toEncode[numDataBytes + i];
    }
    return ecBytes;
}
项目:boohee_v5.6    文件:Detector.java   
private static int getCorrectedParameterData(long parameterData, boolean compact) throws
        NotFoundException {
    int numCodewords;
    int numDataCodewords;
    int i;
    if (compact) {
        numCodewords = 7;
        numDataCodewords = 2;
    } else {
        numCodewords = 10;
        numDataCodewords = 4;
    }
    int numECCodewords = numCodewords - numDataCodewords;
    int[] parameterWords = new int[numCodewords];
    for (i = numCodewords - 1; i >= 0; i--) {
        parameterWords[i] = ((int) parameterData) & 15;
        parameterData >>= 4;
    }
    try {
        new ReedSolomonDecoder(GenericGF.AZTEC_PARAM).decode(parameterWords, numECCodewords);
        int result = 0;
        for (i = 0; i < numDataCodewords; i++) {
            result = (result << 4) + parameterWords[i];
        }
        return result;
    } catch (ReedSolomonException e) {
        throw NotFoundException.getNotFoundInstance();
    }
}
项目:Tesseract-OCR-Scanner    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:QrCodeScanner    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:PortraitZXing    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:PortraitZXing    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}
项目:PortraitZXing    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:PortraitZXing    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}
项目:ZXing-Orient    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:ZXing-Orient    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}
项目:event-app    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:event-app    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}
项目:weex-analyzer-android    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:weex-analyzer-android    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}
项目:qart4j    文件:Bits.java   
public void addCheckBytes(Version version, Level level) throws QArtException {
    int numberOfDataBytes = version.dataBytes(level);
    if (this.size < numberOfDataBytes*8) {
        pad(numberOfDataBytes*8 - this.size);
    }

    if (this.size != numberOfDataBytes*8) {
        throw new IllegalArgumentException("qr: too much data");
    }

    Version.VersionInfo versionInfo = Version.VERSION_INFOS[version.getVersion()];
    Version.VersionLevelInfo levelInfo = versionInfo.levelInfos[level.ordinal()];
    int numberOfDataBytesPerBlock = numberOfDataBytes / levelInfo.numberOfBlocks;
    int numberOfExtraBytes = numberOfDataBytes % levelInfo.numberOfBlocks;
    ReedSolomonEncoder reedSolomonEncoder = new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256);

    int dataIndex = 0;
    for(int i = 0;i < levelInfo.numberOfBlocks;i++){
        if(i == levelInfo.numberOfBlocks - numberOfExtraBytes) {
            numberOfDataBytesPerBlock++;
        }

        byte[] checkBytes = ReedSolomonUtil.generateECBytes(reedSolomonEncoder, this.bits, dataIndex, numberOfDataBytesPerBlock, levelInfo.numberOfCheckBytesPerBlock);
        dataIndex += numberOfDataBytesPerBlock;

        this.append(new Bits(checkBytes, levelInfo.numberOfCheckBytesPerBlock * 8));
    }

    if(this.size/8 != versionInfo.bytes) {
        throw new QArtException("qr: internal error");
    }

}
项目:weex-3d-map    文件:Encoder.java   
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
  int numDataBytes = dataBytes.length;
  int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
  for (int i = 0; i < numDataBytes; i++) {
    toEncode[i] = dataBytes[i] & 0xFF;
  }
  new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);

  byte[] ecBytes = new byte[numEcBytesInBlock];
  for (int i = 0; i < numEcBytesInBlock; i++) {
    ecBytes[i] = (byte) toEncode[numDataBytes + i];
  }
  return ecBytes;
}
项目:weex-3d-map    文件:Detector.java   
/**
 * Corrects the parameter bits using Reed-Solomon algorithm.
 *
 * @param parameterData parameter bits
 * @param compact true if this is a compact Aztec code
 * @throws NotFoundException if the array contains too many errors
 */
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
  int numCodewords;
  int numDataCodewords;

  if (compact) {
    numCodewords = 7;
    numDataCodewords = 2;
  } else {
    numCodewords = 10;
    numDataCodewords = 4;
  }

  int numECCodewords = numCodewords - numDataCodewords;
  int[] parameterWords = new int[numCodewords];
  for (int i = numCodewords - 1; i >= 0; --i) {
    parameterWords[i] = (int) parameterData & 0xF;
    parameterData >>= 4;
  }
  try {
    ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
    rsDecoder.decode(parameterWords, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw NotFoundException.getNotFoundInstance();
  }
  // Toss the error correction.  Just return the data as an integer
  int result = 0;
  for (int i = 0; i < numDataCodewords; i++) {
    result = (result << 4) + parameterWords[i];
  }
  return result;
}