Video coding rate control method and device

By adaptively adjusting the constraint range of LCU-level Lagrangian multiplier and quantization parameters in HEVC video encoding, the problem of instantaneous code rate fluctuation in HEVC video encoding is solved, and more stable code rate control and higher encoding efficiency are achieved.

CN115118975BActive Publication Date: 2025-09-02ASR MICROELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210668453.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2025-09-02
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

The existing HEVC video encoding technology has severe fluctuations in instantaneous code rate control, especially when the content of the video frame is large or contains a large number of SKIP blocks, resulting in a decrease in encoding efficiency and oscillation of the code rate control.

Method used

By calculating the difference between the target number of coded bits and the actual number of coded bits in the previous video frame, the credibility of the current frame-level Lagrangian multiplier is determined, and the constraint range of the LCU-level Lagrangian multiplier and quantization parameters is adjusted to achieve adaptive bit rate control.

Benefits of technology

It effectively suppresses instantaneous code rate fluctuations, improves video encoding efficiency, and avoids code rate control oscillation, ensuring the stability and efficiency of encoding quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115118975B_ABST
    Figure CN115118975B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for bit rate control of video coding. The credibility Cf of the frame-level Lagrangian multiplier of the current video frame to be coded is calculated based on the target coding bit number and the actual coding bit number of the previous video frame. The constraint range adjustment coefficient λ of the LCU-level Lagrangian multiplier is calculated based on Cf. scale According to λ scale Calculate the constraint range of LCU-level quantization parameter to adjust the offset QP offset According to the frame-level Lagrange multiplier and λ of the current video frame to be encoded scale A first value range is set for the LCU-level Lagrange multiplier of each LCU in the current video frame to be encoded. Also, a first value range is set for the LCU-level Lagrange multiplier of each LCU in the current video frame to be encoded according to the frame-level quantization parameter and QP of the current video frame to be encoded. offset The second value range is set for the LCU-level quantization parameter of each LCU in the current video frame to be encoded. The present invention can adaptively and in real time adjust the first value range and the second value range, suppress instantaneous bit rate fluctuations, and effectively improve video encoding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a video coding technology, in particular to a HEVC high-definition digital video coding technology. Background Art

[0002] Video coding compresses redundant components in video images and uses the least amount of data possible to represent video information. HEVC (High Efficiency Video Coding, also known as H.265) is a next-generation video coding standard. Compared to the previous generation video coding standard, AVC (Advanced Video Coding, also known as H.264), HEVC can reduce the encoding bit rate by approximately 50% while achieving the same video encoding quality, roughly doubling the video compression performance of AVC.

[0003] Video coding technology uses image blocks as the most basic coding unit. In HEVC, the basic coding unit is called a CU (Coding Unit); a CU can be an image block of 64 pixels x 64 pixels, 32 pixels x 32 pixels, 16 pixels x 16 pixels, or 8 pixels x 8 pixels. The 64 pixels x 64 pixels image block is also called the largest coding unit (LCU).

[0004] In real life, the channel bandwidth capacity used to transmit video is limited. If the video encoding bit rate is too high, exceeding the channel bandwidth capacity, it will cause video transmission congestion or even packet loss. If the video encoding bit rate is too low, the channel bandwidth will not be fully utilized, and higher video quality cannot be achieved. Therefore, it is necessary to use rate control technology to control the output bit rate of the video encoder to match the channel bandwidth capacity.

[0005] The goal of rate control technology is to adjust the encoding parameters of the video encoder to ensure that the output bitrate of the video encoder is equal to the preset target bitrate, while minimizing coding distortion to improve video encoding quality. The rate control algorithm currently used in the HEVC reference encoder (HM) (High Efficiency Video Coding Test Model) is based on the JCTVC-K0103 proposal. The JCTVC-K0103 proposal establishes a mathematical relationship between the encoding bitrate R and the Lagrange multiplier λ (i.e., the R-λ model), achieving rate control through two steps: target bit allocation and target bit control.

[0006] See also Figure 1In the JCTVC-K0103 proposal, target bit allocation is performed at three levels: the GOP (Group of Pictures, a set of temporally continuous video frames) level, the video frame level, and the basic coding unit level. Considering computational complexity, the LCU is generally selected as the basic unit of bit allocation in the target bit allocation at the basic coding unit level. Therefore, the target bit allocation at the basic coding unit level is also called the target bit allocation at the LCU level. In the rate control algorithm of the JCTVC-K0103 proposal, rate control is primarily achieved by adjusting two coding parameters: the Lagrange multiplier λ and the quantization parameter QP at the video frame and LCU levels. Adjusting the Lagrange multiplier λ and the quantization parameter QP at the video frame and LCU levels is actually the process of calculating reasonable values ​​for the Lagrange multiplier λ and the quantization parameter QP at the video frame and LCU levels.

[0007] After the target bit allocation at the video frame level, the target coding bit number of the current video frame to be encoded is determined. The next step is to calculate the frame-level Lagrange multiplier λ of the current video frame to be encoded based on the R-λ model proposed in the JCTVC-K0103 proposal. Frame The value of λ Frame =α·bpp β (Formula 1). In Formula 1, α and β are parameters of the R-λ model. Their values ​​are determined by the video content and the video encoder configuration parameters and are continuously updated as the video encoding process progresses. BPP (bit per pixel) is the average target number of coding bits allocated to each pixel. When calculating the frame-level Lagrange multiplier λ Frame When bpp is taken as the quotient of the target number of coding bits of the video frame to be coded and the number of pixels of the video frame to be coded. Frame Afterwards, the frame-level quantization parameter QP of the current video frame to be encoded is calculated according to the following formula: Frame , QP Frame =4.2005×ln(λ Frame )+13.7122(Formula 2). In Formula 2, “ln” is the natural logarithm operator.

[0008] Similarly, after the target bit allocation at the LCU level, the target coding bit number of each LCU in the current video frame to be encoded is determined, and then the LCU-level Lagrange multiplier λ of each LCU is calculated according to the R-λ model proposed in the JCTVC-K0103 proposal. LCU and LCU-level quantization parameter QP LCU .

[0009] In the JCTVC-K0103 proposal, in order to avoid excessive fluctuations in video coding quality, the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded is calculated. LCU and LCU-level quantization parameter QP LCU After that, the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded is LCU and LCU-level quantization parameter QP LCU Upper and lower limits are set respectively. If the calculated LCU-level Lagrange multiplier λ of a certain LCU in the current video frame to be encoded LCU Greater than the upper limit Then let the LCU-level Lagrange multiplier λ of the LCU be LCU Equal to the upper limit The same applies to the remaining upper and lower limits.

[0010] From formula 3 and formula 4, we can see that in the JCTVC-K0103 proposal, the frame-level Lagrange multiplier λ of the current video frame to be encoded is Frame and frame-level quantization parameter QP Frame Directly determines the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded LCU and LCU-level quantization parameter QP LCU If the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame and frame-level quantization parameter QP Frame The calculation result is very close to the ideal value, then the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded is LCU and LCU-level quantization parameter QP LCU can be constrained within a suitable range, which can avoid excessive fluctuations in video quality and rate control oscillation. If the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame and frame-level quantization parameter QP Frame If the calculation result deviates greatly from the ideal value, the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded is LCU and LCU-level quantization parameter QP LCU The codec will be constrained within the wrong range, easily encoding jumbo frames or tiny frames, resulting in dramatic instantaneous bitrate fluctuations. A jumbo frame is one whose size far exceeds the average frame size, while a tiny frame is one whose size far exceeds the average frame size.

[0011] During video encoding using the HEVC video encoder, if the R-λ model proposed in the JCTVC-K0103 proposal is used for rate control, the instantaneous bit rate of the video encoding will fluctuate dramatically in the following two situations.

[0012] The first case is: if the content difference between the previous and next video frames is very small or even completely the same, a large number of CU blocks in the next video frame will be encoded as SKIP blocks. SKIP blocks are a type of coding block without residuals, characterized by a small number of bits after encoding. For coded video frames containing a large number of SKIP blocks, the coded frame size is very small, much smaller than the size of ordinary coded frames (i.e., coded video frames containing fewer SKIP blocks). The inventors discovered through experiments that when the rate control method in the JCTVC-K0103 proposal is used to encode "coded video frames containing a large number of SKIP blocks", the R-λ model parameters α and β updated after the encoding process of the "coded video frames containing a large number of SKIP blocks" are not applicable to the subsequent encoding of the "coded video frames containing fewer SKIP blocks", resulting in the frame size of the "coded video frames containing fewer SKIP blocks" far exceeding the average frame size, which in turn leads to severe instantaneous bit rate fluctuations.

[0013] The second situation is: if the content of the previous and next video frames is very different, such as when a scene switch occurs in the video content, when the bit rate control method in the JCTVC-K0103 proposal is used for encoding, the R-λ model parameters α and β obtained in the encoding process before the scene switch are not applicable to the video frames after the scene switch, which will cause the size of the video frame after the scene switch to far exceed the average frame size, thereby causing severe instantaneous bit rate fluctuations.

[0014] In the above two cases, when the R-λ model parameters α and β are not suitable for the video frame to be encoded, the frame-level Lagrange multiplier λ of the video frame to be encoded calculated based on α and β will be Frame and frame-level quantization parameter QP Frame There is a large difference between the ideal value and the LCU. In this way, when encoding the LCU in the current video frame, the LCU-level Lagrange multiplier λ of each LCU will be LCU and LCU-level quantization parameter QP LCU Being constrained in the wrong range leads to abnormal LCU-level rate control, which eventually causes severe instantaneous rate fluctuations. Moreover, due to the LCU-level Lagrange multiplier λ of the LCU within the current video frame, LCU and LCU-level quantization parameter QP LCUThe LCU is constrained within an incorrect range and does not match the actual coding situation of the LCU, resulting in abnormalities in the LCU coding mode selection and distortion control during LCU coding, causing a significant drop in coding efficiency. Therefore, if the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded can be adjusted in real time according to the video coding status, LCU and LCU-level quantization parameter QP LCU The constraint range is adjusted so that the LCU-level Lagrange multiplier λ LCU and LCU-level quantization parameter QP LCU The value of is within a reasonable range, which can not only suppress the fluctuation of instantaneous bit rate, but also effectively improve the video coding efficiency.

[0015] In order to reduce the instantaneous bit rate fluctuation during video encoding, an existing method is to expand the LCU level Lagrange multiplier λ when performing LCU level bit rate control. LCU and LCU-level quantization parameter QP LCU The value range of λ is used to enhance the adjustment capability of LCU-level rate control. However, this method also brings great risks. LCU and LCU-level quantization parameter QP LCU The range of values ​​of λ is very likely to cause rate control to oscillate, further exacerbating instantaneous rate fluctuations. Rate control oscillation refers to the situation in the rate control system where, due to improper control parameters or control methods, the instantaneous rate not only fails to converge but fluctuates more and more violently. In other words, the more control is performed, the more violent the instantaneous rate fluctuations become. Therefore, when performing LCU-level rate control, how to adaptively (i.e., automatically select the appropriate time) adjust the LCU-level Lagrange multiplier λ is a key issue. LCU and LCU-level quantization parameter QP LCU Adjusting the value range of λ to suppress the instantaneous bit rate fluctuation caused by inappropriate model parameters and avoid bit rate control oscillation has become a problem that needs to be solved. In the existing bit rate control algorithm based on the JCTVC-K0103 proposal, no method has been found to adaptively adjust the LCU-level Lagrange multiplier λ to λ. LCU and LCU-level quantization parameter QP LCU The method of adjusting the value range of to suppress instantaneous bit rate fluctuations. Summary of the Invention

[0016] The technical problem to be solved by the present invention is to propose a video coding rate control method capable of adaptively suppressing instantaneous rate fluctuations.

[0017] In order to solve the above technical problems, the present invention discloses a video coding rate control method, comprising the following steps. Step S1: Calculate the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded based on the target number of coding bits and the actual number of coding bits of the previous video frame; the smaller the difference between the target number of coding bits and the actual number of coding bits of the previous video frame, the higher the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded; and vice versa. Step S2: Calculate the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier based on the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded; the two are proportional. Step S3: Calculate the constraint range adjustment offset of the LCU-level quantization parameter based on the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier; the two are positively correlated. Step S4: Based on the constraint range adjustment coefficients of the frame-level Lagrangian multiplier and the LCU-level Lagrangian multiplier of the current video frame to be encoded, a first value range is set for the LCU-level Lagrangian multiplier of each LCU within the current video frame to be encoded; the lower limit and upper limit of the first value range are inversely proportional and directly proportional to the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier, respectively. Furthermore, based on the frame-level quantization parameter and the constraint range adjustment offset of the LCU-level quantization parameter of the current video frame to be encoded, a second value range is set for the LCU-level quantization parameter of each LCU within the current video frame to be encoded; the lower limit and upper limit of the second value range are negatively correlated and positively correlated, respectively, with the constraint range adjustment offset of the LCU-level quantization parameter.

[0018] Preferably, in step S1, Bt represents the target number of coding bits of the previous video frame, Ba represents the actual number of coding bits of the previous video frame, and Cf represents the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded, and Cf is calculated as follows; if Ba<Bt, then Cf=Bt÷Ba; if Ba>Bt, then Cf=Ba÷Bt; if Ba=Bt, then Cf=1.0.

[0019] Furthermore, in step S1, the closer the value of Cf is to 1.0, the higher the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded is; and vice versa.

[0020] Preferably, in step S2, λ scale represents the constraint range adjustment coefficient of the LCU-level Lagrange multiplier, Cf represents the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded, and λ scale The calculation method of λ is as follows; scale =γ×Cf; where γ is the constraint strength adjustment multiplier, and its value is a positive number greater than or equal to 1.0.

[0021] Preferably, in step S2, an upper limit value is set for the constraint range adjustment coefficient of the LCU-level Lagrange multiplier.

[0022] Preferably, in step S3, QP offset represents the constraint range adjustment offset of the LCU-level quantization parameter, λ scale represents the constraint range adjustment coefficient of the LCU-level Lagrange multiplier, QP offset The calculation method of is as follows; in," ” is the floor operator, and ln is the natural logarithm operator.

[0023] Preferably, in step S3, an upper limit value is set for the constraint range adjustment offset of the LCU-level quantization parameter.

[0024] Preferably, in step S4, λ LCU represents the LCU-level Lagrange multiplier of each LCU in the current video frame to be encoded, λ Frame represents the frame-level Lagrange multiplier of the current video frame to be encoded, λ scale represents the constraint range adjustment coefficient of the LCU-level Lagrange multiplier, and the calculation method of the first value range is as follows;

[0025] Preferably, in step S4, QP LCU Indicates the LCU-level quantization parameter, QP, of each LCU in the current video frame to be encoded. Frame Indicates the frame-level quantization parameter of the current video frame to be encoded, QP offset Indicates the constraint range adjustment offset of the LCU-level quantization parameter, and the second value range is calculated as follows; QP Frame -2-QP offset ≤QP LCU ≤QP Frame +2+QP offset .

[0026] The present invention also discloses a video coding rate control device, which includes a credibility calculation module, an adjustment coefficient calculation module, an adjustment offset calculation module, and a value range calculation module. The credibility calculation module is used to calculate the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded based on the target number of coding bits and the actual number of coding bits of the previous video frame; the smaller the difference between the target number of coding bits and the actual number of coding bits of the previous video frame, the higher the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded; and vice versa. The adjustment coefficient calculation module is used to calculate the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier based on the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded; the two are proportional. The adjustment offset calculation module is used to calculate the constraint range adjustment offset of the LCU-level quantization parameter based on the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier; the two are positively correlated. The value range calculation module is used to set a first value range for the LCU-level Lagrangian multiplier of each LCU in the current video frame to be encoded based on the constraint range adjustment coefficient of the frame-level Lagrangian multiplier and the LCU-level Lagrangian multiplier of the current video frame to be encoded; the lower limit value and the upper limit value of the first value range are inversely proportional to and directly proportional to the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier. The value range calculation module is also used to set a second value range for the LCU-level quantization parameter of each LCU in the current video frame to be encoded based on the frame-level quantization parameter and the constraint range adjustment offset of the LCU-level quantization parameter of the current video frame to be encoded; the lower limit value and the upper limit value of the second value range are negatively correlated and positively correlated with the constraint range adjustment offset of the LCU-level quantization parameter.

[0027] The technical effects achieved by the present invention are: (1) the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame Calculation of the credibility, LCU-level Lagrange multiplier λ LCU Calculation of constraint range adjustment coefficients and LCU-level quantization parameter QP LCU The calculation of the constraint range adjustment offset is completed adaptively, and the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded can be adjusted in real time according to the video encoding state. LCU The first value range of and the LCU-level quantization parameter QP of each LCU in the current video frame to be encoded LCU The second value range of is adjusted to achieve the purpose of suppressing instantaneous bit rate fluctuations. (2) The frame-level Lagrange multiplier λ of the current video frame to be encoded Frame Calculation of the credibility, LCU-level Lagrange multiplier λ LCU Calculation of constraint range adjustment coefficients and LCU-level quantization parameter QP LCUThe calculation of the constraint range adjustment offset is very simple, with small amount of calculation, and is suitable for software and hardware implementation. (3) It can effectively improve the efficiency of video coding. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 This is an overall diagram of the rate control method based on the JCTVC-K0103 proposal.

[0029] Figure 2 It is a flow chart of the video coding rate control method proposed by the present invention.

[0030] Figure 3 It is a schematic diagram of the combination of the video coding rate control method proposed in the present invention and the rate control method based on the JCTVC-K0103 proposal.

[0031] Figure 4 It is a structural diagram of the video coding rate control device proposed by the present invention.

[0032] Figure 5 This is a schematic diagram of instantaneous bit rate fluctuations when encoding the YUV video stream PartyScene using the existing method.

[0033] Figure 6 This is a schematic diagram of instantaneous bit rate fluctuations when encoding the YUV video stream PartyScene using the method of the present invention.

[0034] Figure 7 It is a schematic diagram of the BD-PSNR changes when the YUV video stream PartyScene is encoded using the existing method and the method of the present invention respectively.

[0035] Figure 8 This is a schematic diagram of instantaneous bit rate fluctuations when encoding a YUV video stream SlideShow using an existing method.

[0036] Figure 9 The diagram is a schematic diagram of instantaneous bit rate fluctuation when the YUV video stream SlideShow is encoded using the method of the present invention.

[0037] Figure 10 It is a schematic diagram of the change of BD-PSNR when the YUV video stream SlideShow is encoded using the existing method and the method of the present invention respectively.

[0038] Explanation of the reference numerals in the figure: 1 is a credibility calculation module, 2 is an adjustment coefficient calculation module, 3 is an adjustment offset calculation module, and 4 is a value range calculation module. DETAILED DESCRIPTION

[0039] See also Figure 2The video coding rate control method proposed in the present invention includes the following steps.

[0040] Step S1: Calculate the frame-level Lagrange multiplier λ of the current video frame to be encoded based on the target encoding bit number and the actual encoding bit number of the previous video frame (encoded) Frame The smaller the difference between the target number of coded bits and the actual number of coded bits of the previous video frame, the better the frame-level Lagrange multiplier λ of the current video frame to be coded. Frame The greater the difference between the target number of coded bits and the actual number of coded bits of the previous video frame, the higher the frame-level Lagrange multiplier λ of the current video frame to be coded. Frame The lower the credibility.

[0041] The principle of this is: in the rate control algorithm based on the JCTVC-K0103 proposal, it is necessary to rely on the encoding information of the previous video frame to update the model parameters α and β in the R-λ model, and then rely on α and β to calculate the frame-level Lagrange multiplier λ of the video frame to be encoded. Frame If the difference between the actual number of coded bits of the previous video frame and the target number of coded bits is small, the model parameters α and β obtained based on the coding information of the previous video frame are reliable, and the frame-level Lagrange multiplier λ of the current video frame to be coded is calculated based on α and β. Frame If the actual number of coded bits of the previous video frame differs greatly from the target number of coded bits, the model parameters α and β obtained by relying on the coding information of the previous video frame are unreliable, and the frame-level Lagrange multiplier λ of the current video frame to be coded calculated based on α and β is unreliable. Frame Therefore, the difference between the actual number of coded bits of the previous video frame and the target number of coded bits can be used to quantify the frame-level Lagrange multiplier λ of the current video frame to be coded. Frame credibility.

[0042] As an example, Bt represents the target number of coded bits of the previous video frame, Ba represents the actual number of coded bits of the previous video frame, and Cf represents the frame-level Lagrange multiplier λ of the current video frame to be coded. Frame The credibility of Cf is calculated as follows. (1) If Ba < Bt, then Cf = Bt ÷ Ba. (2) If Ba > Bt, then Cf = Ba ÷ Bt. (3) If Ba = Bt, then Cf = 1.0. Obviously, Cf is a positive number greater than or equal to 1.0. The closer its value is to 1.0, the better the frame-level Lagrange multiplier λ of the current video frame to be encoded. Frame The higher the credibility of ; the more its value deviates from 1.0, the higher the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame The lower the credibility.

[0043] Step S2: Based on the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame The LCU-level Lagrange multiplier λ is calculated based on the credibility of LCU The constraint range adjustment coefficient of LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient" and the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame is proportional to the credibility of the

[0044] As an example, λ scale represents the LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient, λ scale The calculation method of λ is as follows. scale =γ×Cf. Where γ is the constraint strength adjustment multiplier, which is a positive number greater than or equal to 1.0. The smaller γ is, the more Cf affects the LCU-level Lagrange multiplier λ. LCU The stronger the constraint, the larger the γ, which means that Cf has a greater impact on the LCU-level Lagrange multiplier λ. LCU The weaker the constraint, the smaller the value of γ. In general, a value of 1.0 is sufficient.

[0045] Preferably, λ scale Set the upper limit. If the calculated λ scale is greater than the upper limit, then let λ scale The upper limit is set to avoid rate control oscillation. The upper limit is, for example, 10.0.

[0046] Step S3: According to the LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient is used to calculate the LCU level quantization parameter QP LCU The constraint range adjusts the offset. "LCU level quantization parameter QP LCU The constraint range adjustment offset is "and" the LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient is positively correlated, that is, the two change in the same direction, either increasing or decreasing at the same time.

[0047] As an example, QP offset Indicates the LCU level quantization parameter QP LCU The constraint range adjustment offset, QP offset The calculation method of is as follows. in," ” is the floor operator, and ln is the natural logarithm operator.

[0048] Preferably, QP offset Set the upper limit. If the calculated QP offsetIf QP is greater than the upper limit, offset The upper limit is set to avoid excessive fluctuations in video encoding quality. For example, the upper limit is 3.

[0049] Step S4: Based on the frame-level Lagrange multiplier λ of the current video frame to be encoded Frame and the LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient is the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded LCU The first value range is set. The LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded LCU The lower and upper limits of the current video frame are originally determined by the frame-level Lagrange multiplier λ of the current video frame to be encoded. Frame Determine, as shown in formula 3. The newly added λ scale The contribution to the first value range is: the lower limit of the first value range and λ scale Inversely proportional to λ, the upper limit of the first value range is scale Directly proportional.

[0050] As an example, the first value range is calculated as follows.

[0051] Also based on the frame-level quantization parameter QP of the current video frame to be encoded Frame and LCU-level quantization parameter QP LCU The constraint range adjustment offset is the LCU-level quantization parameter QP of each LCU in the current video frame to be encoded LCU Set the second value range. The LCU-level quantization parameter QP of each LCU in the current video frame to be encoded LCU The lower limit and upper limit of the original value are only determined by the frame-level quantization parameter QP of the current video frame to be encoded. Frame Determine, as shown in formula 4. The newly added QP offset The contribution to the second value range is: the lower limit of the second value range and QP offset The upper limit of the second value range is negatively correlated with QP offset Positively correlated.

[0052] As an example, the second value range is calculated as follows. Frame -2-QP offset ≤QP LCU ≤QP Frame +2+QP offset .

[0053] The video coding rate control method proposed in the present invention is combined with the rate control method based on the JCTVC-K0103 proposal (interactive mode) as shown in FIG. Figure 3 shown.

[0054] See also Figure 4 The video coding rate control device proposed in the present invention includes a credibility calculation module 1, an adjustment coefficient calculation module 2, an adjustment offset calculation module 3 and a value range calculation module 4.

[0055] The credibility calculation module 1 is used to calculate the frame-level Lagrange multiplier λ of the current video frame to be encoded based on the target encoding bit number Bt and the actual encoding bit number Ba of the previous video frame (encoded). Frame The smaller the difference between Bt and Ba, the better the frame-level Lagrange multiplier λ of the current video frame to be encoded. Frame The higher the credibility, the better; vice versa.

[0056] The adjustment coefficient calculation module 2 is used to calculate the frame-level Lagrange multiplier λ of the current video frame to be encoded. Frame The LCU-level Lagrange multiplier λ is calculated based on the credibility Cf LCU The constraint range adjustment coefficient λ scale λ scale Proportional to Cf.

[0057] The adjustment offset calculation module 3 is used to calculate the LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient λ scale Calculate the LCU level quantization parameter QP LCU The constraint range adjusts the offset QP offset .QP offset and λ scale Positively correlated.

[0058] The value range calculation module 4 is used to calculate the frame-level Lagrangian multiplier λ of the current video frame to be encoded. Frame and the LCU-level Lagrange multiplier λ LCU The constraint range adjustment coefficient λ scale , is the LCU-level Lagrange multiplier λ of each LCU in the current video frame to be encoded LCU Set the first value range. The lower limit of the first value range is the same as λ scale Inversely proportional to λ, the upper limit of the first value range is scale Directly proportional.

[0059] The value range calculation module 4 is also used to calculate the frame level quantization parameter QP of the current video frame to be encoded. Frame and LCU-level quantization parameter QP LCU The constraint range adjusts the offset QPoffset , is the LCU-level quantization parameter QP of each LCU in the current video frame to be encoded LCU Set the second value range. The lower limit of the second value range is the same as QP offset The upper limit of the second value range is negatively correlated with QP offset Positively correlated.

[0060] The HEVC rate control method proposed in the present invention can adaptively adjust the LCU level Lagrange multiplier λ LCU and LCU-level quantization parameter QP LCU The rate control method proposed in this invention can be adaptively implemented during the encoding process without requiring external prior knowledge or intervention. It has strong real-time performance, is computationally simple, requires little computation, and is easily implemented in both software and hardware.

[0061] To verify the beneficial effects of the present invention, the present invention selected two YUV video streams, PartyScene and SlideShow, from the HEVC standard test sequence for testing. The information and characteristics of these two YUV video streams are shown in the following table.

[0062]

[0063] As shown in the table above, both PartyScene and SlideShow have some identical video frames, meeting the encoding criteria for "encoded video frames containing a large number of skip blocks." SlideShow also experiences drastic changes in video frame content, meeting the criteria for scene switching. Encoding these two YUV video streams using the rate control method proposed in the JCTVC-K0103 proposal will result in significant instantaneous bitrate fluctuations after "encoded video frames containing a large number of skip blocks" and after scene switching.

[0064] In the experiment, the rate control method in the JCTVC-K0103 proposal was used as a benchmark to compare with the rate control method proposed in this invention. For each YUV video stream, four different target bit rates were set for encoding, and the instantaneous bit rate and BD-PSNR ( Delta Peak Signal-to-Noise Ratio (BD-PSNR) is used to measure the encoding efficiency of an encoder. A higher BD-PSNR curve indicates better encoding quality and higher encoding efficiency for the same bitrate. In the experiment, the encoding frame count was set to 120, the encoding GOP structure was IPPP, and P frames only referenced the previous frame.

[0065] See also Figure 5 This is the instantaneous bitrate fluctuation when encoding the YUV video stream PartyScene using the bitrate control method in the existing JCTVC-K0103 proposal. From top to bottom, the instantaneous bitrate changes frame by frame when the video stream is encoded at different target bitrates are shown. The unit of target bitrate (target bps) is bps (bits per second). The horizontal axis represents the number of encoded frames. The vertical axis represents the size of the video frame after encoding, in bytes. It can be seen that at the arrow point, instantaneous bitrate fluctuations occur due to the encoded video frame containing a large number of SKIP blocks; and the higher the target bitrate, the more severe the instantaneous bitrate fluctuations.

[0066] See also Figure 6 This shows the instantaneous bitrate fluctuations when encoding the YUV video stream PartyScene using the rate control method proposed in this invention. From top to bottom, the instantaneous bitrate changes for each frame are shown for each encoding target bitrate. The target bitrate is expressed in bits per second. The horizontal axis represents the number of encoded frames. The vertical axis represents the encoded size of the video frame in bytes. As can be seen at the arrows, the instantaneous bitrate fluctuations caused by encoding video frames containing a large number of skip blocks are effectively suppressed.

[0067] See also Figure 7 , this is the change in BD-PSNR when the YUV video stream PartyScene is encoded using the existing rate control method in the JCTVC-K0103 proposal and the rate control method proposed in the present invention. The dotted line old represents the rate control method in the JCTVC-K0103 proposal, and the square dotted line new represents the rate control method proposed in the present invention. The horizontal axis represents the target rate (Rate), and the unit is kbps. The vertical axis represents the average PSNR value after the video stream is encoded (i.e. PSNRA, A stands for Average), and the unit is dB (decibel). It can be seen that the BD-PSNR of the rate control method proposed in the present invention is generally better than the rate control method in the JCTVC-K0103 proposal.

[0068] See also Figure 8This is the instantaneous bitrate fluctuation when encoding the YUV video stream SlideShow using the existing bitrate control method in the JCTVC-K0103 proposal. From top to bottom, the instantaneous bitrate changes frame by frame when encoding the video stream at different target bitrates are shown. The unit of the target bitrate is bps. The horizontal axis represents the number of encoded frames. The vertical axis represents the size of the encoded video frame in bytes. It can be seen that at the arrows, instantaneous bitrate fluctuations caused by scene switching and instantaneous bitrate fluctuations caused by encoded video frames containing a large number of SKIP blocks occurred, and the higher the target bitrate, the more severe the instantaneous bitrate fluctuations.

[0069] See also Figure 9 This is the instantaneous bitrate fluctuation when encoding the YUV video stream SlideShow using the bitrate control method proposed in this invention. From top to bottom, the frame-by-frame instantaneous bitrate changes of the video stream encoded at different target bitrates are shown. The unit of the target bitrate is bps. The horizontal axis represents the number of encoded frames. The vertical axis represents the size of the encoded video frame in bytes. It can be seen that at the arrows, the instantaneous bitrate fluctuations caused by scene switching and the instantaneous bitrate fluctuations caused by encoded video frames containing a large number of SKIP blocks are effectively suppressed.

[0070] See also Figure 10 , this is the change in BD-PSNR when the YUV video stream SlideShow is encoded using the existing rate control method in the JCTVC-K0103 proposal and the rate control method proposed in the present invention. The dotted line old represents the rate control method in the JCTVC-K0103 proposal, and the square dotted line new represents the rate control method proposed in the present invention. The horizontal axis represents the target bit rate, and the unit is kbps. The vertical axis represents the average PSNR value (PSNRA) after the video stream is encoded, and the unit is dB (decibel). It can be seen that the BD-PSNR of the rate control method proposed in the present invention is generally better than the rate control method in the JCTVC-K0103 proposal.

[0071] The experimental results clearly demonstrate that, compared to the existing rate control method in the JCTVC-K0103 proposal, the rate control method proposed in this invention maintains a more stable instantaneous bitrate at each target bitrate. This effectively suppresses instantaneous bitrate fluctuations caused by encoding video frames containing a large number of skip blocks and scene cuts. Furthermore, it achieves a higher BD-PSNR for video encoding and better encoding performance. This demonstrates that the rate control method proposed in this invention not only effectively suppresses instantaneous bitrate fluctuations, stabilizing the video encoding bitrate, but also significantly improves video encoding efficiency.

[0072] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Those skilled in the art will appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A video coding rate control method, characterized in that: The method includes the following steps: Step S1: Calculating the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded based on the target number of encoded bits and the actual number of encoded bits of the previous video frame; the smaller the difference between the target number of encoded bits and the actual number of encoded bits of the previous video frame, the higher the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded, and vice versa; Step S2: Calculating the constraint range adjustment coefficient of the LCU-level Lagrange multiplier according to the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded; The two are directly proportional; Step S3: calculating the constraint range adjustment offset of the LCU-level quantization parameter according to the constraint range adjustment coefficient of the LCU-level Lagrange multiplier; The two are positively correlated; Step S4: setting a first value range for the LCU-level Lagrangian multiplier of each LCU in the current video frame to be encoded according to the constraint range adjustment coefficient of the frame-level Lagrangian multiplier and the LCU-level Lagrangian multiplier of the current video frame to be encoded; the lower limit and the upper limit of the first value range are inversely proportional to and directly proportional to the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier, respectively; The offset is also adjusted according to the constraint range of the frame-level quantization parameter and the LCU-level quantization parameter of the current video frame to be encoded, and a second value range is set for the LCU-level quantization parameter of each LCU in the current video frame to be encoded; the lower limit value and the upper limit value of the second value range are negatively correlated and positively correlated with the constraint range adjustment offset of the LCU-level quantization parameter, respectively.

2. The video encoding rate control method according to claim 1, wherein: In step S1, Bt represents the target number of coding bits of the previous video frame, Ba represents the actual number of coding bits of the previous video frame, and Cf represents the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded. Cf is calculated as follows: if Ba<Bt, then Cf=Bt÷Ba; if Ba>Bt, then Cf=Ba÷Bt; if Ba=Bt, then Cf=1.

0.

3. The video encoding rate control method according to claim 2, wherein: In step S1, the closer the value of Cf is to 1.0, the higher the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded is; and vice versa.

4. The video encoding rate control method according to claim 1, wherein: In the step S2, λ scale represents the constraint range adjustment coefficient of the LCU-level Lagrange multiplier, Cf represents the credibility of the frame-level Lagrange multiplier of the current video frame to be encoded, and λ scale The calculation method of λ is as follows; scale =γ×Cf; where γ is the constraint strength adjustment multiplier, and its value is a positive number greater than or equal to 1.

0.

5. The video encoding rate control method according to claim 1, wherein: In the step S2, an upper limit value is set for the constraint range adjustment coefficient of the LCU-level Lagrange multiplier.

6. The video encoding rate control method according to claim 1, wherein: In step S3, QP offset represents the constraint range adjustment offset of the LCU-level quantization parameter, λ scale represents the constraint range adjustment coefficient of the LCU-level Lagrange multiplier, QP offset The calculation method of is as follows; in, is the floor operator, and ln is the natural logarithm operator.

7. The video encoding rate control method according to claim 1, wherein: In step S3, an upper limit value is set for adjusting the offset of the constraint range of the LCU-level quantization parameter.

8. The video encoding rate control method according to claim 1, wherein: In the step S4, λ LCU represents the LCU-level Lagrange multiplier of each LCU in the current video frame to be encoded, λ Frame represents the frame-level Lagrange multiplier of the current video frame to be encoded, λ scale represents the constraint range adjustment coefficient of the LCU-level Lagrange multiplier, and the calculation method of the first value range is as follows; 9. The video encoding rate control method according to claim 1, wherein: In step S4, QP LCU Indicates the LCU-level quantization parameter, QP, of each LCU in the current video frame to be encoded. Frame Indicates the frame-level quantization parameter of the current video frame to be encoded, QP offset Indicates the constraint range adjustment offset of the LCU-level quantization parameter, and the second value range is calculated as follows; QP Frame -2-QP offset ≤QP LCU ≤QP Frame +2+QP offset .

10. A video coding rate control device, characterized in that: It includes a credibility calculation module, an adjustment coefficient calculation module, an adjustment offset calculation module and a value range calculation module; The credibility calculation module is used to calculate the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded based on the target number of coding bits and the actual number of coding bits of the previous video frame; the smaller the difference between the target number of coding bits and the actual number of coding bits of the previous video frame, the higher the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded, and vice versa; The adjustment coefficient calculation module is used to calculate the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier according to the credibility of the frame-level Lagrangian multiplier of the current video frame to be encoded; The two are directly proportional; The adjustment offset calculation module is used to calculate the constraint range adjustment offset of the LCU-level quantization parameter according to the constraint range adjustment coefficient of the LCU-level Lagrange multiplier; The two are positively correlated; The value range calculation module is used to set a first value range for the LCU-level Lagrangian multiplier of each LCU in the current video frame to be encoded according to the frame-level Lagrangian multiplier and the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier of the current video frame to be encoded; the lower limit value and the upper limit value of the first value range are inversely proportional to and directly proportional to the constraint range adjustment coefficient of the LCU-level Lagrangian multiplier, respectively; The value range calculation module is also used to adjust the offset according to the constraint range of the frame-level quantization parameter and the LCU-level quantization parameter of the current video frame to be encoded, and set a second value range for the LCU-level quantization parameter of each LCU in the current video frame to be encoded; the lower limit value and the upper limit value of the second value range are negatively correlated and positively correlated with the constraint range adjustment offset of the LCU-level quantization parameter, respectively.

Citation Information

Patent Citations

  • Joint code rate control method and system supporting multimachine parallel coding

    CN106231320A

  • H.265-baased rate control method, system and device

    CN108040256A