com.google.zxing.common.reedsolomon.ReedSolomonDecoder Java Examples

The following examples show how to use com.google.zxing.common.reedsolomon.ReedSolomonDecoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: Detector.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: Detector.java    From weex with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #5
Source File: Decoder.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #6
Source File: Decoder.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
public Decoder() {
	rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
Example #7
Source File: Decoder.java    From barterli_android with Apache License 2.0 4 votes vote down vote up
public Decoder() {
    rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #8
Source File: Decoder.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
public Decoder() {
	rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
Example #9
Source File: Decoder.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
public Decoder() {
	rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #10
Source File: Decoder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public Decoder()
{
    d = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
Example #11
Source File: Decoder.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #12
Source File: Decoder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public Decoder()
{
    a = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
Example #13
Source File: Detector.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private static void a(boolean aflag[], boolean flag)
{
    byte byte0;
    byte byte1;
    int i;
    int ai[];
    if (flag)
    {
        byte0 = 7;
        byte1 = 2;
    } else
    {
        byte0 = 10;
        byte1 = 4;
    }
    i = byte0 - byte1;
    ai = new int[byte0];
    for (int j = 0; j < byte0; j++)
    {
        int k1 = 1;
        int l1 = 1;
        for (; k1 <= 4; k1++)
        {
            if (aflag[(4 + 4 * j) - k1])
            {
                ai[j] = l1 + ai[j];
            }
            l1 <<= 1;
        }

    }

    int k;
    try
    {
        (new ReedSolomonDecoder(GenericGF.AZTEC_PARAM)).decode(ai, i);
    }
    catch (ReedSolomonException reedsolomonexception)
    {
        throw NotFoundException.getNotFoundInstance();
    }
    for (k = 0; k < byte1; k++)
    {
        int l = 1;
        int i1 = 1;
        while (l <= 4) 
        {
            int j1 = (4 + k * 4) - l;
            boolean flag1;
            if ((i1 & ai[k]) == i1)
            {
                flag1 = true;
            } else
            {
                flag1 = false;
            }
            aflag[j1] = flag1;
            i1 <<= 1;
            l++;
        }
    }

}
 
Example #14
Source File: Decoder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public Decoder()
{
    a = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #15
Source File: Decoder.java    From android-quick-response-code with Apache License 2.0 4 votes vote down vote up
public Decoder() {
    rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #16
Source File: Decoder.java    From reacteu-app with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
Example #17
Source File: Decoder.java    From reacteu-app with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
Example #18
Source File: Decoder.java    From reacteu-app with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #19
Source File: Decoder.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
Example #20
Source File: Decoder.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #21
Source File: Decoder.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
Example #22
Source File: Decoder.java    From ScreenCapture with MIT License 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #23
Source File: EncoderDecoder.java    From pied-piper with MIT License 4 votes vote down vote up
public EncoderDecoder(){
	decoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
	encoder = new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #24
Source File: Decoder.java    From weex with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
Example #25
Source File: Decoder.java    From weex with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
Example #26
Source File: Decoder.java    From weex with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #27
Source File: Decoder.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
Example #28
Source File: Decoder.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
Example #29
Source File: Decoder.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
Example #30
Source File: Decoder.java    From ZXing-Orient with Apache License 2.0 4 votes vote down vote up
public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}