bug fixing at qr code encoder.

This commit is contained in:
favoritas37 2015-12-05 16:02:49 +02:00
parent 09c7d0c2c8
commit b661cc2480
4 changed files with 9 additions and 5 deletions

View File

@ -60,9 +60,12 @@ void ReedSolomonEncoder::encode(std::vector<int> &toEncode, int ecBytes)
//original kept for future checks
//System.arraycopy(coefficients, 0, toEncode, dataBytes + numZeroCoefficients, coefficients.length);
toEncode.insert(toEncode.begin() + dataBytes + numZeroCoefficients,
coefficients.array_->values().begin(),
coefficients.array_->values().end());
//toEncode.insert(toEncode.begin() + (dataBytes-1) + numZeroCoefficients,
// coefficients.array_->values().begin(),
// coefficients.array_->values().end());
for (size_t i = 0; i < coefficients.count(); i++)
toEncode[i] = coefficients[i];
}
}

View File

@ -148,7 +148,7 @@ bool MaskUtil::getDataMaskBit(int maskPattern, int x, int y)
intermediate = (y + x) % 3;
break;
case 4:
intermediate = (((unsigned int)y >> (unsigned int)1) + (x / 3)) & 0x1;
intermediate = ((y >> 1) + (x / 3)) & 0x1;
break;
case 5:
temp = y * x;

View File

@ -226,7 +226,7 @@ int MatrixUtil::findMSBSet(int value)
{
int numDigits = 0;
while (value != 0) {
value = ((unsigned int)value) >> (unsigned int)1;
value = value >> 1;
++numDigits;
}
return numDigits;

View File

@ -423,6 +423,7 @@ ArrayRef<char> Encoder::generateECBytes(const std::vector<char>& dataBytes, int
std::vector<int> toEncode;
toEncode.resize(numDataBytes + numEcBytesInBlock);
for (int i = 0; i < numDataBytes; i++)
//toEncode[i] = dataBytes[i];
toEncode[i] = dataBytes[i] & 0xFF;
zxing::ReedSolomonEncoder encoder(GenericGF::QR_CODE_FIELD_256);