Video encoding methods, apparatus, electronic devices, storage media and computer program products

By using the results of the first encoding pass to correct the quantization parameters during multiple encoding passes, the problem of insufficient consideration of the reference dependency of coding units in inter-frame prediction is solved, thus achieving more efficient video coding.

CN123123564APending Publication Date: 2026-11-17BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611588869.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-14
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing video coding techniques fail to adequately consider the reference dependency of coding units in inter-frame prediction, resulting in decreased coding quality and low overall compression efficiency.

Method used

Through multiple encoding passes, the results of the first encoding pass are used to statistically analyze the true reference situation of each encoding block, and the quantization parameter adjustment values ​​in the second encoding pass are corrected. Taking into account the propagation of all reference frames, the quantization parameters are precisely adjusted.

Benefits of technology

It significantly improves the compression efficiency and encoding quality of video encoding, reduces bitrate fluctuations, and increases encoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123564A_ABST
    Figure CN123123564A_ABST
Patent Text Reader

Abstract

This disclosure provides a video coding method, apparatus, electronic device, storage medium, and computer program product. The video coding method includes: after the first encoding pass in a multi-pass coding process, acquiring the encoding result of the first pass; in a pre-analysis stage before the second encoding pass in the multi-pass coding process, calculating the quantization parameter adjustment amount of the current block of the current frame based on the encoding result of the first pass, and performing quantization parameter adjustment amount correction on the current block of the current frame based on the encoding result of the first pass, obtaining the corrected quantization parameter adjustment amount of the current block of the current frame; in the second encoding pass, encoding the current block of the current frame based on the corrected quantization parameter adjustment amount of the current block of the current frame. In this way, by fully utilizing the encoding information of the first pass to correct the QP adjustment value of the second pass, more precise dynamic adjustment of the QP value of each coding block can be achieved, thereby improving compression efficiency and coding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to video encoding / decoding and compression. More specifically, this disclosure relates to a video encoding method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0002] Traditional video encoders typically employ fixed quantizer parameters (QP) or static allocation strategies based on frame complexity for bitrate control. These methods do not adequately consider the reference dependencies of coding units (CUs) in inter-frame prediction. For example, if a CU is frequently referenced in subsequent frames, its coding quality degrades, leading to error propagation and impacting overall compression efficiency. To address the drawbacks of fixed QP or spatial complexity-based bitrate allocation strategies, the x264 encoder integrated a macroblock tree (MB Tree) algorithm, which was later inherited and improved by the x265 encoder into cuTree. cuTree considers the temporal reference relationships between frames, significantly improving compression efficiency by dynamically adjusting the QP values ​​of frequently referenced key CUs (reducing QP to improve quality). However, existing cuTree implementations are based on downsampled images and do not consider the complete inter-frame reference relationships, leaving room for further improvement in compression efficiency. Summary of the Invention

[0003] Embodiments of this disclosure provide a video encoding method, apparatus, electronic device, storage medium, and computer program product.

[0004] According to a first aspect of the embodiments of the present disclosure, a video encoding method is provided, comprising: after a first encoding pass in a multi-pass encoding process, obtaining the encoding result of the first pass; in a pre-analysis stage before a second encoding pass in the multi-pass encoding process, calculating a quantization parameter adjustment amount of the current block of the current frame based on the encoding result of the first pass, and performing quantization parameter adjustment amount correction on the current block of the current frame based on the encoding result of the first pass to obtain a corrected quantization parameter adjustment amount of the current block of the current frame; and encoding the current block of the current frame based on the corrected quantization parameter adjustment amount of the current block of the current frame in the second encoding pass.

[0005] According to an exemplary embodiment of this disclosure, calculating the quantization parameter adjustment amount of the current block of the current frame based on the encoding result of the first pass includes: determining the real reference frame of the current block of the current frame based on the encoding result of the first pass by traversing all reference frames of the current frame; calculating the propagation cost from the current frame to the real reference frame; and calculating the quantization parameter adjustment amount of the current block of the current frame based on the propagation cost.

[0006] According to an exemplary embodiment of this disclosure, performing a quantization parameter adjustment correction on the current block of the current frame based on the encoding result of the first pass includes: determining the reference area of ​​the current block of the current frame based on the encoding result of the first pass; determining an adjustment correction factor for the current block of the current frame based on the reference area of ​​the current block of the current frame, wherein the adjustment correction factor is positively correlated with the reference area; and correcting the quantization parameter adjustment based on the adjustment correction factor.

[0007] According to an exemplary embodiment of this disclosure, determining an adjustment correction factor for the current block of the current frame based on the referenced area of ​​the current block of the current frame includes: calculating the average value of the referenced area of ​​the current frame; and determining an adjustment correction factor for each block of the current frame based on the ratio between the referenced area of ​​the current block of the current frame and the average value of the referenced area, wherein the ratio is positively correlated with the adjustment correction factor.

[0008] According to an exemplary embodiment of the present disclosure, determining the adjustment correction factor of the current block of the current frame based on the referenced area of ​​the current block of the current frame includes: determining the adjustment correction factor of the current block of the current frame based on the referenced area of ​​the current block of the current frame and the temporal level of the current frame, wherein the adjustment correction factor is negatively correlated with the temporal level.

[0009] According to an exemplary embodiment of this disclosure, determining an adjustment correction factor for the current block of the current frame based on the reference area of ​​the current block of the current frame includes: determining the distortion of the current frame in the rate-distortion optimization process based on the first pass coding result; correcting the reference area of ​​the current block of the current frame based on the distortion; and determining the adjustment correction factor for the current block of the current frame based on the corrected reference area of ​​the current block of the current frame.

[0010] According to an exemplary embodiment of the present disclosure, correcting the reference area of ​​the current block of the current frame based on the distortion includes: reducing the reference area of ​​the current block of the current frame when the distortion is greater than a predetermined threshold.

[0011] According to an exemplary embodiment of the present disclosure, performing quantization parameter adjustment correction on the current block of the current frame includes: performing quantization parameter adjustment correction on the current block of the current frame that meets a preset condition, wherein the preset condition is that the quantization parameter adjustment of the current block is greater than a predetermined threshold.

[0012] According to an exemplary embodiment of this disclosure, the predetermined threshold is determined based on the average value of the quantization parameter adjustment amount of the current frame.

[0013] According to a second aspect of the embodiments of the present disclosure, a video encoding apparatus is provided, comprising: an encoding result acquisition unit configured to acquire the encoding result of a first pass after a first pass in a multi-pass encoding process; a quantization parameter adjustment amount determination unit configured to, during a pre-analysis stage before a second pass in the multi-pass encoding process, calculate the quantization parameter adjustment amount of a current block of a current frame based on the encoding result of the first pass, and perform quantization parameter adjustment amount correction on the current block of the current frame based on the encoding result of the first pass, to obtain the corrected quantization parameter adjustment amount of the current block of the current frame; and an encoding unit configured to encode the current block of the current frame based on the corrected quantization parameter adjustment amount of the current block of the current frame during the second pass of encoding.

[0014] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment determination unit is configured to: determine the real reference frame of the current block of the current frame by traversing all reference frames of the current frame and based on the encoding result of the first pass; calculate the propagation cost from the current frame to the real reference frame; and calculate the quantization parameter adjustment amount of the current block of the current frame based on the propagation cost.

[0015] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment determination unit is configured to: determine the reference area of ​​the current block of the current frame based on the encoding result of the first pass; determine the adjustment correction factor of the current block of the current frame based on the reference area of ​​the current block of the current frame, wherein the adjustment correction factor is positively correlated with the reference area; and correct the quantization parameter adjustment based on the adjustment correction factor.

[0016] According to an exemplary embodiment of the present disclosure, the quantization parameter adjustment amount determination unit is configured to: calculate the average value of the reference area of ​​the current frame; and determine the adjustment amount correction factor for each block of the current frame based on the ratio between the reference area of ​​the current block and the average value of the reference area, wherein the ratio is positively correlated with the adjustment amount correction factor.

[0017] According to an exemplary embodiment of the present disclosure, the quantization parameter adjustment amount determination unit is configured to: determine an adjustment amount correction factor for the current block of the current frame based on the referenced area of ​​the current block of the current frame and the temporal level of the current frame, wherein the adjustment amount correction factor is negatively correlated with the temporal level.

[0018] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment amount determination unit is configured to: determine the distortion of the current frame in the rate-distortion optimization process based on the first pass encoding result; correct the reference area of ​​the current block of the current frame based on the distortion; and determine the adjustment amount correction factor of the current block of the current frame based on the corrected reference area of ​​the current block of the current frame.

[0019] According to an exemplary embodiment of the present disclosure, the quantization parameter adjustment amount determination unit is configured to: reduce the reference area of ​​the current block of the current frame when the distortion is greater than a predetermined threshold.

[0020] According to an exemplary embodiment of the present disclosure, the quantization parameter adjustment amount determination unit is configured to: perform quantization parameter adjustment amount correction on the current block in the current frame that meets a preset condition, wherein the preset condition is that the quantization parameter adjustment amount of the current block is greater than a predetermined threshold.

[0021] According to an exemplary embodiment of this disclosure, the predetermined threshold is determined based on the average value of the quantization parameter adjustment amount of the current frame.

[0022] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising: at least one processor; at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform a video encoding method according to the present disclosure.

[0023] According to a fourth aspect of embodiments of the present disclosure, a computer-readable storage medium is provided that stores a bit stream and instructions, which, when executed by a computing device having one or more processors, cause the one or more processors to perform a video encoding method according to the present disclosure.

[0024] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, including computer instructions that, when executed by at least one processor, implement the video encoding method according to the present disclosure.

[0025] In this disclosure, since the encoder has multiple encoding passes, and the inter-frame prediction process is performed based on the original resolution during the preceding encoding process, the real reference information from the preceding encoding process can be reused to guide the optimization of subsequent encoding processes. That is, the QP adjustment value of the second encoding pass can be corrected by fully utilizing the information from the first encoding pass, enabling more precise dynamic adjustment of the QP value of each coding block, thereby improving compression efficiency and encoding efficiency.

[0026] According to exemplary embodiments of this disclosure, by fully considering all reference frames in the actual coding process, the temporal reference relationship (propagation chain) is considered more completely, which can greatly improve coding efficiency.

[0027] According to exemplary embodiments of this disclosure, an adjustment correction factor can be determined based on the actual reference area of ​​the current block to adjust the quantization parameters of the current block. For blocks with a large reference area during the first encoding pass (e.g., CTU), the quantization parameters are appropriately lowered to improve coding quality, resulting in better reference frames for subsequent frames. Simultaneously, to reduce bitrate fluctuations, for blocks with a small reference area (e.g., CTU), the quantization parameters are appropriately increased to reduce the bitrate.

[0028] It will be understood that the above general description and the following detailed description are merely examples and do not limit this disclosure. Attached Figure Description

[0029] The accompanying drawings, which are incorporated in and form part of this specification, illustrate examples according to this disclosure and, together with this description, serve to explain the principles of this disclosure.

[0030] Figure 1 A schematic diagram of the structure of GOP 16 in the related technology is shown; Figure 2 This is a flowchart illustrating a video encoding method according to an exemplary embodiment of the present disclosure; Figure 3 A schematic diagram illustrating a method for calculating the referenced area according to an exemplary embodiment of the present disclosure; Figure 4 This is a block diagram illustrating a video encoding apparatus according to an exemplary embodiment of the present disclosure; Figure 5 This is a block diagram illustrating an electronic device according to exemplary embodiments of the present disclosure. Detailed Implementation

[0031] Referring now to the detailed description, examples of which are illustrated in the accompanying drawings. Numerous non-limiting details are set forth in the following detailed description to aid in understanding the subject matter presented herein. However, various alternatives may be used without departing from the scope of the claims, and the subject matter may be practiced without these specific details. For example, the subject matter presented herein can be implemented on many types of electronic devices with digital video capabilities.

[0032] It should be noted that the terms "first," "second," etc., used in the specification, claims, and drawings of this disclosure are used to distinguish objects and not to describe any specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in sequences other than those shown in the drawings or described in this disclosure.

[0033] In related technologies, cuTree is based on look-ahead processing. Look-ahead typically pre-reads dozens or even hundreds of frames of images into memory for processing and analysis. Furthermore, it uses 8x8 blocks of the downsampled image as coding units, performing intra-frame and inter-frame cost calculations separately. The inter-frame cost calculation process follows a pyramid structure. Taking a Group of Pictures (GOP) of 16 as an example... Figure 1 This is a schematic diagram illustrating the structure of GOP 16 in the relevant art. (Refer to...) Figure 1 Each small square represents a frame of image, and the number in the square is the image's display order count (POC). The image pointed to by the arrow is the reference frame for the current image. Furthermore, if the POC is less than that of the current frame, it is usually called the forward reference frame; otherwise, it can be called the backward reference frame.

[0034] For example, POC 16 corresponds only to the forward reference frame POC 0; the forward reference frame of POC 8 is POC 0, and the backward reference frame is POC 16; the forward reference frame of POC 4 is POC 0, and the backward reference frame is POC 8; the forward reference frame of POC 6 is POC 4, and the backward reference frame is POC 8, and so on.

[0035] In related technologies, considering the impact of the propagation chain, taking POC 6 as an example, although it does not directly reference POC 0, its forward reference frame POC 4 references POC 0. Therefore, the coding quality of POC 0 will indirectly affect the coding quality of POC 6. Based on this, cuTree takes into account the cumulative propagation error, obtaining the reference value of each frame by reverse propagating the reference situation. Figure 1For example, all frames after POC 16 are pre-calculated and passed to POC 16. For instance, POC 1-6 calculates the propagation value according to the post-order traversal path of the binary tree, with the propagation order being: 1-3-2-5-7-6-4-9-11-10-13-15-14-12-8-16. It is evident that the later the frame is propagated, the greater its reference value. Furthermore, since propagation generally uses 8x8 blocks as the basic unit, and each basic unit is referenced differently, the reference value of each basic unit differs from others, resulting in different QP adjustment ranges. This achieves the effect of adaptive dynamic adjustment of QP.

[0036] However, the above-mentioned solutions in the relevant technologies have the following drawbacks: 1. Based solely on downsampled images, motion search results will deviate significantly from those at the original resolution, leading to invalid propagation.

[0037] 2. Only the propagation of the reference frame at position 0 of the reference image list is considered, while the cases of the other reference frames are ignored, resulting in a large room for performance improvement.

[0038] To address the aforementioned problems in related technologies, this disclosure proposes a cuTree optimization method based on two-pass coding. In a multi-pass coding chain, by fully utilizing the information from the first pass of coding to guide the optimization of the second pass of coding in cuTree, the coding compression efficiency can be significantly improved.

[0039] This disclosure mainly involves the following two improvements: 1. By statistically analyzing the reference situation at the original resolution during the first actual encoding process, the adjustment value of QP during the second encoding process is corrected.

[0040] 2. The cuTree propagation process takes into account the propagation of all reference frames, making the propagation chain closer to the actual coding situation, and thus making the QP adjustment value more accurate.

[0041] Figure 2 This is a flowchart illustrating a video encoding method according to an exemplary embodiment of the present disclosure.

[0042] Reference Figure 2 In step S210, after the first encoding pass in the multi-pass encoding process, the encoding result of the first pass can be obtained.

[0043] In this disclosure, the pre-coding process can be executed normally according to the original encoding process. After execution, the actual reference situation of each CU can be counted, and then the referenced area size of each coding tree unit (CTU) of each referenced frame can be obtained by accumulation. Figure 3 This is a schematic diagram illustrating how the referenced area is calculated according to an exemplary embodiment of the present disclosure. (Refer to...) Figure 3 The referenced area of ​​the 9th and 10th CTUs in the referenced frame can be: the area of ​​cu0 divided by 2 plus the area of ​​cu1 divided by 4; the referenced area of ​​the 13th and 14th CTUs can be: the area of ​​cu1 divided by 4.

[0044] It should be noted that, in this disclosure, in order to reduce the amount of information that needs to be saved in the first pass of encoding, the reference information of each frame is stored at the CTU level. If, in order to further improve encoding performance, it can also be stored in finer-grained blocks, which can be flexibly configured based on the actual situation, and this disclosure does not impose specific restrictions on this.

[0045] In step S220, during the pre-analysis stage before the second encoding pass in the multi-pass encoding process, the quantization parameter adjustment amount of the current block of the current frame can be calculated based on the encoding result of the first pass, and the quantization parameter adjustment amount of the current block of the current frame can be corrected based on the encoding result of the first pass, so as to obtain the corrected quantization parameter adjustment amount of the current block of the current frame.

[0046] According to an exemplary embodiment of this disclosure, by traversing all reference frames of the current frame, the true reference frame of the current block of the current frame can be determined based on the encoding result of the first pass. Then, the propagation cost from the current frame to the true reference frame can be calculated. Next, the quantization parameter adjustment amount of the current block of the current frame can be calculated based on the propagation cost.

[0047] In this way, by fully considering all reference frames in the actual coding process, the temporal reference relationship (propagation chain) is considered more completely, which can greatly improve coding efficiency.

[0048] According to exemplary embodiments of this disclosure, an adjustment correction factor can be determined based on the actual reference area of ​​the current block to adjust the quantization parameters of the current block. For blocks with a large reference area during the first encoding pass (e.g., CTU), the quantization parameters are appropriately lowered to improve coding quality, resulting in better reference frames for subsequent frames. Simultaneously, to reduce bitrate fluctuations, for blocks with a small reference area (e.g., CTU), the quantization parameters are appropriately increased to reduce the bitrate.

[0049] Specifically, the reference area of ​​the current block in the current frame can be determined based on the encoding result of the first pass. Then, based on the reference area of ​​the current block in the current frame, the adjustment correction factor of the current block in the current frame can be determined, where the adjustment correction factor can be positively correlated with the reference area. Next, the quantization parameter adjustment can be corrected based on the adjustment correction factor. For example, for each 8-bit of the current frame... 8 blocks, the corrected quantization parameter adjustment amount can be:

[0050] in, This is the adjusted amount of the corrected quantization parameters for the current block of the current frame. This is the adjustment amount for the quantization parameters of the current block in the current frame. This is the adjustment correction factor for the current block of the current frame.

[0051] According to exemplary embodiments of this disclosure, the average value of the referenced area of ​​the current frame can be calculated. For example, the average value of the referenced area of ​​the current frame can be calculated using the following formula:

[0052] in, This represents the average value of the referenced area in the current frame, where N represents the number of CTUs contained in the current frame. This represents the reference area counted for the i-th CTU in the current frame during the first encoding pass (pass1). For example, it can be the average of the reference areas of all CTUs in the current frame, or the average of the reference areas of the effective CTUs in the current frame. Here, "effective CTU" refers to... The value is greater than a certain threshold (for example, the threshold could be 16). That is, in this disclosure, only statistics are considered. CTUs larger than a certain threshold can be selected, and invalid CTUs with too small an area can be removed.

[0053] Then, the adjustment correction factor for each block in the current frame can be determined based on the ratio between the referenced area of ​​the current block and the average value of the referenced area, where the ratio and the adjustment correction factor can be positively correlated.

[0054] For example, considering the overall situation of the entire frame, the adjustment correction factor can be calculated using the following formula:

[0055] in, Here, r represents the adjustment correction factor for the current block of the current frame, and r represents the overall algorithm adjustment strength. This represents the referenced area of ​​the current block in the current frame. This represents the average value of the referenced area in the current frame.

[0056] According to exemplary embodiments of this disclosure, the adjustment correction factor for the current block of the current frame can be determined based on the referenced area of ​​the current block and the temporal level t of the current frame, wherein the adjustment correction factor may be negatively correlated with the temporal level t. For example, in the above formula, the value of r can be adaptively adjusted according to the temporal level of the current frame; the higher the temporal level, the smaller the value of r.

[0057] For example, for a frame with a time-domain level of t, the adjustment correction factor can be set to 0.2. `table[t]`, where `table` can be defined as: [1.25, 1.2, 1.1, 1.05, 1.0, 0.98, 0.98]. It can be seen that the higher the time-domain level, the lower the adjustment force can be. Furthermore, all 8 elements within the i-th CTU... Blocks of 8 can share the same adjustment correction factor.

[0058] According to an exemplary embodiment of this disclosure, the first pass encoding result may include, in addition to the reference area of ​​each block, the distortion of each frame during rate-distortion optimization (RDO) may also be recorded. Distortion and reference area can be considered simultaneously to adjust the quantization parameter adjustment amount to maximize encoding performance. For example, when the distortion of a frame is relatively large, the quantization parameter adjustment amount can be reduced to decrease the adjustment intensity. The distortion of the current frame during rate-distortion optimization can be determined based on the first pass encoding result. Then, the reference area of ​​the current block in the current frame can be corrected based on the distortion. Next, the adjustment factor for the current block in the current frame can be determined based on the corrected reference area of ​​the current block in the current frame.

[0059] According to an exemplary embodiment of this disclosure, when the aforementioned distortion exceeds a predetermined threshold, the reference area of ​​the current block in the current frame can be reduced. For example, the reference area of ​​the current block can be corrected using the following formula:

[0060] in, The corrected reference area of ​​the current block in the current frame. The referenced area of ​​the current block in the current frame before it was corrected. For correction coefficients, and , This indicates the distortion of the current frame during the rate-distortion optimization process. This indicates the aforementioned predetermined threshold.

[0061] According to an exemplary embodiment of this disclosure, in order to prevent the existing algorithm adjustment amount from being further amplified when it is already sufficiently large, a preset condition for performing quantization parameter adjustment amount correction can be set. When the current block in the current frame meets the preset condition, quantization parameter adjustment amount correction can be performed, wherein the preset condition can be that the quantization parameter adjustment amount of the current block is greater than a predetermined threshold.

[0062] According to an exemplary embodiment of this disclosure, the predetermined threshold can be determined based on the average value of the quantization parameter adjustment amount of the current frame.

[0063] For example, the above preset conditions can be expressed as follows: .

[0064] in, This is the adjustment amount for the quantization parameters of the current block in the current frame. The average value of the quantization parameter adjustment for the current frame.

[0065] Return to reference Figure 2 In step S230, during the second encoding pass, the current block of the current frame can be encoded based on the adjusted quantization parameters of the current block in the current frame. The quantization parameters of the current block can be adjusted using the adjusted quantization parameters, and the current block can be quantized based on these adjusted quantization parameters.

[0066] Figure 4 This is a block diagram illustrating a video encoding apparatus 400 according to an exemplary embodiment of the present disclosure.

[0067] Reference Figure 4 The video encoding device 400 may include an encoding result acquisition unit 401, a quantization parameter adjustment amount determination unit 402, and an encoding unit 403.

[0068] The encoding result acquisition unit 401 can acquire the encoding result of the first pass after the first pass of the multi-pass encoding process.

[0069] In the pre-analysis stage before the second encoding pass in the multi-pass encoding process, the quantization parameter adjustment determination unit 402 can calculate the quantization parameter adjustment of the current block of the current frame based on the encoding result of the first pass, and can perform quantization parameter adjustment correction on the current block of the current frame based on the encoding result of the first pass to obtain the corrected quantization parameter adjustment of the current block of the current frame.

[0070] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment determination unit 402 can determine the true reference frame of the current block of the current frame based on the encoding result of the first pass by traversing all reference frames of the current frame. Then, the quantization parameter adjustment determination unit 402 can calculate the propagation cost from the current frame to the true reference frame. Next, the quantization parameter adjustment determination unit 402 can calculate the quantization parameter adjustment of the current block of the current frame based on the propagation cost.

[0071] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment amount determination unit 402 can determine the reference area of ​​the current block of the current frame based on the encoding result of the first pass. Then, the quantization parameter adjustment amount determination unit 402 can determine the adjustment amount correction factor of the current block of the current frame based on the reference area of ​​the current block of the current frame, wherein the adjustment amount correction factor can be positively correlated with the reference area. Next, the quantization parameter adjustment amount determination unit 402 can correct the quantization parameter adjustment amount based on the adjustment amount correction factor.

[0072] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment amount determination unit 402 can calculate the average value of the reference area of ​​the current frame. Then, the quantization parameter adjustment amount determination unit 402 can determine the adjustment amount correction factor for each block of the current frame based on the ratio between the reference area of ​​the current block and the average value of the reference area, wherein the ratio and the adjustment amount correction factor can be positively correlated.

[0073] According to an exemplary embodiment of the present disclosure, the quantization parameter adjustment amount determination unit 402 can determine the adjustment amount correction factor of the current block of the current frame based on the reference area of ​​the current block of the current frame and the temporal level t of the current frame, wherein the adjustment amount correction factor may be negatively correlated with the temporal level t.

[0074] According to an exemplary embodiment of this disclosure, the quantization parameter adjustment amount determination unit 402 can determine the distortion of the current frame in the rate-distortion optimization process based on the first pass encoding result. Then, the quantization parameter adjustment amount determination unit 402 can correct the reference area of ​​the current block of the current frame based on the distortion. Next, the quantization parameter adjustment amount determination unit 402 can determine the adjustment amount correction factor of the current block of the current frame based on the corrected reference area of ​​the current block of the current frame.

[0075] According to an exemplary embodiment of the present disclosure, the quantization parameter adjustment amount determination unit 402 may reduce the reference area of ​​the current block of the current frame when the distortion is greater than a predetermined threshold.

[0076] According to an exemplary embodiment of the present disclosure, for a current block in the current frame that meets a preset condition, the quantization parameter adjustment amount determination unit 402 can perform quantization parameter adjustment amount correction, wherein the preset condition can be that the quantization parameter adjustment amount of the current block is greater than a predetermined threshold, wherein the predetermined threshold can be determined based on experience.

[0077] According to an exemplary embodiment of this disclosure, the predetermined threshold can be determined based on the average value of the quantization parameter adjustment amount of the current frame.

[0078] During the second encoding pass, the encoding unit 403 can encode the current block of the current frame based on the adjusted quantization parameters of the current block of the current frame.

[0079] Figure 5 A block diagram of an electronic device 500 according to an exemplary embodiment of the present disclosure is shown.

[0080] Reference Figure 5 The electronic device 500 includes at least one memory 501 and at least one processor 502. The at least one memory 501 stores instructions that, when executed by the at least one processor 502, perform a video encoding method according to an exemplary embodiment of the present disclosure.

[0081] As an example, electronic device 500 may be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned instructions. Here, electronic device 500 is not necessarily a single electronic device, but may be a collection of any devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 500 may also be part of an integrated control system or system manager, or may be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.

[0082] In electronic device 500, processor 502 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.

[0083] The processor 502 can execute instructions or code stored in the memory 501, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.

[0084] The memory 501 may be integrated with the processor 502, for example, by arranging RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 501 may include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 501 and the processor 502 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 502 to read files stored in the memory.

[0085] In addition, electronic device 500 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of electronic device 500 can be interconnected via a bus and / or network.

[0086] According to exemplary embodiments of this disclosure, a computer-readable storage medium may also be provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the video encoding method described above. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.

[0087] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, including a computer program that, when executed by a processor, implements the video encoding method according to the present disclosure.

[0088] The description in this disclosure has been presented for illustrative purposes and is not intended to be exhaustive or limited to this disclosure. Many modifications, variations, and alternative embodiments will be apparent to those skilled in the art from the teachings presented in the foregoing description and the associated drawings.

[0089] Unless otherwise specifically stated, the order of steps in the method according to this disclosure is intended to be illustrative only, and the steps of the method according to this disclosure are not limited to the specific order described above, but may be changed according to actual circumstances. Furthermore, at least one step in the method according to this disclosure may be adjusted, combined, or omitted as needed.

[0090] The examples chosen and described are intended to explain the principles of this disclosure and to enable others skilled in the art to understand the various embodiments of this disclosure, and preferably to utilize the basic principles and various embodiments with various modifications suitable for the intended particular purpose. Therefore, it will be understood that the scope of this disclosure is not limited to the specific examples of the disclosed embodiments, and that modifications and other embodiments are intended to be included within the scope of this disclosure.

Claims

1. A video encoding method, characterized in that, include: After the first encoding pass in a multi-pass encoding process, obtain the encoding result of the first pass; In the pre-analysis stage before the second encoding pass in the multi-pass encoding process, based on the encoding result of the first pass, the quantization parameter adjustment amount of the current block of the current frame is calculated, and based on the encoding result of the first pass, the quantization parameter adjustment amount of the current block of the current frame is corrected to obtain the corrected quantization parameter adjustment amount of the current block of the current frame. During the second encoding pass, the current block of the current frame is encoded based on the corrected quantization parameter adjustment amount of the current block of the current frame.

2. The video encoding method as described in claim 1, characterized in that, Based on the encoding results of the first pass, the quantization parameter adjustment amount of the current block in the current frame is calculated, including: By traversing all reference frames of the current frame, the real reference frame of the current block of the current frame is determined based on the encoding results of the first pass; Calculate the propagation cost from the current frame to the real reference frame; The quantization parameter adjustment amount of the current block of the current frame is calculated based on the propagation cost.

3. The video encoding method as described in claim 1, characterized in that, Based on the encoding results of the first pass, the quantization parameter adjustment of the current block of the current frame is corrected, including: The reference area of ​​the current block in the current frame is determined based on the encoding results of the first pass; Based on the referenced area of ​​the current block in the current frame, an adjustment correction factor for the current block in the current frame is determined, wherein the adjustment correction factor is positively correlated with the referenced area. The adjustment amount of the quantization parameter is corrected based on the adjustment amount correction factor.

4. The video encoding method as described in claim 3, characterized in that, Based on the referenced area of ​​the current block in the current frame, determine the adjustment correction factor for the current block in the current frame, including: Calculate the average value of the referenced area of ​​the current frame; Based on the ratio between the referenced area of ​​the current block in the current frame and the average value of the referenced area, an adjustment correction factor for each block in the current frame is determined, wherein the ratio is positively correlated with the adjustment correction factor.

5. The video encoding method as described in claim 3, characterized in that, Determining the adjustment correction factor for the current block of the current frame based on the referenced area of ​​the current block of the current frame includes: Based on the referenced area of ​​the current block in the current frame and the temporal level of the current frame, the adjustment correction factor of the current block in the current frame is determined, wherein the adjustment correction factor is negatively correlated with the temporal level.

6. The video encoding method as described in claim 3, characterized in that, Based on the referenced area of ​​the current block in the current frame, determine the adjustment correction factor for the current block in the current frame, including: Based on the encoding results of the first pass, determine the distortion of the current frame during the rate-distortion optimization process; The reference area of ​​the current block in the current frame is corrected based on the distortion. Based on the corrected reference area of ​​the current block in the current frame, the adjustment correction factor of the current block in the current frame is determined.

7. The video encoding method as described in claim 6, characterized in that, Correcting the reference area of ​​the current block in the current frame based on the distortion includes: If the distortion exceeds a predetermined threshold, the reference area of ​​the current block in the current frame is reduced.

8. The video encoding method as described in claim 1, characterized in that, Performing quantization parameter adjustment correction on the current block of the current frame includes: For the current block in the current frame that meets a preset condition, a quantization parameter adjustment is performed, wherein the preset condition is that the quantization parameter adjustment of the current block is greater than a predetermined threshold.

9. The video encoding method as described in claim 8, characterized in that, The predetermined threshold is determined based on the average value of the quantization parameter adjustment amount of the current frame.

10. A video encoding device, characterized in that, The video encoding device includes: The encoding result acquisition unit is configured to acquire the encoding result of the first pass after the first pass of the multi-pass encoding process; The quantization parameter adjustment determination unit is configured to, in the pre-analysis stage before the second encoding pass in the multi-pass encoding process, calculate the quantization parameter adjustment of the current block of the current frame based on the encoding result of the first pass, and perform quantization parameter adjustment correction on the current block of the current frame based on the encoding result of the first pass, to obtain the corrected quantization parameter adjustment of the current block of the current frame. The encoding unit is configured to encode the current block of the current frame based on the corrected quantization parameter adjustment amount of the current block of the current frame during the second encoding pass.

11. An electronic device, characterized in that, include: At least one processor; At least one memory that stores computer-executable instructions. The computer-executable instructions, when executed by at least one processor, cause at least one processor to perform the video encoding method as described in any one of claims 1 to 9.

12. A computer-readable storage medium storing a bit stream and instructions, which, when executed by a computing device having one or more processors, cause the one or more processors to perform the video encoding method as described in any one of claims 1 to 9.

13. A computer program product comprising computer instructions, characterized in that, The computer instructions, when executed by at least one processor, implement the video encoding method as described in any one of claims 1 to 9.