A video compression method, apparatus, device and storage medium

By calculating the error distribution value of pixel blocks in the video sequence, we can determine whether time domain filtering is performed, which solves the problem of error measurement distortion in the prior art, and improves the compression performance and video compression efficiency of the encoder.

CN120075451BActive Publication Date: 2025-07-22MALANSHAN AUDIO & VIDEO LABORATORY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510537057.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-07-22
Estimated Expiration
2045-04-27

AI Technical Summary

Technical Problem

Existing video encoders (such as AVS3 encoders) lack effective indicators when measuring block error distribution, resulting in block error measurement distortion in the case of error concentration, affecting the compression performance and efficiency of the encoder.

Method used

By calculating the square error, vertical square error and horizontal square error of pixel blocks of each frame image in the video sequence, the error distribution value is calculated based on these errors and the size of the pixel block, and whether the time domain filtering operation is performed based on the error distribution value. If it is less than the threshold value, filtering is performed, otherwise it will be directly encoded and compressed.

Benefits of technology

The compression performance and video compression efficiency of the encoder are improved, and the efficiency of the encoding process is improved by skipping unnecessary time domain filtering operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075451B_ABST
    Figure CN120075451B_ABST
Patent Text Reader

Abstract

The present application discloses a video compression method, apparatus, device and storage medium, relating to the technical field of video processing, including: determining a target video sequence to be compressed, and sequentially obtaining a plurality of pixel blocks in each frame image of the target video sequence; respectively calculating the sum of squared errors, vertical sum of squared errors and horizontal sum of squared errors of the plurality of pixel blocks in each frame image; calculating the error distribution of the corresponding pixel blocks based on the size, sum of squared errors, vertical sum of squared errors and horizontal sum of squared errors of each pixel block to obtain an error distribution value, and determining whether the error distribution value is less than a preset threshold; if it is less than the preset threshold, performing a temporal filtering operation on the corresponding pixel block to obtain filtered data, and performing encoding and compression on the filtered data to obtain a compression result; if it is not less than the preset threshold, directly performing encoding and compression on the corresponding pixel block to obtain a compression result. The present application can improve the compression performance of the encoder and at the same time improve the efficiency of video compression.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of video processing, and particularly relates to a video compression method, device, equipment and storage medium. Background Art

[0002] Currently, when compressing a video, a video encoder is usually required, such as an AVS3 (Audio Video Standard) encoder, to perform encoding processing on the video data, thereby achieving efficient video compression. Temporal Filter (TF), as a tool in the video encoder, filters the images that are more likely to be referenced in the inter-frame encoding in the temporal domain, thereby reducing the residuals of the frames encoded with this image as a reference, so as to achieve the purpose of saving the bit rate.

[0003] For example, when there is a video sequence of two frames to be encoded, where the first frame is A and the second frame is B, then in the encoding process, frame B will be encoded with frame A as a reference. Before the formal encoding, TF will filter frame A with frame B using a filtering weight, that is, part of the information in frame B is fused into frame A. In the subsequent encoding process, frame B will be predicted and encoded with frame A as a reference. Since frame A already has some information in frame B at this time, the residuals remaining after the predictive encoding will be reduced, enabling higher compression efficiency in the subsequent transformation, quantization, and entropy encoding, that is, saving the bitstream.

[0004] However, in the current video encoders (such as AVS3 encoders), there are only methods related to block (pixel block) error calculation, and there are no metrics and related calculation methods for measuring the block error distribution. This causes the measurement of the block error to be distorted in some cases where the errors are concentrated (such as when large errors are distributed in a small range), and further leads to poor algorithm effects that rely on the block error, resulting in a decline in the compression performance of the encoder. Summary of the Invention

[0005] In view of this, the purpose of the present application is to provide a video compression method, device, equipment and storage medium, which can improve the compression performance of the encoder and at the same time improve the efficiency of video compression. The specific solutions are as follows:

[0006] In a first aspect, the present application discloses a video compression method applied to a video encoder, including:

[0007] Determine the target video sequence to be compressed, and sequentially obtain multiple pixel blocks in each frame image of the target video sequence;

[0008] Calculate the sum of squared errors, vertical sum of squared errors, and horizontal sum of squared errors of the multiple pixel blocks in each frame image respectively;

[0009] Calculate the error distribution of each pixel block based on the size of each pixel block, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors, obtain an error distribution value, and determine whether the error distribution value is less than a preset threshold;

[0010] If the error distribution value is less than the preset threshold, perform a time-domain filtering operation on the corresponding pixel block to obtain filtered data, and perform encoding compression on the filtered data to obtain a compression result;

[0011] If the error distribution value is not less than the preset threshold, directly perform encoding compression on the corresponding pixel block to obtain a compression result.

[0012] Optionally, the calculation formula for the sum of squared errors is:

[0013] ;

[0014] In the formula, SSD represents the sum of squared errors, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search, represents each of the pixel blocks.

[0015] Optionally, the calculation formula for the horizontal sum of squared errors is:

[0016] ;

[0017] In the formula, HSD represents the horizontal sum of squared errors, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search.

[0018] Optionally, the calculation formula for the vertical sum of squared errors is:

[0019] ;

[0020] In the formula, VSD represents the vertical sum of squared errors, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search.

[0021] Optionally, calculating the error distribution of each of the pixel blocks based on the size of each of the pixel blocks, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors to obtain an error distribution value includes:

[0022] Obtain the width and height of the pixel block, and calculate the product of the width and the height to obtain a first calculation result;

[0023] Calculate the product of the first calculation result and a preset coefficient to obtain a second calculation result, and calculate the sum of the width and the height;

[0024] Calculate the difference between the second calculation result and the sum value, and calculate the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors to obtain an error distribution value.

[0025] Optionally, calculating the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors to obtain an error distribution value includes:

[0026] Use a preset error distribution calculation formula and calculate the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors to obtain an error distribution value;

[0027] Among them, the preset error distribution calculation formula is:

[0028] ;

[0029] In the formula, represents the error distribution value, represents the first calculation result, represents the difference, and b1 is a preset parameter.

[0030] Optionally, the error distribution value is inversely proportional to the error distribution concentration degree of the pixel block.

[0031] In a second aspect, the present application discloses a video compression device, which is applied to a video encoder and includes:

[0032] A determination module, configured to determine a target video sequence to be compressed;

[0033] An acquisition module, configured to sequentially acquire a plurality of pixel blocks in each frame image of the target video sequence;

[0034] A first calculation module, configured to respectively calculate the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors of the plurality of pixel blocks in each frame image;

[0035] A second calculation module, configured to calculate an error distribution of a corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors, obtain an error distribution value, and determine whether the error distribution value is less than a preset threshold;

[0036] A filtering and compression module, configured to, if the error distribution value is less than the preset threshold, perform a time-domain filtering operation on the corresponding pixel block to obtain filtered data, and perform encoding and compression on the filtered data to obtain a compression result;

[0037] An encoding and compression module, configured to, if the error distribution value is not less than the preset threshold, directly perform encoding and compression on the corresponding pixel block to obtain a compression result.

[0038] In a third aspect, the present application discloses an electronic device, including a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the foregoing video compression method is implemented.

[0039] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the foregoing video compression method is implemented.

[0040] It can be seen that the present application is applied to a video encoder. First, a target video sequence to be compressed is determined, and a plurality of pixel blocks in each frame image of the target video sequence are sequentially obtained. Then, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors of the plurality of pixel blocks in each frame image are respectively calculated. Next, an error distribution of a corresponding pixel block is calculated based on the size of each pixel block, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors to obtain an error distribution value, and it is determined whether the error distribution value is less than a preset threshold; if the error distribution value is less than the preset threshold, a time-domain filtering operation is performed on the corresponding pixel block to obtain filtered data, and encoding and compression are performed on the filtered data to obtain a compression result; if the error distribution value is not less than the preset threshold, encoding and compression are directly performed on the corresponding pixel block to obtain a compression result. The present application calculates an error distribution value for measuring the block error distribution situation based on the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors of pixel blocks in each frame image of a video sequence, and the size of each pixel block, and directly performs encoding and compression on the pixel block when the error distribution value is not less than the preset threshold, that is, directly skips the time-domain filtering operation when it is not less than the preset threshold. By judging whether to skip the current time-domain filtering process according to the error distribution situation of the pixel block, the compression performance of the encoder can be improved, and at the same time, the efficiency of video compression is increased. Description of the Drawings

[0041] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on the provided drawings.

[0042] Figure 1 It is a flowchart of a video compression method disclosed in the present application;

[0043] Figure 2 It is a schematic structural diagram of a video compression device disclosed in the present application;

[0044] Figure 3 It is a structural diagram of an electronic device disclosed in the present application. Detailed implementation manners

[0045] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0046] The embodiments of the present application disclose a video compression method, which is applied to a video encoder. Refer to Figure 1 As shown, the method includes:

[0047] Step S11: Determine the target video sequence to be compressed, and sequentially obtain multiple pixel blocks in each frame image of the target video sequence.

[0048] It should be noted that the video compression scheme proposed in the present application is specifically applied to a video encoder, such as an AVS3 encoder, which can compress the original uncompressed video signal into a bitstream in the AVS3 format for storage or transmission. In actual applications, the AVS3 encoder can be used in multiple fields. For example, ultra-high-definition content distribution: such as 4K / 8K video on demand, ultra-high-definition television; video live broadcast: such as sports live broadcast, real-time streaming media; cloud gaming and VR / AR: providing low-latency and high-quality video transmission; video surveillance: efficiently storing a large amount of high-definition video content. In the above applications, the encoder needs to execute the encoding process more efficiently while ensuring the video quality.

[0049] In this embodiment, when video compression is required, the video sequence to be compressed can be obtained first to obtain the target video sequence, and then multiple in each frame image of the above target video sequence are sequentially processed according to a preset block size (such as obtain pixel blocks of a certain size.

[0050] Step S12: Calculate the sum of squared differences, vertical squared differences, and horizontal squared differences of the multiple pixel blocks in each frame of image respectively.

[0051] In this embodiment, after obtaining the multiple pixel blocks in each frame of image, further calculate multiple error values of pixel blocks of a certain size according to a preset error factor, such as calculating the sum of squared differences (SSD), vertical squared difference (VSD), and horizontal squared difference (HSD) of the multiple pixel blocks of a certain size in each frame of image respectively.

[0052] Among them, the calculation formula for the sum of squared differences (i.e., SSD) is:

[0053] ;

[0054] In the formula, SSD represents the sum of squared differences, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search, represents each of the pixel blocks.

[0055] Specifically, the calculation formula for the horizontal squared difference (i.e., HSD) is:

[0056] ;

[0057] In the formula, HSD represents the horizontal squared difference, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search.

[0058] In a specific embodiment, the calculation formula for the vertical squared difference (i.e., VSD) is:

[0059] ;

[0060] In the formula, VSD represents the vertical squared difference, represents the value of the pixel point with coordinates The value of the pixel point, represents the value of the pixel point with coordinates on the reference block obtained by motion search.

[0061] Step S13: Calculate the error distribution of the corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors, obtain an error distribution value, and determine whether the error distribution value is less than a preset threshold.

[0062] In this embodiment, after obtaining multiple error values of multiple pixel blocks in each frame of image, the error distribution of the corresponding pixel block can be calculated based on the size of the pixel block and the multiple error values. Specifically, the error distribution of the corresponding pixel block can be calculated based on the size of the above pixel block, the above sum of squared errors, the above vertical sum of squared errors, and the above horizontal sum of squared errors, obtain an error distribution value, and then determine whether the error distribution value is less than a preset threshold.

[0063] In a specific implementation manner, the calculating the error distribution of the corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors, and obtaining an error distribution value may specifically include: obtaining the width and height of the pixel block, and calculating the product of the width and the height to obtain a first calculation result; calculating the product of the first calculation result and a preset coefficient to obtain a second calculation result, and calculating the sum value of the width and the height; calculating the difference between the second calculation result and the sum value, and calculating the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors, to obtain an error distribution value. In this embodiment, first obtain the width and height of the current pixel block, then calculate the product of the width and height to obtain the corresponding first calculation result Next, calculate the product of the first calculation result and the preset coefficient to obtain the corresponding second calculation result, then calculate the sum value of the width and height Finally, calculate the difference between the above second calculation result and the above sum value , and calculate the error distribution of the corresponding pixel block based on this difference

[0064] Among them, the calculation formula of the first calculation result can be expressed as:

[0065] .

[0066] The said difference The calculation formula of can be expressed as:

[0067] ;

[0068] In the formula, 2 represents the said preset coefficient, and this value can be selected according to actual application requirements.

[0069] Specifically, calculating the error distribution of the corresponding pixel block based on the said difference, the sum of squared errors, the vertical sum of squared errors and the horizontal sum of squared errors to obtain an error distribution value may specifically include: using a preset error distribution calculation formula and calculating the error distribution of the corresponding pixel block based on the said difference, the sum of squared errors, the vertical sum of squared errors and the horizontal sum of squared errors to obtain an error distribution value;

[0070] Among them, the preset error distribution calculation formula is:

[0071] ;

[0072] In the formula, represents the said error distribution value, represents the said first calculation result, represents the said difference, and b1 is a preset parameter.

[0073] It should be noted that the said error distribution value is inversely proportional to the error distribution concentration degree of the pixel block. In this embodiment, the calculated error distribution value can reflect the error distribution situation of the pixel block. The smaller the error distribution value is, the more concentrated the error distribution is, and vice versa, it indicates that the error distribution is more dispersed.

[0074] Step S14: If the error distribution value is less than a preset threshold, perform a time-domain filtering operation on the corresponding pixel block to obtain filtered data, and perform encoding and compression on the filtered data to obtain a compression result.

[0075] In this embodiment, if the above error distribution value is less than a preset threshold, perform a time-domain filtering operation on the corresponding pixel block, such as prediction, transformation, quantization, entropy coding and other operations, to obtain filtered data, and then perform encoding and compression on the above filtered data to obtain a compression result.

[0076] Step S15: If the error distribution value is not less than a preset threshold, directly perform encoding and compression on the corresponding pixel block to obtain a compression result.

[0077] In this embodiment, if the above error distribution value is not less than the preset threshold, it indicates that in the current situation, the time-domain filtering operation can be skipped and the compression process can be directly performed. At this time, the time-domain filtering operation is skipped and the corresponding pixel block is directly encoded and compressed, thereby obtaining the compression result of the target video sequence.

[0078] It can be seen that the embodiment of the present application is applied to a video encoder. First, the target video sequence to be compressed is determined, and a plurality of pixel blocks in each frame image of the target video sequence are sequentially obtained. Then, the sum of squared errors, vertical squared errors, and horizontal squared errors of the plurality of pixel blocks in each frame image are respectively calculated. Based on the size of each pixel block, the sum of squared errors, the vertical squared error, and the horizontal squared error, the error distribution of the corresponding pixel block is calculated to obtain an error distribution value, and it is determined whether the error distribution value is less than the preset threshold. If the error distribution value is less than the preset threshold, the time-domain filtering operation is performed on the corresponding pixel block to obtain filtered data, and the filtered data is encoded and compressed to obtain a compression result. If the error distribution value is not less than the preset threshold, the corresponding pixel block is directly encoded and compressed to obtain a compression result. The embodiment of the present application calculates an error distribution value for measuring the block error distribution situation based on the sum of squared errors, vertical squared errors, and horizontal squared errors of pixel blocks in each frame image of the video sequence, and the size of each pixel block. When the error distribution value is not less than the preset threshold, the pixel block is directly encoded and compressed, that is, when it is not less than the preset threshold, the time-domain filtering operation is directly skipped. By judging whether to skip the current time-domain filtering process according to the error distribution situation of the pixel block, the compression performance of the encoder can be improved, and at the same time, the efficiency of video compression can be improved.

[0079] Correspondingly, the embodiment of the present application also discloses a video compression device, which is applied to a video encoder. Refer to Figure 2 As shown, the device includes:

[0080] A determination module 11, configured to determine a target video sequence to be compressed;

[0081] An acquisition module 12, configured to sequentially acquire a plurality of pixel blocks in each frame image of the target video sequence;

[0082] A first calculation module 13, configured to respectively calculate the sum of squared errors, vertical squared errors, and horizontal squared errors of the plurality of pixel blocks in each frame image;

[0083] A second calculation module 14, configured to calculate the error distribution of the corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical squared error, and the horizontal squared error to obtain an error distribution value, and determine whether the error distribution value is less than a preset threshold;

[0084] The filtering and compression module 15 is configured to, if the error distribution value is less than a preset threshold, perform a time-domain filtering operation on the corresponding pixel block to obtain filtered data, and perform encoding and compression on the filtered data to obtain a compression result;

[0085] The encoding and compression module 16 is configured to, if the error distribution value is not less than the preset threshold, directly perform encoding and compression on the corresponding pixel block to obtain a compression result.

[0086] Among them, the specific working processes of the above-mentioned various modules can refer to the corresponding content disclosed in the foregoing embodiments, and will not be elaborated herein.

[0087] It can be seen that the embodiment of the present application is applied to a video encoder. First, a target video sequence to be compressed is determined, and a plurality of pixel blocks in each frame image of the target video sequence are sequentially obtained. Then, the sum of squared errors, vertical sum of squared errors, and horizontal sum of squared errors of the plurality of pixel blocks in each frame image are respectively calculated. Next, based on the size of each pixel block, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors, the error distribution of the corresponding pixel block is calculated to obtain an error distribution value, and it is determined whether the error distribution value is less than a preset threshold; if the error distribution value is less than the preset threshold, a time-domain filtering operation is performed on the corresponding pixel block to obtain filtered data, and encoding and compression are performed on the filtered data to obtain a compression result; if the error distribution value is not less than the preset threshold, encoding and compression are directly performed on the corresponding pixel block to obtain a compression result. The embodiment of the present application calculates an error distribution value for measuring the block error distribution situation based on the sum of squared errors, vertical sum of squared errors, and horizontal sum of squared errors of pixel blocks in each frame image of a video sequence, and the size of each pixel block, and directly performs encoding and compression on the pixel block when the error distribution value is not less than the preset threshold, that is, directly skips the time-domain filtering operation when it is not less than the preset threshold. By judging whether to skip the current time-domain filtering process according to the error distribution situation of the pixel block, the compression performance of the encoder can be improved, and at the same time, the efficiency of video compression is increased.

[0088] In some specific embodiments, the calculation formula for the sum of squared errors is:

[0089] ;

[0090] In the formula, SSD represents the sum of squared errors, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search, represents each of the pixel blocks.

[0091] In some specific embodiments, the calculation formula of the horizontal squared error is as follows:

[0092] ;

[0093] where HSD represents the horizontal squared error, represents the value of the pixel point with coordinates on the current pixel block, and represents the value of the pixel point with coordinates

[0094] on the reference block obtained by motion search.

[0095] ;

[0096] where VSD represents the vertical squared error, represents the value of the pixel point with coordinates on the current pixel block, and represents the value of the pixel point with coordinates

[0097] on the reference block obtained by motion search.

[0098] An information acquisition unit, configured to acquire the width and height of the pixel block;

[0099] A first calculation unit, configured to calculate the product of the width and the height to obtain a first calculation result;

[0100] A second calculation unit, configured to calculate the product of the first calculation result and a preset coefficient to obtain a second calculation result, and calculate the sum value of the width and the height;

[0101] A third calculation unit, configured to calculate the difference between the second calculation result and the sum value, and calculate the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical squared error, and the horizontal squared error to obtain an error distribution value.

[0102] In some specific embodiments, the third calculation unit may specifically include:

[0103] A fourth calculation unit, configured to calculate the error distribution of the corresponding pixel block by using a preset error distribution calculation formula based on the difference, the sum of squared errors, the vertical squared error, and the horizontal squared error to obtain an error distribution value;

[0104] where the preset error distribution calculation formula is:

[0105] ;

[0106] In the formula, represents the error distribution value, represents the first calculation result, represents the difference, and b1 is a preset parameter.

[0107] In some specific embodiments, the error distribution value is inversely proportional to the error distribution concentration degree of the pixel block.

[0108] Furthermore, an embodiment of the present application also discloses an electronic device. Figure 3 It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment. The content in the figure cannot be considered as any limitation to the scope of use of the present application.

[0109] Figure 3 It is a schematic structural diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the video compression method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0110] In this embodiment, the power supply 23 is used to provide a working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, and no specific limitation is imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application requirements, and no specific limitation is made here.

[0111] In addition, as a carrier for resource storage, the memory 22 may be a read-only memory, a random access memory, a magnetic disk, or an optical disc, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0112] Among them, the operating system 221 is used to manage and control each hardware device and computer program 222 on the electronic device 20, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the video compression method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.

[0113] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the foregoing disclosed video compression method is implemented. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.

[0114] Furthermore, an embodiment of the present application also discloses a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the video compression method disclosed as above are implemented.

[0115] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and reference can be made to the method part for the relevant parts.

[0116] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0117] The steps of the method or algorithm described in combination with the embodiments disclosed in this article can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0118] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.

[0119] The above has introduced in detail a video compression method, apparatus, device and storage medium provided by the present application. Specific examples are used in this text to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A video compression method, characterized in that, Applied to a video encoder, including: Determine a target video sequence to be compressed, and sequentially obtain a plurality of pixel blocks within each frame image of the target video sequence; Calculate the sum of squared errors, vertical squared error, and horizontal squared error of the plurality of pixel blocks in each frame image respectively; Calculate the error distribution of the corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical squared error, and the horizontal squared error, obtain an error distribution value, and determine whether the error distribution value is less than a preset threshold; If the error distribution value is less than the preset threshold, perform a temporal filtering operation on the corresponding pixel block to obtain filtered data, and perform encoding compression on the filtered data to obtain a compression result; If the error distribution value is not less than the preset threshold, directly perform encoding compression on the corresponding pixel block to obtain a compression result; The calculating the error distribution of the corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical squared error, and the horizontal squared error, and obtaining an error distribution value includes: obtaining the width and height of the pixel block, and calculating the product of the width and the height to obtain a first calculation result; calculating the product of the first calculation result and a preset coefficient to obtain a second calculation result, and calculating the sum value of the width and the height; calculating the difference between the second calculation result and the sum value, and calculating the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical squared error, and the horizontal squared error to obtain an error distribution value.

2. The video compression method according to claim 1, wherein The formula for calculating the sum of squared errors is: ; Wherein, SSD represents the sum of squared errors, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search, represents each of the pixel blocks.

3. The video compression method according to claim 2, wherein The formula for calculating the horizontal squared error is: ; Wherein, HSD represents the horizontal square error, represents the value of the pixel point with coordinates on the current pixel block, and represents the value of the pixel point with coordinates on the reference block obtained by motion search.

4. The video compression method according to claim 3, wherein The formula for calculating the vertical squared error is: ; Wherein, VSD represents the vertical squared error, represents the value of the pixel point with coordinates on the current pixel block, represents the value of the pixel point with coordinates on the reference block obtained by motion search.

5. The video compression method according to claim 4, wherein The calculating the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical squared error, and the horizontal squared error, and obtaining an error distribution value includes: Using a preset error distribution calculation formula and calculating the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical squared error, and the horizontal squared error to obtain an error distribution value; Wherein, the preset error distribution calculation formula is: ; In the formula, represents the error distribution value, represents the first calculation result, represents the difference value, and b1 is a preset parameter.

6. The video compression method according to any one of claims 1 to 5, characterized in that, The error distribution value is inversely proportional to the error distribution concentration degree of the pixel block.

7. A video compression device, characterized in that, Applied to a video encoder, including: A determination module for determining a target video sequence to be compressed; An acquisition module for sequentially acquiring a plurality of pixel blocks within each frame image of the target video sequence; A first calculation module for respectively calculating the sum of squared errors, vertical squared error, and horizontal squared error of the plurality of pixel blocks in each frame image; A second calculation module for calculating the error distribution of the corresponding pixel block based on the size of each pixel block, the sum of squared errors, the vertical squared error, and the horizontal squared error, obtaining an error distribution value, and determining whether the error distribution value is less than a preset threshold; A filtering and compression module for, if the error distribution value is less than the preset threshold, performing a temporal filtering operation on the corresponding pixel block to obtain filtered data, and performing encoding compression on the filtered data to obtain a compression result; An encoding and compression module, configured to directly perform encoding and compression on the corresponding pixel block to obtain a compression result if the error distribution value is not less than a preset threshold; The second calculation module is specifically configured to obtain the width and height of the pixel block, calculate the product of the width and the height to obtain a first calculation result; calculate the product of the first calculation result and a preset coefficient to obtain a second calculation result, and calculate the sum of the width and the height; calculate the difference between the second calculation result and the sum value, and calculate the error distribution of the corresponding pixel block based on the difference, the sum of squared errors, the vertical sum of squared errors, and the horizontal sum of squared errors to obtain an error distribution value.

8. An electronic device, characterized in that, It includes a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the video compression method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium, characterized in that, For storing a computer program; wherein, when the computer program is executed by a processor, the video compression method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Video noise reduction method and device based on time domain filtering

    CN113613005A