Complexity-based two-dimensional code generation method

CN120337964BActive Publication Date: 2026-09-25CHENGDU JIUZHOU ELECTRONIC INFORMATION SYSTEM CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510445581.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2026-09-25
Estimated Expiration
2045-04-10

AI Technical Summary

Technical Problem

这种方式在处理简单、单一类型的数据时表现尚可,但当面对类型多样化、内容复杂度高(例如,高信息熵的随机文本、深层嵌套的结构化数据、包含大量特殊字符集的数据)的原始数据时,固定的编码策略可能并非最优,导致编码效率低下、生成的二维码数据冗余度高、存储空间浪费

Benefits of technology

[0031]1、本发明能够在判断原始数据满足预设并行处理条件时,自动将数据分割成多个分片,并利用多核处理器等计算资源并行地执行编码策略。相比于传统的单线程顺序执行方式,这种并行处理能够大幅缩短处理大容量数据所需的时间,显著提高了二维码的生成速度和整体系统吞吐量,特别适用于需要快速处理大量数据的场景。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120337964B_ABST
    Figure CN120337964B_ABST
Patent Text Reader

Abstract

The application discloses a two-dimensional code generation method based on complexity, comprising the following steps: receiving original data to be encoded; analyzing the original data to obtain data types and at least one complexity index; selecting at least one matched encoding strategy from an encoding strategy library containing multiple encoding strategies based on a preset dynamic matching rule according to the data types and the complexity index; executing the matched encoding strategy on the original data to generate encoded data; and generating a two-dimensional code image based on the encoded data. The two-dimensional code generation method can not only dynamically select an optimal encoding strategy according to data complexity and content features, but also efficiently execute an encoding process, and can significantly shorten processing time for large-capacity data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information processing technology, and in particular to a method for generating QR codes based on complexity. Background Technology

[0002] QR codes (Quick Response Codes), as a type of matrix barcode capable of quickly storing and retrieving information, have been widely used in numerous scenarios such as logistics tracking, mobile payment, identity verification, and information transmission. One of the core steps in generating a QR code is to convert raw data (such as text, URLs, contact information, image data, binary data, etc.) into a data stream suitable for QR code storage using specific encoding rules.

[0003] While existing technologies for QR code generation recognize the importance of selecting different encoding modes (such as numeric, alphanumeric, byte, and Chinese character modes) based on data type, they fall short in deeper-level encoding strategy optimization. Some methods attempt to select strategies based on simple rules or data types, but often employ fixed, preset encoding strategies. This approach performs adequately when handling simple, single-type data, but when faced with diverse types of raw data with high content complexity (e.g., high-information-entropy random text, deeply nested structured data, or data containing a large number of special character sets), fixed encoding strategies may not be optimal, leading to low encoding efficiency, high redundancy in generated QR code data, and wasted storage space.

[0004] On the other hand, even with the optimal encoding strategy, if the strategy itself is computationally intensive or the original data volume is enormous, the traditional single-threaded, sequential encoding process will consume a significant amount of processing time, resulting in slow QR code generation and impacting user experience and system processing efficiency. This is particularly problematic in applications requiring real-time or near-real-time generation of large numbers of QR codes (such as batch ticket generation and large-scale IoT device identification), where encoding speed becomes a critical bottleneck. Furthermore, existing methods often fail to fully utilize the multi-core processing capabilities commonly found in modern computing devices, leading to a waste of computing resources. Summary of the Invention

[0005] To address the shortcomings of the existing technologies, this invention aims to provide a QR code generation method that can not only dynamically select the optimal encoding strategy based on data complexity and content characteristics, but also efficiently execute the encoding process, especially significantly shortening processing time for large-capacity data.

[0006] To achieve the above-mentioned objectives, the technical solution provided by this invention includes:

[0007] A complexity-based QR code generation method includes the following steps:

[0008] S1. Receive the raw data to be encoded;

[0009] S2. Analyze the raw data to obtain its data type and at least one complexity index;

[0010] S3. Based on preset dynamic matching rules, select at least one matching encoding strategy from an encoding strategy library containing multiple encoding strategies according to the data type and the complexity index;

[0011] S4. Execute the matching encoding strategy on the original data to generate encoded data, wherein the process of executing the matching encoding strategy includes:

[0012] Determine whether the size of the original data is greater than a first preset threshold:

[0013] S41. If so, the original data is divided into multiple data fragments, the matching encoding strategy is executed in parallel, and the fragmented encoded data is merged to obtain the encoded data;

[0014] S42. If not, then the matching encoding strategy is applied to the original data to obtain the encoded data;

[0015] S5. Generate a QR code image based on the encoded data.

[0016] Preferably, the complexity metrics include information entropy, structural depth, and character diversity.

[0017] Preferably, the method for dividing the original data into multiple data fragments in step S41 includes: dynamically determining the size of the data fragment based on at least one of the size of the original data and the number of currently available processing resources.

[0018] Preferably, the method for dynamically determining the size of the data fragment includes:

[0019] Shard size = max(preset minimum shard size, original data size / (number of CPU cores × α)); α is an adjustment factor.

[0020] Preferably, the method for obtaining the data type of the raw data includes: using regular expressions to match predefined structured data formats; and using a neural network model to classify the raw data to identify image data and / or text data.

[0021] Preferably, the method for determining the complexity index includes:

[0022] Calculate the content size of the original data and compare the content size with a preset content size threshold;

[0023] Calculate the information entropy of the original data: Where, x i For the i-th original data, p(x) i ) represents the probability of character occurrence, n represents the original data length, and the information entropy is compared with a preset information entropy threshold;

[0024] The percentage of ASCII and / or Unicode characters in the original data is calculated and compared with a preset percentage threshold.

[0025] Preferably, the method for determining the complexity index further includes:

[0026] If the data type is structured data, then the nesting level of the structured data is parsed, and the nesting level is compared with a preset level threshold.

[0027] If the data type is image data, then the resolution of the image data is obtained, and the resolution is compared with a preset resolution threshold.

[0028] Preferably, the method for selecting an encoding strategy based on preset dynamic matching rules includes: using a preset decision tree model, wherein the decision tree model determines the matching encoding strategy based on the data type of the original data and a comprehensive complexity value calculated according to preset weights.

[0029] Preferably, the matching encoding strategy includes a combination of multiple encoding strategies, and the combination conditions for the multiple encoding strategies include: no execution conflict between the encoding strategies, and the expected total execution time T of the combination of multiple encoding strategies. total Satisfy: T total ≤α×min(T1,T2,…,T m ), where α is a preset constant, T m The expected execution time for each coding strategy when executed individually.

[0030] Beneficial effects

[0031] 1. This invention can automatically divide the original data into multiple segments when it is determined that the original data meets the preset parallel processing conditions, and execute the encoding strategy in parallel using computing resources such as multi-core processors. Compared with the traditional single-threaded sequential execution method, this parallel processing can significantly shorten the time required to process large amounts of data, significantly improve the QR code generation speed and overall system throughput, and is particularly suitable for scenarios that require rapid processing of large amounts of data.

[0032] 2. This invention does not process all data in parallel. Instead, it determines the appropriate parallel sharding mechanism based on preset conditions. For small datasets, traditional direct encoding is used, avoiding the additional overhead of parallelization (such as the costs of thread creation, data splitting, and merging). This conditional execution strategy allows the method to intelligently adapt to different scales of data input, ensuring efficiency in small data processing while effectively utilizing multi-core resources to accelerate large data processing, thus optimizing the use of computing resources.

[0033] 3. This invention, while efficiently performing encoding, can also dynamically select the optimal encoding strategy based on data type and complexity indicators, resulting in high encoding efficiency and low storage redundancy. The parallel processing mechanism and the dynamic strategy selection mechanism work together to improve the overall performance and quality of QR code generation. Attached Figure Description

[0034] Figure 1 This is a schematic diagram of a complexity-based QR code generation method provided in a preferred embodiment of the present invention. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings. In the description of this invention, it should be understood that the terms "upper," "lower," "front," "rear," "left," "right," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention.

[0036] like Figure 1 As shown, this invention provides a complexity-based QR code generation method, including the following steps:

[0037] S1. Receive the raw data to be encoded.

[0038] The raw data is the information carrier that will eventually be encoded and presented as a QR code image. Its specific content determines the basis for subsequent analysis and strategy selection. It includes, but is not limited to, text strings (containing different character sets such as ASCII and Unicode), URLs, structured data (such as JSON, XML, and other data with hierarchical and key-value pair characteristics), and even image data (which can be raw pixel information, compressed format, or text representation such as Base64 encoded text) and any binary data stream.

[0039] S2. Analyze the raw data to obtain its data type and at least one complexity index.

[0040] The acquisition of the data type refers to identifying whether the data belongs to a predefined category such as text, image, binary stream, or structured data (e.g., JSON, XML). This lays the foundation for subsequent selection of appropriate analysis methods and encoding strategies. For example, image data and text data may require drastically different processing logics and complexity evaluation dimensions. Existing technologies typically rely on the encoding modes defined in the QR code standard to indirectly infer or restrict data types. In some preferred embodiments, a deeper, more accurate, and finer-grained type identification method is provided, offering a solid and reliable foundation for subsequent targeted complexity analysis and encoding strategy optimization. Specifically, this includes:

[0041] The methods for obtaining the data type of the original data include:

[0042] S21. Use regular expressions to match predefined structured data formats. For example, JSON data has its own rules for using parentheses, quotation marks, colons, and commas, while XML has tag pairs and attribute definitions. By designing matching regular expressions, you can efficiently and accurately determine whether the input data belongs to these specific structured types.

[0043] S22. A neural network model is used to classify the raw data to identify image data and / or text data. The neural network, by learning the features of a large number of samples, can capture subtle statistical differences between different data types, and can perform effective classification even when the data is complex or contains noise. The specific implementation can be flexibly selected by those skilled in the art based on existing technology, and this invention does not impose further limitations.

[0044] The above steps combine rule-driven and data-driven strategies, enabling the present invention to have high flexibility, accuracy, and adaptability to diverse data inputs in the key step of data type determination, laying a solid foundation for subsequent differentiated complexity analysis and coding strategy selection.

[0045] Determining the data type and complexity metrics constitutes a multi-layered understanding of the characteristics of the original data, ensuring that the selected encoding strategy truly matches the data's characteristics. Complexity metrics are a series of calculable measures used to quantify the inherent characteristics, structure, or information content complexity of the original data. Existing technologies often neglect the characteristics of these metrics, relying solely on basic data type judgments or employing fixed, pre-defined encoding strategies to apply the same standard encoding to a particular type of data without considering its actual internal characteristics. This is one of the reasons for low encoding efficiency, high redundancy, and poor adaptability to complex data.

[0046] Information entropy, in information theory, is an indicator that measures the randomness or uncertainty of an information source. It is used to quantify the degree of randomness or compressibility of the original data content. High information entropy means that the data tends to be random, contains fewer predictable patterns or repetitions, and has little compression potential (e.g., encrypted data, random number sequences). Low information entropy indicates that the data has more regularity, repetition, or patterns, and is easier to compress (e.g., repetitive text strings, simple text structures).

[0047] Structure depth refers to the maximum depth of nesting levels in structured data (such as JSON and XML). For example, a simple JSON object {"a":1,"b":2} has a shallow structure depth, while a complex JSON object such as {"a":{"b":{"c":[1,2]}}} has a deep structure depth. A greater structure depth generally indicates more complex data relationships, which may require more resources for parsing and processing, and may also affect the efficiency or applicability of certain encoding strategies (such as path-based compression).

[0048] Character diversity measures the richness of different character types that make up raw data (especially text data). It can be expressed as the total number of different characters, or the proportion of characters from a specific character set (such as different blocks in ASCII or Unicode). High character diversity means that the data contains a mixture of various character types (such as uppercase and lowercase letters, numbers, multiple symbols, and scripts from multiple languages). Low character diversity indicates that the data is mainly composed of a limited number of characters (such as pure numbers or pure lowercase letters).

[0049] In some preferred embodiments, a specific computational process for quantifying the complexity of the original data is provided, including:

[0050] The size of the original data is calculated and compared with a preset content size threshold. This step determines the volume of the original data.

[0051] Calculate the information entropy of the original data: Where, x iFor the i-th original data, p(x) i ) represents the probability of character occurrence, n represents the original data length, and the information entropy is compared with a preset information entropy threshold to determine whether the data is highly structured and highly repetitive (low entropy), or close to random and difficult to compress (high entropy).

[0052] The proportion of ASCII and / or Unicode characters in the original data is statistically analyzed, and the proportion is compared with a preset proportion threshold to evaluate the complexity of the original data in terms of character composition.

[0053] The aforementioned preset thresholds (content size threshold, information entropy threshold, character ratio threshold) are boundary points for subsequent decision-making, designed to distinguish different data characteristic ranges so that the optimal strategy can be selected based on these distinctions. Specifically, they can be set or adjusted by those skilled in the art based on their professional knowledge and practical experience in this field, or the optimal results can be obtained through experiments. This part is not the focus of this invention and will not be elaborated here.

[0054] This embodiment compares the calculated complexity index with a preset threshold. The comparison result (e.g., "greater than / equal to the threshold" or "less than the threshold") directly determines the qualitative judgment of the characteristics of the current original data. Its specific significance lies in transforming quantitative data analysis into specific and actionable decision signals. It is a key bridge connecting data understanding (S2) and strategy selection (S3), ensuring that the selection of encoding strategy is based on an objective assessment of the inherent complexity of the data, thereby achieving the final optimization goal.

[0055] In other preferred embodiments, in order to dynamically select a specific indicator that best reflects the core complexity of the identified data type, the method for determining the complexity indicator further includes:

[0056] If the data type is structured data, the nesting level of the structured data is parsed, and the nesting level is compared with a preset level threshold. By calculating this level number and comparing it with the preset level threshold, it is determined whether the structured data is flat and simple or deeply nested and complex in relationship.

[0057] If the data type is image data, the resolution of the image data is obtained and compared with a preset resolution threshold to evaluate the size and detail of the image data. This is directly related to the size after converting it into a byte stream suitable for QR code storage (such as through Base64 encoding), and whether preprocessing is needed before encoding (such as adjusting the size or changing the compression rate) to adapt to the capacity limitations of QR codes or optimize the final scanning experience.

[0058] S3. Based on preset dynamic matching rules, select at least one matching encoding strategy from an encoding strategy library containing multiple encoding strategies, according to the data type and the complexity index.

[0059] The dynamic matching rule determines the decision result (i.e., which encoding strategy to choose) based on the characteristics (data type and complexity index) of the real-time input and changing raw data. Specifically, a preset decision tree model can be used. This decision tree model determines the matching encoding strategy based on the data type of the raw data and a comprehensive complexity value calculated according to preset weights. A decision tree is a supervised learning algorithm widely used in classification and regression tasks. Its structure is similar to a flowchart, where each internal node represents a test of an attribute (or feature), each branch represents the test result, and each leaf node represents the final decision result or classification label. In the context of this invention, this decision tree is specifically designed and trained to perform the task of selecting encoding strategies. Its specific design and training methods can be implemented by those skilled in the art as needed, and this invention does not further limit them.

[0060] The encoding strategy library refers to a pre-built collection containing various encoding strategies (algorithms or methods). It includes various technical solutions for converting raw data into a data stream suitable for QR code generation, including but not limited to: basic encoding modes of the QR code standard, data compression algorithms, data representation optimization, format conversion strategies, and error correction level selection strategies. In some preferred embodiments, to ensure the encoding strategy library has the ability to continuously evolve and self-improve, and to ensure that it always contains the currently optimal or effective encoding strategies, a programmatic and sustainable encoding strategy library update method is provided. This includes: periodically obtaining candidate encoding algorithms from the encoding standard library or open-source projects, and adding encoding algorithms that meet the test requirements to the encoding strategy library after automated testing. The automated testing includes, but is not limited to, multiple dimensions such as encoding efficiency (compression ratio), execution speed, resource consumption (CPU, memory), correctness (lossless encoding and decoding), robustness (ability to handle abnormal data), and compatibility with other strategies in the existing library. Only encoding algorithms that successfully pass all tests and meet the preset performance and reliability requirements will be finally confirmed as effective and officially added to the encoding strategy library.

[0061] It should be understood that this invention can not only select a single optimal strategy from the strategy library, but also construct and select strategy combinations or strategy chains composed of multiple different strategies, in order to achieve better coding effects that a single strategy cannot achieve. In some preferred embodiments, the selection of strategies must at least meet the following conditions: there are no execution conflicts between the coding strategies, and the expected total execution time Ttotal of the combination of multiple coding strategies satisfies: Ttotal ≤ α × min(T1, T2, ..., Tm), where α is a preset constant, and Tm is the expected execution time of each coding strategy when executed individually. The absence of execution conflicts between coding strategies means that the multiple strategies combined must be compatible with each other, able to execute smoothly in a predetermined order (either in parallel or sequentially), and the subsequent strategy must correctly process the output of the previous strategy, without logical contradictions, data format mismatches, or mutual interference leading to execution failure. The expected total execution time of the strategy combination is limited to the expected execution time of the strategy with the shortest (i.e., fastest) execution time among all the individual strategies considered for combination. The preset constant α is typically greater than or equal to 1, setting a performance tolerance relative to the fastest single strategy. For example, if α = 1.2, it means the total execution time of the combined strategies can be up to 20% slower than the fastest single strategy. This time constraint ensures that even when using multiple strategies to pursue better coding quality, the coding process will not become excessively slow, thus achieving a reasonable balance between optimization effectiveness and execution efficiency. Therefore, this mechanism allows the invention to explore more complex optimization paths while ensuring that the selected strategy combinations are both powerful and practical through rigorous compatibility and performance threshold screening.

[0062] S4. Execute the matching encoding strategy on the original data to generate encoded data, wherein the process of executing the matching encoding strategy includes:

[0063] Determine whether the size of the original data is greater than a first preset threshold:

[0064] S41. If so, the original data is divided into multiple data fragments, the matching encoding strategy is executed in parallel, and the fragmented encoded data is merged to obtain the encoded data.

[0065] S42. If not, then the matching encoding strategy is applied to the original data to obtain the encoded data.

[0066] It should be understood that the first preset threshold is used to distinguish between "small data" and "big data," and its core objective is to find a balance: when the data size is below this threshold, the total time for sequential execution (encoding time) is usually shorter than or roughly the same as the total time for parallel execution (data partitioning + parallel encoding + merging + management overhead); when the data size exceeds this threshold, the speed improvement brought by parallel execution is sufficient to offset its additional overhead, resulting in a significant reduction in total time. The specific setting method can be configured by those skilled in the art based on the specific hardware and software environment, and this invention does not make further requirements.

[0067] The segmentation refers to dividing a large original data object into multiple smaller data units according to certain rules or strategies. These smaller units are called data fragments and are a prerequisite for parallel processing.

[0068] The method for dividing the original data into multiple data fragments in step S41 includes: dynamically determining the size of the data fragment based on at least one of the size of the original data and the number of currently available processing resources. Most existing technologies employ segmentation by a fixed size or a fixed number of fragments. In some preferred embodiments, a dynamic, adaptive segmentation method is provided, specifically including: dynamically determining the size of the data fragment based on at least one of the size of the original data and the number of currently available processing resources. In this case, segmentation can be based solely on the data size, i.e., the larger the data, the larger the fragment, or the number of fragments can be kept relatively stable; or segmentation can be based solely on the number of available resources, for example, dividing the data into a number of fragments equal to the number of CPU cores, with the size of each fragment being the total size divided by the number of cores; preferably, it can also depend on both the data size and the number of available resources simultaneously. Specifically, the method for dynamically determining the size of the data fragment includes:

[0069] Shard size = max(preset minimum shard size, original data size / (number of CPU cores × α)); α is an adjustment factor. This method is based on the following technical considerations:

[0070] The ideal partition size is calculated based on the original data size and the system's processing power (represented by the number of CPU cores, adjusted by a factor α). However, if the original data is relatively small or the number of CPU cores is very large, the calculated partition size may become very small, resulting in excessively high parallel task management overhead. Therefore, a `max` function and a preset minimum partition size are introduced. The `max` function compares the calculated ideal partition size with this preset lower limit and takes the larger of the two as the final partition size. This means that no matter how small the calculated result based on the data size and the number of CPU cores is, the actual partition size will at least remain above a preset, considered reasonable minimum value, thus ensuring that each parallel task has sufficient workload and avoiding performance degradation caused by excessively small partitions. In parallel tasks, besides the key indicator of the number of CPU cores, factors such as memory bandwidth, I / O speed, task scheduling efficiency, and the characteristics of the encoding algorithm itself (whether it is CPU-intensive or I / O-intensive) can all affect the optimal partition size. Therefore, an adjustment factor α is designed to adjust the effective weight of the number of CPU cores in the partition size calculation. When α = 1, each core can be roughly allocated one partition. When α > 1, on the one hand, it means that more partitions than the number of CPU cores will be generated to achieve better load balancing and resource utilization. On the other hand, it also means that when a core completes its partition task early, it can immediately take over the next partition to be processed instead of waiting for other cores, thereby reducing CPU idle time and improving throughput. When α < 1, it is often applicable to special cases, such as: parallel tasks require a lot of memory, but the total system memory is limited, so it is necessary to limit the number of tasks running at the same time (i.e., the number of partitions) to avoid memory exhaustion; in some special algorithms or multi-tenant environments that require strict control of resource usage, it is necessary to intentionally limit the degree of parallelism. Therefore, the setting of the adjustment factor α can be determined by those skilled in the art through empirical performance testing and optimization. By comparing the performance under different α values ​​(such as encoding speed and resource utilization), the α value that can provide the best average performance in typical scenarios can be selected as the final configuration. This value may be a fixed constant, or in more complex systems, it may even be dynamically fine-tuned according to real-time system load or other runtime parameters.

[0071] The parallel execution of the matching encoding strategy refers to leveraging the computing system's ability to process multiple tasks simultaneously. Multiple data slices that would normally require sequential processing are distributed to different processing units (such as different CPU cores), allowing each unit to perform the same encoding operation on its assigned data slice within the same timeframe. The aim is to shorten the overall processing time. This can be implemented using either multithreading or multiprocessing. After all data slices have completed their encoding through parallel execution, these dispersed, already encoded data slices are reassembled into a single, continuous, and complete encoded data stream, following their original order in the original data.

[0072] S5. Generate a QR code image based on the encoded data.

[0073] The encoded data refers to a binary data stream or byte sequence that has been processed by the selected encoding strategy and conforms to the QR code standard. It typically includes encoded user data, necessary mode indicators, length indicators, and crucial error correction codes (ECC). These ECC codes are generated according to the selected error correction level to ensure the QR code can still be read correctly even when partially damaged. Then, according to the QR code layout rules (including version information, format information, positioning patterns, correction patterns, timing patterns, and other fixed elements), the data is filled into a two-dimensional matrix, and an optimal mask pattern is applied to optimize the image's scannability. Finally, the output is a square QR code graphic composed of black and white squares (modules) that can be directly recognized by scanning devices.

[0074] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A complexity-based QR code generation method, characterized in that, Including the following steps: S1. Receive the raw data to be encoded; S2. Analyze the raw data to obtain its data type and at least two complexity indicators; S3. Based on preset dynamic matching rules, select at least one matching encoding strategy from an encoding strategy library containing multiple encoding strategies according to the data type and the complexity index; S4. Execute the matching encoding strategy on the original data to generate encoded data, wherein the process of executing the matching encoding strategy includes: Determine whether the size of the original data is greater than a first preset threshold: S41. If so, the original data is divided into multiple data fragments, the matching encoding strategy is executed in parallel, and the fragmented encoded data is merged to obtain the encoded data; S42. If not, then the matching encoding strategy is applied to the original data to obtain the encoded data; S5. Generate a QR code image based on the encoded data; The complexity metrics include information entropy, structural depth, and character diversity; the structural depth refers to the maximum depth of nesting levels in structured data. The method for selecting an encoding strategy based on preset dynamic matching rules includes: using a preset decision tree model, wherein the decision tree model determines the matching encoding strategy based on the data type of the original data and a comprehensive complexity value calculated according to preset weights; The matching encoding strategy includes a combination of multiple encoding strategies. The combination conditions of the multiple encoding strategies include: there is no execution conflict between the encoding strategies, and the expected total execution time Ttotal of the combination of multiple encoding strategies satisfies: Ttotal≤α×min(T1,T2,...,Tm), where α is a preset constant and Tm is the expected execution time of each encoding strategy when executed individually.

2. The complexity-based QR code generation method as described in claim 1, characterized in that, The method for dividing the original data into multiple data fragments in step S41 includes: dynamically determining the size of the data fragment based on at least one of the size of the original data and the number of currently available processing resources.

3. The complexity-based QR code generation method as described in claim 2, characterized in that, The method for dynamically determining the size of the data fragment includes: Shard size = max(preset minimum shard size, original data size / (number of CPU cores × α)); α is an adjustment factor.

4. The complexity-based QR code generation method as described in claim 1, characterized in that, Methods for obtaining the data type of the raw data include: using regular expressions to match predefined structured data formats; and using neural network models to classify the raw data to identify image data and / or text data.

5. The complexity-based QR code generation method as described in claim 1, characterized in that, The methods for determining the complexity index include: Calculate the information entropy of the original data: ;in, For the i-th original data, The probability of character occurrence is given, n is the original data length, and the information entropy is compared with a preset information entropy threshold. The percentage of ASCII and / or Unicode characters in the original data is calculated and compared with a preset percentage threshold.

6. The complexity-based QR code generation method as described in claim 5, characterized in that, The method for determining the complexity index also includes: If the data type is structured data, then the nesting level of the structured data is parsed, and the nesting level is compared with a preset level threshold.

Citation Information

Patent Citations

  • Data transmission method, transmission system, acquisition equipment and receiving equipment

    CN114239779A

  • Low-delay video transmission method and system

    CN118945364A

  • Multi-two-dimensional code data array generation and identification method and system

    CN119476328A