Lossless compression method based on finding common difference to eliminate redundancy
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHANGZHOU WHISPER TECH CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-05-29
Smart Images

Figure CN122120469A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image and video processing and lossless compression technology, specifically to a lossless compression method based on finding common differences to eliminate redundancy. Background Technology
[0002] Lossless image compression is a classic problem in the field of information coding. Its core challenge lies in how to efficiently eliminate spatial redundancy in image data while maintaining the integrity and reconstructability of information. Current mainstream lossless image coding standards generally adopt a prediction-residual coding framework, which estimates the current pixel value through a spatial domain prediction model and then entropy-encodes the prediction residual. However, such methods still have significant limitations in complex image content and high-fidelity application scenarios.
[0003] Existing prediction models mostly rely on fixed-direction gradient detection or local linear extrapolation, which makes it difficult to effectively capture the non-stationary texture structures and non-linear edge features that are widely present in natural images. When the prediction model and local statistical properties are mismatched, the residual signal exhibits a high-frequency dispersed distribution, leading to a significant decrease in the efficiency of subsequent entropy coding.
[0004] Traditional methods lack systematic utilization of image block-level structural redundancy. Although some methods introduce context-adaptive mechanisms, they still fail to establish efficient block-level labeling and reuse mechanisms when processing image regions with repetitive patterns or local self-similarity, thus limiting further improvements in their compression performance.
[0005] Existing encoders generally lack flexibility in predictive path selection and difference representation optimization, making it difficult to achieve an effective balance between computational complexity and compression efficiency.
[0006] In recent years, deep learning-based methods (such as end-to-end neural network compression) have struggled to meet the demands of real-time processing and embedded system deployment.
[0007] Therefore, exploring block-level redundancy elimination mechanisms that combine strong adaptability, low complexity, and high compression ratio within traditional coding frameworks has become an important research direction in this field. Summary of the Invention
[0008] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a lossless compression method based on finding common differences to eliminate redundancy. It has the advantages of low compression ratio, complete reversibility, strong adaptability and high computational efficiency, and is suitable for fast motion scenarios and real-time lossless compression requirements.
[0009] To solve the above-mentioned technical problems, the technical solution of the present invention is: a lossless compression method based on finding common differences to eliminate redundancy, comprising: Divide the current video frame into multiple non-overlapping n*m pixel blocks, where n and m are integers greater than or equal to 2; For each pixel block, determine whether there is a pixel block that is completely identical to it in its preset neighboring pixel blocks; if so, the pixel block is marked as a neighboring overlapping sample and included in the data statistics; if not, determine whether all the pixels in the pixel block are the same; if so, extract a single corner pixel; if not, extract all pixels. Boundary condition difference processing is performed on the boundary pixels of the current video frame; for the extracted non-boundary pixels, it is determined whether there are identical pixels in its preset neighboring pixels; if so, the pixel is marked as an adjacent pixel overlap sample and included in the data statistics; if not, the difference vector is calculated and judged sequentially according to the preset difference vector priority calculation method. If the current condition is met, it is included in the data statistics; if the current condition is not met, the difference vector is put into the difference group and the process moves to the next condition until all conditions are judged. Based on the optimal difference selection algorithm, an optimal difference vector is selected from each difference group and labeled, and then added to the difference dictionary. After encoding and optimizing all labeled difference vectors, they are included in the data statistics. Entropy coding is performed on all tags and data included in the data statistics.
[0010] Furthermore, the preset neighboring pixel blocks for each pixel block include adjacent pixel blocks that were traversed before it in the traversal order.
[0011] Furthermore, when extracting a single corner pixel, the orientation of the extracted corner is consistent with the starting orientation of the current video frame traversal.
[0012] Furthermore, the preset priority of the difference vector is: Model prediction difference vector > first-order difference vector > second-order difference vector.
[0013] Furthermore, the model is a nine-reference-point prediction model, which is based on dual-channel weighted prediction.
[0014] Furthermore, the optimal difference selection algorithm includes: The algorithm is executed according to the priority order: dictionary-based optimal matching algorithm > uniform difference optimal matching algorithm > preset pattern matching algorithm; among which... The dictionary-based optimization matching algorithm includes: if only one difference vector exists in the difference dictionary in the difference group, select and mark that difference vector; if at least two difference vectors exist in the difference dictionary in the difference group, determine whether those at least two difference vectors exist. If so, select The one with the smallest absolute sum difference is marked; otherwise, the one with the smallest absolute sum difference is selected and marked. If no difference vector exists in the difference dictionary in the difference group, the uniform difference optimization algorithm is executed. These are the three components of the difference vector; The uniform difference optimization algorithm includes: if there are difference vectors in the difference group that satisfy... Choose to satisfy The difference vector with the smallest absolute value is marked and stored in the difference dictionary; if no difference vector in the difference group satisfies this condition... Execute the preset pattern matching algorithm; These are the three components of the difference vector; The preset pattern matching algorithm includes: if there is a difference vector in the difference group that exists in the preset pattern array, select the difference vector that exists in the preset pattern array and has the smallest absolute value sum, mark it, and store it in the difference dictionary; if there is no difference vector in the difference group that exists in the preset pattern array, select the difference vector that has the smallest absolute value sum, mark it, and store it in the difference dictionary.
[0015] Furthermore, the difference vectors of all labels are encoded and optimized before being included in the data statistics; specifically, this includes: First, match the preset pattern array. If a match is found, mark it again and proceed to data statistics. If no match can be found: if , mark and store To the set of uniform differences; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; Otherwise, Store the entire component set; The uniform difference set, the first difference set, and the full component set are included in the data statistics.
[0016] Furthermore, boundary condition differential processing is performed on the boundary pixels of the current video frame; specifically including: Initial pixel processing: The original pixel values are directly stored in the difference dictionary, and then the difference vector encoding is optimized.
[0017] Processing the first row of non-starting pixels: Calculate the difference vector between the current pixel and the pixels in the previous traversal. If the difference vector does not exist in the difference dictionary, store it in the difference dictionary and store it in the difference group. Processing the first and non-starting pixels: Calculate the difference vectors with the two neighboring pixels respectively, and store them in the difference group; For the last column and not the first row of pixels, calculate the difference vectors between the last and the four adjacent pixels and store them in the difference group.
[0018] By adopting the above technical solution, the present invention has the following beneficial effects: Common difference is a core encoding logic in lossless compression based on pixel correlation. Its core idea is to leverage the strong correlation between adjacent pixels in the spatial domain, as well as between pixels in the same row and column, to extract and centrally encode the "common difference" between related pixels, rather than independently encoding the original value of each pixel. This achieves efficient compression while ensuring complete reversibility. Furthermore, this method, with its simple computational logic and flexible adaptability, perfectly meets the core requirements of high-speed motion scenarios and real-time lossless compression. It possesses advantages such as complete reversibility, strong adaptability, and high computational efficiency, making it particularly suitable for fast-moving scenarios and real-time lossless compression needs. It shows promising application prospects in fields such as medical imaging and remote sensing data transmission. Attached Figure Description
[0019] Figure 1 This is a flowchart of the lossless compression method for eliminating redundancy based on finding common differences according to the present invention; Figure 2 This is a flowchart of step S1 of the present invention; Figure 3 This is a flowchart of steps S22 to S26 of the present invention; Figure 4 This is a flowchart of the optimal difference algorithm of the present invention; Figure 5 This is a flowchart of step S3 of the present invention. Detailed Implementation
[0020] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0021] like Figure 1 As shown, a lossless compression method based on finding common differences to eliminate redundancy includes: Divide the current video frame into multiple non-overlapping n*m pixel blocks, where n and m are integers greater than or equal to 2; For each pixel block, determine whether there is a pixel block that is completely identical to it in its preset neighboring pixel blocks; if so, the pixel block is marked as a neighboring overlapping sample and included in the data statistics; if not, determine whether all the pixels in the pixel block are the same; if so, extract a single corner pixel; if not, extract all pixels. Boundary condition difference processing is performed on the boundary pixels of the current video frame; for the extracted non-boundary pixels, it is determined whether there are identical pixels in its preset neighboring pixels; if so, the pixel is marked as an adjacent pixel overlap sample and included in the data statistics; if not, the difference vector is calculated and judged sequentially according to the preset difference vector priority calculation method. If the current condition is met, it is included in the data statistics; if the current condition is not met, the difference vector is put into the difference group and the process moves to the next condition until all conditions are judged. Based on the optimal difference selection algorithm, an optimal difference vector is selected from each difference group and labeled, and then added to the difference dictionary. After encoding and optimizing all labeled difference vectors, they are included in the data statistics. Entropy coding is performed on all tags and data included in the data statistics.
[0022] In some examples, the preset neighboring pixel blocks for each pixel block include adjacent pixel blocks that were traversed before it in the traversal order.
[0023] In some examples, when extracting a single corner pixel, the orientation of the extracted corner is consistent with the starting orientation of the current video frame traversal.
[0024] In some examples, the default priority of the difference vector is: Model prediction difference vector > first-order difference vector > second-order difference vector.
[0025] In some examples, the model is a nine-reference-point prediction model based on dual-channel weighted prediction.
[0026] In some examples, the optimal difference selection algorithm includes: The algorithm is executed according to the priority order: dictionary-based optimal matching algorithm > uniform difference optimal matching algorithm > preset pattern matching algorithm; among which... The dictionary-based optimization matching algorithm includes: if only one difference vector exists in the difference dictionary in the difference group, select and mark that difference vector; if at least two difference vectors exist in the difference dictionary in the difference group, determine whether those at least two difference vectors exist. If so, select The one with the smallest absolute sum difference is marked; otherwise, the one with the smallest absolute sum difference is selected and marked. If no difference vector exists in the difference dictionary in the difference group, the uniform difference optimization algorithm is executed. These are the three components of the difference vector; The uniform difference optimization algorithm includes: if there are difference vectors in the difference group that satisfy... Choose to satisfy The difference vector with the smallest absolute value is marked and stored in the difference dictionary; if no difference vector in the difference group satisfies this condition... Execute the preset pattern matching algorithm; These are the three components of the difference vector; The preset pattern matching algorithm includes: if there is a difference vector in the difference group that exists in the preset pattern array, select the difference vector that exists in the preset pattern array and has the smallest absolute value sum, mark it, and store it in the difference dictionary; if there is no difference vector in the difference group that exists in the preset pattern array, select the difference vector that has the smallest absolute value sum, mark it, and store it in the difference dictionary.
[0027] In some examples, the difference vectors of all tags are encoded and optimized before being included in the data statistics; specifically: First, match the preset pattern array. If a match is found, mark it again and include it in the data statistics. If no match can be found: if , mark and store To the set of uniform differences; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; Otherwise, Store the entire component set; The uniform difference set, the first difference set, and the full component set are included in the data statistics.
[0028] In some examples, boundary condition differencing is performed on the boundary pixels of the current video frame; specifically including: Initial pixel processing: The original pixel values are directly stored in the difference dictionary, and then the difference vector encoding is optimized.
[0029] Processing the first row of non-starting pixels: Calculate the difference vector between the current pixel and the pixels in the previous traversal. If the difference vector does not exist in the difference dictionary, store it in the difference dictionary and store it in the difference group. Processing the first and non-starting pixels: Calculate the difference vectors with the two neighboring pixels respectively, and store them in the difference group; For the last column and not the first row of pixels, calculate the difference vectors between the last and the four adjacent pixels and store them in the difference group.
[0030] The solutions involved in the above embodiments will be described in detail below with reference to specific examples.
[0031] like Figure 1 As shown, a lossless compression method based on finding common differences to eliminate redundancy (traversing from the top left corner of the video frame) includes: Step S1: Image frame analysis and sample classification.
[0032] Let the resolution of the input video frame be... ,in Indicates the number of pixels in the height direction. This indicates the number of pixels in the width direction.
[0033] Step S11: Divide the current frame into several non-overlapping segments. Pixel block. Each pixel block can be represented as:
[0034] in , Represents pixel values (r, g, b).
[0035] Step S12, for each pixel block Evaluate its spatial consistency with neighboring blocks. If any neighboring blocks exist... (in (And the index is valid) satisfies:
[0036] Then the pixel block The samples marked as "overlapping samples in adjacent areas" are included in the data statistics.
[0037] If there are no adjacent blocks satisfy But pixel blocks The inner pixels are completely consistent:
[0038] Extract pixels .
[0039] For samples that do not meet any of the above conditions, extract all pixels within the pixel block.
[0040] Step S2: Pixel-level prediction and optimal difference vector labeling.
[0041] This step focuses on the individual pixels and boundary pixels extracted in step S1, establishing an encoding and labeling system with pixels as the basic unit. Specifically, it includes: Step S21, for boundary pixels (starting pixel, first row pixel, first column and last column pixel).
[0042] Boundary condition differential processing: Starting pixel processing: For the start position of the frame The original pixel values are directly stored in the difference dictionary, and then the difference vector encoding is optimized.
[0043] First row and non-starting pixel processing
[0044] Calculate the current pixel With the left pixel Difference vector:
[0045] If the difference vector If it does not exist in the difference dictionary, then store it in the dictionary and in the difference group.
[0046] Processing the first column and non-starting pixels
[0047] Calculate two sets of difference vectors (current pixel) With the pixel directly above and the top right pixel (difference vector)
[0048]
[0049] Store in the difference group.
[0050] Processing pixels in the last column that are not in the first row
[0051] Calculate four sets of difference vectors (current pixel) With the pixel directly above Left pixel and the top left pixel (difference vector)
[0052] Store in the difference group.
[0053] Step S22, for the single pixel extracted in step S1 that is a non-boundary pixel.
[0054] For the current pixel position Prioritize detection of its spatial proximity area. Check if there are duplicate pixel values. If duplicate values exist, mark them as "overlapping adjacent pixels" and include them in the data statistics; otherwise, proceed to step S22.
[0055] It's important to note that these four neighborhoods are the best performing ones found so far, specifically for traversing from the top left corner. While other neighborhoods can also achieve the same result, they don't reach the optimal performance of these four. This is the encoding process; there's also a decoding process. The decoding process depends on the already decoded positions. If encoding starts from the top left corner (the usual (0,0) position), these four positions are used. Decoding also starts from (0,0), relying on the decoded positions. If starting from the top right corner (0, w-1), then (y-1, x-1), (y-1, x), (y-1, x+1), and (y, x+1) are used. Different directions require different positions.
[0056] Step S23: Based on spatial correlation theory, construct a prediction model containing nine reference points (reference pixels): Reference point coordinate set:
[0057]
[0058]
[0059] Based on dual-channel weighted prediction calculation: Each reference point has its corresponding K value and RGB value. Bias is used for weighting.
[0060] First prediction channel:
[0061]
[0062]
[0063] Second prediction channel:
[0064]
[0065]
[0066] Final predicted values synthesized:
[0067]
[0068]
[0069] , , The RGB values of the points to be calculated Bias; ( , , ), ( , , )……( , , ) are the pixel values (R, G, B) at positions A, B...I respectively; , , , , , These are the coefficients K for reference pixels A, B, D, E, F, G, H, and I, respectively. n is a constant, 0 < n < 1, which improves the accuracy of probability prediction.
[0070] In this embodiment, K A = 1.893248; K E =1.703452; K G =0.778486; K I = 0.651277; K B =1.906357; K F = 1.799652; K H = 0.850945; K J = 0.707524; β R = -0.164052; β G = -0.147988; β B = -0.162730.
[0071] Will , The predicted value can be obtained by rounding down.
[0072] In this step, the nine reference points and their K values are obtained using deep learning. The acquisition process is as follows: Based on the raster scanning order of image processing (from left to right, from top to bottom), the causal neighborhood of the current pixel (i.e. the top left, left side, top right, and top right pixels that have been processed in the encoding / decoding stage) is selected, and the values of these neighborhood pixels are flattened into a one-dimensional feature vector, which is used as the input of a lightweight deep learning model (composed of fully connected layers + activation functions). Secondly, based on the end-to-end training results of massive image data, the deep learning model performs feature encoding and correlation evaluation on the input neighborhood feature vector, outputs the correlation score between each neighboring pixel and the current pixel, and automatically selects the Top-M pixels with the highest scores as the set of strongly correlated pixels. Next, the set of strongly correlated pixels is input into a deep learning coefficient mapping model that has been trained and optimized offline (the training objective is to minimize the error between the predicted value and the true value of the pixel). The model dynamically outputs the optimal weight coefficient corresponding to each strongly correlated pixel (the coefficient supports positive and negative values and can represent the enhancement, suppression or difference relationship between pixels). Finally, we obtain the strongly correlated pixel values, corresponding weight coefficients, number of strongly correlated pixels, and corresponding biases.
[0073] Step S24, set the current pixel position The difference between the predicted value and the actual pixel value is calculated. If the difference vector meets the requirement (which can be 0), it is included in the data statistics; if the difference vector does not meet the requirement, the difference vector is stored in the difference group, and step S24 is executed. Step S25, First-order differential detection: Calculate the current pixel With the left pixel Color difference vector:
[0074] like or If the result is positive, it is classified as a "first-order difference sample" and included in the data statistics; otherwise, the difference vector (i.e., the first-order difference result) is stored in the difference group and step S25 is executed. Step S25, Second-order difference detection: Calculate the Laplacian operator based on four neighboring pixels.
[0075] in like or If the difference is significant, it is classified as a "second-order difference sample" and included in the data statistics; otherwise, it is marked as an "irregular sample," and the difference vector (i.e., the second-order difference result) is recorded. Store it in the difference group.
[0076] It should be noted that if a pixel cannot be predicted because it does not have nine reference points, steps S22 to S24 can be skipped and the process can proceed directly to step S25.
[0077] Step S26: Select an optimal difference vector from the difference group based on the optimal difference selection algorithm and add it to the difference dictionary.
[0078] Step S3, for the difference vector of all labels After hierarchical coding optimization, it is included in the data statistics; specifically including: Preset pattern detection: Prioritize matching the preset pattern array. If a match is found, mark it again and include it in the data statistics; Preset pattern array This is a custom set of common difference groups, representing the most frequently used difference combinations across multiple videos. For example, G = [(0, 0, 0), (1, 1, 1),(-1, -1, -1),(2, 2, 2), (-2, -2, -2),(4, 0, 0), (0, 4, 0), (0, 0, 4), (2, 2, 0), (0, 2, 2),(2, 0, 2)]. This array is mutable.
[0079] If no match can be found: First, perform uniform vector encoding: if , mark and store To a uniform set of differences; if not, perform dual-channel correlation encoding: if , mark and store To the set of uniform differences; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; Otherwise, Store the entire component set; The uniform difference set, the first difference set, and the full component set are included in the data statistics.
[0080] This hierarchical encoding strategy makes full use of the correlation between color channels, significantly improves compression efficiency through differential dictionaries and pattern matching, and provides optimized input data for the subsequent entropy encoding stage.
[0081] Step S4: Entropy coding and lossless compression.
[0082] This step performs entropy encoding on all data and tags included in the data statistics of the previous steps to achieve lossless compression.
[0083] It is important to note that this step involves entropy encoding of all recorded tags and data after all pixels have been processed. The scheme in this embodiment is compared with the zip method as follows.
[0084]
[0085] The compression ratio calculation formula is: Compression ratio = (Size of compressed data / Size of original video data) × 100%. In lossless compression scenarios, the smaller the size of the compressed file, the lower the compression ratio and the better the compression effect. During file storage and transmission, the smaller the file size, the lower the storage and transmission load. Therefore, lossless compression is preferred when the compression ratio is as low as possible. Here, "lossless" means that the original data before compression and the data after decompression are completely identical, and the decompression process can achieve complete data restoration.
[0086] ZIP compression is a typical lossless compression method and can be used as a comparison benchmark in this embodiment. At the same time, in the design and implementation of the compression algorithm, it is also necessary to ensure the reversibility of data during decompression, so as to ensure that the compressed data can be restored to the original data without distortion or loss.
[0087] The solution in this embodiment can achieve the following: First, the common difference achieves "complete reversibility".
[0088] Complete reversibility is the core premise of lossless compression. Through a closed-loop logic of "difference extraction - reversible derivation of the original value," the common difference ensures that the compressed data can be 100% restored to the original image without any loss of pixel information. The core logic consists of two steps: 1. The basis for the reversibility of difference extraction: Adjacent pixels in video frames or images (whether horizontally / vertically adjacent pixels within the same frame, or corresponding pixels in adjacent frames in a dynamic scene) typically have small color value differences and exhibit a large number of repetitive or regular differences (i.e., "common differences"). For example, in the background area of a static image, the grayscale difference between adjacent pixels may be fixed at 0 or ±1; in fast-moving scenes, the pixel differences of the same object pixels in adjacent frames due to motion displacement also show a concentrated distribution (e.g., during horizontal motion, the pixel difference between horizontally adjacent frames is a fixed offset). Common difference encoding only extracts these "differences," rather than modifying or discarding any original pixel information.
[0089] 2. Reversible Derivation Logic of Original Values: During encoding, only the original value of a "base pixel" (such as the first pixel of the frame or the top-left pixel of a region) is retained. All subsequent pixels are stored in the form of "base pixel value + common difference". During decoding, only the original value of the base pixel is called, and the stored common difference is added in reverse according to the selected calculation method to accurately restore the original value of each pixel without any error. For example, if the base pixel value is 120, and the common difference of subsequent pixels is +1, 0, and -1, then the decoded pixel values are 121, 120, and 119 respectively, which are completely consistent with the original values. This "base value + difference" storage logic has no information loss and is the core guarantee of complete reversibility.
[0090] Second, the common differences enable "strong adaptability".
[0091] The strong adaptability of the common difference is reflected in its ability to flexibly adapt to different types of images and different scenes (especially fast-moving scenes), without the need for complex scene prediction or parameter adjustment. The core of this is its "adaptive difference capture" feature: 1. Versatility to adapt to different image qualities and scenes: Whether it is a static image (landscape, text, portrait) or a dynamic sequence (fast-moving video frames, real-time captured images), the common differences can be automatically captured to capture the correlation between pixels. In static scenes, the common differences between adjacent pixels in the spatial domain (such as the fixed difference in the background area) are focused on. In fast-moving scenes, the common differences in the spatial domain (pixel correlation within a single frame) and the temporal domain (pixel correlation between adjacent frames) are captured simultaneously without switching the encoding logic.
[0092] 2. Core Advantages for Fast-Moving Scenes: The core pain point of fast-moving scenes is "drastic pixel changes between frames, but local correlations still exist" (e.g., the pixels of a moving object itself do not change significantly, only its position shifts; background pixels remain basically unchanged). The shared difference approach eliminates the need for complex calculations of motion trajectories; it only extracts the "difference between corresponding pixels in adjacent frames" (i.e., the shared difference between frames) to efficiently capture pixel changes caused by motion. For the shift of moving objects, the shared difference between frames exhibits a regular distribution; for static backgrounds, the shared difference between frames is 0, allowing for rapid encoding and compression without additional motion compensation, thus adapting to scenes with fast motion speeds and complex inter-frame changes.
[0093] 3. Anti-interference and scene fault tolerance: Even if there is slight noise in the image (such as noise in real-time acquired images), the common difference can still focus on the "main difference pattern" and ignore the random noise difference (which can be achieved through simple threshold screening). No complicated noise reduction preprocessing is required. It can ensure compression efficiency and restore the details of the original image after decoding, and is suitable for various complex real-time acquisition scenarios (such as monitoring and motion capture).
[0094] Third, the common difference achieves "efficient computation".
[0095] Computational efficiency is key to the "real-time lossless compression" of common difference adaptation. Its core advantage lies in "simple computational logic and low computational load," requiring only basic addition and subtraction operations and difference statistics, without complex matrix operations or transform encoding (such as JPEG's DCT transform). 1. Low computational load in the encoding stage: The encoding process involves only three basic operations: ① Selecting a reference pixel (no calculation required, directly selecting a pixel at a fixed position); ② Calculating the difference according to several calculation methods described in the instructions; ③ Selecting existing differences from a preset pattern array or from an established dictionary to reduce the number of differences and increase the repetition frequency; ④ Statistically analyzing the frequency of common differences and simplifying the encoding of high-frequency common differences. The entire process involves no multiplication or matrix transformation, resulting in extremely low computational load and enabling rapid single-frame encoding.
[0096] 2. Rapid Reconstruction in the Decoding Stage: The decoding process is the reverse of the encoding process, requiring only the addition of "base pixel value + common difference," without the need for complex inverse transformations or inverse quantization. The operational logic is simpler than traditional lossless compression (such as PNG). For example, during decoding, the base pixel value is called, the calculation method is extracted, and the stored differences are sequentially added to reconstruct the original pixel value in real time. The decoding latency is extremely low, meeting the requirements for real-time transmission and display.
[0097] 3. Strong hardware adaptability, further improving efficiency: Since the calculation of common difference is only a basic addition and subtraction operation, it does not require high-performance hardware support. Ordinary embedded devices and real-time acquisition devices (such as action cameras and surveillance cameras) can easily carry it. Without additional hardware upgrades, the entire process of "real-time compression-real-time transmission-real-time decoding" can be realized. The computational efficiency is far higher than lossless compression algorithms that require complex transformations (such as JPEG 2000).
[0098] In summary, the core value of shared difference lies in "accurately capturing pixel correlation and simplifying encoding logic": It achieves completely lossless compression through the reversible storage logic of "baseline value + shared difference"; it adapts to different scenarios (especially fast-moving scenarios) by adaptively capturing shared differences in the spatial / temporal domains; and it achieves high computational efficiency and low latency through a low-computation design based on basic addition and subtraction operations. The synergistic effect of these three factors makes it one of the optimal encoding schemes for fast-moving scenarios (such as real-time monitoring and motion recording) and real-time lossless compression requirements (such as evidence preservation and high-definition real-time transmission). It solves the pain points of high computational load and high latency in traditional lossless compression while also compensating for the information loss inherent in lossy compression.
[0099] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.
Claims
1. A lossless compression method based on finding common differences to eliminate redundancy, characterized in that, include: Divide the current video frame into multiple non-overlapping n*m pixel blocks, where n and m are integers greater than or equal to 2; For each pixel block, determine whether there is a pixel block that is completely identical to it in its preset neighboring pixel blocks; if so, the pixel block is marked as a neighboring overlapping sample and included in the data statistics; if not, determine whether all the pixels in the pixel block are the same; if so, extract a single corner pixel; if not, extract all pixels. Boundary condition difference processing is performed on the boundary pixels of the current video frame; for the extracted non-boundary pixels, it is determined whether there are identical pixels in its preset neighboring pixels; if so, the pixel is marked as an adjacent pixel overlap sample and included in the data statistics; if not, the difference vector is calculated and judged sequentially according to the preset difference vector priority calculation method. If the current condition is met, it is included in the data statistics; if the current condition is not met, the difference vector is put into the difference group and the process moves to the next condition until all conditions are judged. Based on the optimal difference selection algorithm, an optimal difference vector is selected from the difference group and labeled, and then added to the difference dictionary. After encoding optimization of all labeled difference vectors, they are included in the data statistics. Entropy coding is performed on all tags and data included in the data statistics.
2. The lossless compression method based on finding common differences to eliminate redundancy according to claim 1, characterized in that, Each pixel block's preset neighboring pixel blocks include adjacent pixel blocks that were traversed before it in the traversal order.
3. The lossless compression method based on finding common differences to eliminate redundancy according to claim 1, characterized in that, When extracting a single corner pixel, the orientation of the extracted corner is consistent with the starting orientation of the current video frame traversal.
4. The lossless compression method based on finding common differences to eliminate redundancy according to claim 1, characterized in that, The default priority of the difference vector is: Model prediction difference vector > first-order difference vector > second-order difference vector.
5. The lossless compression method based on finding common differences to eliminate redundancy according to claim 4, characterized in that, The model is a nine-reference-point prediction model, which is based on dual-channel weighted prediction.
6. The lossless compression method based on finding common differences to eliminate redundancy according to claim 1, characterized in that, The optimal difference selection algorithm includes: The algorithm is executed according to the priority order: dictionary-based optimal matching algorithm > uniform difference optimal matching algorithm > preset pattern matching algorithm; among which... The dictionary-based optimal matching algorithm includes: if only one difference vector exists in the difference dictionary in the difference group, select and mark that difference vector; if at least two difference vectors exist in the difference dictionary in the difference group, determine whether those at least two difference vectors exist. If so, select The one with the smallest absolute sum difference is marked; otherwise, the one with the smallest absolute sum difference is selected and marked. If no difference vector exists in the difference dictionary in the difference group, the uniform difference optimization algorithm is executed. These are the three components of the difference vector; The uniform difference optimization algorithm includes: if there are difference vectors in the difference group that satisfy... Choose to satisfy The difference vector with the smallest absolute value is marked and stored in the difference dictionary; if no difference vector in the difference group satisfies this condition... Execute the preset pattern matching algorithm; The preset pattern matching algorithm includes: if there is a difference vector in the difference group that exists in the preset pattern array, select the difference vector that exists in the preset pattern array and has the smallest absolute value sum, mark it, and store it in the difference dictionary; if there is no difference vector in the difference group that exists in the preset pattern array, select the difference vector that has the smallest absolute value sum, mark it, and store it in the difference dictionary.
7. The lossless compression method based on finding common differences to eliminate redundancy according to claim 6, characterized in that, After optimizing the encoding of the difference vectors of all tags, they are included in the data statistics; Specifically, it includes: First, match the preset pattern array. If a match is found, mark it again and include it in the data statistics. If no match can be found: if , mark and store To the uniform set of differences; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; if , mark and store To the uniform difference set, To the first difference set; Otherwise, Store the entire data in the complete component set; The uniform difference set, the first difference set, and the full component set are included in the data statistics.
8. The lossless compression method for eliminating redundancy based on finding common differences according to claim 1, characterized in that, Perform boundary condition differencing on the boundary pixels of the current video frame; specifically including: Initial pixel processing: Directly store the original pixel values into the difference dictionary, and then perform difference vector encoding optimization; Processing the first row of non-starting pixels: Calculate the difference vector between the current pixel and the pixels in the previous traversal. If the difference vector does not exist in the difference dictionary, store it in the difference dictionary and store it in the difference group. Processing the first and non-starting pixels: Calculate the difference vectors with the two neighboring pixels respectively, and store them in the difference group; For the last column and not the first row of pixels, calculate the difference vectors between the last and the four adjacent pixels and store them in the difference group.