Method and device for controlling video compression bit rate

By classifying the video encoding block complexity, calculating the number of lossless coded bits and target coded bits, and determining the quantization parameters using the code rate control model, the problem of unstable encoding buffer bit rate control in the prior art is solved, and higher quality video encoding is achieved.

CN115174907BActive Publication Date: 2025-05-02PEKING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210687517.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-17
Publication Date
2025-05-02
Estimated Expiration
2042-06-17

AI Technical Summary

Technical Problem

When existing video light compression standards realize data compression, it is difficult to effectively control the code rate of the encoding buffer, resulting in possible overflow or underflow, affecting the quality of the encoded image.

Method used

By determining its category based on the complexity of the target coded block sample, the number of lossless coded bits is obtained, the number of target coded bits is calculated, and the quantization parameters are determined using the code rate control model, and the number of lossless coded bits is updated to achieve stable control of the code rate.

Benefits of technology

It effectively avoids overflow and underflow of the encoding buffer, improves the quality of the encoded image, and ensures the stability of the code rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115174907B_ABST
    Figure CN115174907B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for video compression bit rate control, the method comprising: determining the category of the target coding block based on the complexity of the target coding block sample; obtaining the number of lossless coding bits of the target coding block according to the category of the target coding block; determining the target coding bit number of the target coding block based on the number of lossless coding bits of the target coding block; determining the quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and the rate control model; updating the number of lossless coding bits corresponding to the category of the target coding block based on the actual number of coding bits and the quantization parameter of the target coding block. Based on this, a method for bit rate control is provided, which can ensure that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the coded image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of video processing technology, and in particular to a method and device for controlling video compression bit rate. Background Art

[0002] With the increasing popularity of image and video applications, video light compression technology is also constantly iterating and innovating. Common video light compression standards such as display stream compression (DSC) standard, VESA display compression-M (VDC-M) standard, Apple ProRes codec and JPEG-XS standard are widely used in display interface fields such as High Definition Multimedia Interface (HDMI) and (display port, DP) and image and video production fields.

[0003] The main purpose of general video light compression standards is to achieve 4 to 16 times data compression under the conditions of low latency, low complexity and subjective losslessness. Taking the more common DSC coding standard as an example, the light compression coding framework mainly includes modules such as input and output, cache segmentation, prediction, quantization, reconstruction, entropy coding, bit rate control and bit stream synthesis. Other standards may optionally have transformation and other special tool modules.

[0004] Among them, the bit rate control module is used to make quantization decisions. How to make the quantization decisions to ensure that the coding buffer neither overflows nor underflows, and at the same time make full use of the coding buffer to improve the quality of the encoded image is an important research direction at present. Summary of the invention

[0005] The present invention provides a method and device for video compression bit rate control, which is used to provide a bit rate control method. When implementing bit rate control, it is ensured that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the coded image.

[0006] The present invention provides a method for controlling a video compression bit rate, comprising:

[0007] Determining a category of a target coding block based on the complexity of a sample of the target coding block;

[0008] Acquire the number of lossless coding bits of the target coding block according to the category of the target coding block;

[0009] Determining a target number of coding bits for the target coding block based on the number of lossless coding bits for the target coding block;

[0010] Determining a quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and a rate control model;

[0011] The lossless coding bit number corresponding to the category of the target coding block is updated based on the actual coding bit number and the quantization parameter of the target coding block.

[0012] According to a method for video compression bit rate control provided by the present invention, before determining the category of the target coding block based on the complexity of the target coding block sample, the method further includes:

[0013] The complexity of the target coding block sample is determined based on an average number of binary digits of an absolute value of a difference between the target coding block sample and a sample within a preset distance.

[0014] According to a method for controlling a video compression bit rate provided by the present invention, determining a target number of coding bits of a target coding block based on the number of lossless coding bits of the target coding block comprises:

[0015] According to a preset mapping relationship, an initial target number of coding bits is determined based on the lossless coding bit number and the historical coding overhead;

[0016] A final target number of coding bits is determined based on the initial target number of coding bits, the lossless coding bit number, the historical coding overhead and the fullness of the coding buffer.

[0017] According to a method for controlling a video compression bit rate provided by the present invention, a final target encoding bit number is determined based on the initial target encoding bit number, the lossless encoding bit number, the historical encoding overhead, and the fullness of the encoding buffer, including:

[0018] When the initial target number of coding bits is less than the minimum bit rate, the minimum bit rate is set as the final target number of coding bits; or

[0019] When the initial target number of coding bits is greater than the maximum bit rate, setting the maximum bit rate to the final target number of coding bits;

[0020] The minimum bit rate and the maximum bit rate are determined based on the number of lossless coding bits, the historical coding overhead and the fullness of the coding buffer.

[0021] According to a method for controlling a video compression bit rate provided by the present invention, the preset mapping relationship is:

[0022] target_rate_0 = k*(B–B offset), where target_rate_0 is the initial target coding bit number, k is the proportional coefficient determined based on the historical coding overhead, B is the lossless coding bit number, and B offset For bias.

[0023] According to a method for controlling a video compression bit rate provided by the present invention, the expression of the proportional coefficient k is:

[0024] k = bpp / (B avg –B offset ), where bpp is the pixel depth, B avg is the average number of coded bits, B avg =0.99*B avg +0.01*B real , where B real Determined based on actual encoding overhead.

[0025] According to a method for video compression bit rate control provided by the present invention, the bit rate control model expression is:

[0026]

[0027] The quantization step size of channel i is determined based on the quantization parameter of channel i, and B is the number of lossless coding bits.

[0028] The present invention also provides a device for controlling video compression bit rate, comprising:

[0029] A first determination module is used to determine the category of the target coding block based on the complexity of the target coding block sample; an acquisition module is used to obtain the number of lossless coding bits of the target coding block according to the category of the target coding block; a second determination module is used to determine the target number of coding bits of the target coding block based on the number of lossless coding bits of the target coding block; a third determination module is used to determine the quantization parameter of the target coding block based on the target number of coding bits, the number of lossless coding bits and a rate control model; an updating module is used to update the number of lossless coding bits corresponding to the category of the target coding block based on the actual number of coding bits and the quantization parameter of the target coding block.

[0030] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for controlling the video compression bit rate are implemented.

[0031] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for controlling the video compression bit rate are implemented.

[0032] The method and device for video compression rate control provided by the present invention classify the coding blocks according to the complexity of the coding blocks, so that the corresponding lossless coding bit numbers can be used for the coding blocks of different complexities, laying a foundation for calculating the quantization parameter according to the lossless coding bit number. And the target coding bit number is calculated according to the lossless coding bit number, and on this basis, the quantization parameter is jointly determined according to the rate control model, thereby providing a rate control method, which can ensure that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the coded image. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 It is a schematic diagram of the framework of the video compression method of the prior art;

[0035] Figure 2 This is one of the flow charts of the method for controlling the video compression bit rate provided by the present invention;

[0036] Figure 3 This is a second flow chart of the method for controlling the video compression bit rate provided by the present invention;

[0037] Figure 4 It is a structural schematic diagram of a device for controlling video compression bit rate provided by the present invention;

[0038] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] In order to facilitate understanding, the technical terms involved in the present invention are first explained.

[0041] Bit rate control: Bit rate control technology is a very important technical module in actual video encoders. According to the different specific application scenarios in practice, such as real-time or offline encoding, traditional broadcasting and television services, or streaming media transmission services on the Internet, there are many different specific requirements and restrictions on the output bit rate of the video encoder, such as average or maximum target bit rate, buffer size, initial delay, etc. Bit rate control is to control the quantization parameter (QP) of each frame or each coding unit for various application business scenarios, so that the output encoded video bit rate meets the specific restriction requirements, and the coding performance, including coding efficiency and subjective quality, is also optimized as much as possible.

[0042] Bit rate: Bit rate is the number of data bits transmitted per unit time during data transmission, and the unit is kilobits per second (kbps).

[0043] Combine the following Figure 1-Figure 5 The present invention describes a method and device for controlling the video compression bit rate.

[0044] For ease of understanding, Figure 1 An application example of the method for controlling the video compression bit rate of the present invention is given as an example. Taking the DSC coding standard as an example, Figure 1 As shown, the light compression coding framework mainly includes modules such as input, cache segmentation, flatness measurement, prediction, quantization, reconstruction, entropy coding, rate control, bit stream synthesis, coding buffer and output. Among them, the rate control module can output quantization parameters to the flatness measurement module, and the entropy coding module can feed back the number of coding bits to the rate control module. The method of video compression rate control of the present invention can be mainly applied to the rate control module in the above light compression coding framework.

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

[0046] Figure 2 This is a flow chart of a method for controlling the video compression bit rate provided by the present invention. Figure 2 As shown, the method 200 may include steps 210 to 250. Steps 210 to 250 in the method 200 are described in detail below. It should be understood that the method 200 can be applied to the field of video compression and can be executed by a bit rate control device. The method 200 includes:

[0047] Step 210: Determine the category of the target coding block based on the complexity of the target coding block samples.

[0048] The target coding block is a coding block of a video frame to be compressed in video compression; the complexity of the target coding block sample can be understood as a measure of another coding block sample at a specific distance from the target coding block sample relative to the target coding block sample.

[0049] It is understandable that, since the complexity of each coding block sample may be different, different numbers of lossless coding bits may be set for coding blocks of different complexities during rate control. Specifically, the complexity of the coding blocks is distinguished by the category of the target coding block.

[0050] Step 220: Obtain the number of lossless coding bits of the target coding block according to the category of the target coding block.

[0051] It can be understood that different categories and the number of lossless coding bits corresponding to each category are pre-stored. Therefore, after the category of the target coding block is determined, the number of lossless coding bits of the target coding block can be obtained according to the category of the target coding block.

[0052] The number of lossless coding bits is the number of bits that can be completely restored after the coding block is compressed. The initial value of the number of lossless coding bits can be set according to expert experience.

[0053] Step 230: determine a target number of coding bits of the target coding block based on the number of lossless coding bits of the target coding block.

[0054] The target number of coding bits is the number of bits expected to be achieved after compressing the target coding block.

[0055] Step 240: Determine a quantization parameter of a target coding block based on the target coding bit number, the lossless coding bit number, and a rate control model.

[0056] Among them, the rate control model is used to control the quantization parameters of the target coding block so that the encoded video bit rate meets various specific restrictions. At the same time, the coding performance, such as coding efficiency and subjective quality of the encoded image, is also optimized as much as possible.

[0057] A possible expression of the rate control model is:

[0058]

[0059] Among them, the quantization step size of channel i is determined based on the quantization parameter of channel i, and B is the number of lossless coding bits. It should be noted that when different quantization methods are adopted, the relationship between the corresponding quantization step size and the quantization parameter is different. Therefore, the relationship between the quantization step size and the quantization parameter is not limited here. In specific applications, the relationship between the corresponding quantization step size and the quantization parameter can be substituted according to different quantization methods. It can be understood that in lossless coding, all quantization step sizes are 1. At this time, the total number of coding bits is equal to the parameter B in the above formula, so B corresponds to the number of lossless coding bits when the quantization step size is 1.

[0060] It can also be understood that based on the expression of the above-mentioned rate control model, when the target coding bit number and the lossless coding bit number are determined, the target coding bit number can be substituted into the above-mentioned rate control model as the total coding bit number to determine the quantization step size, thereby further determining the quantization parameter.

[0061] Step 250: Update the lossless coding bit number corresponding to the category of the target coding block based on the actual coding bit number and the quantization parameter of the target coding block.

[0062] The update formula of the lossless coding bit number of the target coding block can be: B = 0.75*B + 0.25*B real Among them, B real The rate control model is obtained based on the actual coding overhead determination and the actual number of coding bits and quantization parameters of the target coding block.

[0063] It can be understood that after determining the quantization parameters of the target coding block, the bit rate control device can transmit the quantization parameters of the target coding block to the quantization module, and the quantization module quantizes the target coding block, and reconstructs and encodes the quantized target coding block. After encoding, the actual number of coding bits of the target coding block can be determined.

[0064] It can also be understood that in order to better estimate the quantization parameters of other coding blocks of the encoded video frame, the number of lossless coding bits corresponding to the category of the target coding block can be updated according to the actual number of coding bits and the quantization parameter of the target coding block, laying a foundation for calculating the quantization parameters of other coding blocks. Among them, the specific quantization and encoding processes can refer to the prior art, and the present invention will not be described in detail.

[0065] The method for video compression bit rate control provided by the present invention classifies the coding blocks according to their complexity, so that the corresponding lossless coding bit numbers can be used for coding blocks of different complexity, laying a foundation for calculating the quantization parameter according to the lossless coding bit number. And the target coding bit number is calculated according to the lossless coding bit number, and on this basis, the quantization parameter is jointly determined according to the bit rate control model, thereby providing a method for bit rate control, which can ensure that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the coded image.

[0066] Based on the above embodiment, in this embodiment, before determining the category of the target coding block based on the complexity of the target coding block sample, the method further includes:

[0067] The complexity of the target coding block sample is determined based on the average number of binary digits of the absolute value of the difference between the target coding block sample and the sample within a preset distance.

[0068] It can be understood that since the complexity of the target coding block sample can be determined based on a specific measurement of another coding block sample at a specific distance from the target coding block sample, there are multiple specific measurement methods, and there are also multiple corresponding methods for calculating the complexity of the target coding block sample. This embodiment only schematically provides a method for calculating the complexity of the target coding block sample, and other methods can also be used to calculate the complexity of the sample, and the present invention is not limited to this.

[0069] Based on any of the above embodiments, in this embodiment, the target number of coding bits of the target coding block is determined based on the number of lossless coding bits of the target coding block, such as Figure 3 As shown, the following steps are included:

[0070] Step 310: According to a preset mapping relationship, an initial target number of coding bits is determined based on the number of lossless coding bits and the historical coding overhead.

[0071] Preferably, the preset mapping relationship is: target_rate_0 = k*(B – B offset ), where target_rate_0 is the initial target coding bit number, k is the proportional coefficient determined based on the historical coding overhead, B is the lossless coding bit number, and B offset is the bias. Among them, B offset It is related to the image format and the pre-set pixel depth (bits per pixel, bpp), and can be removed. The pixel depth can be set according to the image quality requirements of the video frame to be encoded and the fullness of the encoding buffer.

[0072] The historical coding overhead can be obtained based on the average complexity of the coding block before the target coding block, or based on the fullness of the coding buffer. In the case where the historical coding overhead is obtained based on the average complexity of the coding block before the target coding block, the expression of k can be: k = bpp / (B avg –B offset ), where bpp is the pixel depth, B avg is the average number of coded bits, which can be calculated as:

[0073] B avg =0.99*B avg +0.01*B real , among which, among which, B avg The average number of lossless coded bits of other coded blocks before the target coded block can be B real Based on the actual coding overhead, B real It is the value corresponding to the parameter B obtained by cyclically iterating the above-mentioned rate control model based on the actual coding overhead and quantization step size of the coding block before the target coding block.

[0074] It can be understood that the present invention only exemplarily provides a possible expression of k, and k may also be expressed in other ways, which is not limited in the present invention.

[0075] It can also be understood that the present invention only schematically provides a possible expression form of the preset mapping relationship, and the preset mapping relationship may also be other non-linear relationships, which is not limited in the present invention.

[0076] Step 320, determining a final target number of coding bits based on the initial target number of coding bits, the number of lossless coding bits, the historical coding overhead, and the fullness of the coding buffer.

[0077] The fullness of the encoding buffer is the current fullness of the encoding buffer.

[0078] It can be understood that since the target number of coding bits is ultimately used to determine the quantization parameters of the target coding block, thereby achieving the effect of bit rate control, the target number of coding bits can be optimized and updated based on the initial target number of coding bits, the number of lossless coding bits, the historical coding overhead and the fullness of the coding buffer.

[0079] The method for video compression bit rate control provided by the present invention obtains an initial target coding bit number by calculating the lossless coding bit number of the target coding block, and optimizes and updates the target coding bit number based on the initial target coding bit number, the lossless coding bit number, the historical coding overhead and the fullness of the coding buffer, thereby laying a foundation for calculating the quantization parameter according to the lossless coding bit number, adding corresponding restriction conditions for bit rate control, so that when the bit rate control is performed based on the final quantization parameter, it can be ensured that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the encoded image.

[0080] Based on any of the above embodiments, in this embodiment, based on the initial target number of coding bits, the number of lossless coding bits, the historical coding overhead and the fullness of the coding buffer, determining the final target number of coding bits includes:

[0081] When the initial target number of coding bits is less than the minimum bit rate, the minimum bit rate is set to the final target number of coding bits; or

[0082] When the initial target number of coding bits is greater than the maximum bit rate, the maximum bit rate is set to the final target number of coding bits;

[0083] The minimum bit rate and the maximum bit rate are determined based on the number of lossless coding bits, historical coding overhead, and the fullness of the coding buffer.

[0084] Specifically, the above content can be expressed using the formula: The update formula of the target coding bit number can be: target_rate = CLIP (target_rate_0, min_rate, max_rate). Among them, min_rate is the minimum bit rate; max_rate is the maximum bit rate; CLIP function represents a clamping operation, that is, when the initial target coding bit number target_rate_0 is between min_rate and max_rate, the target coding bit number target_rate is the initial target coding bit number target_rate_0; when the initial target coding bit number is less than the minimum bit rate, min_rate is set to the final target coding bit number, and when the initial target coding bit number is greater than the maximum bit rate, the max_rate is set to the final target coding bit number.

[0085] It can be understood that, according to the actual application situation, when the fullness of the coding buffer is low or the complexity of the target coding block is low, the target coding bit number can be appropriately increased. Conversely, when the fullness of the coding buffer is high or the complexity of the target coding block is high, the target coding bit number can be appropriately reduced. Thus, when quantization is performed based on the quantization parameter determined based on the target coding bit number, it is more conducive to ensuring that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the encoded image.

[0086] Among them, a possible expression of the initial minimum bit rate min_rate_0 is:

[0087] min_rate_0=max((1.5-10*fullness)*bpp, k1*B), k1=0.9*bpp / B max ,

[0088] Here, fullness is the fullness of the encoding buffer.

[0089] Among them, the 1.5-10*fullness item takes effect when the encoding buffer is full at a low level, and sets it as the initial minimum bit rate; the k1*B item takes effect when the block encoding complexity is low, in order to ensure the lowest encoding quality. max is the maximum number of lossless coding bits.

[0090] Furthermore, the minimum bit rate can be updated as follows: min_rate=max(min_rate_0, bpp-3*(B max -B) -k2*(fullness-0.85)) is used to provide a maximum quantization parameter limit related to the fullness of the coding buffer.

[0091] In addition, a possible expression of the maximum bit rate is:

[0092] max_rate=max(bpp+bpp_offset, min_rate);

[0093] Where bpp_offset = min(bpp_offset_0, k4*fullness+b-3*(B max -B));

[0094] Among them, bpp_offset_0=min(max_bppoffset,k3*(0.85-fullness));

[0095] Among them, max_bppoffset is the preset maximum bit rate, and the k3*(0.85-fullness) item takes effect when the encoding buffer is full at a high level, with the purpose of controlling the maximum fullness to be around 0.85.

[0096] bpp_offset is equivalent to adding a minimum quantization parameter limit associated with a lower code buffer fullness.

[0097] The method for controlling the video compression bit rate provided by the present invention clamps the target coding bit number, that is, when the fullness of the coding buffer is low or the complexity of the target coding block is low, the target coding bit number is appropriately increased; when the fullness of the coding buffer is high or the complexity of the target coding block is high, the target coding bit number can be appropriately reduced. Thus, when the quantization parameter determined based on the target coding bit number is quantized, it is more conducive to ensuring that the coding buffer does not overflow or underflow, and at the same time, the coding buffer is used as much as possible to improve the quality of the coded image.

[0098] The video compression bit rate control device provided by the present invention is described below. The video compression bit rate control device described below and the video compression bit rate control method described above can be referred to each other.

[0099] Figure 4 Schematic diagram of the video compression bit rate control device provided by the present invention, such as Figure 4 As shown, the video compression bit rate control device provided by the embodiment of the present invention includes:

[0100] A first determination module 410, configured to determine a category of a target coding block based on the complexity of a sample of the target coding block;

[0101] An acquisition module 420, configured to acquire the number of lossless coding bits of a target coding block according to the category of the target coding block;

[0102] A second determination module 430, configured to determine a target number of coding bits of a target coding block based on the number of lossless coding bits of the target coding block;

[0103] A third determination module 440, configured to determine a quantization parameter of a target coding block based on a target coding bit number, a lossless coding bit number, and a rate control model;

[0104] The updating module 450 is configured to update the number of lossless coding bits corresponding to the category of the target coding block based on the actual number of coding bits and the quantization parameter of the target coding block.

[0105] The apparatus for video compression bit rate control provided by the present invention classifies the coding blocks according to their complexity, so that the corresponding lossless coding bit numbers can be used for coding blocks of different complexity, laying a foundation for calculating the quantization parameter according to the lossless coding bit number. And the target coding bit number is calculated according to the lossless coding bit number, and on this basis, the quantization parameter is jointly determined according to the bit rate control model, thereby providing a method for bit rate control, which can ensure that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the coded image.

[0106] Based on any of the above embodiments, in this embodiment, the device further includes:

[0107] The fourth determination module is used to determine the complexity of the target coding block sample based on the average binary digit number of the absolute value of the difference between the target coding block sample and the sample within a preset distance.

[0108] Based on any of the above embodiments, in this embodiment, the second determining module 430 includes:

[0109] A first determining unit, configured to determine an initial target number of coding bits based on a preset mapping relationship, the number of lossless coding bits and a historical coding overhead;

[0110] The second determining unit is used to determine the final target number of coding bits based on the initial target number of coding bits, the lossless coding bit number, the historical coding overhead and the fullness of the coding buffer.

[0111] The device for video compression bit rate control provided by the present invention obtains an initial target coding bit number by calculating the lossless coding bit number of the target coding block, and optimizes and updates the target coding bit number based on the initial target coding bit number, the lossless coding bit number, the historical coding overhead and the fullness of the coding buffer, thereby laying a foundation for calculating the quantization parameter according to the lossless coding bit number, adding corresponding restriction conditions for the bit rate control, so that when the bit rate control is performed based on the quantization parameter finally obtained, it can be ensured that the coding buffer neither overflows nor underflows, and at the same time, the coding buffer is used as much as possible to improve the quality of the encoded image.

[0112] Based on any of the foregoing embodiments, in this embodiment, the second determining unit includes:

[0113] A first setting unit is used to set the minimum bit rate as the final target coding bit number when the initial target coding bit number is less than the minimum bit rate; or

[0114] A second setting unit is used to set the highest bit rate as the final target coding bit number when the initial target coding bit number is greater than the highest bit rate;

[0115] The minimum bit rate and the maximum bit rate are determined based on the number of lossless coding bits, historical coding overhead, and the fullness of the coding buffer.

[0116] Based on any of the above embodiments, in this embodiment, the preset mapping relationship is:

[0117] target_rate_0 = k*(B – B offset ), where target_rate_0 is the initial target coding bit number, k is the proportional coefficient determined based on the historical coding overhead, B is the lossless coding bit number, and B offset For bias.

[0118] Based on any of the above embodiments, in this embodiment, the expression of the proportional coefficient k is:

[0119] k = bpp / (B avg –B offset ), where bpp is the pixel depth, B avg is the average number of coded bits, B avg =0.99*B avg +0.01*B real , where B real Determined based on actual encoding overhead.

[0120] Based on any of the above embodiments, in this embodiment, the rate control model expression is:

[0121]

[0122] The quantization step size of channel i is determined based on the quantization parameter of channel i, and B is the number of lossless coding bits.

[0123] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute a method for video compression rate control, the method comprising: determining the category of the target coding block based on the complexity of the target coding block sample; obtaining the number of lossless coding bits of the target coding block according to the category of the target coding block; determining the target coding bit number of the target coding block based on the number of lossless coding bits of the target coding block; determining the quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and the rate control model; updating the number of lossless coding bits corresponding to the category of the target coding block based on the actual number of coding bits and the quantization parameter of the target coding block.

[0124] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, etc. Various media that can store program codes.

[0125] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the video compression bit rate control method provided by the present invention, the method including: determining the category of the target coding block based on the complexity of the target coding block sample; obtaining the lossless coding bit number of the target coding block according to the category of the target coding block; determining the target coding bit number of the target coding block based on the lossless coding bit number of the target coding block; determining the quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and the rate control model; and updating the lossless coding bit number corresponding to the category of the target coding block based on the actual coding bit number and the quantization parameter of the target coding block.

[0126] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the method for video compression rate control provided by the present invention, the method comprising: determining the category of the target coding block based on the complexity of the target coding block sample; obtaining the number of lossless coding bits of the target coding block according to the category of the target coding block; determining the target number of coding bits of the target coding block based on the number of lossless coding bits of the target coding block; determining the quantization parameter of the target coding block based on the target number of coding bits, the lossless coding bit number and a rate control model; and updating the number of lossless coding bits corresponding to the category of the target coding block based on the actual number of coding bits and the quantization parameter of the target coding block.

[0127] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0129] It can be understood that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for controlling video compression bit rate, characterized in that: include: Determining a category of a target coding block based on the complexity of a sample of the target coding block; Acquire the number of lossless coding bits of the target coding block according to the category of the target coding block; Determining a target number of coding bits for the target coding block based on the number of lossless coding bits for the target coding block; Determining a quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and a rate control model; The lossless coding bit number corresponding to the category of the target coding block is updated based on the actual coding bit number and the quantization parameter of the target coding block.

2. The method for controlling video compression bit rate according to claim 1, characterized in that: Before determining the category of the target coding block based on the complexity of the target coding block sample, the method further includes: The complexity of the target coding block sample is determined based on an average number of binary digits of an absolute value of a difference between the target coding block sample and a sample within a preset distance.

3. The method for controlling video compression bit rate according to claim 1, characterized in that: The determining a target number of coding bits of the target coding block based on the number of lossless coding bits of the target coding block comprises: According to a preset mapping relationship, an initial target number of coding bits is determined based on the lossless coding bit number and the historical coding overhead; A final target number of coding bits is determined based on the initial target number of coding bits, the lossless coding bit number, the historical coding overhead and the fullness of the coding buffer.

4. The method for controlling video compression bit rate according to claim 3, characterized in that: Determining a final target number of coding bits based on the initial target number of coding bits, the lossless coding bit number, the historical coding overhead, and the fullness of the coding buffer includes: When the initial target number of coding bits is less than the minimum bit rate, the minimum bit rate is set as the final target number of coding bits; or When the initial target number of coding bits is greater than the maximum bit rate, setting the maximum bit rate to the final target number of coding bits; The minimum bit rate and the maximum bit rate are determined based on the number of lossless coding bits, the historical coding overhead and the fullness of the coding buffer.

5. The method for controlling video compression bit rate according to claim 3, characterized in that: The preset mapping relationship is: target_rate_0=k*(BB offset ), where target_rate_0 is the initial target coding bit number, k is the proportional coefficient determined based on the historical coding overhead, B is the lossless coding bit number, and B offset For bias.

6. The method for controlling video compression bit rate according to claim 5, characterized in that: The expression of the proportionality coefficient k is: k = bpp / (B avg -B offset ), where bpp is the pixel depth, B avg is the average number of coded bits, B avg =0.99*B avg +0.01*B real , where B real Determined based on actual encoding overhead.

7. The method for controlling the video compression bit rate according to any one of claims 1 to 6, characterized in that: The rate control model expression is: Wherein, the quantization step size of channel i is determined based on the quantization parameter of channel i, and B is the number of lossless coding bits; Among them, all quantization steps are 1 in lossless coding, and the total number of coding bits is equal to the parameter B in the above formula; or, based on the expression of the above rate control model, when the target number of coding bits and the number of lossless coding bits are determined, the target number of coding bits is used as the total number of coding bits.

8. A device for controlling video compression bit rate, characterized in that: include: A first determination module, configured to determine a category of a target coding block based on the complexity of a sample of the target coding block; An acquisition module, configured to acquire the number of lossless coding bits of the target coding block according to the category of the target coding block; A second determining module, configured to determine a target number of coding bits of the target coding block based on the number of lossless coding bits of the target coding block; A third determination module, configured to determine a quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and a rate control model; An updating module is used to update the number of lossless coding bits corresponding to the category of the target coding block based on the actual number of coding bits and a quantization parameter of the target coding block.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for controlling the video compression bit rate as described in any one of claims 1 to 7 are implemented.

10. 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, the steps of the method for controlling the video compression bit rate as claimed in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Rate control method for intra-frame coding

    CN104038769A

  • Code rate control method based on H.264 video compression standard

    CN106937112A