Video Compression Method, Device, Computer Equipment and Storage Medium

By adaptive mapping and parallel compression analysis of each image frame in the video, the compression performance loss caused by parallel processing in the prior art is solved, and efficient video compression processing is achieved.

CN116112683BActive Publication Date: 2025-07-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111327815.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2025-07-01
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

Existing video compression methods are prone to introduce compression performance losses during parallel processing, resulting in lower video compression performance.

Method used

By adaptively mapping each image frame in the video, the parallel processing conditions of the image frame are determined, and when the conditions are met, the image encoding unit in the image frame is performed in parallel compression analysis, and encoding parameters for the image frame are obtained, and the video is compressed based on these encoding parameters.

Benefits of technology

Improves video compression processing efficiency, reduces compression performance losses, and ensures video compression performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116112683B_ABST
    Figure CN116112683B_ABST
Patent Text Reader

Abstract

The present application relates to a video compression method, apparatus, computer device, storage medium, and computer program product. The method includes: obtaining a video to be compressed; for each image frame in the video, performing adaptive mapping based on the difference features between the image frame and the corresponding reference frame, and determining the parallel processing conditions corresponding to the image frame according to the mapping result; when the hierarchical features of the image frame meet the parallel processing conditions, performing parallel compression analysis on the image coding units in the image frame to obtain coding parameters for the image frame; the image coding units are obtained by dividing the image frame into units; and compressing the video based on the coding parameters respectively corresponding to the respective image frames in the video. Using this method can improve the efficiency of video compression processing and ensure the video compression performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a video compression method, apparatus, computer device, storage medium, and computer program product. Background Art

[0002] With the development of computer technology, videos are continuously evolving towards high definition, high frame rate, and high resolution, and the amount of video data is also increasing. To facilitate the storage and transmission of videos, it is becoming increasingly important to effectively compress videos. Video compression refers to the use of compression technology to remove redundant information in digital videos, reducing the storage required to represent the original video, so as to facilitate the transmission and storage of video data.

[0003] Currently, during video compression processing, parallel compression processing is used to improve the processing efficiency of video compression. However, when accelerating video compression through parallel processing, a large compression performance loss is often introduced, resulting in low compression performance of the video. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a video compression method, apparatus, computer device, storage medium, and computer program product that can improve the processing efficiency of video compression and ensure the video compression performance.

[0005] A video compression method, the method comprising:

[0006] Obtaining a video to be compressed;

[0007] For each image frame in the video, performing adaptive mapping based on the difference features between the image frame and the corresponding reference frame, and determining the parallel processing condition corresponding to the image frame according to the mapping result;

[0008] When the hierarchical feature of the image frame meets the parallel processing condition, performing parallel compression analysis on the image coding units in the image frame to obtain coding parameters for the image frame; the image coding units are obtained by dividing the image frame into units;

[0009] Compressing the video based on the coding parameters respectively corresponding to each image frame in the video.

[0010] A video compression apparatus, the apparatus comprising:

[0011] A video acquisition module, configured to acquire a video to be compressed;

[0012] A parallel condition determination module, configured to perform adaptive mapping on each image frame in the video based on the difference features between the image frame and the corresponding reference frame, and determine the parallel processing condition corresponding to the image frame according to the mapping result;

[0013] An encoding parameter determination module, configured to perform parallel compression analysis on image coding units in an image frame to obtain encoding parameters for the image frame when the hierarchical features of the image frame meet the parallel processing conditions; the image coding units are obtained by dividing the image frame into units;

[0014] A video compression processing module, configured to compress a video based on the encoding parameters respectively corresponding to each image frame in the video.

[0015] A computer device, comprising a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0016] Obtain a video to be compressed;

[0017] For each image frame in the video, perform adaptive mapping based on the difference features between the image frame and the corresponding reference frame, and determine the parallel processing conditions corresponding to the image frame according to the mapping result;

[0018] When the hierarchical features of the image frame meet the parallel processing conditions, perform parallel compression analysis on the image coding units in the image frame to obtain encoding parameters for the image frame; the image coding units are obtained by dividing the image frame into units;

[0019] Compress the video based on the encoding parameters respectively corresponding to each image frame in the video.

[0020] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0021] Obtain a video to be compressed;

[0022] For each image frame in the video, perform adaptive mapping based on the difference features between the image frame and the corresponding reference frame, and determine the parallel processing conditions corresponding to the image frame according to the mapping result;

[0023] When the hierarchical features of the image frame meet the parallel processing conditions, perform parallel compression analysis on the image coding units in the image frame to obtain encoding parameters for the image frame; the image coding units are obtained by dividing the image frame into units;

[0024] Compress the video based on the encoding parameters respectively corresponding to each image frame in the video.

[0025] A computer program product, comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0026] Obtain a video to be compressed;

[0027] For each image frame in the video, perform adaptive mapping based on the difference features between the image frame and the corresponding reference frame, and determine the parallel processing conditions corresponding to the image frame according to the mapping result;

[0028] When the hierarchical features of the image frame meet the parallel processing conditions, perform parallel compression analysis on the image coding units in the image frame to obtain coding parameters for the image frame; the image coding units are obtained by dividing the image frame into units;

[0029] Compress the video based on the coding parameters corresponding to each image frame in the video.

[0030] For the above video compression method, device, computer device, storage medium, and computer program product, for each image frame in the video to be compressed, determine the parallel processing conditions corresponding to the image frame according to the mapping result of the adaptive mapping based on the difference features between the image frame and the corresponding reference frame. When the hierarchical features of the image frame meet the parallel processing conditions, perform parallel compression analysis on the image coding units obtained by dividing the image frame in the image frame to obtain coding parameters for the image frame, and compress the video based on the coding parameters corresponding to each image frame in the video. During the video compression process, determine the corresponding parallel processing conditions for each image frame, perform parallel compression analysis on the image coding units in the image frame when the image frame meets the corresponding parallel processing conditions to obtain coding parameters, and compress the video through the coding parameters corresponding to each image frame, so as to perform parallel compression analysis on each image frame in the video adaptively, reduce the introduced compression performance loss, and thus ensure the compression performance of the video while improving the video compression processing efficiency. Description of the Drawings

[0031] Figure 1 It is an application environment diagram of the video compression method in an embodiment;

[0032] Figure 2 It is a flowchart of the video compression method in an embodiment;

[0033] Figure 3 It is a flowchart of determining the parallel processing conditions in an embodiment;

[0034] Figure 4 It is a schematic diagram of a Group of Pictures (GOP) in an embodiment;

[0035] Figure 5 It is a schematic diagram of slice-level parallel processing for cutting;

[0036] Figure 6 It is a schematic diagram of tile-level parallel processing for tiling;

[0037] Figure 7Schematic diagram of the dependency relationship between coding tree units in wavefront parallel processing in an embodiment;

[0038] Figure 8 Schematic diagram of parallel processing between coding tree units in wavefront parallel processing in an embodiment;

[0039] Figure 9 Schematic diagram of the reference relationship between each image frame in a Group of Pictures (GOP) in an embodiment;

[0040] Figure 10 Schematic diagram of correcting residual parameters in an embodiment;

[0041] Figure 11 Structural block diagram of a video compression device in an embodiment;

[0042] Figure 12 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0044] The video compression method provided by the present application can be applied to an application environment as Figure 1 shown. Among them, the terminal 102 communicates with the server 104 through a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or can be placed in the cloud or other network servers. The terminal 102 can be provided with a shooting device, such as a camera. The terminal 102 can shoot a video and send the shot video to the server 104, so that the server 104 can, for each image frame in the video to be compressed received, determine the parallel processing condition corresponding to the image frame according to the mapping result of adaptive mapping based on the difference feature between the image frame and the corresponding reference frame. When the hierarchical feature of the image frame meets the parallel processing condition, perform parallel compression analysis on the image coding units obtained by unit division in the image frame to obtain the coding parameters for the image frame, and compress the video based on the coding parameters corresponding to each image frame in the video.

[0045] In addition, the video compression process can also be implemented separately by the terminal 102 or the server 104. For example, after the terminal 102 captures a video, the terminal 102 can directly perform compression processing on the video for transmission and storage. Another example is that the server 104 can directly obtain the video to be compressed from the server database for compression processing. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, in-vehicle devices, and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0046] In one embodiment, as Figure 2 shown, a video compression method is provided. Taking the server in Figure 1 as an example, the method includes the following steps:

[0047] Step 202, obtain the video to be compressed.

[0048] Among them, the video to be compressed can be captured by a shooting device, specifically by a terminal with a shooting function. The capacity of the original video captured by the shooting device is often very large, which is not conducive to the transmission and storage of the video. By compressing the video, redundant information in the video can be effectively removed, the capacity of the video can be reduced, and the video can be transmitted and stored.

[0049] Specifically, the server obtains the video to be compressed. Specifically, the server can receive the video to be compressed sent by the terminal. For example, in a video application or website, when a user uploads a video captured by the terminal to a video sharing platform such as a video application or website, the server receives the video uploaded by the terminal for compression processing as the video to be compressed. In specific applications, when the original video is stored in the database, the server can also directly obtain the video to be compressed from the database.

[0050] Step 204, for each image frame in the video, perform adaptive mapping based on the difference feature between the image frame and the corresponding reference frame, and determine the parallel processing condition corresponding to the image frame according to the mapping result.

[0051] Among them, a video is a sequence of continuous images, which is composed of continuous frames, and one frame is an image. An image frame is each frame image that constitutes a video. For adjacent frames of images in a video, the difference between each frame image is small, that is, the change between each image frame is small, and there is a large amount of redundant information. At this time, for a segment in the video where the change of image frames is small, a complete image frame can be encoded from this segment, and the difference between other image frames in this segment and this complete image frame is small. Then, for other image frames, only the difference part from this complete image frame needs to be encoded, so as to achieve the compression processing of the video by avoiding encoding complete image frames. Among them, the encoded complete image frame is the reference frame for other image frames in this segment, that is, other image frames are encoded with this complete image frame as a reference, and can also be decoded with this complete image frame as a reference, so as to restore the original image frame. For example, for 8 consecutive frames of images in a video, the change between the 8 frames of images is small, then these 8 frames of images can be used as a group of pictures. One frame is selected from this group of pictures as a reference frame for complete encoding processing. For example, the first frame can be used as the reference frame, then the first frame is subjected to complete encoding processing, and the remaining 7 frames of images all use the first frame as a reference frame. By encoding the difference between each frame of image and the first frame, the encoding of each frame of image is achieved, and the compression processing of the video is achieved.

[0052] A reference frame is an image frame for which other image frames are encoded with reference. Specifically, it can be an image frame for which other image frames in a group of pictures are encoded with reference. The difference feature is used to characterize the difference between an image frame and the corresponding reference frame, and can be specifically obtained according to the picture change between the image frame and the corresponding reference frame. For example, it can be obtained according to the object difference and pixel difference between the image frame and the corresponding reference frame. Adaptive mapping refers to the mapping processing based on the difference feature between an image frame and the corresponding reference frame, that is, the mapping result obtained by adaptive mapping is related to the difference feature between the image frame and the corresponding reference frame. Thus, the mapping result obtained by adaptive mapping further characterizes the difference between the image frame and the corresponding reference frame, so as to determine the parallel processing condition corresponding to the image frame. The parallel processing condition is used to determine whether parallel processing needs to be performed on the image frame, and can be specifically generated according to the mapping result. For example, when the mapping result is data of a numerical type, the parallel processing condition can be set as a threshold determination condition based on the numerical type, so as to obtain the parallel processing condition of the image frame according to the mapping result. Another example is that when the mapping result is data of a type divided by high and low levels, the parallel processing condition can be set as a determination condition that meets the high and low levels.

[0053] The parallel processing conditions are determined according to the mapping results obtained by adaptively mapping based on the difference features between the image frames and the corresponding reference frames. Different image frames have different difference features from the corresponding reference frames. After adaptive mapping, different mapping results are obtained, thereby determining different parallel processing conditions. The parallel processing conditions are adaptively determined according to the image features. Based on the parallel processing conditions, it is determined whether to perform parallel processing on the image frames, which can flexibly encode each video frame in the video to be compressed, reduce the introduced compression performance loss, and ensure the compression performance of the video, that is, ensure that the video can be accurately restored after compression. For example, if the adaptive mapping is a linear mapping, the greater the difference between the image frame and the corresponding reference frame, the greater the mapping result also represents the difference between the image frame and the corresponding reference frame. At this time, if parallel acceleration is performed, more compression performance loss may be introduced, resulting in the inability to accurately restore the image frame after encoding. Then, through the parallel processing conditions, it can be determined that the image frame does not perform parallel acceleration processing, so as to ensure that the image frame can be accurately restored after encoding and ensure the compression performance of the video.

[0054] Specifically, after the server obtains the video to be compressed, for each image frame in the video, according to the reference relationship between the image frames, the reference frame corresponding to the image frame can be determined, and further the difference features between the image frame and the corresponding reference frame can be determined. The server performs adaptive mapping on the difference features, such as linear mapping, non-linear mapping, etc., to obtain the mapping result. The server determines the parallel processing conditions corresponding to the image frame based on the mapping result. The parallel processing conditions are used to determine whether the image frame needs to be processed in parallel.

[0055] In a specific application, the server can start from the first image frame of the video to be compressed, traverse the video for adaptive mapping to determine the parallel processing conditions corresponding to each image frame. For example, the server extracts an image frame from the video to be compressed as the current image frame, determines the reference frame of the current image frame, and performs adaptive mapping based on the difference features between the current image frame and the reference frame to obtain the current mapping result. The server determines the parallel processing conditions corresponding to the current mapped frame according to the current mapping result and processes the current image frame based on the parallel processing conditions. After the server finishes processing the current image frame, it extracts the next frame from the video to process the next frame until all the image frames in the video are traversed to obtain the parallel processing conditions corresponding to each image frame. In addition, if the current image frame extracted by the server from the video is a reference frame, it means that the current image frame needs to be fully encoded and does not need to be compressed. The image frames with the current image frame as the reference frame can be adaptively mapped, and the corresponding parallel processing conditions can be determined based on the mapping result.

[0056] Step 206: When the hierarchical feature of the image frame meets the parallel processing condition, perform parallel compression analysis on the image coding units in the image frame to obtain coding parameters for the image frame; the image coding units are obtained by dividing the image frame into units.

[0057] Among them, the hierarchical feature is used to represent the hierarchical information of the image frame in the image group to which it belongs. In an image group, the reference frame is completely encoded, and other image frames in the image group use this reference frame as a reference and encode the differences from the reference frame. When there are multiple reference frames in the image group, or each image frame refers to multiple image frames respectively, a hierarchical reference relationship is formed among the image frames. The hierarchical feature of the image frame can describe the reference relationship of the image frame in the corresponding image group to which it belongs. For example, for an image group including 7 image frames, the first frame can be a completely encoded image frame, the fourth frame and the seventh frame both use the first frame as a reference frame, and the second frame and the third frame both use the first frame and the fourth frame as reference frames, that is, both the second frame and the third frame include two reference frames, which are the first frame and the fourth frame; the fifth frame and the sixth frame both use the first frame and the seventh frame as reference frames, that is, both the fifth frame and the sixth frame also include two reference frames, which are the first frame and the seventh frame. This image group forms a three-layer hierarchical reference relationship. According to the level to which each image frame belongs, the hierarchical feature of the image frame can be obtained. For example, when the levels in the reference relationship are represented by consecutive natural numbers, the level to which the image frame belongs can be directly used as the hierarchical feature. The hierarchical feature of the image frame reflects the level of the image frame in the image group. Generally, the higher the level, the more reference frames it corresponds to, the lower its importance as a reference, and the smaller the impact on the video compression performance, thereby improving the parallel processing efficiency of its compression.

[0058] The image coding units are obtained by dividing the image frame into units. Specifically, based on different unit division methods, the image frame can be divided into units to obtain image coding units. For example, the image frame can be divided into Coding Tree Units (CTUs) based on the WPP (Wavefront Parallel Processing) algorithm, and the image frame can also be divided into Slices or Tiles, etc. Parallel compression analysis refers to performing parallel compression analysis processing on the image coding units in the image frame to determine the coding parameters corresponding to each image coding unit, so as to obtain the coding parameters for the image frame. The coding parameters are related parameters for encoding the image frame, and specifically can include but are not limited to division mode, residual parameters, division block size, etc.

[0059] Specifically, after the server determines the parallel processing conditions corresponding to the image frame, it further determines the hierarchical features of the image frame, which can be determined specifically according to the hierarchical reference relationship of the image frame in the image group to which it belongs. The server compares the hierarchical features of the image frame with the corresponding parallel processing conditions. If the hierarchical features of the image frame meet the parallel processing conditions, for example, the hierarchical features of the image frame are greater than the parallel processing threshold in the parallel processing conditions, it indicates that parallel processing can be performed on the image frame, which can improve processing efficiency while ensuring that the image frame can be accurately restored. The server performs parallel compression analysis on the image coding unit in the image frame. The image coding unit is obtained by dividing the image frame into units. The server uses the image coding unit in the image frame as a parallel unit, and simultaneously processes multiple image coding units that do not have a dependency relationship in parallel to perform parallel compression analysis on the image coding unit in the image frame, and obtains the encoding parameters corresponding to each image coding unit, thereby obtaining the encoding parameters for the image frame. The encoding parameters are used to encode the image frame to achieve video compression.

[0060] Step 208: compress the video based on the encoding parameters corresponding to each image frame in the video.

[0061] The video includes multiple image frames, and for each image frame, the encoding parameters of the corresponding image frame are determined, so as to compress the video based on the encoding parameters corresponding to each image frame in the video. Specifically, the server can obtain the encoding parameters corresponding to each image frame in the video, so as to compress the video based on the encoding parameters corresponding to each image frame. In a specific application, the server can determine the encoding parameters corresponding to each image frame, encode the image frame based on the encoding parameters, and determine the encoding parameters and encode the next frame in a loop after the encoding process is completed, until all image frames in the video are traversed, thereby realizing the compression process of the video.

[0062] In a specific application, for each image frame in a video, the image frame that meets the corresponding parallel processing conditions can obtain the corresponding encoding parameters based on parallel compression analysis, and for the image frame that does not meet the corresponding parallel processing conditions, the corresponding encoding parameters can be determined based on the processing of non-parallel compression analysis. Specifically, the server extracts image frames from the video in sequence, and for the extracted current image frame, the server determines the reference frame corresponding to the current image frame, further determines the difference feature between the current image frame and the reference frame, adaptively maps the difference feature, and obtains the mapping result. The server determines the parallel processing condition corresponding to the current image frame based on the mapping result. The server determines the hierarchical feature of the current image frame according to the reference relationship of the current image frame in the image group to which it belongs. When the server determines that the hierarchical feature of the current image frame meets the parallel processing condition, the server determines each image encoding unit obtained by unit division in the current image frame, and performs parallel compression analysis on each image encoding unit to obtain the encoding parameter for the current image frame, and encodes the current image frame based on the encoding parameter to achieve compression of the current image frame. The server extracts the next image frame from the video and processes it as the next current image frame. If the hierarchical features of the current image frame do not meet the parallel processing conditions, the server can determine the encoding parameters of the image frame by other means, such as performing compression analysis on the image encoding units in the image frame in turn to determine the encoding parameters for the current image frame, and perform encoding compression processing based on the encoding parameters. After the server traverses all the image frames in the video, each image frame in the video is encoded and processed, and the capacity is reduced, thereby achieving compression processing of the video.

[0063] In the above-mentioned video compression method, for each image frame in the video to be compressed, the mapping result of adaptive mapping is performed according to the difference characteristics between the image frame and the corresponding reference frame, and the parallel processing conditions corresponding to the image frame are determined. When the hierarchical characteristics of the image frame meet the parallel processing conditions, the image coding units obtained by unit division in the image frame are subjected to parallel compression analysis to obtain the coding parameters for the image frame, and the video is compressed based on the coding parameters corresponding to each image frame in the video. In the process of video compression, the corresponding parallel processing conditions are determined for each image frame, and when the image frame meets the corresponding parallel processing conditions, the image coding units in the image frame are subjected to parallel compression analysis to obtain the coding parameters, and the video is compressed based on the coding parameters corresponding to each image frame. Parallel compression analysis can be adaptively performed for each image frame in the video to reduce the introduced compression performance loss, thereby improving the video compression processing efficiency while ensuring the video compression performance.

[0064] In one embodiment, Figure 3As shown, determine the parallel processing conditions, that is, perform adaptive mapping based on the difference features between the image frame and the corresponding reference frame, and determine the parallel processing conditions corresponding to the image frame according to the mapping result, including:

[0065] Step 302, determine the adaptive mapping parameters and the result limitation range; the result limitation range is obtained based on the image group features of the image group to which the image frame belongs.

[0066] Among them, the adaptive mapping parameters are used to perform adaptive mapping on the difference features between the image frame and the corresponding reference frame. For example, when the adaptive mapping of the difference features between the image frame and the corresponding reference frame is a linear mapping, the adaptive mapping parameters can be the parameters corresponding to the linear mapping. The adaptive mapping parameters can be flexibly set according to actual needs. The result limitation range is obtained based on the image group features of the image group to which the image frame belongs. The image group is a number of image frames with high similarity and small change degree determined from the video to be compressed. The image group features are used to describe the corresponding image group, and specifically can include features representing the hierarchical reference relationship between the image frames in the image group. The result limitation range is the range of the mapping result used to determine the parallel processing conditions. By limiting the value range of the mapping result, the parallel processing of the image frame can be accurately determined. In specific applications, the result limitation range can be between the minimum level and the maximum level of the image group to which the image frame belongs.

[0067] Specifically, when determining the parallel processing conditions corresponding to the image frame according to the mapping result, the server obtains the preset adaptive mapping parameters and the result limitation range. The adaptive mapping parameters are set according to actual needs, such as can be set according to the application scenario to adjust the adaptive mapping of the image frame as needed. The result limitation range is obtained based on the image group features of the image group to which the image frame belongs.

[0068] Step 304, perform adaptive mapping on the difference features between the image frame and the corresponding reference frame through the adaptive mapping parameters to obtain a difference feature mapping result.

[0069] Among them, the difference feature mapping result is the preliminary mapping result obtained by performing adaptive mapping processing on the difference features through the adaptive mapping parameters. Specifically, after determining the adaptive mapping parameters, the server performs adaptive mapping on the difference features between the image frame and the corresponding reference frame based on the adaptive mapping parameters to obtain the difference feature mapping result corresponding to the image frame.

[0070] Step 306, adjust the difference feature mapping result based on the result limitation range to obtain a mapping result within the result limitation range.

[0071] After obtaining the differential feature mapping result, the server adjusts the differential feature mapping result based on the result limit range obtained from the image group features of the image group to which the image frame belongs. Specifically, the value of the differential feature mapping result can be adjusted, so as to adjust the differential feature mapping result to within the result limit range and obtain a mapping result within the result limit range. In specific implementation, the server can compare the differential feature mapping result to determine whether the differential feature mapping result is within the result limit range. For example, when the differential feature mapping result is numerical data, the result limit range corresponds to the value range of the numerical data. The server compares the differential feature mapping result with the end values of the result limit range. If the differential feature mapping result is within the result limit range, it indicates that the value of the differential feature mapping result is already within a reasonable range and no adjustment is required. Then, the server can directly determine the parallel processing condition corresponding to the image frame according to the differential feature mapping result. If the differential feature mapping result is outside the result limit range, adjustment by the server is required. The server can determine whether the differential feature mapping result is greater than the upper end value of the result limit range or not greater than the lower end value of the result limit range when comparing the differential feature mapping result with the end values of the result limit range. When the differential feature mapping result is greater than the upper end value of the result limit range, the differential feature mapping result can be adjusted to the upper end value of the result limit range to obtain the mapping result of the differential feature. When the differential feature mapping result is not greater than the lower end value of the result limit range, the differential feature mapping result can be adjusted to the lower end value of the result limit range to obtain the mapping result of the differential feature, and the obtained mapping result is within the result limit range.

[0072] Step 308: Determine the parallel processing threshold according to the mapping result, and generate the parallel processing condition corresponding to the image frame based on the parallel processing threshold.

[0073] Among them, the parallel processing threshold is the judgment threshold used to determine whether to perform parallel processing on the image frame in the parallel processing condition. The parallel processing threshold is determined according to the mapping result. Specifically, when the mapping result is numerical data, the mapping result can be directly used as the parallel processing threshold, and the parallel processing condition corresponding to the image frame is generated based on the parallel processing threshold. For example, after determining the parallel processing threshold according to the mapping result, the corresponding generated parallel processing condition can be that when the hierarchical feature of the image frame is greater than the parallel processing threshold, it is determined that parallel processing needs to be performed on the image frame, and when the hierarchical feature of the image frame is not greater than the parallel processing threshold, it is determined that parallel processing is not performed on the image frame, and other processing methods can be adopted to perform encoding processing on the image frame.

[0074] Specifically, after obtaining the mapping result corresponding to the differential feature, the server determines the parallel processing threshold based on the mapping result. Specifically, the server can set the parallel processing threshold with reference to the mapping result and generate the parallel processing condition corresponding to the image frame based on the parallel processing threshold. For example, the parallel processing threshold can be used as the determination condition for determining whether the image frame needs to be processed in parallel.

[0075] In this embodiment, the differential features between the image frame and the corresponding reference frame are adaptively mapped according to the preset adaptive mapping parameters, and the obtained result of the differential feature mapping obtained by adaptive mapping is adjusted by the result-limiting range obtained from the image group features of the image group to which the image frame belongs, so as to obtain the mapping result within the result-limiting range. The parallel processing condition corresponding to the image frame is generated according to the parallel processing threshold determined by the mapping result, so that the obtained parallel processing condition corresponds to the hierarchical features and differential features of the image frame, and the adaptive determination of parallel processing of the image frame can be realized. Furthermore, the parallel compression analysis is performed adaptively, which can reduce the introduced compression performance loss, and while improving the video compression processing efficiency, ensure the compression performance of the video.

[0076] In one embodiment, the differential features include motion features and residual features; the adaptive mapping parameters include motion feature mapping parameters and residual feature mapping parameters; the differential features between the image frame and the corresponding reference frame are adaptively mapped by the adaptive mapping parameters to obtain the differential feature mapping result, including: adaptively mapping the motion features by the motion feature mapping parameters to obtain the motion feature mapping result; adaptively mapping the residual features by the residual feature mapping parameters to obtain the residual feature mapping result; and obtaining the differential feature mapping result based on the motion feature mapping result and the motion feature mapping result.

[0077] Among them, the differential feature characterizes the difference between the image frame and the corresponding reference frame, which can be specifically obtained according to the change of the picture between the image frame and the corresponding reference frame, and specifically includes motion features and residual features. The motion feature characterizes the motion intensity of the image between the image frame and the corresponding reference frame; the residual feature characterizes the similarity degree of the image between the image frame and the corresponding reference frame. Through the motion feature and the residual feature, the change degree between the image frame and the reference frame can be reflected. The adaptive mapping parameter is the relevant parameter for adaptively mapping the differential feature, and specifically includes the motion feature mapping parameter and the residual feature mapping parameter. The motion feature mapping parameter is used to adaptively map the motion feature, and the residual feature mapping parameter is used to adaptively map the residual feature. The motion feature mapping parameter and the residual feature mapping parameter can be flexibly set according to actual needs. For example, they can be set as constants to perform linear mapping on the motion feature and the residual feature.

[0078] Specifically, when performing adaptive mapping on the differential features, the server performs adaptive mapping on the motion features in the differential features through the motion feature mapping parameter in the adaptive mapping parameter to obtain the motion feature mapping result corresponding to the motion features. The server performs adaptive mapping on the residual features in the differential features through the residual feature mapping parameter in the adaptive mapping parameter to obtain the residual feature mapping result corresponding to the residual features. After obtaining the motion feature mapping result and the residual feature mapping result, the server obtains the differential feature mapping result corresponding to the image frame based on the motion feature mapping result and the residual feature mapping result. In a specific application, the server can fuse the motion feature mapping result and the residual feature mapping result, such as performing linear fusion or non-linear fusion, to obtain the differential feature mapping result.

[0079] In this embodiment, the differential features include motion features and residual features. Adaptive mapping is performed on the motion features and the residual features respectively through the adaptive mapping parameter, and the differential feature mapping result is obtained based on the obtained motion feature mapping result and the motion feature mapping result. The differential features between the image frame and the corresponding reference frame are adaptively mapped from multiple dimensions, so that the differential feature mapping result can accurately express the adaptive features of the image frame, which is beneficial to the adaptive determination of parallel processing of the image frame, and then the parallel compression analysis is performed adaptively.

[0080] In one embodiment, when the hierarchical features of the image frame meet the parallel processing condition, parallel compression analysis is performed on the image coding units in the image frame to obtain the coding parameters for the image frame, including: when the image level of the image frame is greater than the parallel processing threshold, determining the image coding units in the image frame; performing parallel compression analysis on each image coding unit in the wavefront parallel processing manner, and obtaining the coding parameters for the image frame according to the analysis results corresponding to each image coding unit respectively.

[0081] Among them, the image level refers to the level where the image frame is located within the image group to which it belongs. The image level is determined according to the reference relationship between the image frames in the image group. Generally, the lower the image level, the fewer the number of reference frames corresponding to the image frame, and the more the number of times it is referenced. The more important the image frame is, the higher the compression performance needs to be protected; the higher the image level, the more the number of reference frames corresponding to the image, and the fewer the number of times it is referenced. The lower the importance of the image frame, the more it can be processed in parallel to improve the processing efficiency of encoding compression. The parallel processing condition includes the condition for determining whether to perform parallel processing on the image frame based on the parallel processing threshold. The parallel processing threshold is used to determine whether to perform parallel processing on the image frame. The image coding unit is obtained by dividing the image frame into units. The image coding unit is the processing unit for performing parallel processing on the image frame. By simultaneously and parallelly processing multiple image coding units that have no dependency relationship, the parallel processing of the image frame is realized. The wavefront parallel processing method corresponds to the image coding unit to be processed as the coding tree unit CTU. Thus, multiple rows of CTU processing are performed simultaneously in the rows of CTU, but the latter row is 2 CTUs slower than the previous row, ensuring the original performance. The so-called wavefront parallelism means that the CTU is not independent and is used for parallel processing when mutual reference is required. For example, intra-frame prediction requires the reference CTU in the upper row and the leftmost column, inter-frame prediction requires the motion characteristics of the upper CTU and the left CTU, the loop filtering process crosses CTUs and various boundaries, etc. The parallel compression analysis obtains the analysis results corresponding to each image coding unit respectively, and based on each analysis result, the coding parameters of the image frame are obtained. The image frame is divided into multiple image coding units, and the coding parameters of the image frame can be obtained by synthesizing the analysis results corresponding to each image coding unit.

[0082] Specifically, when performing parallel compression analysis on the image coding units in the image frame, the server determines the image level of the image frame. Specifically, it can determine the image group to which the image frame belongs, and based on this image group, determine the image level of the image frame. It can also determine the image level of the image frame according to the level parameter carried by the image frame. The server compares the image level of the image frame with the parallel processing threshold in the parallel processing condition. If the image level of the image frame is greater than the parallel processing threshold, it indicates that the level where the image frame is located is relatively high, and its importance is low, and parallel processing can be performed to improve the processing efficiency of encoding compression. The server determines each image coding unit in the image frame, and according to the wavefront parallel processing method, performs parallel compression analysis on each image coding unit to obtain the analysis results corresponding to each image coding unit respectively. The analysis results can include the coding parameters of the corresponding image coding unit. According to the analysis results corresponding to each image coding unit respectively, the coding parameters for the image frame can be obtained. Specifically, the analysis results corresponding to each image coding unit can be fused in order according to the position of the image coding unit in the image frame to obtain the coding parameters for the image frame, and the image frame is encoded and processed through the coding parameters for the image frame.

[0083] In this embodiment, when the image level of an image frame is greater than the parallel processing threshold, parallel compression analysis is performed on each image coding unit in accordance with the wavefront parallel processing method, and coding parameters for the image frame are obtained according to the analysis results respectively corresponding to the image coding units. Performing parallel compression analysis on each image coding unit in an image frame with a low importance level in accordance with the wavefront parallel processing method can improve the efficiency of encoding and processing the image frames in a video and ensure the performance of video compression.

[0084] In one embodiment, the image coding units in an image frame are arranged in rows; parallel compression analysis is performed on each image coding unit, and coding parameters for the image frame are obtained according to the analysis results respectively corresponding to the image coding units, including: performing parallel residual analysis on each image coding unit to obtain residual parameters respectively corresponding to the image coding units; when the residual parameters of the first image coding unit in each image coding unit satisfy the residual correction condition, correcting the residual parameters of the first image coding unit; the first image coding unit is the first image coding unit in each row of image coding units; obtaining the analysis result corresponding to the first image coding unit based on the corrected residual parameters; and obtaining the coding parameters for the image frame according to the analysis results respectively corresponding to the image coding units.

[0085] Among them, the image coding units in the image frame are arranged in rows. That is, when parallel processing each image coding unit, by simultaneously processing multiple rows of image coding units, parallel processing can be achieved. Parallel residual analysis refers to performing residual analysis on each image coding unit in the image frame in parallel. For example, 3 rows of image coding units can be analyzed for residuals in parallel to determine the residual parameters corresponding to each image coding unit. The residual parameters reflect the similarity degree between an image coding unit and its associated image coding unit. The first image coding unit is the first image coding unit in each row of image coding units. That is, when performing parallel processing, the first image coding unit in each row of image coding units is the first image coding unit. The residual correction condition is used to determine whether it is necessary to correct the residual parameters of the first image coding unit. The image coding units in the image frame are arranged in rows, and encoding analysis is performed in parallel through multiple rows. If the residual parameter of the first image coding unit in a certain row is 0, the quantization parameter corresponding to this first image coding unit is the last image coding unit in the previous row, which causes the quantization parameter corresponding to the first image coding unit to be unable to be correctly determined during parallel processing, resulting in the inability to correctly reconstruct the image. Therefore, it is necessary to avoid the situation where the residual parameter of the first image coding unit is 0. Specifically, the residual parameter is corrected, and the analysis result corresponding to the first image coding unit is obtained based on the corrected residual parameter. Among them, the quantization parameter reflects the spatial detail compression situation. For example, if the quantization parameter is small, most details in the video will be retained; as the quantization parameter increases, some details are lost, the bit rate decreases, but the image distortion increases and the quality deteriorates.

[0086] Specifically, the image coding units in the image frame are arranged in rows, and the server performs parallel compression analysis on the image coding units row by row. Specifically, the server can perform compression analysis on multiple rows of image coding units in the image frame in parallel, including performing parallel residual analysis on each image coding unit to obtain the residual parameters corresponding to each image coding unit respectively. When the residual parameter of the first image coding unit in each image coding unit satisfies the residual correction condition, it indicates that it is necessary to correct the residual parameter of the first image coding unit to avoid affecting the encoding and restoration processing of the first image coding unit. In specific applications, the server can determine whether the residual parameter of each first image coding unit takes the value of 0. For the first image coding unit with a residual parameter value of 0, its residual parameter is corrected to avoid the problem of being unable to correctly restore the corresponding image frame. When specifically applied, the image information of the first image coding unit can be adjusted, such as modifying the low-frequency coefficient or high-frequency coefficient corresponding to the first image coding unit, changing the low-frequency coefficient or high-frequency coefficient from 0 to 1, or by reducing the quantization parameter to make the residual parameter corresponding to the first image coding unit not 0. It is also possible to use a lossless coding method, such as encoding through the PCM (Pulse Code Modulation) coding method, to avoid the residual parameter being 0.

[0087] After correcting the residual parameters of the first image coding unit that meets the residual correction condition, the server obtains the analysis result corresponding to the first image coding unit based on the corrected residual parameters. For other image coding units in the video that do not require residual parameter correction, the corresponding analysis results can be directly obtained based on parallel compression analysis. After obtaining the analysis results corresponding to each image coding unit respectively, the server obtains the coding parameters for the image frame based on the analysis results corresponding to each image coding unit respectively.

[0088] In this embodiment, when performing parallel compression analysis on each image coding unit, for the first image coding unit that meets the residual correction condition, the residual parameters of the first image coding unit are corrected, and the analysis result corresponding to the first image coding unit is obtained based on the corrected residual parameters. According to the analysis results corresponding to each image coding unit in the image frame, the coding parameters for the image frame are obtained. By correcting the residual parameters of the first image coding unit, the problem of being unable to correctly restore the reconstructed image frame is avoided, thereby ensuring the compression performance of the video.

[0089] In one embodiment, based on the coding parameters corresponding to each image frame in the video, compressing the video includes: determining the coding parameters corresponding to each image frame in the video; encoding the corresponding image frame based on the coding parameters corresponding to each image frame in a non-wavefront parallel processing manner to obtain the coding results corresponding to each image frame respectively; and compressing the video based on the coding results corresponding to each image frame respectively.

[0090] Among them, the non-wavefront parallel processing manner refers to a coding manner that does not pass through wavefront parallel processing, such as ways like Slices or Tiles. The non-wavefront parallel processing manner can be specifically set according to actual needs, but the non-wavefront parallel processing manner does not adopt the wavefront parallel processing manner.

[0091] Specifically, when compressing a video, the server determines the encoding parameters corresponding to each image frame in the video. Among them, for the image frames in the video that meet the corresponding parallel processing conditions, the encoding parameters for the image frames can be obtained by performing parallel compression analysis on the image coding units in the image frames. For the image frames in the video that do not meet the corresponding parallel processing conditions, the image frames can be compressed and analyzed by means such as slicing or tiling to obtain the encoding parameters for the corresponding image frames. That is, the encoding parameters corresponding to each image frame in the video can include the encoding parameters obtained by performing parallel compression analysis on the image coding units, and also include the encoding parameters obtained by performing compression analysis on the image frames that do not meet the parallel processing conditions through other compression analysis methods. After obtaining the encoding parameters corresponding to each image frame in the video, the server encodes the corresponding image frames based on the encoding parameters corresponding to each image frame in a non-wavefront parallel processing manner, that is, an encoding method without using WPP, to obtain the encoding results corresponding to each image frame. For example, slicing or tiling can be used to encode the image frames to obtain the encoding results corresponding to each image frame. After obtaining the encoding results corresponding to each image frame, the server can compress the video based on the encoding results corresponding to each image frame. Specifically, the server can package the encoding results corresponding to each image frame to compress the video and obtain the compression result corresponding to the video. The compression result includes the encoding results corresponding to each image frame in the video.

[0092] In specific applications, for the image frames in the video that meet the corresponding parallel processing conditions, by performing parallel compression analysis on the image coding units in the image frames, specifically, the parallel compression analysis on the image coding units in the image frames can be performed in a wavefront parallel processing manner to obtain the encoding parameters for the image frames. For the image frames in the video that do not meet the corresponding parallel processing conditions, the image frames can be compressed and analyzed by other means, such as slicing or tiling, to obtain the encoding parameters corresponding to the image frames. When encoding each image frame, the corresponding image frames can be encoded based on the encoding parameters corresponding to each image frame in a non-wavefront parallel processing manner, and the video can be compressed based on the encoding results corresponding to each image frame. Further, when faster compression efficiency is required, when encoding each image frame, the corresponding image frames can also be encoded based on the encoding parameters corresponding to each image frame in a wavefront parallel processing manner, and the video can be compressed based on the encoding results corresponding to each image frame.

[0093] In this embodiment, in accordance with the non-wavefront parallel processing method, based on the encoding parameters corresponding to each image frame, the corresponding image frame is encoded. Avoiding the use of the wavefront parallel processing method in the encoding stage can reduce the compression performance loss caused by using the wavefront parallel processing method for encoding, thereby ensuring the compression performance of the video.

[0094] In one embodiment, after obtaining the video to be compressed, it further includes: determining the image size information of each image frame in the video; when the image size information and the compression processing resources meet the parallel start condition, performing the step of, for each image frame in the video, performing adaptive mapping based on the difference feature between the image frame and the corresponding reference frame, and determining the parallel processing condition corresponding to the image frame according to the mapping result.

[0095] Among them, the image size information describes the image size of each image frame in the video, and specifically may include the width and height of the image, so that the resources required for compressing the video can be determined according to the image size information. The image size information can be determined by analyzing the sizes of each image frame in the video. The larger the image size of each image frame in the video, the larger the data volume of each image frame, and the more parallel tasks can be divided. The compression processing resources are the resources of the device for performing video compression, and specifically may be the computing resources of the server. The higher the compression processing resources of the server, the more parallel processing tasks can be supported. The parallel start condition is used to determine whether the server supports parallel processing of the video, and specifically can be set according to the actual resource status of the server.

[0096] Specifically, after obtaining the video to be compressed, the server determines the image size information of each image frame in the video. Specifically, a predetermined number of image frames can be randomly selected from the video, and the sizes of the image frames are analyzed to determine the image size information of each image frame in the video, specifically including the width and height of each image frame. The server further determines the compression processing resources that can be used for video compression. Based on the image size information and the compression processing resources, the server determines whether the parallel start condition is met. For example, the server can determine the number of parallel compression tasks that can be supported based on the compression processing resources, and determine the number of parallel compression tasks that can be divided according to the image size information, and comprehensively determine whether the parallel start condition is met. If the parallel start condition is met, it indicates that parallel compression processing can be performed on the video, and the step of, for each image frame in the video, performing adaptive mapping based on the difference feature between the image frame and the corresponding reference frame, and determining the parallel processing condition corresponding to the image frame according to the mapping result is executed, so as to perform compression processing on the video. If the parallel start condition is not met, it indicates that the server does not support parallel compression of the video, and the video can be compressed by other compression methods, such as cutting, tiling, or frame-level parallelism, etc.

[0097] In this embodiment, when it is determined that the parallel start condition is met according to the image size information of each image frame in the video and the compression processing resources of the server, parallel compression processing of the video is performed, so as to adaptively perform parallel compression analysis on each image frame in the video, reduce the introduced compression performance loss, and thus ensure the compression performance of the video while improving the video compression processing efficiency.

[0098] In one embodiment, the video compression method further includes: determining the group of pictures (GOP) to which the image frame belongs in the video; determining the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on the GOP; performing difference analysis on the image frame and the reference frame to obtain the difference feature between the image frame and the reference frame.

[0099] Among them, the GOP refers to a frame sequence formed by dividing multiple image frames in the video. In the GOP, there can be an image frame that has been completely encoded and processed as a reference frame, and the differences between other image frames in the GOP and this reference frame are encoded. That is, the reference frame is the image frame for other image frames in the GOP to be encoded with reference. The hierarchical feature is used to represent the hierarchical information of the image frame in the GOP to which it belongs. The difference feature is used to represent the difference between the image frame and the corresponding reference frame, and can be specifically obtained according to the picture change between the image frame and the corresponding reference frame, such as the object difference and pixel difference between the image frame and the corresponding reference frame.

[0100] Specifically, after obtaining the video to be compressed, when the server performs encoding processing on each image frame in the video, the server determines the GOP to which the image frame belongs in the video, and can specifically determine the GOP to which the image frame belongs according to the group division relationship of the image frame. After determining the GOP to which the image frame belongs, the server determines the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on this GOP. The hierarchical feature can be obtained according to the level to which the image frame belongs to describe the reference relationship of the image frame in the corresponding GOP. Further, the server performs difference analysis on the image frame and the reference frame to obtain the difference feature between the image frame and the reference frame. Specifically, the server can compare the image frame and the reference frame to determine the difference feature between the image frame and the reference frame. The difference feature can represent the picture change of the image frame compared with the reference frame, and can specifically include but is not limited to motion features, residual features, etc. The server can perform adaptive mapping based on the difference feature between the image frame and the reference frame to determine the parallel processing conditions corresponding to the image frame according to the mapping result.

[0101] In this embodiment, the hierarchical feature of an image frame and the corresponding reference frame of the image frame are determined according to the image group to which the image frame belongs, so as to perform a difference analysis between the image frame and the corresponding reference frame to obtain the difference feature between the image frame and the reference frame, so as to determine the parallel processing condition corresponding to the image frame based on the difference feature, and implement parallel compression analysis for each image frame in the video adaptively through the parallel processing condition.

[0102] In one embodiment, determining the hierarchical feature of an image frame and the corresponding reference frame of the image frame based on the image group includes: determining the image group feature of the image group; determining the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on the image group reference relationship in the image group feature.

[0103] Among them, the image group feature is used to describe the corresponding image group, and specifically may include features representing the hierarchical reference relationship between each image frame in the image group. The image group feature includes an image group attribute feature and an image group reference relationship. The image group attribute feature can describe the features of the image group attribute, such as the size of the image group, the number of the image frame, etc.; the image group reference relationship reflects the reference relationship between each image frame in the image group.

[0104] Specifically, after determining the image group to which the image frame belongs, the server obtains the image group feature of the image group. The image group feature includes an image group reference relationship. The server determines the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on the image group reference relationship in the image group feature. In specific applications, the server can determine the reference relationship between each frame image in the image group according to the image group reference relationship, and determine the hierarchical feature of the image frame in the image group based on the reference relationship between each frame image, such as obtaining the hierarchical feature of the image frame according to the level where the image frame is located in the image group, and determining the corresponding reference frame of the image frame according to the reference relationship between each frame image.

[0105] In this embodiment, the hierarchical feature of the image frame and the corresponding reference frame of the image frame are determined based on the image group reference relationship in the image group feature, so that the parallel processing condition corresponding to the image frame can be determined based on the difference feature between the image frame and the corresponding reference frame, and parallel compression analysis for each image frame in the video can be implemented adaptively through the parallel processing condition.

[0106] In one embodiment, performing a difference analysis on the image frame and the reference frame to obtain the difference feature between the image frame and the reference frame includes: determining the matching image block corresponding to each original image block in the image frame in the reference frame; obtaining the motion information corresponding to each original image block according to the position of each original image block and the position of the corresponding matching image block; obtaining the motion feature between the image frame and the reference frame based on the motion information corresponding to each original image block.

[0107] Among them, the difference features include motion features, and the motion features characterize the motion intensity of the image between the image frame and the corresponding reference frame, which is specifically determined according to the motion information between the image frame and the corresponding reference frame. The image frame can be divided into multiple original image blocks, and the size of the original image blocks can be flexibly set according to actual needs. The image frame takes the reference frame as a reference, and each original image block in the image frame can be matched in the reference frame to obtain a corresponding matching image block. According to the position change between the original image block and the corresponding matching image block, the motion information corresponding to each original image block is obtained, that is, the motion information of the image frame relative to the reference frame is obtained, and the motion characteristics between the image frame and the reference frame can be obtained based on the motion information.

[0108] Specifically, when determining the difference features between the image frame and the reference frame, the server determines the matching image blocks in the reference frame that correspond to the original image blocks in the image frame. In specific implementation, the server can divide the image frame into multiple original image blocks, search and match the original image blocks in the reference frame, such as using a full search, a diamond search, or a quadrilateral search, etc., to determine the matching image blocks corresponding to the original image blocks from the reference frame. For example, the sum of absolute errors (SAD) or SATD (Sum of Absolute Transformed Difference) of the pixel difference values ​​between the original image block and each image block in the reference frame can be calculated, that is, the sum of absolute values ​​after the Hadamard transformation, and the image block with the smallest calculation result is the matching image block corresponding to the original image block. After determining the matching image blocks in the reference frame, the server determines the position of each original image block and the position of the corresponding matching image block, and obtains the motion information corresponding to each original image block according to the position of each original image block and the position of the corresponding matching image block. Specifically, the displacement between each original image block and the corresponding matching image block can be determined according to the position of each original image block and the position of the corresponding matching image block, and the motion information corresponding to each original image block can be obtained. The server determines the motion characteristics between the image frame and the reference frame based on the motion information corresponding to each original image block. Specifically, the motion information corresponding to each original image block can be summed and transformed to obtain the motion characteristics between the image frame and the reference frame. For example, motion characteristic = (the sum of the displacements of all original image blocks in the X-axis direction of the current image frame / image width + the sum of the displacements of all original image blocks in the Y-axis direction of the current image frame / image height) / the number of all original image blocks / the distance between the current image frame and the reference frame. The larger the motion characteristic value, the more violent the motion between images; conversely, the smaller the motion characteristic value, the more static the images.

[0109] In this embodiment, according to the positions of the original image blocks in the image frame and the positions of the corresponding matching image blocks in the reference frame, the motion information corresponding to each original image block is determined, and based on the motion information corresponding to each original image block, the motion characteristics between the image frame and the reference frame are determined. Thus, the difference characteristics between the image frame and the reference frame can be determined through the image displacement between the image frame and the reference frame, so as to determine the parallel processing conditions corresponding to the image frame based on the difference characteristics, and the parallel compression analysis for each image frame in the video can be adaptively implemented through the parallel processing conditions.

[0110] In one embodiment, a difference analysis is performed on the image frame and the reference frame to obtain the difference characteristics between the image frame and the reference frame, including: obtaining the residual information corresponding to each original image block according to the pixels of each original image block and the pixels of the corresponding matching image block; and obtaining the residual characteristics between the image frame and the reference frame based on the residual information corresponding to each original image block and the number of original image blocks.

[0111] Among them, the difference characteristics include residual characteristics, and the residual characteristics characterize the similarity degree of the images between the image frame and the corresponding reference frame, which is specifically determined according to the pixel similarity between the image frame and the corresponding reference frame. The image frame can be divided into multiple original image blocks, and the size of the original image blocks can be flexibly set according to actual needs. The image frame takes the reference frame as a reference, and each original image block in the image frame can be matched in the reference frame to obtain the corresponding matching image block. According to the pixel change between the original image block and the corresponding matching image block, the residual information corresponding to each original image block is obtained, that is, the residual information of the image frame relative to the reference frame is obtained, and the residual characteristics between the image frame and the reference frame can be obtained based on the motion residual.

[0112] Specifically, when determining the difference features between an image frame and a reference frame, the server determines the matching image blocks in the reference frame that respectively correspond to the original image blocks in the image frame. After determining the matching image blocks in the reference frame, the server determines the pixels of each original image block and the pixels of the corresponding matching image block, and based on the pixels of each original image block and the pixels of the corresponding matching image block, obtains the residual information respectively corresponding to each original image block. Specifically, the pixel change between each original image block and the corresponding matching image block can be determined according to the pixels of each original image block and the pixels of the corresponding matching image block, so as to obtain the residual information respectively corresponding to each original image block. The server determines the residual features between the image frame and the reference frame based on the residual information respectively corresponding to each original image block. Specifically, a summation transformation can be performed on the residual information respectively corresponding to each original image block to obtain the residual features between the image frame and the reference frame. For example, Residual feature = Sum of absolute error of residuals of all original image blocks in the current image frame / Number of all original image blocks. The larger the value of the residual feature, the lower the image similarity; conversely, the smaller the value of the residual feature, the higher the image similarity.

[0113] In this embodiment, according to the pixels of each original image block in the image frame and the pixels of the corresponding matching image block in the reference frame, the residual information respectively corresponding to each original image block is determined, and based on the residual information respectively corresponding to each original image block, the residual features between the image frame and the reference frame are determined. Thus, the difference features between the image frame and the reference frame can be determined through the pixel change between the image frame and the reference frame, so as to determine the parallel processing conditions corresponding to the image frame based on the difference features, and perform parallel compression analysis adaptively for each image frame in the video through the parallel processing conditions.

[0114] In one embodiment, the video compression method further includes: when the hierarchical features of the image frame do not meet the parallel processing conditions, performing compression analysis on the image frame in a non-wavefront parallel processing manner to obtain the coding parameters for the image frame.

[0115] Among them, the non-wavefront parallel processing manner refers to a manner that does not use wavefront parallel processing, such as cutting or tiling. The non-wavefront parallel processing manner can be specifically set according to actual needs, and the non-wavefront parallel processing manner does not adopt the wavefront parallel processing manner.

[0116] Specifically, when the hierarchical features of an image frame do not meet the parallel processing conditions, it indicates that the image frame is not suitable for parallel compression analysis of the image coding units in the image frame. Then, the server performs compression analysis on the image frame in a non-wavefront parallel processing manner, such as in a cutting or tiling manner, to obtain the coding parameters for the image frame. In specific applications, for an image frame whose hierarchical features do not meet the parallel processing conditions, the server can determine the coding parameters of the image frame through other means. For example, it can sequentially perform compression analysis on the image coding units in the image frame to determine the coding parameters for the current image frame, and perform coding compression processing based on these coding parameters.

[0117] In this embodiment, for an image frame that does not meet the parallel processing conditions, compression analysis is performed in a non-wavefront parallel processing manner to determine the coding parameters for the current image frame, and coding compression processing is performed based on these coding parameters. This can adaptively perform parallel compression analysis on each image frame in the video, reduce the introduced compression performance loss, and thus ensure the compression performance of the video while improving the video compression processing efficiency.

[0118] This application also provides an application scenario that applies the above video compression method. Specifically, the application of the video compression method in this application scenario is as follows:

[0119] With the rapid development of video applications, videos are continuously evolving towards high definition, high frame rate, and high resolution. H.265 has been widely used due to its excellent compression performance and plays an increasingly important role in the video field. H.265 is also known as HEVC (High Efficiency Video Coding), which is the successor to the ITU-T H.264 / MPEG-4 AVC standard. H.265 divides an image into coding tree units (CTUs). Depending on different coding settings, the size of the coding tree unit can be set to 64×64 or limited to 32×32 or 16×16. Larger coding tree units can provide higher compression efficiency (although they also require higher coding speed). Each coding tree unit can be recursively divided into sub-regions of 32×32, 16×16, and 8×8 using a quadtree structure. Each image is further divided into special groups of tree-coded blocks called Slices and Tiles. The coding tree unit is the basic coding unit of H.265, similar to the macroblock in H.264. A coding tree unit can be further partitioned into a Coding Unit (CU), a Prediction Unit (PU), and a Transform Unit (TU). Each coding tree unit contains one luma and two chroma coding tree blocks, as well as syntax elements for recording additional information. However, the computational complexity of H.265 is many times higher than that of H.264. Such high computational complexity is very costly if relying solely on the processing power of a single core. Therefore, in the implementation of H.265, parallel computing requirements need to be considered to fully utilize the multi-core resources of the device.

[0120] From a data perspective, parallel algorithms on H.265 can be classified, from high to low, into GOP (Group Of Picture) level, frame level, slice / tile level, and CTU-level WPP parallelism.

[0121] Among them, for GOP-level parallelism, GOP is short for Group Of Picture, which means a group of pictures, such as Figure 4As shown in the figure, in a Group of Pictures (GOP), an I-frame is an intra-coded frame, representing a key frame. The picture of this frame is completely retained, and only the data of this frame is required for decoding. A P-frame is a forward-predicted coded frame. A P-frame represents the difference between this frame and a previous key frame (or P-frame). When decoding, the previously cached picture needs to be superimposed with the difference defined in this frame to generate the final picture. A P-frame is a difference frame. A P-frame does not have complete picture data, only the data of the difference from the previous frame. A B-frame is a bi-directional predicted interpolation coded frame. What a B-frame records is the difference between this frame and the frames before and after. To decode a B-frame, not only the previously cached picture needs to be obtained, but also the pictures after that need to be decoded. The final picture is obtained by superimposing the data of the previous and subsequent pictures with the data of this frame. The compression ratio of a B-frame is high. The reference relationships among I-frames, B-frames, and P-frames are as Figure 4 indicated by the arrows in the figure. Based on an I-frame, P-frames can be determined in sequence, and based on an I-frame and P-frames, B-frames can be determined. If it is defined to start from an IDR (Instantaneous Decoding Refresh) frame and end at the next IDR frame, then GOPs are independent of each other, can be parallelized, and there is no loss of compression performance. However, there are two problems with this parallelization: one is that the sizes of each GOP are inconsistent, and the difference may be very large, which is not conducive to parallel efficiency; the other is that for each additional group of parallel GOPs, the memory used doubles exactly, and the overhead is relatively large.

[0122] For frame-level parallelism, the frame-level structure of H.265 is much more complex than that of H.264. Frames can reference each other, but non-reference frames are independent of each other and can be parallelized. In addition, if the frames are layered according to the reference relationship, the relationship between frames in the same layer is relatively weak. When certain restrictions are imposed on the reference relationship, a certain amount of compression performance can be sacrificed to perform parallel processing on the frames in the same layer.

[0123] For Slice-level parallelism, each frame of an image can be split into multiple sliced Slices. The data between each Slice is independent, as Figure 5 shown in the figure. The image is divided into multiple Slices. Slice1 and Slice2 are indicated by different filled lines, and each Slice is independent of each other. Therefore, multiple Slices within a frame can be processed in parallel with each other. However, precisely because the Slices are independent of each other, Slices cannot perform intra-frame or inter-frame prediction across their boundaries, and each Slice has independent header information, resulting in a decrease in compression efficiency. As the number of Slices increases, the parallelism is higher, but the compression efficiency is also lower. In addition, although filtering across blocks can be performed between Slices, it will in turn affect the compression performance.

[0124] For Tile-level parallelism, compared with slices, the biggest change is that it does not need to be divided according to the coding order of frames, but can be divided into rectangles, as Figure 6 shown. The image is divided into rectangular tiles of various sizes. Moreover, header information does not need to be written, reducing bitrate waste. However, at the same time, the same problem exists with Tile and slice parallelism, that is, between tiles, because they are independent of each other, it is impossible to perform intra-frame prediction across their boundaries, reducing the compression ratio. At the same time, Tile parallelism is mutually exclusive with macroblock row-level parallelism, which also limits its usage scenarios.

[0125] For CTU-level WPP parallelism, it was first proposed in H.265 and is also the most important parallelism method in H.265. The idea is that since the prediction, reconstruction, entropy coding, etc. of each block will use the data of adjacent blocks, there is a mutual dependence relationship between each macroblock and its left, upper left, upper, and upper right blocks, as Figure 7 shown. The CTU at (x,y) has a dependence relationship with its left, upper left, upper, and upper right CTUs. Therefore, for different macroblock rows, if two macroblocks can be staggered, the macroblocks can be processed in parallel, as Figure 8 shown. The shaded CTUs can be processed in parallel, which can greatly improve the parallel efficiency, but this parallelism has certain disadvantages. First, in order to enable each row to be encoded independently, the entropy coding context model needs to be updated independently for each row during encoding, resulting in a loss of compression performance and the need to introduce additional syntax elements, further reducing the compression performance. Second, for the hierarchical coding frame structure, the higher the hierarchical level of the frame, the greater the loss of compression performance. Finally, for frames with different characteristics, the loss of compression performance is different.

[0126] In traditional video compression processing technologies, a unified parallel scheme is often adopted. For different video features, the impact on videos with different hierarchical structures varies, lacking flexibility. Moreover, to achieve greater parallel acceleration, a relatively large performance loss is introduced, and as the hierarchical structure becomes more complex, the performance loss becomes greater. Further, in traditional video compression processing technologies, although the parallel encoding efficiency is significantly improved, the compression performance loss is obvious. The main reason is that no more appropriate scheme is selected for different image features, resulting in a loss of compression performance; while parallel entropy coding brings a certain speedup, it also causes a relatively high compression performance loss; when high-level images use WPP parallelism, the parallel benefits are limited, but it causes a relatively high compression performance loss, and the loss is related to the features of the images. Based on this, the overall concept of the video compression method provided in this embodiment is to adaptively select an appropriate parallel scheme according to different video features, specifically calculate the frames at the levels where WPP needs to be turned on or off adaptively according to the information of the images; and use WPP parallel analysis during analysis, while adopting ordinary encoding methods during encoding to reduce the compression performance loss during encoding.

[0127] Specifically, obtain the video to be compressed and determine whether to enable WPP for parallel processing of this video. Specifically, determine whether to enable WPP according to the number of available CPU cores of the server and the width and height of the image frames in the video. The more available CPU cores, the more resources can be provided for parallelism; the larger the width or height of the image, the more rows can be divided for WPP parallelism. During specific operations, it can be determined according to the actual situation. For example, when (cpu_number > 2 and Min(Width / 2 / CTU_size, Height / CTU_size) > 2), turn on WPP, indicating that WPP is required to perform parallel compression processing on this video. cpu_number is the number of available CPU cores, Width is the width of the image frames in the video, Height is the height of the image frames in the video, and CTU_size is the size of the divided CTU, such as 64 * 64. If it is determined not to enable WPP, compress this video through other video compression methods.

[0128] Further, determine the hierarchical features of the image frames in the video, specifically including image hierarchical information. Determine the GOP size and reference relationship of the image. The GOP size and reference relationship can be determined according to parameters or calculated adaptively through an algorithm. The GOP size refers to the size of the image group to which the image frame belongs, that is, the number of image frames in the image group; the reference relationship is the mutual dependence relationship between the image frames in the image group. For example Figure 9As shown in the figure, a group of images GOP includes 8 frames numbered 1-8, that is, the GOP size is 8. The serial number represents the coding order of each image frame (coder order), from left to right, it is the display order of the image (display order), and the black arrow represents the reference relationship (dependency) between frames. The current frame depends on the pointed frame. For example, 2 refers to 0 and 1, and 4 refers to 2 and 1. The importance of the referenced frame is higher than the current frame. The most important frame in a GOP is defined as layer 0, that is, the 0th layer. For each lower level of importance, the layer increases by 1. For example, in a GOP (serial number 1 to 8), 1 is the most important frame, and its layer is 0, 2 refers to 1, and its layer is 1, 3 and 4 refer to 2, and their layer is 2, 5, 6, 7, 8 refer to 3 and 4, so their layer is 3. The smaller the layer, the higher its importance, and its compression performance needs to be ensured; conversely, the higher the layer, the less important it is, and the processing efficiency of its compression can be improved.

[0129] Determine the motion characteristics of the image frame in the video, including the motion intensity information. In the lookahead process, each block of size 8x8 has been searched on its reference image to find the best matching block on the reference image. The search method can adopt various search methods such as full search, diamond search or quadrilateral search, and the matching method can calculate the SAD (Sum of Absolute Difference) or SATD (Sum of Absolute Transformed Difference) of the pixel difference between the original block image and the reference block image, that is, the absolute value sum after the hadamard transformation. The block with the smallest calculation result is determined as the matching block corresponding to the original block. The displacement between the current block and the matching block (x-offset, y-offset) = (abs(x_original-x_match), abs(y_original-y_match)) (abs(x) means to find the absolute value of x), and the motion size of the current block is obtained. The motion intensity information of the current frame = (the sum of x_offset of all blocks in the current frame / image width + the sum of y_offset of all blocks in the current frame / image height) / the number of blocks in the current frame / the distance between the image and the reference image. The greater the motion intensity, the more violent the motion between images; conversely, the smaller the motion intensity, the more static the images.

[0130] Determine the residual features of the image frames in the video, which may specifically include residual size information. After obtaining a matching block of 8x8, calculate the pixel difference between the image of the original block and the image of the matching block, which is the residual. Residual information size = sum of the SAD of the residuals of all blocks in the current frame / number of blocks in the current frame. The larger the residual information size, the lower the image similarity; conversely, the smaller the residual information size, the higher the image similarity.

[0131] Furthermore, since WPP can improve parallel efficiency while causing a decrease in compression performance, it is possible to adaptively determine whether to turn on WPP for different frames according to the image information of the image frames in the video. Different images are at different levels in the GOP, representing different degrees of importance. The lower the level of the frame, the higher the importance, the more times it is referenced, and the greater the influence range; while the higher the level of the frame, the lower the importance, the fewer times it is referenced, and the smaller the influence range. Therefore, turning on WPP for low-level images will cause more performance loss, while turning on WPP for high-level images will result in less performance loss. Based on this, a threshold value threshold can be set to reasonably select which levels of WPP to turn on. When the layer of the current image is less than or equal to threshold, WPP is turned off; when the layer of the current image is greater than threshold, WPP is turned on.

[0132] The threshold Thresehold of WPP is a function related to the motion intensity information mv and the residual size information res, Threshold = Fun(mv, res). Specifically, when the motion intensity information is larger, the image motion is more intense, the correlation between images is smaller, and the impact caused by turning on WPP is smaller; when the residual information size is larger, the image similarity is lower, and the impact caused by turning on WPP is also smaller. For example, Threshold = Clip(0, MaxLayer, a / mv + b / res); where the coefficients a and b can be set according to the actual situation, and MaxLayer is the maximum level of the current GOP. Here, y = Clip(min, max, x) means restricting x within the range of the minimum value min and the maximum value max, and assigning the return value to y, that is, when x is within the range of min and max, y = x; if x is less than min, then y = min, if x is greater than max, then y = max. In addition, in addition to determining whether to turn on WPP through the level of the image frame, it is also possible to make a determination based on the reference parameter of the image frame. The higher the number of times the image frame is referenced, the lower its level, and it is necessary to ensure its compression processing performance.

[0133] If it is determined that the image frame in the video needs to enable WPP for parallel compression processing, the specific usage mode of WPP is further determined. The video compression process mainly includes two stages, the analysis stage and the encoding stage. The analysis stage refers to the process of selecting the optimal partition block size for each CTU (whether it is 64x64, 32x32, or 16x16), the partition mode (including using intra-frame modes such as DC mode, planer mode, or angular mode, etc.) or inter-frame mode (such as using unidirectional or bidirectional for inter-frame), the coefficients after residual transformation quantization, and other various encoding parameters. The encoding stage refers to the process of writing various encoding parameters such as the optimal partition block size, partition mode, and residual coefficients into the bitstream. The traditional WPP means using WPP in both the analysis stage and the encoding stage. In this embodiment, WPP is used in the analysis stage for parallel analysis acceleration, while WPP is not used for parallel encoding in the encoding stage. The difference between the two is that the traditional WPP method, while bringing a significant speed increase, will cause an obvious loss of compression performance. In this embodiment, by removing WPP parallelism in the encoding stage, the loss can be greatly reduced, thus ensuring the performance of video compression. In specific applications, if parallel processing needs to be performed on the current image frame through WPP, it is default to use WPP for parallel analysis acceleration in the analysis stage, while WPP is not used for parallel encoding in the encoding stage. If a higher encoding speed is required, the traditional WPP method can be selected, that is, WPP is also used for parallel encoding in the encoding stage.

[0134] In addition, when using WPP in the analysis stage and not using WPP in the encoding stage, if the cbf (Coding Block Flag, representing the residual) of the first TU block of a certain TCU block in the current macroblock row is 0, then its quantization parameter qp is equal to last_qp, that is, the quantization parameter qp of the last block in the previous row. As Figure 10 shown, when the cbf of the first TU block in thread 2 is 0, it indicates that its quantization parameter qp is the quantization parameter qp of the last block in the previous row, that is, equal to the quantization parameter qp of the last shaded block in thread 1. Because it is parallel analysis, it will cause the correct quantization parameter qp of the current block to be unavailable, resulting in the inability to correctly reconstruct the image. Based on this, it is necessary to avoid the situation where the first block in the current row has cbf = 0, that is, no residual. Specifically, after the transformation and quantization operations of the current block are completed, if it is found that its residual is 0, the low-frequency coefficient after its transformation can be changed from 0 to 1, so as to avoid the situation of cbf = 0. In addition, the high-frequency information can be changed from 0 to 1, or the qp value can be reduced until the residual of the image is not 0, or PCM lossless encoding can be used to avoid its residual being 0, so as to ensure the compression performance of the video.

[0135] In a specific application test, as shown in Table 1 below,

[0136] Table 1

[0137]

[0138] Among them, classB, classC, classD, classE, and classF are standard test sequence groups for testing compression performance, and the others are different types of video test sequence groups. PSNR (peak signal to noise ratio), the larger the PSNR between two images, the more similar they are; SSIM (Structural Similarity Index), the result calculated by SSIM is a decimal between -1 and 1. If the result is 1, it means that the two compared images are identical in data; when the BD-rate is negative, it means that under the same PSNR condition, the bitrate decreases and the performance improves; when it is positive, the bitrate increases and the performance decreases. As shown in Table 1 above, the video compression method provided in this embodiment has a compression performance improvement of 0.79% to 0.95% compared to the original highest-performance parallel scheme, and the compression performance improvement efficiency is obvious.

[0139] In this embodiment, for different video features, including the hierarchical information, motion information, and residual adaptability of the video, a suitable parallel scheme is selected. Specifically for the bottom-layer frames, in the analysis stage, WPP parallel analysis can be adaptively used, and in the encoding stage, either a normal encoding method or WPP encoding can be selected to maximize the reduction of compression performance loss while increasing the video parallelism, thereby ensuring the video compression performance while improving the video compression parallel processing efficiency.

[0140] It should be understood that although Figures 2 - 3 the steps in the flowchart of Figures 2 - 3 are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps has no strict order restriction, and these steps can be executed in other orders. Moreover,

[0141] In one embodiment, as Figure 11As shown, a video compression device 1100 is provided. This device can be implemented as a software module, a hardware module, or a combination of both, and becomes part of a computer device. Specifically, the device includes: a video acquisition module 1102, a parallel condition determination module 1104, an encoding parameter determination module 1106, and a video compression processing module 1108, where:

[0142] The video acquisition module 1102 is used to acquire the video to be compressed;

[0143] The parallel condition determination module 1104 is used to perform adaptive mapping on each image frame in the video based on the difference features between the image frame and the corresponding reference frame, and determine the parallel processing conditions corresponding to the image frame according to the mapping result;

[0144] The encoding parameter determination module 1106 is used to perform parallel compression analysis on the image coding units in the image frame to obtain the encoding parameters for the image frame when the hierarchical features of the image frame meet the parallel processing conditions; the image coding units are obtained by dividing the image frame into units;

[0145] The video compression processing module 1108 is used to compress the video based on the encoding parameters corresponding to each image frame in the video.

[0146] In one embodiment, the parallel condition determination module 1104 includes a mapping parameter determination module, an adaptive mapping module, a mapping adjustment module, and a parallel condition generation module; where: the mapping parameter determination module is used to determine the adaptive mapping parameters and the result limit range; the result limit range is obtained based on the group characteristics of the picture group to which the image frame belongs; the adaptive mapping module is used to perform adaptive mapping on the difference features between the image frame and the corresponding reference frame through the adaptive mapping parameters to obtain the difference feature mapping result; the mapping adjustment module is used to adjust the difference feature mapping result based on the result limit range to obtain a mapping result within the result limit range; the parallel condition generation module is used to determine the parallel processing threshold according to the mapping result and generate the parallel processing conditions corresponding to the image frame based on the parallel processing threshold.

[0147] In one embodiment, the difference features include motion features and residual features; the adaptive mapping parameters include motion feature mapping parameters and residual feature mapping parameters; the adaptive mapping module includes a motion feature mapping module, a residual feature mapping module, and a mapping result fusion module; where: the motion feature mapping module is used to perform adaptive mapping on the motion features through the motion feature mapping parameters to obtain the motion feature mapping result; the residual feature mapping module is used to perform adaptive mapping on the residual features through the residual feature mapping parameters to obtain the residual feature mapping result; the mapping result fusion module is used to obtain the difference feature mapping result based on the motion feature mapping result and the motion feature mapping result.

[0148] In one embodiment, the encoding parameter determination module 1106 includes an encoding unit determination module and a wavefront parallel processing module; wherein: the encoding unit determination module is configured to determine each image encoding unit in an image frame when the image level of the image frame is greater than the parallel processing threshold; the wavefront parallel processing module is configured to perform parallel compression analysis on each image encoding unit in a wavefront parallel processing manner, and obtain encoding parameters for the image frame according to the analysis results respectively corresponding to each image encoding unit.

[0149] In one embodiment, the image encoding units in an image frame are arranged in rows; the encoding parameter determination module 1106 further includes a residual analysis module, a residual parameter correction module, an analysis result obtaining module, and an analysis result processing module; wherein: the residual analysis module is configured to perform parallel residual analysis on each image encoding unit to obtain residual parameters respectively corresponding to each image encoding unit; the residual parameter correction module is configured to correct the residual parameter of the first image encoding unit when the residual parameter of the first image encoding unit in each image encoding unit meets the residual correction condition; the first image encoding unit is the first image encoding unit in each row of image encoding units; the analysis result obtaining module is configured to obtain an analysis result corresponding to the first image encoding unit based on the corrected residual parameter; the analysis result processing module is configured to obtain encoding parameters for the image frame according to the analysis results respectively corresponding to each image encoding unit.

[0150] In one embodiment, the video compression processing module 1108 includes an encoding parameter acquisition module, an encoding processing module, and an encoding result processing module; wherein: the encoding parameter acquisition module is configured to determine encoding parameters respectively corresponding to each image frame in a video; the encoding processing module is configured to encode the corresponding image frame based on the encoding parameters respectively corresponding to each image frame in a non-wavefront parallel processing manner to obtain encoding results respectively corresponding to each image frame; the encoding result processing module is configured to compress the video based on the encoding results respectively corresponding to each image frame.

[0151] In one embodiment, it further includes an image size determination module, configured to determine the image size information of each image frame in a video; when the image size information and the compression processing resources meet the parallel start condition, perform the step of adaptively mapping each image frame in the video based on the difference feature between the image frame and the corresponding reference frame, and determining the parallel processing condition corresponding to the image frame according to the mapping result.

[0152] In one embodiment, it further includes an image group determination module, an image group analysis module, and a difference analysis module; wherein: the image group determination module is used to determine the image group to which an image frame belongs in a video; the image group analysis module is used to determine the hierarchical features of the image frame and the corresponding reference frame of the image frame based on the image group; the difference analysis module is used to perform difference analysis on the image frame and the reference frame to obtain the difference features between the image frame and the reference frame.

[0153] In one embodiment, the image group analysis module includes an image group feature determination module and an image group feature analysis module; wherein: the image group feature determination module is used to determine the image group features of the image group; the image group feature analysis module is used to determine the hierarchical features of the image frame and the corresponding reference frame of the image frame based on the image group reference relationship in the image group features.

[0154] In one embodiment, the difference analysis module includes a matching image block determination module, a motion information determination module, and a motion feature determination module; wherein: the matching image block determination module is used to determine the matching image blocks corresponding to each original image block in the image frame in the reference frame; the motion information determination module is used to obtain the motion information corresponding to each original image block according to the positions of each original image block and the positions of the corresponding matching image blocks; the motion feature determination module is used to obtain the motion features between the image frame and the reference frame based on the motion information corresponding to each original image block.

[0155] In one embodiment, the difference analysis module further includes a residual information determination module and a residual feature determination module; wherein: the residual information determination module is used to obtain the residual information corresponding to each original image block according to the pixels of each original image block and the pixels of the corresponding matching image block; the residual feature determination module is used to obtain the residual features between the image frame and the reference frame based on the residual information corresponding to each original image block and the number of original image blocks.

[0156] In one embodiment, it further includes a non-wavefront parallel processing module, which is used to perform compression analysis on the image frame in a non-wavefront parallel processing manner to obtain the coding parameters for the image frame when the hierarchical features of the image frame do not meet the parallel processing conditions.

[0157] For the specific limitations of the video compression device, reference can be made to the limitations on the video compression method in the above text, which will not be elaborated here. Each module in the above video compression device can be implemented in whole or in part through software, hardware, and their combinations. The above-mentioned modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.

[0158] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structural diagram may be as shown in Figure 12 . The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store adaptive mapping data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a video compression method.

[0159] Those skilled in the art can understand that Figure 12 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0160] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps in the above method embodiments are implemented.

[0161] In one embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0162] In one embodiment, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in the above method embodiments.

[0163] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0164] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0165] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification. The above-described embodiments only represent several implementation manners of this application. Their descriptions are relatively specific and detailed, but they should not be construed as limitations on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of the patent of this application should be subject to the appended claims.

Claims

1. A video compression method, characterized in that, The method includes: Obtaining a video to be compressed; For each image frame in the video, determining an adaptive mapping parameter and a result limitation range; the result limitation range is obtained based on the group characteristics of the group of pictures to which the image frame belongs; Adapting and mapping the difference features between the image frame and the corresponding reference frame through the adaptive mapping parameter to obtain a difference feature mapping result; Adjusting the difference feature mapping result based on the result limitation range to obtain a mapping result within the result limitation range; Determining a parallel processing threshold according to the mapping result, and generating a parallel processing condition corresponding to the image frame based on the parallel processing threshold; When the hierarchical feature of the image frame meets the parallel processing condition, performing parallel compression analysis on the image coding units in the image frame to obtain coding parameters for the image frame; the image coding units are obtained by dividing the image frame into units; Compressing the video based on the coding parameters respectively corresponding to each image frame in the video.

2. The method according to claim 1, wherein The difference features include motion features and residual features; the adaptive mapping parameters include motion feature mapping parameters and residual feature mapping parameters; The step of adapting and mapping the difference features between the image frame and the corresponding reference frame through the adaptive mapping parameter to obtain a difference feature mapping result includes: Adapting and mapping the motion features through the motion feature mapping parameter to obtain a motion feature mapping result; Adapting and mapping the residual features through the residual feature mapping parameter to obtain a residual feature mapping result; Obtaining a difference feature mapping result based on the motion feature mapping result and the residual feature mapping result.

3. The method according to claim 1, wherein The step of when the hierarchical feature of the image frame meets the parallel processing condition, performing parallel compression analysis on the image coding units in the image frame to obtain coding parameters for the image frame includes: When the image level of the image frame is greater than the parallel processing threshold, determining each image coding unit in the image frame; Performing parallel compression analysis on each of the image coding units in a wavefront parallel processing manner, and obtaining coding parameters for the image frame according to the analysis results respectively corresponding to each of the image coding units.

4. The method according to claim 3, characterized in that, The image coding units in the image frame are arranged in rows; the step of performing parallel compression analysis on each of the image coding units and obtaining coding parameters for the image frame according to the analysis results respectively corresponding to each of the image coding units includes: Performing parallel residual analysis on each of the image coding units to obtain residual parameters respectively corresponding to each of the image coding units; When the residual parameter of the first image coding unit in each of the image coding units meets the residual correction condition, correcting the residual parameter of the first image coding unit; the first image coding unit is the first image coding unit in each row of the image coding units; Obtaining an analysis result corresponding to the first image coding unit based on the corrected residual parameter; Obtaining coding parameters for the image frame according to the analysis results respectively corresponding to each of the image coding units.

5. The method according to claim 1, characterized in that, Compressing the video based on the encoding parameters respectively corresponding to each image frame in the video includes: Determining the encoding parameters respectively corresponding to each image frame in the video; Encoding the corresponding image frame based on the encoding parameters respectively corresponding to each image frame in a non-wavefront parallel processing manner to obtain the encoding results respectively corresponding to each image frame; Compressing the video based on the encoding results respectively corresponding to each image frame.

6. The method according to claim 1, characterized in that After obtaining the video to be compressed, it further includes: Determining the image size information of each image frame in the video; When the image size information and the compression processing resources meet the parallel enabling condition, performing the step of adaptively mapping each image frame in the video based on the difference feature between the image frame and the corresponding reference frame, and determining the parallel processing condition corresponding to the image frame according to the mapping result.

7. The method according to claim 1, wherein The method further includes: Determining the picture group to which the image frame belongs in the video; Determining the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on the picture group; Performing a difference analysis on the image frame and the reference frame to obtain the difference feature between the image frame and the reference frame.

8. The method according to claim 7, characterized in that The determining the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on the picture group includes: Determining the picture group feature of the picture group; Determining the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on the picture group reference relationship in the picture group feature.

9. The method according to claim 7, characterized in that The performing a difference analysis on the image frame and the reference frame to obtain the difference feature between the image frame and the reference frame includes: Determining the matching image blocks respectively corresponding to each original image block in the image frame in the reference frame; Obtaining the motion information respectively corresponding to each original image block according to the positions of each original image block and the corresponding matching image blocks; Obtaining the motion feature between the image frame and the reference frame based on the motion information respectively corresponding to each original image block.

10. The method according to claim 9, wherein The performing a difference analysis on the image frame and the reference frame to obtain the difference feature between the image frame and the reference frame includes: Obtaining the residual information respectively corresponding to each original image block according to the pixels of each original image block and the corresponding matching image blocks; Obtaining the residual feature between the image frame and the reference frame based on the residual information respectively corresponding to each original image block and the number of the original image blocks.

11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: When the hierarchical feature of the image frame does not meet the parallel processing condition, performing a compression analysis on the image frame in a non-wavefront parallel processing manner to obtain the encoding parameters for the image frame.

12. A video compression device, characterized in that, The apparatus includes: A video acquisition module, configured to acquire a video to be compressed; A parallel condition determination module, configured to determine an adaptive mapping parameter and a result limitation range for each image frame in the video; the result limitation range is obtained based on the group characteristics of the image group to which the image frame belongs; through the adaptive mapping parameter, perform adaptive mapping on the difference features between the image frame and the corresponding reference frame to obtain a difference feature mapping result; adjust the difference feature mapping result based on the result limitation range to obtain a mapping result within the result limitation range; determine a parallel processing threshold according to the mapping result, and generate a parallel processing condition corresponding to the image frame based on the parallel processing threshold; An encoding parameter determination module, configured to perform parallel compression analysis on the image coding units in the image frame to obtain encoding parameters for the image frame when the hierarchical features of the image frame meet the parallel processing conditions; the image coding units are obtained by dividing the image frame into units; A video compression processing module, configured to compress the video based on the encoding parameters respectively corresponding to each image frame in the video.

13. The device according to claim 12, wherein The difference features include motion features and residual features; the adaptive mapping parameters include motion feature mapping parameters and residual feature mapping parameters; The parallel condition determination module is further configured to perform adaptive mapping on the motion features through the motion feature mapping parameters to obtain a motion feature mapping result; perform adaptive mapping on the residual features through the residual feature mapping parameters to obtain a residual feature mapping result; Based on the motion feature mapping result and the motion feature mapping result, obtain a difference feature mapping result.

14. The apparatus according to claim 12, wherein, The encoding parameter determination module is further configured to determine each image coding unit in the image frame when the image level of the image frame is greater than the parallel processing threshold; perform parallel compression analysis on each of the image coding units in a wavefront parallel processing manner, and obtain encoding parameters for the image frame according to the analysis results respectively corresponding to each of the image coding units.

15. The device according to claim 14, characterized in that, The image coding units in the image frame are arranged in rows; The encoding parameter determination module is further configured to perform parallel residual analysis on each of the image coding units to obtain residual parameters respectively corresponding to each of the image coding units; when the residual parameter of the first image coding unit in each of the image coding units meets the residual correction condition, correct the residual parameter of the first image coding unit; the first image coding unit is the first image coding unit in each row of the image coding units; Obtain an analysis result corresponding to the first image coding unit based on the corrected residual parameter; Obtain encoding parameters for the image frame according to the analysis results respectively corresponding to each of the image coding units.

16. The apparatus according to claim 12, wherein, The video compression processing module is further configured to determine encoding parameters corresponding to respective image frames in the video; encode the corresponding image frames based on the encoding parameters corresponding to the respective image frames in a non-wavefront parallel processing manner to obtain encoding results corresponding to the respective image frames; Compress the video based on the encoding results corresponding to the respective image frames.

17. The device according to claim 12, characterized in that, The apparatus further includes: An image size determination module, configured to determine image size information of respective image frames in the video; when the image size information and compression processing resources meet the parallel activation condition, perform, for each image frame in the video, the steps of adaptively mapping based on a difference feature between the image frame and a corresponding reference frame, and determining a parallel processing condition corresponding to the image frame according to a mapping result.

18. The device according to claim 12, characterized in that, The apparatus further includes: An image group determination module, configured to determine an image group to which the image frame belongs in the video; An image group analysis module, configured to determine a hierarchical feature of the image frame and a corresponding reference frame of the image frame based on the image group; A difference analysis module, configured to perform a difference analysis on the image frame and the reference frame to obtain a difference feature between the image frame and the reference frame.

19. The apparatus according to claim 18, wherein The image group analysis module is further configured to determine an image group feature of the image group; and determine the hierarchical feature of the image frame and the corresponding reference frame of the image frame based on an image group reference relationship in the image group feature.

20. The apparatus according to claim 18, wherein The difference analysis module is further configured to determine matching image blocks corresponding to respective original image blocks in the image frame in the reference frame; obtain motion information corresponding to the respective original image blocks according to positions of the respective original image blocks and positions of the corresponding matching image blocks; and obtain a motion feature between the image frame and the reference frame based on the motion information corresponding to the respective original image blocks.

21. The apparatus according to claim 20, wherein The difference analysis module is further configured to obtain residual information corresponding to the respective original image blocks according to pixels of the respective original image blocks and pixels of the corresponding matching image blocks; and obtain a residual feature between the image frame and the reference frame based on the residual information corresponding to the respective original image blocks and the number of the original image blocks.

22. The device according to any one of claims 12 to 21, characterized in that, The apparatus further includes: A non-wavefront parallel processing module, configured to perform a compression analysis on the image frame in a non-wavefront parallel processing manner to obtain encoding parameters for the image frame when the hierarchical feature of the image frame does not meet the parallel processing condition.

23. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.

24. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 11 are implemented.

25. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Optimization using multi-threaded parallel processing framework

    US20170310983A1