Method for rate control to improve video quality

By adjusting the bitrate control at the frame and CU layers, the problem of uneven P-frame encoding quality when scene changes are large in existing technologies is solved, and the overall video quality is improved, especially maintaining the consistency of encoding quality in different regions when scene changes are large.

CN115866256BActive Publication Date: 2026-04-28HANGZHOU ARCVIDEO TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU ARCVIDEO TECHNOLOGY CO LTD
Filing Date
2022-11-25
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing rate control algorithms cannot accurately estimate the frame-level target bit count of P-frames when the scene changes significantly, resulting in poorer coding quality in the lower half of the region compared to the upper half. Furthermore, existing technologies struggle to maintain consistent coding quality across different regions when the scene changes considerably.

Method used

When controlling the bit rate at the frame level, a maximum number of bits is set for the P-frame, and the prediction coefficients of the I-frame are used to calculate the maximum number of bits for the P-frame. When controlling the bit rate at the CU level, if the QP value of the CU is much greater than the QP value at the frame level, the QP value of the CU is reduced to ensure that the sum of the number of bits of all CUs in the current frame is less than the maximum number of bits for the P-frame, thus ensuring the consistency of coding quality.

Benefits of technology

By adjusting the bitrate control of the frame layer and CU layer, the overall encoding quality of the video was improved when the scene changes significantly, making the quality of the lower half of the region more consistent with that of the upper half of the region, thus improving the encoding effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115866256B_ABST
    Figure CN115866256B_ABST
Patent Text Reader

Abstract

The application discloses a code rate control method for improving video quality, comprising the following steps: S1, initializing prediction coefficients of I frames, P frames and B frames, and starting encoding; S2, starting frame layer code rate control of the i-th frame; S3, calculating a QP value for preventing overflow and underflow of the current frame according to a bandwidth, and marking the QP value as qp0; S4, calculating a target bit number Target_bits and a maximum bit number Max_bits of the current frame according to a frame type of the current frame, the qp0, a SATD value and the prediction coefficients; S5, updating the prediction coefficients of the current frame by using a linear regression method; S6, starting CU layer code rate control; S7, calculating a final QP value of the j-th CU, and encoding the CU by using the final QP value; S8, judging whether all CUs of all frames of the current video have been encoded, if yes, ending the encoding and obtaining an encoded code stream, if not, judging whether all CUs of the current frame have been encoded, if yes, adding 1 to i and executing S2, if not, adding 1 to j and executing S7.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of video coding technology, specifically relating to a bitrate control method for improving video quality. Background Technology

[0002] With the rapid development of network communication and video processing technologies, video resolution has gradually increased to 4K and 8K, and the increase in video data volume has placed higher demands on video encoding and compression technologies.

[0003] Within a single frame of a video image, many neighboring pixels share similar or identical data, representing spatial redundancy. Similarly, data between adjacent frames in a video often exhibits similarity or repetition, representing temporal redundancy. Encoding compression removes this redundant information. Intra-frame coding eliminates spatial redundancy, while inter-frame coding eliminates temporal redundancy. Encoders, based on latency requirements, network bandwidth, and video quality, classify video frames into I-frames, P-frames, and B-frames, and further divide each frame into several coding units (CUs). I-frames use intra-frame mode encoding for each CU, consuming the most bits but achieving the highest quality. P-frames and B-frames determine whether to use intra-frame or inter-frame mode encoding based on the motion complexity of each CU, consuming fewer bits than I-frames but with slightly lower quality.

[0004] Rate control algorithms can be broadly divided into two layers: frame-level rate control and CU-level rate control. Frame-level rate control calculates the quantization parameter (QP) value for each frame to prevent overflow and underflow based on the bandwidth, and uses the RQ model to calculate the target number of bits for each frame.

[0005]

[0006] Where Bits represents the number of available bits in the current frame, SATD is the sum of the absolute values ​​of the residual transforms of the current frame, used to measure the complexity of the current frame, and a, b, and c are prediction coefficients, updated frame by frame using linear regression. Since I-frames, P-frames, and B-frames consume significantly different bitrates, each is assigned a set of prediction coefficients: I-frame prediction coefficients (a_I, b_I, c_I), P-frame prediction coefficients (a_P, b_P, c_P), and B-frame prediction coefficients (a_B, b_B, c_B). CU layer bitrate control allocates the target number of bits for a frame to each CU. On the one hand, it allocates more bits to CUs with more complex textures; on the other hand, it needs to ensure that the total number of bits in all CUs of the current frame is close to the target number of bits for the current frame.

[0007] When the scene changes drastically, such as when a football video switches from a long shot to a close-up, the existing bitrate control algorithm may not accurately estimate the frame-level target bit count of the P-frame. Scene changes will cause each CU to tend to choose the intra-frame coding mode, consuming more bits. If the estimated frame-level target bit count is too low, the CU will find that there are not enough bits when encoding the lower half of the region. It can only increase the QP to reduce the bit count. The larger the QP, the greater the encoding distortion. Therefore, the quality of the lower half of the region will be worse than that of the upper half of the region. Summary of the Invention

[0008] In view of the above-mentioned problems, the present invention provides a bitrate control method to improve video quality, which makes the quality of the lower half region and the upper half region more consistent during CU encoding, thereby improving the encoding quality when the scene changes greatly.

[0009] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0010] A bitrate control method for improving video quality, characterized by comprising:

[0011] S1, initialize the prediction coefficients for I-frames, P-frames, and B-frames, and begin encoding;

[0012] S2, start frame layer bitrate control for the i-th frame;

[0013] S3, calculate the QP value that prevents the current frame from overflowing and underflowing based on the bandwidth, and mark it as qp0;

[0014] S4. Calculate the target number of bits (Target_bits) and the maximum number of bits (Max_bits) of the current frame based on the frame type, qp0, SATD value, and prediction coefficients of the current frame.

[0015] S5, use linear regression to update the prediction coefficients of the current frame;

[0016] S6, Start CU layer bitrate control;

[0017] S7, calculate the final QP value of the j-th CU, and encode the CU using the final QP value;

[0018] S8: Determine whether all CUs of all frames in the current video have been encoded. If so, end the encoding and obtain the encoded bitstream. Otherwise, determine whether all CUs of the current frame have been encoded. If so, increment i by 1 and execute S2. Otherwise, increment j by 1 and execute S7.

[0019] Preferably, the prediction coefficients for initializing I-frames, P-frames, and B-frames in S1 include:

[0020] If it is an I-frame, the prediction coefficients (a_I, b_I, c_I) are (0.5, 1.0, 2.0).

[0021] Preferably, S4 includes:

[0022] If it is an I-frame, then the target number of bits for the current frame is:

[0023]

[0024] Maximum number of bits:

[0025] Max_bits = Target_bits.

[0026] Preferably, the prediction coefficients for initializing I-frames, P-frames, and B-frames in S1 include:

[0027] If it is a P-frame, the prediction coefficients (a_P, b_P, c_P) are (0.25, 1.0, 2.0).

[0028] Preferably, S4 includes:

[0029] If it is a P-frame, then the target number of bits for the current frame is:

[0030]

[0031] And determine if the intra-frame mode ratio of the frame is greater than 90%. If it is, then:

[0032]

[0033] If it is not greater than:

[0034] Max_bits = Target_bits.

[0035] Preferably, the prediction coefficients for initializing I-frames, P-frames, and B-frames in S1 include:

[0036] If it is a B-frame, the prediction coefficients (a_B, b_B, c_B) are (0.2, 1.0, 2.0).

[0037] Preferably, S4 includes:

[0038] If it is a B-frame, then the target bit count for the current frame is:

[0039]

[0040] Maximum number of bits:

[0041] Max_bits = Target_bits

[0042] Preferably, calculating the final QP value of the j-th CU in S7 includes: calculating the initial QP value qp_cu0 of the current CU according to the texture complexity of the CU and the target number of bits Target_bits. If qp_cu0 - qp0 > 6, and the cumulative number of bits Sum_bits of the coded CUs in the current frame satisfies Sum_bits > Target_bits and Sum_bits < Max_bits, then the final QP value of the current CU is equal to qp_cu0 - 3; otherwise, the final QP value of the current CU is equal to qp_cu0.

[0043] The present invention has the following beneficial effects: during frame-level bitrate control, when a large scene change is detected, the maximum number of bits is set for the P frame, and the prediction coefficients of the I frame are used to calculate the maximum number of bits of the P frame; during CU-level bitrate control, when the QP value of the CU is much larger than the frame-level QP, while ensuring that the total number of bits of all CUs in the current frame is less than the maximum number of bits of the P frame, the QP of the CU is reduced to ensure the coding quality, and ultimately the coding quality when the scene change is large is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flowchart of the steps of the bitrate control method for improving video quality according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0045] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0046] Refer to Figure 1 , which shows a flowchart of the steps of the bitrate control method for improving video quality according to an embodiment of the present invention, including:

[0047] S1, initialize the prediction coefficients of I frames, P frames, and B frames, and start encoding;

[0048] S2, start the frame-level bitrate control of the i-th frame;

[0049] S3, calculate the QP value that makes the current frame not overflow or underflow according to the bandwidth, and mark it as qp0;

[0050] S4, calculate the target number of bits Target_bits and the maximum number of bits Max_bits of the current frame according to the frame type, qp0, SATD value, and prediction coefficients of the current frame;

[0051] S5, update the prediction coefficients of the current frame using the linear regression method;

[0052] S6, Start CU layer bitrate control;

[0053] S7, calculate the final QP value of the j-th CU, and encode the CU using the final QP value;

[0054] S8: Determine whether all CUs of all frames in the current video have been encoded. If so, end the encoding and obtain the encoded bitstream. Otherwise, determine whether all CUs of the current frame have been encoded. If so, increment i by 1 and execute S2. Otherwise, increment j by 1 and execute S7.

[0055] A bitrate control method for improving video quality according to an embodiment of the present invention includes initializing the prediction coefficients of I-frames, P-frames, and B-frames in step S1, which includes:

[0056] If it is an I-frame, the prediction coefficients (a_I, b_I, c_I) are (0.5, 1.0, 2.0).

[0057] Furthermore, S4 includes:

[0058] If it is an I-frame, then the target number of bits for the current frame is:

[0059]

[0060] Maximum number of bits:

[0061] Max_bits = Target_bits.

[0062] A bitrate control method for improving video quality according to an embodiment of the present invention includes initializing the prediction coefficients of I-frames, P-frames, and B-frames in step S1, which includes:

[0063] If it is a P-frame, the prediction coefficients (a_P, b_P, c_P) are (0.25, 1.0, 2.0).

[0064] Furthermore, S4 includes:

[0065] If it is a P-frame, then the target number of bits for the current frame is:

[0066]

[0067] And determine if the intra-frame mode ratio of the frame is greater than 90%. If it is, then:

[0068]

[0069] If it is not greater than:

[0070] Max_bits = Target_bits.

[0071] The bitrate control method for improving video quality according to an embodiment of the present invention. The initialization of the prediction coefficients for I frames, P frames, and B frames in S1 includes:

[0072] If it is a B frame, the prediction coefficients (a_B, b_B, c_B) are respectively (0.2, 1.0, 2.0).

[0073] Furthermore, S4 includes:

[0074] If it is a B frame, the target bit number of the current frame is:

[0075]

[0076] Maximum bit number:

[0077] Max_bits = Target_bits.

[0078] The bitrate control method for improving video quality according to an embodiment of the present invention. Calculating the final QP value of the j-th CU in S7 includes: calculating the initial QP value qp_cu0 of the current CU according to the texture complexity of the CU and the target bit number Target_bits. If qp_cu0 - qp0 > 6, and the cumulative bit number Sum_bits of the encoded CUs in the current frame satisfies Sum_bits > Target_bits and Sum_bits < Max_bits, then the final QP value of the current CU is equal to qp_cu0 - 3, otherwise the final QP value of the current CU is equal to qp_cu0.

[0079] Through the above-set bitrate control method for improving video quality, during frame-level bitrate control, when a large scene change is detected, the maximum bit number is set for the P frame, and the prediction coefficients of the I frame are used to calculate the maximum bit number of the P frame; during CU-level bitrate control, when the QP value of the CU is much larger than the frame-level QP, while ensuring that the total bit number of all CUs in the current frame is less than the maximum bit number of the P frame, the QP of the CU is reduced to ensure the encoding quality, and finally the encoding quality with large scene changes is improved. Compared with the phenomenon that the quality of the lower half region is worse than that of the upper half region when there is a large scene change in the existing bitrate control algorithm, the quality of the lower half region and the upper half region of the method of the present invention tends to be consistent, and finally the encoding quality with large scene changes is improved. The above method can be implemented in encoders such as HEVC / AVS2, H264, AVS, AVS3, etc.

[0080] It should be understood that the exemplary embodiments described herein are illustrative and not restrictive. Although one or more embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art will understand that various changes in form and detail may be made without departing from the spirit and scope of the invention as defined by the appended claims.

Claims

1. A bitrate control method for improving video quality, characterized in that, It includes: S1, Initialize the prediction coefficients of I-frame, P-frame, and B-frame, and start encoding, including: If it is an I-frame, the prediction coefficients (a_I, b_I, c_I) are (0.5, 1.0, 2.0) respectively; if it is a P-frame, the prediction coefficients (a_P, b_P, c_P) are (0.25, 1.0, 2.0) respectively. S2, Start the frame-level bitrate control of the i-th frame. S3, Calculate the QP value that makes the current frame not overflow or underflow according to the bandwidth, and mark it as qp0. S4, According to the frame type, qp0, SATD value, and prediction coefficients of the current frame; SATD is the sum of the absolute values of the residual transforms of the current frame, which is used to measure the complexity of the current frame; calculate the target bits Target_bits and the maximum bits Max_bits of the current frame, including: If it is a P-frame, the target bits of the current frame are: ; And judge whether the intra-mode ratio of this frame is greater than 90%. If it is greater than, then: ; If it is not greater than, then: ; S8, Update the prediction coefficients of the current frame using the linear regression method. S9, Start the CU-level bitrate control. S10, Calculate the final QP value of the j-th CU, and encode the CU with the final QP value. Among them, calculating the final QP value of the j-th CU includes: Calculate the initial QP value qp_cu0 of the current CU according to the texture complexity of the CU and the target bits Target_bits. If qp_cu0 - qp0 > 6, and the cumulative bits Sum_bits of the CUs encoded in the current frame satisfy Sum_bits > Target_bits and Sum_bits < Max_bits, then the final QP value of the current CU is equal to qp_cu0 - 3, otherwise the final QP value of the current CU is equal to qp_cu0.

2. The bitrate control method for improving video quality as described in claim 1, characterized in that, S11, Judge whether all CUs of all frames in the current video have been encoded. If so, end the encoding and obtain the encoded bitstream; otherwise, judge whether all CUs of the current frame have been encoded. If so, increment i by 1 and execute S2, otherwise increment j by 1 and execute S10. In S4, it includes: ; If it is an I-frame, the target bits of the current frame are: 。 3. The bitrate control method for improving video quality as described in claim 1, characterized in that, The maximum bits: The initialization of the prediction coefficients of I-frame, P-frame, and B-frame in S1 includes:

4. The bitrate control method for improving video quality as described in claim 3, characterized in that, If it is a B-frame, the prediction coefficients (a_B, b_B, c_B) are (0.2, 1.0, 2.0) respectively. In S4, it includes: ; If it is a B-frame, the target bits of the current frame are: The maximum bits: 。

Citation Information

Patent Citations

  • Code rate control method for 8K-oriented AVS2 ultra-high-definition video coding

    CN110662045A

  • Video coding rate control

    US8175147B1