Frame type determination method, device, electronic device and storage medium

By calculating the encoding feature parameters of video frames and determining the threshold value to determine the frame type, the problem of difficulty in taking into account the efficiency and accuracy of the P frame judgment method in the prior art is solved, and a better video encoding effect is achieved.

CN119363979BActive Publication Date: 2025-04-11MOORE THREADS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411896558.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-11
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

In the prior art, P frame judgment methods are difficult to take into account both efficiency and accuracy, resulting in poor encoding effects.

Method used

By calculating the encoding characteristic parameters of the video frame, determining the threshold value, and determining the frame type based on the threshold value, ensuring the efficiency and accuracy of the frame type determination.

Benefits of technology

Improve the accuracy and efficiency of frame type determination and optimize the video encoding effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119363979B_ABST
    Figure CN119363979B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of video coding and decoding, and proposes a frame type determination method, device, electronic device and storage medium. The method includes: when the type of the current video frame is unknown, according to the position of the current video frame in multiple video frames of unknown type included in the video frame sequence and a preset reference relationship, the encoding statistical information of the current video frame is calculated, and the encoding feature parameters of the current video frame are calculated according to the encoding statistical information; according to the position and the encoding feature parameters, a threshold is determined; according to the position, the encoding feature parameters and the threshold, whether the current video frame meets the frame type judgment condition; when the frame type judgment condition is met, the current video frame is determined to be a P frame, otherwise the current video frame is determined to be a B frame. The encoding feature parameters proposed by the frame type determination method of the embodiment of the present disclosure characterize the encoding features of the current video frame more accurately, and can improve the accuracy of frame type determination while ensuring that the frame type determination has high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of video coding and decoding, and in particular to a frame type determination method, device, electronic device and storage medium. Background Art

[0002] The amount of data in a video frame sequence is very large. In order to reduce transmission power consumption and storage costs, the video frame sequence is usually encoded before transmission or storage. In order to obtain a better encoding effect, it is necessary to first determine the type of each video frame in the video frame sequence. Different types of video frames can be encoded in different ways. Video frames can be divided into three types: intra coded picture, forward predictive coded frame, and bi-directional predictive interpolation coded frame.

[0003] Among them, intra-frame coded frames are also called I frames, forward predictive coded frames are also called P frames, and bidirectional predictive interpolation coded frames are also called B frames. I frames refer to video frames that have scene switching with the previous frame (the content of the frame changes significantly). After being encoded, I frames still retain complete data and can be decoded independently without referring to other video frames. Therefore, the encoding method of I frames is intra-frame coding. P frames need to refer to the data of the previous video frame to complete encoding, and also need to refer to the encoding result of the previous video frame when decoding. Therefore, the encoding method of P frames is forward predictive coding. B frames need to refer to the data of the previous video frame and the next video frame to complete encoding. Also need to refer to the encoding results of the previous video frame and the next video frame when decoding. Therefore, the encoding method of B frames is bidirectional predictive interpolation coding. Usually, I frames are determined first, and then P frames are determined from the remaining frames, and finally B frames are left. Obviously, the accuracy of P frame determination directly affects the accuracy of B frame determination. Therefore, the higher the accuracy of P frame determination, the better the video encoding effect.

[0004] The P frame determination method proposed in the prior art is difficult to strike a balance between efficiency and accuracy. How to ensure high efficiency in determining the frame type while improving the accuracy of determining the frame type and optimizing the encoding effect has become a technical problem that needs to be solved urgently in this field. Summary of the invention

[0005] In view of this, the present disclosure proposes a frame type determination method, device, electronic device and storage medium. The coding feature parameters proposed by the frame type determination method of the embodiment of the present disclosure more accurately characterize the coding features of the current video frame, and can improve the accuracy of frame type determination while ensuring high efficiency of frame type determination, thereby achieving better coding effect.

[0006] According to one aspect of the present disclosure, a frame type determination method is provided, the method being used to determine the type of a video frame in a video frame sequence, the method comprising: when the type of a current video frame is unknown, calculating a coding feature parameter of the current video frame according to the position of the current video frame in a plurality of video frames of unknown type included in the video frame sequence; determining a threshold for determining the type of the current video frame according to the position and the coding feature parameter; determining whether the current video frame satisfies a frame type determination condition according to the position, the coding feature parameter and the threshold; determining that the current video frame is a forward prediction coding frame when the frame type determination condition is met, and determining that the current video frame is a forward prediction coding frame when the frame type determination condition is not met When the condition occurs, it is determined that the current video frame is a bidirectional predictive interpolation coded frame; wherein, when the current video frame is the first video frame of a plurality of video frames of unknown type included in a video frame sequence, the coding feature parameters include at least a first coding block ratio, and when the current video frame is the jth video frame of a plurality of video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the coding feature parameters include at least a first coding block ratio and a referenceability of a first reference frame, the first coding block ratio indicating a scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicating a reference value of using the first reference frame as a reference frame for the current video frame compared to using the second reference frame.

[0007] In a possible implementation, when the current video frame is the jth video frame of a plurality of video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the threshold includes a first reference degree threshold for comparison with the reference degree of the first reference frame, each video frame includes a plurality of coding blocks, and the coding feature parameters also include a first block-level coding cost, the first block-level coding cost indicates an average coding cost of each coding block when the current video frame is encoded in an intra-frame coding manner, and determining the threshold for judging the type of the current video frame based on the position and the coding feature parameters includes: determining the level of the first block-level coding cost; obtaining a first numerical value based on a basic threshold corresponding to the level of the first block-level coding cost, and determining a second reference degree threshold based on the first numerical value, wherein different levels of first block-level coding costs correspond to different basic thresholds; and determining the first reference degree threshold based on the second reference degree threshold.

[0008] In a possible implementation, the first numerical value is obtained according to the basic threshold corresponding to the level of the first block-level coding cost, including: selecting a first weight corresponding to the type of encoder according to the type; and multiplying the basic threshold corresponding to the level of the first block-level coding cost by the first weight to obtain the first numerical value.

[0009] In a possible implementation, determining the first reference threshold according to the second reference threshold includes: determining the first reference threshold according to a larger one of the second reference threshold and a preset third reference threshold.

[0010] In one possible implementation, the first reference threshold is determined based on the larger one of the second reference threshold and a preset third reference threshold, including: when the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the larger one of the second reference threshold and the preset third reference threshold is increased by M times to obtain the first reference threshold, where M is a number greater than 1.

[0011] In a possible implementation, the coding feature parameters also include a second block-level coding cost, a resolution, and a degree of inter-frame motion, wherein the second block-level coding cost indicates an average value of the coding costs of each coding block when the current video frame is encoded with reference to the second reference frame, the resolution indicates the resolution of the current video frame, and the degree of inter-frame motion is equal to the ratio of the first block-level coding cost to the second block-level coding cost, and determining the second reference degree threshold based on the first numerical value includes: determining the level of the second block-level coding cost, the level of the resolution, and the level of the degree of inter-frame motion; multiplying the first numerical value with at least one of a second weight corresponding to the level of the second block-level coding cost, a third weight corresponding to the level of the resolution, and a fourth weight corresponding to the level of the degree of inter-frame motion to obtain a second numerical value, wherein different levels of second block-level coding costs correspond to different second weights, different levels of resolutions correspond to different third weights, and different levels of inter-frame motion degrees correspond to different fourth weights; determining the second reference degree threshold based on the second numerical value.

[0012] In one possible implementation, determining the second reference threshold based on the second numerical value includes: when the level of the second block-level coding cost is the lowest level, multiplying the second numerical value and a preset fifth weight to obtain a third numerical value, and determining the second reference threshold based on the third numerical value.

[0013] In a possible implementation, the coding feature parameters also include a second coding block ratio, where the second coding block ratio indicates the scene difference between the current video frame and the second reference frame, and determining the second reference degree threshold based on the third value includes: when the second coding block ratio is greater than a preset first ratio threshold, multiplying the third value and a preset sixth weight to obtain a fourth value, and determining the second reference degree threshold based on the fourth value.

[0014] In one possible implementation, the threshold includes a second proportion threshold for comparison with the proportion of the first coding block, and when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a fifth value; when the current video frame is the second video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a sixth value; when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a seventh value, where i is an integer greater than 2; the fifth value is greater than the sixth value, and the sixth value is greater than the seventh value.

[0015] In a possible implementation, the threshold also includes a second proportion threshold for comparison with the proportion of the first coding block, and the frame type judgment condition includes a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the reference degree of the first reference frame is greater than the first reference degree threshold; when the frame type judgment condition only includes the first sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition.

[0016] In a possible implementation, the coding feature parameters also include a first identifier and a second block-level coding cost, the second block-level coding cost indicates the average coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the first identifier is in a first state when the second block-level coding cost is greater than or equal to a first cost threshold, and the first identifier is in a second state when the second block-level coding cost is less than the first cost threshold, the frame type judgment condition also includes a second sub-condition, the second sub-condition is that the first identifier is in the first state; when the frame type judgment condition only includes the first sub-condition and the second sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition.

[0017] In a possible implementation, when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, the encoding feature parameters also include block-level motion displacement, and the block-level motion displacement indicates the degree of motion of the encoding block that moves when the current video frame refers to the second reference frame, and the frame type judgment condition also includes a third sub-condition, and the third sub-condition is that the block-level motion displacement is greater than a preset first displacement threshold; when the frame type judgment condition only includes the first sub-condition, the second sub-condition, and the third sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition, or satisfies the third sub-condition.

[0018] In a possible implementation, the coding feature parameter also includes a second identifier, which indicates whether to control the number of consecutive bidirectional predictive interpolation coding frames in the video frame sequence. When the second identifier is in the first state, it indicates that the number is not controlled, and when the second identifier is in the second state, it indicates that the number is controlled to be an odd number. The frame type judgment condition also includes a fourth sub-condition, and the fourth sub-condition is that the second identifier is in the first state, or the second identifier is in the second state and i is an even number. When the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition, the second sub-condition, the fourth sub-condition, or satisfies the third sub-condition and the fourth sub-condition.

[0019] In a possible implementation, the encoding feature parameters also include the number of continuous frames of extremely slow motion, and the number of continuous frames of extremely slow motion indicates the degree of scene motion between the current video frame and at least one forward video frame. When the current video frame does not satisfy the fourth sub-condition, or does not satisfy any one of the first sub-condition and the second sub-condition, and does not satisfy the third sub-condition, the frame type judgment condition also includes a fifth sub-condition, and the fifth sub-condition is that the number of continuous frames of extremely slow motion is greater than or equal to a preset first frame number threshold, and the level of the first block-level encoding cost is greater than or equal to a first preset level; when the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, and the fifth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the fifth sub-condition.

[0020] In a possible implementation, the coding feature parameters further include a second block-level coding cost, a third block-level coding cost, and a fourth block-level coding cost, wherein the second block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the third block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the first reference frame, and the fourth block-level coding cost is equal to the second block-level coding cost of a previous video frame of the current video frame. When the current video frame does not meet the fifth sub-condition, the frame type judgment condition further includes a sixth sub-condition, and the sixth sub-condition is that the sum of the fourth block-level coding cost and the second block-level coding cost is less than the third block-level coding cost, and the difference between the fourth block-level coding cost and the second block-level coding cost is greater than a preset second cost threshold, and the third block-level coding cost is greater than the second cost threshold, and the level of the first block-level coding cost is less than the first preset level; when the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, when the current video frame meets the sixth sub-condition, the frame type judgment condition is met.

[0021] According to another aspect of the present disclosure, a frame type determination device is provided, the device is used to determine the type of a video frame in a video frame sequence, the device comprising: a first calculation module, used to calculate the encoding feature parameters of the current video frame according to the position of the current video frame in a plurality of video frames of unknown type included in the video frame sequence when the type of the current video frame is unknown; a first determination module, used to determine a threshold for determining the type of the current video frame according to the position and the encoding feature parameters; a first judgment module, used to determine whether the current video frame meets a frame type judgment condition according to the position, the encoding feature parameters and the threshold; a second determination module, used to determine whether the current video frame is a forward video frame when the frame type judgment condition is met. Predictive coding frame, when the frame type judgment condition is not met, determine that the current video frame is a bidirectional predictive interpolation coding frame; wherein, when the current video frame is the first video frame of a plurality of video frames of unknown type included in a video frame sequence, the coding feature parameters at least include a first coding block ratio, and when the current video frame is the jth video frame of a plurality of video frames of unknown type included in a video frame sequence, and j is an integer greater than 1, the coding feature parameters at least include a first coding block ratio and a reference degree of a first reference frame, wherein the first coding block ratio indicates a scene difference between the current video frame and the first reference frame, and the reference degree of the first reference frame indicates a reference value of using the first reference frame as a reference frame for the current video frame compared to using the second reference frame.

[0022] In a possible implementation, when the current video frame is the jth video frame of a plurality of video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the threshold includes a first reference degree threshold for comparison with the reference degree of the first reference frame, each video frame includes a plurality of coding blocks, and the coding feature parameters also include a first block-level coding cost, the first block-level coding cost indicates an average coding cost of each coding block when the current video frame is encoded in an intra-frame coding manner, and determining the threshold for judging the type of the current video frame based on the position and the coding feature parameters includes: determining the level of the first block-level coding cost; obtaining a first numerical value based on a basic threshold corresponding to the level of the first block-level coding cost, and determining a second reference degree threshold based on the first numerical value, wherein different levels of first block-level coding costs correspond to different basic thresholds; and determining the first reference degree threshold based on the second reference degree threshold.

[0023] In a possible implementation, the first numerical value is obtained according to the basic threshold corresponding to the level of the first block-level coding cost, including: selecting a first weight corresponding to the type of encoder according to the type; and multiplying the basic threshold corresponding to the level of the first block-level coding cost by the first weight to obtain the first numerical value.

[0024] In a possible implementation, determining the first reference threshold according to the second reference threshold includes: determining the first reference threshold according to a larger one of the second reference threshold and a preset third reference threshold.

[0025] In one possible implementation, the first reference threshold is determined based on the larger one of the second reference threshold and a preset third reference threshold, including: when the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the larger one of the second reference threshold and the preset third reference threshold is increased by M times to obtain the first reference threshold, where M is a number greater than 1.

[0026] In a possible implementation, the coding feature parameters also include a second block-level coding cost, a resolution, and a degree of inter-frame motion, wherein the second block-level coding cost indicates an average value of the coding costs of each coding block when the current video frame is encoded with reference to the second reference frame, the resolution indicates the resolution of the current video frame, and the degree of inter-frame motion is equal to the ratio of the first block-level coding cost to the second block-level coding cost, and determining the second reference degree threshold based on the first numerical value includes: determining the level of the second block-level coding cost, the level of the resolution, and the level of the degree of inter-frame motion; multiplying the first numerical value with at least one of a second weight corresponding to the level of the second block-level coding cost, a third weight corresponding to the level of the resolution, and a fourth weight corresponding to the level of the degree of inter-frame motion to obtain a second numerical value, wherein different levels of second block-level coding costs correspond to different second weights, different levels of resolutions correspond to different third weights, and different levels of inter-frame motion degrees correspond to different fourth weights; determining the second reference degree threshold based on the second numerical value.

[0027] In one possible implementation, determining the second reference threshold based on the second numerical value includes: when the level of the second block-level coding cost is the lowest level, multiplying the second numerical value and a preset fifth weight to obtain a third numerical value, and determining the second reference threshold based on the third numerical value.

[0028] In a possible implementation, the coding feature parameters also include a second coding block ratio, where the second coding block ratio indicates the scene difference between the current video frame and the second reference frame, and determining the second reference degree threshold based on the third value includes: when the second coding block ratio is greater than a preset first ratio threshold, multiplying the third value and a preset sixth weight to obtain a fourth value, and determining the second reference degree threshold based on the fourth value.

[0029] In one possible implementation, the threshold includes a second proportion threshold for comparison with the proportion of the first coding block, and when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a fifth value; when the current video frame is the second video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a sixth value; when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a seventh value, where i is an integer greater than 2; the fifth value is greater than the sixth value, and the sixth value is greater than the seventh value.

[0030] In a possible implementation, the threshold also includes a second proportion threshold for comparison with the proportion of the first coding block, and the frame type judgment condition includes a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the reference degree of the first reference frame is greater than the first reference degree threshold; when the frame type judgment condition only includes the first sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition.

[0031] In a possible implementation, the coding feature parameters also include a first identifier and a second block-level coding cost, the second block-level coding cost indicates the average coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the first identifier is in a first state when the second block-level coding cost is greater than or equal to a first cost threshold, and the first identifier is in a second state when the second block-level coding cost is less than the first cost threshold, the frame type judgment condition also includes a second sub-condition, the second sub-condition is that the first identifier is in the first state; when the frame type judgment condition only includes the first sub-condition and the second sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition.

[0032] In a possible implementation, when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, the encoding feature parameters also include block-level motion displacement, and the block-level motion displacement indicates the degree of motion of the encoding block that moves when the current video frame refers to the second reference frame, and the frame type judgment condition also includes a third sub-condition, and the third sub-condition is that the block-level motion displacement is greater than a preset first displacement threshold; when the frame type judgment condition only includes the first sub-condition, the second sub-condition, and the third sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition, or satisfies the third sub-condition.

[0033] In a possible implementation, the coding feature parameter also includes a second identifier, which indicates whether to control the number of consecutive bidirectional predictive interpolation coding frames in the video frame sequence. When the second identifier is in the first state, it indicates that the number is not controlled, and when the second identifier is in the second state, it indicates that the number is controlled to be an odd number. The frame type judgment condition also includes a fourth sub-condition, and the fourth sub-condition is that the second identifier is in the first state, or the second identifier is in the second state and i is an even number. When the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition, the second sub-condition, the fourth sub-condition, or satisfies the third sub-condition and the fourth sub-condition.

[0034] In a possible implementation, the encoding feature parameters also include the number of continuous frames of extremely slow motion, and the number of continuous frames of extremely slow motion indicates the degree of scene motion between the current video frame and at least one forward video frame. When the current video frame does not satisfy the fourth sub-condition, or does not satisfy any one of the first sub-condition and the second sub-condition, and does not satisfy the third sub-condition, the frame type judgment condition also includes a fifth sub-condition, and the fifth sub-condition is that the number of continuous frames of extremely slow motion is greater than or equal to a preset first frame number threshold, and the level of the first block-level encoding cost is greater than or equal to a first preset level; when the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, and the fifth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the fifth sub-condition.

[0035] In a possible implementation, the coding feature parameters further include a second block-level coding cost, a third block-level coding cost, and a fourth block-level coding cost, wherein the second block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the third block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the first reference frame, and the fourth block-level coding cost is equal to the second block-level coding cost of a previous video frame of the current video frame. When the current video frame does not meet the fifth sub-condition, the frame type judgment condition further includes a sixth sub-condition, and the sixth sub-condition is that the sum of the fourth block-level coding cost and the second block-level coding cost is less than the third block-level coding cost, and the difference between the fourth block-level coding cost and the second block-level coding cost is greater than a preset second cost threshold, and the third block-level coding cost is greater than the second cost threshold, and the level of the first block-level coding cost is less than the first preset level; when the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, when the current video frame meets the sixth sub-condition, the frame type judgment condition is met.

[0036] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0037] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.

[0038] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0039] According to the frame type determination method of the embodiment of the present disclosure, by calculating the encoding feature parameters of the current video frame according to the position of the current video frame in multiple video frames of unknown types included in a video frame sequence when the type of the current video frame is unknown, the encoding features of the current video frame can be characterized; according to the position and the encoding feature parameters, a threshold for judging the type of the current video frame is determined, and according to the position, the encoding feature parameters and the threshold, it is judged whether the current video frame meets the frame type judgment condition; when the frame type judgment condition is met, the current video frame is determined to be a forward prediction coding frame, and when the frame type judgment condition is not met, the current video frame is determined to be a bidirectional prediction interpolation coding frame, thereby completing the type judgment of the current video frame. When the current video frame is the first video frame of a plurality of video frames of unknown type included in a video frame sequence, the coding feature parameter includes at least the first coding block ratio, and when the current video frame is the jth video frame of a plurality of video frames of unknown type included in a video frame sequence, and j is an integer greater than 1, the coding feature parameter includes at least the first coding block ratio and the referenceability of the first reference frame, the first coding block ratio indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as the reference frame of the current video frame compared with using the second reference frame. Since the referenceability of the first reference frame is a relative coding feature parameter, it can reflect the relative texture and motion changes of the video frame, so the referenceability of the first reference frame is more accurate in characterizing the coding features of the current video frame. On this basis, the accuracy of judging the frame type using the first coding block ratio and the referenceability of the first reference frame is also higher. And the method does not need to traverse the combination of different frame types, which can ensure a high efficiency in determining the frame type. To sum up, the coding feature parameters proposed by the frame type determination method of the embodiment of the present disclosure more accurately characterize the coding features of the current video frame, and can improve the accuracy of frame type determination while ensuring high efficiency, thereby achieving better coding effect.

[0040] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0042] Figure 1 An exemplary application scenario of the frame type determination method according to an embodiment of the present disclosure is shown.

[0043] Figure 2 An example of a video frame sequence according to an embodiment of the present disclosure is shown.

[0044] Figure 3A schematic diagram showing the process of the frame type determination method according to an embodiment of the present disclosure.

[0045] Figure 4 A schematic diagram showing reference relationships according to an embodiment of the present disclosure.

[0046] Figure 5 An example of a frame type determination condition according to an embodiment of the present disclosure is shown.

[0047] Figure 6 A schematic diagram showing the structure of a frame type determination device according to an embodiment of the present disclosure.

[0048] Figure 7 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0049] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0050] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0051] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0052] The following introduces the P frame determination method proposed in the prior art.

[0053] A P frame determination method proposed in the prior art is a frame combination full search algorithm, which starts from the most recently determined non-B frame (nonB, also known as P frame or I frame) and searches for all possible frame type combinations when the types of each video frame in the video frame sequence are P frame and B frame respectively. Taking the video frame sequence including 4 video frames as an example, possible frame type combinations include BBBB, BBBP, BBPB, BBPP, etc. Then, the sum of the encoding costs of each video frame under each frame type combination is calculated as the total encoding cost of the video frame sequence under the frame type combination. Finally, the total encoding costs under each frame type combination are compared, and the frame type combination with the smallest total encoding cost is the optimal frame type combination, and the type of each video frame under this frame type combination is used as the type of the final determined video frame.

[0054] The disadvantage of the frame combination full search algorithm is that there are too many frame type combinations that need to calculate the coding cost, and the calculation of the coding cost is very complicated, resulting in a large amount of calculation and a large delay in frame type judgment.

[0055] In order to speed up the judgment of frame types, the prior art proposes a single-frame fast judgment algorithm, which judges the type of video frames based on a preset threshold and the coding cost of the video frame. For example, the inter-frame coding cost of the current video frame is p_cost, the current video frame includes cu_count coding blocks, and the preset threshold is p_thresh. If p_cost>p_thresh×cu_count, it can be determined that the current video frame is a P frame, otherwise it is determined that the current video frame is a B frame. This method only uses one coding parameter and one threshold to judge the frame type, and the judgment accuracy is low, resulting in poor coding effect.

[0056] In summary, the P frame determination method proposed in the prior art is difficult to strike a balance between efficiency and accuracy. How to ensure high efficiency in determining the frame type while improving the accuracy of determining the frame type and optimizing the encoding effect has become a technical problem that needs to be urgently solved in this field.

[0057] In view of this, the present disclosure proposes a frame type determination method, device, electronic device and storage medium. The coding feature parameters proposed by the frame type determination method of the embodiment of the present disclosure more accurately characterize the coding features of the current video frame, and can improve the accuracy of frame type determination while ensuring high efficiency of frame type determination, thereby achieving better coding effect.

[0058] Furthermore, the frame type determination method disclosed in the present invention sets different levels for the numerical values ​​of the encoding feature parameters of the video frame, sets different thresholds or weights for the different levels, and selects the corresponding threshold or weight for judging the type of the current video frame according to the level of the encoding feature parameters of the current video frame, so that the threshold used in judging the type of the current video frame is more accurate, thereby improving the accuracy of determining the type of the video frame.

[0059] Furthermore, the frame type determination method disclosed in the present invention proposes a frame type judgment condition including multiple sub-conditions, and the sub-conditions can be adaptively increased or decreased according to the application scenario requirements, making the setting of the frame type judgment condition more flexible.

[0060] Figure 1 An exemplary application scenario of the frame type determination method according to an embodiment of the present disclosure is shown.

[0061] like Figure 1As shown, it is assumed that a video frame sequence stored on a first device needs to be transmitted to a second device. In this case, the first device can determine an I frame according to the prior art (for example, an I frame is determined for each video frame with a certain value interval, or an I frame is determined by detecting scene switching of adjacent video frames), and then execute the frame type determination method of the embodiment of the present disclosure to determine a P frame and a B frame.

[0062] Figure 2 An example of a video frame sequence according to an embodiment of the present disclosure is shown.

[0063] like Figure 2 As shown, it is assumed that the video frame sequence includes video frames 11 to 19 that are continuously captured. Video frame 11 is the video frame with the earliest position and the earliest capture time, and video frame 19 is the video frame with the latest position and the latest capture time. Among them, video frames 11 and 19 have been determined to be I frames, and video frames 12 to 18 are video frames of unknown type. Then, executing the frame type determination method disclosed in the present invention can determine whether video frames 12 to 18 are P frames or B frames.

[0064] The frame type determination method can be executed by a frame type determination device (not shown) of software, and the determined frame type is also output by the frame type determination device. After the type of each video frame is determined, the encoding order of the video frame can be determined according to a preset reference relationship to ensure that when each video frame is encoded, the video frame referenced by the video frame has been encoded and the video frame referenced by the video frame has not yet started encoding.

[0065] The first device can encode each video frame according to the determined encoding order. When encoding each video frame, it is encoded according to the encoding method corresponding to the type of the video frame. For example, the encoding method of the I frame is intra-frame encoding, the encoding method of the P frame is forward prediction encoding, and the encoding method of the B frame is bidirectional prediction interpolation encoding. When the first device encodes each video frame, it can encode it only once to achieve higher encoding efficiency, or it can perform pre-coding and formal encoding, and adjust the formal encoding process according to the result of pre-coding to achieve better encoding effect. The embodiment of the present disclosure does not limit this. Intra-frame coding, forward prediction coding, and bidirectional prediction interpolation coding can all be implemented based on existing technologies, and adjusting the formal encoding process according to the result of pre-coding can also be implemented based on existing technologies. The specific encoding process will not be repeated here.

[0066] The first device can transmit the encoded code stream and the reference relationship, type and other information of each video frame to the second device. After receiving the code stream, the second device can decode it according to the reference relationship, type and other information of each video frame, thereby restoring each video frame, and then reorder the video frames according to the acquisition order of the video frames themselves (such as recording by the video frame numbers) to restore the video frame sequence.

[0067] Figure 3 A schematic diagram showing the process of the frame type determination method according to an embodiment of the present disclosure.

[0068] like Figure 3 As shown, in a possible implementation manner, the method is used to determine the type of a video frame in a video frame sequence, and the method includes:

[0069] Step S31, when the type of the current video frame is unknown, calculating the encoding feature parameters of the current video frame according to the position of the current video frame in a plurality of video frames of unknown types included in the video frame sequence;

[0070] Step S32, determining a threshold for determining the type of the current video frame according to the position and the encoding feature parameters;

[0071] Step S33, judging whether the current video frame meets the frame type judgment condition according to the position, encoding feature parameters and threshold;

[0072] Step S34, when the frame type determination condition is met, determining that the current video frame is a forward prediction coding frame, and when the frame type determination condition is not met, determining that the current video frame is a bidirectional prediction interpolation coding frame.

[0073] Among them, when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the encoding feature parameters include at least the proportion of the first encoding block; when the current video frame is the j-th video frame among multiple video frames of unknown type included in the video frame sequence and j is an integer greater than 1, the encoding feature parameters include at least the proportion of the first encoding block and the referenceability of the first reference frame, the first encoding block proportion indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as a reference frame for the current video frame compared to using the second reference frame.

[0074] For example, the frame type determination method disclosed in the present invention is used to determine the type of a video frame of unknown type, that is, when the type of the current video frame is unknown, step S31 is executed to calculate the encoding feature parameters of the current video frame according to the position of the current video frame among multiple video frames of unknown type included in a video frame sequence.

[0075] The position of the current video frame in the multiple video frames of unknown type included in the video frame sequence may be the number of the multiple video frames of unknown type included in the video frame sequence that the current video frame is. The coding feature parameter may be used to characterize the coding features of the video frame. There are multiple calculable coding feature parameters. When the current video frame is at different positions in the multiple video frames of unknown type included in the video frame sequence, the types of coding feature parameters calculated in step S31 may be different.

[0076] Among them, when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the coding feature parameters include at least the proportion of the first coding block, and when the current video frame is the jth video frame among multiple video frames of unknown type included in the video frame sequence and j is an integer greater than 1, the coding feature parameters include at least the proportion of the first coding block and the referenceability of the first reference frame. The proportion of the first coding block indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as a reference frame for the current video frame compared to using the second reference frame. The selection method of the first reference frame and the second reference frame can be found in Figure 4 Related description.

[0077] An exemplary calculation method for the proportion of the first coding block and the reference availability of the first reference frame is given below.

[0078] For example, the current video frame may be intra-coded, and the current video frame may be inter-coded according to a preset reference relationship, and the coding statistical information of the current video frame may be counted, and then the coding feature parameters may be calculated based on the coding statistical information. The coding statistical information includes the frame-level coding cost of intra-coding the current video frame and the frame-level coding cost of inter-coding the current video frame according to a preset reference relationship. The preset reference relationship may be: the nearest non-B frame forward of the current video frame is used as the first reference frame, and the previous video frame of the current video frame is used as the second reference frame. For each reference frame, the corresponding frame-level coding cost is calculated respectively.

[0079] Figure 4 A schematic diagram showing reference relationships according to an embodiment of the present disclosure.

[0080] like Figure 4 As shown, it is assumed that the video frame sequence includes video frames 11 to 19 that are continuously captured. Video frame 11 is the video frame with the earliest position and the earliest capture time, and video frame 19 is the video frame with the latest position and the latest capture time. Among them, video frames 11 and 19 have been determined to be I frames, and video frames 12 to 18 are video frames of unknown type. Then executing the frame type determination method disclosed in the present invention can determine whether video frames 12 to 18 are P frames or B frames. When video frame 12 is the current video frame, the first reference frame and the second reference frame can be the same and be video frame 11; when video frame 13 is the current video frame, the first reference frame can be video frame 11, and the second reference frame can be video frame 12. The first reference frame and the second reference frame of the remaining video frames are no longer listed one by one.

[0081] An exemplary calculation method of frame-level coding cost is given below.

[0082] The current video frame may include multiple coding blocks, and each coding block may be intra-coded respectively, and the sum of the intra-coding costs of all coding blocks is used as the frame-level coding cost intra_cost for intra-coding the current video frame.

[0083] The first reference frame also includes multiple coding blocks. For each coding block of the current video frame, a matching coding block can be found in the first reference frame, and the coding block of the current video frame is inter-coded with reference to the matching coding block. The sum of the inter-coding costs of all coding blocks of the current video frame is used as the frame-level coding cost inter_cost_l1 for inter-coding the current video frame with reference to the first reference frame.

[0084] The second reference frame also includes multiple coding blocks. For each coding block of the current video frame, a matching coding block can be found in the second reference frame, and the coding block of the current video frame is inter-coded with reference to the matching coding block. The sum of the inter-coding costs of all coding blocks of the current video frame is used as the frame-level coding cost inter_cost_l0 for inter-coding the current video frame with reference to the second reference frame.

[0085] In practical applications, according to the user's requirements for coding efficiency and coding complexity, an intra-frame coding method and an inter-frame coding method that are suitable for the user's requirements can be selected from the existing intra-frame coding methods and inter-frame coding methods of the various coding blocks. The present disclosure does not limit the intra-frame coding method and inter-frame coding method specifically used by each coding block.

[0086] When the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the first reference frame and the second reference frame of the current video frame are the same video frame, so the reference value of using the second reference frame as the reference frame of the current video frame is the same as the reference value of using the first reference frame as the reference frame of the current video frame, and there is no need to calculate the referenceability of the first reference frame. When the current video frame is the second video frame or other subsequent video frames among multiple video frames of unknown type included in the video frame sequence, the first reference frame and the second reference frame of the current video frame are different video frames, so the reference value of using the second reference frame as the reference frame of the current video frame may also be different from the reference value of using the first reference frame as the reference frame of the current video frame. In this case, the referenceability of the first reference frame can be calculated as one of the encoding feature parameters of the current video frame.

[0087] The coding statistics information also includes the number of coding blocks with lower coding cost for intra-frame coding, num_intra_cu_l1_pk_intra. Since the coding cost of intra-frame coding for each coding block and the coding cost of inter-frame coding with reference to the matching coding block in the first reference frame have been calculated when calculating the frame-level coding cost of the current video frame, the above two coding costs corresponding to each coding block can be compared, and the number of coding blocks with lower coding cost for intra-frame coding, num_intra_cu_l1_pk_intra, can be counted. When the current video frame includes all_cu_count pixel blocks and each pixel block includes s×s pixels (s is a positive integer, for example, s=8), the first coding block ratio curr_ratio_intra_blk_l1 can be equal to the ratio of the number of coding blocks with lower intra-frame coding cost to the total number of pixel blocks, that is, curr_ratio_intra_blk_l1=num_intra_cu_l1_pk_intra / all_cu_count.

[0088] The size of the coding block may be the same as or different from the pixel block, and the present disclosure does not limit this. The sizes of coding blocks of different video frames may be different, and using the total number of pixel blocks to calculate the coding feature parameters can standardize the coding feature parameters of each video frame.

[0089] In this case, the larger the proportion of the first coding block, the larger the scene difference between the current video frame and the first reference frame. The smaller the proportion of the first coding block, the smaller the scene difference between the current video frame and the first reference frame. Thus, the proportion of the first coding block can indicate the scene difference between the current video frame and the first reference frame. In this way, the proportion of the first coding block indicating the scene difference between the current video frame and the first reference frame can be obtained.

[0090] The referenceability of the first reference frame curr_ratio_inter_satd_l1_l0 may be equal to the ratio of the coding cost inter_cost_l1 of the current video frame inter-coding with reference to the first reference frame to the coding cost inter_cost_l0 of the current video frame inter-coding with reference to the second reference frame. That is, curr_ratio_inter_satd_l1_l0=inter_cost_l1 / inter_cost_l0.

[0091] In this case, when the referenceability of the first reference frame is greater than 1, it means that the coding cost of inter-frame coding of the current video frame with reference to the first reference frame is greater than the coding cost of inter-frame coding with reference to the second reference frame. When the referenceability of the first reference frame is equal to 1, it means that the coding cost of inter-frame coding of the current video frame with reference to the first reference frame is equal to the coding cost of inter-frame coding with reference to the second reference frame. When the referenceability of the first reference frame is less than 1, it means that the coding cost of inter-frame coding of the current video frame with reference to the first reference frame is less than the coding cost of inter-frame coding with reference to the second reference frame. The larger the value of the referenceability of the first reference frame, the lower the reference value of using the first reference frame as the reference frame of the current video frame compared to using the second reference frame. In this way, the referenceability of the first reference frame indicating the reference value of using the first reference frame as the reference frame of the current video frame compared to using the second reference frame can be obtained.

[0092] Those skilled in the art should understand that there may be other ways to calculate the first coding block ratio and the referenceability of the first reference frame, as long as the first coding block ratio indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as the reference frame of the current video frame compared to using the second reference frame. The present disclosure does not limit the specific calculation method of the first coding block ratio and the referenceability of the first reference frame.

[0093] Those skilled in the art should understand that more coding feature parameters of the current video frame can be calculated. The present disclosure does not limit the types of coding feature parameters that can be calculated. Examples of other types of coding feature parameters are given below.

[0094] After obtaining the encoding feature parameters of the current video frame, step S32 may be performed to determine a threshold for determining the type of the current video frame according to the position of the current video frame in the plurality of video frames of unknown types included in the video frame sequence and the encoding feature parameters of the current video frame. The type of the threshold that can be determined is related to the position and the type of the encoding feature parameters, and the correlation relationship thereof is given later.

[0095] After determining the threshold value for judging the type of the current video frame, step S33 may be continued to be performed, and whether the current video frame meets the frame type judgment condition is judged according to the position of the current video frame in the multiple video frames of unknown type included in the video frame sequence, the encoding feature parameters of the current video frame, and the type of the current video frame. Among them, the position of the current video frame in the multiple video frames of unknown type included in the video frame sequence determines the specific content of the frame type judgment condition. The encoding feature parameters and the threshold value may be compared, and whether the current video frame meets the frame type judgment condition is judged according to the comparison result. The details of step S33 are given later.

[0096] When the current video frame meets the frame type determination condition, it can be determined that the current video frame is a P frame. When the current video frame does not meet the frame type determination condition, it can be determined that the current video frame is a B frame.

[0097] By analogy, each video frame of unknown type is used as the current video frame, and the type of each video frame of unknown type in the video frame sequence can be determined.

[0098] According to the frame type determination method of the embodiment of the present disclosure, by calculating the encoding feature parameters of the current video frame according to the position of the current video frame in multiple video frames of unknown types included in a video frame sequence when the type of the current video frame is unknown, the encoding features of the current video frame can be characterized; according to the position and the encoding feature parameters, a threshold for judging the type of the current video frame is determined, and according to the position, the encoding feature parameters and the threshold, it is judged whether the current video frame meets the frame type judgment condition; when the frame type judgment condition is met, the current video frame is determined to be a forward prediction coding frame, and when the frame type judgment condition is not met, the current video frame is determined to be a bidirectional prediction interpolation coding frame, thereby completing the type judgment of the current video frame. When the current video frame is the first video frame of a plurality of video frames of unknown type included in a video frame sequence, the coding feature parameter includes at least the first coding block ratio, and when the current video frame is the jth video frame of a plurality of video frames of unknown type included in a video frame sequence, and j is an integer greater than 1, the coding feature parameter includes at least the first coding block ratio and the referenceability of the first reference frame, the first coding block ratio indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as the reference frame of the current video frame compared with using the second reference frame. Since the referenceability of the first reference frame is a relative coding feature parameter, it can reflect the relative texture and motion changes of the video frame, so the referenceability of the first reference frame is more accurate in characterizing the coding features of the current video frame. On this basis, the accuracy of judging the frame type using the first coding block ratio and the referenceability of the first reference frame is also higher. And the method does not need to traverse the combination of different frame types, which can ensure a high efficiency in determining the frame type. To sum up, the coding feature parameters proposed by the frame type determination method of the embodiment of the present disclosure more accurately characterize the coding features of the current video frame, and can improve the accuracy of frame type determination while ensuring high efficiency, thereby achieving better coding effect.

[0099] The following first introduces examples of coding feature parameters and calculation methods that can be calculated in the present disclosure. Among them, the exemplary calculation method of the first coding block ratio and the reference degree of the first reference frame has been described above and will not be repeated here.

[0100] In a possible implementation, the encoding feature parameters of the current video frame include a first block-level encoding cost curr_cu_intra_cost. The first block-level encoding cost indicates the average encoding cost of each encoding block when the current video frame is encoded in an intra-frame encoding manner. For example, the first block-level encoding cost curr_cu_intra_cost may be equal to the ratio of the encoding cost intra_cost of the current video frame encoded in an intra-frame encoding manner to the total number of pixel blocks all_cu_count included in the current video frame, that is, curr_cu_intra_cost=intra_cost / all_cu_count.

[0101] In one possible implementation, the encoding feature parameters of the current video frame include a second block-level encoding cost curr_cu_inter_l0, which indicates an average encoding cost of each encoding block when the current video frame is encoded with reference to the second reference frame. For example, the second block-level encoding cost curr_cu_inter_l0 may be equal to the ratio of the encoding cost inter_cost_l0 for inter-frame encoding of the current video frame with reference to the second reference frame to the total number of pixel blocks all_cu_count included in the current video frame, that is, curr_cu_inter_l0=inter_cost_l0 / all_cu_count.

[0102] In a possible implementation, the coding feature parameters of the current video frame include a third block-level coding cost curr_cu_inter_l1, which indicates the average coding cost of each coding block when the current video frame is encoded with reference to the first reference frame. For example, the third block-level coding cost curr_cu_inter_l1 may be equal to the ratio of the coding cost inter_cost_l1 for inter-frame encoding of the current video frame with reference to the first reference frame to the total number of pixel blocks all_cu_count included in the current video frame, that is, curr_cu_inter_l1=inter_cost_l1 / all_cu_count.

[0103] In a possible implementation, the encoding feature parameters of the current video frame include a fourth block-level encoding cost prev_cu_inter_10. The fourth block-level encoding cost prev_cu_inter_10 is equal to the second block-level encoding cost of the previous video frame of the current video frame.

[0104] In one possible implementation, the encoding feature parameters of the current video frame include a first identifier flag_verylow_inter. When the second block-level encoding cost of the current video frame is greater than or equal to the first cost threshold inter_thresh_0, the first identifier is in the first state. When the second block-level encoding cost of the current video frame is less than the first cost threshold inter_thresh_0, the first identifier is in the second state.

[0105] Since the second block-level coding cost indicates the average coding cost of each coding block when the current video frame is encoded with reference to the second reference frame (previous video frame), if the second block-level coding cost of the current video frame is relatively large, greater than or equal to the first cost threshold, and the first identifier is in the first state, it can be considered that the texture difference between the current video frame and the second reference frame is large, and the scene motion between the current video frame and the second reference frame is fast. On the contrary, if the second block-level coding cost of the current video frame is relatively small, less than the first cost threshold, and the first identifier is in the second state, it can be considered that the texture difference between the current video frame and the second reference frame is small, the scene motion between the current video frame and the second reference frame is slow, and the current video frame belongs to a video frame with extremely slow motion.

[0106] The first cost threshold can be set according to application scenario requirements, for example, set to 80, and the present disclosure does not limit the specific value of the first cost threshold.

[0107] The first state of the first identifier can be represented by "0". The second state of the first identifier can be represented by "1". Those skilled in the art should understand that the first state and the second state of the first identifier can also be represented by other numerical values ​​or symbols, as long as the first state and the second state of the first identifier are different. The present disclosure does not limit the specific representation method of the first state and the second state of the first identifier.

[0108] In one possible implementation, the encoding feature parameters of the current video frame include a second identifier flag_even_adj, which indicates whether to control the number of consecutive B frames in the video frame sequence. When the second identifier is in the first state, it indicates that the number is not controlled; when the second identifier is in the second state, it indicates that the number is controlled to be an odd number.

[0109] Each P frame and all the consecutive B frames between the P frame and the nearest non-B frame in the forward direction form a group of pictures (Group Of Picture, GOP). When the image content of adjacent video frames changes very little, the parity of the number of frames included in the group of pictures has little effect on the encoding effect, and there is no need to control the number of consecutive B frames in the video frame sequence. When the image content of adjacent video frames changes greatly, the encoding effect of the group of pictures with an even number of frames is better, and the number of consecutive B frames in the video frame sequence can be controlled and made odd.

[0110] Therefore, when determining the frame type, it is possible to determine whether to control the number of consecutive B frames in the video frame sequence and adjust the state of the second identifier according to the level inter_cost_level of the second block-level coding cost and the level intra_cost_level of the first block-level coding cost of the current video frame. Exemplarily, when the level inter_cost_level of the second block-level coding cost is level 1 (inter_cost_level=1) and the level intra_cost_level of the first block-level coding cost is less than or equal to level 3 (intra_cost_level<=3), the state of the second identifier is adjusted to the second state, otherwise the state of the second identifier is adjusted to the first state.

[0111] An exemplary calculation method of the level of the second block-level coding cost and the level of the degree of inter-frame motion as well as the differences between different levels are given below.

[0112] The first state of the second identifier can be represented by "0". The second state of the second identifier can be represented by "1". Those skilled in the art should understand that the first state and the second state of the second identifier can also be represented by other numerical values ​​or symbols, as long as the first state and the second state of the second identifier are different. The present disclosure does not limit the specific representation method of the first state and the second state of the second identifier.

[0113] In a possible implementation, the encoding feature parameter of the current video frame includes a block-level motion displacement avg_mv_l0. The block-level motion displacement indicates the motion degree of the encoding block that moves when the current video frame refers to the second reference frame.

[0114] The coding statistics may also include the accumulated absolute displacement sum mvx_sum_l0 of all pixel blocks in the current video frame in the x direction, the accumulated absolute displacement sum mvy_sum_l0 in the y direction, and the number num_nzmv_l0 of pixel blocks with displacement in the x direction or in the y direction. In the process of calculating the coding cost of the current video frame for inter-frame coding (each coding block is coded in the inter-frame coding mode) with reference to the second reference frame, it is possible to determine which pixel block of the second reference frame each pixel block of the current video frame matches, and calculate the accumulated absolute displacement sum mvx_sum_l0 of all pixel blocks in the current video frame in the x direction according to the displacement mv_x of each pixel block of the current video frame and the matching pixel block in the x direction. According to the displacement mv_y of each pixel block of the current video frame and the matching pixel block in the y direction, calculate the accumulated absolute displacement sum mvy_sum_l0 of all pixel blocks in the current video frame in the y direction. The number of pixel blocks num_nzmv_l0 that have displacement in the x direction or the y direction of the current video frame can be counted, and the block-level motion displacement avg_mv_l0=(mvx_sum_l0 / num_nzmv_l0) 2 + (mvy_sum_l0 / num_nzmv_l0) 2 The larger the block-level motion displacement, the greater the degree of motion of the coding block that moves when the current video frame refers to the second reference frame. The smaller the block-level motion displacement, the smaller the degree of motion of the coding block that moves when the current video frame refers to the second reference frame.

[0115] In a possible implementation, the encoding feature parameter of the current video frame includes the number of continuous frames of extremely slow motion s_num_verylow_inter, and the number of continuous frames of extremely slow motion indicates the degree of scene motion between the current video frame and at least one video frame in the forward direction. The number of continuous frames of extremely slow motion can be determined according to the state of the second identifier of the current video frame and each video frame in the forward direction. In one example, if the second identifier of the current video frame is in the second state, the number of continuous frames of extremely slow motion of the current video frame can be increased by one based on the number of continuous frames of extremely slow motion of the previous video frame, and if the second identifier of the current video frame is in the first state, the number of continuous frames of extremely slow motion of the current video frame can be reset to 0. That is, when the number of continuous frames of extremely slow motion of the current video frame is not 0, it can indicate that the scene motion between the current video frame and at least one video frame in the forward direction is slow, and the current video frame belongs to a subsequence of extremely slow motion in the video frame sequence. When the number of continuous frames of extremely slow motion of the current video frame is 0, it may indicate that faster scene motion occurs between the current video frame and the previous video frame, and the current video frame does not belong to the extremely slow motion subsequence in the video frame sequence.

[0116] In a possible implementation, the encoding feature parameters of the current video frame include resolution. When encoding the current video frame, the video frame is usually downsampled, so the resolution can be the original resolution of the current video frame, that is, the total number of pixels of the current video frame, or the downsampled resolution of the current video frame, that is, the total number of pixels after the current video frame is downsampled. The downsampling ratio can be 1, 1 / 2, 1 / 4, etc. For example, when a downsampling ratio of 1 / 2 is used, the total number of pixels after downsampling is equal to the total number of pixels of the original video frame × 1 / 2 × 1 / 2. Common resolutions include 416×240, 640×360, 832×480, 1024×768, 1280×720, 1920×1080, 4K, 8K, etc.

[0117] In a possible implementation, the encoding feature parameters of the current video frame include a second encoding block ratio. The second encoding block ratio indicates the scene difference between the current video frame and the second reference frame. The calculation method of the second encoding block ratio is similar to the calculation method of the first encoding block ratio, and the encoding cost of the current video frame used for inter-frame encoding with reference to the first reference frame is replaced with the encoding cost of the current video frame used for inter-frame encoding with reference to the second reference frame. The larger the second encoding block ratio, the greater the scene difference between the current video frame and the second reference frame. The smaller the second encoding block ratio, the smaller the scene difference between the current video frame and the second reference frame.

[0118] In a possible implementation, the encoding feature parameters of the current video frame include the degree of inter-frame motion, and the degree of inter-frame motion of the current video frame is equal to the ratio of the first block-level encoding cost curr_cu_intra_cost of the current video frame to the second block-level encoding cost curr_cu_inter_l0 of the current video frame. Since the first block-level encoding cost curr_cu_intra_cost=intra_cost / all_cu_count, and the second block-level encoding cost curr_cu_inter_l0=inter_cost_l0 / all_cu_count, the degree of inter-frame motion is also equal to the ratio of the encoding cost intra_cost of the current video frame encoded in intra-frame encoding mode to the encoding cost inter_cost_l0 of the current video frame inter-frame encoding with reference to the second reference frame. The larger the value of the degree of inter-frame motion, the smaller the degree of inter-frame motion, and the smaller the value of the degree of inter-frame motion, the greater the degree of inter-frame motion.

[0119] Those skilled in the art should understand that the coding feature parameters should be more than the above examples, as long as they can reflect the coding features of the video frame, and the coding statistical information can also be used as the coding feature parameters. Through the diversified coding feature parameters, the coding feature parameters disclosed in the present invention can more finely characterize the coding features of the P frame and adapt to more extreme video frame sequences.

[0120] The following first introduces an example of a threshold value and a determination method determined according to encoding feature parameters in the present disclosure.

[0121] In a possible implementation, the threshold includes a second percentage threshold for comparison with the first coding block percentage.

[0122] When the current video frame is the first video frame of a plurality of video frames of unknown type included in the video frame sequence, the second proportion threshold is a fifth value;

[0123] When the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the second proportion threshold is a sixth value;

[0124] When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, the second proportion threshold is a seventh value, and i is an integer greater than 2;

[0125] The fifth value is greater than the sixth value, and the sixth value is greater than the seventh value.

[0126] For example, the proportion of the first coding block is one of the most important coding feature parameters. When the proportion of the first coding block is greater than a certain threshold, it means that the reference value of the first reference frame as a reference frame of the current video frame is very low, and the current video frame can be set as a new P frame.

[0127] It can be understood that the position of the current video frame among the multiple video frames of unknown type included in the video frame sequence indicates the distance between the current video frame and the first reference frame. The closer the current video frame is to the first reference frame, the smaller the proportion of the first coding block, and the farther the distance from the first reference frame, the larger the proportion of the first coding block. Therefore, in order to improve the accuracy of determining the frame type using the proportion of the first coding block, the numerical size of the second proportion threshold used for comparison with the proportion of the first coding block can be set according to the position of the current video frame among the multiple video frames of unknown type included in the video frame sequence.

[0128] For example, when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is the fifth value intra_ratio1; when the current video frame is the second video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is the sixth value intra_ratio2; when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is the seventh value intra_ratio, where i is an integer greater than 2; as long as the fifth value is greater than the sixth value, and the sixth value is greater than the seventh value, that is, intra_ratio1>intra_ratio2>intra_ratio, the value of the second proportion threshold can be adapted to the distance between the current video frame and the first reference frame.

[0129] Furthermore, since the type of encoder may affect the value of the first coding block ratio, the optional value of the second ratio threshold may be adjusted according to the type of coding block. The specific adjustment method may be implemented based on the existing technology and will not be described in detail here.

[0130] In a possible implementation, when the current video frame is the jth video frame of a plurality of video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the threshold comprises a first reference degree threshold for comparison with a reference degree of the first reference frame,

[0131] Each video frame includes multiple coding blocks, and the coding feature parameters also include a first block-level coding cost, which indicates the average coding cost of each coding block when the current video frame is encoded in an intra-frame coding mode.

[0132] According to the position and the encoding feature parameters, a threshold for judging the type of the current video frame is determined, including:

[0133] Determining a level of first block level coding cost;

[0134] Obtaining a first value according to a basic threshold value corresponding to the level of the first block-level coding cost, and determining a second reference threshold value according to the first value, wherein different levels of first block-level coding costs correspond to different basic threshold values;

[0135] The first reference degree threshold is determined according to the second reference degree threshold.

[0136] For example, see Figure 3As described in the related description, when the current video frame is the first video frame of a plurality of video frames of unknown type included in the video frame sequence, there is no need to calculate the referenceability of the first reference frame, and therefore, there is no need to determine the first reference degree threshold for comparison with the referenceability of the first reference frame. When the current video frame is the jth video frame of a plurality of video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the encoding feature parameter includes the referenceability of the first reference frame, and then the first reference degree threshold can be determined.

[0137] Each video frame includes multiple coding blocks, and the coding feature parameters also include a first block-level coding cost curr_cu_intra_cost, which indicates the average coding cost of each coding block when the current video frame is encoded in an intra-frame coding manner. Its exemplary calculation method has been described above and will not be repeated here. The first reference degree threshold can be determined according to the position of the current video frame in multiple video frames of unknown type included in the video frame sequence and the first block-level coding cost curr_cu_intra_cost.

[0138] First, the level of the first block-level coding cost of the current video frame can be determined. Exemplarily, the first block-level coding cost can be pre-divided into multiple numerical intervals according to the possible values ​​of the first block-level coding cost, each numerical interval corresponds to a level, and each level corresponds to a basic threshold. The basic thresholds corresponding to the first block-level coding costs of different levels are different. Table 1 takes 6 numerical intervals as an example to give examples of the numerical intervals, levels, and basic thresholds of the first block-level coding cost.

[0139] Table 1

[0140]

[0141] Taking the levels in Table 1 as an example, if the first block-level coding cost of the current video frame falls within the interval [1200, 1500), the level intra_cost_level of the first block-level coding cost of the current video frame may be level 4, and the corresponding basic threshold may be threshes_common=th4=2.1.

[0142] The more complex the texture of the current video frame is, the greater the first block-level encoding cost is, so the value of the basic threshold can be set to increase with the increase of the level.

[0143] Those skilled in the art should understand that the number of levels of the first block-level coding cost, the endpoints of each numerical interval, and the basic threshold corresponding to each level may also take other values, and the present disclosure does not impose any limitation on this.

[0144] According to the basic threshold corresponding to the level of the first block-level coding cost, a first value threshes_1 can be obtained. The basic threshold can be directly used as the first value (threshes_1=threshes_common), or the first value can be calculated using the basic threshold and other parameters. An exemplary calculation method is given below.

[0145] The second reference threshold thresh_2 can be determined according to the first value. The first value can be directly used as the second reference threshold (thresh_2=threshes_1), or the second reference threshold can be calculated using the first value and other parameters. An exemplary calculation method is given below.

[0146] The first reference threshold thresh_1 can be determined according to the second reference threshold. The second reference threshold can be directly used as the first reference threshold (thresh_1=thresh_2), or the first reference threshold can be calculated using the second reference threshold and other parameters. An exemplary calculation method is given below.

[0147] In this way, the basic threshold is more adapted to the first block-level coding cost, and the more levels there are, the better the adaptability of the basic threshold to the first block-level coding cost, and the higher the accuracy of the first reference threshold determined using the basic threshold.

[0148] An exemplary method of obtaining the first value according to the basic threshold and other parameters corresponding to the level of the first block-level coding cost is introduced below.

[0149] In a possible implementation, obtaining the first value according to a basic threshold corresponding to the level of the first block-level coding cost includes:

[0150] Selecting a first weight corresponding to the type according to the type of the encoder;

[0151] A first value is obtained by multiplying a basic threshold corresponding to the level of the first block-level coding cost by the first weight.

[0152] For example, there are many types of encoders, such as High Efficiency Video Coding (HEVC), Advanced Video Coding (AVC), and Open Media Video 1 (AV1). Different types of encoders have different encoding methods, which results in different values ​​of the first block-level encoding cost obtained by different encoders when performing intra-frame encoding on the same video frame.

[0153] Based on this, the first weight thresh_coff corresponding to each type of encoder can be pre-set according to the type of encoder, so that when the first block-level encoding cost obtained by a certain encoder is larger, the corresponding first weight is also larger. When determining the first value threshes_1 according to the basic threshold, the first weight corresponding to the type can be selected according to the type of encoder, and the basic threshold corresponding to the level of the first block-level encoding cost is multiplied by the first weight to obtain the first value. That is, threshes_1 =threshes_common×thresh_coff.

[0154] In this way, the influence of the encoder type on the encoding characteristic parameters is taken into account when determining the threshold. When targeting different encoders, the frame type determination method disclosed in the present invention is more portable, and more dimensional threshold adjustment methods can be used to adapt the threshold to the characteristics of different encoders, so that the code control effect can be optimized on any encoder.

[0155] An exemplary manner of determining the first reference degree threshold according to the second reference degree threshold and other parameters is described below.

[0156] In a possible implementation manner, determining the first reference degree threshold according to the second reference degree threshold includes:

[0157] The first reference degree threshold is determined according to a larger one of the second reference degree threshold and a preset third reference degree threshold.

[0158] For example, when the second reference threshold thresh_2 is relatively small, using the second reference threshold to determine the first reference threshold may reduce the accuracy of determining whether the current video frame meets the frame type determination condition. Therefore, the third reference threshold thresh_3 may be preset, for example, set to 1, and the first reference threshold is determined based on the larger one of the second reference threshold and the preset third reference threshold.

[0159] In this case, when the second reference degree threshold is smaller than the third reference degree threshold, the larger third reference degree threshold may be used to determine the first reference degree threshold, thereby improving the accuracy of the first reference degree threshold.

[0160] An exemplary manner of determining the first reference degree threshold according to the larger one of the second reference degree threshold and the preset third reference degree threshold is described below.

[0161] In a possible implementation, determining the first reference threshold according to a larger one of the second reference threshold and a preset third reference threshold includes:

[0162] When the current video frame is the second video frame of multiple video frames of unknown type included in the video frame sequence, the larger one of the second reference degree threshold and the preset third reference degree threshold is expanded M times to obtain the first reference degree threshold, where M is a number greater than 1.

[0163] It can be understood that the closer the distance between the current video frame and the first reference frame, the smaller the scene change between the current video frame and the first reference frame, and the higher the reference value of using the first reference frame as the reference frame of the current video frame. The farther the distance between the current video frame and the first reference frame, the greater the scene change between the current video frame and the first reference frame, and the lower the reference value of using the first reference frame as the reference frame of the current video frame. The referenceability of the first reference frame indicates the reference value of using the first reference frame as the reference frame of the current video frame compared with using the second reference frame. Therefore, even if the content of the current video frame and the first reference frame is fixed, the distance between the current video frame and the first reference frame will affect the value of the referenceability of the first reference frame, that is, the closer the distance between the current video frame and the first reference frame, the greater the referenceability of the first reference frame, and the farther the distance between the current video frame and the first reference frame, the smaller the referenceability of the first reference frame.

[0164] Since the first reference degree threshold is used for comparison with the reference degree of the first reference frame, the specific method of determining the first reference degree threshold according to the larger one of the second reference degree threshold and the preset third reference degree threshold can be determined according to the position of the current video frame in the multiple video frames of unknown type included in the video frame sequence. Since there is no need to determine the first reference degree threshold when the current video frame is the first video frame among the multiple video frames of unknown type included in the video frame sequence, it is only necessary to expand the larger one of the second reference degree threshold and the preset third reference degree threshold by M times when the current video frame is the second video frame among the multiple video frames of unknown type included in the video frame sequence to obtain the first reference degree threshold. At this time, the value of the first reference degree threshold can be the eighth value thresh2. The value of M can be set according to the application scenario requirements, for example, it is set to 2, and the present disclosure does not limit the specific value of M.

[0165] When the current video frame is the third or subsequent video frame among multiple video frames of unknown type included in the video frame sequence, the larger one of the second reference threshold and the preset third reference threshold can be directly used as the first reference threshold, or the corresponding second reference threshold magnification factor can be preset for each video frame, so that the second reference threshold magnification factor of the subsequent video frame is less than the second reference threshold magnification factor of the previous video frame. The present disclosure does not limit whether to magnify the second reference threshold and the specific magnification factor when the current video frame is the third or subsequent video frame among multiple video frames of unknown type included in the video frame sequence. At this time, the value of the first reference threshold can be the ninth value thresh3.

[0166] In this way, the calculation error of the first reference degree threshold can be reduced.

[0167] An exemplary method of calculating the second reference degree threshold according to the first value and other parameters is described below.

[0168] In a possible implementation, the coding feature parameters further include a second block-level coding cost, a resolution, and an inter-frame motion degree, wherein the second block-level coding cost indicates an average coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the resolution indicates a resolution of the current video frame, and the inter-frame motion degree is equal to a ratio of the first block-level coding cost to the second block-level coding cost.

[0169] Determining a second reference threshold according to the first value includes:

[0170] Determining a level of second block-level coding cost, a level of resolution, and a level of inter-frame motion;

[0171] The first value is multiplied by at least one of a second weight corresponding to the level of the second block-level coding cost, a third weight corresponding to the level of the resolution, and a fourth weight corresponding to the level of the inter-frame motion degree, to obtain a second value, wherein different levels of second block-level coding costs correspond to different second weights, different levels of resolutions correspond to different third weights, and different levels of inter-frame motion degrees correspond to different fourth weights;

[0172] A second reference degree threshold is determined according to the second value.

[0173] For example, as described above, the coding feature parameters also include a second block-level coding cost, a resolution, and an inter-frame motion degree, wherein the second block-level coding cost indicates an average value of the coding costs of each coding block when the current video frame is encoded with reference to the second reference frame, the resolution indicates the resolution of the current video frame, and the inter-frame motion degree is equal to the ratio of the first block-level coding cost to the second block-level coding cost. The exemplary calculation method of the second block-level coding cost, the resolution, and the inter-frame motion degree has been described above and will not be repeated here.

[0174] The second reference threshold may be determined according to the second block-level coding cost, the resolution, the inter-frame motion level and the first value. First, the level of the second block-level coding cost, the level of the resolution and the level of the inter-frame motion level may be determined.

[0175] Exemplarily, the second block-level coding cost can be pre-divided into a plurality of value intervals according to the possible values ​​of the second block-level coding cost, each value interval corresponds to a level, and each level corresponds to a second weight inter_satd_coff. Second block-level coding costs of different levels correspond to different second weights. Table 2 takes 6 value intervals as an example to give examples of the value intervals, levels, and second weights of the second block-level coding cost.

[0176] Table 2

[0177]

[0178] Different levels of second block-level coding costs correspond to different second weights. The larger the inter-frame coding cost inter_cost_l0 of the current video frame referring to the second reference frame, the faster the motion of the current video frame compared with the second reference frame. Frequently setting P frames is more beneficial to improving the coding effect. Therefore, the second weight can be set to a smaller value, for example, inter_coff[2]>inter_coff[3]>inter_coff[4]>inter_coff[5]>inter_coff[6]. However, when the motion of the current video frame compared with the second reference frame is very slow, in order to maintain the consistency of the quality of each frame and reduce the breathing effect, the length of the image group can also be kept short, for example, inter_coff[1]<inter_coff[2].

[0179] Taking the levels in Table 2 as an example, if the second block-level coding cost of the current video frame falls within the interval [1100, 1600), the level inter_cost_level of the second block-level coding cost of the current video frame may be level 5, and the corresponding second weight inter_satd_coff=inter_coff[5]=0.75.

[0180] Those skilled in the art should understand that the number of levels of the second block-level coding cost, the endpoints of each numerical interval, and the second weight corresponding to each level may also take other values, and the present disclosure does not limit this.

[0181] Exemplarily, the possible values ​​of the number of pixel blocks included in the image after the video frame is downsampled can be determined according to the possible values ​​of the resolution (resolution after downsampling) (each pixel block includes s×s pixels), and the number of pixel blocks is pre-divided into multiple value intervals, each value interval corresponds to a level, and each level corresponds to at least one resolution and a third weight res_coff. Different levels of resolution correspond to different third weights. Table 3 takes 6 value intervals, s=8, and a downsampling ratio of 1 / 2 as an example to give examples of the value intervals of the number of pixel blocks, the level of resolution, and the third weight.

[0182] Table 3

[0183]

[0184] Different levels of resolution correspond to different third weights. When the image content is the same, the greater the image resolution, the smaller the average intra-frame coding complexity and inter-frame coding complexity of each pixel block, so the third weight can be set to gradually decrease as the resolution increases.

[0185] Taking the levels in Table 3 as an example, if the original resolution of the current video frame is 1024×768 and the downsampling ratio is 1 / 2, the downsampled resolution may be 512×384. The number of 8×8 pixel blocks included in the downsampled image may be 64×48=3072, which falls within the interval [3000, 6000). The resolution level res_level of the current video frame may be level 3, and the corresponding third weight res_coff=res_coff[3]=1.02. The resolution level of the current video frame may be determined based on the original resolution of the current video frame and the downsampled resolution. The present disclosure does not limit the specific resolution used to determine the resolution level of the current video frame.

[0186] Those skilled in the art should understand that the number of resolution levels, the endpoints of each numerical interval, and the third weight corresponding to each level may also take other values, and the present disclosure does not limit this.

[0187] For example, the inter-frame motion degree can be divided into a plurality of value intervals in advance according to the possible values ​​of the inter-frame motion degree, each value interval corresponds to a level, and each level corresponds to a fourth weight value move_coff. The fourth weight values ​​corresponding to different levels of inter-frame motion degrees are different. Table 4 takes 5 value intervals as an example to give examples of the value intervals, levels, and fourth weight values ​​of the inter-frame motion degree.

[0188] Table 4

[0189]

[0190] Different levels of inter-frame motion correspond to different fourth weights. When the inter-frame motion is moderate, such as when it is equal to 2 to 6, the greater the inter-frame motion, the greater the first reference threshold value may be, so as to avoid generating an image group with too small a number of frames. Therefore, the fourth weight may also be gradually increased with the inter-frame motion; when the inter-frame motion is too large or too small, such as when it is equal to 1 or greater than 6, the fourth weight may be set to 1.

[0191] Taking the levels in Table 4 as an example, if the inter-frame motion degree of the current video frame falls within the interval [0, 2), the inter-frame motion degree level move_degree of the current video frame may be level 1, and the corresponding fourth weight move_coff= mv_coff[1]=1.

[0192] Those skilled in the art should understand that the number of levels of inter-frame motion degree, the endpoints of each numerical interval, and the fourth weight corresponding to each level may also take other values, and the present disclosure does not limit this.

[0193] After determining the level of the second block-level coding cost, the level of resolution, and the level of inter-frame motion, the first value threshes_1 can be multiplied by at least one of the second weight corresponding to the level of the second block-level coding cost, the third weight corresponding to the level of resolution, and the fourth weight corresponding to the level of inter-frame motion according to the application scenario requirements to obtain the second value threshes_2.

[0194] That is, thresholds_2=threshes_1×mv_coff[move_degree]×res_coff[res_level]×inter_satd_coff[inter_cost_level].

[0195] The second reference threshold can be determined according to the second numerical value. The second numerical value can be directly used as the second reference threshold, or the second reference threshold can be calculated using the second numerical value and other parameters, and an example of calculation is given later. The present disclosure does not limit the specific method of determining the second reference threshold according to the second numerical value.

[0196] In this way, the texture complexity, motion complexity, resolution, frame jump characteristics, etc. of the video frame are comprehensively considered, and the second reference degree threshold can be adjusted in multiple dimensions according to the application scenario requirements, so that the second reference degree threshold is more adapted to the application scenario requirements.

[0197] An exemplary manner of calculating the second reference degree threshold according to the second value and other parameters is described below.

[0198] In a possible implementation manner, determining the second reference threshold according to the second value includes:

[0199] When the level of the second block-level coding cost is the lowest level, the second value is multiplied by a preset fifth weight to obtain a third value, and the second reference degree threshold is determined according to the third value.

[0200] For example, in order to more finely adjust the first reference threshold, the present disclosure also pre-sets a fifth weight inter_low_coff. If the current video frame is a slow-motion video frame, that is, the level of the second block-level encoding cost of the current video frame inter_cost_level=0, the second value can be multiplied by the fifth weight to obtain a third value threshes_3, that is, threshes_3=threshes_2×inter_low_coff, and the second reference threshold is determined according to the third value.

[0201] The value of the fifth weight can be set according to the application scenario requirements, for example, set to 0.98. The present disclosure does not limit the specific value of the fifth weight.

[0202] The third value can be directly used as the second reference threshold, or the second reference threshold can be calculated using the third value and other parameters, and an example of calculation is given below. The present disclosure does not limit the specific method of determining the second reference threshold according to the third value.

[0203] In this way, the flexibility of setting the threshold can be improved.

[0204] An exemplary manner of calculating the second reference degree threshold according to the third value and other parameters is described below.

[0205] In a possible implementation, the coding feature parameter further includes a second coding block ratio, where the second coding block ratio indicates a scene difference between the current video frame and the second reference frame.

[0206] Determining a second reference threshold according to the third value includes:

[0207] When the proportion of the second coding block is greater than a preset first proportion threshold, the third value is multiplied by a preset sixth weight to obtain a fourth value, and the second reference degree threshold is determined according to the fourth value.

[0208] The exemplary calculation method of the second coding block ratio has been described above and will not be repeated here. The second reference degree threshold may be calculated according to the second coding block ratio and the third value.

[0209] Exemplarily, in order to more finely adjust the first reference degree threshold, the present disclosure also pre-sets a sixth weight intra_high_coff. If the current video frame is a slow-motion video frame (the level of the second block-level coding cost of the current video frame inter_cost_level=0), and the second coding block accounts for a large proportion (for example, greater than the first proportion threshold intra_ratio_thresh), the third value and the sixth weight can be multiplied to obtain a fourth value threshes_4, that is, threshes_4=threshes_3×intra_high_coff, and the second reference degree threshold is determined according to the fourth value.

[0210] The values ​​of the first proportion threshold and the sixth weight can be set according to the application scenario requirements. For example, the first proportion threshold can be set to 0.4, and the sixth weight can be set to 0.95. The present disclosure does not limit the specific values ​​of the first proportion threshold and the sixth weight.

[0211] The fourth value can be directly used as the second reference threshold, or the second reference threshold can be calculated using the fourth value and other parameters. The present disclosure does not limit the specific method of determining the second reference threshold according to the fourth value.

[0212] In this way, the flexibility of setting the threshold can be improved.

[0213] The following describes an example of a frame type determination condition according to an embodiment of the present disclosure: The position of the current video frame among a plurality of video frames of unknown types included in a video frame sequence determines the content of the frame type determination condition used to determine the type of the current video frame.

[0214] In a possible implementation, the threshold further includes a second percentage threshold for comparison with the first coding block percentage.

[0215] The frame type determination condition includes a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the reference degree of the first reference frame is greater than the first reference degree threshold;

[0216] When the frame type determination condition includes only the first sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition.

[0217] The value of the second proportion threshold is related to the position of the current video frame in the multiple video frames of unknown type included in the video frame sequence. The exemplary method for determining the second proportion threshold has been described above and will not be repeated here.

[0218] For example, no matter where the current video frame is located in the multiple video frames of unknown type included in the video frame sequence, the frame type determination condition may include a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the reference degree of the first reference frame is greater than the first reference degree threshold. If the frame type determination condition only includes the first sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition.

[0219] When the proportion of the first coding block is greater than the second proportion threshold, or when the reference degree of the first reference frame is greater than the first reference degree threshold, it means that the reference value of the first reference frame as a reference frame of the current video frame is very low, and the current video frame can be set as a new P frame.

[0220] Among them, when the current video frame is the first video frame of a plurality of video frames of unknown type included in a video frame sequence, the frame type judgment condition is satisfied as long as the first coding block ratio is greater than the second ratio threshold. When the current video frame is the jth video frame of a plurality of video frames of unknown type included in a video frame sequence, and j is an integer greater than 1, the first coding block ratio is greater than the second ratio threshold, or the reference degree of the first reference frame is greater than the first reference degree threshold, the frame type judgment condition is satisfied.

[0221] In this way, while ensuring the accuracy of frame type judgment, the efficiency of frame type judgment can be further improved.

[0222] Optionally, the frame type determination condition may further include other sub-conditions. Examples of other sub-conditions included in the frame type determination condition are given below.

[0223] In a possible implementation, the coding feature parameter further includes a first identifier and a second block-level coding cost, the second block-level coding cost indicates an average value of coding costs of each coding block when the current video frame is encoded with reference to the second reference frame, the first identifier is in a first state when the second block-level coding cost is greater than or equal to a first cost threshold, and the first identifier is in a second state when the second block-level coding cost is less than the first cost threshold.

[0224] The frame type determination condition further includes a second sub-condition, and the second sub-condition is that the first identifier is in the first state;

[0225] When the frame type determination condition includes only the first sub-condition and the second sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition.

[0226] An exemplary method for determining the second block-level encoding cost and the first identifier has been described above and will not be repeated here.

[0227] Regardless of the position of the current video frame in the multiple video frames of unknown types included in the video frame sequence, the frame type determination condition may further include a second sub-condition, and the second sub-condition is that the first identifier is in the first state. If the frame type determination condition only includes the first sub-condition and the second sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition.

[0228] When the first indicator is in the second state, it indicates that the current video frame is a very slow motion video frame and is not suitable as a P frame. In this way, it is possible to avoid determining a very slow motion video frame as a P frame, further improving the accuracy of frame type determination.

[0229] To improve the accuracy of type determination of the i-th video frame (i is an integer greater than 2) among a plurality of video frames of unknown types included in a video frame sequence, more sub-conditions may be set for the frame type determination condition.

[0230] In a possible implementation, when the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, and i is an integer greater than 2,

[0231] The coding feature parameters also include block-level motion displacement, which indicates the degree of motion of the coding block that moves when the current video frame refers to the second reference frame.

[0232] The frame type determination condition further includes a third sub-condition, and the third sub-condition is that the block-level motion displacement is greater than a preset first displacement threshold;

[0233] When the frame type determination condition includes only the first sub-condition, the second sub-condition, and the third sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition, or satisfies the third sub-condition.

[0234] The exemplary determination method of block-level motion displacement has been described above and will not be repeated here. The value of the first displacement threshold can be preset according to the application scenario requirements, for example, set to 100000. The present disclosure does not limit the specific value of the first displacement threshold.

[0235] The frame type determination condition also includes a third sub-condition, and the third sub-condition is that the block-level motion displacement is greater than the first displacement threshold.

[0236] When the current video frame is the i-th video frame among multiple video frames of unknown type included in a video frame sequence, and i is an integer greater than 2, if the frame type judgment condition only includes the first sub-condition, the second sub-condition, and the third sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition, or satisfies the third sub-condition.

[0237] When the current video frame is the i-th video frame among multiple video frames of unknown type included in a video frame sequence, and i is an integer greater than 2, if the frame type judgment condition only includes the first sub-condition and the third sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition or satisfies the third sub-condition.

[0238] When the block-level motion displacement is less than or equal to the first displacement threshold, it indicates that the motion degree of the coding block that moves when the current video frame refers to the second reference frame is small and is not suitable as a P frame. In this way, it is possible to avoid judging a video frame with a small block-level motion displacement as a P frame, further improving the accuracy of frame type judgment.

[0239] In a possible implementation, the coding feature parameter further includes a second flag, the second flag indicating whether to control the number of consecutive bidirectional predictive interpolation coding frames in the video frame sequence, when the second flag is in the first state, it indicates that the number is not controlled, and when the second flag is in the second state, it indicates that the number is controlled to be an odd number.

[0240] The frame type determination condition further includes a fourth sub-condition, and the fourth sub-condition is that the second identifier is in the first state, or the second identifier is in the second state and i is an even number;

[0241] When the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is met when the current video frame satisfies the first sub-condition, the second sub-condition, the fourth sub-condition, or the third sub-condition and the fourth sub-condition.

[0242] An exemplary method for determining the second identifier has been described above and will not be repeated here.

[0243] The frame type determination condition also includes a fourth sub-condition, which is that the second identifier is in the first state, or the second identifier is in the second state and i is an even number.

[0244] When the current video frame is the i-th video frame among multiple video frames of unknown type included in a video frame sequence, and i is an integer greater than 2, if the frame type judgment condition only includes the first sub-condition, the second sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition, the second sub-condition, and the fourth sub-condition, or satisfies the third sub-condition and the fourth sub-condition.

[0245] When the current video frame is the i-th video frame among multiple video frames of unknown type included in a video frame sequence, and i is an integer greater than 2, if the frame type judgment condition only includes the first sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition, the fourth sub-condition, or when the third sub-condition and the fourth sub-condition are satisfied.

[0246] When the second flag is in the second state and i is an odd number, if the current video frame is judged to be a P frame, the number of consecutive B frames included in the image group will become an even number, resulting in a poor encoding effect. Therefore, when the second flag is in the second state and i is an odd number, the current video frame is not suitable as a P frame. In this way, the parity of the number of frames in the image group can be better controlled, and the accuracy of frame type judgment can be further improved.

[0247] Further, it is possible to first determine whether the current video frame satisfies the fourth sub-condition. If the fourth sub-condition is not satisfied, it is not necessary to determine whether the current video frame satisfies other sub-conditions and directly determine that the current video frame does not satisfy the frame type determination condition, so as to improve the determination speed.

[0248] In a possible implementation, the encoding feature parameter further includes the number of continuous frames of extremely slow motion, where the number of continuous frames of extremely slow motion indicates the degree of scene motion between the current video frame and at least one previous video frame.

[0249] When the current video frame does not satisfy the fourth sub-condition, or does not satisfy any one of the first sub-condition and the second sub-condition, and does not satisfy the third sub-condition, the frame type determination condition further includes a fifth sub-condition, and the fifth sub-condition is that the number of continuous frames of extremely slow motion is greater than or equal to a preset first frame number threshold, and the level of the first block-level encoding cost is greater than or equal to a first preset level;

[0250] When the frame type determination condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, and the fifth sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the fifth sub-condition.

[0251] An exemplary method for determining the number of continuous frames of extremely slow motion has been described above and will not be repeated here. The first frame number threshold and the first preset level can be preset according to the application scenario requirements. For example, the first frame number threshold can be set to 4, and the first preset level is also set to 4. The present disclosure does not limit the specific setting method of the first frame number threshold and the first preset level.

[0252] When the current video frame does not meet the fourth sub-condition, or does not meet any one of the first sub-condition and the second sub-condition, and does not meet the third sub-condition, the frame type judgment condition also includes a fifth sub-condition, and the fifth sub-condition is that the number of continuous frames of extremely slow motion is greater than or equal to a preset first frame number threshold, and the level of the first block-level encoding cost is greater than or equal to a first preset level.

[0253] When the current video frame is the i-th video frame among multiple video frames of unknown type included in a video frame sequence, and i is an integer greater than 2, if the frame type judgment condition includes a first sub-condition, a second sub-condition, a third sub-condition, a fourth sub-condition, and a fifth sub-condition, then when the current video frame satisfies the fifth sub-condition, the frame type judgment condition is satisfied.

[0254] When the current video frame is the i-th video frame among multiple video frames of unknown type included in a video frame sequence, and i is an integer greater than 2, if the frame type judgment condition includes a first sub-condition, a third sub-condition, a fourth sub-condition, and a fifth sub-condition, then when the current video frame satisfies the fifth sub-condition, the frame type judgment condition is satisfied.

[0255] When the number of consecutive frames of extremely slow motion is less than the preset first frame number threshold, it means that the extremely slow motion subsequence to which the current video frame belongs is relatively short, or the current video frame does not belong to the extremely slow motion subsequence, and at this time, there are relatively few video frames with stable motion displacement with the current video frame. When the level of the first block-level coding cost is less than the first preset threshold, it means that the texture of the current video frame is relatively simple. When there are relatively few video frames with stable motion displacement with the current video frame and the texture of the current video frame is simple, the current video frame is not suitable as a P frame.

[0256] In this way, it is possible to avoid determining the current video frame as a P frame when there are relatively few video frames with stable motion displacement with the current video frame and the current video frame has a simple texture, thereby further improving the accuracy of frame type judgment.

[0257] In a possible implementation, the coding feature parameter further includes a second block-level coding cost, a third block-level coding cost, and a fourth block-level coding cost, wherein the second block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the third block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the first reference frame, and the fourth block-level coding cost is equal to the second block-level coding cost of a video frame previous to the current video frame.

[0258] When the current video frame does not meet the fifth sub-condition, the frame type determination condition further includes a sixth sub-condition, and the sixth sub-condition is that the sum of the fourth block-level coding cost and the second block-level coding cost is less than the third block-level coding cost, and the difference between the fourth block-level coding cost and the second block-level coding cost is greater than a preset second cost threshold, and the third block-level coding cost is greater than the second cost threshold, and the level of the first block-level coding cost is less than a first preset level;

[0259] When the frame type determination condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the sixth sub-condition.

[0260] The exemplary determination methods of the second block-level coding cost, the third block-level coding cost, and the fourth block-level coding cost have been described above and will not be repeated here. The second cost threshold and the first preset level can be preset according to the application scenario requirements. For example. The second cost threshold can be set to 100, and the first preset level can be set to 4. The present disclosure does not limit the specific setting method of the second cost threshold and the first preset level.

[0261] The frame type judgment condition also includes a sixth sub-condition, which is that the sum of the fourth block-level coding cost and the second block-level coding cost is less than the third block-level coding cost, and the difference between the fourth block-level coding cost and the second block-level coding cost is greater than a preset second cost threshold, and the third block-level coding cost is greater than the second cost threshold, and the level of the first block-level coding cost is less than the first preset level.

[0262] When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, if the frame type determination condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, it means that the current video frame either does not satisfy the fourth sub-condition and the fifth sub-condition, or does not satisfy any one of the first sub-condition and the second sub-condition, and does not satisfy the third sub-condition and the fifth sub-condition. At this time, when the current video frame satisfies the sixth sub-condition, the frame type determination condition is satisfied.

[0263] When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, if the frame type determination condition includes the first sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, it means that the current video frame either does not satisfy the fourth sub-condition and the fifth sub-condition, or does not satisfy the first sub-condition, the third sub-condition, and the fifth sub-condition. At this time, when the current video frame satisfies the sixth sub-condition, the frame type determination condition is satisfied.

[0264] When the sum of the fourth block-level coding cost and the second block-level coding cost is greater than or equal to the third block-level coding cost, or when the third block-level coding cost is less than or equal to the second cost threshold, it means that the effect of inter-frame coding of the current video frame with reference to the first reference frame is better, and the current video frame is not suitable as a P frame. When the difference between the fourth block-level coding cost and the second block-level coding cost is less than or equal to the preset second cost threshold, it means that the scene difference between the current video frame and the second reference frame is less than or equal to the scene difference between the previous video frame and the second reference frame of the previous video frame, and the current video frame is not suitable as a P frame. When the level of the first block-level coding cost is greater than or equal to the first preset level, it means that the cost of intra-frame coding of the current video frame is too high, that is, the current video frame is not suitable as a P frame.

[0265] In this way, it is possible to avoid determining the current video frame as a P frame when the effect of inter-frame encoding of the current video frame with reference to the first reference frame is better, when the scene difference between the current video frame and the second reference frame is less than or equal to the scene difference between the previous video frame and the second reference frame of the previous video frame, and when the cost of intra-frame encoding of the current video frame is too high, thereby further improving the accuracy of frame type judgment.

[0266] Figure 5 An example of a frame type determination condition according to an embodiment of the present disclosure is shown.

[0267] like Figure 5 As shown, when the current video frame is the first video frame or the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the frame type determination condition includes a first sub-condition P1 and a second sub-condition P2. If the current video frame satisfies P1 and P2, it is determined to be a P frame, otherwise it is determined to be a B frame.

[0268] Among them, when the current video frame is the first video frame of a plurality of video frames of unknown type included in the video frame sequence, the first sub-condition may be that the first coding block ratio curr_ratio_intra_blk_l1 is greater than the second ratio threshold, and the value of the second ratio threshold may be the fifth value intra_ratio1, that is, the first sub-condition may be curr_ratio_intra_blk_l1> intra_ratio1. The second sub-condition may be that the first flag flag_verylow_inter is in the first state, and the first state is represented by "0", that is, the second sub-condition may be flag_verylow_inter=0.

[0269] When the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the first sub-condition may be that the first coding block ratio curr_ratio_intra_blk_l1 is greater than the second ratio threshold or the reference degree curr_ratio_inter_satd_l1_l0 of the first reference frame is greater than the first reference degree threshold, at which time the value of the second ratio threshold may be the sixth value intra_ratio2, and the value of the first reference degree threshold may be the eighth value thresh2, that is, the first sub-condition may be curr_ratio_intra_blk_l1> intra_ratio2, or, curr_ratio_inter_satd_l1_l0>thresh2. The second sub-condition may be that the first flag flag_verylow_inter is in the first state, and the first state is represented by "0", that is, the second sub-condition may be flag_verylow_inter=0.

[0270] When the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the first sub-condition may be that the first coding block ratio curr_ratio_intra_blk_l1 is greater than the second ratio threshold or the reference degree curr_ratio_inter_satd_l1_l0 of the first reference frame is greater than the first reference degree threshold, at which time the value of the second ratio threshold may be the sixth value intra_ratio2, and the value of the first reference degree threshold may be the eighth value thresh2, that is, the first sub-condition may be curr_ratio_intra_blk_l1> intra_ratio2, or, curr_ratio_inter_satd_l1_l0>thresh2. The second sub-condition may be that the first flag flag_verylow_inter is in the first state, and the first state is represented by "0", that is, the second sub-condition may be flag_verylow_inter=0.

[0271] When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, the frame type determination condition includes at least a first sub-condition P1, a second sub-condition P2, a third sub-condition P3, and a fourth sub-condition P4. When the current video frame satisfies P1, P2, and P4, or satisfies P3 and P4, it is determined to be a P frame.

[0272] When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, the first sub-condition may be that the first coding block ratio curr_ratio_intra_blk_l1 is greater than the second ratio threshold or the reference degree curr_ratio_inter_satd_l1_l0 of the first reference frame is greater than the first reference degree threshold, at which time the value of the second ratio threshold may be the seventh value intra_ratio, and the value of the first reference degree threshold may be the ninth value thresh3, that is, the first sub-condition may be curr_ratio_intra_blk_l1>intra_ratio, or, curr_ratio_inter_satd_l1_l0>thresh3. The second sub-condition may be that the first flag flag_verylow_inter is in the first state, and the first state is represented by "0", that is, the second sub-condition may be flag_verylow_inter=0.

[0273] The third sub-condition may be that the block-level motion displacement avg_mv_l0 is greater than a preset first displacement threshold, and the first displacement threshold may be 100000, that is, the third sub-condition may be avg_mv_l0>100000.

[0274] The fourth sub-condition may be that the second identifier flag_even_adj is in the first state, or that the second identifier flag_even_adj is in the second state and i is an even number. The first state of the second identifier may be represented by "0". The second state of the second identifier may be represented by "1". That is, the fourth sub-condition may be flag_even_adj=0, or flag_even_adj=1 and i is an even number.

[0275] If the current video frame does not meet P4, or does not meet P1 / P2 and P3, the frame type determination condition also includes a fifth sub-condition P5, which determines whether the current video frame meets P5. If it meets P5, it is determined to be a P frame.

[0276] The fifth sub-condition may be that the number of continuous frames of very slow motion s_num_verylow_inter is greater than or equal to a preset first frame number threshold, and the level of the first block-level coding cost intra_cost_level is greater than or equal to a first preset level. The first frame number threshold and the first preset level may be 4, that is, the fifth sub-condition may be s_num_verylow_inter≥4 and intra_cost_level≥4.

[0277] If the current video frame does not meet P5, the frame type determination condition further includes a sixth sub-condition P6, which determines whether the current video frame meets P6. If it meets P6, it is determined to be a P frame. If it does not meet P6, it is determined to be a B frame.

[0278] The sixth sub-condition may be that the sum of the fourth block-level encoding cost prev_cu_inter_l0 and the second block-level encoding cost curr_cu_inter_l0 is less than the third block-level encoding cost curr_cu_inter_l1, and the difference between the fourth block-level encoding cost prev_cu_inter_l0 and the second block-level encoding cost curr_cu_inter_l0 is greater than a preset second cost threshold, and the third block-level encoding cost curr_cu_inter_l1 is greater than the second cost threshold, and the level of the first block-level encoding cost intra_cost_level is less than the first preset level. The second cost threshold may be 100, and the first preset level may be 4. That is, the sixth sub-condition may be that prev_cu_inter_l0 + curr_cu_inter_l0 < curr_cu_inter_l1, and prev_cu_inter_l0 - curr_cu_inter_l0 > 100, and curr_cu_inter_l1 > 100, and intra_cost_level < 4.

[0279] The present disclosure also provides a frame type determination device. Figure 6 A schematic diagram showing the structure of the frame type determination device according to an embodiment of the present disclosure.

[0280] As Figure 6 shown, in a possible implementation, the device is used to determine the type of a video frame in a video frame sequence, and the device includes:

[0281] A first calculation module 61, configured to calculate an encoding feature parameter of a current video frame according to the position of the current video frame in a plurality of video frames with unknown types included in the video frame sequence when the type of the current video frame is unknown;

[0282] A first determination module 62, configured to determine a threshold for determining the type of the current video frame according to the position and the encoding feature parameter;

[0283] A first judgment module 63, configured to judge whether the current video frame meets the frame type judgment condition according to the position, the encoding feature parameter, and the threshold;

[0284] A second determination module 64, configured to determine that the current video frame is a forward prediction encoded frame when the frame type judgment condition is met, and determine that the current video frame is a bidirectional prediction interpolation encoded frame when the frame type judgment condition is not met;

[0285] Among them, when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the encoding feature parameters include at least the proportion of the first encoding block; when the current video frame is the jth video frame among multiple video frames of unknown type included in the video frame sequence and j is an integer greater than 1, the encoding feature parameters include at least the proportion of the first encoding block and the referenceability of the first reference frame, the first encoding block proportion indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as a reference frame for the current video frame compared to using the second reference frame.

[0286] In a possible implementation, when the current video frame is the jth video frame of a plurality of video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the threshold includes a first reference degree threshold for comparison with the reference degree of the first reference frame, each video frame includes a plurality of coding blocks, and the coding feature parameters also include a first block-level coding cost, the first block-level coding cost indicates an average coding cost of each coding block when the current video frame is encoded in an intra-frame coding manner, and determining the threshold for judging the type of the current video frame based on the position and the coding feature parameters includes: determining the level of the first block-level coding cost; obtaining a first numerical value based on a basic threshold corresponding to the level of the first block-level coding cost, and determining a second reference degree threshold based on the first numerical value, wherein different levels of first block-level coding costs correspond to different basic thresholds; and determining the first reference degree threshold based on the second reference degree threshold.

[0287] In a possible implementation, the first numerical value is obtained according to the basic threshold corresponding to the level of the first block-level coding cost, including: selecting a first weight corresponding to the type of encoder according to the type; and multiplying the basic threshold corresponding to the level of the first block-level coding cost by the first weight to obtain the first numerical value.

[0288] In a possible implementation, determining the first reference threshold according to the second reference threshold includes: determining the first reference threshold according to a larger one of the second reference threshold and a preset third reference threshold.

[0289] In one possible implementation, the first reference threshold is determined based on the larger one of the second reference threshold and a preset third reference threshold, including: when the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the larger one of the second reference threshold and the preset third reference threshold is increased by M times to obtain the first reference threshold, where M is a number greater than 1.

[0290] In a possible implementation, the coding feature parameters also include a second block-level coding cost, a resolution, and a degree of inter-frame motion, wherein the second block-level coding cost indicates an average value of the coding costs of each coding block when the current video frame is encoded with reference to the second reference frame, the resolution indicates the resolution of the current video frame, and the degree of inter-frame motion is equal to the ratio of the first block-level coding cost to the second block-level coding cost, and determining the second reference degree threshold based on the first numerical value includes: determining the level of the second block-level coding cost, the level of the resolution, and the level of the degree of inter-frame motion; multiplying the first numerical value with at least one of a second weight corresponding to the level of the second block-level coding cost, a third weight corresponding to the level of the resolution, and a fourth weight corresponding to the level of the degree of inter-frame motion to obtain a second numerical value, wherein different levels of second block-level coding costs correspond to different second weights, different levels of resolutions correspond to different third weights, and different levels of inter-frame motion degrees correspond to different fourth weights; determining the second reference degree threshold based on the second numerical value.

[0291] In one possible implementation, determining the second reference threshold based on the second numerical value includes: when the level of the second block-level coding cost is the lowest level, multiplying the second numerical value and a preset fifth weight to obtain a third numerical value, and determining the second reference threshold based on the third numerical value.

[0292] In a possible implementation, the coding feature parameters also include a second coding block ratio, where the second coding block ratio indicates the scene difference between the current video frame and the second reference frame, and determining the second reference degree threshold based on the third value includes: when the second coding block ratio is greater than a preset first ratio threshold, multiplying the third value and a preset sixth weight to obtain a fourth value, and determining the second reference degree threshold based on the fourth value.

[0293] In one possible implementation, the threshold includes a second proportion threshold for comparison with the proportion of the first coding block, and when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a fifth value; when the current video frame is the second video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a sixth value; when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, the second proportion threshold is a seventh value, where i is an integer greater than 2; the fifth value is greater than the sixth value, and the sixth value is greater than the seventh value.

[0294] In a possible implementation, the threshold also includes a second proportion threshold for comparison with the proportion of the first coding block, and the frame type judgment condition includes a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the reference degree of the first reference frame is greater than the first reference degree threshold; when the frame type judgment condition only includes the first sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition.

[0295] In a possible implementation, the coding feature parameters also include a first identifier and a second block-level coding cost, the second block-level coding cost indicates the average coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the first identifier is in a first state when the second block-level coding cost is greater than or equal to a first cost threshold, and the first identifier is in a second state when the second block-level coding cost is less than the first cost threshold, the frame type judgment condition also includes a second sub-condition, the second sub-condition is that the first identifier is in the first state; when the frame type judgment condition only includes the first sub-condition and the second sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition.

[0296] In a possible implementation, when the current video frame is the i-th video frame among multiple video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, the encoding feature parameters also include block-level motion displacement, and the block-level motion displacement indicates the degree of motion of the encoding block that moves when the current video frame refers to the second reference frame, and the frame type judgment condition also includes a third sub-condition, and the third sub-condition is that the block-level motion displacement is greater than a preset first displacement threshold; when the frame type judgment condition only includes the first sub-condition, the second sub-condition, and the third sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition, or satisfies the third sub-condition.

[0297] In a possible implementation, the coding feature parameter also includes a second identifier, which indicates whether to control the number of consecutive bidirectional predictive interpolation coding frames in the video frame sequence. When the second identifier is in the first state, it indicates that the number is not controlled, and when the second identifier is in the second state, it indicates that the number is controlled to be an odd number. The frame type judgment condition also includes a fourth sub-condition, and the fourth sub-condition is that the second identifier is in the first state, or the second identifier is in the second state and i is an even number. When the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition, the second sub-condition, the fourth sub-condition, or satisfies the third sub-condition and the fourth sub-condition.

[0298] In a possible implementation, the encoding feature parameters also include the number of continuous frames of extremely slow motion, and the number of continuous frames of extremely slow motion indicates the degree of scene motion between the current video frame and at least one forward video frame. When the current video frame does not satisfy the fourth sub-condition, or does not satisfy any one of the first sub-condition and the second sub-condition, and does not satisfy the third sub-condition, the frame type judgment condition also includes a fifth sub-condition, and the fifth sub-condition is that the number of continuous frames of extremely slow motion is greater than or equal to a preset first frame number threshold, and the level of the first block-level encoding cost is greater than or equal to a first preset level; when the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, and the fifth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the fifth sub-condition.

[0299] In a possible implementation, the coding feature parameters further include a second block-level coding cost, a third block-level coding cost, and a fourth block-level coding cost, wherein the second block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the third block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the first reference frame, and the fourth block-level coding cost is equal to the second block-level coding cost of a previous video frame of the current video frame. When the current video frame does not meet the fifth sub-condition, the frame type judgment condition further includes a sixth sub-condition, and the sixth sub-condition is that the sum of the fourth block-level coding cost and the second block-level coding cost is less than the third block-level coding cost, and the difference between the fourth block-level coding cost and the second block-level coding cost is greater than a preset second cost threshold, and the third block-level coding cost is greater than the second cost threshold, and the level of the first block-level coding cost is less than the first preset level; when the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, when the current video frame meets the sixth sub-condition, the frame type judgment condition is met.

[0300] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0301] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0302] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0303] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0304] Figure 7 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 7, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0305] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2000. TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM or similar.

[0306] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0307] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0308] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the above. The computer-readable storage medium used herein is not to be interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0309] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0310] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of the computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.

[0311] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0312] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0313] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0314] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0315] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for determining a frame type, characterized in that: The method is used to determine the type of a video frame in a video frame sequence, the method comprising: When the type of the current video frame is unknown, calculating the encoding feature parameter of the current video frame according to the position of the current video frame in a plurality of video frames of unknown types included in the video frame sequence; Determining a threshold for determining the type of the current video frame according to the position and the encoding feature parameter; Determine whether the current video frame meets the frame type determination condition according to the position, the encoding feature parameter, and the threshold; When the frame type determination condition is met, determining that the current video frame is a forward prediction coding frame, and when the frame type determination condition is not met, determining that the current video frame is a bidirectional prediction interpolation coding frame; Among them, when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the coding feature parameters include at least the proportion of the first coding block, the threshold includes the second proportion threshold, when the current video frame is the jth video frame among multiple video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the coding feature parameters include at least the proportion of the first coding block and the referenceability of the first reference frame, the threshold includes the second proportion threshold and the first reference degree threshold, the first coding block proportion indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as the reference frame of the current video frame compared with using the second reference frame; the frame type judgment condition includes a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the referenceability of the first reference frame is greater than the first reference degree threshold.

2. The method according to claim 1, characterized in that Each video frame includes a plurality of coding blocks, and the coding feature parameter further includes a first block-level coding cost, wherein the first block-level coding cost indicates an average value of coding costs of each coding block when the current video frame is encoded in an intra-frame coding manner. The step of determining a threshold for judging the type of the current video frame according to the position and the encoding feature parameter comprises: determining a level of the first block-level encoding cost; Obtaining a first value according to a basic threshold value corresponding to the level of the first block-level coding cost, and determining a second reference threshold value according to the first value, wherein different levels of first block-level coding costs correspond to different basic threshold values; The first reference degree threshold is determined according to the second reference degree threshold.

3. The method according to claim 2, characterized in that The obtaining a first value according to a basic threshold corresponding to the level of the first block-level encoding cost includes: Selecting a first weight corresponding to the type of the encoder according to the type of the encoder; The first value is obtained by multiplying the first weight by a basic threshold corresponding to the level of the first block-level encoding cost.

4. The method according to claim 2 or 3, characterized in that: The determining the first reference degree threshold according to the second reference degree threshold includes: The first reference degree threshold is determined according to a larger one of the second reference degree threshold and a preset third reference degree threshold.

5. The method according to claim 4, characterized in that The determining the first reference threshold according to a larger one of the second reference threshold and a preset third reference threshold includes: When the current video frame is the second video frame of multiple video frames of unknown type included in the video frame sequence, the larger one of the second reference degree threshold and the preset third reference degree threshold is expanded by M times to obtain the first reference degree threshold, where M is a number greater than 1.

6. The method according to claim 2 or 3, characterized in that: The coding characteristic parameters also include a second block-level coding cost, a resolution, and an inter-frame motion degree, wherein the second block-level coding cost indicates an average coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the resolution indicates a resolution of the current video frame, and the inter-frame motion degree is equal to a ratio of the first block-level coding cost to the second block-level coding cost. The step of determining the second reference threshold value according to the first value includes: Determining the level of the second block-level coding cost, the level of the resolution, and the level of the degree of inter-frame motion; The first value is multiplied by at least one of a second weight corresponding to the level of the second block-level coding cost, a third weight corresponding to the level of the resolution, and a fourth weight corresponding to the level of the inter-frame motion degree, to obtain a second value, wherein different levels of second block-level coding costs correspond to different second weights, different levels of resolutions correspond to different third weights, and different levels of inter-frame motion degrees correspond to different fourth weights; The second reference degree threshold is determined according to the second value.

7. The method according to claim 6, characterized in that The determining the second reference threshold according to the second value includes: When the level of the second block-level coding cost is the lowest level, the second value is multiplied by a preset fifth weight to obtain a third value, and the second reference degree threshold is determined according to the third value.

8. The method according to claim 7, characterized in that The encoding feature parameter also includes a second encoding block ratio, where the second encoding block ratio indicates a scene difference between the current video frame and the second reference frame. The determining the second reference threshold according to the third value includes: When the proportion of the second coding block is greater than a preset first proportion threshold, the third value is multiplied by a preset sixth weight to obtain a fourth value, and the second reference degree threshold is determined according to the fourth value.

9. The method according to claim 1, characterized in that: When the current video frame is the first video frame of a plurality of video frames of unknown type included in the video frame sequence, the second proportion threshold is a fifth value; When the current video frame is the second video frame of a plurality of video frames of unknown type included in the video frame sequence, the second proportion threshold is a sixth value; When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, the second proportion threshold is a seventh value, and i is an integer greater than 2; The fifth value is greater than the sixth value, and the sixth value is greater than the seventh value.

10. The method according to claim 1, characterized in that When the frame type determination condition only includes the first sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition.

11. The method according to claim 10, characterized in that The encoding feature parameters also include a first identifier and a second block-level encoding cost, wherein the second block-level encoding cost indicates an average encoding cost of each encoding block when the current video frame is encoded with reference to the second reference frame, and when the second block-level encoding cost is greater than or equal to a first cost threshold, the first identifier is in a first state, and when the second block-level encoding cost is less than the first cost threshold, the first identifier is in a second state. The frame type determination condition further includes a second sub-condition, wherein the second sub-condition is that the first identifier is in the first state; When the frame type determination condition only includes the first sub-condition and the second sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition.

12. The method according to claim 11, characterized in that When the current video frame is the i-th video frame of a plurality of video frames of unknown type included in the video frame sequence, and i is an integer greater than 2, The encoding feature parameters also include block-level motion displacement, which indicates the degree of motion of the encoding block that moves when the current video frame refers to the second reference frame. The frame type determination condition further includes a third sub-condition, wherein the third sub-condition is that the block-level motion displacement is greater than a preset first displacement threshold; When the frame type judgment condition only includes the first sub-condition, the second sub-condition, and the third sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition and the second sub-condition, or satisfies the third sub-condition.

13. The method according to claim 12, characterized in that The encoding feature parameter also includes a second identifier, the second identifier indicating whether to control the number of consecutive bidirectional predictive interpolation encoding frames in the video frame sequence, the second identifier indicating not to control the number when it is in the first state, and the second identifier indicating controlling the number to be an odd number when it is in the second state. The frame type determination condition further includes a fourth sub-condition, wherein the fourth sub-condition is that the second identifier is in the first state, or the second identifier is in the second state and i is an even number; When the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, and the fourth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the first sub-condition, the second sub-condition, the fourth sub-condition, or satisfies the third sub-condition and the fourth sub-condition.

14. The method according to claim 13, characterized in that The coding feature parameters also include the number of continuous frames of extremely slow motion and a first block-level coding cost, wherein the number of continuous frames of extremely slow motion indicates the degree of scene motion between the current video frame and at least one previous video frame, and the first block-level coding cost indicates the average coding cost of each coding block when the current video frame is encoded in an intra-frame coding manner. When the current video frame does not satisfy the fourth sub-condition, or does not satisfy any one of the first sub-condition and the second sub-condition, and does not satisfy the third sub-condition, the frame type determination condition further includes a fifth sub-condition, and the fifth sub-condition is that the number of continuous frames of the extremely slow motion is greater than or equal to a preset first frame number threshold, and the level of the first block-level coding cost is greater than or equal to a first preset level; When the frame type determination condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, and the fifth sub-condition, the frame type determination condition is satisfied when the current video frame satisfies the fifth sub-condition.

15. The method according to claim 14, characterized in that The coding feature parameters also include a second block-level coding cost, a third block-level coding cost, and a fourth block-level coding cost, wherein the second block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the second reference frame, the third block-level coding cost indicates the coding cost of each coding block when the current video frame is encoded with reference to the first reference frame, and the fourth block-level coding cost is equal to the second block-level coding cost of the previous video frame of the current video frame. When the current video frame does not meet the fifth sub-condition, the frame type determination condition further includes a sixth sub-condition, and the sixth sub-condition is that the sum of the fourth block-level coding cost and the second block-level coding cost is less than the third block-level coding cost, and the difference between the fourth block-level coding cost and the second block-level coding cost is greater than a preset second cost threshold, and the third block-level coding cost is greater than the second cost threshold, and the level of the first block-level coding cost is less than the first preset level; When the frame type judgment condition includes the first sub-condition, the second sub-condition, the third sub-condition, the fourth sub-condition, the fifth sub-condition, and the sixth sub-condition, the frame type judgment condition is satisfied when the current video frame satisfies the sixth sub-condition.

16. A frame type determination device, characterized in that: The device is used to determine the type of a video frame in a video frame sequence, and the device comprises: A first calculation module, configured to calculate, when the type of the current video frame is unknown, a coding feature parameter of the current video frame according to a position of the current video frame among a plurality of video frames of unknown types included in the video frame sequence; A first determination module, used to determine a threshold for judging the type of the current video frame according to the position and the encoding feature parameter; A first judgment module, used to judge whether the current video frame meets the frame type judgment condition according to the position, the encoding feature parameter and the threshold; A second determination module is used to determine that the current video frame is a forward prediction coding frame when the frame type determination condition is met, and to determine that the current video frame is a bidirectional prediction interpolation coding frame when the frame type determination condition is not met; Among them, when the current video frame is the first video frame among multiple video frames of unknown type included in the video frame sequence, the coding feature parameters include at least the proportion of the first coding block, the threshold includes the second proportion threshold, when the current video frame is the jth video frame among multiple video frames of unknown type included in the video frame sequence, and j is an integer greater than 1, the coding feature parameters include at least the proportion of the first coding block and the referenceability of the first reference frame, the threshold includes the second proportion threshold and the first reference degree threshold, the first coding block proportion indicates the scene difference between the current video frame and the first reference frame, and the referenceability of the first reference frame indicates the reference value of using the first reference frame as the reference frame of the current video frame compared with using the second reference frame; the frame type judgment condition includes a first sub-condition, and the first sub-condition is that the proportion of the first coding block is greater than the second proportion threshold, or the referenceability of the first reference frame is greater than the first reference degree threshold.

17. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 15 when executing the instructions stored in the memory.

18. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 15 is implemented.

Citation Information

Patent Citations

  • Adaptive frame structure-based AVS coding method

    CN101720044A

  • Method for judging frame type of video frame, and electronic device

    CN107277519A