private static BitList GetFormatInfoBits(ErrorCorrectionLevel errorlevel, Pattern pattern) { int formatInfo = (int)pattern.MaskPatternType; //Pattern bits length = 3 formatInfo |= GetErrorCorrectionIndicatorBits(errorlevel) << 3; int bchCode = BCHCalculator.CalculateBCH(formatInfo, s_FormatInfoPoly); //bchCode length = 10 formatInfo = (formatInfo << 10) | bchCode; //xor maskPattern formatInfo ^= s_FormatInfoMaskPattern; BitList resultBits = new BitList(); resultBits.Add(formatInfo, 15); if (resultBits.Count != 15) { throw new Exception("FormatInfoBits length is not 15"); } else { return(resultBits); } }
private static BitList VersionInfoBitList(int version) { BitList result = new BitList(); result.Add(version, s_LengthDataBits); result.Add(BCHCalculator.CalculateBCH(version, s_VersionBCHPoly), s_LengthECBits); if (result.Count != (s_LengthECBits + s_LengthDataBits)) { throw new Exception("Version Info creation error. Result is not 18 bits"); } return(result); }