Lines Matching defs:version
57 testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ecc ecl, uint8_t result[]);
58 testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl);
66 testable void initializeFunctionModules(int version, uint8_t qrcode[]);
67 static void drawLightFunctionModules(uint8_t qrcode[], int version);
69 testable int getAlignmentPatternPositions(int version, uint8_t result[7]);
85 testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int version);
86 static int numCharCountBits(enum qrcodegen_Mode mode, int version);
210 // Find the minimal version number to use
211 int version, dataUsedBits;
212 for (version = minVersion; ; version++) {
213 int dataCapacityBits = getNumDataCodewords(version, ecl) * 8; // Number of data bits available
214 dataUsedBits = getTotalBits(segs, len, version);
216 break; // This version number is found to be suitable
217 if (version >= maxVersion) { // All versions in the range could not fit the given data
224 // Increase the error correction level while the data still fits in the current version number
226 if (boostEcl && dataUsedBits <= getNumDataCodewords(version, (enum qrcodegen_Ecc)i) * 8)
231 memset(qrcode, 0, (size_t)qrcodegen_BUFFER_LEN_FOR_VERSION(version) * sizeof(qrcode[0]));
236 appendBitsToBuffer((unsigned int)seg->numChars, numCharCountBits(seg->mode, version), qrcode, &bitLen);
245 int dataCapacityBits = getNumDataCodewords(version, ecl) * 8;
259 addEccAndInterleave(qrcode, version, ecl, tempBuffer);
260 initializeFunctionModules(version, qrcode);
261 drawCodewords(tempBuffer, getNumRawDataModules(version) / 8, qrcode);
262 drawLightFunctionModules(qrcode, version);
263 initializeFunctionModules(version, tempBuffer);
294 testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ecc ecl, uint8_t result[]) {
296 assert(0 <= (int)ecl && (int)ecl < 4 && qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX);
297 int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[(int)ecl][version];
298 int blockEccLen = ECC_CODEWORDS_PER_BLOCK [(int)ecl][version];
299 int rawCodewords = getNumRawDataModules(version) / 8;
300 int dataLen = getNumDataCodewords(version, ecl);
326 // for the given version number and error correction level. The result is in the range [9, 2956].
327 testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl) {
328 int v = version, e = (int)ecl;
336 // Returns the number of data bits that can be stored in a QR Code of the given version number, after
417 // version's size, then marks every function module as dark.
418 testable void initializeFunctionModules(int version, uint8_t qrcode[]) {
420 int qrsize = version * 4 + 17;
435 int numAlign = getAlignmentPatternPositions(version, alignPatPos);
444 // Fill version blocks
445 if (version >= 7) {
455 static void drawLightFunctionModules(uint8_t qrcode[], int version) {
479 int numAlign = getAlignmentPatternPositions(version, alignPatPos);
491 // Draw version blocks
492 if (version >= 7) {
494 int rem = version; // version is uint6, in the range [7, 40]
497 long bits = (long)version << 12 | rem; // uint18
547 // for this version number, returning the length of the list (in the range [0,7]).
550 testable int getAlignmentPatternPositions(int version, uint8_t result[7]) {
551 if (version == 1)
553 int numAlign = version / 7 + 2;
554 int step = (version == 32) ? 26 :
555 (version * 4 + numAlign * 2 + 1) / (numAlign * 2 - 2) * 2;
556 for (int i = numAlign - 1, pos = version * 4 + 10; i >= 1; i--, pos -= step)
985 // Calculates the number of bits needed to encode the given segments at the given version.
988 testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int version) {
996 int ccbits = numCharCountBits(segs[i].mode, version);
1010 // in a QR Code at the given version number. The result is in the range [0, 16].
1011 static int numCharCountBits(enum qrcodegen_Mode mode, int version) {
1012 assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX);
1013 int i = (version + 7) / 17;