Complexity-based two-dimensional code generation method
By analyzing the data type and complexity indicators in the QR code generation method, dynamically selecting coding strategies to process big data in parallel, solving the problem of slow generation speed in the existing technology and achieving efficient QR code generation.
Patent Information
- Application Number
- CN202510445581.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-04-10
AI Technical Summary
The existing QR code generation methods are inefficient in coding when processing complexity and diversified data, and do not fully utilize multi-core processing capabilities, resulting in slow generation speed, affecting user experience and system efficiency.
By receiving the original data, analyzing its type and complexity indicators, dynamically selecting the coding strategy, and segmenting data fragments and processing in big data in parallel, using multi-core resources to generate QR code images.
It significantly shortens the processing time of large-capacity data, improves generation speed and system throughput, optimizes computing resource utilization, and improves encoding efficiency and overall performance of QR code generation.
Smart Images

Figure CN120337964A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information processing, and particularly to a method for generating two-dimensional codes based on complexity. Background Art
[0002] As a matrix bar code that can quickly store and read information, the Quick Response Code has been widely used in many scenarios such as logistics tracking, mobile payment, identity recognition, information transmission, etc. One of the core steps in generating a two-dimensional code is to convert the original data (such as text, URL, contact information, image data, binary data, etc.) into a data stream suitable for storage in the two-dimensional code through specific encoding rules.
[0003] In the aspect of two-dimensional code generation in the prior art, although the importance of selecting different encoding modes (such as numeric, alphanumeric, byte, Chinese character mode) according to the data type is recognized, there are deficiencies in the optimization of deeper encoding strategies. Some methods attempt to select strategies based on simple rules or data types, but often adopt fixed and preset encoding strategies. This method performs well when dealing with simple and single-type data, but when faced with original data with diverse types and high content complexity (for example, random text with high information entropy, deeply nested structured data, data containing a large number of special character sets), the fixed encoding strategy may not be optimal, resulting in low encoding efficiency, high redundancy of the generated two-dimensional code data, and waste of storage space.
[0004] On the other hand, even if the optimal encoding strategy is selected, if the strategy itself has a large computational amount or the original data volume is very large, the traditional single-threaded and sequential execution encoding process will consume a large amount of processing time, resulting in slow two-dimensional code generation speed and affecting the user experience and system processing efficiency. Especially in application scenarios that require real-time or near-real-time generation of a large number of two-dimensional codes (such as batch ticket generation, large-scale Internet of Things device identification, etc.), the encoding speed becomes a key bottleneck. In addition, existing methods usually fail to make full use of the multi-core processing capabilities commonly available in modern computing devices, resulting in waste of computing resources. Summary of the Invention
[0005] In order to solve the above-mentioned deficiencies existing in the prior art, the present invention aims to provide a method for generating two-dimensional codes that can not only dynamically select the optimal encoding strategy according to the data complexity and content characteristics, but also efficiently execute the encoding process, especially significantly shortening the processing time for large-capacity data.
[0006] To achieve the above-mentioned invention purpose, the technical solution provided by the present invention includes:
[0007] A method for generating two-dimensional codes based on complexity, including the steps:
[0008] S1. Receive the original data to be encoded;
[0009] S2. Analyze the original data to obtain its data type and at least one complexity metric;
[0010] S3. Based on a preset dynamic matching rule, select at least one matching encoding strategy from an encoding strategy library containing multiple encoding strategies according to the data type and the complexity metric;
[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] Judge whether the size of the original data is greater than a first preset threshold:
[0013] S41. If so, split the original data into multiple data slices, execute the matching encoding strategy in parallel, and merge the sliced encoded data to obtain the encoded data;
[0014] S42. If not, execute the matching encoding strategy on the original data to obtain the encoded data;
[0015] S5. Generate a two-dimensional code image based on the encoded data.
[0016] Preferably, the complexity metric includes information entropy, structural depth, and character diversity.
[0017] Preferably, the method of splitting the original data into multiple data slices in step S41 includes: dynamically determining the size of the data slices according to at least one of the size of the original data and the number of currently available processing resources.
[0018] Preferably, the method of dynamically determining the size of the data slices includes:
[0019] Slice size = max(pre-set minimum slice size, original data size / (number of CPU cores × α)); α is an adjustment factor.
[0020] Preferably, the method of obtaining the data type of the original data includes: using a regular expression to match a predefined structured data format; using a neural network model to identify and classify the original data to identify image data and / or text data.
[0021] Preferably, the method of determining the complexity metric 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 is the i-th bit of the original data, p(x i ) is the character occurrence probability, n is the length of the original data, and compare the information entropy with a preset information entropy threshold;
[0024] Statistically analyze the proportion of ASCII characters and / or Unicode characters in the original data, and compare the proportion with a preset proportion threshold.
[0025] Preferably, the method for determining the complexity metric further includes:
[0026] If the data type is structured data, parse the nested level of the structured data and compare the nested level with a preset level threshold;
[0027] If the data type is image data, obtain the resolution of the image data and compare the resolution with a preset resolution threshold.
[0028] Preferably, the method for selecting an encoding strategy based on a preset dynamic matching rule includes: using a preset decision tree model, which determines the matching encoding strategy based on the data type of the original data and the comprehensive complexity value calculated according to the preset weights.
[0029] Preferably, the matching encoding strategy includes a combination of multiple encoding strategies, and the combination conditions of the multiple encoding strategies include: there is no execution conflict between the encoding strategies, and the expected total execution time T total of the combination of multiple encoding strategies satisfies: T total ≤α×min(T1,T2,…,T m ), where α is a preset constant, and T m is the expected execution time when each encoding strategy is executed separately.
[0030] Advantageous Effects
[0031] 1. When it is determined that the original data meets the preset parallel processing conditions, the present invention can automatically split the data into multiple shards and use computing resources such as multi-core processors to execute the encoding strategy in parallel. Compared with the traditional single-thread sequential execution method, this parallel processing can significantly shorten the time required to process large-capacity data, significantly improve the QR code generation speed and the overall system throughput, and is particularly suitable for scenarios that require rapid processing of large amounts of data.
[0032] 2. Instead of performing parallel processing on all data, the present invention makes judgments based on preset conditions and only activates the parallel sharding mechanism when necessary. For small-capacity data, traditional direct encoding methods are used to avoid the additional overhead brought by parallelization (such as the costs of thread creation, data segmentation, and merging). This conditional execution strategy enables the method to intelligently adapt to different scales of data input, while ensuring the processing efficiency of small data, effectively utilizing multi-core resources to accelerate big data processing, and achieving optimized utilization of computing resources.
[0033] 3. While efficiently performing encoding, the present invention can also dynamically select the optimal encoding strategy based on data types and complexity metrics, featuring high encoding efficiency and low storage redundancy. The parallel processing mechanism and the dynamic strategy selection mechanism work together to jointly improve the overall performance and quality of QR code generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a schematic flowchart of a QR code generation method based on complexity provided in a preferred embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described below with reference to the accompanying drawings. In the description of the present invention, it should be understood that the orientation or positional relationships indicated by the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", etc. are based on the orientation or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the present invention.
[0036] As Figure 1 shown, the present invention provides a QR code generation method based on complexity, including the steps of:
[0037] S1. Receive the original data to be encoded.
[0038] The original data is the information carrier that will ultimately be encoded and presented as a QR code image. Its specific content determines the basis for subsequent analysis and strategy selection, including but not limited to text strings (including different character sets such as ASCII, Unicode, etc.), website links (URLs), structured data (such as data with hierarchical and key-value pair characteristics like JSON, XML, etc.), even image data (which can be raw pixel information, compressed formats, or text representations such as Base64-encoded text), and any binary data streams and other types of data.
[0039] S2. Analyze the original data to obtain its data type and at least one complexity metric.
[0040] Obtaining the data type refers to identifying whether the data belongs to predefined categories such as text, image, binary stream, or structured data (such as JSON, XML), etc. This lays the foundation for subsequent selection of appropriate analysis methods and coding strategies. For example, image data and text data may require completely different processing logics and complexity evaluation dimensions. In the prior art, the encoding mode defined in the QR code standard is usually relied on to indirectly infer or limit the data type. In some preferred embodiments, a deeper, more accurate, and more fine-grained type recognition method is provided, which provides a solid and reliable basis for subsequent targeted complexity analysis and coding strategy optimization, specifically including:
[0041] The method for obtaining the data type of the original data includes:
[0042] S21. Use regular expressions to match predefined structured data formats. For example, JSON data has its own specific rules for using brackets, quotes, colons, and commas, while XML has tag pairs and attribute definitions. By designing matching regular expressions, it is possible to efficiently and accurately determine whether the input data belongs to these specific structured types.
[0043] S22. Use a neural network model to classify the original data to identify image data and / or text data. The neural network can capture subtle statistical differences between different data types by learning the features of a large number of samples, and can perform effective classification and discrimination even when the data form is relatively complex or there is a certain amount of noise. The specific implementation method can be flexibly selected by those skilled in the art according to the prior art, and the present invention does not make 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 differential complexity analysis and coding strategy selection.
[0045] The determination of data types and complexity metrics constitutes a multi-level understanding of the characteristics of the original data, ensuring that the selected encoding strategy can truly fit the characteristics of the data. Among them, complexity metrics are a series of computable metrics used to quantitatively describe the complexity of the internal characteristics, structure, or information content of the original data. In the prior art, the characteristics of such metrics are often ignored, and only based on the basic data type judgment or using a fixed, preset encoding strategy to uniformly apply the same standard encoding to a certain type of data without considering the actual characteristics inside the data, which is one of the reasons for its low encoding efficiency, high redundancy, and poor adaptability to complex data.
[0046] Among them, the information entropy is an index in information theory to measure the randomness or uncertainty of the information source, and is used to quantitatively describe the randomness degree 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 (such as encrypted data, random number sequences). Low information entropy indicates that the data has more regularity, repetition, or patterns, and is more easily compressed (such as repeated text strings, text with simple structures).
[0047] The structure depth is the maximum depth of the nesting levels in structured data (such as JSON, XML). For example, a simple JSON object {"a":1,"b":2} has a shallow structure depth, while a complex JSON such as {"a":{"b":{"c":[1,2]}}} has a deeper structure depth. The greater the structure depth, usually the more complex the data relationship, and parsing and processing may require more resources, and may also affect the efficiency or applicability of certain specific encoding strategies (such as path-based compression).
[0048] The character diversity is used to measure the richness of different character types that make up the original data (especially text data). It can be expressed as the total number of different characters, or the proportion of characters in a specific character set (such as different blocks in ASCII, Unicode). High character diversity means that the data mixes multiple types of characters (such as uppercase and lowercase letters, numbers, multiple symbols, multi-language texts). Low character diversity indicates that the data is mainly composed of a limited number of characters (such as pure numbers, pure lowercase letters).
[0049] In some preferred embodiments, a specific calculation process for quantifying the complexity of the original data is given, including:
[0050] Calculate the content size of the original data and compare the content size with a preset content size threshold. This step judges the volume scale of the original data.
[0051] Calculate the information entropy of the original data: where x iis the i-th bit of the original data, p(x i ) is the probability of the character appearing, n is the length of the original data, and the information entropy is compared with a preset information entropy threshold to determine whether the data is highly structured and repetitive (low entropy), or close to random and difficult to compress (high entropy).
[0052] Count the proportion of ASCII characters and / or Unicode characters in the original data, and compare the proportion with a preset proportion threshold to evaluate the complexity of the original data in terms of character composition.
[0053] The above preset thresholds (content size threshold, information entropy threshold, character proportion threshold) are boundary points for subsequent decision-making, aiming to distinguish different data characteristic intervals, so as to be able to make optimal strategy selections 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 of the content is not the focus of the present invention and will not be elaborated here.
[0054] In this embodiment, the calculated complexity index is compared with a preset threshold, and the comparison result (such as "greater than / equal to the threshold" or "less than the threshold") directly determines the qualitative judgment of the current original data characteristics. Its specific significance lies in converting the quantitative data analysis into specific and operable decision signals, which is a key bridge connecting data understanding (S2) and strategy selection (S3), ensuring that the selection of the encoding strategy is based on an objective assessment of the inherent complexity of the data, so as to achieve the final optimization goal.
[0055] In some other preferred embodiments, in order to dynamically select a specific index that best reflects the core complexity of the identified data type for measurement according to the identified data type, the method for determining the complexity index further includes:
[0056] If the data type is structured data, parse the nested levels of the structured data, and compare the nested levels with a preset level threshold. By calculating this number of levels and comparing it with the preset level threshold, determine whether the structured data is flat and simple, or deeply nested and complex in relationship.
[0057] If the data type is image data, obtain the resolution of the image data, and compare the resolution with a preset resolution threshold to evaluate the scale and detail level of the image data, which is directly related to the size after converting it into a byte stream suitable for storing in a QR code (such as through Base64 encoding), and whether preprocessing (such as resizing, changing the compression rate) needs to be performed before encoding to adapt to the capacity limit of the QR code or optimize the final scanning experience.
[0058] S3. Based on the preset dynamic matching rules, select at least one matching encoding strategy from the encoding strategy library containing multiple encoding strategies according to the data type and the complexity index.
[0059] The dynamic matching rules determine the decision result (i.e., which encoding strategy to select) according to the real-time input and changing characteristics of the original data (data type and complexity index). Specifically, a preset decision tree model can be used. The decision tree model is based on the data type of the original data and the complexity comprehensive value calculated according to the preset weight to determine the matching encoding strategy. 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 on an attribute (or feature), each branch represents the result of the test, and each leaf node represents the final decision result or classification label. In the scenario of the present invention, this decision tree is specifically designed and trained to perform the task of selecting encoding strategies. The specific design and training methods can be specifically implemented by those skilled in the art according to needs, and the present invention does not make further limitations.
[0060] The encoding strategy library refers to a pre-constructed set containing multiple different encoding strategies (algorithms or methods), which includes various technical solutions for converting the original data into a data stream suitable for QR code generation, including but not limited to: the basic encoding mode of the QR code standard, data compression algorithms, data representation optimization, format conversion strategies, and error correction level selection strategies. In some preferred embodiments, in order to ensure that the encoding strategy library has the ability to continuously evolve and self-improve, so as to ensure that it can always contain the current optimal or effective encoding strategies, a programmed and sustainable encoding strategy library update method is also provided, specifically including: regularly obtaining candidate encoding algorithms from the encoding standard library or open source projects, and adding the 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 rate), execution speed, resource consumption (CPU, memory), correctness (lossless encoding and decoding), robustness (ability to process abnormal data), and compatibility with other strategies in the existing library. Only the 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 in the present invention, not only can a single optimal strategy be selected from the strategy library, but also a strategy combination or strategy chain composed of multiple different strategies can be constructed and selected to achieve a better coding effect that cannot be achieved by a single strategy. In some preferred embodiments, the selection of strategies needs to meet at least the following conditions: there is no execution conflict between the encoding strategies, and the total expected 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 when each encoding strategy is executed alone. Among them, no execution conflict between the encoding strategies means that the multiple strategies combined together must be mutually compatible and can be executed smoothly in a predetermined order (either in parallel or serially), and the subsequent strategy can correctly process the output result of the previous strategy without logical contradictions, data format mismatches, or mutual interference leading to execution failures. The total expected execution time of the strategy combination limits the expected execution time of the strategy with the shortest (i.e., the fastest) execution time among all the individual strategies considered for combination. The preset constant α is usually greater than or equal to 1, which sets a performance tolerance relative to the fastest single strategy. For example, if α = 1.2, it means that the total time of the combined strategy can be up to 20% slower than the fastest single strategy. The time constraint ensures that even when using a multi-strategy combination to pursue better coding quality, the coding process will not become overly slow, thus achieving a reasonable balance between the optimization effect and the execution efficiency. Therefore, this mechanism enables the present invention to explore more complex optimization paths while ensuring that the selected strategy combination is both powerful and practical through strict compatibility and performance threshold screening.
[0062] S4. Execute the matched encoding strategy on the original data to generate encoded data, where the process of executing the matched encoding strategy includes:
[0063] Judge whether the size of the original data is greater than a first preset threshold:
[0064] S41. If so, split the original data into multiple data shards, execute the matched encoding strategy in parallel, and merge the shard-encoded data to obtain the encoded data.
[0065] S42. If not, execute the matched encoding strategy on the original data to obtain the encoded data.
[0066] It should be understood that the first preset threshold is used to distinguish the boundary between "small data" and "big data". The core objective of its setting is to find a balance point: when the data size is lower than this threshold, the total time of sequential execution (encoding time) is usually shorter or comparable to the total time of parallel execution (data segmentation + 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 the total time. The specific setting method can be determined by those skilled in the art according to the specific hardware environment and software environment, and the present invention does not make further requirements.
[0067] The term "segmentation" refers to dividing a larger original data object into multiple smaller data units according to certain rules or strategies. These small units are called data shards and are the prerequisite for parallel processing.
[0068] The method of splitting the original data into multiple data shards in step S41 includes: dynamically determining the size of the data shards according to at least one of the size of the original data and the number of currently available processing resources. Most of the prior arts adopt splitting by fixed size or fixed number. In some preferred embodiments, a dynamic and adaptive splitting method is provided, specifically including: dynamically determining the size of the data shards according to at least one of the size of the original data and the number of currently available processing resources. At this time, it is possible to split only depending on the data size, that is, the larger the data, the larger the shards, or the number of shards remains relatively stable; it is also possible to split only depending on the number of available resources, for example, splitting the data into the same number of shards as the number of CPU cores, and the size of each shard is 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. Specifically, the method of dynamically determining the size of the data shards 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] An ideal shard size is obtained based on the size of the original data and the processing capacity of the system (represented by the number of CPU cores and corrected by an adjustment factor α). However, if the original data is relatively small or the number of CPU cores is very large, the calculated shard size may become extremely small. At this time, there is an excessive parallel task management overhead. Therefore, the max function and a preset minimum shard size are introduced. The role of the max function is to compare the calculated ideal shard size with this preset lower limit and take the larger of the two as the final shard size. This means that no matter how small the calculation result based on the data size and the number of CPU cores is, the actual shard size will at least remain above a preset and considered reasonable minimum value, thus ensuring that each parallel task has sufficient workload and avoiding performance degradation caused by overly small shards. Among them, in parallel tasks, in addition to the key indicator of the number of CPU cores, memory bandwidth, I / O speed, task scheduling efficiency, the characteristics of the encoding algorithm itself (whether it is CPU-intensive or I / O-intensive), etc. may all affect the optimal shard size. Therefore, an adjustment factor α is designed to adjust the effective weight of the number of CPU cores in the shard size calculation. When α = 1, each core can be roughly assigned a shard; when α > 1, on the one hand, it means that there is a tendency to generate more shards than the number of CPU cores to achieve better load balancing and resource utilization. On the other hand, when a certain core finishes its shard task in advance, it can immediately pick up the next shard to be processed instead of waiting for other cores, thereby reducing CPU idle time and increasing throughput; when α < 1, it is often applicable to special situations. For example, parallel tasks consume a large amount of memory, and the total system memory is limited. It is necessary to limit the number of simultaneously running tasks (i.e., the number of shards) 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 parallelism. Therefore, the setting of the adjustment factor α can be determined by those skilled in the art through empirical performance testing and tuning. By comparing the performance performances (such as encoding speed, resource utilization) under different α values, the α value that can provide the best average performance in typical scenarios is selected as the final configuration. This value may be a fixed constant, or in a more complex system, it can even be dynamically fine-tuned according to the 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 shards that would originally need to be processed sequentially are assigned to different processing units (such as different cores of a CPU), allowing them to perform the same encoding operation on their respective data shards within the same time period. The aim is to shorten the overall processing time. The specific implementation method can be either multithreading or multiprocessing. After all data shards have completed their respective encodings through parallel execution, these scattered and already encoded shard-encoded data are recombined into a single, continuous, and complete encoded data stream in 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 the binary data stream or byte sequence that has been processed by the selected encoding strategy and complies with the QR code standard specifications. It usually contains the encoded user data, necessary mode indicators, length indicators, and crucial error correction codewords (ECC). These error correction codewords are generated according to the selected error correction level and are used to ensure that the QR code can still be correctly read when partially damaged. Then, it is filled into a two-dimensional matrix according to the QR code layout rules (including fixed elements such as version information, format information, positioning patterns, calibration patterns, timing patterns, etc.), and an optimal mask pattern is applied to optimize the scannability of the image. Finally, the visually seen square QR code pattern composed of black and white squares (modules) that can be directly recognized by scanning devices is rendered and output.
[0074] The above shows and describes 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 by the above embodiments. What is described in the above embodiments and the specification only illustrates the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed. The scope of protection claimed by the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for generating a two-dimensional code based on complexity, characterized in that, Including the steps: S1. Receive the original data to be encoded; S2. Analyze the original data to obtain its data type and at least one complexity metric; S3. Based on a preset dynamic matching rule, select at least one matching encoding strategy from an encoding strategy library containing multiple encoding strategies according to the data type and the complexity metric; S4. Execute the matching encoding strategy on the original data to generate encoded data, wherein the process of executing the matching encoding strategy includes: Judge whether the size of the original data is greater than a first preset threshold: S41. If so, split the original data into multiple data shards, execute the matching encoding strategy in parallel, and merge the shard-encoded data to obtain the encoded data; S42. If not, execute the matching encoding strategy on the original data to obtain the encoded data; S5. Generate a two-dimensional code image based on the encoded data.
2. The method for generating a two-dimensional code based on complexity according to claim 1, wherein The complexity metric includes information entropy, structural depth, and character diversity.
3. The method for generating a two-dimensional code based on complexity according to claim 1, wherein, The method of splitting the original data into multiple data shards in step S41 includes: dynamically determining the size of the data shards according to at least one of the size of the original data and the number of currently available processing resources.
4. The method for generating a two-dimensional code based on complexity according to claim 3, wherein The method of dynamically determining the size of the data shards includes: Shard size = max(preset minimum shard size, original data size / (number of CPU cores × α)); α is an adjustment factor.
5. The method for generating a two-dimensional code based on complexity according to claim 1, wherein The method of obtaining the data type of the original data includes: using a regular expression to match a predefined structured data format; using a neural network model to identify and classify the original data to identify image data and / or text data.
6. The method for generating a two-dimensional code based on complexity according to claim 1, wherein, The method of determining the complexity metric includes: Calculate the content size of the original data and compare the content size with a preset content size threshold; Calculate the information entropy of the original data: where x i is the i-th bit of the original data, p(x i ) is the character occurrence probability, n is the length of the original data, and compare the information entropy with a preset information entropy threshold; Statistically analyze the proportion of ASCII characters and / or Unicode characters in the original data and compare the proportion with a preset proportion threshold.
7. The method for generating a two-dimensional code based on complexity according to claim 6, wherein The method of determining the complexity metric also includes: If the data type is structured data, parse the nested level of the structured data and compare the nested level with a preset level threshold; If the data type is image data, obtain the resolution of the image data and compare the resolution with a preset resolution threshold.
8. The complexity-based QR code generation method according to claim 1, characterized in that The method of selecting an encoding strategy based on a preset dynamic matching rule includes: using a preset decision tree model, and the decision tree model determines the matching encoding strategy based on the data type of the original data and the complexity comprehensive value calculated according to a preset weight.
9. The method for generating a two-dimensional code based on complexity according to claim 8, wherein The described matching coding strategy includes a combination of multiple coding strategies. The combination conditions of the multiple coding strategies include: there is no execution conflict between the coding strategies, and the expected total execution time T of the combination of multiple coding strategies total satisfies: T total ≤α×min(T1,T2,…,T m ), where α is a preset constant, and T m is the expected execution time when each coding strategy is executed separately.
Citation Information
Patent Citations
Data information two-dimensional code encoding method
CN103530669A
Data transmission method, transmission system, acquisition equipment and receiving equipment
CN114239779A
Coding control method and device, equipment and storage medium
CN117750017A
Low-delay video transmission method and system
CN118945364A
Communication method and system for time-delay-free ultra-high-definition image transmission IP core software
CN119325015A