Video encoding method and device, electronic equipment and computer readable storage medium

CN116389768BActive Publication Date: 2026-10-27SHANGHAI BILIBILI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310325793.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2026-10-27
Estimated Expiration
2043-03-29

AI Technical Summary

Technical Problem

对于平台而言,随着用户数量的不断增长,用于视频传输的带宽成本也越来越大

Benefits of technology

[0010]根据本公开的一个或多个实施例,在对待编码视频进行编码之前确定是否要对每个视频帧的参考帧列表进行剪枝,并且在确定要对参考帧列表进行剪枝的情况下基于每个视频帧的倾向参考方向对参考帧列表进行剪枝,由此可以减少所需遍历的参考帧组合,避免在从多个参考帧中确定最优参考帧时所需的大量计算,从而加快编码速度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389768B_ABST
    Figure CN116389768B_ABST
Patent Text Reader

Abstract

The present disclosure provides a video encoding method and device, electronic equipment and computer readable storage medium. The method comprises: obtaining a to-be-encoded video, the to-be-encoded video comprising one or more video frames; determining, for a current video frame in the one or more video frames, a plurality of reference frames corresponding to the current video frame; in response to determining, based on attributes of the plurality of reference frames, that the plurality of reference frames are to be pruned, determining a tendency reference direction of the current video frame, the tendency reference direction indicating an association relationship between a target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; pruning the plurality of reference frames according to the tendency reference direction; and encoding the to-be-encoded video based on a pruning result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to a video encoding method and apparatus, electronic equipment, computer-readable storage medium, and computer program product. Background Technology

[0002] With the development of internet technology, video platforms have also experienced rapid growth, with more and more users sharing and watching videos. For these platforms, the bandwidth costs for video transmission are increasing as the number of users grows. To improve video storage and transmission efficiency, video data compression is typically achieved through video image encoding. Since there is strong correlation between consecutive frames in a video, intra-frame prediction and inter-frame prediction techniques can be used to encode the video, thereby achieving the goal of compressing the video data.

[0003] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention

[0004] This disclosure provides a video encoding method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] According to one aspect of this disclosure, a video encoding method is provided, comprising: acquiring a video to be encoded, the video to be encoded including one or more video frames; determining a plurality of reference frames corresponding to a current video frame among the one or more video frames; in response to determining that the plurality of reference frames should be pruned based on attributes of the plurality of reference frames, determining a biased reference direction of the current video frame, the biased reference direction indicating the association relationship between a target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; pruning the plurality of reference frames according to the biased reference direction; and encoding the video to be encoded based on the pruning result.

[0006] According to another aspect of this disclosure, a video encoding apparatus is also provided, comprising: an acquisition module configured to acquire a video to be encoded, the video to be encoded including one or more video frames; a first determination module configured to determine, for a current video frame among the one or more video frames, a plurality of reference frames corresponding to the current video frame; a second determination module configured to determine, in response to determining, to prune the plurality of reference frames based on attributes of the plurality of reference frames, a biased reference direction of the current video frame, the biased reference direction indicating the association between a target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; a pruning module configured to prune the plurality of reference frames according to the biased reference direction; and an encoding module configured to encode the video to be encoded based on the pruning result.

[0007] According to another aspect of this disclosure, an electronic device is also provided, comprising: at least one processor; and at least one memory communicatively connected to the at least one processor, wherein the at least one memory stores a computer program that, when executed by the at least one processor, implements the video encoding method described above.

[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium storing a computer program is also provided, wherein the computer program implements the above-described video encoding method when executed by a processor.

[0009] According to another aspect of this disclosure, a computer program product is also provided, comprising a computer program, wherein the computer program implements the above-described video encoding method when executed by a processor.

[0010] According to one or more embodiments of this disclosure, before encoding the video to be encoded, it is determined whether the reference frame list for each video frame should be pruned, and if it is determined that the reference frame list should be pruned, the reference frame list is pruned based on the preferred reference direction of each video frame. This reduces the number of reference frame combinations that need to be traversed, avoids the large amount of computation required to determine the optimal reference frame from multiple reference frames, and thus speeds up the encoding process.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0013] Figure 1 A flowchart of a video encoding method according to some embodiments of the present disclosure is shown;

[0014] Figure 2 A flowchart illustrating the determination of the bias reference direction of the current video frame according to some embodiments of the present disclosure is shown;

[0015] Figure 3 A flowchart illustrating the determination of the bias reference direction of the current video frame according to other embodiments of the present disclosure is shown;

[0016] Figure 4 A structural block diagram of a video encoding apparatus according to an embodiment of the present disclosure is shown;

[0017] Figure 5 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation

[0018] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0019] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.

[0020] The terminology used in the description of the various examples described in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.

[0021] With the development of internet technology, video platforms have also experienced rapid growth, with more and more users sharing and watching videos. For these platforms, the bandwidth costs for video transmission are increasing as the number of users grows. To improve video storage and transmission efficiency, video data compression is typically achieved through video image encoding. Since there is strong correlation between consecutive frames in a video, intra-frame prediction and inter-frame prediction techniques can be used to encode the video, thereby achieving the goal of compressing the video data.

[0022] Different video standards specify the number of reference frames in the reference frame list when encoding each video frame using inter-frame prediction techniques (e.g., the AV1 standard specifies that each video frame can have 7 reference frames). These reference frames are categorized as forward reference frames or backward reference frames based on whether they precede or follow the current frame in playback order. Typically, at most two of these reference frames are used as the final target reference frames. The inventors discovered that the final target reference frame is usually determined based on rate-distortion theory, i.e., traversing all possible combinations of reference frames and calculating the rate-distortion cost of each combination, selecting the combination with the lowest rate-distortion cost as the final target reference frame for the current frame. However, calculating the rate-distortion cost of each combination often requires a large amount of computation, which can lead to a decrease in encoding speed, especially when the number of reference frames in the reference frame list is large; the impact of computation on encoding speed is particularly significant in these cases.

[0023] In view of this, embodiments of the present disclosure provide a video coding method that, before performing main coding on the video to be encoded, determines the biased reference direction of each video frame through pre-analysis and prunes the reference frame list based on the biased reference direction of each video frame. This combination of pre-analysis and main coding reduces the number of reference frame combinations required during main coding, thereby reducing the computational load required to determine the optimal reference frame from multiple reference frames and accelerating the coding speed. Furthermore, since pre-analysis and main coding are performed twice on the same video frame, their results often have a certain correlation. Therefore, encoding the video to be encoded based on the pruning results can also ensure both the coding result and coding performance.

[0024] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0025] Figure 1 A flowchart of a video encoding method 100 according to some embodiments of the present disclosure is shown. Figure 1As shown, method 100 may include: step S110, acquiring a video to be encoded, the video to be encoded including one or more video frames; step S120, for the current video frame in the one or more video frames, determining a plurality of reference frames corresponding to the current video frame; step S130, in response to determining to prune the plurality of reference frames based on the attributes of the plurality of reference frames, determining the biased reference direction of the current video frame, the biased reference direction indicating the association between the target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; step S140, pruning the plurality of reference frames according to the biased reference direction; and step S150, encoding the video to be encoded based on the pruning result.

[0026] Before the main encoding of the video to be encoded, pre-analysis is used to determine the preferred reference direction for each video frame. Based on this preferred reference direction, the list of reference frames is pruned. This combination of pre-analysis and main encoding reduces the number of reference frame combinations required during the main encoding process, thereby reducing the computational load needed to determine the optimal reference frame from multiple reference frames and accelerating the encoding speed. Furthermore, since pre-analysis and main encoding are performed twice on the same video frame, their results often have some correlation. Therefore, encoding the video to be encoded based on the pruning results can also ensure both the encoding result and the encoding performance.

[0027] In step S110, the stored or cached video to be encoded can be read from a suitable storage device (local and / or remote). Alternatively, the video to be encoded can also be received from other external devices via a wired or wireless communication link. The video to be encoded can refer to any complete video file. For example, it can be a video file recorded by the user, a video file extracted by the user from other video files, or a video file created by the user based on multiple video files; the scope of the subject matter claimed in this disclosure is not limited in this respect.

[0028] In step S120, the reference frame corresponding to the current video frame can refer to the image referenced by the coding block during the video encoding process. The number of reference frames in the reference frame list can vary depending on the selected video coding standard. For example, the AV1 video coding standard includes 7 reference frames, while the H.264 video coding standard includes 16 reference frames, and so on.

[0029] Figure 2 A flowchart illustrating the determination of the bias reference direction of the current video frame according to some embodiments of this disclosure is shown. Figure 2As shown, in step S130, in response to determining that the multiple reference frames need to be pruned based on their attributes, determining the biased reference direction of the current video frame may include: step S232, dividing the current video frame to obtain multiple coding blocks of a preset size; step S234, for each coding block, calculating the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, and the intra-frame prediction rate distortion cost; and step S236, determining the biased reference direction of the current video frame based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, the intra-frame prediction rate distortion cost, and the total number of multiple coding blocks.

[0030] Rate-distortion cost can be used to characterize the cost loss when performing intra-frame predictive coding and inter-frame predictive coding on each video frame. The higher the rate-distortion cost, the lower the coding efficiency of the video. Conversely, the lower the rate-distortion cost, the higher the coding efficiency of the video. Therefore, determining the bias reference direction of the current video frame based on the rate-distortion cost of each coding block has a certain degree of accuracy and reliability.

[0031] According to some embodiments of this disclosure, in step S232, multiple fixed-size coding blocks can be obtained by downsampling the current video frame, for example, dividing the current video frame into multiple coding blocks of 8*8 or 16*16 pixel size. Then, the rate-distortion cost is calculated for each divided coding block.

[0032] According to some embodiments of this disclosure, in step S234, the forward inter-frame prediction rate-distortion cost can represent the cost loss when performing inter-frame prediction between the current video frame (coded block) and the forward reference frames in the reference frame list, and the backward inter-frame prediction rate-distortion cost can represent the cost loss when performing inter-frame prediction between the current video frame (coded block) and the backward reference frames in the reference frame list. Specifically, the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost can be calculated using the following formulas:

[0033] SATDCOST=SATD+λ*R (1)

[0034] Where SATD is the sum of absolute transform differences (Sum of Absolute Transformed Differences) between the residuals of the predicted and original coded blocks during intra-frame or inter-frame prediction, after undergoing the Hadamard transform. λ is the Lagrange multiplier in rate-distortion optimization theory, which can be obtained from the quantization parameter QP. R is the number of bits required to encode the inter-frame motion vector or the intra-frame prediction direction and residuals.

[0035] Based on the quantization parameter QP, the Lagrange multiplier λ can be calculated using the following formula:

[0036] λ=c*Qstep 2 (2)

[0037] Where Qstep represents the quantization step size obtained by looking up the quantization parameter QP in a table, and c is a constant determined by the encoder, for example, c can be 0.5.

[0038] The Hadamard transform of the residual between the predicted and original coded blocks can be calculated using the following formula:

[0039] T = H M *Resi*H M (3)

[0040] Where Resi is the residual matrix. H M Let T be an M-order Hadamard matrix, where M can take values ​​of 4, 8, 16, 32, etc. T is the resulting matrix after the Hadamard transformation. SATD can be obtained by taking the absolute value of each value in T and summing them.

[0041] The residual between the predicted coded block and the original coded block can be calculated using the following formula:

[0042] Resi(i,j)=Pred(i,j)-Src(i,j) (4)

[0043] Where i and j represent the row and column coordinates of a pixel in the image, respectively; Pred(i,j) represents the predicted pixel value in the i-th row and j-th column; Src(i,j) represents the original pixel value in the i-th row and j-th column; and Resi(i,j) represents the residual value between the predicted pixel value in the i-th row and j-th column and the original pixel value. All residual values ​​of each coding block can form a residual matrix Resi.

[0044] It should be understood that the specific formulas (1)-(4) for calculating the inter-frame prediction rate distortion cost and the intra-frame prediction rate distortion cost are shown for illustrative purposes only, and any other suitable method may be used to calculate them. The scope of the subject matter claimed in this disclosure is not limited in this respect.

[0045] It should also be understood that the costs of forward inter-frame prediction rate distortion, backward inter-frame prediction rate distortion, and intra-frame prediction rate distortion can all be calculated using the above formula. It is only necessary to obtain the corresponding residuals and the corresponding number of bits.

[0046] According to some embodiments of this disclosure, in step S234, for each of the plurality of coding blocks, calculating the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, and the intra-frame prediction rate distortion cost of the coding block may include: calculating the inter-frame prediction rate distortion cost between the coding block and the corresponding coding block in the forward adjacent reference frame of the current video frame as the forward inter-frame prediction rate distortion cost; and calculating the inter-frame prediction rate distortion cost between the coding block and the corresponding coding block in the backward adjacent reference frame of the current video frame as the backward inter-frame prediction rate distortion cost.

[0047] Specifically, the inter-frame prediction rate distortion cost between the current video frame and the corresponding coding block of the forward or backward adjacent reference frame can be calculated using the above formulas (1)-(4).

[0048] Since there is a strong correlation between consecutive frames of a video, and the correlation between each video frame and its adjacent video frames (including forward and backward reference frames) is likely to be the closest, selecting the current video frame and its two adjacent reference frames to perform inter-frame prediction and calculate the corresponding inter-frame prediction rate-distortion cost is beneficial for obtaining a more accurate tendency reference direction for the current video frame.

[0049] According to some embodiments of this disclosure, in step S236, determining the bias reference direction of the current video frame based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, the intra-frame prediction rate distortion cost, and the total number of multiple coding blocks may include: determining whether the coding block is a forward prediction coding block or a backward prediction coding block based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, and the intra-frame prediction rate distortion cost; determining the number of forward prediction coding blocks and backward prediction coding blocks among the multiple coding blocks; and determining the bias reference direction of the current video frame based on the number of forward prediction coding blocks, the number of backward prediction coding blocks, and the total number of multiple coding blocks.

[0050] In some embodiments, the bias reference direction of the current video frame can be forward, backward, or uncertain, and the bias reference direction of the current video frame can be set to uncertain in the initial state. Specifically, determining whether a coding block is a forward predictive coding block or a backward predictive coding block based on the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost can include: determining the coding block as a forward predictive coding block in response to determining that the forward inter-frame prediction rate-distortion cost of the coding block is less than the intra-frame prediction rate-distortion cost; and determining the coding block as a backward predictive coding block in response to determining that the backward inter-frame prediction rate-distortion cost of the coding block is less than the intra-frame prediction rate-distortion cost.

[0051] For each video frame, during the actual encoding process, inter-frame coding or intra-frame coding may be chosen. When choosing inter-frame coding, the optimal target reference frame or combination of target reference frames needs to be determined from the reference frame list. In the pre-analysis process described above for determining the preferred reference direction of the current video frame, by comparing the inter-frame prediction rate-distortion cost and the intra-frame prediction rate-distortion cost, a preliminary prediction of whether inter-frame coding or intra-frame coding will be chosen during the actual encoding process can be achieved. Simultaneously, when inter-frame coding needs to be performed in the preliminary prediction, it can be determined more accurately whether each coding block is a forward prediction coding block or a backward prediction coding block. Furthermore, compared to the actual encoding process, the computational load involved in calculating the rate-distortion cost in the above pre-analysis process is relatively small, thus contributing to faster encoding speed.

[0052] It is important to note that the above pre-analysis process is not the sole basis for selecting inter-frame coding or intra-frame coding during the actual coding process. Rather, it is only used to determine the preferred reference direction for each coding block when the inter-frame coding rate-distortion cost is relatively small. In other words, even if it is determined that the inter-frame prediction rate-distortion cost of a coding block is greater than the intra-frame prediction rate-distortion cost (including the forward inter-frame prediction rate-distortion cost being greater than the intra-frame prediction rate-distortion cost, the subsequent inter-frame prediction rate-distortion cost being greater than the intra-frame prediction rate-distortion cost, or both), it does not mean that the corresponding video frame for that coding block will be intra-coded during the actual coding process.

[0053] It should be understood that by calculating the forward inter-frame prediction rate-distortion cost, backward inter-frame prediction rate-distortion cost, and intra-frame prediction rate-distortion cost for each coding block, the following four cases may exist:

[0054] 1) The forward inter-frame prediction rate distortion cost of this coding block is less than the intra-frame prediction rate distortion cost, and the backward inter-frame prediction rate distortion cost is also less than the intra-frame prediction rate distortion cost. In this case, it can be determined that this coding block is both a forward prediction coding block and a backward prediction coding block, and the number of both forward prediction coding blocks and backward prediction coding blocks is increased by 1.

[0055] 2) The forward inter-frame prediction rate-distortion cost of this coding block is less than the intra-frame prediction rate-distortion cost, and the backward inter-frame prediction rate-distortion cost is greater than or equal to the intra-frame prediction rate-distortion cost. In this case, the coding block can be determined as a forward prediction coding block, and the number of forward prediction coding blocks is increased by 1, while the number of backward prediction coding blocks remains unchanged.

[0056] 3) The forward inter-frame prediction rate-distortion cost of this coding block is greater than or equal to the intra-frame prediction rate-distortion cost, and the backward inter-frame prediction rate-distortion cost is less than the intra-frame prediction rate-distortion cost. In this case, the coding block can be determined as a backward prediction coding block, and the number of backward prediction coding blocks is increased by 1, while the number of forward prediction coding blocks remains unchanged.

[0057] 4) The forward inter-frame prediction rate distortion cost of this coding block is greater than or equal to the intra-frame prediction rate distortion cost, and the backward inter-frame prediction rate distortion cost is also greater than or equal to the intra-frame prediction rate distortion cost. In this case, it can be determined that this coding block is neither a forward prediction coding block nor a backward prediction coding block, and the number of forward prediction coding blocks and the number of backward prediction coding blocks remain unchanged.

[0058] Therefore, the sum of the number of forward predictive coding blocks and backward predictive coding blocks is not necessarily less than or equal to the total number of coding blocks. For example, if 16 fixed-size coding blocks are obtained by downsampling the current video frame, there may be 9 forward predictive coding blocks and 9 backward predictive coding blocks, where two coding blocks are both forward and backward predictive coding blocks.

[0059] Based on this, and according to some embodiments of this disclosure, determining the tendency reference direction of the current video frame based on the number of forward predictive coding blocks, the number of backward predictive coding blocks, and the total number of multiple coding blocks may include: determining the tendency reference direction of the current video frame as forward in response to determining that the number of forward predictive coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks and the number of backward predictive coding blocks is less than a second threshold multiple of the total number of multiple coding blocks; and determining the tendency reference direction of the current video frame as backward in response to determining that the number of forward predictive coding blocks is less than a second threshold multiple of the total number of multiple coding blocks and the number of backward predictive coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks.

[0060] The first threshold can be the same as or different from the second threshold. For example, both the first and second thresholds can be set to 0.5. Alternatively, the first threshold can be set to 0.6 and the second threshold can be set to 0.5. It should be understood that the first and second thresholds can be any suitable value between 0 and 1, and are not limited to the specific values ​​in the particular embodiments described above; the subject matter claimed in this disclosure is not limited in this respect.

[0061] According to some embodiments of this disclosure, determining the tendency reference direction of the current video frame based on the number of forward predictive coding blocks, the number of backward predictive coding blocks, and the total number of multiple coding blocks may further include: determining the tendency reference direction of the current video frame as uncertain in response to determining that neither of the following is true: the number of forward predictive coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks and the number of backward predictive coding blocks is less than a second threshold multiple of the total number of multiple coding blocks; and the number of forward predictive coding blocks is less than a second threshold multiple of the total number of multiple coding blocks and the number of backward predictive coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks.

[0062] Continuing with the example above, which includes 9 forward predictive coding blocks and 9 backward predictive coding blocks in the 16 coding blocks, and where both the first threshold and the second threshold are 0.5, in this case, the number of forward predictive coding blocks, 9, is greater than the total number of multiple coding blocks, 16 * the first threshold 0.5 = 8, while the number of backward predictive coding blocks, 9, is not less than the total number of multiple coding blocks, 16 * the second threshold 0.5 = 8. Therefore, it can be determined that the tendency reference direction of the previous video frame is uncertain.

[0063] Figure 3 A flowchart illustrating the determination of the bias reference direction of the current video frame according to other embodiments of this disclosure is shown. Figure 3 As shown, in step S130, in response to determining whether to prune the multiple reference frames based on their attributes, determining the bias reference direction of the current video frame may include: [related to...] Figure 2 The steps S232-S236 described are the same as or similar to steps S332-S336; and step S338, updating the tendency reference direction of the current video frame to obtain the updated tendency reference direction.

[0064] It should be understood that the operations, features, and advantages described above for steps S232-S236 also apply to steps S332-S336. For the sake of brevity, these operations, features, and advantages will not be repeated here.

[0065] After determining the orientation reference direction of the current video frame through the above steps, updating the orientation reference direction can further improve the accuracy and reliability of the determined orientation reference direction.

[0066] According to some embodiments of this disclosure, in step S338, updating the tendency reference direction of the current video frame to obtain the updated tendency reference direction may include: in response to determining that the tendency reference direction of the current video frame is forward, determining the tendency reference direction of the forward adjacent reference frame of the current video frame; and in response to determining that the tendency reference direction of the forward adjacent reference frame is backward, updating the tendency reference direction of the current video frame to uncertain.

[0067] Specifically, when the tendency reference direction of the current video frame is determined to be forward, there may be a closer correlation between the current video frame and its adjacent forward reference frames. In this case, by further determining the tendency reference direction of its adjacent forward reference frames, the error caused in the process of calculating the tendency reference direction of the current video frame can be reduced, thereby improving the accuracy of this preprocessing analysis result.

[0068] Optionally, if the orientation of the forward adjacent reference frame is determined to be uncertain, the orientation of the current video frame can be left unupdated, i.e., the orientation of the current video frame can be maintained as forward.

[0069] According to some embodiments of this disclosure, in step S360, updating the tendency reference direction of the current video frame to obtain the updated tendency reference direction may include: in response to determining that the tendency reference direction of the current video frame is backward, determining the tendency reference direction of the backward adjacent reference frame of the current video frame; and in response to determining that the tendency reference direction of the backward adjacent reference frame is forward, updating the tendency reference direction of the current video frame to uncertain.

[0070] Similarly, when the bias reference direction of the current video frame is determined to be backward, there may be a closer correlation between the current video frame and its adjacent backward reference frames. In this case, by further determining the bias reference direction of its adjacent backward reference frames, the error caused in the process of calculating the bias reference direction of the current video frame can be reduced, thereby improving the accuracy of this preprocessing analysis result.

[0071] Optionally, if the orientation of the backward adjacent reference frame is determined to be uncertain, the orientation of the current video frame can be left unchanged, i.e., the orientation of the current video frame is maintained as backward.

[0072] It should be understood that determining the orientation of the forward adjacent reference frame or the orientation of the backward adjacent reference frame can be achieved using the same or similar steps as determining the orientation of the current video frame.

[0073] According to some embodiments of this disclosure, in step S130, determining to prune multiple reference frames based on their attributes may include: determining the number of multiple reference frames; determining whether the multiple reference frames include both forward reference frames and backward reference frames; and pruning the multiple reference frames in response to determining that the number of multiple reference frames is greater than 2 and that the multiple reference frames include both forward reference frames and backward reference frames.

[0074] As mentioned above, the number of reference frames in the reference frame list may be related to the current video coding standard, and there may be cases where all reference frames in the reference frame list are forward reference frames or all are backward reference frames. When the number of reference frames in the reference frame list is no more than two, or when all reference frames in the reference frame list are forward reference frames or all are backward reference frames, there is no need to prune the reference frames in the reference frame list. By determining whether to prune the reference frames in the reference frame list before determining the bias reference direction of the current video frame, the computational cost, such as the cost of calculating rate distortion, can be avoided, and storage space can be saved.

[0075] According to some embodiments of this disclosure, in step S140, pruning multiple reference frames according to the biased reference direction includes: pruning all backward reference frames in the multiple reference frames in response to determining that the biased reference direction is forward; pruning all forward reference frames in the multiple reference frames in response to determining that the biased reference direction is backward; and not pruning the multiple reference frames in response to determining that the biased reference direction is uncertain.

[0076] By pruning the reference frames in the reference frame list, the number of reference frame combinations that need to be traversed when determining the optimal reference frame from multiple reference frames can be reduced, effectively reducing the large amount of computation required and thus speeding up the encoding process.

[0077] According to some embodiments of this disclosure, in step S150, the pruning result represents the remaining reference frames after pruning the reference frames in the reference frame list. Encoding the video to be encoded based on the pruning result may include: traversing the remaining reference frame combinations after pruning; calculating the rate-distortion cost corresponding to each reference frame combination; selecting the reference frame combination with the minimum rate-distortion cost as the optimal target reference frame corresponding to the current video frame; and encoding the video to be encoded based on the target reference frame.

[0078] Therefore, in determining the optimal target reference frame, the number of reference frame combinations required for traversal can be reduced, thereby accelerating the coding speed. Furthermore, since the pre-analysis process for obtaining the pruning results and the main coding process encode the same video frame twice, their results often have a certain correlation. Therefore, the position of the target reference frame reflected in the pruning results has a certain degree of accuracy, ensuring superior coding performance.

[0079] Figure 4 A structural block diagram of a video encoding apparatus 400 according to an embodiment of the present disclosure is shown. Figure 4 As shown, the apparatus 400 may include: an acquisition module 410 configured to acquire a video to be encoded, the video to be encoded including one or more video frames; a first determination module 420 configured to determine a plurality of reference frames corresponding to the current video frame among the one or more video frames; a second determination module 430 configured to determine a biased reference direction of the current video frame in response to determining that the plurality of reference frames should be pruned based on the attributes of the plurality of reference frames, the biased reference direction indicating the association between the target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; a pruning module 440 configured to prune the plurality of reference frames according to the biased reference direction; and an encoding module 450 configured to encode the video to be encoded based on the pruning result.

[0080] By determining whether to prune the reference frame list for each video frame before encoding, and pruning the reference frame list based on the preferred reference direction of each video frame if pruning is determined, the number of reference frame combinations that need to be traversed can be reduced, avoiding the large amount of computation required to determine the optimal reference frame from multiple reference frames, thereby speeding up the encoding process.

[0081] According to some embodiments of this disclosure, the second determining module 430 may include: a partitioning module configured to partition the current video frame to obtain multiple coding blocks of a preset size; a rate-distortion cost calculation module configured to calculate, for each of the multiple coding blocks, the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost of that coding block; and a bias reference direction determination module configured to determine the bias reference direction of the current video frame based on the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, the intra-frame prediction rate-distortion cost, and the total number of the multiple coding blocks.

[0082] According to some embodiments of this disclosure, the rate-distortion cost calculation module may include: a module configured to calculate the inter-frame prediction rate-distortion cost between the coding block and the corresponding coding block in the forward adjacent reference frame of the current video frame as the forward inter-frame prediction rate-distortion cost; and a module configured to calculate the inter-frame prediction rate-distortion cost between the coding block and the corresponding coding block in the backward adjacent reference frame of the current video frame as the backward inter-frame prediction rate-distortion cost.

[0083] According to some embodiments of this disclosure, the module for determining the bias reference direction may include: a module for determining forward and backward predictive coding blocks, configured to determine whether the coding block is a forward predictive coding block or a backward predictive coding block based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, and the intra-frame prediction rate distortion cost; a module for determining the number of forward and backward coding blocks, configured to determine the number of forward and backward predictive coding blocks among a plurality of coding blocks; and a submodule for determining the bias reference direction, configured to determine the bias reference direction of the current video frame based on the number of forward predictive coding blocks, the number of backward predictive coding blocks, and the total number of a plurality of coding blocks.

[0084] According to some embodiments of the present disclosure, the module for determining forward and backward predictive coding blocks may include: a module configured to determine the coding block as a forward predictive coding block in response to determining that the forward inter-frame prediction rate distortion cost of the coding block is less than the intra-frame prediction rate distortion cost; and a module configured to determine the coding block as a backward predictive coding block in response to determining that the backward inter-frame prediction rate distortion cost of the coding block is less than the intra-frame prediction rate distortion cost.

[0085] According to some embodiments of this disclosure, the bias reference direction determination submodule may include: a module configured to determine that the bias reference direction of the current video frame is forward in response to determining that the number of forward predictive coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks and the number of backward predictive coding blocks is less than a second threshold multiple of the total number of multiple coding blocks; and a module configured to determine that the bias reference direction of the current video frame is backward in response to determining that the number of forward predictive coding blocks is less than a second threshold multiple of the total number of multiple coding blocks and the number of backward predictive coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks.

[0086] According to some embodiments of this disclosure, the tendency reference direction determination submodule may further include: a module configured to determine that the tendency reference direction of the current video frame is uncertain in response to determining that the number of forward predicted coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks and the number of backward predicted coding blocks is less than a second threshold multiple of the total number of multiple coding blocks; and the number of forward predicted coding blocks is less than a second threshold multiple of the total number of multiple coding blocks and the number of backward predicted coding blocks is greater than a first threshold multiple of the total number of multiple coding blocks.

[0087] According to some embodiments of this disclosure, the second determining module 430 may further include: an updating module configured to update the tendency reference direction of the current video frame to obtain an updated tendency reference direction.

[0088] According to some embodiments of this disclosure, the updating module may include: a module configured to determine the forward reference direction of the current video frame in response to determining that the forward reference direction of the current video frame is forward; and a module configured to update the forward reference direction of the current video frame to uncertain in response to determining that the forward reference direction of the forward reference frame is backward.

[0089] According to some embodiments of this disclosure, the updating module may include: a module configured to determine the tendency reference direction of the backward neighboring reference frame of the current video frame in response to determining that the tendency reference direction of the current video frame is backward; and a module configured to update the tendency reference direction of the current video frame to uncertain in response to determining that the tendency reference direction of the backward neighboring reference frame is forward.

[0090] According to some embodiments of this disclosure, determining to prune multiple reference frames based on their attributes may include: a module configured to determine the number of multiple reference frames; a module configured to determine whether the multiple reference frames include both forward reference frames and backward reference frames; and a module configured to prune the multiple reference frames in response to determining that the number of multiple reference frames is greater than 2 and that the multiple reference frames include both forward reference frames and backward reference frames.

[0091] According to some embodiments of this disclosure, the pruning module 440 may include: a module configured to prune all backward reference frames in a plurality of reference frames in response to determining that the reference direction is forward; a module configured to prune all forward reference frames in a plurality of reference frames in response to determining that the reference direction is backward; and a module configured not to prune the plurality of reference frames in response to determining that the reference direction is uncertain.

[0092] It should be understood that Figure 4 The various modules 410-450 of the device 400 shown can be used with reference to Figure 1 The steps S110-S150 in the described method 100 correspond to each other. Therefore, the operations, features, and advantages described above for method 100 also apply to device 400 and its included modules. For the sake of brevity, some operations, features, and advantages will not be repeated here.

[0093] It should also be understood that this article can describe various technologies in the general context of software and hardware components or program modules. The above regarding... Figure 4 The various modules described can be implemented in hardware or in hardware in combination with software and / or firmware. For example, these modules can be implemented as computer program code / instructions configured to execute in one or more processors and stored in a computer-readable storage medium. Alternatively, these modules can be implemented as hardware logic / circuit. For example, in some embodiments, one or more of the acquisition module 410, the first determination module 420, the second determination module 430, the pruning module 540, and the encoding module 450 can be implemented together in a System on Chip (SoC). The SoC may include an integrated circuit chip (which includes a processor (e.g., a Central Processing Unit (CPU), microcontroller, microprocessor, digital signal processor (DSP), etc.), memory, one or more communication interfaces, and / or one or more components of other circuitry) and may optionally execute received program code and / or include embedded firmware to perform functions.

[0094] According to another aspect of this disclosure, an electronic device is also provided, comprising: at least one processor; and at least one memory communicatively connected to the at least one processor; wherein the at least one memory stores a computer program that, when executed by the at least one processor, implements the video encoding method described above.

[0095] According to another aspect of this disclosure, a computer-readable storage medium storing a computer program is also provided, wherein the computer program implements the above-described video encoding method when executed by a processor.

[0096] According to another aspect of this disclosure, a computer program product is also provided, comprising a computer program, wherein the computer program implements the above-described video encoding method when executed by a processor.

[0097] See Figure 5 The present invention describes a structural block diagram of an electronic device 500 that can serve as a server of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device can be different types of computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0098] like Figure 5 As shown, the electronic device 500 may include at least one processor 510, working memory 520, input unit 540, display unit 550, speaker 560, storage unit 570, communication unit 580 and other output units 590 that are capable of communicating with each other via system bus 530.

[0099] Processor 510 may be a single processing unit or multiple processing units, and all processing units may include single or multiple computing units or multiple cores. Processor 510 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. Processor 510 may be configured to acquire and execute computer-readable instructions stored in working memory 520, storage unit 570, or other computer-readable media, such as program code of operating system 520a, program code of application program 520b, etc.

[0100] Working memory 520 and storage cell 570 are examples of computer-readable storage media for storing instructions executed by processor 510 to perform the various functions described above. Working memory 520 may include both volatile and non-volatile memory (e.g., RAM, ROM, etc.). Furthermore, storage cell 570 may include hard disk drives, solid-state drives, removable media including external and removable drives, memory cards, flash memory, floppy disks, optical disks (e.g., CDs, DVDs), storage arrays, network-attached storage, storage area networks, etc. Working memory 520 and storage cell 570 may be collectively referred to herein as memory or computer-readable storage media, and may be non-transitory media capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by processor 510 as a specific machine configured to perform the operations and functions described in the examples herein.

[0101] The input unit 560 can be any type of device capable of inputting information to the electronic device 500. The input unit 560 can receive input numerical or character information and generate key signal inputs related to user settings and / or function control of the electronic device. It can include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. The output unit can be any type of device capable of presenting information and can include, but is not limited to, a display unit 550, a speaker 560, and other output units 590. Other output units 590 can include, but are not limited to, video / audio output terminals, vibrators, and / or printers. The communication unit 580 allows the electronic device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks. It can include, but is not limited to, a modem, network card, infrared communication device, wireless communication transceiver, and / or chipset, such as Bluetooth. TM Equipment, 802.11 equipment, Wi-Fi equipment, WiMAX equipment, cellular communication equipment and / or the like.

[0102] The application program 520b in working register 520 can be loaded to execute the various methods and steps described above, for example... Figure 1 Steps S110-S150 in the process Figure 2 Steps S232-S236 in the process Figure 3Steps S332-S338 in the above description. For example, in some embodiments, the various methods described above can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 570. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 500 via storage unit 570 and / or communication unit 580. When the computer program is loaded and executed by processor 510, one or more steps of method 100 described above can be performed. Alternatively, in other embodiments, processor 510 can be configured to perform method 100 by any other suitable means (e.g., by means of firmware).

[0103] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0104] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0105] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0106] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0107] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0108] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0109] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0110] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.

Claims

1. A video encoding method, comprising: Obtain the video to be encoded, which includes one or more video frames; For the current video frame in the one or more video frames, determine a plurality of reference frames corresponding to the current video frame; In response to determining that the plurality of reference frames need to be pruned based on their attributes, a biased reference direction for the current video frame is determined, the biased reference direction indicating the association between a target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; Prune the plurality of reference frames according to the preferred reference direction; as well as The video to be encoded is encoded based on the pruning results. Specifically, in response to determining that pruning of the multiple reference frames needs to be performed based on their attributes, determining the bias reference direction of the current video frame includes: The current video frame is divided to obtain multiple encoding blocks of a preset size; For each of the plurality of coding blocks, calculate the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost for that coding block; and The tendency reference direction of the current video frame is determined based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, the intra-frame prediction rate distortion cost, and the total number of the plurality of coding blocks.

2. The method according to claim 1, wherein, For each of the plurality of coding blocks, calculating the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost of that coding block includes: The inter-frame prediction rate-distortion cost between the coded block and the corresponding coded block in the forward neighboring reference frame of the current video frame is calculated as the forward inter-frame prediction rate-distortion cost; and The inter-frame prediction rate distortion cost between the coding block and the corresponding coding block in the backward neighboring reference frame of the current video frame is calculated as the backward inter-frame prediction rate distortion cost.

3. The method according to claim 2, wherein, Based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, the intra-frame prediction rate distortion cost, and the total number of the plurality of coding blocks, determining the tendency reference direction of the current video frame includes: Based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, and the intra-frame prediction rate distortion cost, determine whether the coding block is a forward prediction coding block or a backward prediction coding block. Determine the number of forward predictive coding blocks and backward predictive coding blocks in the plurality of coding blocks; and The tendency reference direction of the current video frame is determined based on the number of forward predictive coding blocks, the number of backward predictive coding blocks, and the total number of the plurality of coding blocks.

4. The method according to claim 3, wherein, Determining whether a coding block is a forward predictive coding block or a backward predictive coding block based on the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost includes: In response to determining that the forward inter-frame prediction rate-distortion cost of the coding block is less than the intra-frame prediction rate-distortion cost, the coding block is determined to be a forward prediction coding block; and In response to determining that the backward inter-frame prediction rate-distortion cost of the coding block is less than the intra-frame prediction rate-distortion cost, the coding block is determined to be a backward prediction coding block.

5. The method according to claim 3 or 4, wherein, Determining the tendency reference direction of the current video frame based on the number of forward predictive coding blocks, the number of backward predictive coding blocks, and the total number of the plurality of coding blocks includes: In response to determining that the number of forward-predicted coding blocks is greater than a first threshold multiple of the total number of the plurality of coding blocks and the number of backward-predicted coding blocks is less than a second threshold multiple of the total number of the plurality of coding blocks, the tendency reference direction of the current video frame is determined to be forward; and In response to determining that the number of forward predictive coding blocks is less than a second threshold multiple of the total number of the plurality of coding blocks and the number of backward predictive coding blocks is greater than a first threshold multiple of the total number of the plurality of coding blocks, the tendency reference direction of the current video frame is determined to be backward.

6. The method according to claim 5, wherein, Determining the tendency reference direction of the current video frame based on the number of forward predictive coding blocks, the number of backward predictive coding blocks, and the total number of the plurality of coding blocks further includes: The tendency reference direction of the current video frame is determined to be uncertain in response to the determination that it is not one of the following: The number of forward-predicted coding blocks is greater than a first threshold multiple of the total number of the plurality of coding blocks, and the number of backward-predicted coding blocks is less than a second threshold multiple of the total number of the plurality of coding blocks; and The number of forward predictive coding blocks is less than a second threshold multiple of the total number of the plurality of coding blocks, and the number of backward predictive coding blocks is greater than a first threshold multiple of the total number of the plurality of coding blocks.

7. The method according to any one of claims 2-4, wherein, In response to determining that pruning of the plurality of reference frames is to be performed based on the attributes of the plurality of reference frames, determining the bias reference direction of the current video frame further includes: The tilt reference direction of the current video frame is updated to obtain the updated tilt reference direction.

8. The method according to claim 7, wherein, Updating the tilt reference direction of the current video frame to obtain the updated tilt reference direction includes: In response to determining that the tendency reference direction of the current video frame is forward, the tendency reference direction of the forward adjacent reference frame of the current video frame is determined; and In response to determining that the tendency reference direction of the forward adjacent reference frame is backward, the tendency reference direction of the current video frame is updated to uncertain.

9. The method according to claim 7, wherein, Updating the tilt reference direction of the current video frame to obtain the updated tilt reference direction includes: In response to determining that the tilt reference direction of the current video frame is backward, the tilt reference direction of the backward adjacent reference frame of the current video frame is determined; and In response to determining that the tendency reference direction of the backward adjacent reference frame is forward, the tendency reference direction of the current video frame is updated to uncertain.

10. The method according to any one of claims 1-4, wherein, Determining which reference frames to prune based on their attributes includes: Determine the number of the plurality of reference frames; Determine whether the plurality of reference frames includes both a forward reference frame and a backward reference frame; and In response to determining that the number of the plurality of reference frames is greater than 2, and that the plurality of reference frames includes both forward reference frames and backward reference frames, the plurality of reference frames are pruned.

11. The method according to claim 10, wherein, Pruning the plurality of reference frames according to the preferred reference direction includes: In response to determining that the tendency reference direction is forward, pruning is performed on all backward reference frames in the plurality of reference frames; In response to determining that the bias reference direction is backward, pruning is performed on all forward reference frames among the plurality of reference frames; and In response to determining that the tendency reference direction is uncertain, no pruning is performed on the plurality of reference frames.

12. A video encoding apparatus, comprising: The acquisition module is configured to acquire a video to be encoded, the video to be encoded including one or more video frames; The first determining module is configured to determine, for the current video frame in the one or more video frames, a plurality of reference frames corresponding to the current video frame; The second determining module is configured to determine, in response to determining that the plurality of reference frames should be pruned based on the attributes of the plurality of reference frames, a biased reference direction of the current video frame, the biased reference direction indicating the association between a target reference frame and the current video frame, the target reference frame being included in the plurality of reference frames; A pruning module is configured to prune the plurality of reference frames according to the preferred reference direction; as well as The encoding module is configured to encode the video to be encoded based on the pruning results. Specifically, in response to determining that pruning of the multiple reference frames needs to be performed based on their attributes, determining the bias reference direction of the current video frame includes: The current video frame is divided to obtain multiple encoding blocks of a preset size; For each of the plurality of coding blocks, calculate the forward inter-frame prediction rate-distortion cost, the backward inter-frame prediction rate-distortion cost, and the intra-frame prediction rate-distortion cost for that coding block; and The tendency reference direction of the current video frame is determined based on the forward inter-frame prediction rate distortion cost, the backward inter-frame prediction rate distortion cost, the intra-frame prediction rate distortion cost, and the total number of the plurality of coding blocks.

13. An electronic device, comprising: At least one processor; as well as At least one memory communicatively connected to the at least one processor The at least one memory stores a computer program that, when executed by the at least one processor, implements the method as described in any one of claims 1-11.

14. A computer-readable storage medium storing a computer program, wherein, The computer program, when executed by a processor, implements the method as described in any one of claims 1-11.

15. A computer program product comprising a computer program, wherein, The computer program, when executed by a processor, implements the method as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Video coding method, device, storage medium and electronic equipment

    CN113891090A

  • Method and apparatus for fast image encoding for image compression

    KR1020210013916A