private boolean extractFormatInfo ( QrCode qr ) { for ( int i = 0 ; i < 2 ; i ++ ) { // probably a better way to do this would be to go with the region that has the smallest // hamming distance if ( i == 0 ) readFormatRegion0 ( qr ) ; else readFormatRegion1 ( qr ) ; int bitField = this . bits . read ( 0 , 15 , false ) ; bitField ^= QrCodePolynomialMath . FORMAT_MASK ; int message ; if ( QrCodePolynomialMath . checkFormatBits ( bitField ) ) { message = bitField >> 10 ; } else { message = QrCodePolynomialMath . correctFormatBits ( bitField ) ; } if ( message >= 0 ) { QrCodePolynomialMath . decodeFormatMessage ( message , qr ) ; return true ; } } return false ; }
Reads format info bits from the image and saves the results in qr