类com.google.zxing.common.reedsolomon.ReedSolomonDecoder源码实例Demo

下面列出了怎么用com.google.zxing.common.reedsolomon.ReedSolomonDecoder的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: 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;
}
 

/**
 * 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;
}
 
源代码3 项目: weex   文件: 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;
}
 
源代码4 项目: barcodescanner-lib-aar   文件: 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;
}
 
源代码5 项目: ScreenCapture   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码6 项目: OpenChirp   文件: MainActivity.java

/** Called when the samples have been updated. */
private static final void onGaydecki(final ReedSolomonDecoder pReedSolomonDecoder, final double[] pSamples, final double[] pConfidences, final int pSubsamples, final ChirpFactory.IListener pChirpListener) {
    // Calculate the Number of Symbols.
    final int    lSymbols      = (pSamples.length / pSubsamples);
    // Declare the String.
          String lAccumulation = "";
    // Iterate the Samples whilst we're building up the string.
    for(int i = 0; i < lSymbols && (lAccumulation.length() != MainActivity.FACTORY_CHIRP.getEncodedLength()); i++) {
        // Fetch the Offset for the next Symbol.
        final int lOffset = (i * pSubsamples);
        // Detect the Chirp.
        final ChirpFactory.Result lResult = ChirpFactory.DETECTOR_CHIRP_MEAN.getSymbol(MainActivity.FACTORY_CHIRP, pSamples, pConfidences, lOffset, pSubsamples);
        // Is the Result valid?
        if(lResult.isValid()) {
            // Buffer the Result's data into the Accumulation.
            lAccumulation += lResult.getCharacter();
        }
    }
    // Is the accumulated data long enough?
    if(lAccumulation.length() == MainActivity.FACTORY_CHIRP.getEncodedLength()) {
        // Declare the Packetized Representation.
        final int[] lPacketized = new int[MainActivity.FACTORY_CHIRP.getRange().getFrameLength()];
        // Buffer the Header/Payload.
        for(int i = 0; i < MainActivity.FACTORY_CHIRP.getIdentifier().length() + MainActivity.FACTORY_CHIRP.getPayloadLength(); i++) {
            // Update the Packetized with the corresponding index value.
            lPacketized[i] = MainActivity.FACTORY_CHIRP.getRange().getCharacters().indexOf(lAccumulation.charAt(i));
        }
        // Iterate the Error Symbols.
        for(int i = 0; i < MainActivity.FACTORY_CHIRP.getErrorLength(); i++) {
            // Update the Packetized with the corresponding index value.
            lPacketized[MainActivity.FACTORY_CHIRP.getRange().getFrameLength() - MainActivity.FACTORY_CHIRP.getErrorLength() + i] = MainActivity.FACTORY_CHIRP.getRange().getCharacters().indexOf(lAccumulation.charAt(MainActivity.FACTORY_CHIRP.getIdentifier().length() + MainActivity.FACTORY_CHIRP.getPayloadLength() + i));
        }
        // Attempt to Reed/Solomon Decode.
        try {
            // Decode the Sample.
            pReedSolomonDecoder.decode(lPacketized, MainActivity.FACTORY_CHIRP.getErrorLength());
            // Declare the search metric.
            boolean lIsValid = true;
            // Iterate the Identifier characters.
            for(int i = 0; i < MainActivity.FACTORY_CHIRP.getIdentifier().length(); i++) {
                // Update the search metric.
                lIsValid &= MainActivity.FACTORY_CHIRP.getIdentifier().charAt(i) == (MainActivity.FACTORY_CHIRP.getRange().getCharacters().charAt(lPacketized[i]));
            }
            // Is the message directed to us?
            if(lIsValid) {
                // Fetch the Message data.
                String lMessage = "";
                // Iterate the Packet.
                for(int i = MainActivity.FACTORY_CHIRP.getIdentifier().length(); i < MainActivity.FACTORY_CHIRP.getIdentifier().length() + MainActivity.FACTORY_CHIRP.getPayloadLength(); i++) {
                    // Accumulate the Message.
                    lMessage += MainActivity.FACTORY_CHIRP.getRange().getCharacters().charAt(lPacketized[i]);
                }
                // Call the callback.
                pChirpListener.onChirp(lMessage);
            }
        }
        catch(final ReedSolomonException pReedSolomonException) { /* Do nothing; we're transmitting across a very lossy channel! */ }
    }
}
 
源代码7 项目: OpenChirp   文件: MainActivity.java

private final ReedSolomonDecoder getReedSolomonDecoder() {
    return this.mReedSolomonDecoder;
}
 
源代码8 项目: Tesseract-OCR-Scanner   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码9 项目: QrCodeScanner   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码10 项目: ZXing-Orient   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码11 项目: ZXing-Orient   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
源代码12 项目: ZXing-Orient   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
源代码16 项目: weex   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码17 项目: weex   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
源代码18 项目: weex   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
源代码19 项目: pied-piper   文件: EncoderDecoder.java

public EncoderDecoder(){
	decoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
	encoder = new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码20 项目: barcodescanner-lib-aar   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码21 项目: barcodescanner-lib-aar   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
源代码22 项目: barcodescanner-lib-aar   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
源代码23 项目: reacteu-app   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码24 项目: reacteu-app   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
源代码25 项目: reacteu-app   文件: Decoder.java

public Decoder() {
  rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
源代码26 项目: MiBandDecompiled   文件: Decoder.java

public Decoder()
{
    a = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
源代码27 项目: MiBandDecompiled   文件: Detector.java

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++;
        }
    }

}
 
源代码28 项目: MiBandDecompiled   文件: Decoder.java

public Decoder()
{
    a = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);
}
 
源代码29 项目: MiBandDecompiled   文件: Decoder.java

public Decoder()
{
    d = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
 
源代码30 项目: RipplePower   文件: Decoder.java

public Decoder() {
	rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
 
 类所在包
 同包方法