CN115174907A - Method and device for controlling video compression code rate - Google Patents

Method and device for controlling video compression code rate Download PDF

Info

Publication number
CN115174907A
CN115174907A CN202210687517.7A CN202210687517A CN115174907A CN 115174907 A CN115174907 A CN 115174907A CN 202210687517 A CN202210687517 A CN 202210687517A CN 115174907 A CN115174907 A CN 115174907A
Authority
CN
China
Prior art keywords
bit number
coding
target
target coding
coding block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210687517.7A
Other languages
Chinese (zh)
Inventor
高文
宋泽田
任荟文
王苫社
马思伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Original Assignee
Peking University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University filed Critical Peking University
Priority to CN202210687517.7A priority Critical patent/CN115174907A/en
Publication of CN115174907A publication Critical patent/CN115174907A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/14Coding unit complexity, e.g. amount of activity or edge presence estimation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention provides a method and a device for controlling video compression code rate, wherein the method comprises the following steps: determining a category of a target coding block based on the complexity of a target coding block sample; acquiring the lossless coding bit number of the target coding block according to the type of the target coding block; determining a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block; determining quantization parameters of the target coding block based on the target coding bit number, the lossless coding bit number and a code 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. Based on the above, a method for controlling the code rate is provided, which can ensure that the coding buffer does not overflow or underflow, and improve the quality of the coded image by using the coding buffer as much as possible.

Description

Method and device for controlling video compression code rate
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a method and an apparatus for controlling a video compression rate.
Background
With the continuous popularization of image and video applications, the video light compression technology is also continuously iterated and innovated. Common video soft compression standards such as the Display Stream Compression (DSC) standard, VESA display stream compression-M (VDC-M) standard, apple ProRes codec, JPEG-XS standard, and the like are widely used in the display Interface field such as High Definition Multimedia Interface (HDMI), display port, DP, and the like, and the production field such as video and the like.
The general video light compression standard mainly aims to realize 4-16 times of data compression under the conditions of meeting low delay, low complexity and subjective lossless. Taking a relatively universal DSC coding standard as an example, the light compression coding frame mainly includes modules such as input/output, cache fragmentation, prediction, quantization, reconstruction, entropy coding, code rate control, and code stream synthesis, and other modules with special tools and conversion optionally exist in other standards.
The code rate control module is used for making a quantization decision, how to make the quantization decision ensure that the coding buffer does not overflow or underflow, and meanwhile, the improvement of the quality of a coded image by using the coding buffer as much as possible is an important research direction at present.
Disclosure of Invention
The invention provides a method and a device for controlling video compression code rate, which are used for providing a code rate control method, ensuring that a coding buffer does not overflow or underflow when the code rate control is realized, and simultaneously improving the quality of a coded image by utilizing the coding buffer as much as possible.
The invention provides a method for controlling video compression code rate, which comprises the following steps:
determining a category of a target coding block based on complexity of a target coding block sample;
acquiring the lossless coding bit number of the target coding block according to the category of the target coding block;
determining a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block;
determining quantization parameters of the target coding block based on the target coding bit number, the lossless coding bit number and a code 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.
According to the method for controlling the video compression code rate provided by the invention, before the determining the category of the target coding block based on the complexity of the target coding block sample, the method further comprises the following steps:
and determining the complexity of the target coding block sample based on the average binary digit number of the difference absolute value of the target coding block sample and the sample in the preset distance.
According to a method for controlling video compression rate provided by the present invention, the determining a target coding bit number of a target coding block based on a lossless coding bit number of the target coding block comprises:
determining an initial target coding bit number based on the lossless coding bit number and the historical coding cost according to a preset mapping relation;
and determining the final target coding bit number based on the initial target coding bit number, the lossless coding bit number, the historical coding overhead and the filling degree of a coding buffer.
According to the method for controlling the video compression code rate provided by the invention, the final target coding bit number is determined based on the initial target coding bit number, the lossless coding bit number, the historical coding cost and the filling degree of a coding buffer, and the method comprises the following steps:
setting the lowest code rate as a final target coding bit number under the condition that the initial target coding bit number is smaller than the lowest code rate; or the like, or, alternatively,
setting the highest code rate as a final target coding bit number under the condition that the initial target coding bit number is greater than the highest code rate;
wherein the lowest code rate and the highest code rate are determined based on the number of lossless coding bits, the historical coding overhead, and the fullness of a coding buffer.
According to the method for controlling the video compression code rate provided by the invention, the preset mapping relation is as follows:
target_rate_0=k*(B–B offset ) Wherein, target _ rate _0 is an initial target coding bit number, k is a proportionality coefficient determined based on historical coding overhead, B is a lossless coding bit number, and B is a target coding bit number offset Is an offset.
According to the method for controlling the video compression code rate provided by the invention, the expression of the proportionality coefficient k is as follows:
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 Wherein B is real Based on the actual coding overhead determination.
According to the method for controlling the video compression code rate provided by the invention, the code rate control model expression is as follows:
Figure BDA0003700203270000031
and B is the number of lossless coding bits.
The invention also provides a device for controlling the video compression code rate, which comprises:
a first determining module, configured to determine a category of a target coding block based on a complexity of a target coding block sample; the acquisition module is used for acquiring the lossless coding bit number of the target coding block according to the category of the target coding block; a second determining module, configured to determine a target coding bit number of the target coding block based on a lossless coding bit number of the target coding block; a third determining 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 code rate control model; and the updating module is used for 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.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of the method for controlling the video compression code rate.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method for video compression rate control as described in any of the above.
According to the method and the device for controlling the video compression code rate, the coding blocks are classified according to the complexity of the coding blocks, so that the corresponding lossless coding bit number can be used for the coding blocks with different complexities, and a foundation is laid 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 the basis, the quantization parameters are jointly determined according to the code rate control model, so that a code rate control method is provided, the coding buffer can be ensured not to overflow or underflow, and meanwhile, the coding buffer is utilized to improve the quality of the coded image as much as possible.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a block diagram of a prior art video compression method;
FIG. 2 is a flowchart illustrating a method for controlling a video compression rate according to the present invention;
FIG. 3 is a second flowchart illustrating a method for rate control of video compression according to the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for controlling video compression rate according to the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For the sake of easy understanding, the technical terms related to the present invention are first explained.
Code rate control: the rate control technology is a very important technical module in a practical video encoder. According to different practical application scenarios, for example: real-time or off-line coding, traditional broadcast television service, streaming media transmission service on the internet, etc., there are various specific requirements and limitations on the output code rate of a video encoder, such as: average or maximum target code rate, buffer size, initial delay, etc. The rate control is to control the Quantization Parameter (QP) of each frame or each coding unit for different application service scenarios, so that the output coded video rate meets each specific constraint requirement, and the coding performance, including coding efficiency and subjective quality, is optimized as much as possible.
Code rate: the code rate is the number of data bits transmitted per unit time during data transmission, and the unit is kilobits per second (kbps).
The method and apparatus for rate control in video compression according to the present invention are described with reference to fig. 1-5.
For ease of understanding, fig. 1 exemplarily shows an application example of the method for controlling the video compression rate according to the present invention. Taking the DSC coding standard as an example, as shown in fig. 1, the light compression coding frame mainly includes modules such as input, buffer slicing, flatness measurement, prediction, quantization, reconstruction, entropy coding, code rate control, code stream synthesis, coding buffer, and output. The video compression code rate control method can be mainly applied to the code rate control module in the light compression coding framework.
It is understood that the present invention can be applied to video compression methods such as VDC-M, apple ProRes, and JPEG-XS, in addition to DSC.
Fig. 2 is a schematic flow chart of a method for controlling video compression rate according to the present invention. As shown in fig. 2, the method 200 may include steps 210 to 250, and the steps 210 to 250 of the method 200 are described in detail below. It should be understood that the method 200 may be applied to the field of video compression, and may be performed by a rate control apparatus, and the method 200 includes:
and step 210, determining the category of the target coding block based on the complexity of the target coding block sample.
The target coding block is a coding block of a video frame to be compressed in video compression; the complexity of a target coded block sample may be understood as the measure of another coded block sample at a certain distance from the target coded block sample relative to the target coded block sample.
It can be understood that, since the complexity of each coded block sample may be different, when performing rate control, different lossless coding bit numbers may be set for coded blocks with different complexities. Specifically, the complexity of the coding blocks is distinguished by the class of the target coding block.
And step 220, acquiring the lossless coding bit number of the target coding block according to the type of the target coding block.
It can be understood that the different categories and the number of lossless coding bits corresponding to each category are pre-stored, and 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.
The number of lossless coding bits is the number of bits that the coding block can be completely restored after compression. The initial value of the number of lossless coding bits can be set according to expert experience.
Step 230, determining the target coding bit number of the target coding block based on the lossless coding bit number of the target coding block.
And the target coding bit number is the bit number expected to be reached after the target coding block is compressed.
And 240, determining the quantization parameter of the target coding block based on the target coding bit number, the lossless coding bit number and the code rate control model.
The code rate control model is used for controlling quantization parameters of a target coding block, so that the coded video code rate meets various specific limiting requirements, and meanwhile, the coding performance, such as coding efficiency and subjective quality of a coded image, is optimized as much as possible.
One possible expression of the rate control model is:
Figure BDA0003700203270000071
the quantization step size of the channel i is determined based on the quantization parameter of the channel i, and B is the lossless coding bit number. It should be noted that, when different quantization methods are used, the corresponding quantization step and quantization parameter have different relationships, and thus, the relationship between the quantization step and the quantization parameter is not limited here. In a specific application, the corresponding relation between the quantization step and the quantization parameter can be substituted according to different quantization modes. It can be understood that all quantization steps are 1 in lossless coding, and the total coding bit number is equal to the parameter B in the above equation, so B corresponds to the lossless coding bit number when the quantization step is 1.
It can also be understood that, based on the expression of the rate control model, when the target coding bit number and the lossless coding bit number are determined, the target coding bit number can be taken as the total coding bit number and brought into the rate control model, so that the quantization step can be determined, and the quantization parameter can be further determined.
And step 250, 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.
The formula for updating the lossless coding bit number of the target coding block may be: b =0.75 + B +0.25 + B real (ii) a Wherein, B real And determining based on the actual coding overhead, and substituting the actual coding bit number and the quantization parameter of the target coding block to obtain the code rate control model.
It can be understood that, after the quantization parameter of the target coding block is determined, the code rate control device may transmit the quantization parameter of the target coding block to the quantization module, the quantization module quantizes the target coding block, and performs processes such as reconstruction and encoding on the quantized target coding block, and the actual number of coded bits of the target coding block can be determined after encoding.
It can also be understood that, in order to better estimate the quantization parameters of other coding blocks of the video frame to be coded, the lossless coding bit number corresponding to the category of the target coding block may be updated according to the actual coding bit number and the quantization parameter of the target coding block, so as to lay a foundation for calculating the quantization parameters of other coding blocks. The specific processes such as quantization and coding can refer to the prior art, and the present invention is not described in detail herein.
The method for controlling the video compression code rate classifies the coding blocks according to the complexity of the coding blocks, so that the corresponding lossless coding bit number can be used for the coding blocks with different complexities, and a foundation is laid 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 the basis, the quantization parameters are jointly determined according to the code rate control model, so that a code rate control method is provided, the coding buffer can be ensured not to overflow or underflow, and meanwhile, the coding buffer is utilized to improve the quality of the coded image as much as possible.
Based on the foregoing embodiments, in this embodiment, before determining the class of the target coding block based on the complexity of the target coding block sample, the method further includes:
and determining the complexity of the target coding block sample based on the average binary digit number of the difference absolute value of the target coding block sample and the sample in the preset distance.
It can be understood that, since the complexity of a target coding block sample may be determined based on a certain specific metric of another coding block sample at a specific distance from the target coding block sample, there are various specific metrics, and there are also various methods for calculating the complexity of the corresponding target coding block sample, but this embodiment only schematically provides a method for calculating the complexity of the target coding block sample, and may also adopt other methods to calculate the complexity of the sample, which is not limited in this invention.
Based on any of the above embodiments, in this embodiment, determining the target encoding bit number of the target encoding block based on the lossless encoding bit number of the target encoding block includes the following steps, as shown in fig. 3:
step 310, according to a preset mapping relationship, determining an initial target coding bit number based on the lossless coding bit number and the historical coding cost.
Preferably, the preset mapping relationship is: target _ rate _0= k [ (B-B) ] offset ) Wherein, target _ rate _0 is an initial target coding bit number, k is a proportionality coefficient determined based on historical coding cost, B is a lossless coding bit number, and B is a residual coding bit number offset Is an offset. Wherein, B offset Related to the image format and the preset pixel depth (bpp), can be removed. The pixel depth can be set according to the image quality requirement of the video frame to be encoded and the fullness degree of the encoding buffer.
The historical encoding overhead can be obtained based on the average complexity of the encoding blocks before the target encoding block, and also can be obtained based on the fullness degree of the encoding buffer. In the case that the historical coding overhead is obtained based on the average complexity of the coding blocks before the target coding block, the expression of k may be: k = bpp/(B avg –B offset ) (ii) a Where bpp is the pixel depth, B avg For the average number of coded bits, the calculation formula may be:
B avg =0.99*B avg +0.01*B real wherein, B avg The average lossless coding bit number of other coding blocks before the target coding block can be B real Based on the actual coding overhead determination, B real The value corresponding to the parameter B is obtained by cyclic iteration according to the code rate control model based on the actual coding cost and the quantization step size of the coding block before the target coding block.
It should be understood that the present invention only shows one possible expression of k by way of example, and k may also be other expressions, which are not limited by the present invention.
It should be further understood that the present invention only schematically provides one possible expression form of the preset mapping relationship, and the preset mapping relationship may also be other non-linear relationships, which is not limited by the present invention.
Step 320, determining the final target coding bit number based on the initial target coding bit number, the lossless coding bit number, the historical coding cost and the filling degree of the coding buffer.
Wherein, the fullness degree of the coding buffer is the current fullness degree of the coding buffer.
It can be understood that, since the target coding bit number is finally used to determine the quantization parameter of the target coding block, thereby achieving the effect of rate control, the target coding bit number can be optimally updated based on the initial target coding bit number, the lossless coding bit number, the historical coding overhead and the fullness degree of the coding buffer.
The method for controlling the video compression code rate calculates the initial target coding bit number according to the lossless coding bit number of the target coding block, 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 filling degree of the coding buffer, thereby laying a foundation for calculating the quantization parameter according to the lossless coding bit number, and increasing corresponding limiting conditions for code rate control, so that when the code rate control is carried out based on the finally obtained quantization parameter, the coding buffer can be ensured not to overflow or underflow, and the quality of a coded image can be improved by utilizing the coding buffer as much as possible.
Based on any of the foregoing embodiments, in this embodiment, determining a final target encoding bit number based on the initial target encoding bit number, the lossless encoding bit number, the historical encoding overhead, and the fullness degree of the encoding buffer includes:
setting the lowest code rate as the final target coding bit number under the condition that the initial target coding bit number is smaller than the lowest code rate; or the like, or, alternatively,
setting the highest code rate as the final target coding bit number under the condition that the initial target coding bit number is greater than the highest code rate;
the lowest code rate and the highest code rate are determined based on the number of lossless coding bits, historical coding cost and the filling degree of a coding buffer.
Specifically, the above content usage formula can be expressed as: the update formula of the target encoding bit number may be: target _ rate = CLIP (target _ rate _0, min _rate, max _rate). Wherein, min _ rate is the lowest code rate; max _ rate is the highest code rate; the CLIP function represents a clamping operation, i.e., 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; and when the initial target coding bit number is smaller than the lowest code rate, setting min _ rate as the final target coding bit number, and when the initial target coding bit number is larger than the highest code rate, setting max _ rate as the final target coding bit number.
It can be understood that, according to the actual application, the target encoding bit number can be appropriately increased under the condition that the fullness degree of the encoding buffer is low or the complexity of the target encoding block is low. Conversely, when the fullness of the encoding buffer is high or the complexity of the target encoding block is high, the target encoding bit number can be appropriately reduced. Therefore, when quantization is carried out on the quantization parameter determined based on the target coding bit number, the method is more beneficial to ensuring that the coding buffer does not overflow or underflow, and simultaneously, the quality of the coded image is improved by utilizing the coding buffer as much as possible.
One possible expression of the initial lowest code rate min _ rate _0 is as follows:
min_rate_0=max((1.5-10*fullness)*bpp,k1*B),k1=0.9*bpp/B max
wherein, fullness is the fullness of the encoding buffer.
Wherein, the 1.5-10 full items take effect when the fullness of the coding buffer is lower, and the items are set as the initial lowest code rate; the k1 × B term is effective when the block coding complexity is low, in order to guarantee a minimum coding quality. B is max Is the maximum number of lossless coding bits.
Further, the lowest code rate can be updated as follows: min _ rate = max (min _ rate _0, bpp-3 (B) max -B) -k2 × (fullness-0.85)), for providing the highest quantization parameter limit related to the fullness of the coding buffer.
Furthermore, one possible expression of the highest code rate is:
max_rate=max(bpp+bpp_offset,min_rate);
wherein bpp _ offset = min (bpp _ offset _0, k4 full + B-3 (B) max -B));
Wherein bpp _ offset _0= min (max _ bpoffset, k3 × (0.85-fullness));
wherein max _ bppoffset is the preset highest code rate, and the k3 (0.85-fullness) item takes effect when the fullness of the coding buffer is higher, so as to control the highest fullness to be near 0.85.
bpp _ offset is equivalent to adding a minimum quantization parameter limit associated with a lower fullness of the encoding buffer.
The method for controlling the video compression code rate provided by the invention properly improves the target coding bit number by carrying out clamping operation on the target coding bit number, namely under the condition that the filling degree of a coding buffer is lower or the complexity of a target coding block is lower; when the fullness degree of the coding buffer is high or the complexity of the target coding block is high, the target coding bit number can be reduced appropriately. Therefore, when quantization is carried out on the quantization parameter determined based on the target coding bit number, the method is more favorable for ensuring that the coding buffer does not overflow or underflow, and simultaneously, the coding buffer is utilized as much as possible to improve the quality of the coded image.
The video compression rate control device provided by the present invention is described below, and the video compression rate control device described below and the video compression rate control method described above may be referred to in correspondence with each other.
Fig. 4 is a schematic diagram of a video compression rate control apparatus provided in the present invention, and as shown in fig. 4, the video compression rate control apparatus provided in the embodiment of the present invention includes:
a first determining module 410, configured to determine a class of a target coding block based on a complexity of a target coding block sample;
an obtaining module 420, configured to obtain the lossless coding bit number of the target coding block according to the type of the target coding block;
a second determining module 430, configured to determine a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block;
a third determining module 440, configured to determine a 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 an updating module 450, configured to update the lossless coding bit number corresponding to the category of the target coding block based on the actual coding bit number of the target coding block and the quantization parameter.
The video compression code rate control device provided by the invention classifies the coding blocks according to the complexity of the coding blocks, so that the corresponding lossless coding bit number can be used for the coding blocks with different complexities, and a foundation is laid 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 the basis, the quantization parameters are jointly determined according to the code rate control model, so that a code rate control method is provided, the coding buffer can be ensured not to overflow or underflow, and meanwhile, the coding buffer is utilized to improve the quality of the coded image as much as possible.
Based on any one of the above embodiments, in this embodiment, the apparatus further includes:
and the fourth determining module is used for determining the complexity of the target coding block sample based on the average binary digit number of the difference absolute value of the target coding block sample and the sample in the preset distance.
Based on any one of the foregoing embodiments, in this embodiment, the second determining module 430 includes:
the first determining unit is used for determining an initial target coding bit number based on the lossless coding bit number and the historical coding cost according to a preset mapping relation;
and the second determining unit is used for determining the final target coding bit number based on the initial target coding bit number, the lossless coding bit number, the historical coding overhead and the filling degree of the coding buffer.
The device for controlling the video compression code rate calculates the initial target coding bit number according to the lossless coding bit number of the target coding block, and optimally 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 filling degree of the coding buffer, thereby laying a foundation for calculating the quantization parameter according to the lossless coding bit number, and increasing corresponding limiting conditions for code rate control, so that when the code rate control is carried out based on the finally obtained quantization parameter, the coding buffer can be ensured not to overflow or underflow, and the quality of a coded image can be improved by utilizing the coding buffer as much as possible.
Based on any one of the foregoing embodiments, in this embodiment, the second determining unit includes:
the first setting unit is used for setting the lowest code rate as the final target coding bit number under the condition that the initial target coding bit number is smaller than the lowest code rate; or the like, or a combination thereof,
a second setting unit, configured to set the highest code rate as a final target coding bit number when the initial target coding bit number is greater than the highest code rate;
the lowest code rate and the highest code rate are determined based on the number of lossless coding bits, historical coding cost and the filling degree of a coding buffer.
Based on any of the above embodiments, in this embodiment, the preset mapping relationship is:
target_rate_0=k*(B–B offset ) Wherein, target _ rate _0 is an initial target coding bit number, k is a proportionality coefficient determined based on historical coding cost, B is a lossless coding bit number, and B is a residual coding bit number offset Is an offset.
Based on any one of the embodiments, in this embodiment, the expression of the scaling factor 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 Wherein, B real Based on the actual coding overhead determination.
Based on any of the above embodiments, in this embodiment, the code rate control model expression is:
Figure BDA0003700203270000141
and B is the number of lossless coding bits.
Fig. 5 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 5: a processor (processor) 510, a communication interface (communication interface) 520, a memory (memory) 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform a method for video compression rate control, the method comprising: determining a category of a target coding block based on the complexity of a target coding block sample; acquiring the lossless coding bit number of the target coding block according to the category of the target coding block; determining a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block; determining quantization parameters of the target coding block based on the target coding bit number, the lossless coding bit number and a code 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.
Furthermore, the logic instructions in the memory 530 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform a method for video compression rate control as provided by the present invention, the method comprising: determining a category of a target coding block based on complexity of a target coding block sample; acquiring the lossless coding bit number of the target coding block according to the category of the target coding block; determining a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block; determining quantization parameters of the target coding block based on the target coding bit number, the lossless coding bit number and a code 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.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a method for performing video compression rate control provided by the present invention, the method comprising: determining a category of a target coding block based on the complexity of a target coding block sample; acquiring the lossless coding bit number of the target coding block according to the type of the target coding block; determining a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block; determining quantization parameters of the target coding block based on the target coding bit number, the lossless coding bit number and a code 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.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
It should be understood that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit the same; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for rate control in video compression, comprising:
determining a category of a target coding block based on complexity of a target coding block sample;
acquiring the lossless coding bit number of the target coding block according to the category of the target coding block;
determining a target coding bit number of the target coding block based on the lossless coding bit number of the target coding block;
determining quantization parameters of the target coding block based on the target coding bit number, the lossless coding bit number and a code 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.
2. The method of video compression rate control of claim 1, wherein the determining the class of the target coding block based on the complexity of the target coding block sample further comprises:
and determining the complexity of the target coding block sample based on the average binary digit number of the difference absolute value of the target coding block sample and the sample in the preset distance.
3. The method of claim 1, wherein the determining the target number of coding bits for the target coding block based on the lossless number of coding bits for the target coding block comprises:
determining an initial target coding bit number based on the lossless coding bit number and the historical coding overhead according to a preset mapping relation;
and determining the final target coding bit number based on the initial target coding bit number, the lossless coding bit number, the historical coding overhead and the filling degree of a coding buffer.
4. The method of claim 3, wherein determining a final target number of coding bits based on the initial target number of coding bits, the lossless number of coding bits, the historical coding overhead, and a fullness level of a coding buffer comprises:
setting the lowest code rate as a final target coding bit number under the condition that the initial target coding bit number is smaller than the lowest code rate; or the like, or a combination thereof,
setting the highest code rate as a final target coding bit number under the condition that the initial target coding bit number is greater than the highest code rate;
wherein the lowest code rate and the highest code rate are determined based on the number of lossless coding bits, the historical coding overhead, and the fullness of a coding buffer.
5. The method of claim 3, wherein the predetermined mapping relationship is:
target_rate_0=k*(B–B offset ) Wherein, target _ rate _0 is an initial target coding bit number, k is a proportionality coefficient determined based on historical coding overhead, B is a lossless coding bit number, and B is a target coding bit number offset Is an offset.
6. The method of claim 5, wherein the scaling factor k is expressed as:
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 Wherein, B real Based on the actual coding overhead.
7. The method of video compression rate control according to any of claims 1 to 6, wherein the rate control model expression is:
Figure FDA0003700203260000021
and B is the number of lossless coding bits.
8. An apparatus for rate control in video compression, comprising:
a first determining module, configured to determine a category of a target coding block based on a complexity of a target coding block sample;
the acquisition module is used for acquiring the lossless coding bit number of the target coding block according to the category of the target coding block;
a second determining module, configured to determine a target coding bit number of the target coding block based on a lossless coding bit number of the target coding block;
a third determining 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 code rate control model;
and the updating module is used for 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.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of the method for video compression rate control according to any of claims 1 to 7.
10. A non-transitory computer-readable storage medium, having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the method for video compression rate control according to any of claims 1 to 7.
CN202210687517.7A 2022-06-17 2022-06-17 Method and device for controlling video compression code rate Pending CN115174907A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210687517.7A CN115174907A (en) 2022-06-17 2022-06-17 Method and device for controlling video compression code rate

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210687517.7A CN115174907A (en) 2022-06-17 2022-06-17 Method and device for controlling video compression code rate

Publications (1)

Publication Number Publication Date
CN115174907A true CN115174907A (en) 2022-10-11

Family

ID=83486333

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210687517.7A Pending CN115174907A (en) 2022-06-17 2022-06-17 Method and device for controlling video compression code rate

Country Status (1)

Country Link
CN (1) CN115174907A (en)

Similar Documents

Publication Publication Date Title
US11727548B2 (en) Method and apparatus for encoding and decoding HDR images
CN105379269B (en) The Video coding of interest region perception
KR100484148B1 (en) Advanced method for rate control and apparatus thereof
CN108063944B (en) Perception code rate control method based on visual saliency
US20150172680A1 (en) Producing an Output Need Parameter for an Encoder
CN110225343B (en) Code rate control method and device for video coding
CN111741300B (en) Video processing method
EP1209625A2 (en) Picture coding apparatus and method
EP3545677A1 (en) Methods and apparatuses for encoding and decoding video based on perceptual metric classification
CN103501438B (en) A kind of content-adaptive method for compressing image based on principal component analysis
CN114051139B (en) Video coding method and device
US20230050250A1 (en) Method and apparatus for encoding video, and storage medium
CN114900692A (en) Video stream frame rate adjusting method and device, equipment, medium and product thereof
CN110365981B (en) Video coding method and device, electronic equipment and storage medium
CN111416978B (en) Video encoding and decoding method and system, and computer readable storage medium
CN107820084B (en) Video perception coding method and device
CN112437301A (en) Code rate control method and device for visual analysis, storage medium and terminal
CN115174907A (en) Method and device for controlling video compression code rate
CN107205151B (en) Coding and decoding device and method based on mixed distortion measurement criterion
JP2004040811A (en) Method and apparatus for controlling amount of dct computation performed to encode motion image
CN111163320A (en) Video compression method and system
CN1917646A (en) Method of controlling rate of video compression code based on query table in low memory consumption
CN114374841A (en) Optimization method and device for video coding rate control and electronic equipment
CN102811349A (en) No-feedback multi-description distributed video coder-decoder capable of adjusting redundancy automatically
US8971393B2 (en) Encoder

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination