Video lossless compression method, device and medium in H.264 encoding environment

By introducing an improved CABAC method with adaptive codeword length adjustment, context model selection optimization and adaptive probability update in the H.264 coding environment, the problems of insufficient compression efficiency and coding flexibility in H.264 video compression technology are solved, and lossless compression and efficient coding are achieved.

CN118741158BActive Publication Date: 2025-10-21CHINA UNICOM ONLINE INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410768212.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2025-10-21
Estimated Expiration
2044-06-14

AI Technical Summary

Technical Problem

The existing H.264 video compression technology has insufficient compression efficiency and encoding flexibility when processing complex video signals, and cannot achieve lossless compression. In addition, the traditional entropy coding method lacks an adaptive adjustment mechanism, resulting in limited encoding quality and efficiency.

Method used

An improved CABAC method with adaptive codeword length adjustment, context model selection optimization and adaptive probability update mechanism is adopted. Combining coding control, transformation and quantization, inverse transformation and inverse quantization, predictive coding and other steps, the coding parameters are dynamically adjusted to adapt to different video content and network environment.

Benefits of technology

It significantly improves video compression efficiency, ensures lossless compression effect, reduces video data redundancy, and improves encoding flexibility and encoding quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118741158B_ABST
    Figure CN118741158B_ABST
Patent Text Reader

Abstract

The application provides a video lossless compression method, device and medium in H.264 coding environment, including coding control, transformation and quantization, inverse transformation and inverse quantization, prediction coding and entropy coding. An improved CABAC method is introduced in the entropy coding stage, including adaptive code length adjustment, context model selection optimization and adaptive probability updating mechanism. The adaptive code length adjustment adjusts the code length according to the symbol frequency by real-time statistics of the symbol frequency, and ensures that high-frequency symbols use shorter code words; the context model selection optimization selects the optimal context model by analyzing the video features, and improves the accuracy of the probability model; the adaptive probability updating mechanism adjusts the probability distribution in real time according to the symbol frequency, so that the model can quickly adapt to the input data changes. The method can effectively improve the coding efficiency and ensure the lossless compression effect of the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of video processing technology, and in particular to a method, device and medium for lossless video compression in an H.264 encoding environment. Background Art

[0002] With the rapid development of video technology, video compression plays a vital role in multimedia transmission and storage. H.264 / MPEG-4 AVC (Advanced Video Coding), a widely used video compression standard, holds a prominent position in the video coding field due to its efficient compression performance and excellent video quality. However, despite its significant advantages in compression efficiency and image quality, existing technologies still face some technical challenges in practical applications, urgently requiring further improvement and optimization.

[0003] In particular, existing entropy coding methods still lack compression efficiency and coding flexibility when processing complex video signals. CAVLC (Context-Adaptive Variable-Length Coding) and CABAC (Context-Adaptive Binary Arithmetic Coding), the main entropy coding methods used in H.264, perform well in improving compression efficiency. However, they lack an adaptive adjustment mechanism during the encoding process, resulting in suboptimal compression efficiency and coding quality when processing videos with different contents. This limits compression performance, meaning that lossless compression benefits cannot be achieved. Furthermore, the CAVLC method is commonly used in traditional solutions, while the CABAC method is limited in flexibility and is difficult to apply to a variety of scenarios. Therefore, when applying the CABAC method, there is an urgent need to provide a reliable solution that reduces file size, saves transmission resources and storage space, and does not affect the user's existing objective environment (such as player upgrades). Summary of the Invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art.

[0005] To this end, a first aspect of the present invention provides a video lossless compression method in an H.264 encoding environment.

[0006] A second aspect of the present invention provides a computer device;

[0007] A third aspect of the present invention provides a computer-readable storage medium.

[0008] The video lossless compression method in the H.264 coding environment proposed by the present invention includes:

[0009] Encoding control, which processes the video frames in the input video signal into blocks, adjusts the encoding parameters according to the complexity of the input video signal and the target bit rate, and outputs encoding control data;

[0010] Transformation and quantization: After the video signal is coded, it enters the transformation and quantization stage. In the transformation and quantization stage, the image blocks are transformed, the pixel values ​​in the spatial domain are converted into coefficients in the frequency domain, and then the frequency domain coefficients are quantized;

[0011] Inverse transformation and inverse quantization: inverse transformation and inverse quantization are performed on the transformed and quantized coefficients to form restored data;

[0012] Predictive coding uses restored data to perform intra-frame prediction and inter-frame prediction. Intra-frame prediction uses adjacent video blocks in the same frame to generate intra-frame prediction data; inter-frame prediction uses similar areas in previous and next frames to perform predictions, perform motion estimation and motion compensation on video blocks, and generate motion vectors to form inter-frame prediction data.

[0013] Entropy coding uses an improved CABAC method to compress coding control data, quantized frequency domain coefficients, intra-frame prediction data and inter-frame prediction data. The improved CABAC method includes adaptive codeword length adjustment, context model selection optimization and adaptive probability update mechanism.

[0014] The video lossless compression method in the H.264 coding environment according to the above technical solution of the present invention may also have the following additional technical features:

[0015] In the above technical solution, the adaptive codeword length adjustment includes dynamically adjusting the codeword length according to the frequency of occurrence of symbols and the complexity of the context model during the encoding process;

[0016] The context model selection optimization includes selecting different context models for encoding according to the characteristics of the video content;

[0017] The adaptive probability update mechanism includes dynamically adjusting the probabilities in the context model according to the actual occurrence probabilities of symbols.

[0018] In the above technical solution, the adaptive codeword length adjustment includes:

[0019] Convert input data into binary symbols;

[0020] Count the frequency of occurrence of binary symbols;

[0021] Use Huffman tree or dynamic coding tree structure to adjust codeword length according to symbol frequency.

[0022] In the above technical solution, during the encoding process, the codeword length is dynamically adjusted according to the real-time statistical results of the symbol occurrence frequency.

[0023] In the above technical solution, the context model selection optimization includes:

[0024] Analyzing video features of an input video; the video features include texture complexity and motion estimation results;

[0025] According to the analysis result, an optimal probability model is selected from a context model library for encoding, wherein the context model library has a plurality of probability models that can reflect the probability distribution of symbol occurrence.

[0026] In the above technical solution, the adaptive probability update mechanism includes:

[0027] An adaptive probability update algorithm is used to dynamically adjust the probability distribution of the context model according to the actual occurrence frequency of symbols.

[0028] In the above technical solution, the adaptive probability update algorithm includes a Bayesian update rule.

[0029] In the above technical solution, error correction and filtering are also included before predictive coding, and the error correction and filtering include deblocking effect filtering and sample adaptive filtering, wherein the deblocking effect filtering includes performing deblocking effect filtering on the transformed and quantized image blocks; the sample adaptive filtering includes performing adaptive filtering on the image blocks to reduce noise caused by compression.

[0030] The present invention also provides a computer device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded and executed by the processor, a video lossless compression method in an H.264 encoding environment as described in any one of the above technical solutions is implemented.

[0031] The present invention also provides a computer-readable storage medium storing a program, which, when loaded by a processor, implements the video lossless compression method in an H.264 encoding environment as described in any one of the above technical solutions.

[0032] In summary, due to the adoption of the above technical features, the beneficial effects of the present invention are:

[0033] The present invention proposes a method for lossless video compression in an H.264 coding environment. The method analyzes the complexity of the input video signal in the coding control stage and dynamically adjusts the coding parameters according to the target bit rate, so that the coding process can adapt to changes in different video content and network environments. In the transformation and quantization stage, a fast discrete cosine transform (DCT) and an adaptive quantization strategy are adopted. By optimizing the quantization table, the transformed frequency domain coefficients can be quantized more efficiently. The quantized data can be accurately restored in the inverse transformation and inverse quantization stages, effectively avoiding the accumulation of quantization errors and ensuring the lossless compression effect of the video. In the predictive coding stage, the redundancy of video data is reduced by utilizing spatial and temporal redundancy through intra-frame prediction and inter-frame prediction.

[0034] The present invention introduces an improved CABAC method in the entropy coding stage, including adaptive codeword length adjustment, context model selection optimization and adaptive probability update mechanism. These improvements enable CABAC to dynamically adjust the coding strategy when processing different video content, further improving the compression efficiency. Adaptive codeword length adjustment adjusts the codeword length according to the symbol frequency through real-time statistical symbol frequency, ensuring that high-frequency symbols use shorter codewords; context model selection optimization selects the optimal context model by analyzing video features, thereby improving the accuracy of the probability model; the adaptive probability update mechanism uses the Bayesian update rule to adjust the probability distribution in real time according to the frequency of symbol occurrence, so that the model can quickly adapt to changes in input data. These improvement measures not only significantly improve the coding efficiency, but also effectively ensure the lossless compression effect of the video.

[0035] Additional aspects and advantages of the invention will become apparent from the description which follows, or may be learned by practice of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which:

[0037] Figure 1 The flowchart of a video lossless compression method in an H.264 encoding environment is an embodiment of the present invention. DETAILED DESCRIPTION

[0038] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.

[0039] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.

[0040] Refer to the following Figure 1 The video lossless compression method in the H.264 encoding environment provided according to some embodiments of the present invention is described.

[0041] Some embodiments of the present application provide a method for lossless video compression in an H.264 encoding environment.

[0042] like Figure 1 As shown, the first embodiment of the present invention proposes a video lossless compression method in an H.264 coding environment, which includes at least five steps: coding control, transformation and quantization, inverse transformation and inverse quantization, predictive coding, and entropy coding.

[0043] In the encoding control step, the video frames in the input video signal are processed in blocks, the encoding parameters are adjusted according to the complexity of the input video signal and the target bit rate, and encoding control data is output.

[0044] In some embodiments, the encoding control step primarily includes video frame segmentation, complexity analysis, target bitrate setting, encoding parameter adjustment, and output of encoding control data. During video frame segmentation, the input video signal is segmented into a number of macroblocks per frame. In one specific embodiment, each macroblock is typically 16x16 pixels in size. During complexity analysis, the complexity of the input video signal is analyzed, including texture complexity and motion complexity. Texture complexity is assessed by detecting image edges and details, while motion complexity is calculated using a motion estimation algorithm. During target bitrate setting, a target bitrate is set based on user settings or automatically adapted to network bandwidth conditions; the target bitrate directly influences the selection of encoding parameters. During encoding parameter adjustment, encoding parameters, such as the quantization parameter (QP), intra-frame and inter-frame prediction mode selection, are dynamically adjusted based on the complexity analysis and target bitrate. The output encoding control data includes the adjusted encoding parameters, which are passed to the subsequent transform, quantization, and predictive coding stages.

[0045] In a specific embodiment, the complexity analysis algorithm can use the Sobel algorithm based on edge detection to perform texture complexity analysis, and use the optical flow algorithm (such as the Lucas-Kanade method) to perform motion complexity analysis. The target bit rate adaptation mechanism can dynamically adjust the target bit rate by detecting the current network bandwidth to ensure that the best compression effect can be achieved under different network conditions. The dynamic adjustment mechanism of the encoding parameters can quickly adjust according to the complexity of the video signal and the target bit rate through a preset encoding parameter adjustment table to ensure the real-time and high efficiency of the encoding process.

[0046] In the transform and quantization step, the video signal undergoes encoding control and then enters the transform and quantization phase. This phase transforms the image blocks, converting the spatial domain pixel values ​​into frequency domain coefficients, which are then quantized. Transformation and quantization are crucial steps in video coding. By converting spatial domain pixel values ​​into frequency domain coefficients and then quantizing them, data compression is achieved.

[0047] In some embodiments, the transformation and quantization steps primarily include discrete cosine transform (DCT), quantization, and outputting quantized coefficients. In discrete cosine transform, a DCT transform is performed on an image block to convert pixel values ​​in the spatial domain into coefficients in the frequency domain. In quantization, the frequency domain coefficients are quantized, discarding smaller coefficients and retaining only larger coefficients, thereby reducing the amount of data. In outputting quantized coefficients, the quantized frequency domain coefficients are output and passed to the inverse transform and inverse quantization, as well as the predictive coding stage.

[0048] In one specific embodiment, a fast DCT algorithm is used to improve transformation efficiency. This can be implemented using library functions or hardware acceleration. An appropriate quantization step size is selected based on the quantization parameter (QP value) adjusted during the encoding control phase. The choice of quantization step size has a direct impact on compression performance and image quality. An adaptive quantization table can also be used to dynamically adjust the quantization step size based on the complexity of the image block, improving encoding efficiency and image quality.

[0049] In the inverse transform and inverse quantization steps, the transformed and quantized coefficients are inversely transformed and inversely quantized to form restored data. Inverse transform and inverse quantization are the inverse of the transform and quantization process, restoring the quantized coefficients in the frequency domain to pixel values ​​in the spatial domain.

[0050] In some embodiments, the inverse transformation and inverse quantization steps primarily include inverse quantization, inverse discrete cosine transform (IDCT), and outputting restored data. In the inverse quantization process, the quantized frequency domain coefficients are inversely quantized to restore the original frequency domain coefficients. In the inverse discrete cosine transform process, the inverse quantized frequency domain coefficients are subjected to an IDCT transform to convert the frequency domain coefficients back to pixel values ​​in the spatial domain. In the outputting restored data process, the restored image block data is output for use in predictive coding.

[0051] Specifically, the inverse quantization algorithm uses the same quantization table as the quantization stage to ensure the accuracy of the restored data. The IDCT transform uses a fast IDCT algorithm to improve the restoration efficiency. This can be implemented using library functions or hardware acceleration.

[0052] In some embodiments, before performing the predictive coding step, error correction and filtering are also included, and the error correction and filtering include deblocking effect filtering and sample adaptive filtering, wherein the deblocking effect filtering includes performing deblocking effect filtering on the transformed and quantized image blocks to reduce blocking effects and improve image quality; the sample adaptive filtering includes performing adaptive filtering on the image blocks to reduce noise caused by compression and improve visual quality.

[0053] In the predictive coding step, restored data is used for intra-frame prediction and inter-frame prediction. Intra-frame prediction uses adjacent video blocks in the same frame to generate intra-frame prediction data; inter-frame prediction uses similar regions in previous and next frames to perform predictions. Motion estimation and motion compensation are performed on the video blocks to generate motion vectors, thereby forming inter-frame prediction data. Intra-frame prediction and inter-frame prediction reduce redundant data by using adjacent video blocks or similar regions in previous and next frames for prediction.

[0054] Specifically, intra-frame prediction involves selecting adjacent blocks, selecting a prediction mode, calculating residuals, and outputting intra-frame prediction data. Adjacent video blocks within the same frame are selected as reference blocks. Based on the characteristics of the reference blocks, the optimal prediction mode is selected to generate a prediction block. The prediction block is then compared with the current block, and the prediction residual is calculated. The intra-frame prediction data, including the prediction mode and residual, is then output to the entropy coding stage.

[0055] Inter-frame prediction involves motion estimation, motion compensation, residual calculation, and output of inter-frame prediction data. Motion estimation is performed using similar regions in the previous and next frames to calculate motion vectors. Based on the motion vectors, motion compensation is performed on the current block to generate a predicted block. The predicted block is then compared with the current block to calculate the prediction residual. The inter-frame prediction data, including the motion vector and residual, is then output to the entropy coding stage.

[0056] The intra-frame prediction algorithm can use multiple prediction modes, such as DC mode, horizontal mode, and vertical mode, and selects the optimal mode to reduce prediction errors. Motion estimation algorithms: Block matching-based motion estimation algorithms, such as three-step search and global search, are used to improve the accuracy and efficiency of motion estimation. Motion compensation strategies use motion compensation on the current block based on the motion estimation results to generate a high-quality predicted block.

[0057] In the entropy coding step, an improved CABAC method is used to compress the coding control data, quantized frequency domain coefficients, intra-frame prediction data and inter-frame prediction data to generate the final coded bit stream.

[0058] The traditional CABAC (Context Adaptive Binary Arithmetic Coding) method mainly includes binary representation, context modeling, and arithmetic coding. Among them, binary representation is used to convert input data into binary symbols. Context modeling selects a probability model based on the context of the current symbol and performs adaptive coding. Arithmetic coding compresses the binary symbols into a compact bit stream. In order to further enhance the flexibility and compression effect of entropy coding, the present disclosure provides an improved CABAC method.

[0059] The difference between the improved CABAC method and the traditional CABAC method mainly lies in the adaptive codeword length adjustment, context model selection optimization and adaptive probability update mechanism.

[0060] Among them, the adaptive codeword length adjustment includes dynamically adjusting the codeword length according to the frequency of occurrence of symbols and the complexity of the context model during the encoding process; the context model selection optimization includes selecting different context models for encoding according to the characteristics of the video content; the adaptive probability update mechanism includes dynamically adjusting the probability in the context model according to the actual probability of occurrence of symbols.

[0061] In some embodiments, the adaptive codeword length adjustment includes:

[0062] Convert input data into binary symbols;

[0063] The frequency of occurrence of binary symbols is counted; specifically, a symbol frequency statistics module can be introduced into the entropy encoder to count the frequency of occurrence of binary symbols in real time.

[0064] Using Huffman tree or dynamic coding tree structure, the codeword length is adjusted according to the symbol frequency to ensure that high-frequency symbols use shorter codewords.

[0065] During the encoding process, the codeword length is dynamically adjusted based on the real-time statistical results of the symbol occurrence frequency.

[0066] In some embodiments, the context model selection optimization includes:

[0067] Analyzing video features of an input video; the video features include texture complexity and motion estimation results;

[0068] According to the analysis result, an optimal probability model is selected from a context model library for encoding, wherein the context model library has a plurality of probability models that can reflect the probability distribution of symbol occurrence.

[0069] Specifically, a context model library is established in the context model selection optimization, and the optimal model is dynamically selected according to video features to improve coding efficiency.

[0070] In some embodiments, the adaptive probability update mechanism includes:

[0071] Adaptive probability update algorithms are used to dynamically adjust the probability distribution of the context model based on the actual frequency of symbol occurrence. Specifically, a Bayesian update module can be introduced into the CABAC encoder to dynamically adjust the probability distribution of the context model based on the frequency of symbol occurrence, ensuring model accuracy and real-time performance.

[0072] Other embodiments of the present invention further provide a computer device comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is loaded and executed by the processor, the video lossless compression method in the H.264 encoding environment as described in any of the above embodiments is implemented.

[0073] The present invention further provides a computer-readable storage medium storing a program, which, when loaded by a processor, implements the video lossless compression method in an H.264 encoding environment as described in any of the above embodiments.

[0074] In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any suitable manner in any one or more embodiments or examples.

[0075] Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A video lossless compression method in an H.264 encoding environment, characterized in that: include: Encoding control, which processes the video frames in the input video signal into blocks, adjusts the encoding parameters according to the complexity of the input video signal and the target bit rate, and outputs encoding control data; Transformation and quantization: After encoding control, the video signal enters the transformation and quantization stage. In this stage, the image blocks are transformed, the pixel values ​​in the spatial domain are converted into coefficients in the frequency domain, and then the frequency domain coefficients are quantized. The fast DCT algorithm is used to transform the image blocks. The adaptive quantization table is used for quantization, and the quantization step size is dynamically adjusted according to the complexity of the image block. Inverse transformation and inverse quantization: inverse transformation and inverse quantization are performed on the transformed and quantized coefficients to form restored data; Predictive coding uses restored data to perform intra-frame prediction and inter-frame prediction. Intra-frame prediction uses adjacent video blocks in the same frame to generate intra-frame prediction data; inter-frame prediction uses similar areas in previous and next frames to perform predictions, perform motion estimation and motion compensation on video blocks, and generate motion vectors to form inter-frame prediction data. Entropy coding, using an improved CABAC method to compress the coding control data, quantized frequency domain coefficients, intra-frame prediction data, and inter-frame prediction data. The improved CABAC method includes adaptive codeword length adjustment, context model selection optimization, and adaptive probability update mechanism; The adaptive codeword length adjustment includes dynamically adjusting the codeword length according to the frequency of occurrence of symbols and the complexity of the context model during the encoding process; The context model selection optimization includes selecting different context models for encoding according to the characteristics of the video content; The adaptive probability update mechanism includes dynamically adjusting the probabilities in the context model according to the actual occurrence probabilities of symbols.

2. The video lossless compression method in the H.264 coding environment according to claim 1, characterized in that: The adaptive codeword length adjustment includes: Convert input data into binary symbols; Count the frequency of occurrence of binary symbols; Use Huffman tree or dynamic coding tree structure to adjust codeword length according to symbol frequency.

3. The video lossless compression method in the H.264 coding environment according to claim 2, characterized in that: During the encoding process, the codeword length is dynamically adjusted based on the real-time statistical results of the symbol occurrence frequency.

4. The video lossless compression method in the H.264 coding environment according to claim 1, characterized in that: The context model selection optimization includes: Analyzing video features of an input video; the video features include texture complexity and motion estimation results; According to the analysis result, an optimal probability model is selected from a context model library for encoding, wherein the context model library has a plurality of probability models that can reflect the probability distribution of symbol occurrence.

5. The video lossless compression method in the H.264 coding environment according to claim 1, characterized in that: The adaptive probability update mechanism includes: An adaptive probability update algorithm is used to dynamically adjust the probability distribution of the context model according to the actual occurrence frequency of symbols.

6. The video lossless compression method in the H.264 coding environment according to claim 5, characterized in that: The adaptive probability update algorithm includes a Bayesian update rule.

7. The video lossless compression method in the H.264 coding environment according to claim 1, characterized in that: Before predictive coding is performed, error correction and filtering are also included. The error correction and filtering include deblocking effect filtering and sample adaptive filtering. The deblocking effect filtering includes performing deblocking effect filtering on the transformed and quantized image blocks; the sample adaptive filtering includes performing adaptive filtering on the image blocks to reduce noise caused by compression.

8. A computer device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded and executed by the processor, the method for lossless video compression in an H.264 coding environment as claimed in any one of claims 1 to 7 is implemented.

9. A computer-readable storage medium, characterized in that A program is stored, and when the program is loaded by a processor, the video lossless compression method in an H.264 encoding environment according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Video encoding device, video decoding device, video encoding method, video decoding method, and video encoding or decoding program

    CN101933331A

  • Unmanned aerial vehicle scouting image synthesis compressed encoding method based on selective block transformation

    CN103347185A