A data encoding method, device, storage medium, and computer device

By dynamically determining the encoding strategy of video data frames, the cost of intra-rate distortion and inter-frame rate distortion are used to solve the problem of slow encoding speed in the prior art and improve the efficiency of video data encoding.

CN114449284BActive Publication Date: 2025-06-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011221654.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-05
Publication Date
2025-06-20
Estimated Expiration
2040-11-05

AI Technical Summary

Technical Problem

In the prior art, unified inter-frame encoding of video data results in slow encoding speed and failure to effectively utilize the differences between image frames.

Method used

By acquiring the intra-rate distortion cost and inter-rate distortion cost of the target image frame, the inter-frame gap and image frame complexity between the image frame and adjacent image frames are determined, and the encoding strategy is dynamically determined as inter-frame encoding or intra-frame encoding.

Benefits of technology

The encoding speed of the target image frame is improved, especially when the image frame is complex and is scene conversion, intra-frame encoding is used to reduce encoding time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114449284B_ABST
    Figure CN114449284B_ABST
Patent Text Reader

Abstract

The present application discloses a data encoding method, apparatus, storage medium, and computer device. The method relates to data transmission related technologies in cloud technologies. The method includes: obtaining a target image frame, obtaining an intra-frame rate distortion cost for the target image frame, and obtaining an inter-frame rate distortion cost for the target image frame; determining an inter-frame gap degree between the target image frame and an adjacent image frame of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost; determining an image frame complexity for the target image frame according to the inter-frame rate distortion cost; determining an encoding strategy for the target image frame according to the image frame complexity and the inter-frame gap degree; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy. By adopting the present application, the encoding speed for the target image frame can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and particularly to a data encoding method, apparatus, storage medium, and computer device. Background Art

[0002] In many daily life scenarios, scenarios of compressing video data are involved. For example, when user A transmits a video data to user B, a process of compressing and then transmitting the video data is involved. Among them, there are usually two encoding methods when compressing video data, one is the intra-frame encoding method, and the other is the inter-frame encoding method.

[0003] It should be noted that generally, the inter-frame encoding method for video data is more time-consuming than the intra-frame encoding method. In the prior art, the inter-frame encoding method is usually adopted to encode each image frame of the video data, because generally, the encoding effect of using the inter-frame encoding method for an image frame is better than that of using the intra-frame encoding method for the image frame, and this encoding effect can be reflected by the rate-distortion cost of encoding.

[0004] However, the difference in the encoding effect between using the intra-frame encoding method and the inter-frame encoding method for an image frame is usually related to the image frame itself. If the differences between image frames are not considered and the inter-frame encoding method is uniformly used to encode each image frame, the encoding speed of the image frame will be slow. Summary of the Invention

[0005] This application provides a data encoding method, apparatus, storage medium, and computer device, which can improve the encoding speed for a target image frame.

[0006] On the one hand, this application provides a data encoding method, including:

[0007] Obtain a target image frame, obtain the intra-frame rate-distortion cost for the target image frame, and obtain the inter-frame rate-distortion cost for the target image frame;

[0008] Determine the inter-frame difference degree between the target image frame and the adjacent image frame of the target image frame according to the inter-frame rate-distortion cost and the intra-frame rate-distortion cost;

[0009] Determine the image frame complexity for the target image frame according to the inter-frame rate-distortion cost;

[0010] Determine an encoding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.

[0011] On the one hand, this application provides a data encoding apparatus, including:

[0012] A cost acquisition module, configured to acquire a target image frame, acquire an intra-frame rate distortion cost for the target image frame, and acquire an inter-frame rate distortion cost for the target image frame;

[0013] A difference degree determination module, configured to determine an inter-frame difference degree between the target image frame and an adjacent image frame of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost;

[0014] A complexity determination module, configured to determine an image frame complexity for the target image frame according to the inter-frame rate distortion cost;

[0015] A strategy determination module, configured to determine an encoding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.

[0016] Wherein, the inter-frame difference degree is a first inter-frame difference degree or a second inter-frame difference degree; the first inter-frame difference degree is greater than the second inter-frame difference degree; the image frame complexity is a first image frame complexity or a second image frame complexity; the first image frame complexity is greater than the second image frame complexity;

[0017] The strategy determination module includes:

[0018] A first strategy determination unit, configured to determine that the encoding strategy for the target image frame is an intra-frame encoding strategy when the image frame complexity is the first image frame complexity and the inter-frame difference degree is the first inter-frame difference degree;

[0019] A second strategy determination unit, configured to determine that the encoding strategy for the target image frame is an inter-frame encoding strategy when the image frame complexity is the second image frame complexity or the inter-frame difference degree is the second inter-frame difference degree.

[0020] Wherein, the difference degree determination module includes:

[0021] A parameter determination unit, configured to determine a frame difference measurement parameter according to the inter-frame rate distortion cost and the intra-frame rate distortion cost;

[0022] A first difference degree determination unit, configured to determine that the inter-frame difference degree is the first inter-frame difference degree when the frame difference measurement parameter is greater than a frame difference measurement threshold;

[0023] A second difference degree determination unit, configured to determine that the inter-frame difference degree is the second inter-frame difference degree when the inter-frame difference degree is less than or equal to the frame difference measurement threshold.

[0024] Wherein, the complexity determination module includes:

[0025] A first complexity determination unit, configured to determine that the image frame complexity is the first image frame complexity when the inter-frame rate distortion cost is greater than a cost measurement threshold;

[0026] A second complexity determination unit, configured to determine that the complexity of the image frame is the second image frame complexity when the inter-frame rate distortion cost is less than or equal to the cost measurement threshold.

[0027] Wherein, the above device further includes:

[0028] A first unit acquisition module, configured to acquire the coding units included in the target image frame when it is determined that the coding strategy for the target image frame is an inter-frame coding strategy;

[0029] A unit cost acquisition module, configured to acquire the unit inter-frame rate distortion cost and the unit intra-frame rate distortion cost for the coding unit;

[0030] A threshold determination module, configured to acquire a cost measurement parameter, and determine a cost measurement threshold according to the cost measurement parameter and the unit intra-frame rate distortion cost;

[0031] A first unit strategy determination module, configured to determine that the coding strategy for the coding unit is an intra-frame coding strategy when the inter-frame rate distortion cost is greater than the cost measurement threshold.

[0032] Wherein, the above device further includes:

[0033] A second unit acquisition module, configured to acquire the coding units included in the target image frame when it is determined that the coding strategy for the target image frame is an intra-frame coding strategy;

[0034] A second unit strategy determination module, configured to determine that the coding strategy for the coding unit is an intra-frame coding strategy.

[0035] Wherein, the cost acquisition module includes:

[0036] An intra-frame parameter acquisition unit, configured to acquire the intra-frame prediction distortion degree for the target image frame, and acquire the intra-frame prediction code rate for the target image frame;

[0037] An intra-frame cost determination unit, configured to determine the intra-frame rate distortion cost for the target image frame according to the intra-frame prediction distortion degree and the intra-frame prediction code rate.

[0038] Wherein, the cost acquisition module includes:

[0039] An inter-frame parameter acquisition unit, configured to acquire the inter-frame prediction distortion degree for the target image frame, and acquire the inter-frame prediction code rate for the target image frame;

[0040] An inter-frame cost determination unit, configured to determine the inter-frame rate distortion cost for the target image frame according to the inter-frame prediction distortion degree and the inter-frame prediction code rate.

[0041] Wherein, the cost acquisition module includes:

[0042] A video acquisition unit for acquiring video data;

[0043] A frame division unit for dividing the video data into frames to obtain at least two image frames included in the video data;

[0044] An image frame determination unit for determining a target image frame from at least two image frames.

[0045] Wherein, the above device further includes:

[0046] An encoding module for encoding the video data based on the determined encoding strategy for the target image frame to obtain encoded data of the video data;

[0047] A decoding module for synchronizing the encoded data to a video client so that the video client decodes the encoded data to obtain decoded data of the video data and plays the decoded data.

[0048] On the one hand, the present application provides a computer device, including a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor executes the method in one aspect of the present application.

[0049] On the one hand, the present application provides a computer-readable storage medium storing a computer program, the computer program including program instructions, and when the program instructions are executed by a processor, the processor executes the method in the above one aspect.

[0050] According to one aspect of the present application, there is provided a computer program product or a computer program, the computer program product or the computer program including computer instructions 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 methods provided in the above various optional manners such as the above one aspect.

[0051] This application can obtain a target image frame, obtain the intra-frame rate-distortion cost for the target image frame, and obtain the inter-frame rate-distortion cost for the target image frame; determine the inter-frame difference degree between the target image frame and the adjacent image frame of the target image frame according to the inter-frame rate-distortion cost and the intra-frame rate-distortion cost; determine the image frame complexity for the target image frame according to the inter-frame rate-distortion cost; determine the coding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; the coding strategy is an inter-frame coding strategy or an intra-frame coding strategy. It can be seen that the method proposed in this application can obtain the inter-frame difference degree between the target image frame and the adjacent image frame, as well as the image frame complexity of the target image frame according to the inter-frame rate-distortion cost and the intra-frame rate-distortion cost of the target image frame. This inter-frame difference degree and image frame complexity can be used to determine whether the target image frame is an image frame of a scene transition, so as to determine the coding strategy for the target image frame. Since the time-consuming of performing an inter-frame coding strategy on the target image frame is more than that of performing an intra-frame coding strategy, therefore, by judging whether to perform an inter-frame coding strategy or an intra-frame coding strategy on the target image frame in such an adaptive manner, the coding speed for the target image frame can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in this application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0053] Figure 1 is a schematic structural diagram of a network architecture provided by an embodiment of this application;

[0054] Figure 2 is a schematic diagram of a data coding scenario provided by this application;

[0055] Figure 3 is a schematic flowchart of a data coding method provided by this application;

[0056] Figure 4 is a schematic diagram of a scenario for obtaining an image frame provided by this application;

[0057] Figure 5 is a schematic diagram of a scenario for coding prediction provided by this application;

[0058] Figure 6 is a schematic diagram of a scenario for comparing coding time provided by this application;

[0059] Figure 7 is a schematic diagram of a scenario for obtaining the coding strategy of a coding unit provided by this application;

[0060] Figure 8 is a schematic flowchart of a data encoding and transmission method provided by this application;

[0061] Figure 9 is a schematic structural diagram of a data encoding device provided by this application;

[0062] Figure 10 is a schematic structural diagram of a computer device provided by this application. Detailed implementation manners

[0063] Next, the technical solutions in this application will be clearly and completely described in conjunction with the accompanying drawings in this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of this application.

[0064] This application relates to cloud technology. Among them, cloud technology is a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data calculation, storage, processing, and sharing.

[0065] Cloud technology is the general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model, which can form a resource pool, be used on demand, and be flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the highly developed application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the background system for logical processing. Data at different levels will be processed separately, and various industry data requires a powerful system support, which can only be achieved through cloud computing.

[0066] The cloud technology mainly involved in this application refers to the technology for transmitting video data, specifically referring to the technology that can use a cloud server to encode and compress video data before transmission. Please refer to the following description.

[0067] Please refer to Figure 1 , Figure 1 is a schematic structural diagram of a network architecture provided by an embodiment of this application. As Figure 1 shown, the network architecture may include a server 200 and a cluster of terminal devices. The cluster of terminal devices may include one or more terminal devices, and the number of terminal devices will not be limited here. As Figure 1As shown, the multiple terminal devices may specifically include terminal device 100a, terminal device 101a, terminal device 102a, …, terminal device 103a; as Figure 1 shown, terminal device 100a, terminal device 101a, terminal device 102a, …, terminal device 103a can all be network-connected to server 200, so that each terminal device can perform data interaction with server 200 through the network connection.

[0068] As Figure 1 shown, server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal device can be: a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart TV, etc. Hereinafter, taking the communication between terminal device 100a and server 200 as an example, the specific description of the embodiments of the present application will be carried out.

[0069] Please also refer to Figure 2 , Figure 2 which is a schematic diagram of a data encoding scenario provided by the present application. Image frame 101b and image frame 102b can be the image frames obtained after the video data 100b is framed. That is, the video data 100b includes image frame 101b and image frame 102b. Image frame 101b can be an adjacent image frame of 102b, and image frame 101b can be the previous image frame of image frame 102b.

[0070] The video data 100b can be any video data, and the video data 100b can be obtained by terminal device 100a. For example, the video data 100b can be the conference video data recorded by terminal device 100a during the implementation of a real-time online meeting. After obtaining the video data 100b, terminal device 100a can send the video data 100b to server 200 to request server 200 to encode the video data 100b. Therefore, after obtaining the video data 108b, server 100b can frame the video data 100b to obtain image frame 101b and image frame 102b.

[0071] Since the principle of the server 200 encoding each image frame included in the video data 100b is the same, here, the process of how the server 200 encodes the image frame 102b is taken as an example for illustration. Therefore, the image frame 102b can be used as the target image frame, and the image frame 101b is the adjacent image frame of the target image frame. The target image frame can be any image frame in the video data 100b. The following specifically describes the process of the server 200 encoding the target image frame 102b. Please refer to the following description.

[0072] As Figure 2 shown, during the process of encoding the video data 100b, the server 200 will perform pre-analysis on the video data. By performing pre-analysis on the video data 100b, the server 200 can obtain the rate-distortion cost of intra-frame encoding for the image frame 102b. The rate-distortion cost of intra-frame encoding for the image frame 102b can be referred to as the intra-frame rate-distortion cost 106b. By performing pre-analysis on the video data 100b, the server 200 can also obtain the rate-distortion cost of inter-frame encoding for the image frame 102b. The rate-distortion cost of inter-frame encoding for the image frame 102b can be referred to as the inter-frame rate-distortion cost 107b.

[0073] Among them, the rate-distortion cost can comprehensively measure the quality of encoding data. The rate-distortion cost is obtained by measuring the distortion degree and bit rate of encoding data. In an actual encoding scenario, it is desired that the distortion degree is smaller and the bit rate is smaller, which can make the rate-distortion cost smaller. However, the distortion degree and the bit rate usually cannot be both obtained. Generally, they have an inverse correlation. Among them, the description of intra-frame encoding or inter-frame encoding for the target image frame 102b can be referred to the description in the following Figure 3 corresponding embodiments.

[0074] The server 200 can obtain the inter-frame difference degree 103b between the target image frame 102b and its adjacent image frame 101b through the intra-frame rate-distortion cost 106b and the inter-frame rate-distortion cost 107b. The server 200 can also obtain the image frame complexity 105b of the target image frame 102b through the inter-frame rate-distortion cost 107b. Among them, the specific process of obtaining the inter-frame difference degree 103b and the image frame complexity 105b of the target image frame 102b through the intra-frame rate-distortion cost 106b and the inter-frame rate-distortion cost 107b can also be referred to the description in the following Figure 3 corresponding embodiments.

[0075] The server 200 can obtain the encoding strategy 108b for the target image frame 102b based on the inter-frame difference degree 103b and the image frame complexity 105b of the target image frame 102b. Among them, when the server obtains the encoding strategy 108b for the target image frame 102b, it is to determine the encoding method for the target image frame 102b. As Figure 2 shown, the encoding strategy 108b can be an intra-frame encoding strategy 110b or an inter-frame encoding strategy 111b.

[0076] Among them, when the server 200 detects that the inter-frame difference degree 103b of the target image frame 102b is large enough, and the image frame complexity of the target image frame 102b is also large enough, it can be considered that the target image frame 102b is an image frame belonging to scene transition. For the target image frame 102b of scene transition, the encoding strategy 108b determined by the server 200 for the target image frame 102b can be an intra-frame encoding strategy 110b, that is, intra-frame encoding needs to be performed on the target image frame 102b.

[0077] When the server 200 detects that the inter-frame difference degree 103b of the target image frame 102b is not large enough, or the image frame complexity of the target image frame 102b is not large enough, it can be considered that the target image frame 102b is not an image frame belonging to scene transition. For the target image frame 102b that is not a scene transition, the encoding strategy 108b determined by the server 200 for the target image frame 102b can be an inter-frame encoding strategy 111b, that is, inter-frame encoding needs to be performed on the target image frame 102b.

[0078] The specific process of how to determine the encoding strategy for the target image frame 102b can also be referred to the description in the following Figure 3 corresponding embodiments.

[0079] It should be noted that the principle of performing inter-frame encoding on the target image frame 102b is mainly achieved through the relative motion between the target image frame 102b and the adjacent image frame 101b. When the inter-frame difference degree 103b between the target image frame 102b and the adjacent image frame 101b is larger, it indicates that more image blocks in the target image frame 102b are likely not obtained based on the motion of the corresponding image blocks in the adjacent image frame 101b (and it also more represents that the target image frame 102b is an image frame of scene transition), but newly emerging image blocks. Therefore, even if the inter-frame encoding method is adopted for the target image frame 102b, more image blocks in the target image frame 102b still adopt the intra-frame encoding method. And when the inter-frame difference degree of the target image frame 102b is larger and more complex (that is, when the image frame complexity 105b is larger), the time-consuming of adopting the intra-frame encoding method for the target image frame 102b is much shorter than that of adopting the inter-frame encoding method for the image frame 102b.

[0080] Through the method provided in this application, for a relatively complex image frame and an image frame belonging to scene conversion, the intra-frame coding method can be adopted for this image frame, which can improve the coding speed for this image frame.

[0081] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of a data coding method provided in this application. As Figure 3 shown, the method may include:

[0082] Step S101, obtain a target image frame, obtain the intra-frame rate-distortion cost for the target image frame, and obtain the inter-frame rate-distortion cost for the target image frame;

[0083] Specifically, the execution entity in the embodiments of this application may be any computer device, or may be a device cluster composed of multiple computer devices. The computer device may be a server or a terminal device, and this is not limited. Here, the server is taken as an example of the execution entity in this application for illustration. Please refer to the following description.

[0084] The server can obtain video data, which can be any video data and can be sent by a terminal device to the server. By sending video data to the server, the terminal device may request the server to encode the video data. For example, the video data may be video data captured in real time by a camera, such as online meeting video data; the video data may also be video data for screen sharing, etc.

[0085] When encoding the video data, the server can frame the video data, and thus obtain multiple (at least two) image frames included in the video data. Therefore, the target image frame may be any one of the multiple image frames obtained by framing the video data. When the server encodes the video data, it is necessary to encode each image frame of the video data. Here, the process of the server encoding the target image frame in the video data is taken as an example for illustration. It can be understood that the principle of the server encoding each image frame in the video data is the same. Please refer to the following description.

[0086] During the process of encoding video data, the server first performs pre-analysis on the video data. By performing pre-analysis on the video data, the server can predict the rate-distortion cost (here referring to the minimum rate-distortion cost of intra-frame encoding) for each image frame in the video data when performing intra-frame encoding, as well as the rate-distortion cost (here referring to the minimum rate-distortion cost of inter-frame encoding) for each image frame when performing inter-frame encoding. The rate-distortion cost for intra-frame encoding of each image frame can be referred to as the intra-frame rate-distortion cost of each image frame. The rate-distortion cost for inter-frame encoding of each image frame can be referred to as the inter-frame rate-distortion cost of each image frame.

[0087] Therefore, by performing pre-analysis on the video data, the server can also obtain the intra-frame rate-distortion cost and inter-frame rate-distortion cost for the target image frame. Among them, the specific process for the server to obtain the intra-frame rate-distortion cost and inter-frame rate-distortion cost for the target image frame can be as follows:

[0088] Since the rate-distortion cost is obtained by simultaneously measuring the distortion degree and bit rate when encoding data, the smaller the distortion degree, it indicates that when encoding the data, the distortion degree of the data is smaller, and the smaller the bit rate, it indicates that after encoding the data, the data volume of the data is smaller (that is, the number of bits of the data is smaller, which means the data is compressed smaller). Therefore, in the scenario of encoding data, it is desired that the distortion degree of the data after encoding is smaller and the bit rate is smaller.

[0089] However, when encoding data, the distortion degree and bit rate often have a negative correlation. When the distortion degree of the data is smaller, the bit rate of the data often becomes larger. On the contrary, when the distortion degree of the data is larger, the bit rate of the data can usually be smaller. Therefore, the rate-distortion cost is obtained by comprehensively measuring the distortion degree and bit rate of the data when encoding. In other words, through the rate-distortion cost, the impacts brought by the distortion degree and bit rate of the data when encoding can be considered in a balanced manner.

[0090] Therefore, it can be understood that when encoding data, it is desired that the rate-distortion cost of the data during encoding is smaller, which indicates that the encoding effect of the data is better.

[0091] Specifically, during the pre-analysis of video data, the server can obtain the inter-frame prediction distortion degree of the target image frame. The inter-frame prediction distortion degree refers to the distortion degree of the target image frame when performing inter-frame coding on the target image frame. During the pre-analysis of video data, the server can also obtain the inter-frame prediction bit rate of the target image frame. The inter-frame prediction bit rate refers to the bit rate of the target image frame when predicting inter-frame coding of the target image frame. Through the inter-frame prediction distortion degree and inter-frame prediction bit rate of the target image frame, the server can obtain the inter-frame rate-distortion cost of the target image frame.

[0092] Similarly, during the pre-analysis of video data, the server can also obtain the intra-frame prediction distortion degree of the target image frame. The intra-frame prediction distortion degree refers to the distortion degree of the target image frame when performing intra-frame coding on the target image frame. During the pre-analysis of video data, the server can also obtain the intra-frame prediction bit rate of the target image frame. The intra-frame prediction bit rate refers to the bit rate of the target image frame when predicting intra-frame coding of the target image frame. Through the intra-frame prediction distortion degree and intra-frame prediction bit rate of the target image frame, the server can obtain the intra-frame rate-distortion cost of the target image frame.

[0093] Among them, since when pre-analyzing video data, the rate-distortion cost of predicting inter-frame coding of the target image frame includes the intra-frame coding scheme of the target image frame. Therefore, when obtaining the intra-frame rate-distortion cost and inter-frame rate-distortion cost of the target image frame, the intra-frame coding of the target image frame can only include the i-frame coding scheme of the target image frame; the inter-frame coding of the target image frame can include the i-frame coding, p-frame coding, and b-frame coding schemes of the target image frame.

[0094] The intra-frame rate-distortion cost when the above server performs intra-frame coding on the target image frame is the minimum rate-distortion cost when performing intra-frame coding (i-frame coding) on the target image frame. Similarly, the inter-frame rate-distortion cost when the above server performs inter-frame coding on the target image frame is the minimum rate-distortion cost when performing inter-frame coding (i-frame coding, p-frame coding, and b-frame coding) on the target image frame. In other cases except for obtaining the inter-frame rate-distortion cost and intra-frame rate-distortion cost of the target image frame, the intra-frame coding of the target image frame can refer to performing i-frame coding on the target image frame, and the inter-frame coding of the target image frame can refer to performing b-frame coding or p-frame coding on the target image frame.

[0095] Since the inter-frame coding scheme includes the intra-frame coding scheme when obtaining the intra-frame rate-distortion cost and the inter-frame rate-distortion cost of the target image frame, the inter-frame rate-distortion cost of the target image frame will necessarily be less than or equal to the intra-frame rate-distortion cost of the target image frame, and the inter-frame rate-distortion cost of the target image frame may be the same as the intra-frame rate-distortion cost of the target image frame.

[0096] For example, when the rate-distortion cost is the smallest during the I-frame coding of the target image frame, the inter-frame rate-distortion cost of the target image frame is the same as the intra-frame rate-distortion cost. When the rate-distortion cost is the smallest during the B-frame coding or P-frame coding of the target image frame, the inter-frame rate-distortion cost of the target image frame is less than the intra-frame rate-distortion cost.

[0097] Among them, performing I-frame coding on the target image frame means that when coding the target image frame, all the complete picture information of the target image frame is retained, and the coding of the target image frame can be achieved only by the target image frame. Therefore, when decoding, only the coding data of the target image frame is required to achieve the decoding of the target image frame.

[0098] Performing P-frame coding on the target image frame means that it needs to be coded through the relative motion between the target image frame and the adjacent image frame, that is, it needs to be coded through the difference between the target image frame and the adjacent image frame. The adjacent image frame can refer to the previous image frame of the target image frame.

[0099] Therefore, when decoding the coding data of the target image frame after performing P-frame coding on the target image frame, not only the coding data of the target image frame is required to achieve decoding, but also the coding data of the target image frame needs to be superimposed on the basis of the adjacent image frame of the target image frame to achieve the decoding of the target image frame. In other words, the coding data obtained by performing P-frame coding on the target image frame does not have the complete picture information of the target image frame, but only the difference data between the target image frame and the adjacent image frame.

[0100] The above-mentioned P-frame coding of the target image frame is unidirectional coding, and only the previous image frame (the previously decoded image frame) of the target image frame is required to achieve the coding of the target image frame. Performing B-frame coding on the target image frame is bidirectional coding, that is, performing B-frame coding on the target image frame requires not only the previous image frame of the target image frame, but also the subsequent image frame (the subsequently decoded image frame) of the target image frame. The target image frame is coded through the difference between the target image frame and the previous image frame, and the difference between the target image frame and the subsequent image frame.

[0101] Step S102, determine the inter-frame gap degree between the target image frame and the adjacent image frame of the target image frame according to the inter-frame rate-distortion cost and the intra-frame rate-distortion cost;

[0102] Specifically, the server can obtain the ratio between the inter-frame rate distortion cost and the intra-frame rate distortion cost of the target image frame, that is, the ratio of the inter-frame rate distortion cost to the intra-frame rate distortion cost. This ratio can be referred to as the frame gap measurement parameter. When the frame gap measurement parameter is greater than the frame gap measurement threshold, it can be considered that the frame gap degree between the target image frame and its adjacent image frame is the first inter-frame gap degree, and this first inter-frame gap degree indicates a large gap between the target image frame and the adjacent image frame. Among them, the adjacent image frame can be any image frame in front of the target image frame, for example, it can be the previous image frame of the target image frame.

[0103] Please refer to Figure 4 , Figure 4 which is a schematic diagram of a scenario for obtaining an image frame provided by this application. As Figure 4 shown, the server can frame the video data 100c to obtain multiple image frames included in the video data 100c. These multiple image frames are the multiple image frames in the area 101c. Specifically, these multiple image frames can include image frame 102c, image frame 103c, image frame 104c, and image frame 105c.

[0104] The server can use any image frame included in the video data 100c as the target image frame. For example, here, the server can use the image frame 104c of the video data 100c as the target image frame, and use the previous image frame 103c of the target image frame 104c as the adjacent image frame of the target image frame.

[0105] Since the inter-frame rate distortion cost of the target image frame is necessarily less than or equal to the intra-frame rate distortion cost, the value range of the frame gap measurement parameter is from 0 to 1. Therefore, the frame gap measurement threshold can be set according to the actual situation, and the value range of the frame gap measurement threshold is also from 0 to 1. For example, the frame gap measurement threshold can be equal to 0.7.

[0106] Among them, when the frame gap measurement parameter is greater than the frame gap measurement threshold, the rate distortion cost of performing intra-frame coding or inter-frame coding on the target image frame is almost the same. And when the inter-frame gap degree between the target image frame and the adjacent image frame is larger, it indicates that more image blocks in the target image frame do not move based on the image blocks in the adjacent image frame, that is, it indicates that more image blocks in the target image frame are newly emerged image blocks.

[0107] At this time, even if the target image frame is encoded by means of inter-frame encoding (herein referring to P-frame encoding or B-frame encoding), more image blocks in the target image frame (such as newly emerged image blocks) are encoded by means of intra-frame encoding (herein referring to I-frame encoding), because the new image blocks do not move based on the image blocks in adjacent image frames. Therefore, it is necessary to retain the complete picture information of the newly emerged image blocks. Therefore, in this case, the difference in rate-distortion cost between encoding the target image frame by means of inter-frame encoding (herein referring to P-frame encoding or B-frame encoding) and encoding the target image frame by means of intra-frame encoding (herein referring to I-frame encoding) is not significant.

[0108] Moreover, the greater the inter-frame difference degree between the target image frame and adjacent image frames, the more it indicates that the target image frame is an image frame of scene transition. Because, for an image frame of scene transition, the image blocks it contains are basically not moved from the image blocks in the previous image frames.

[0109] Therefore, when the ratio between the inter-frame rate-distortion cost and intra-frame rate-distortion cost of the above-mentioned target image frame (i.e., the frame difference measurement parameter) is greater than the frame difference measurement threshold, it indicates that the intra-frame rate-distortion cost of the target image frame is closer to the inter-frame rate-distortion cost of the target image frame. Therefore, the above-mentioned frame difference measurement parameter can be used to measure the difference (i.e., the disparity) between the target image frame and adjacent image frames.

[0110] Furthermore, when the above-mentioned frame difference measurement parameter is less than or equal to the above-mentioned frame difference measurement threshold, it can be considered that the inter-frame difference degree between the target image frame and its adjacent image frame is the second inter-frame difference degree, and this second inter-frame difference degree indicates that the difference between the target image frame and adjacent image frames is small.

[0111] Therefore, the above-mentioned first inter-frame difference degree is greater than the above-mentioned second inter-frame difference degree.

[0112] Through the above process, the server can obtain the inter-frame difference degree between the target image frame and its adjacent image frames, and this inter-frame difference degree can be the first inter-frame difference degree or the second inter-frame difference degree.

[0113] Please refer to Figure 5 , Figure 5 which is a schematic diagram of a scene of coding prediction provided by this application. As Figure 5 shown, the target image frame 100d is an image frame of scene transition, and the image blocks included in the target image frame 100d can be predicted, that is, to predict whether each image block is an intra-frame prediction block or an inter-frame prediction block. If an image block is an intra-frame prediction block, it indicates that the image block needs to be encoded by means of intra-frame encoding (I-frame encoding). If an image block is an inter-frame prediction block, it indicates that the image block needs to be encoded by means of inter-frame encoding (P-frame encoding or B-frame encoding).

[0114] As shown Figure 5 in FIG. 100d, the target image frame 100d may include image blocks 101d, 102d, 103d, 104d, 105d, 106d, 107d, and 108d. Since the target image frame belongs to the image frame of scene transition, therefore, a small portion of the image blocks 101d, 102d, 103d, 104d, 105d, 106d, 107d, and 108d in the target image frame 100d belong to the inter-frame prediction blocks, while most of the image blocks in the target image frame 100d other than the image blocks 101d, 102d, 103d, 104d, 105d, 106d, 107d, and 108d belong to the intra-frame prediction blocks.

[0115] Step S103, determine the image frame complexity for the target image frame according to the inter-frame rate distortion cost;

[0116] Specifically, since when the image frame is more complex, usually its inter-frame rate distortion cost will be greater when encoding the image frame. Therefore, when the inter-frame rate distortion cost of the target image frame is smaller, it can indicate that the target image frame is less complex, and vice versa, when the inter-frame rate distortion cost of the target image frame is greater, it can indicate that the target image frame is more complex.

[0117] Therefore, when the inter-frame rate distortion cost of the target image frame is greater than the cost measurement threshold, it can be considered that the image frame complexity of the target image frame is the first image frame complexity, and this first image frame complexity indicates that the target image frame is relatively complex.

[0118] On the contrary, when the inter-frame rate distortion cost of the target image frame is less than or equal to the cost measurement threshold, it can be considered that the image frame complexity of the target image frame is the second image frame complexity, and this second image frame indicates that the target image frame is not very complex.

[0119] Therefore, the above-mentioned first image frame complexity is greater than the second image frame complexity.

[0120] Through this process, the server can obtain the image frame complexity of the target image frame, and this image frame complexity can be the first image frame complexity or the second image frame complexity.

[0121] Step S104, determine the encoding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy;

[0122] Specifically, the encoding strategy for the target image frame is the intra-frame encoding strategy, indicating that the target image frame can be encoded in the form of I-frame encoding. The encoding strategy for the target image frame is the inter-frame encoding strategy, indicating that the target image frame can be encoded in the form of P-frame encoding or B-frame encoding.

[0123] When the inter-frame difference degree obtained by the server is the first inter-frame difference degree and the image frame complexity of the target image frame is the first image frame complexity, it indicates that at this time, the rate-distortion cost of encoding the target image frame using the inter-frame encoding method (P-frame encoding or B-frame encoding) or the intra-frame encoding method (I-frame encoding) is about the same, and the target image frame is also relatively complex. In this case, the target image frame can be considered as an image frame of scene transition. Therefore, the encoding strategy for the target image frame at this time can be the intra-frame encoding strategy.

[0124] Because generally, when encoding an image frame using the inter-frame encoding method (P-frame encoding or B-frame encoding), the encoding time of the image frame is longer than that when encoding the image frame using the intra-frame encoding method (I-frame encoding). Therefore, when the target image frame is relatively complex and is an image frame of scene transition, at this time, the rate-distortion cost of encoding the target image frame using the inter-frame encoding method (P-frame encoding or B-frame encoding) is about the same as that of encoding the target image frame using the intra-frame encoding method (I-frame encoding), but the encoding time of the target image frame when encoding the target image frame using the inter-frame encoding method (P-frame encoding or B-frame encoding) is longer than that of encoding the target image frame using the intra-frame encoding method (I-frame encoding). Therefore, the encoding strategy for the target image frame at this time can be the intra-frame encoding strategy.

[0125] On the contrary, when the inter-frame difference degree obtained by the server is the second inter-frame difference degree, or the image frame complexity of the target image frame is the second image frame complexity, it indicates that the difference between the target image frame and the adjacent image frame is relatively small, or the target image frame is not so complex. At this time, it can be considered that the encoding strategy for the target image frame can be the inter-frame encoding strategy.

[0126] Because when the inter-frame difference degree between the target image frame and the adjacent image frame is relatively small (i.e., the inter-frame difference degree is the second inter-frame difference degree), the rate-distortion cost of encoding the target image frame using the inter-frame encoding method (P-frame encoding or B-frame encoding) is significantly less than the rate-distortion cost of encoding the target image frame using the intra-frame encoding method (I-frame encoding). Therefore, at this time, the inter-frame encoding method is still used to encode the target image frame.

[0127] Moreover, when the target image frame is not so complex (i.e., the image frame complexity is the second image frame complexity), the time consumption for encoding the target image frame using intra-frame encoding (I-frame encoding) is similar to that using inter-frame encoding (P-frame encoding or B-frame encoding). Therefore, at this time, inter-frame encoding is still used to encode the target image frame.

[0128] Among them, when the server encodes the target image frame, the target image frame can also be decomposed into multiple coding units for separate encoding, and a coding unit can be an image block in the target image frame.

[0129] When the encoding strategy for the target image frame obtained by the server is an intra-frame encoding strategy, the server can obtain multiple coding units included in the target image frame, and the server can also determine the encoding strategy for each coding unit included in the target image frame as an intra-frame encoding strategy. That is, at this time, when encoding the target image frame, each coding unit included in the target image frame can be encoded using intra-frame encoding (I-frame encoding).

[0130] Through the method provided in this application, the encoding strategy for the target image frame can be determined based on the inter-frame rate-distortion cost and intra-frame rate-distortion cost obtained during the pre-analysis process. When it is determined that the target image frame is relatively complex and is an image frame with scene transition, intra-frame encoding is used to encode the target image frame, which can greatly reduce the encoding time consumption of the target image frame and improve the encoding speed for the target image frame.

[0131] Moreover, since users are more sensitive to image frames with scene transition when watching video data, therefore, by improving the encoding speed for image frames with scene transition, the display effect of video data can also be improved, that is, image frames with scene transition can be displayed more quickly and smoothly, thereby improving the user's perception of the video data.

[0132] Please refer to Figure 6 , Figure 6 which is a schematic diagram of a scenario for comparing encoding time consumption provided in this application. As Figure 6 shown, Figure 6 the abscissa of the coordinates in represents the image frame index number, and the ordinate represents the encoding time (i.e., encoding time consumption), and the unit of encoding time consumption is ms (milliseconds). Point 101e and point 102e are the encoding times for encoding the same image frame. Point 101e represents the encoding time for inter-frame encoding of the image frame, and point 102e represents the time consumption for intra-frame encoding of the image frame. It can be seen that the encoding time represented by point 101e is greater than the encoding time represented by point 102e.

[0133] Similarly, the points 103e and 104e are the encoding times for encoding the same image frame. The point 103e represents the encoding time for inter-frame encoding of the image frame, and the point 104e represents the time taken for intra-frame encoding of the image frame. It can be seen that the encoding time represented by the point 103e is greater than the encoding time represented by the point 104e. The points 105e and 106e are the encoding times for encoding the same image frame. The point 105e represents the encoding time for inter-frame encoding of the image frame, and the point 106e represents the time taken for intra-frame encoding of the image frame. It can be seen that the encoding time represented by the point 105e is greater than the encoding time represented by the point 106e. The points 107e and 108e are the encoding times for encoding the same image frame. The point 107e represents the encoding time for inter-frame encoding of the image frame, and the point 108e represents the time taken for intra-frame encoding of the image frame. It can be seen that the encoding time represented by the point 107e is greater than the encoding time represented by the point 108e.

[0134] Furthermore, the points 109e and 110e are the encoding times for encoding the same image frame. The point 109e represents the encoding time for inter-frame encoding of the image frame, and the point 110e represents the time taken for intra-frame encoding of the image frame. It can be seen that the encoding time represented by the point 109e is greater than the encoding time represented by the point 110e. The points 111e and 112e are the encoding times for encoding the same image frame. The point 111e represents the encoding time for inter-frame encoding of the image frame, and the point 112e represents the time taken for intra-frame encoding of the image frame. It can be seen that the encoding time represented by the point 111e is greater than the encoding time represented by the point 112e. The points 113e and 114e are the encoding times for encoding the same image frame. The point 113e represents the encoding time for inter-frame encoding of the image frame, and the point 114e represents the time taken for intra-frame encoding of the image frame. It can be seen that the encoding time represented by the point 113e is greater than the encoding time represented by the point 114e.

[0135] From the above, it can be seen that the encoding time for encoding an image frame using the inter-frame encoding method is generally greater than the encoding time for encoding an image frame using the intra-frame encoding method.

[0136] When the encoding strategy for the target image frame obtained by the server is an inter-frame encoding strategy, the server can also obtain multiple coding units included in the target image frame. The server can further determine the encoding strategy for each coding unit in the target image frame. This encoding strategy can also include an inter-frame encoding strategy and an intra-frame encoding strategy. If the encoding strategy for a certain coding unit is an inter-frame encoding strategy, it indicates that the coding unit can be encoded in an inter-frame encoding (P-frame encoding or B-frame encoding) manner. If the encoding strategy for a certain coding unit is an intra-frame encoding strategy, it indicates that the coding unit can be encoded in an intra-frame encoding (I-frame encoding) manner. However, at this time, for the target image frame, it still belongs to inter-frame encoding.

[0137] Thus, it can be achieved that when the target image frame belongs to a frame of scene transition, but the entire target image frame does not undergo a scene transition, only some of the image frames undergo a scene transition, the coding units at the scene transition in the target image frame can also be encoded in an intra-frame encoding manner more meticulously, while the coding units that do not undergo a scene transition are still encoded in an inter-frame encoding manner.

[0138] For example, if a small pop-up window appears in the target image frame, it can be considered that only the coding units at the position of the small pop-up window in the target image frame undergo a scene transition, while the other coding units do not.

[0139] Among them, the server can also obtain the unit inter-frame rate distortion cost and the unit intra-frame rate distortion cost of each coding unit of the target image frame. The unit inter-frame rate distortion cost represents the rate distortion cost when the coding unit is encoded in an inter-frame encoding (P-frame encoding or B-frame encoding) manner, and the unit intra-frame rate distortion cost represents the rate distortion cost when the coding unit is encoded in an intra-frame encoding (I-frame encoding) manner. The unit inter-frame rate distortion cost and the unit intra-frame rate distortion cost can also be obtained by the server during the pre-analysis of the video data.

[0140] When the unit intra-frame rate distortion cost of a certain coding unit in the target image frame is much smaller than its unit inter-frame rate distortion cost, it is considered that the coding unit is a coding unit that has undergone a scene transition, and the intra-frame encoding strategy can be used as the encoding strategy for this coding unit. On the contrary, when the unit intra-frame rate distortion cost of a certain coding unit in the target image frame is not much smaller than its unit inter-frame rate distortion cost, it is considered that the coding unit is not a coding unit that has undergone a scene transition, and the inter-frame encoding strategy can be used as the encoding strategy for this coding unit.

[0141] Among them, the server can set a cost measurement parameter. The server can use the product of the cost measurement parameter and the intra-frame rate distortion cost of the coding unit as the cost measurement threshold. One coding unit corresponds to one cost measurement threshold. When the inter-frame rate distortion cost of a certain coding unit is greater than its corresponding cost measurement threshold, it can be considered that the intra-frame rate distortion cost of this coding unit is much smaller than its inter-frame rate distortion cost. On the contrary, when the inter-frame rate distortion cost of a certain coding unit is less than its corresponding cost measurement threshold, it can be considered that the intra-frame rate distortion cost of this coding unit is not much smaller than its inter-frame rate distortion cost.

[0142] The above cost measurement parameter can be set according to the actual application scenario. For example, the cost measurement parameter can be set to a relatively large value. When the inter-frame rate distortion cost of the coding unit is greater than the cost measurement threshold, the ratio between the inter-frame rate distortion cost and the intra-frame rate distortion cost of the coding unit is greater than the cost measurement parameter. In other words, when the ratio of the inter-frame rate distortion cost of the coding unit to its intra-frame rate distortion cost is greater than the cost measurement parameter, it can be considered that the intra-frame rate distortion cost of the coding unit is much smaller than its inter-frame rate distortion cost, that is, the inter-frame rate distortion cost of the coding unit is much greater than its intra-frame rate distortion cost.

[0143] By further determining the coding strategy of each coding unit of the target image frame and performing intra-frame coding on the coding units where scene transitions occur, the coding speed for the target image frame can be further improved.

[0144] Please refer to Figure 7 , Figure 7 which is a schematic diagram of the scenario for obtaining the coding strategy of the coding unit provided by this application. As Figure 7 shown, as shown in area 100f, the target image frame may include 12 coding units, and the 12 coding units may specifically include coding unit 1, coding unit 2, coding unit 3, coding unit 4, coding unit 5, coding unit 6, coding unit 7, coding unit 8, coding unit 9, coding unit 10, coding unit 11, and coding unit 12.

[0145] As shown in area 101f, among the above 12 coding units, coding unit 1 and coding unit 8 belong to the coding units with scene transitions, and the coding units other than coding unit 1 and coding unit 8 among the 12 coding units do not belong to the coding units with scene transitions.

[0146] As shown in region 102f, the coding strategies for coding units 1 and 8 that belong to scene transitions among the above 12 coding units can be intra-coding strategies. The coding strategies for coding units 2, 3, 4, 5, 6, 7, 9, 10, 11, and 12 that do not belong to scene transitions among the above 12 coding units can be inter-coding strategies.

[0147] Moreover, the server can encode the video data to which the target image frame belongs by using the obtained coding strategy for the target image frame and the coding strategies for each coding unit in the target image frame, and obtain the encoded data of the video data. The server can send the encoded data to the video client, so that the video client can decode the encoded data to obtain the decoded data of the video data, and then the video client can play the decoded data to achieve the playback of the video data.

[0148] For example, the video data to which the target image frame belongs can be sent by the video client of user 1 to the server. The video client of user 1 sends the video data to the server to request that the video data be sent to the video client of user 2. Therefore, after the server encodes the video data to obtain the encoded data of the video data, it can send the encoded data to the video client of user 2, so that the video client of user 2 can decode the encoded data to obtain the decoded data and play the decoded data.

[0149] This application can obtain a target image frame, obtain the intra-frame rate distortion cost for the target image frame, and obtain the inter-frame rate distortion cost for the target image frame; determine the inter-frame gap degree between the target image frame and the adjacent image frame of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost; determine the image frame complexity for the target image frame according to the inter-frame rate distortion cost; determine the coding strategy for the target image frame according to the image frame complexity and the inter-frame gap degree; the coding strategy is an inter-coding strategy or an intra-coding strategy. It can be seen that the method proposed in this application can obtain the inter-frame gap degree between the target image frame and the adjacent image frame, as well as the image frame complexity of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost of the target image frame. The inter-frame gap degree and the image frame complexity can be used to determine whether the target image frame is an image frame of a scene transition, so as to determine the coding strategy for the target image frame. Since the time consumption of performing an inter-coding strategy on the target image frame is more than that of performing an intra-coding strategy, determining whether to perform an inter-coding strategy or an intra-coding strategy on the target image frame in this adaptive manner can improve the coding speed for the target image frame.

[0150] Please refer to Figure 8 ,Figure 8 This is a schematic flowchart of a data encoding and transmission method provided by the present application. As Figure 8 shown, the method may include:

[0151] Step S201, sending video data;

[0152] Specifically, the video client 100g may send video data to the server 101g to request the server 101g to send the video data to the video client 102g.

[0153] Step S202, encoding the video data;

[0154] Specifically, after receiving the video data sent by the video client 100g, the server 101g may encode the video data to obtain the encoded data of the video data. Among them, the manner in which the server 101g encodes the video data may be the manner described in the corresponding embodiment above Figure 3 corresponding embodiment.

[0155] Step S203, sending the encoded data;

[0156] Specifically, the server 101g may send the encoded data to the video client 102g, which indicates that the server 101g has sent the video data to the video client 102g.

[0157] Step S204, decoding the encoded data and playing the decoded data;

[0158] Specifically, after receiving the encoded data sent by the server 101g, the video client 102g may decode the encoded data to obtain the decoded data of the video data. The video client 102g may play the decoded data to realize the playing of the above video data.

[0159] Encoding the video data by the method provided by the present application can reduce the encoding time for the video data, and further reduce the time taken for the video client 100g to transmit the video data to the video client 102g.

[0160] Please refer to Figure 9 , Figure 9 This is a schematic structural diagram of a data encoding device provided by the present application. As Figure 9 shown, the data encoding device 1 may include: a cost acquisition module 101, a difference degree determination module 102, a complexity determination module 103, and a policy determination module 104;

[0161] A cost acquisition module 101, configured to acquire a target image frame, acquire an intra-frame rate distortion cost for the target image frame, and acquire an inter-frame rate distortion cost for the target image frame;

[0162] A difference degree determination module 102, configured to determine an inter-frame difference degree between the target image frame and an adjacent image frame of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost;

[0163] A complexity determination module 103, configured to determine an image frame complexity for the target image frame according to the inter-frame rate distortion cost;

[0164] A strategy determination module 104, configured to determine an encoding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.

[0165] Among them, for the specific functional implementation manners of the cost acquisition module 101, the difference degree determination module 102, the complexity determination module 103, and the strategy determination module 104, please refer to Figure 3 Steps S101 - S104 in the corresponding embodiments, which will not be elaborated here.

[0166] Among them, the inter-frame difference degree is a first inter-frame difference degree or a second inter-frame difference degree; the first inter-frame difference degree is greater than the second inter-frame difference degree; the image frame complexity is a first image frame complexity or a second image frame complexity; the first image frame complexity is greater than the second image frame complexity;

[0167] The strategy determination module 104 includes: a first strategy determination unit 1041 and a second strategy determination unit 1042;

[0168] The first strategy determination unit 1041 is configured to determine that the encoding strategy for the target image frame is an intra-frame encoding strategy when the image frame complexity is the first image frame complexity and the inter-frame difference degree is the first inter-frame difference degree;

[0169] The second strategy determination unit 1042 is configured to determine that the encoding strategy for the target image frame is an inter-frame encoding strategy when the image frame complexity is the second image frame complexity or the inter-frame difference degree is the second inter-frame difference degree.

[0170] Among them, for the specific functional implementation manners of the first strategy determination unit 1041 and the second strategy determination unit 1042, please refer to Figure 3 Step S104 in the corresponding embodiments, which will not be elaborated here.

[0171] Among them, the difference degree determination module 102 includes: a parameter determination unit 1021, a first difference degree determination unit 1022, and a second difference degree determination unit 1023;

[0172] A parameter determination unit 1021, configured to determine a frame gap measurement parameter according to an inter-frame rate distortion cost and an intra-frame rate distortion cost;

[0173] A first gap degree determination unit 1022, configured to determine an inter-frame gap degree as a first inter-frame gap degree when the frame gap measurement parameter is greater than a frame gap measurement threshold;

[0174] A second gap degree determination unit 1023, configured to determine an inter-frame gap degree as a second inter-frame gap degree when the inter-frame gap degree is less than or equal to the frame gap measurement threshold.

[0175] Wherein, for the specific functional implementation manners of the parameter determination unit 1021, the first gap degree determination unit 1022, and the second gap degree determination unit 1023, please refer to Figure 3 Step S102 in the corresponding embodiment, which will not be elaborated here.

[0176] Wherein, a complexity determination module 103 includes: a first complexity determination unit 1031 and a second complexity determination unit 1032;

[0177] The first complexity determination unit 1031 is configured to determine an image frame complexity as a first image frame complexity when the inter-frame rate distortion cost is greater than a cost measurement threshold;

[0178] The second complexity determination unit 1032 is configured to determine an image frame complexity as a second image frame complexity when the inter-frame rate distortion cost is less than or equal to the cost measurement threshold.

[0179] Wherein, for the specific functional implementation manners of the first complexity determination unit 1031 and the second complexity determination unit 1032, please refer to Figure 3 Step S103 in the corresponding embodiment, which will not be elaborated here.

[0180] Wherein, the above device 1 further includes: a first unit acquisition module 105, a unit cost acquisition module 106, a threshold determination module 107, and a first unit policy determination module 108;

[0181] The first unit acquisition module 105 is configured to acquire an encoding unit included in a target image frame when it is determined that an encoding policy for the target image frame is an inter-frame encoding policy;

[0182] The unit cost acquisition module 106 is configured to acquire a unit inter-frame rate distortion cost and a unit intra-frame rate distortion cost for the encoding unit;

[0183] The threshold determination module 107 is configured to acquire a cost measurement parameter, and determine a cost measurement threshold according to the cost measurement parameter and the unit intra-frame rate distortion cost;

[0184] The first unit strategy determination module 108 is configured to determine that the encoding strategy for the encoding unit is an intra-frame encoding strategy when the inter-frame rate-distortion cost is greater than the cost measurement threshold.

[0185] For the specific functional implementation manners of the first unit acquisition module 105, the unit cost acquisition module 106, the threshold determination module 107, and the first unit strategy determination module 108, please refer to Figure 3 step S104 in the corresponding embodiment, which will not be elaborated here.

[0186] Wherein, the above device 1 further includes: a second unit acquisition module 109 and a second unit strategy determination module 110;

[0187] The second unit acquisition module 109 is configured to acquire the encoding units included in the target image frame when it is determined that the encoding strategy for the target image frame is an intra-frame encoding strategy;

[0188] The second unit strategy determination module 110 is configured to determine that the encoding strategy for the encoding unit is an intra-frame encoding strategy.

[0189] For the specific functional implementation manners of the second unit acquisition module 109 and the second unit strategy determination module 110, please refer to Figure 3 step S104 in the corresponding embodiment, which will not be elaborated here.

[0190] Wherein, the cost acquisition module 101 includes: an intra-frame parameter acquisition unit 1011 and an intra-frame cost determination unit 1012;

[0191] The intra-frame parameter acquisition unit 1011 is configured to acquire the intra-frame prediction distortion degree for the target image frame and acquire the intra-frame prediction bit rate for the target image frame;

[0192] The intra-frame cost determination unit 1012 is configured to determine the intra-frame rate-distortion cost for the target image frame according to the intra-frame prediction distortion degree and the intra-frame prediction bit rate.

[0193] For the specific functional implementation manners of the intra-frame parameter acquisition unit 1011 and the intra-frame cost determination unit 1012, please refer to Figure 3 step S101 in the corresponding embodiment, which will not be elaborated here.

[0194] Wherein, the cost acquisition module 101 includes: an inter-frame parameter acquisition unit 1013 and an inter-frame cost determination unit 1014;

[0195] The inter-frame parameter acquisition unit 1013 is configured to acquire the inter-frame prediction distortion degree for the target image frame and acquire the inter-frame prediction bit rate for the target image frame;

[0196] An inter-frame cost determination unit 1014 is configured to determine an inter-frame rate-distortion cost for a target image frame according to an inter-frame prediction distortion degree and an inter-frame prediction code rate.

[0197] For the specific functional implementation manners of the inter-frame parameter acquisition unit 1013 and the inter-frame cost determination unit 1014, please refer to Figure 3 Step S101 in the corresponding embodiment, which will not be elaborated here.

[0198] The cost acquisition module 101 includes: a video acquisition unit 1015, a frame splitting unit 1016, and an image frame determination unit 1017;

[0199] The video acquisition unit 1015 is configured to acquire video data;

[0200] The frame splitting unit 1016 is configured to split the video data into frames to obtain at least two image frames included in the video data;

[0201] The image frame determination unit 1017 is configured to determine a target image frame from the at least two image frames.

[0202] For the specific functional implementation manners of the video acquisition unit 1015, the frame splitting unit 1016, and the image frame determination unit 1017, please refer to Figure 3 Step S101 in the corresponding embodiment, which will not be elaborated here.

[0203] The above device 1 further includes: an encoding module 111 and a decoding module 112;

[0204] The encoding module 111 is configured to encode the video data based on the determined encoding strategy for the target image frame to obtain encoded data of the video data;

[0205] The decoding module 112 is configured to synchronize the encoded data to a video client so that the video client decodes the encoded data to obtain decoded data of the video data and plays the decoded data.

[0206] For the specific functional implementation manners of the encoding module 111 and the decoding module 112, please refer to Figure 3 Step S104 in the corresponding embodiment, which will not be elaborated here.

[0207] This application can obtain a target image frame, obtain the intra-frame rate distortion cost for the target image frame, and obtain the inter-frame rate distortion cost for the target image frame; determine the inter-frame difference degree between the target image frame and the adjacent image frame of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost; determine the image frame complexity for the target image frame according to the inter-frame rate distortion cost; determine the encoding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy. It can be seen that the device proposed in this application can obtain the inter-frame difference degree between the target image frame and the adjacent image frame, as well as the image frame complexity of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost of the target image frame. This inter-frame difference degree and image frame complexity can be used to determine whether the target image frame is an image frame of scene transition, so as to determine the encoding strategy for the target image frame. Since the time-consuming of performing the inter-frame encoding strategy on the target image frame is more than that of performing the intra-frame encoding strategy, determining whether to perform the inter-frame encoding strategy or the intra-frame encoding strategy on the target image frame in this adaptive manner can improve the encoding speed for the target image frame.

[0208] Please refer to Figure 10 , Figure 10 which is a schematic structural diagram of a computer device provided by this application. As Figure 10 shown, the computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. In addition, the computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection communication between these components. Among them, the user interface 1003 may include a display screen (Display) and a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory, such as at least one disk memory. Optionally, the memory 1005 may further be at least one storage device located far from the aforementioned processor 1001. As Figure 10 shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0209] In Figure 10 the computer device 1000 shown, the network interface 1004 can provide network communication functions; while the user interface 1003 is mainly used to provide an input interface for users; and the processor 1001 can be used to call the device control application program stored in the memory 1005 to implement the foregoingFigure 3 The description of the data encoding method in the corresponding embodiment. It should be understood that the computer device 1000 described in this application can also execute the foregoing Figure 9 The description of the data encoding device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated either.

[0210] In addition, it should be noted here that: This application also provides a computer-readable storage medium, and the computer-readable storage medium stores the computer program executed by the foregoing-mentioned data encoding device 1, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the foregoing Figure 3 The description of the data encoding method in the corresponding embodiment. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated either. For the technical details not disclosed in the computer storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0211] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing relevant hardware through a computer program. The above program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. Among them, the above storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc.

[0212] The foregoing disclosure is only the preferred embodiment of this application, and of course it cannot be used to limit the scope of rights of this application. Therefore, equivalent changes made according to the claims of this application still fall within the scope covered by this application.

Claims

1. A data encoding method, characterized in that, Including: Obtain a target image frame, obtain an intra-frame rate distortion cost for the target image frame, and obtain an inter-frame rate distortion cost for the target image frame; the inter-frame rate distortion cost is less than or equal to the intra-frame rate distortion cost; Determine an inter-frame gap degree between the target image frame and an adjacent image frame of the target image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost, the inter-frame gap degree being a first inter-frame gap degree or a second inter-frame gap degree, the first inter-frame gap degree being greater than the second inter-frame gap degree; Determine an image frame complexity for the target image frame according to the inter-frame rate distortion cost, the image frame complexity being a first image frame complexity or a second image frame complexity, the first image frame complexity being greater than the second image frame complexity; When the image frame complexity is the first image frame complexity and the inter-frame gap degree is the first inter-frame gap degree, determine that the encoding strategy for the target image frame is an intra-frame encoding strategy; When the image frame complexity is the second image frame complexity or the inter-frame gap degree is the second inter-frame gap degree, determine that the encoding strategy for the target image frame is an inter-frame encoding strategy.

2. The method according to claim 1, characterized in that, The determining the inter-frame gap degree between the target image frame and the adjacent image frame according to the inter-frame rate distortion cost and the intra-frame rate distortion cost includes: Determine a frame gap measurement parameter according to the inter-frame rate distortion cost and the intra-frame rate distortion cost; When the frame gap measurement parameter is greater than a frame gap measurement threshold, determine that the inter-frame gap degree is the first inter-frame gap degree; When the inter-frame gap degree is less than or equal to the frame gap measurement threshold, determine that the inter-frame gap degree is the second inter-frame gap degree.

3. The method according to claim 1, characterized in that, The determining the image frame complexity for the target image frame according to the inter-frame rate distortion cost includes: When the inter-frame rate distortion cost is greater than a cost measurement threshold, determine that the image frame complexity is the first image frame complexity; When the inter-frame rate distortion cost is less than or equal to the cost measurement threshold, determine that the image frame complexity is the second image frame complexity.

4. The method according to claim 1, characterized in that, The method further includes: When it is determined that the encoding strategy for the target image frame is the inter-frame encoding strategy, obtain the coding units included in the target image frame; Obtain a unit inter-frame rate distortion cost and a unit intra-frame rate distortion cost for the coding unit; Obtain a cost measurement parameter, and determine a cost measurement threshold corresponding to the coding unit according to the cost measurement parameter and the unit intra-frame rate distortion cost; When the unit inter-frame rate distortion cost is greater than the cost measurement threshold corresponding to the coding unit, determine that the encoding strategy for the coding unit is the intra-frame encoding strategy.

5. The method according to claim 1, characterized in that, The method further includes: When it is determined that the encoding strategy for the target image frame is the intra-frame encoding strategy, obtain the coding units included in the target image frame; Determine that the encoding strategy for the coding unit is the intra-frame encoding strategy.

6. The method according to claim 1, characterized in that, The obtaining the intra-frame rate distortion cost for the target image frame includes: Obtain the intra-frame prediction distortion degree for the target image frame, and obtain the intra-frame prediction bit rate for the target image frame; Determine the intra-frame rate-distortion cost for the target image frame according to the intra-frame prediction distortion degree and the intra-frame prediction bit rate.

7. The method according to claim 1, characterized in that, The obtaining of the inter-frame rate-distortion cost for the target image frame includes: Obtain the inter-frame prediction distortion degree for the target image frame, and obtain the inter-frame prediction bit rate for the target image frame; Determine the inter-frame rate-distortion cost for the target image frame according to the inter-frame prediction distortion degree and the inter-frame prediction bit rate.

8. The method according to any one of claims 1-7, characterized in that, The obtaining of the target image frame includes: Obtain video data; Perform frame division on the video data to obtain at least two image frames included in the video data; Determine the target image frame from the at least two image frames.

9. The method according to claim 8, characterized in that,The method further includes: Encode the video data based on the determined encoding strategy for the target image frame to obtain the encoded data of the video data; Synchronize the encoded data to a video client so that the video client decodes the encoded data to obtain the decoded data of the video data and plays the decoded data.

10. A data encoding device, characterized in that, It includes: A cost acquisition module, configured to obtain a target image frame, obtain the intra-frame rate-distortion cost for the target image frame, and obtain the inter-frame rate-distortion cost for the target image frame; the inter-frame rate-distortion cost is less than or equal to the intra-frame rate-distortion cost; A difference degree determination module, configured to determine the inter-frame difference degree between the target image frame and the adjacent image frame of the target image frame according to the inter-frame rate-distortion cost and the intra-frame rate-distortion cost, the inter-frame difference degree being the first inter-frame difference degree or the second inter-frame difference degree, and the first inter-frame difference degree being greater than the second inter-frame difference degree; A complexity determination module, configured to determine the image frame complexity for the target image frame according to the inter-frame rate-distortion cost, the image frame complexity being the first image frame complexity or the second image frame complexity, and the first image frame complexity being greater than the second image frame complexity; A strategy determination module, configured to determine the encoding strategy for the target image frame according to the image frame complexity and the inter-frame difference degree; The encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy; The strategy determination module includes: A first strategy determination unit, configured to determine that the encoding strategy for the target image frame is an intra-frame encoding strategy when the image frame complexity is the first image frame complexity and the inter-frame difference degree is the first inter-frame difference degree; A second strategy determination unit, configured to determine that the encoding strategy for the target image frame is an inter-frame encoding strategy when the image frame complexity is the second image frame complexity or the inter-frame difference degree is the second inter-frame difference degree.

11. The device according to claim 10, characterized in that, The difference degree determination module includes: A parameter determination unit, configured to determine a frame difference measurement parameter according to the inter-frame rate-distortion cost and the intra-frame rate-distortion cost; The first gap degree determination unit is configured to determine the inter-frame gap degree as the first inter-frame gap degree when the frame gap measurement parameter is greater than the frame gap measurement threshold; The second gap degree determination unit is configured to determine the inter-frame gap degree as the second inter-frame gap degree when the inter-frame gap degree is less than or equal to the frame gap measurement threshold.

12. A computer device, characterized in that, It includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor is caused to execute the steps of the method according to any one of claims 1-9.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the method according to any one of claims 1-9 is executed.

Citation Information

Patent Citations

  • Method and device for setting intra-frame coding frame in video sequence

    CN106412580A

  • Video coding processing method, video coding processing apparatus and electronic device

    CN108810531A

  • Video encoding method and device, video decoding method and device, storage medium and electronic device

    CN110636293A