CN114449284A - Data encoding method and device, storage medium and computer equipment - Google Patents

Data encoding method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN114449284A
CN114449284A CN202011221654.9A CN202011221654A CN114449284A CN 114449284 A CN114449284 A CN 114449284A CN 202011221654 A CN202011221654 A CN 202011221654A CN 114449284 A CN114449284 A CN 114449284A
Authority
CN
China
Prior art keywords
frame
image frame
inter
target image
encoding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011221654.9A
Other languages
Chinese (zh)
Inventor
张清
王诗涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011221654.9A priority Critical patent/CN114449284A/en
Publication of CN114449284A publication Critical patent/CN114449284A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/107Selection of coding mode or of prediction mode between spatial and temporal predictive coding, e.g. picture refresh
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application discloses a data encoding method, a data encoding device, a storage medium and computer equipment, wherein the method relates to the data transmission related technology in the cloud technology, and the method comprises the following steps: acquiring a target image frame, acquiring intra-frame rate distortion cost aiming at the target image frame, and acquiring inter-frame rate distortion cost aiming at the target image frame; determining inter-frame distance degree between a 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 the complexity of an image frame aiming at a target image frame according to the rate distortion cost between frames; determining a coding strategy aiming at the target image frame according to the complexity of the image frame and the difference between frames; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy. By adopting the method and the device, the encoding speed of the target image frame can be improved.

Description

Data encoding method and device, storage medium and computer equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data encoding method, an apparatus, a storage medium, and a computer device.
Background
In many daily life scenarios, a scenario of compressing video data is involved, for example, when a user a transmits a video data to a user B, a process of compressing and then transmitting the video data is involved. When video data is compressed, there are two encoding methods, one is an intra-frame encoding method and the other is an inter-frame encoding method.
It should be noted that it is generally more time-consuming to perform inter-coding than intra-coding on video data. In the prior art, each image frame of video data is usually encoded by using an inter-frame coding method, because the image frame is usually encoded by using an inter-frame coding method rather than an intra-frame coding method, the encoding effect is better, and the encoding effect can be reflected by the rate distortion cost of encoding.
However, the difference between the intra-frame coding method and the inter-frame coding method applied to the image frames is usually related to the image frames themselves, and if the difference between the image frames is not considered and the image frames are uniformly coded by the inter-frame coding method, the coding speed of the image frames is slow.
Disclosure of Invention
The application provides a data encoding method, a data encoding device, a storage medium and a computer device, which can improve the encoding speed of a target image frame.
One aspect of the present application provides a data encoding method, including:
acquiring a target image frame, acquiring intra-frame rate distortion cost aiming at the target image frame, and acquiring inter-frame rate distortion cost aiming at the target image frame;
determining inter-frame distance degree between a 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 the complexity of an image frame aiming at a target image frame according to the rate distortion cost between frames;
determining a coding strategy aiming at the target image frame according to the complexity of the image frame and the difference between frames; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.
An aspect of the present application provides a data encoding apparatus, including:
the cost acquisition module is used for acquiring a target image frame, acquiring intra-frame rate distortion cost aiming at the target image frame and acquiring inter-frame rate distortion cost aiming at the target image frame;
the distance degree determining module is used for determining the distance degree between the target image frame and the adjacent image frame of the target image frame according to the interframe rate distortion cost and the intraframe rate distortion cost;
the complexity determining module is used for determining the complexity of the image frames aiming at the target image frames according to the rate distortion cost among the frames;
the strategy determining module is used for determining a coding strategy aiming at the target image frame according to the complexity of the image frame and the difference degree between frames; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.
Wherein, the interframe difference degree is a first interframe difference degree or a second interframe difference degree; the first inter-frame difference is larger than the second inter-frame difference; the image frame complexity is a first image frame complexity or a second image frame complexity; the complexity of the first image frame is greater than that of the second image frame;
a policy determination module comprising:
the first strategy determining unit is used for determining that the coding strategy aiming at the target image frame is an intra-frame coding strategy when the image frame complexity is a first image frame complexity and the inter-frame difference degree is a first inter-frame difference degree;
and the second strategy determining unit is used for determining that the coding strategy aiming at the target image frame is the inter-frame coding strategy when the image frame complexity is the second image frame complexity or the inter-frame difference is the second inter-frame difference.
Wherein, the gap degree determination module comprises:
the parameter determining unit is used for determining a frame gap measurement parameter according to the interframe rate distortion cost and the intraframe rate distortion cost;
a first gap determining unit, configured to determine the inter-frame gap as a first inter-frame gap when the frame gap measurement parameter is greater than the frame gap measurement threshold;
and a second gap determining unit for determining the gap between the frames as a second gap between the frames when the gap between the frames is less than or equal to the frame gap measurement threshold.
Wherein, the complexity determination module comprises:
the first complexity determining unit is used for determining the complexity of the image frame as the complexity of the first image frame when the rate distortion cost between frames is greater than a cost measurement threshold;
and the second complexity determining unit is used for determining the complexity of the image frame as the second complexity of the image frame when the rate distortion cost between frames is less than or equal to the cost measurement threshold value.
Wherein, above-mentioned device still includes:
the first unit acquiring module is used for acquiring an encoding unit included in a target image frame when the encoding strategy aiming at the target image frame is determined to be an inter-frame encoding strategy;
a unit cost obtaining module, configured to obtain a rate distortion cost between unit frames and a rate distortion cost within unit frames for a coding unit;
the threshold value determining module is used for acquiring the cost measurement parameter and determining a cost measurement threshold value according to the cost measurement parameter and the rate distortion cost in the unit frame;
the first unit strategy determining module is used for determining that the coding strategy aiming at the coding unit is the intra-frame coding strategy when the inter-frame rate distortion cost is larger than the cost measurement threshold value.
Wherein, above-mentioned device still includes:
the second unit acquiring module is used for acquiring the coding unit included in the target image frame when the coding strategy aiming at the target image frame is determined to be an intra-frame coding strategy;
a second unit strategy determination module to determine the encoding strategy for the encoding unit to be an intra-frame encoding strategy.
Wherein, the cost obtaining module includes:
the intra-frame parameter acquisition unit is used for acquiring the intra-frame prediction distortion degree aiming at the target image frame and acquiring the intra-frame prediction code rate aiming at the target image frame;
and the intra-frame cost determining unit is used for determining the intra-frame rate distortion cost aiming at the target image frame according to the intra-frame prediction distortion degree and the intra-frame prediction code rate.
Wherein, the cost obtaining module includes:
the inter-frame parameter obtaining unit is used for obtaining the inter-frame prediction distortion degree aiming at the target image frame and obtaining the inter-frame prediction code rate aiming at the target image frame;
and the inter-frame cost determining unit is used for determining the inter-frame rate distortion cost aiming at the target image frame according to the inter-frame prediction distortion degree and the inter-frame prediction code rate.
Wherein, the cost obtaining module includes:
a video acquisition unit for acquiring video data;
the framing unit is used for framing the video data to obtain at least two image frames included in the video data;
an image frame determining unit for determining a target image frame from at least two image frames.
Wherein, above-mentioned device still includes:
the encoding module is used for encoding the video data based on the determined encoding strategy aiming at the target image frame to obtain encoded data of the video data;
and the decoding module is used for synchronizing the coded data to the video client so that the video client decodes the coded data to obtain decoded data of the video data and plays the decoded data.
An aspect of the application provides a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the method of an aspect of the application.
An aspect of the application provides a computer-readable storage medium having stored thereon a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of the above-mentioned aspect.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being 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 to cause the computer device to perform the method provided in the various alternatives of the above aspect and the like.
The method and the device can acquire the target image frame, acquire the intra-frame rate distortion cost aiming at the target image frame and acquire the inter-frame rate distortion cost aiming at the target image frame; determining inter-frame distance degree between a 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 the complexity of an image frame aiming at a target image frame according to the rate distortion cost between frames; determining a coding strategy aiming at the target image frame according to the complexity of the image frame and the difference between frames; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy. Therefore, the method provided by the application can obtain the inter-frame difference between the target image frame and the adjacent image frame and 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, and the inter-frame difference and the image frame complexity can be used for judging whether the target image frame is an image frame of scene conversion or not so as to determine the encoding strategy for the target image frame. Because the time consumption for executing the interframe coding strategy on the target image frame is more than that for executing the intraframe coding strategy, the coding speed of the target image frame can be improved by judging whether the interframe coding strategy or the intraframe coding strategy is executed on the target image frame in the self-adaptive mode.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a network architecture according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a data encoding scenario provided in the present application;
FIG. 3 is a flow chart of a data encoding method provided herein;
FIG. 4 is a schematic view of a scene for acquiring image frames provided herein;
FIG. 5 is a schematic diagram of a scene of coding prediction provided in the present application;
FIG. 6 is a schematic diagram of a scene of coding time-consuming comparison provided in the present application;
FIG. 7 is a schematic diagram illustrating a scenario of obtaining an encoding strategy of an encoding unit according to the present application;
fig. 8 is a schematic flow chart of a data encoding and transmitting method provided in the present application;
FIG. 9 is a schematic structural diagram of a data encoding apparatus provided in the present application;
fig. 10 is a schematic structural diagram of a computer device provided in the present application.
Detailed Description
The technical solutions in the present application will be described clearly and completely with reference to the accompanying drawings in the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The present application relates to cloud technology. The Cloud technology (Cloud technology) is a hosting technology for unifying series resources such as hardware, software, network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
The Cloud technology (Cloud technology) is based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied in a Cloud computing business model, can form a resource pool, can be used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
The cloud technology mainly involved in the application refers to a technology for transmitting video data, and particularly relates to a technology for encoding, compressing and transmitting video data by using a cloud server. Please see the description below.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a network architecture according to an embodiment of the present disclosure. As shown in fig. 1, the network architecture may include a server 200 and a terminal device cluster, and the terminal device cluster may include one or more terminal devices, where the number of terminal devices is not limited herein. As shown in fig. 1, the plurality of terminal devices may specifically include a terminal device 100a, a terminal device 101a, terminal devices 102a, …, and a terminal device 103 a; as shown in fig. 1, the terminal device 100a, the terminal device 101a, the terminal devices 102a, …, and the terminal device 103a may all be in network connection with the server 200, so that each terminal device may perform data interaction with the server 200 through the network connection.
The server 200 shown in fig. 1 may be an independent physical server, may also be a server cluster or a distributed system formed by a plurality of physical servers, and may also be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN, and a big data and artificial intelligence platform. The terminal device may be: the intelligent terminal comprises intelligent terminals such as a smart phone, a tablet computer, a notebook computer, a desktop computer and an intelligent television. The following takes communication between the terminal device 100a and the server 200 as an example, and a detailed description of an embodiment of the present application is made.
Referring to fig. 2, fig. 2 is a schematic view of a data encoding scenario provided in the present application. The image frame 101b and the image frame 102b may be image frames obtained by framing the video data 100 b. I.e. video data 100b comprises image frame 101b and image frame 102 b. Image frame 101b may be an adjacent image frame to image frame 102b and image frame 101b may be a previous image frame to image frame 102 b.
The video data 100b may be any video data, and the video data 100b may be acquired by the terminal device 100 a. For example, the video data 100b may be conference video data recorded by the terminal device 100a during the real-time online conference. After acquiring the video data 100b, the terminal device 100a may transmit the video data 100b to the server 200 to request the server 200 to encode the video data 100 b. Therefore, after acquiring the video data 108b, the server 100b may frame the video data 100b to obtain the image frame 101b and the image frame 102 b.
Since the principle of the server 200 encoding each image frame included in the video data 100b is the same, the process of how the server 200 encodes the image frame 102b will be described as an example. Therefore, the image frame 102b may be a target image frame, the image frame 101b may be an adjacent image frame of the target image frame, and the target image frame may be any one image frame in the video data 100 b. The following describes the process of encoding the target image frame 102b by the server 200 in detail, and please refer to the following description.
As shown in fig. 2, in the process of encoding the video data 100b, the server 200 performs pre-analysis on the video data, and by performing the pre-analysis on the video data 100b, the server 200 may obtain a rate distortion cost for intra-frame encoding the image frame 102b, and the rate distortion cost for intra-frame encoding the image frame 102b may be referred to as an intra-frame rate distortion cost 106 b. By pre-analyzing the video data 100b, the server 200 may further obtain a rate distortion cost for inter-coding the image frame 102b, and the rate distortion cost for inter-coding the image frame 102b may be referred to as an inter-rate distortion cost 107 b.
Wherein, the rate-distortion cost can comprehensively measure the quality of coding data. The rate-distortion cost is obtained by measuring the distortion degree and the code rate of the data to be coded. In an actual coding scenario, it is desirable that the smaller the distortion degree, the smaller the code rate, which can make the rate distortion cost smaller. However, the distortion factor and the code rate cannot be obtained at the same time, and the distortion factor and the code rate are generally in an inverse correlation relationship. The description of intra-coding or inter-coding the target image frame 102b may refer to the description of the corresponding embodiment of fig. 3 below.
The server 200 may obtain the inter-frame distance difference 103b between the target image frame 102b and the adjacent image frame 101b through the intra-frame rate distortion cost 106b and the inter-frame rate distortion cost 107 b. The server 200 may also obtain the image frame complexity 105b of the target image frame 102b through the inter-frame rate distortion cost 107 b. The specific process of obtaining the inter-frame distance measure 103b and the image frame complexity 105b of the target image frame 102b through the intra-frame rate distortion measure 106b and the inter-frame rate distortion measure 107b may also be referred to the following description in the embodiment corresponding to fig. 3.
The server 200 may derive the encoding policy 108b for the target image frame 102b from the inter-frame difference 103b and the image frame complexity 105b of the target image frame 102 b. The server obtains the encoding policy 108b for the target image frame 102b, that is, determines what encoding method is used for the target image frame 102 b. As shown in fig. 2, the encoding policy 108b may be an intra-coding policy 110b or an inter-coding policy 111 b.
When the server 200 detects that the inter-frame distance 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, the target image frame 102b may be considered as an image frame belonging to a scene transition, and for the target image frame 102b of the scene transition, the encoding policy 108b for the target image frame 102b, which is determined by the server 200, may be an intra-frame encoding policy 110b, that is, the target image frame 102b needs to be intra-frame encoded.
When the server 200 detects that the inter-frame distance 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 may be determined that the target image frame 102b is not an image frame belonging to a scene transition, and for the target image frame 102b not belonging to the scene transition, the encoding policy 108b for the target image frame 102b determined by the server 200 may be an inter-frame encoding policy 111b, that is, the target image frame 102b needs to be inter-frame encoded.
The specific process of how to determine the encoding strategy for the target image frame 102b can also be seen in the following description of the corresponding embodiment of fig. 3.
It should be noted that the principle of inter-frame coding the target image frame 102b is mainly implemented by the relative motion between the target image frame 102b and the adjacent image frame 101b, and when the inter-frame difference degree 103b between the target image frame 102b and the adjacent image frame 101b is larger, it indicates that the probability of more image blocks in the target image frame 102b is not obtained based on the motion of the corresponding image blocks in the adjacent image frame 101b (and also more indicates that the target image frame 102b is an image frame of scene transition), but is newly appeared image blocks, so even if the inter-frame coding is performed on the target image frame 102b, the more image blocks in the target image frame 102b are still the intra-frame coding method. When the inter-frame difference of the target image frame 102b is larger and more complicated (i.e., the image frame complexity 105b is larger), the time consumption is much shorter when the intra-frame encoding is performed on the target image frame 102b than when the inter-frame encoding is performed on the image frame 102 b.
By the method, for the image frame which is relatively complex and belongs to scene conversion, an intra-frame coding mode can be adopted for the image frame, and the coding speed of the image frame can be improved.
Referring to fig. 3, fig. 3 is a schematic flow chart of a data encoding method provided in the present application, and as shown in fig. 3, the method may include:
step S101, obtaining a target image frame, obtaining intra-frame rate distortion cost aiming at the target image frame, and obtaining inter-frame rate distortion cost aiming at the target image frame;
specifically, the execution main body in the embodiment of the present application may be any one computer device, or may be a device cluster formed by a plurality of computer devices. The computer device may be a server or a terminal device, which is not limited to this. Here, the description will be made taking an execution subject in the present application as an example of a server. Please see the description below.
The server may obtain video data, where the video data may be any one of video data, and the video data may be sent to the server by the terminal device. The terminal device may request the server to encode the video data by transmitting the video data to the server. For example, the video data may be video data shot by a camera in real time, such as online conference video data; the video data may also be screen-shared video data or the like.
When the server encodes the video data, the server may perform framing on the video data, that is, may obtain a plurality of (at least two) image frames included in the video data. Therefore, the target image frame may be any one of a plurality of image frames framed in the video data. The server encodes the video data, that is, each image frame of the video data needs to be encoded, and here, a process of encoding a target image frame in the video data by the server is taken as an example. It will be appreciated that the principle of the server encoding each image frame in the video data is the same. Please see the description below.
The server performs pre-analysis on the video data first in the process of encoding the video data, and by performing the pre-analysis on the video data, the server can predict a rate distortion cost (here, the minimum rate distortion cost of intra-frame encoding) when each image frame in the video data is intra-frame encoded, and a rate distortion cost (here, the minimum rate distortion cost of inter-frame encoding) when each image frame is inter-frame encoded. The rate-distortion cost at the time of intra-coding each image frame may be referred to as an intra-rate-distortion cost for each image frame. The rate distortion cost when each image frame is inter-coded may be referred to as an inter-frame rate distortion cost for each image frame.
Therefore, by performing pre-analysis on the video data, the server can also obtain the intra-frame rate distortion cost and the inter-frame rate distortion cost for the target image frame. The specific process of the server obtaining the intra-frame rate distortion cost and the inter-frame rate distortion cost for the target image frame may be as follows:
since the rate-distortion cost is obtained by simultaneously measuring the distortion degree and the code rate when the data is encoded, the smaller the distortion degree is, the smaller the code rate is, the smaller the data amount is after the data is encoded (i.e. the smaller the bit number of the data is, the smaller the data is compressed). Therefore, in a scenario where data is encoded, it is desirable that the distortion degree of the data after the data is encoded is smaller and the code rate is smaller.
However, when data is encoded, the distortion degree and the code rate tend to be in a negative correlation relationship, the code rate of the data tends to be larger when the distortion degree of the data is smaller, and conversely, the code rate of the data may be smaller when the distortion degree of the data is larger. Therefore, the rate-distortion cost is obtained by comprehensively measuring the distortion degree and the code rate of the data when the data is encoded, in other words, the influence caused by the distortion degree and the code rate of the data when the data is encoded can be considered in a balanced manner through the rate-distortion cost.
Therefore, it can be understood that when data is encoded, it is desirable that the rate distortion cost of the data is smaller when the data is encoded, which indicates that the data is encoded more effectively.
Specifically, the server may obtain an inter-frame prediction distortion factor for the target image frame in the process of performing pre-analysis on the video data, where the inter-frame prediction distortion factor is a distortion factor of the target image frame when the target image frame is predicted to be inter-coded. The server may further obtain an inter-frame prediction code rate for the target image frame in the process of performing pre-analysis on the video data, where the inter-frame prediction code rate is a code rate of the target image frame when inter-frame coding is performed on the target image frame. The server can obtain the inter-frame rate distortion cost for the target image frame through the inter-frame prediction distortion degree and the inter-frame prediction code rate of the target image frame.
Similarly, the server may further obtain an intra-frame prediction distortion factor for the target image frame during the pre-analysis of the video data, where the intra-frame prediction distortion factor is a distortion factor of the target image frame when the target image frame is intra-coded. The server may further obtain an intra-frame prediction code rate for the target image frame in the process of performing pre-analysis on the video data, where the intra-frame prediction code rate is a code rate of the target image frame when the target image frame is predicted to be intra-coded. Through the intra-frame prediction distortion degree and the intra-frame prediction code rate of the target image frame, the server can obtain the intra-frame rate distortion cost for the target image frame.
When video data is pre-analyzed and the rate distortion cost of inter-frame coding of a target image frame is predicted, the scheme of intra-frame coding of the target image frame is included. Therefore, when the intra-frame rate distortion cost and the inter-frame rate distortion cost of the target image frame are obtained, intra-frame coding is performed on the target image frame, and the scheme of i-frame coding on the target image frame can be included; the inter-frame coding of the target image frame may include schemes of i-frame coding, p-frame coding and b-frame coding of the target image frame.
The intra-frame rate distortion cost when the 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, and similarly, the inter-frame rate distortion cost when the 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 addition to obtaining the inter-frame rate distortion cost and the intra-frame rate distortion cost of the target image frame, performing intra-frame coding on the target image frame may refer to performing i-frame coding on the target image frame, and performing inter-frame coding on the target image frame may refer to performing b-frame coding or p-frame coding on the target image frame.
When the intra-frame rate distortion cost and the inter-frame rate distortion cost of the target image frame are obtained, the inter-frame coding scheme includes the intra-frame coding scheme, so that the inter-frame rate distortion cost of the target image frame is inevitably smaller 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 intra-frame rate distortion cost of the target image frame.
For example, when the rate-distortion cost is the smallest when i-frame encoding is performed on 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 minimum when b-frame coding or p-frame coding is carried out on the target image frame, the inter-frame rate distortion cost of the target image frame is smaller than the intra-frame rate distortion cost.
The i-frame encoding of the target image frame means that when the target image frame is encoded, all complete picture information of the target image frame is reserved, and the target image frame can be encoded only by the target image frame, so that the target image frame can be decoded only by the encoded data of the target image frame.
The p-frame encoding of the target image frame means that encoding needs to be performed through relative motion between the target image frame and an adjacent image frame, that is, encoding needs to be performed through a difference between the target image frame and the adjacent image frame. The adjacent image frame may refer to an image frame preceding the target image frame.
Therefore, when the target image frame is p-frame encoded and the encoded data of the target image frame is decoded, the encoded data of the target image frame is required to be superimposed on the adjacent image frame of the target image frame to realize decoding of the target image frame. In other words, the encoded data obtained by p-frame encoding 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.
The above p-frame encoding of the target image frame is unidirectional encoding, and only the image frame (previously decoded image frame) in front of the target image frame is required to implement encoding of the target image frame. The b-frame encoding of the target image frame is bidirectional encoding, that is, the b-frame encoding of the target image frame requires not only an image frame before the target image frame but also an image frame after the target image frame (a decoded image frame after the target image frame). The target image frame is encoded by 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.
Step S102, determining inter-frame distance between a 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;
specifically, the server may obtain a ratio between an inter-frame rate distortion cost and an intra-frame rate distortion cost of the target image frame, that is, a ratio between the inter-frame rate distortion cost and the intra-frame rate distortion cost, and may refer to the ratio as a frame difference measurement parameter. When the frame difference measurement parameter is greater than the frame difference measurement threshold, the frame difference between the target image frame and its adjacent image frame may be considered to be a first inter-frame difference that indicates a large difference between the target image frame and the adjacent image frame. The adjacent image frame may be any image frame preceding the target image frame, for example, may be a previous image frame of the target image frame.
Referring to fig. 4, fig. 4 is a schematic view of a scene for acquiring an image frame according to the present application. As shown in fig. 4, the server may perform framing on the video data 100c, i.e., obtain a plurality of image frames included in the video data 100 c. The plurality of image frames are a plurality of image frames in the region 101 c. The plurality of image frames may specifically include image frame 102c, image frame 103c, image frame 104c, and image frame 105 c.
The server may use any one of the image frames included in the video data 100c as the target image frame, for example, here, the server may 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.
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 difference measurement parameter is 0 to 1. Therefore, the frame difference measurement threshold may be set according to an actual situation, and a value range of the frame difference measurement threshold is also 0 to 1, for example, the frame difference measurement threshold may be equal to 0.7.
When the frame difference measurement parameter is larger than the frame difference measurement threshold, the target image frame is subjected to intra-frame coding or inter-frame coding, and the rate distortion cost is almost the same. And when the inter-frame difference between the target image frame and the adjacent image frame is larger, the more image blocks in the target image frame are indicated not to be based on the motion of the image blocks in the adjacent image frame, namely the more image blocks in the target image frame are indicated as new image blocks.
At this time, even if the target image frame is encoded by inter-frame coding (p-frame coding or b-frame coding, herein), more image blocks (such as newly appearing image blocks) in the target image frame are encoded by intra-frame coding (i-frame coding, herein), because the new image blocks are not based on the motion of image blocks in the adjacent image frame, and thus, it is necessary to retain the complete picture information of the newly appearing image blocks. Therefore, in this case, the rate-distortion cost is not much different between the case of encoding the target image frame by inter-frame encoding (p-frame encoding or b-frame encoding in this case) and the case of encoding the target image frame by intra-frame encoding (i-frame encoding in this case).
And when the inter-frame difference degree between the target image frame and the adjacent image frame is larger, the target image frame is more indicated as the image frame of the scene transition. Because, for an image frame of a scene transition, the image blocks contained therein are not substantially moved by the image blocks in the previous image frame.
Therefore, when the ratio (i.e., the frame difference measurement parameter) between the inter-frame rate distortion cost and the intra-frame rate distortion cost of the target image frame 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 frame gap measurement parameter described above can be used to measure the gap (i.e., difference) between the target image frame and the adjacent image frame.
More specifically, when the frame difference measurement parameter is less than or equal to the frame difference measurement threshold, the frame difference between the target image frame and the adjacent image frame may be considered as a second inter-frame difference, which indicates that the difference between the target image frame and the adjacent image frame is small.
Therefore, the difference between the first frames is larger than the difference between the second frames.
Through the above process, the server can obtain the inter-frame difference between the target image frame and the adjacent image frame, wherein the inter-frame difference can be a first inter-frame difference or a second inter-frame difference.
Referring to fig. 5, fig. 5 is a schematic view of a scene of coding prediction according to the present application. As shown in fig. 5, the target image frame 100d is an image frame of a scene transition, and the image blocks included in the target image frame 100d may be predicted, that is, whether each image block is an intra-prediction block or an inter-prediction block is predicted. If a certain image block is an intra-frame prediction block, it indicates that the image block needs to be encoded by intra-frame coding (i-frame coding). If a certain image block is an inter-prediction block, it indicates that the image block needs to be encoded by inter-coding (p-frame coding or b-frame coding).
As shown in FIG. 5, the target image frame 100d may include an image block 101d, an image block 102d, an image block 103d, an image block 104d, an image block 105d, an image block 106d, an image block 107d, and an image block 108d therein. Since the target image frame belongs to an image frame of a scene transition, a small portion of the image blocks 101d, 102d, 103d, 104d, 105d, 106d, 107d, and 108d in the target image frame 100d belong to an inter-prediction block, and a large portion of the image blocks in the target image frame 100d except for the image block 101d, 102d, 103d, 104d, 105d, 106d, 107d, and 108d belong to an intra-prediction block.
Step S103, determining the complexity of the image frame aiming at the target image frame according to the rate distortion cost between frames;
specifically, as the image frame is more complex, the rate distortion cost between frames is generally greater when the image frame is encoded. Therefore, when the inter-frame rate distortion cost of the target image frame is smaller, it may indicate that the target image frame is less complicated, whereas when the inter-frame rate distortion cost of the target image frame is larger, it may indicate that the target image frame is more complicated.
Therefore, when the inter-frame rate distortion cost of the target image frame is greater than the cost measurement threshold, the image frame complexity of the target image frame may be considered as the first image frame complexity, which indicates that the target image frame is more complex.
Conversely, when the inter-frame rate distortion cost of the target image frame is less than or equal to the cost measurement threshold, the image frame complexity of the target image frame may be considered to be a second image frame complexity, which indicates that the target image frame is less complex.
Therefore, the complexity of the first image frame is greater than that of the second image frame.
Through the process, the server can obtain the image frame complexity of the target image frame, wherein the image frame complexity can be the first image frame complexity or the second image frame complexity.
Step S104, determining a coding strategy aiming at the target image frame according to the complexity of the image frame and the difference between frames; the coding strategy is an interframe coding strategy or an intraframe coding strategy;
specifically, the encoding policy for the target image frame is an intra-frame encoding policy, which indicates that the target image frame may be encoded in an i-frame encoding manner. The encoding strategy for the target image frame is an inter-frame encoding strategy, which indicates that the target image frame can be encoded by adopting a p-frame encoding mode or a b-frame encoding mode.
When the inter-frame difference obtained by the server is the first inter-frame difference and the image frame complexity of the target image frame is the first image frame complexity, it indicates that the rate distortion cost is not much when the target image frame is encoded in an inter-frame coding mode (p-frame coding or b-frame coding) or in an intra-frame coding mode (i-frame coding), and the target image frame is relatively complex.
Because the encoding of the image frame is usually performed by inter-frame encoding (p-frame encoding or b-frame encoding), which is more time consuming than the encoding of the image frame by intra-frame encoding (i-frame encoding). Therefore, when the target image frame is relatively complex and is an image frame of a scene transition, the rate-distortion cost when the target image frame is coded by inter-frame coding (p-frame coding or b-frame coding) is almost the same as the rate-distortion cost when the target image frame is coded by intra-frame coding (i-frame coding), but the coding time of the target image frame when the target image frame is coded by inter-frame coding (p-frame coding or b-frame coding) is longer than the coding time of the target image frame when the target image frame is coded by intra-frame coding (i-frame coding), and therefore the coding strategy for the target image frame at this time can be an intra-frame coding strategy.
On the contrary, when the inter-frame difference obtained by the server is the second inter-frame difference, 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, and at this time, the encoding strategy for the target image frame may be considered to be an inter-frame encoding strategy.
When the inter-frame difference between the target image frame and the adjacent image frame is relatively small (i.e. the inter-frame difference is the second inter-frame difference), the rate distortion cost of encoding the target image frame by inter-frame coding (p-frame coding or b-frame coding) is obviously less than the rate distortion cost of encoding the target image frame by intra-frame coding (i-frame coding), so the target image frame is encoded by inter-frame coding.
Further, when the target image frame is not so complicated (i.e., the image frame complexity is the second image frame complexity), it takes almost as much time to encode the target image frame by intra-coding (i-frame coding) and to encode the target image frame by inter-coding (p-frame coding or b-frame coding), and therefore the target image frame is encoded by inter-coding.
When the server encodes the target image frame, the server may further decompose the target image frame into a plurality of encoding units for encoding, respectively, and one encoding unit may be an image block in the target image frame.
When the encoding policy for the target image frame acquired by the server is the intra-frame encoding policy, the server may acquire a plurality of encoding units included in the target image frame, and the server may determine the encoding policy of each encoding unit included in the target image frame as the intra-frame encoding policy. That is, when encoding the target image frame, each encoding unit included in the target image frame may be encoded by intra-frame encoding (i-frame encoding).
By the method, the encoding strategy of the target image frame can be determined according to the interframe rate distortion cost and the intraframe rate distortion cost of the target image frame acquired in the pre-analysis process, and when the target image frame is judged to be more complex and is an image frame of scene conversion, the target image frame is encoded in an intraframe encoding mode, so that the encoding time consumption of the target image frame can be greatly reduced, and the encoding speed of the target image frame is improved.
Moreover, when the user watches the video data, the image frames of the scene transition are more sensitive, so that the display effect of the video data can be improved by improving the coding speed of the image frames of the scene transition, that is, the image frames of the scene transition can be displayed more quickly and smoothly, thereby improving the impression of the user on the video data.
Referring to fig. 6, fig. 6 is a schematic view of a scene of comparing coding time consumption provided by the present application. As shown in fig. 6, the abscissa of the coordinates in fig. 6 represents an image frame index, and the ordinate represents an encoding time (i.e., an encoding elapsed time) in units of ms (milliseconds). The point 101e and the point 102e are encoding times for encoding the same image frame, the point 101e represents an encoding time for inter-encoding the image frame, the point 102e represents a time consumption for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 101e is longer than the encoding time represented by the point 102 e.
Similarly, the point 103e and the point 104e are encoding time for encoding the same image frame, the point 103e represents encoding time for inter-encoding the image frame, the point 104e represents time consumed for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 103e is longer than the encoding time represented by the point 104 e. The point 105e and the point 106e are encoding times for encoding the same image frame, the point 105e represents an encoding time for inter-encoding the image frame, the point 106e represents a time consumption for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 105e is longer than the encoding time represented by the point 106 e. The point 107e and the point 108e are encoding times for encoding the same image frame, the point 107e represents an encoding time for inter-encoding the image frame, the point 108e represents a time taken for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 107e is longer than the encoding time represented by the point 108 e.
More specifically, the point 109e and the point 110e are encoding times for encoding the same image frame, the point 109e represents an encoding time for inter-encoding the image frame, the point 110e represents a time consumption for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 109e is longer than the encoding time represented by the point 110 e. The point 111e and the point 112e are encoding times for encoding the same image frame, the point 111e represents an encoding time for inter-encoding the image frame, the point 112e represents a time taken for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 111e is longer than the encoding time represented by the point 112 e. The point 113e and the point 114e are encoding times for encoding the same image frame, the point 113e represents an encoding time for inter-encoding the image frame, the point 114e represents a time consumption for intra-encoding the image frame, and it can be seen that the encoding time represented by the point 113e is longer than the encoding time represented by the point 114 e.
As can be seen from the above description, the encoding time for encoding the image frame in the manner of inter-frame encoding is generally longer than the encoding time for encoding the image frame in the manner of intra-frame encoding.
When the coding strategy for the target image frame acquired by the server is an inter-frame coding strategy, the server may also acquire a plurality of coding units included in the target image frame, and the server may further determine the coding strategy of each coding unit in the target image frame, where the coding strategy may also include an inter-frame coding strategy and an intra-frame coding strategy, and if the coding strategy of a certain coding unit is the inter-frame coding strategy, it indicates that the coding unit may be coded in an inter-frame coding (p-frame coding or b-frame coding) mode. If the coding strategy of a certain coding unit is an intra-frame coding strategy, it indicates that the coding unit can be coded by using intra-frame coding (i-frame coding). But now it is still inter-coded for the target image frame.
In this way, when the target image frame belongs to a frame of a scene transition, but the target image frame is not a whole frame of which the scene transition occurs but only a part of the image frame of which the scene transition occurs, it is possible to encode the coding unit of the target image frame where the scene transition occurs in an intra-frame coding manner more finely, and encode the coding unit where the scene transition does not occur in an inter-frame coding manner.
For example, if a small pop window appears in the target image frame, it may be considered that only the coding unit at the small pop window in the target image frame has a scene transition, and the other coding units have no scene transition.
The server can also obtain a unit inter-frame rate distortion cost and a unit intra-frame rate distortion cost of each coding unit of the target image frame, wherein the unit inter-frame rate distortion cost represents a rate distortion cost when the coding unit is coded in an inter-frame coding (p-frame coding or b-frame coding) mode, and the unit intra-frame rate distortion cost represents a rate distortion cost when the coding unit is coded in an intra-frame coding (i-frame coding) mode. The rate distortion cost between unit frames and the rate distortion cost in unit frames can also be obtained by the server in the process of pre-analyzing the video data.
When the rate distortion cost in a unit frame of a certain coding unit of the target image frame is far less than the rate distortion cost in the unit frame, the coding unit is considered as a coding unit with scene transition, and the intra-frame coding strategy can be used as the coding strategy of the coding unit. On the contrary, when the rate distortion cost in a unit frame of a certain coding unit of the target image frame is not much smaller than the rate distortion cost between the unit frames, the coding unit is considered not to be the coding unit in which the scene change occurs, and the inter-frame coding strategy can be used as the coding strategy of the coding unit.
The server may set a cost measurement parameter, and the server may use a product of the cost measurement parameter and the rate distortion cost in the unit frame of the coding unit as a cost measurement threshold. One coding unit corresponds to one cost measure threshold. When the rate distortion cost between unit frames of a certain coding unit is greater than the corresponding cost measurement threshold, the rate distortion cost between unit frames of the coding unit can be considered to be far less than the rate distortion cost between unit frames. Conversely, when the rate distortion cost between unit frames of a certain coding unit is smaller than the corresponding cost measurement threshold, it can be considered that the rate distortion cost between unit frames of the coding unit is not much smaller than the rate distortion cost between unit frames.
The cost measurement parameter may be set according to an actual application scenario, for example, the cost measurement parameter may be a relatively large value, and when the rate distortion cost between unit frames of the coding unit is greater than a cost measurement threshold, a ratio between the rate distortion cost between unit frames of the coding unit and the rate distortion cost within unit frames of the coding unit is greater than the cost measurement parameter. In other words, when the ratio of the rate distortion cost between unit frames of the coding unit to the rate distortion cost in unit frames is greater than the cost measurement parameter, it can be considered that the rate distortion cost between unit frames of the coding unit is far less than the rate distortion cost between unit frames, i.e. the rate distortion cost between unit frames of the coding unit is far greater than the rate distortion cost in unit frames.
By further judging the coding strategy of each coding unit of the target image frame and carrying out intra-frame coding on the coding unit with the scene transition, the coding speed of the target image frame can be further improved.
Referring to fig. 7, fig. 7 is a schematic view of a scene for acquiring a coding strategy of a coding unit according to the present application. As shown in fig. 7, as shown in the area 100f, the target image frame may include 12 coding units, and the 12 coding units may specifically include a coding unit 1, a coding unit 2, a coding unit 3, a coding unit 4, a coding unit 5, a coding unit 6, a coding unit 7, a coding unit 8, a coding unit 9, a coding unit 10, a coding unit 11, and a coding unit 12.
As shown in the area 101f, the coding unit 1 and the coding unit 8 of the 12 coding units described above belong to a coding unit of a scene change, and the coding units other than the coding unit 1 and the coding unit 8 of the 12 coding units do not belong to a coding unit of a scene change.
As shown in the area 102f, the encoding strategies of the encoding unit 1 and the encoding unit 8 belonging to the scene change among the above 12 encoding units may be intra-frame encoding strategies. The encoding policy of the encoding unit 2, the encoding unit 3, the encoding unit 4, the encoding unit 5, the encoding unit 6, the encoding unit 7, the encoding unit 9, the encoding unit 10, the encoding unit 11, and the encoding unit 12, which do not belong to the scene transition, among the above 12 encoding units, may be an inter-encoding policy.
More, the server may encode the video data to which the target image frame belongs by using the obtained encoding policy for the target image frame and the obtained encoding policy for each encoding unit in the target image frame, and may obtain encoded data of the video data. The server can send the coded data to the video client, so that the video client can decode the coded data to obtain decoded data of the video data, and the video client can play the decoded data to realize the playing of the video data.
For example, the video data to which the target image frame belongs may be sent to the server by the video client of user 1, and the video client of user 1 is a video client requesting to send the video data to user 2 by sending the video data to the server. Therefore, the server may encode the video data to obtain encoded data of the video data, and then send the encoded data to the video client of the user 2, so that the video client of the user 2 may decode the encoded data to obtain decoded data, and play the decoded data.
The method and the device can acquire the target image frame, acquire the intra-frame rate distortion cost aiming at the target image frame and acquire the inter-frame rate distortion cost aiming at the target image frame; determining inter-frame distance degree between a 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 the complexity of an image frame aiming at a target image frame according to the rate distortion cost between frames; determining a coding strategy aiming at the target image frame according to the complexity of the image frame and the difference between frames; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy. Therefore, the method provided by the application can obtain the inter-frame difference between the target image frame and the adjacent image frame and 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, and the inter-frame difference and the image frame complexity can be used for judging whether the target image frame is an image frame of scene conversion or not so as to determine the encoding strategy for the target image frame. Because the time consumption for executing the interframe coding strategy on the target image frame is more than that for executing the intraframe coding strategy, the coding speed of the target image frame can be improved by judging whether the interframe coding strategy or the intraframe coding strategy is executed on the target image frame in the self-adaptive mode.
Referring to fig. 8, fig. 8 is a schematic flowchart of a data encoding and transmitting method provided in the present application. As shown in fig. 8, the method may include:
step S201, sending video data;
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 102 g.
Step S202, encoding video data;
specifically, after receiving the video data sent by the video client 100g, the server 101g may encode the video data, that is, obtain encoded data of the video data. The manner in which the server 101g encodes the video data may be the manner described in the embodiment corresponding to fig. 3.
Step S203, transmitting the coded data;
specifically, the server 101g may send encoded data to the video client 102g, which indicates that the server 101g has sent video data to the video client 102 g.
Step S204, decoding the coded data and playing the decoded data;
specifically, after receiving the encoded data sent by the server 101g, the video client 102g may decode the encoded data, that is, obtain decoded data of the video data. The video client 102g can play the decoded data, so that the video data can be played.
By encoding the video data by the method provided by the application, the encoding time consumption for the video data can be reduced, and further the time consumption for the video client 100g to transmit the video data to the video client 102g can be reduced.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a data encoding apparatus provided in the present application. As shown in fig. 9, the data encoding apparatus 1 may include: a cost obtaining module 101, a gap degree determining module 102, a complexity determining module 103 and a strategy determining module 104;
the cost obtaining module 101 is configured to 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 difference degree determining module 102 is configured to determine a difference degree between a 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 complexity determining module 103 is configured to determine image frame complexity for the target image frame according to the inter-frame rate distortion cost;
a strategy determining module 104, configured to determine an encoding strategy for the target image frame according to the image frame complexity and the inter-frame distance; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.
For specific functional implementation manners of the cost obtaining module 101, the gap degree determining module 102, the complexity determining module 103, and the policy determining module 104, please refer to steps S101 to S104 in the embodiment corresponding to fig. 3, which is not described herein again.
Wherein, the interframe difference degree is a first interframe difference degree or a second interframe difference degree; the first inter-frame difference is larger than the second inter-frame difference; the image frame complexity is a first image frame complexity or a second image frame complexity; the complexity of the first image frame is greater than that of the second image frame;
a policy determination module 104 comprising: a first policy determining unit 1041 and a second policy determining unit 1042;
a first policy determining unit 1041, configured to determine that a coding policy for the target image frame is an intra-frame coding policy when the complexity of the image frame is a first complexity of the image frame and the inter-frame difference is a first inter-frame difference;
the second policy determining unit 1042 is configured to determine that the encoding policy for the target image frame is an inter-frame encoding policy when the image frame complexity is the second image frame complexity or the inter-frame difference is the second inter-frame difference.
For specific functional implementation manners of the first policy determining unit 1041 and the second policy determining unit 1042, please refer to step S104 in the corresponding embodiment of fig. 3, which is not described herein again.
Wherein, the gap degree determining module 102 includes: a parameter determination unit 1021, a first gap degree determination unit 1022, and a second gap degree determination unit 1023;
a parameter determining unit 1021, configured to determine a frame gap measurement parameter according to the inter-frame rate distortion cost and the intra-frame rate distortion cost;
a first gap determining unit 1022, configured to determine the inter-frame gap as a first inter-frame gap when the frame gap measurement parameter is greater than the frame gap measurement threshold;
the second gap degree determining unit 1023 is used for determining the gap degree between frames as the second gap degree between frames when the gap degree between frames is less than or equal to the frame gap measurement threshold.
For a detailed function implementation manner of the parameter determining unit 1021, the first gap degree determining unit 1022, and the second gap degree determining unit 1023, please refer to step S102 in the corresponding embodiment of fig. 3, which is not described herein again.
The complexity determining module 103 includes: a first complexity determination unit 1031 and a second complexity determination unit 1032;
a first complexity determining unit 1031, configured to determine the complexity of the image frame as a first complexity of the image frame when the inter-frame rate distortion cost is greater than a cost measurement threshold;
the second complexity determining unit 1032 is configured to determine the image frame complexity as the second image frame complexity when the inter-frame rate distortion cost is less than or equal to the cost measurement threshold.
For specific functional implementation manners of the first complexity determining unit 1031 and the second complexity determining unit 1032, please refer to step S103 in the embodiment corresponding to fig. 3, which is not described herein again.
Wherein, above-mentioned device 1 still includes: a first unit obtaining module 105, a unit cost obtaining module 106, a threshold determining module 107 and a first unit strategy determining module 108;
a first unit obtaining module 105, configured to obtain a coding unit included in a target image frame when it is determined that a coding policy for the target image frame is an inter-frame coding policy;
a unit cost obtaining module 106, configured to obtain a rate distortion cost between unit frames and a rate distortion cost within a unit frame for the coding unit;
a threshold determining module 107, configured to obtain a cost measurement parameter, and determine a cost measurement threshold according to the cost measurement parameter and the rate distortion cost in the unit frame;
a first unit strategy determining module 108, 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 a cost measure threshold.
For specific functional implementation manners of the first unit obtaining module 105, the unit cost obtaining module 106, the threshold determining module 107, and the first unit policy determining module 108, please refer to step S104 in the corresponding embodiment of fig. 3, which is not described herein again.
Wherein, above-mentioned device 1 still includes: a second unit obtaining module 109 and a second unit policy determining module 110;
a second unit obtaining module 109, configured to obtain a coding unit included in the target image frame when it is determined that the coding policy for the target image frame is an intra-frame coding policy;
a second unit strategy determination module 110, configured to determine that the coding strategy for the coding unit is an intra-frame coding strategy.
For specific functional implementation manners of the second unit obtaining module 109 and the second unit policy determining module 110, please refer to step S104 in the corresponding embodiment of fig. 3, which is not described herein again.
The cost obtaining module 101 includes: an intra-frame parameter acquisition unit 1011 and an intra-frame cost determination unit 1012;
an intra-frame parameter obtaining unit 1011, configured to obtain an intra-frame prediction distortion factor for a target image frame, and obtain an intra-frame prediction code rate for the target image frame;
an intra cost determination unit 1012, configured to determine an intra rate distortion cost for the target image frame according to the intra prediction distortion degree and the intra prediction code rate.
For a specific implementation manner of functions of the intra-frame parameter obtaining unit 1011 and the intra-frame cost determining unit 1012, please refer to step S101 in the corresponding embodiment of fig. 3, which is not described herein again.
The cost obtaining module 101 includes: an inter-frame parameter acquisition unit 1013 and an inter-frame cost determination unit 1014;
an inter-frame parameter obtaining unit 1013, configured to obtain an inter-frame prediction distortion degree for a target image frame, and obtain an inter-frame prediction code rate for the target image frame;
and an inter-frame cost determining unit 1014, configured to determine an 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.
For a specific implementation manner of functions of the inter-frame parameter obtaining unit 1013 and the inter-frame cost determining unit 1014, please refer to step S101 in the corresponding embodiment of fig. 3, which is not described herein again.
The cost obtaining module 101 includes: a video acquisition unit 1015, a framing unit 1016, and an image frame determination unit 1017;
a video acquisition unit 1015 for acquiring video data;
a framing unit 1016, configured to frame the video data to obtain at least two image frames included in the video data;
an image frame determining unit 1017 for determining a target image frame from the at least two image frames.
For a specific functional implementation manner of the video obtaining unit 1015, the framing unit 1016, and the image frame determining unit 1017, please refer to step S101 in the embodiment corresponding to fig. 3, which is not repeated herein.
Wherein, above-mentioned device 1 still includes: an encoding module 111 and a decoding module 112;
the encoding module 111 is configured to encode the video data based on the determined encoding policy for the target image frame to obtain encoded data of the video data;
the decoding module 112 is configured to synchronize the encoded data to the video client, so that the video client decodes the encoded data to obtain decoded data of the video data, and plays the decoded data.
Please refer to step S104 in the embodiment corresponding to fig. 3 for a specific implementation manner of functions of the encoding module 111 and the decoding module 112, which is not described herein again.
The method and the device can acquire the target image frame, acquire the intra-frame rate distortion cost aiming at the target image frame and acquire the inter-frame rate distortion cost aiming at the target image frame; determining inter-frame distance degree between a 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 the complexity of an image frame aiming at a target image frame according to the rate distortion cost between frames; determining a coding strategy aiming at a target image frame according to the complexity of the image frame and the difference between frames; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy. Therefore, the device provided by the application can obtain the inter-frame difference degree between the target image frame and the adjacent image frame and 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, and the inter-frame difference degree and the image frame complexity can be used for judging whether the target image frame is an image frame of scene conversion or not so as to determine the encoding strategy for the target image frame. Because the time consumption for executing the interframe coding strategy on the target image frame is more than that for executing the intraframe coding strategy, the coding speed of the target image frame can be improved by judging whether the interframe coding strategy or the intraframe coding strategy is executed on the target image frame in the self-adaptive mode.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a computer device provided in the present application. As shown in fig. 10, the computer device 1000 may include: the processor 1001, the network interface 1004, and the memory 1005, and the computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., 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. The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 10, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the computer device 1000 shown in fig. 10, the network interface 1004 may provide a network communication function; the user interface 1003 is an interface for providing a user with input; and the processor 1001 may be configured to invoke a device control application stored in the memory 1005 to implement the description of the data encoding method in the corresponding embodiment of fig. 3 above. It should be understood that the computer device 1000 described in this application can also perform the description of the data encoding apparatus 1 in the embodiment corresponding to fig. 9, and the description thereof is omitted here. In addition, the beneficial effects of the same method are not described in detail.
Furthermore, it is to be noted here that: the present application further provides a computer readable storage medium, and the computer readable storage medium stores the aforementioned computer program executed by the data encoding apparatus 1, and the computer program includes program instructions, when the processor executes the program instructions, the description of the data encoding method in the embodiment corresponding to fig. 3 can be performed, and therefore, the description will not be repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in the embodiments of the computer storage medium referred to in the present application, reference is made to the description of the embodiments of the method of the present application.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto but rather by the claims appended hereto.

Claims (15)

1. A method of encoding data, comprising:
acquiring a target image frame, acquiring an intra-frame rate distortion cost aiming at the target image frame, and acquiring an inter-frame rate distortion cost aiming at the target image frame;
determining inter-frame distance difference 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 the image frame complexity aiming at the target image frame according to the interframe rate distortion cost;
determining an encoding strategy for the target image frame according to the image frame complexity and the inter-frame distance; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.
2. The method according to claim 1, wherein the inter-frame difference is a first inter-frame difference or a second inter-frame difference; 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;
the determining a coding strategy for the target image frame according to the image frame complexity and the inter-frame distance comprises:
when the image frame complexity is the first image frame complexity and the inter-frame difference is the first inter-frame difference, determining that the encoding strategy for the target image frame is the intra-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, determining that the encoding strategy for the target image frame is the inter-frame encoding strategy.
3. The method of claim 2, wherein determining the inter-frame distance measure 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 comprises:
determining a frame gap measurement parameter according to the interframe rate distortion cost and the intraframe rate distortion cost;
when the frame gap measurement parameter is larger than a frame gap measurement threshold value, determining the inter-frame gap as the first inter-frame gap;
when the inter-frame distance difference is smaller than or equal to the frame distance difference measurement threshold, determining the inter-frame distance difference as the second inter-frame distance difference.
4. The method of claim 2, wherein the determining an image frame complexity for the target image frame from the inter-frame rate distortion cost comprises:
when the inter-frame rate distortion cost is larger than a cost measurement threshold value, determining the image frame complexity as the first image frame complexity;
when the inter-frame rate distortion cost is less than or equal to the cost measurement threshold, determining the image frame complexity as the second image frame complexity.
5. The method of claim 1, further comprising:
when the encoding strategy aiming at the target image frame is determined to be the inter-frame encoding strategy, acquiring an encoding unit included in the target image frame;
acquiring a rate distortion cost between unit frames and a rate distortion cost in the unit frames aiming at the coding unit;
acquiring a cost measurement parameter, and determining a cost measurement threshold according to the cost measurement parameter and the rate distortion cost in the unit frame;
when the inter-frame rate distortion cost is greater than the cost measurement threshold, determining the encoding strategy for the encoding unit as the intra-frame encoding strategy.
6. The method of claim 1, further comprising:
when the encoding strategy aiming at the target image frame is determined to be the intra-frame encoding strategy, acquiring an encoding unit included in the target image frame;
determining a coding policy for the coding unit as the intra-coding policy.
7. The method of claim 1, wherein obtaining the intra rate-distortion cost for the target image frame comprises:
obtaining an intra-frame prediction distortion degree aiming at the target image frame, and obtaining an intra-frame prediction code rate aiming at the target image frame;
and determining the intra-frame rate distortion cost aiming at the target image frame according to the intra-frame prediction distortion degree and the intra-frame prediction code rate.
8. The method of claim 1, wherein obtaining the inter-frame rate-distortion cost for the target image frame comprises:
acquiring an inter-frame prediction distortion degree aiming at the target image frame, and acquiring an inter-frame prediction code rate aiming at the target image frame;
and determining the inter-frame rate distortion cost aiming at the target image frame according to the inter-frame prediction distortion degree and the inter-frame prediction code rate.
9. The method according to any one of claims 1-8, wherein the acquiring a target image frame comprises:
acquiring video data;
framing the video data to obtain at least two image frames included in the video data;
determining the target image frame from the at least two image frames.
10. The method of claim 9, further comprising:
encoding the video data based on the determined encoding strategy aiming at the target image frame to obtain encoded data of the video data;
and synchronizing the coded data to a video client so that the video client decodes the coded data to obtain decoded data of the video data, and playing the decoded data.
11. A data encoding apparatus, comprising:
the cost acquisition module is used for acquiring a target image frame, acquiring intra-frame rate distortion cost aiming at the target image frame and acquiring inter-frame rate distortion cost aiming at the target image frame;
a difference degree determining module, configured to determine a 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;
the complexity determining module is used for determining the image frame complexity aiming at the target image frame according to the interframe rate distortion cost;
a strategy determining module, configured to determine an encoding strategy for the target image frame according to the image frame complexity and the inter-frame distance; the encoding strategy is an inter-frame encoding strategy or an intra-frame encoding strategy.
12. The apparatus of claim 11, wherein the inter-frame difference is a first inter-frame difference or a second inter-frame difference; 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;
a policy determination module comprising:
a first policy determination unit, configured to determine that a coding policy for the target image frame is the intra-frame coding policy when the image frame complexity is the first image frame complexity and the inter-frame difference is the first inter-frame difference;
a second policy determining unit, configured to determine that the encoding policy for the target image frame is the inter-frame encoding policy when the image frame complexity is the second image frame complexity or the inter-frame difference degree is the second inter-frame difference degree.
13. The apparatus of claim 12, wherein the gap level determination module comprises:
a parameter determining unit, configured to determine a frame gap measurement parameter according to the inter-frame rate distortion cost and the intra-frame rate distortion cost;
a first gap determining unit, configured to determine the inter-frame gap as the first inter-frame gap when the frame gap measurement parameter is greater than a frame gap measurement threshold;
a second gap degree determining unit, configured to determine the inter-frame gap degree as the second inter-frame gap degree when the inter-frame gap degree is smaller than or equal to the frame gap measurement threshold.
14. A computer arrangement comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to carry out the steps of the method according to any one of claims 1-10.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the method of any of claims 1-10.
CN202011221654.9A 2020-11-05 2020-11-05 Data encoding method and device, storage medium and computer equipment Pending CN114449284A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011221654.9A CN114449284A (en) 2020-11-05 2020-11-05 Data encoding method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011221654.9A CN114449284A (en) 2020-11-05 2020-11-05 Data encoding method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN114449284A true CN114449284A (en) 2022-05-06

Family

ID=81360892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011221654.9A Pending CN114449284A (en) 2020-11-05 2020-11-05 Data encoding method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN114449284A (en)

Similar Documents

Publication Publication Date Title
KR102343668B1 (en) Video encoding method, decoding method and terminal
US8724704B2 (en) Apparatus and method for motion estimation and image processing apparatus
CN112533059B (en) Image rendering method and device, electronic equipment and storage medium
CN112351285B (en) Video encoding method, video decoding method, video encoding device, video decoding device, electronic equipment and storage medium
WO2021238546A1 (en) Video encoding method, video playing back method, related devices and medium
WO2023142716A1 (en) Encoding method and apparatus, real-time communication method and apparatus, device, and storage medium
US20230023369A1 (en) Video processing method, video processing apparatus, smart device, and storage medium
CN116546210A (en) Live broadcast data processing method, device, computer equipment and storage medium
RU2660619C1 (en) Method of encoding video with prediction of movement, device for encoding video with prediction of motion, program of encoding video with prediction of movement, method of decoding video with prediction of motion, device for decoding video with prediction of movement and program of decoding video with prediction of movement
CN117459733A (en) Video encoding method, apparatus, device, readable storage medium, and program product
WO2022100645A1 (en) Data coding method and apparatus, and computer readable storage medium
CN114449284A (en) Data encoding method and device, storage medium and computer equipment
CN115941972A (en) Image transmission method, device, equipment and storage medium
CN116489385A (en) Video encoding method, decoding method, device, electronic equipment and storage medium
US20130223525A1 (en) Pixel patch collection for prediction in video coding system
CN115514960A (en) Video coding method and device, electronic equipment and storage medium
CN116993572A (en) Image processing method, device, electronic equipment and storage medium
CN116567242A (en) Image processing method, device and equipment
CN111193926B (en) Encoded data processing method, apparatus, computer device and storage medium
US9451288B2 (en) Inferred key frames for fast initiation of video coding sessions
CN113542737A (en) Encoding mode determining method and device, electronic equipment and storage medium
CN117354524B (en) Method, device, equipment and computer medium for testing coding performance of encoder
CN103974093A (en) Method and system for processing streaming media
KR20240046575A (en) Video encoding methods and apparatus, electronic devices, and storage media
KR101158723B1 (en) System and method for fast game pictures encoder based on scene descriptor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination