Method and apparatus for adjusting a rate control algorithm

By pre-storing the mapping relationship between quantization parameters and Lagrange multipliers in the hardware video encoder and using table lookup operations to adjust the upper and lower limit constraints, the problem of high hardware implementation cost in the HEVC bitrate control algorithm is solved, and a smaller and lower power consumption hardware video encoder is realized.

CN116828182BActive Publication Date: 2026-01-06ASR MICROELECTRONICS CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310754487.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-25
Publication Date
2026-01-06
Estimated Expiration
2043-06-25

AI Technical Summary

Technical Problem

When existing technologies struggle to implement the HEVC bitrate control algorithm in hardware video encoders, the upper and lower limits of the Lagrange multipliers of image blocks are adjusted, and the arithmetic square root is calculated, resulting in high hardware implementation costs.

Method used

By using the mapping relationship between the quantization parameters of pre-stored image blocks and Lagrange multipliers, a lookup table operation is used to replace complex multiplication and square root operations, thereby adjusting the upper and lower limit constraints of the quantization parameters and Lagrange multipliers.

Benefits of technology

This reduces the chip area and power consumption of the hardware video encoder, thereby lowering the cost of hardware implementation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116828182B_ABST
    Figure CN116828182B_ABST
Patent Text Reader

Abstract

The application discloses a kind of adjustment methods of code rate control algorithm.In hardware video encoder, the value of the Lagrange multiplier of the image block corresponding to each value of the quantization parameter of the image block and the value of its arithmetic square root, and the unique mapping relationship between the three are pre-stored.In the mapping relationship of pre-stored, the value of the quantization parameter of the image block to be encoded without upper and lower limit constraint is found out.The value of the quantization parameter of the image block to be encoded without upper and lower limit constraint is adjusted by upper and lower limit constraint.In the mapping relationship of pre-stored, the Lagrange multiplier and its arithmetic square root after the upper and lower limit constraint adjustment of the image block to be encoded are found out.In the HEVC code rate control algorithm of the present application, the quantization parameter of the image block is changed to the core for upper and lower limit constraint adjustment, and only query and integer addition and subtraction operation are used in the adjustment process, which is very suitable for hardware implementation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a digital video coding technology, specifically an adjustment method for an HEVC bitrate control algorithm suitable for hardware implementation. Background Technology

[0002] Video coding is a technique that compresses redundant components in video images and represents video information using as little data as possible. Common video coding standards include HEVC (High Efficiency Video Coding, also known as H.265) and AVC (Advanced Video Coding, also known as H.264).

[0003] Video coding technology uses image blocks as the most basic coding unit. For example, in HEVC, the basic unit of video coding is the CU (Coding Unit). A CU can be an image block of 64 pixels × 64 pixels, 32 pixels × 32 pixels, 16 pixels × 16 pixels, or 8 pixels × 8 pixels. The 64-pixel × 64-pixel image block is also called the LCU (Largest Coding Unit).

[0004] To maximize video compression, common video coding algorithms often employ lossy compression, resulting in differences between the reconstructed video and the original (distortion). HEVC and AVC are both lossy compression algorithms. The coding performance of lossy compression algorithms needs to be measured by both the coding bit rate (Rate) and the distortion introduced by the coding. In video coding, the coding bit rate R and coding distortion D are mutually restrictive and contradictory; reducing the coding bit rate R often increases coding distortion D, and reducing coding distortion D often increases coding bit rate R. Rate-Distortion Optimization (RDO) aims to minimize coding distortion D at a given coding bit rate R, or minimize coding bit rate R at a given coding distortion D. Common video coding algorithms employ rate-distortion optimization methods based on Lagrange multipliers λ, which aim to achieve the minimum coding rate-distortion cost (RD Cost) J, where J = D + λ × R.

[0005] In video encoding, each encoding mode has a coding distortion D and a coding bit rate R, and the coding rate-distortion cost J of each encoding mode can be calculated. During video encoding, selecting the encoding mode with the lowest coding rate-distortion cost J yields optimal encoding performance. The process by which the encoder selects the optimal coding mode for each image block to be encoded using rate-distortion optimization methods is called mode decision for the image block to be encoded.

[0006] In video encoders, to reduce computational complexity, the mode selection process for image blocks to be encoded using rate-distortion optimization (RDE) methods is generally divided into a coding mode prediction stage and a coding mode RDE optimization stage. Essentially, both stages use RDE optimization to filter the coding modes of image blocks; the main difference lies in the precision of the RDE cost J calculated. The coding mode prediction stage typically uses a computationally less demanding and less precise method to calculate the RDE cost J, and uses the square root of the Lagrange multiplier λ in the RDE optimization calculation. The coding mode RDE optimization stage typically uses a computationally more demanding and more precise method to calculate the RDE cost J, and also uses the Lagrange multiplier λ in the RDE optimization calculation.

[0007] In real-world scenarios, the bandwidth capacity of a video transmission channel is limited. If the video encoding bitrate is too high, exceeding the channel bandwidth capacity, it will cause video transmission congestion or even packet loss. Conversely, if the video encoding bitrate is too low, the channel bandwidth will not be fully utilized, and higher video quality cannot be achieved. Therefore, it is necessary to use bitrate control technology to control the output bitrate of the video encoder to match it with the channel bandwidth capacity.

[0008] Rate control aims to adjust the encoding parameters of a video encoder to make the encoder's output bitrate equal to a pre-set target bitrate, while minimizing encoding distortion (D) to improve video encoding quality. Common rate control algorithms typically achieve this task through two stages: target bit allocation and target bit control.

[0009] Target bit allocation typically occurs at three levels: GOP (Group of Pictures, a set of time-series consecutive video frames) level, video frame level, and image block level. At the GOP level, target bit allocation is determined based on the target bitrate of the video to obtain the target coded bits for the GOP. At the video frame level, target bit allocation is determined based on the target bitrate of the GOP to obtain the target coded bits for each video frame within that GOP. At the image block level, target bit allocation is determined based on the target bitrate of the video frame and the bit allocation weights for each image block within that video frame to obtain the target coded bits for each image block within that video frame.

[0010] Target bit control typically occurs at both the video frame and image block levels. At the video frame level, the Lagrange multiplier λ and quantization parameter QP are calculated based on the target number of encoded bits for the video frame. At the image block level, the image block-level Lagrange multiplier λ and quantization parameter QP are calculated based on the target number of encoded bits for a given image block, the video frame-level Lagrange multiplier λ and quantization parameter QP of the video frame to which the image block belongs, and the image block-level Lagrange multiplier λ and quantization parameter QP of the previously encoded image block. These are then used in the video encoding process for that image block. It can be observed that both the Lagrange multiplier λ and quantization parameter QP are divided into video frame and image block levels; sometimes the word "level" is omitted, and they are simply referred to as the video frame Lagrange multiplier λ and the image block Lagrange multiplier λ. In the target bit allocation and control stage at the video frame level (i.e., video frame level bitrate control), the video frame level Lagrange multiplier λ and quantization parameter QP are used. In the target bit allocation and control stage at the image block level (i.e., image block level bitrate control), the image block level Lagrange multiplier λ and quantization parameter QP are used.

[0011] Because video encoding algorithms are computationally intensive, the industry typically uses application-specific integrated circuits (ASICs) to accelerate the video encoding process in hardware to improve encoding speed and achieve real-time encoding and transmission. ASICs used for hardware acceleration of the video encoding process are generally referred to as hardware video encoders.

[0012] In the traditional HEVC rate control algorithm, to avoid excessive fluctuations in video encoding quality, after calculating the Lagrange multiplier λ of a certain image block to be encoded, the Lagrange multiplier λ of the video frame to which that image block belongs is also used. frame The Lagrange multiplier λ of the previous encoded image block previous This is used to calculate the upper and lower bounds of the Lagrange multipliers λ of the current image block to be encoded, thus constraining the Lagrange multipliers λ of the current image block. For example, This means that if the calculated Lagrange multiplier λ of the current image block to be encoded is greater than the upper limit value. Let λ be equal to this upper limit value. The constraints for the other upper and lower limits follow the same principle.

[0013] For ease of expression, this application makes the following conventions: est-λ and est-QP represent the values ​​of the Lagrange multipliers and quantization parameters of the image block to be encoded before the upper and lower bounds are adjusted, respectively; λ and QP represent the values ​​of the Lagrange multipliers and quantization parameters of the image block to be encoded after the upper and lower bounds are adjusted, respectively.

[0014] After obtaining the Lagrange multiplier λ of the image block to be encoded after adjusting for upper and lower bound constraints, the arithmetic square root sqrt_λ of the Lagrange multiplier and the quantization parameter QP of the image block are calculated. Where ln is the natural logarithm operator. This is the floor function. Similar upper and lower bound constraints apply to the quantization parameter QP, which will not be elaborated upon here. It should be noted that the Lagrange multipliers λ and their square root sqrt-λ are floating-point numbers with a large range of values, while the quantization parameter QP is an integer ranging from 0 to 51.

[0015] As can be seen from the above description, in the adjustment operation of the upper and lower bound constraints of the Lagrange multiplier λ of the image block to be encoded, multiplication is required to calculate the values ​​of the upper and lower bounds, square root is required to calculate the arithmetic square root, and natural logarithm and multiplication are required to calculate the quantization parameters. These operations are all performed on the Lagrange multiplier λ. Since the Lagrange multiplier λ is a floating-point number with a large value range, these operations are very unfavorable for hardware video encoder implementation, resulting in a large chip area and high power consumption for the hardware video encoder.

[0016] In some existing HEVC rate control algorithms, hardware multipliers are used to perform multiplication operations and curve fitting is used to perform square root operations in order to adjust the upper and lower limits of the Lagrange multiplier λ of the image block to be encoded. These schemes have high hardware overhead and are not conducive to the implementation of hardware video encoders. Summary of the Invention

[0017] The technical problem to be solved by this invention is to find a method suitable for small-area, low-power hardware video encoders to adjust the upper and lower limits of Lagrange multipliers of image blocks, calculate the arithmetic square root, and calculate quantization parameters in the HEVC bitrate control algorithm.

[0018] To solve the above technical problems, this invention proposes a method for adjusting the bitrate control algorithm, comprising the following steps. Step S1: Pre-store the value of the Lagrange multiplier a of the image block corresponding to each value N of the quantization parameter N of the image block in the hardware video encoder. N The arithmetic square root value of the Lagrange multipliers of the corresponding image patch, b. N And the unique mapping relationship between these three. Step S2: Based on the value of the unconstrained Lagrange multiplier est-λ of the image block to be encoded, find the corresponding quantization parameter value in the mapping relationship pre-stored by the hardware video encoder, and use it as the value of the unconstrained quantization parameter est-QP of the image block to be encoded. Step S3: Based on the quantization parameter QP of the video frame to which the image block to be encoded belongs. frame The quantization parameter QP of the previous encoded image block previous Step S4: Adjust the upper and lower bounds of the unconstrained quantization parameter est-QP of the image block to be encoded to obtain the adjusted quantization parameter QP of the image block to be encoded. Step S5: Based on the adjusted quantization parameter QP of the image block to be encoded, find the corresponding Lagrange multiplier value and its arithmetic square root value in the mapping relationship pre-stored in the hardware video encoder. These are used as the adjusted Lagrange multiplier and its arithmetic square root of the image block to be encoded.

[0019] Furthermore, in step S1, the unique mapping relationship means: (1) each N corresponds to only one a. N It also corresponds to only one b. N (2) Each a N It corresponds to only one N, and also only one b. N (3) Each b N It corresponds to only one N, and also to only one a. N .

[0020] Preferably, in step S1, the values ​​of the quantization parameters of the image block, the values ​​of the Lagrange multipliers of the image block, the values ​​of the arithmetic square roots of the Lagrange multipliers of the image block, and the unique mapping relationship between these three are recorded in tabular form.

[0021] Further, in step S1, a N and b N The value is calculated based on N, satisfying a N <a N+1 , satisfy b N <b N+1 N is an integer between 0 and 51.

[0022] Further, in step S2, the specific search method is as follows: (1) If est-λ < the value of the Lagrange multiplier a0 of the image block corresponding to the minimum value 0 of the quantization parameter of the image block in the mapping relationship, then est-QP is 0. (2) If est-λ ≥ the value of the Lagrange multiplier a0 of the image block corresponding to the maximum value 51 of the quantization parameter of the image block in the mapping relationship, then est-QP is 0. 51 Then est-QP takes the value 51. (3) If est-λ is at a0 and a 51 If the value is less than or equal to est-λ and closest to est-λ in the mapping relationship, then est-QP takes the value of the quantization parameter corresponding to the value of the Lagrange multiplier of the image patch.

[0023] Preferably, in step S3, the specific constraint method is as follows: QP previous -m≤QP≤QP previous +m, and QP frame -n≤QP≤QP frame +n, and 0≤QP≤51; m and n are both positive integers, and m<n.

[0024] Preferably, in step S3, m is 1 and n is 2.

[0025] Further, in step S4, after obtaining the quantization parameters, Lagrange multipliers and their arithmetic square roots of the image block to be encoded after upper and lower limit constraints, the video encoding process of the image block to be encoded begins.

[0026] This invention also proposes an adjustment device for a bitrate control algorithm, including a mapping relationship pre-storage unit, a first search unit, a quantization parameter constraint unit, and a second search unit. The mapping relationship pre-storage unit is used to pre-store the value of the Lagrange multiplier a of each value N of the quantization parameter of an image block in the hardware video encoder before video encoding. N The arithmetic square root value of the Lagrange multipliers of the corresponding image patch, b. N And the unique mapping relationship between these three. The first lookup unit is used to find the corresponding quantization parameter value in the mapping relationship pre-stored in the hardware video encoder based on the value of the unconstrained Lagrange multiplier est-λ of the image block to be encoded, as the value of the unconstrained quantization parameter est-QP of the image block to be encoded. The quantization parameter constraint unit is used to determine the quantization parameter QP of the video frame to which the image block to be encoded belongs. frame The quantization parameter QP of the previous encoded image block previousThe value of the unconstrained quantization parameter est-QP of the image block to be encoded is adjusted for upper and lower bounds to obtain the constrained quantization parameter QP of the image block to be encoded. The second lookup unit is used to find the value of the Lagrange multiplier and its arithmetic square root of the corresponding image block in the mapping relationship pre-stored by the hardware video encoder based on the value of the constrained quantization parameter QP of the image block to be encoded, and use it as the constrained Lagrange multiplier and its arithmetic square root of the image block to be encoded.

[0027] The technical effect achieved by this invention is that the HEVC bitrate control algorithm is changed to use the quantization parameters of image blocks as the core for upper and lower limit constraint adjustment, and only query and integer addition and subtraction operations are used in the adjustment process, which is very suitable for hardware implementation. Attached Figure Description

[0028] Figure 1 This is a flowchart illustrating the adjustment method of the bitrate control algorithm suitable for hardware implementation proposed in this invention.

[0029] Figure 2 This is a schematic diagram of the structure of the adjustment device for the bit rate control algorithm suitable for hardware implementation proposed in this invention.

[0030] The following are the annotations in the figure: 1 is the mapping relationship pre-storage unit, 2 is the first search unit, 3 is the quantization parameter constraint unit, and 4 is the second search unit. Detailed Implementation

[0031] Please see Figure 1 The method for adjusting the bitrate control algorithm suitable for hardware implementation proposed in this invention includes the following steps.

[0032] Step S1: Before video encoding, pre-store the value of the Lagrange multiplier a of each value N of the quantization parameter of the image block in the hardware video encoder. N The arithmetic square root value of the Lagrange multipliers of the corresponding image patch, b. N Simultaneously pre-store N and a N b N The unique mapping relationship among these three is as follows: (1) Each value N of the quantization parameter of the image block corresponds to the value a of the Lagrange multiplier of only one image block. N The value of b, which corresponds to the arithmetic square root of the Lagrange multipliers for only one image patch. N (2) Each value a of the Lagrange multiplier of the image patch N The value of the quantization parameter N corresponds to only one image patch, and the value of the arithmetic square root of the Lagrange multiplier for only one image patch is also represented by b. N(3) Each value b of the arithmetic square root of the Lagrange multiplier of the image patch. N The value of the quantization parameter N corresponds to only one image patch, and the value of the Lagrange multiplier a corresponds to only one image patch. N .

[0033] For example, record N and a in tabular form. N b N The values ​​of these three and their unique mapping relationship are shown in Table 1.

[0034]

[0035]

[0036] Table 1: Unique Mapping Relationship Table

[0037] Table 1 shows that the quantization parameter of the image patch has 52 possible values ​​N, which are integers from 0 to 51. Table 1 also records the value of the Lagrange multiplier a of the image patch for each value N of the quantization parameter. N The value of the arithmetic square root of the Lagrange multipliers of the image patch, b. N a N and b N The value is calculated based on N, satisfying a N <a N+1 , satisfy b N <b N+1 N is an integer between 0 and 51.

[0038] Step S2: During the video encoding process, after calculating the unconstrained Lagrange multiplier est-λ of a certain image block to be encoded within the video frame using the bitrate control algorithm, the corresponding quantization parameter value is found in the mapping relationship pre-stored in the hardware video encoder based on the value of the unconstrained Lagrange multiplier est-λ of the image block to be encoded, and is used as the value of the unconstrained quantization parameter est-QP of the image block to be encoded. The specific search method is as follows: (1) If the value of the unconstrained Lagrange multiplier est-λ of the image block to be encoded is less than the value of the Lagrange multiplier a0 of the image block corresponding to the minimum value 0 of the quantization parameter of the image block, then the value of the unconstrained quantization parameter of the image block to be encoded is 0. That is, if est-λ < a0, then est-QP is 0. (2) If the value of the unconstrained Lagrange multiplier est-λ of the image block to be encoded is greater than or equal to the value of the Lagrange multiplier a0 of the image block corresponding to the maximum value 51 of the quantization parameter of the image block, then the value of the unconstrained quantization parameter est-QP of the image block to be encoded is 0. 51 If est-λ≥a, then the unconstrained quantization parameter value of the image block to be encoded is 51. 51Then est-QP is 51. (3) If the Lagrange multiplier est-λ of the image block to be encoded without upper and lower bound constraints is the value a0 of the Lagrange multiplier of the image block corresponding to the minimum value 0 of the quantization parameter of the image block and the value a of the Lagrange multiplier of the image block corresponding to the maximum value 51 of the quantization parameter of the image block. 51 Between these values, the unconstrained quantization parameters of the image block to be encoded are taken as the value of the "Lagrange multiplier of the image block" that is less than or equal to est-λ and closest to est-λ in the mapping relationship. N The corresponding quantization parameter value N. That is, if a0 ≤ est - λ < a 51 Then est-QP takes the value N, where N satisfies a N ≤est-λ<a N+1 .

[0039] In this step, only a lookup operation (e.g., table lookup) is used to obtain the unconstrained quantization parameter est-QP of the image block to be encoded, without complex calculations. This step obtains the unconstrained quantization parameter est-QP (an integer between 0 and 51) of the image block to be encoded from the unconstrained Lagrange multiplier est-λ (a floating-point number with a large value range). Subsequent adjustments to the upper and lower bounds of the unconstrained quantization parameter est-QP of the image block to be encoded greatly reduce the numerical range and significantly alleviate the computational burden in subsequent operations.

[0040] Step S3: During the video encoding process, the quantization parameters QP of the video frame to which the image block to be encoded belongs are used. frame The quantization parameter QP of the previous encoded image block previous The quantization parameter est-QP of the image block to be encoded, without upper and lower bound constraints, is adjusted to obtain the quantization parameter QP of the image block after upper and lower bound constraints. The specific constraint method is as follows: QP previous -m≤QP≤QP previous +m, QP frame -n≤QP≤QP frame +n, 0≤QP≤51. m and n are both positive integers, and m<n. Preferably, m is 1 and n is 2. There are three upper limits and three lower limits, all of which must be satisfied. For example, if the value of the quantization parameter est-QP of the image block to be encoded without upper and lower limits is greater than a certain upper limit value QP... previous +1, then let the value of est-QP be equal to the upper limit value QP. previous +1. The constraints for the remaining upper and lower limits follow the same principle.

[0041] In this step, in order to adjust the upper and lower bounds of the est-QP value of the unconstrained quantization parameter of the image block to be encoded, only integer addition and subtraction are used when calculating each upper and lower bound value, which is very beneficial to hardware implementation.

[0042] Step S4: During the video encoding process, based on the value of the quantization parameter QP adjusted by upper and lower bound constraints for the image block to be encoded, the value of the corresponding Lagrange multiplier and its arithmetic square root of the image block are found in the mapping relationship pre-stored in the hardware video encoder. These are used as the Lagrange multiplier λ and its arithmetic square root sqrt-λ adjusted by upper and lower bound constraints for the image block to be encoded. After obtaining the quantization parameter QP, the Lagrange multiplier λ, and its arithmetic square root sqrt-λ adjusted by upper and lower bound constraints for the image block to be encoded, the encoding process for the image block to be encoded can begin.

[0043] In this step, in order to obtain the Lagrange multipliers λ and their arithmetic square root sqrt-λ of the image block to be encoded after upper and lower bound constraints, only a lookup operation (e.g., table lookup) was used, without using complex operations.

[0044] Please see Figure 2 The adjustment device for the bit rate control algorithm suitable for hardware implementation proposed in this invention includes a mapping relationship pre-storage unit 1, a first search unit 2, a quantization parameter constraint unit 3, and a second search unit 4. Figure 2 The device shown corresponds to Figure 1 The method shown.

[0045] The mapping relationship pre-storage unit 1 is used to pre-store the value of the Lagrange multiplier a of each value N of the quantization parameter of the image block in the hardware video encoder before video encoding. N The arithmetic square root value of the Lagrange multipliers of the corresponding image patch, b. N Simultaneously pre-store N and a N b N The unique mapping relationship between these three.

[0046] The first lookup unit 2 is used to find the value of the corresponding quantization parameter in the mapping relationship pre-stored in the hardware video encoder based on the value of the unconstrained upper and lower bound Lagrange multiplier est-λ of the image block to be encoded, and use it as the value of the unconstrained upper and lower bound quantization parameter est-QP of the image block to be encoded.

[0047] The quantization parameter constraint unit 3 is used to determine the quantization parameter QP of the video frame to which the image block to be encoded belongs. frame The quantization parameter QP of the previous encoded image block previousThe values ​​of the quantization parameter est-QP of the image block to be encoded without upper and lower bound constraints are adjusted to obtain the quantization parameter QP of the image block to be encoded after upper and lower bound constraints.

[0048] The second lookup unit 4 is used to find the value of the Lagrange multiplier and the value of its arithmetic square root of the corresponding image block in the mapping relationship pre-stored in the hardware video encoder based on the value of the quantization parameter QP of the image block to be encoded after upper and lower limit constraints, and use it as the Lagrange multiplier λ and its arithmetic square root sqrt-λ of the image block to be encoded after upper and lower limit constraints.

[0049] In the traditional HEVC rate control algorithm, to avoid excessive fluctuations in video encoding quality, after calculating the Lagrange multiplier for a specific image block to be encoded within a video frame, a series of upper and lower limit constraint adjustments are performed using this Lagrange multiplier as the core, and the arithmetic square root of the Lagrange multiplier and the quantization parameters of the image block are calculated. This process requires multiplication, square root operations, and natural logarithm operations. Since the Lagrange multiplier is a floating-point number with a large value range, implementing these operations based on the Lagrange multiplier in hardware is very costly. Even if some of these operations are performed using curve fitting, the cost is still very high.

[0050] To address this issue, this invention, after calculating the Lagrange multiplier of a given image block to be encoded using the rate control algorithm, immediately converts it into the corresponding quantization parameter by querying a mapping relationship. Then, using the quantization parameter as the core, a series of upper and lower limit constraint adjustment operations are performed to obtain the constraint-adjusted quantization parameter of the image block to be encoded. Finally, by querying the mapping relationship again, the constraint-adjusted Lagrange multiplier and its arithmetic square root of the image block to be encoded are obtained. Compared to the traditional HEVC rate control algorithm's upper and lower limit constraint adjustment method centered on the Lagrange multiplier, this invention innovatively uses the quantization parameter as the core for upper and lower limit constraint adjustment. The adjustment process only uses querying and integer addition and subtraction operations, making the calculation simple and computationally intensive, highly suitable for hardware implementation, and placing very low demands on the computing power of the hardware video encoder, thereby significantly reducing the chip area, power consumption, and cost of the hardware video encoder.

[0051] The above are merely preferred embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method of adjusting a rate control algorithm, characterized by, The method comprises the following steps: Step S1: prestore in the hardware video encoder the value a of the Lagrange multiplier of the image block corresponding to each value N of the quantization parameter of the image block N , the value b of the arithmetic square root of the Lagrange multiplier of the corresponding image block N , and the unique mapping relationship among the three Step S2: according to the value of the un-constrained Lagrange multiplier est-λ of the image block to be encoded, find the corresponding value of the quantization parameter in the mapping relationship pre-stored in the hardware video encoder, as the value of the un-constrained quantization parameter est-QP of the image block to be encoded; Step S3: according to the quantization parameter QP of the video frame to which the to-be-encoded image block belongs frame and the quantization parameter QP of the previous encoded image block previous upper and lower limit constraint adjustment is performed on the value of the un-constrained quantization parameter est-QP of the to-be-encoded image block, to obtain the quantization parameter QP of the to-be-encoded image block after the upper and lower limit constraint adjustment. Step S4: according to the value of the adjusted quantization parameter QP of the image block to be encoded, find the corresponding value of the Lagrange multiplier of the image block and the value of the arithmetic square root thereof in the mapping relationship pre-stored in the hardware video encoder, as the adjusted Lagrange multiplier and the arithmetic square root thereof of the image block to be encoded.

2. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate and the actual rate. In the step S1, the unique mapping relationship means that (1) each N corresponds to only one a N , and only one b N ; (2) each a N corresponds to only one N, and only one b N ; (3) each b N corresponds to only one N, and only one a N .

3. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate and the actual rate. In the step S1, the values of the quantization parameter of the image block, the value of the Lagrange multiplier of the image block, the value of the arithmetic square root of the Lagrange multiplier of the image block, and the unique mapping relationship among the three are recorded in a table form.

4. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate with a rate of the current frame. The values of a N and b N are calculated according to N, satisfying a N < a N+1 , b N < b N+1 , and N is an integer between 0 and 51.

5. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate and the actual rate. In the step S2, the specific finding method is as follows: (1) if est-λ < a0, the value of the Lagrange multiplier of the image block corresponding to the minimum value 0 of the quantization parameter of the image block in the mapping relationship, then est-QP takes 0; (2) If est-λ≥ the value a of the Lagrange multiplier of the image block corresponding to the maximum value 51 of the quantization parameter of the image block in the mapping relationship 51 , then est-QP takes 51; (3) If est-λ is between a0and a 51 est-QP takes the value of the quantization parameter corresponding to the value of the Lagrange multiplier of the image block in the mapping relationship that is less than or equal to est-λ and closest to est-λ.

6. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate and the actual rate. In the step S3, the specific constraint is as follows: QP previous - m ≤ QP ≤ QP previous + m, and QP frame - n ≤ QP ≤ QP frame + n, and 0 ≤ QP ≤ 51; m and n are positive integers, and m < n.

7. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate and the actual rate. In the step S3, m takes 1 and n takes 2.

8. The method of claim 1, wherein the adjustment of the rate control algorithm is based on a comparison of the target rate and the actual rate. In the step S4, after obtaining the adjusted quantization parameter of the image block to be encoded, the adjusted Lagrange multiplier and the arithmetic square root thereof, the video encoding process of the image block to be encoded is started.

9. An apparatus for adjusting a rate control algorithm, characterized by The method comprises a mapping relationship pre-storing unit, a first finding unit, a quantization parameter constraining unit, and a second finding unit. The mapping relationship pre-storing unit is used to pre-store, in a hardware video encoder before video encoding, the value a of the Lagrange multiplier of the image block corresponding to each value N of the quantization parameter of the image block N , the value b of the arithmetic square root of the Lagrange multiplier of the corresponding image block N , and the unique mapping relationship among the three. The first finding unit is used to find the corresponding value of the quantization parameter in the mapping relationship pre-stored in the hardware video encoder according to the value of the un-constrained Lagrange multiplier est-λ of the image block to be encoded, as the value of the un-constrained quantization parameter est-QP of the image block to be encoded; The quantization parameter constraint unit is configured to constrain the quantization parameter QP of the to-be-encoded image block according to a quantization parameter QP of a video frame to which the to-be-encoded image block belongs frame and a quantization parameter QP of a previous encoded image block previous constrain and adjust a value of an unconstrained quantization parameter est-QP of the to-be-encoded image block to obtain a constrained and adjusted quantization parameter QP of the to-be-encoded image block The second finding unit is used to find the corresponding value of the Lagrange multiplier of the image block and the value of the arithmetic square root thereof in the mapping relationship pre-stored in the hardware video encoder according to the value of the adjusted quantization parameter QP of the image block to be encoded, as the adjusted Lagrange multiplier and the arithmetic square root thereof of the image block to be encoded.

Citation Information

Patent Citations

  • Video coding method based on region of interest (ROI)

    CN101945275A

  • H.264 code rate control method

    CN103533359A

  • Structural similarity-based efficient video code perceiving code rate control optimizing method

    CN103634601A

  • Quantization offset and cost factor modification for video encoding

    US20160057418A1

  • Video processing method

    US20180324426A1