Esempio n. 1
0
        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, FormatInfoPoly);

            //bchCode length = 10
            formatInfo = (formatInfo << 10) | bchCode;

            //xor maskPattern
            formatInfo ^= FormatInfoMaskPattern;

            BitList resultBits = new BitList
            {
                { 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()
     {
         { version, LengthDataBits },
         { BCHCalculator.CalculateBCH(version, VersionBCHPoly), LengthECBits }
     };
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        private static BitList VersionInfoBitList(int version)
        {
            BitList result = new BitList
            {
                { version, LengthDataBits },
                { BCHCalculator.CalculateBCH(version, VersionBCHPoly), LengthECBits }
            };

            if (result.Count != (LengthECBits + LengthDataBits))
            {
                throw new Exception("Version Info creation error. Result is not 18 bits");
            }

            return(result);
        }