Method and apparatus for rate control

By determining the quantization step size through exponential mapping, the problem of encoding buffer fullness fluctuation in existing technologies is solved, and stable bitrate control is achieved when the encoding difficulty changes, thereby improving image quality and buffer efficiency.

CN116527911BActive Publication Date: 2026-04-24PEKING UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PEKING UNIV
Filing Date
2023-04-21
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing bitrate control methods cannot effectively buffer the fullness fluctuations of the encoding buffer when the encoding difficulty of the image to be encoded increases, resulting in a decrease in image quality or insufficient buffer causing screen stuttering.

Method used

The quantization step size is determined by using an exponential mapping method. By making the base of the exponential function a number greater than 1, the quantization step size and the fullness of the encoding buffer change exponentially to adapt to changes in encoding difficulty and ensure the stability of the buffer state.

Benefits of technology

When the encoding difficulty increases, the buffer can be effectively used to buffer the bitstream, improve image quality or reduce the bitstream, prevent screen stuttering caused by insufficient buffer, and achieve more stable bitrate control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116527911B_ABST
    Figure CN116527911B_ABST
Patent Text Reader

Abstract

The application provides a rate control method and device, the method comprising: obtaining a first actual fill level of a coding buffer at a current time; determining a quantization step by performing exponential mapping on the first actual fill level; the base of an exponential function in a target relationship formula of the exponential mapping is a number greater than 1; and determining a quantization parameter of a current coding unit based on the quantization step. Based on this, when the coding difficulty of an image to be coded increases, the fill level of the coding buffer is fluctuated to relieve the state of the buffer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video processing technology, and in particular to a method and apparatus for bitrate control. Background Technology

[0002] With the increasing popularity of image and video applications, video compression technology is constantly iterating and innovating. Common video compression standards such as Display Stream Compression (DSC), VESA Display Compression-M (VDC-M), Apple ProRes codec, and JPEG-XS are widely used in display interfaces such as High Definition Multimedia Interface (HDMI) and DisplayPort (DP), as well as in image and video production. The main purpose of general video compression standards is to achieve data compression of 4 to 16 times while meeting the requirements of low latency, low complexity, and subjective losslessness. Taking the relatively common DSC coding standard as an example, the lightweight compression coding framework mainly includes modules such as input / output, buffer fragmentation, prediction, quantization, reconstruction, entropy coding, bitrate control, and bitstream synthesis. Other standards may optionally include transform and other special tool modules. Among them, the bitrate control module controls the quantization parameter (QP) of the encoding of each frame or each coding unit so that the bitrate of the output encoded video meets various specific constraints. Specifically, the main function of the rate control module is to make quantization decisions based on the fullness of the encoding buffer and the texture information of the encoded image, calculate the quantization step size and quantization parameters of the encoding unit, ensure that the buffer does not overflow or underflow, and at the same time make the most of the buffer to improve the quality of the encoded image.

[0003] Typically, a linear mapping can be performed based on the fill level of the buffer to determine the quantization step size of the coding unit. However, this method cannot buffer the fluctuations in the fill level of the coding buffer to alleviate the buffer state when the coding difficulty of the image to be encoded increases. Summary of the Invention

[0004] This invention provides a method and apparatus for bitrate control, which enables the buffer to alleviate the state of the buffer by buffering the fluctuation of the filling degree of the encoding buffer when the encoding difficulty of the image to be encoded increases.

[0005] This invention provides a method for rate control, comprising: obtaining a first actual fill degree of the encoding buffer at the current time; determining a quantization step size by performing an exponential mapping on the first actual fill degree; wherein the base of the exponential function in the target relation of the exponential mapping is a number greater than 1; and determining the quantization parameters of the current encoding unit based on the quantization step size.

[0006] In one embodiment, determining the quantization step size by exponentially mapping the first actual fullness includes: obtaining the values ​​of a preset target fullness and a preset penalty coefficient of the encoding buffer; the value of the preset penalty coefficient is used to determine the correlation between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness; the number of encoding bits to be allocated is negatively correlated with the actual fullness and positively correlated with the preset target fullness; based on the values ​​of the preset target fullness and the preset penalty coefficient, determining the target relationship of the exponential mapping; and based on the first actual fullness and the target relationship of the exponential mapping, determining the quantization step size.

[0007] In one embodiment, determining the target relation for the exponential mapping based on the preset target fullness and the preset penalty coefficient includes: determining a first relation between the number of coded bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness, based on the preset target fullness and the preset penalty coefficient; determining a third relation between the quantization step size and the actual fullness of the encoding buffer based on the first relation and a preset second relation, and determining the third relation as the target relation for the exponential mapping; the preset second relation is used to represent the relationship between the number of coded bits to be allocated and the quantization step size.

[0008] In one embodiment, the first relation is: R = recover_ratio * (Fa - Ft), where R is the number of coded bits to be allocated; recover_ratio is a preset penalty coefficient, which is negative; Ft is a preset target fullness; Fa represents the actual fullness of the coded buffer after linear mapping, and the fourth relation corresponding to Fa is F. a =scale*(F+offset); where F is the actual fullness of the encoding buffer, scale is a preset linear change coefficient, and offset is a preset bias; the second relation is: R = -alog(qstep)+b, where a and b are preset coefficients obtained based on statistics, and both a and b are positive numbers; the third relation is: Where qstep represents the quantization step size. Let A = e be the exponential function in the objective relation of the exponential mapping. (-recover_ratio / a) B = e((b+recover_ratio*Ft) / a) .

[0009] In one embodiment, determining the quantization step size based on the first actual fullness and the target relation of the exponential mapping includes: substituting the first actual fullness as the actual fullness F of the encoding buffer into the fourth relation to obtain the second actual fullness after linear mapping; and substituting the second actual fullness as the actual fullness Fa of the encoding buffer after linear mapping into the third relation to determine the quantization step size.

[0010] The present invention also provides a bitrate control apparatus, comprising: an acquisition module for acquiring a first actual fill degree of the encoding buffer at the current time; a first determination module for determining a quantization step size by performing an exponential mapping on the first actual fill degree; wherein the base of the exponential function in the target relation of the exponential mapping is a number greater than 1; and a second determination module for determining the quantization parameters of the current encoding unit based on the quantization step size.

[0011] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the bit rate control method as described above.

[0012] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the bitrate control method as described above.

[0013] The bitrate control method and apparatus provided by this invention determine the quantization step size by performing an exponential mapping on the first actual fill level. Furthermore, by ensuring that the base of the exponential function in the target relation of the exponential mapping is greater than 1, the exponential function in the target relation is a monotonically increasing exponential function. Therefore, when the encoding difficulty of the image to be encoded increases and the fill level of the encoding buffer is small, the quantization step size decreases exponentially compared to the fill level of the encoding buffer. This results in a larger decrease in the quantization step size compared to linear mapping, leading to smaller quantization parameter values ​​obtained subsequently based on the quantization step size, finer quantization, higher image quality, and a longer bitstream. Thus, it can fully utilize the encoding buffer to buffer the bitstream even when the encoding difficulty of the image to be encoded increases and the fill level of the encoding buffer is small. Similarly, when the encoding difficulty of the image to be encoded increases and the fill factor of the encoding buffer is large, the quantization step size increases exponentially compared to the fill factor of the encoding buffer. This results in a larger increase in the quantization step size compared to a linear mapping, leading to larger quantization parameter values ​​obtained based on the quantization step size, coarser quantization, and shorter bitstream. This allows for an appropriate reduction in bitstream when the encoding difficulty of the image to be encoded increases and the fill factor of the encoding buffer is large, preventing screen stuttering caused by insufficient encoding buffer. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0015] Figure 1 This is a schematic diagram of the framework of existing video compression methods;

[0016] Figure 2 This is one of the flowcharts illustrating the bitrate control method provided by the present invention;

[0017] Figure 3 This is the second flowchart of the bitrate control method provided by the present invention;

[0018] Figure 4 This is a schematic diagram of the coded image provided by the present invention;

[0019] Figure 5 This is a schematic diagram illustrating the change in the fullness of the encoding buffer provided by the present invention;

[0020] Figure 6 This is a schematic diagram illustrating the change in quantization step size provided by the present invention;

[0021] Figure 7 This is a schematic diagram of the bit rate control device provided by the present invention;

[0022] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0024] To facilitate understanding, the technical terms involved in this invention will first be explained.

[0025] Bitrate control: Bitrate control technology is a crucial module in practical video encoders. Depending on the specific application scenario, such as real-time or offline encoding, traditional broadcast television services or internet streaming media transmission services, there are various specific requirements and limitations on the output bitrate of the video encoder, such as average or maximum target bitrate, buffer size, initial latency, etc. Bitrate control addresses these different application scenarios by controlling the quantization parameters of each frame or each encoding unit to ensure that the output encoded video bitrate meets various specific constraints, while simultaneously optimizing encoding performance, including encoding efficiency and subjective quality, as much as possible.

[0026] Bitrate: Bitrate is the number of bits of data transmitted per unit of time during data transmission, and the unit is kilobitsper second (kbps).

[0027] Quantization parameters: Quantization parameters reflect the degree of spatial detail compression. The smaller the quantization parameter value, the finer the quantization, the higher the image quality, and the longer the generated bitstream. For example, a small QP value preserves most of the details; increasing the QP value results in the loss of some details, a lower bitrate, but also increased image distortion and a decrease in quality.

[0028] The following is combined Figures 1-8 The present invention describes a method and apparatus for bitrate control.

[0029] For ease of understanding, Figure 1 An exemplary application example of the rate control method of the present invention is given. Taking the DSC encoding standard as an example, such as... Figure 1As shown, the lightweight compression coding framework mainly includes modules such as input, buffer fragmentation, flatness measurement, prediction, quantization, reconstruction, entropy coding, rate control, bitstream synthesis, encoding buffer, and output. The rate control module can output quantization parameters to the flatness measurement module and the prediction, quantization, and reconstruction modules. The entropy coding module can feed back the number of encoded bits to the rate control module. The rate control method of this invention can mainly be applied to the rate control module in the aforementioned lightweight compression coding framework.

[0030] It is understood that this invention can be applied not only to DSC, but also to video compression methods such as VDC-M, Apple ProRes, and JPEG-XS.

[0031] Figure 2 This is a flowchart illustrating the bitrate control method provided by the present invention. It can be understood that the bitrate control method can be applied to the field of video compression and can be executed by a bitrate control device, such as... Figure 2 As shown, the method includes the following steps:

[0032] Step 210: Obtain the first actual fullness of the encoding buffer at the current moment.

[0033] The first actual fullness of the current encoding buffer is the fullness of the current encoding buffer.

[0034] Step 220: Determine the quantization step size by performing an exponential mapping on the first actual fullness; the base of the exponential function in the target relation of the exponential mapping is a number greater than 1.

[0035] Understandably, the quantization step size of a coding unit can usually be determined by a linear mapping based on the fill level of the coding buffer. In other words, the quantization step size changes linearly with the fill level of the coding buffer. However, this method cannot buffer fluctuations in the fill level of the coding buffer to alleviate buffer issues when the encoding difficulty of the image increases. Specifically, the following problems exist: if the fill level of the coding buffer is low when the encoding difficulty of the image increases, the buffer cannot be fully utilized to buffer the bitstream, causing a rapid decline in image quality; or if the fill level of the coding buffer is high, it cannot prevent frame drops caused by insufficient buffering.

[0036] Therefore, this invention determines the quantization step size by performing an exponential mapping on the first actual fill degree, and ensures that the base of the exponential function in the target relation of the exponential mapping is a number greater than 1, that is, the exponential function is a monotonically increasing exponential function. In other words, the smaller the first actual fill degree of the current encoding buffer, the smaller the quantization step size, and the quantization step size decreases exponentially compared to the first actual fill degree of the current encoding buffer; conversely, the larger the first actual fill degree of the current encoding buffer, the larger the quantization step size, and the quantization step size increases exponentially compared to the first actual fill degree of the current encoding buffer. Therefore, at least two effects can be achieved: First, when the encoding difficulty of the image to be encoded increases and the fill degree of the encoding buffer is small, the quantization step size decreases exponentially compared to the fill degree of the encoding buffer, thus resulting in a larger decrease in the quantization step size compared to linear mapping. This leads to smaller quantization parameter values ​​obtained subsequently based on the quantization step size, finer quantization, higher image quality, and a longer bitstream. This allows for full utilization of the encoding buffer to buffer the bitstream when the encoding difficulty of the image to be encoded increases and the filling capacity of the encoding buffer is small. Secondly, when the encoding difficulty of the image to be encoded increases and the filling capacity of the encoding buffer is large, the quantization step size increases exponentially compared to the filling capacity of the encoding buffer. This results in a larger increase in the quantization step size compared to a linear mapping, leading to larger quantization parameter values ​​obtained based on the quantization step size, coarser quantization, and a shorter bitstream. This allows for appropriate reduction of the bitstream when the encoding difficulty of the image to be encoded increases and the filling capacity of the encoding buffer is large, preventing screen stuttering caused by insufficient encoding buffer filling.

[0037] Step 230: Determine the quantization parameters of the current coding unit based on the quantization step size.

[0038] It is understandable that this process can refer to existing technologies. For the sake of brevity, it will not be elaborated here.

[0039] The bitrate control method provided by this invention determines the quantization step size by performing an exponential mapping on the first actual fill degree. Furthermore, by ensuring that the base of the exponential function in the target relation of the exponential mapping is greater than 1, the exponential function in the target relation is a monotonically increasing exponential function. Therefore, when the encoding difficulty of the image to be encoded increases and the fill degree of the encoding buffer is small, the quantization step size decreases exponentially compared to the fill degree of the encoding buffer. This results in a larger decrease in the quantization step size compared to linear mapping, leading to smaller quantization parameter values ​​obtained subsequently based on the quantization step size, finer quantization, higher image quality, and a longer bitstream. Thus, it can fully utilize the encoding buffer to buffer the bitstream even when the encoding difficulty of the image to be encoded increases and the fill degree of the encoding buffer is small. Similarly, when the encoding difficulty of the image to be encoded increases and the fill factor of the encoding buffer is large, the quantization step size increases exponentially compared to the fill factor of the encoding buffer. This results in a larger increase in the quantization step size compared to a linear mapping, leading to larger quantization parameter values ​​obtained based on the quantization step size, coarser quantization, and shorter bitstream. This allows for an appropriate reduction in bitstream when the encoding difficulty of the image to be encoded increases and the fill factor of the encoding buffer is large, preventing screen stuttering caused by insufficient encoding buffer.

[0040] In one embodiment, such as Figure 3 As shown, the quantization step size is determined by exponentially mapping the first actual fullness, including the following steps:

[0041] Step 310: Obtain the preset target fullness and preset penalty coefficient values ​​of the encoding buffer.

[0042] The preset penalty coefficient is used to determine the correlation between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness; the number of encoding bits to be allocated is negatively correlated with the actual fullness, and the number of encoding bits to be allocated is positively correlated with the preset target fullness.

[0043] The preset target fullness of the encoding buffer can be understood as a preset target fullness that ensures the encoding buffer is in an appropriate working state. Specifically, the preset target fullness of the encoding buffer can be determined based on the actual application, for example, it can be 0.25. The number of encoding bits to be allocated is the number of encoding bits that will be allocated to the encoding unit.

[0044] It is understandable that, to ensure the encoding buffer is neither too idle nor too full, a preset target fill level can be set to determine a desired buffer state. Furthermore, through the preset penalty coefficient, the number of encoding bits to be allocated is negatively correlated with the actual fill level, and positively correlated with the preset target fill level. This ensures that when the actual fill level of the encoding buffer is high, fewer encoding bits are allocated to the encoding units; conversely, when the actual fill level is low, more encoding bits are allocated to the encoding units. This guarantees that as the encoding difficulty of the image increases, fluctuations in the fill level of the encoding buffer are buffered to alleviate the buffer's state. In other words, when the encoding difficulty of the image increases, if the buffer fill level is low, the buffer cannot be fully utilized to buffer the bitstream, causing a rapid decline in image quality; or if the buffer fill level is high, insufficient buffering can lead to screen stuttering.

[0045] Step 320: Determine the target relationship of the exponential mapping based on the preset target fullness and the preset penalty coefficient.

[0046] Specifically, this step may include steps 3201 and 3202.

[0047] Step 3201: Based on the preset target fullness and the preset penalty coefficient, determine the first relationship between the number of encoding bits to be allocated, the actual fullness of the encoding buffer, and the preset target fullness.

[0048] In one embodiment, the first relation is: R = recover_ratio * (Fa - Ft), where R is the number of coded bits to be allocated; recover_ratio is a preset penalty coefficient, which is negative; Ft is a preset target fullness; Fa represents the actual fullness of the coded buffer after linear mapping, and the fourth relation corresponding to Fa is F. a =scale*(F+offset); where F is the actual fullness of the encoding buffer, scale is the preset linear variation coefficient, and offset is the preset bias.

[0049] The actual fullness of the encoding buffer refers to the actual fullness of the encoding buffer at each moment in actual application.

[0050] For example, the default penalty coefficient could be -1.5.

[0051] Step 3202: Based on the first relation and the preset second relation, determine the third relation between the quantization step size and the actual fullness of the encoding buffer, and determine the third relation as the target relation of the exponential mapping.

[0052] The preset second relation is used to represent the relationship between the number of coded bits to be allocated and the quantization step size.

[0053] It can be understood that by combining the first relation and the preset second relation, the third relation between the quantization step size and the actual fullness of the encoding buffer can be determined.

[0054] Specifically, the second relation can be: R = -alog(qstep) + b, where a and b are preset coefficients obtained based on statistics, and both a and b are positive numbers; the third relation is: Where qstep represents the quantization step size. Let A = e be the exponential function in the objective relation of the exponential mapping. (-recover _ ratio / a) B = e ((b+recover _ratio*Ft) / a).

[0055] Specifically, a and b can be determined statistically on the image dataset, where b equals the bitrate at lossless (qstep = 1). For example, b = 5.0 and a = 1.3.

[0056] It is understandable that the logarithmic function in the second relation can be a logarithm with base e or a logarithmic function with bases other than e. In the case of a logarithmic function with bases other than e, A and B are corresponding exponential functions with bases other than e.

[0057] Understandably, current probabilistic models typically assume that the number of coded bits to be allocated is proportional to the logarithm of the quantization step size; that is, the number of coded bits to be allocated and the quantization step size satisfy the second relationship mentioned above. Therefore, by combining the first relationship, the target relationship for the exponential mapping between the quantization step size and the actual fullness of the encoding buffer can be determined.

[0058] Step 330: Determine the quantization step size based on the target relationship between the first actual fullness and the index mapping.

[0059] Wherein, the first actual fullness of the encoding buffer at the current time is the actual fullness of the encoding buffer at the current time. It can be understood that the first actual fullness of the encoding buffer at the current time is one of the actual fullness values ​​of the encoding buffer. Therefore, based on the first actual fullness of the encoding buffer at the current time, combined with the target relation of the exponential mapping described above, the quantization step size can be determined. Alternatively, the first actual fullness of the encoding buffer at the current time can be linearly mapped before determining the quantization step size. Therefore, specifically, step 330 may include steps 3301 and 3302.

[0060] Step 3301: Take the first actual fullness as the actual fullness F of the encoding buffer, substitute it into the fourth relation, and obtain the second actual fullness after linear mapping.

[0061] Combining the fourth relation above, the first actual fullness is taken as the actual fullness F of the encoding buffer, and substituted into the fourth relation F. a =scale*(F+offset) to get F a .

[0062] Step 3302: Substitute the second actual fill factor as the actual fill factor Fa of the linearly mapped encoding buffer into the third relation to determine the quantization step size.

[0063] Specifically, the second actual fullness is taken as F. a Substitute the third relation into The quantization step size can then be determined.

[0064] To facilitate understanding, the following will be combined with... Figures 4 to 6 This invention explains the effectiveness of the bitrate control method provided by the present invention.

[0065] Figure 4 The original image provided by this invention for encoding. For example... Figure 4 As shown, it is mainly divided into three parts: left, middle, and right, with blank areas between each pair of parts. The left part is a line drawing, the middle part is a paragraph composed of the letter 'c', and the right part is mainly composed of the letter 'x'. The fourth and fifth rows of the right part are composed of other letters and numbers.

[0066] Figure 5 To provide a method for bitrate control based on the present invention Figure 4 A schematic diagram illustrating the change in the fullness of the encoding buffer during the encoding process. The horizontal and vertical axes represent... Figure 4 The image shown contains the coordinates of each pixel, in units of one pixel. Figure 5The brightness level represents the fill level of the encoding buffer corresponding to each pixel. The fill level of the encoding buffer is between 0 and 1, where 0 is the emptyest and 1 is the fullest. Figure 5 The white part with higher fill intensity in the left part corresponds to Figure 4 The line drawing in the middle left section. Figure 5 The middle part of the white with higher fill level corresponds to Figure 4 The paragraph composed of the letter 'c' Figure 5 The white area with higher fillability on the right side corresponds to Figure 4 The text refers to paragraphs containing the letter 'x'. It's understood that the encoding difficulty is higher for positions with lines and letters than for blank areas. This is because positions with significant letter variations contain more pixels than positions with minor letter variations; therefore, encoding positions with significant letter variations is more difficult than those with minor letter variations.

[0067] Therefore, combining Figure 4 ,from Figure 5 It can be seen that, on the one hand, when switching from a region with lower image encoding difficulty to a region with higher encoding difficulty, the fill level of the encoding buffer slowly increases; for example, in the fourth row of the white region on the right, where the fill level transitions from multiple repeated letters 'x' to combinations of different numbers and letters, the fill level of the encoding buffer slowly increases. On the other hand, when switching from a region with higher image encoding difficulty to a region with lower encoding difficulty, the fill level of the encoding buffer slowly decreases; for example, in the region where the line graph on the left transitions to the blank area on its right, the fill level of the encoding buffer slowly decreases.

[0068] Figure 6 To provide a method for bitrate control based on the present invention Figure 4 A schematic diagram illustrating the change in quantization step size during the encoding process. Figure 5 Similarly, the x-axis and y-axis represent Figure 4 The image shown contains the coordinates of each pixel, in units of one pixel. Figure 6 Medium brightness represents the quantization step size value corresponding to each pixel. Figure 6 The white part with higher fill intensity in the left part corresponds to Figure 4 The line drawing in the middle left section. Figure 6 The middle part of the white with higher fill level corresponds to Figure 4 The paragraph composed of the letter 'c' Figure 6 The white area with higher fillability on the right side corresponds to Figure 4The text refers to paragraphs containing the letter 'x'. It's understood that encoding positions with lines and letters is more difficult than blank areas, thus requiring a larger quantization step size to balance encoding quality and efficiency. Because the pixels in positions with significant letter variations differ greatly from those in positions with minor variations, encoding positions with significant letter variations is more difficult than those with minor variations, requiring a larger quantization step size to balance encoding quality and efficiency.

[0069] Therefore, combining Figure 4 ,from Figure 6 It can be seen that, on the one hand, when switching from a region with lower image coding difficulty to a region with higher coding difficulty, the quantization step size of the encoding buffer increases slowly; for example, in the fourth row of the white area with higher fill on the right, the quantization step size increases slowly in the area transitioning from multiple repeated letters 'x' to combinations of different numbers and letters. On the other hand, when switching from a region with higher image coding difficulty to a region with lower coding difficulty, the quantization step size decreases slowly; for example, in the area transitioning from the line graph on the left to the blank area on its right, the quantization step size decreases slowly.

[0070] In addition, combined Figure 5 and Figure 6 It can also be seen that the quantization step size increases significantly with the increase of the fill factor of the encoding buffer, and decreases significantly with the decrease of the fill factor of the encoding buffer. Therefore, compared with linear mapping, when the encoding difficulty of the image to be encoded increases, it can buffer the fluctuation of the fill factor of the encoding buffer to alleviate the buffer state. It can achieve the following when the encoding difficulty of the image to be encoded increases: if the fill factor of the buffer is low, the decrease in quantization step size is relatively large compared with the decrease in the fill factor of the buffer, which can make full use of the buffer to buffer the bitstream and improve the image quality; or if the fill factor of the buffer is high, the increase in quantization step size is relatively large compared with the increase in the fill factor of the buffer, which can improve the encoding efficiency and prevent the screen stuttering caused by insufficient buffer buffer.

[0071] The bitrate control apparatus provided by the present invention will be described below. The bitrate control apparatus described below can be referred to in correspondence with the bitrate control method described above.

[0072] Figure 7 This is a schematic diagram of the bitrate control device provided by the present invention, as shown below. Figure 7 As shown, the bitrate control apparatus provided in this embodiment of the invention includes:

[0073] The acquisition module 710 is used to acquire the first actual fullness of the encoding buffer at the current moment;

[0074] The first determining module 720 is used to determine the quantization step size by performing an exponential mapping on the first actual fullness; the base of the exponential function in the target relation of the exponential mapping is a number greater than 1.

[0075] The second determining module 730 is used to determine the quantization parameters of the current coding unit based on the quantization step size.

[0076] The bitrate control device provided by this invention determines the quantization step size by performing an exponential mapping on the first actual fill degree. Furthermore, by ensuring that the base of the exponential function in the target relation of the exponential mapping is greater than 1, the exponential function in the target relation is a monotonically increasing exponential function. Therefore, when the encoding difficulty of the image to be encoded increases and the fill degree of the buffer is small, the quantization step size decreases exponentially compared to the fill degree of the encoding buffer. This results in a larger decrease in the quantization step size compared to linear mapping, leading to smaller quantization parameter values ​​obtained subsequently based on the quantization step size, finer quantization, higher image quality, and a longer bitstream. Thus, it can fully utilize the encoding buffer to buffer the bitstream even when the encoding difficulty of the image to be encoded increases and the fill degree of the encoding buffer is small. Similarly, when the encoding difficulty of the image to be encoded increases and the fill factor of the encoding buffer is large, the quantization step size increases exponentially compared to the fill factor of the encoding buffer. This results in a larger increase in the quantization step size compared to a linear mapping, leading to larger quantization parameter values ​​obtained based on the quantization step size, coarser quantization, and shorter bitstream. This allows for an appropriate reduction in bitstream when the encoding difficulty of the image to be encoded increases and the fill factor of the encoding buffer is large, preventing screen stuttering caused by insufficient encoding buffer.

[0077] In one embodiment, the first determining module 720 includes:

[0078] The acquisition unit is used to acquire the values ​​of the preset target fullness and the preset penalty coefficient of the encoding buffer; the value of the preset penalty coefficient is used to determine the correlation between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness; the number of encoding bits to be allocated is negatively correlated with the actual fullness and positively correlated with the preset target fullness;

[0079] The first determining unit is used to determine the target relationship of the exponential mapping based on the preset target fullness and the value of the preset penalty coefficient;

[0080] The second determining unit is used to determine the quantization step size based on the first actual fullness and the target relationship of the exponential mapping.

[0081] In one embodiment, the first determining unit includes:

[0082] The third determining unit is used to determine a first relationship between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness, based on the preset target fullness and the value of the preset penalty coefficient.

[0083] The fourth determining unit is used to determine a third relation between the quantization step size and the actual fullness of the encoding buffer based on the first relation and the preset second relation, and to determine the third relation as the target relation of the exponential mapping; the preset second relation is used to represent the relationship between the number of encoding bits to be allocated and the quantization step size.

[0084] In one embodiment, the first relation is: R = recover_ratio * (Fa - Ft), where R is the number of coded bits to be allocated; recover_ratio is a preset penalty coefficient, which is negative; Ft is a preset target fullness; Fa represents the actual fullness of the coded buffer after linear mapping, and the fourth relation corresponding to Fa is F. a =scale*(F+offset); where F is the actual fullness of the encoding buffer, scale is a preset linear change coefficient, and offset is a preset bias; the second relation is: R = -alog(qstep)+b, where a and b are preset coefficients obtained based on statistics, and both a and b are positive numbers; the third relation is: Where qstep represents the quantization step size. Let A = e be the exponential function in the objective relation of the exponential mapping. (-recover _ ratio / a) B = e ((b+recover_ratio*Ft) / a) .

[0085] In one embodiment, the second determining unit includes:

[0086] The first processing unit is used to take the first actual fullness as the actual fullness F of the encoding buffer, substitute it into the fourth relation, and obtain the second actual fullness after linear mapping.

[0087] The second processing unit is used to take the second actual fill degree as the actual fill degree Fa of the linearly mapped encoding buffer, substitute it into the third relation, and determine the quantization step size.

[0088] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8As shown, the electronic device may include a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a rate control method, which includes: obtaining the first actual fill degree of the encoding buffer at the current time; determining the quantization step size by performing an exponential mapping on the first actual fill degree; wherein the base of the exponential function in the target relation of the exponential mapping is a number greater than 1; and determining the quantization parameters of the current encoding unit based on the quantization step size.

[0089] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0090] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the bitrate control method provided by the present invention, the method comprising: obtaining a first actual fill degree of the encoding buffer at the current time; determining a quantization step size by performing an exponential mapping on the first actual fill degree; wherein the base of the exponential function in the target relation of the exponential mapping is a number greater than 1; and determining the quantization parameters of the current encoding unit based on the quantization step size.

[0091] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a rate control method provided by the present invention, the method comprising: obtaining a first actual fill degree of an encoding buffer at a current time; determining a quantization step size by performing an exponential mapping on the first actual fill degree; wherein the base of the exponential function in the target relation of the exponential mapping is a number greater than 1; and determining the quantization parameters of the current encoding unit based on the quantization step size.

[0092] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0093] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0094] It is understood that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for bitrate control, characterized in that, include: Get the first actual fullness of the encoding buffer at the current moment; The quantization step size is determined by exponentially mapping the first actual fullness. The base of the exponential function in the target relation of the exponential mapping is a number greater than 1; The quantization parameters of the current coding unit are determined based on the quantization step size; The quantization step size is determined by performing an exponential mapping on the first actual fullness, including: Obtain the values ​​of the preset target fullness and the preset penalty coefficient of the encoding buffer; the preset penalty coefficient is used to determine the correlation between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness; the number of encoding bits to be allocated is negatively correlated with the actual fullness, and the number of encoding bits to be allocated is positively correlated with the preset target fullness; Based on the preset target fullness and the preset penalty coefficient, the target relationship of the exponential mapping is determined; Based on the target relationship between the first actual fullness and the index mapping, the quantization step size is determined; The step of determining the target relationship of the exponential mapping based on the preset target fullness and the preset penalty coefficient includes: Based on the preset target fullness and the preset penalty coefficient, a first relationship is determined between the number of encoding bits to be allocated, the actual fullness of the encoding buffer, and the preset target fullness. Based on the first relation and the preset second relation, a third relation is determined between the quantization step size and the actual fullness of the encoding buffer, and the third relation is determined as the target relation for the exponential mapping; the preset second relation is used to represent the relationship between the number of encoding bits to be allocated and the quantization step size; the first relation is: Where R is the number of encoded bits to be allocated; recover_ratio is the preset penalty coefficient, which is negative; Ft is the preset target fullness; Fa represents the actual fullness of the encoded buffer after linear mapping, and the fourth relation corresponding to Fa is... ;in, The actual fullness of the encoding buffer, The preset linear variation coefficient, This is the preset bias; The second relation is: R = -alog(qstep) + b, where a and b are preset coefficients obtained based on statistics, and both a and b are positive numbers; The third relation is: ;in, Indicates the quantization step size. Let A = e be the exponential function in the objective relation of the exponential mapping. (-recover_ratio / a) , .

2. The bitrate control method according to claim 1, characterized in that, The determination of the quantization step size based on the target relationship between the first actual fullness and the index mapping includes: Substituting the first actual fullness as the actual fullness F of the encoding buffer into the fourth relation, we obtain the second actual fullness after linear mapping. The second actual fill factor is used as the actual fill factor Fa of the linearly mapped encoding buffer. This is then substituted into the third relational expression to determine the quantization step size.

3. A bit rate control device, characterized in that, include: The acquisition module is used to obtain the first actual fullness of the encoding buffer at the current moment; The first determining module is used to determine the quantization step size by performing an exponential mapping on the first actual fullness. The base of the exponential function in the target relation of the exponential mapping is a number greater than 1; The second determining module is used to determine the quantization parameters of the current coding unit based on the quantization step size; The first determining module includes: The acquisition unit is used to acquire the values ​​of the preset target fullness and the preset penalty coefficient of the encoding buffer; the value of the preset penalty coefficient is used to determine the correlation between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness; the number of encoding bits to be allocated is negatively correlated with the actual fullness and positively correlated with the preset target fullness; The first determining unit is used to determine the target relationship of the exponential mapping based on the preset target fullness and the value of the preset penalty coefficient; The second determining unit is used to determine the quantization step size based on the first actual fullness and the target relationship of the exponential mapping; The first determining unit includes: The third determining unit is used to determine a first relationship between the number of encoding bits to be allocated and the actual fullness of the encoding buffer and the preset target fullness, based on the preset target fullness and the value of the preset penalty coefficient. The fourth determining unit is used to determine a third relation between the quantization step size and the actual fullness of the encoding buffer based on the first relation and the preset second relation, and to determine the third relation as the target relation of the exponential mapping; the preset second relation is used to represent the relationship between the number of encoding bits to be allocated and the quantization step size; The first relation is: Where R is the number of encoded bits to be allocated; recover_ratio is the preset penalty coefficient, which is negative; Ft is the preset target fullness; Fa represents the actual fullness of the encoded buffer after linear mapping, and the fourth relation corresponding to Fa is... ;in, The actual fullness of the encoding buffer, The preset linear variation coefficient, The first is a preset bias; the second relation is: R = -alog(qstep) + b, where a and b are preset coefficients obtained based on statistics, and both a and b are positive numbers; the third relation is: ;in, Indicates the quantization step size. Let A = e be the exponential function in the objective relation of the exponential mapping. (-recover_ratio / a) , .

4. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the rate control method as described in any one of claims 1 to 2.

5. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the rate control method as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Moving picture coding apparatus

    JP2007116655A