Quantization parameter determination method and related product
By adjusting the weight factor of the video frame and evenly distributing the code rate between coding blocks, the problem of low compression efficiency caused by the difference in texture complexity of the video frame coding sub-blocks is solved, and the compression efficiency and video quality of video coding are improved.
Patent Information
- Application Number
- CN202410600872.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-23
AI Technical Summary
In video coding, the difference in texture complexity of coding sub-blocks of video frames leads to a reduction in video coding compression efficiency, which in turn affects video quality.
By adjusting the weight factor of the video frame, coding sub-blocks with higher texture complexity are allocated more bit rates, achieving balanced allocation of bit rates between coding blocks, thereby improving the compression efficiency of video coding.
By distributing bit rates more evenly, the compression efficiency of video encoding is improved and the quality of video frames and videos is guaranteed.
Smart Images

Figure CN118540477A
Abstract
Description
Technical Field
[0001] The present application relates to the field of video encoding technology, and in particular to a quantization parameter determination method and related products. Background Art
[0002] In video coding technology, the compression efficiency of video coding is an important parameter affecting the quality of video frames and videos. If the compression efficiency of video coding decreases while other influencing parameters remain stable, the quality of video frames and videos will decrease. Therefore, in order to ensure that video frames and videos have high quality, it is necessary to encode the video with the required compression efficiency of video coding. However, encoding the video when there are differences in the texture complexity of the coding sub-blocks of the video frame can easily lead to low compression efficiency of video coding. Summary of the invention
[0003] Based on this, it is necessary to provide a quantization parameter determination method and related products that can improve the compression efficiency of video coding when there are differences in the texture complexity of the coding sub-blocks of the video frame in order to solve the above technical problems. The related products include a quantization parameter determination device, a computer device, a computer-readable storage medium and a computer program product.
[0004] In a first aspect, the present application provides a method for determining a quantization parameter, where the quantization parameter is used to characterize the degree of quantization refinement in a video encoding process; the method comprises:
[0005] Acquire a video frame, wherein the video frame includes a coding block, and the coding block includes a coding sub-block;
[0006] In the case where there are at least two coding sub-blocks with different texture complexities in the video frame, reducing a weight factor of the video frame, the weight factor being used to determine a quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, the quantization parameter offset being proportional to both the weight factor and the texture complexity;
[0007] According to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs is determined, and the quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0008] In the case where the texture complexity of the coding sub-blocks of the video frame is different, the quantization parameter offset of the coding sub-block is jointly determined by a preset weight factor and the texture complexity of the coding sub-block. Then, according to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs is determined. Among them, the quantization parameter offset is proportional to the weight factor and the texture complexity; the quantization parameter of the coding block to which it belongs is proportional to the quantization parameter offset of the coding sub-block. Based on this, the quantization parameter offset of the coding sub-block with higher texture complexity is large, the quantization parameter of the coding block to which the coding sub-block with higher texture complexity belongs is large, and the code rate allocated to the coding block to which the coding sub-block with higher texture complexity belongs is small. The quantization parameter offset of the coding sub-block with lower texture complexity is small, the quantization parameter of the coding block to which the coding sub-block with lower texture complexity belongs is small, and the code rate allocated to the coding block to which the coding sub-block with lower texture complexity belongs is large. That is, the code rate allocated to the coding block of the video frame is unbalanced. The uneven distribution of bit rates to coding blocks of video frames may easily lead to low compression efficiency of video coding.
[0009] According to the quantization parameter determination method provided in the first aspect, there are at least two coding sub-blocks with different texture complexities in the video frame, indicating that there are differences in the texture complexity of the coding sub-blocks of the video frame. In this case, the weight factor of the video frame is reduced on the basis of the preset weight factor, so that the weight factor of the video frame is less than the preset weight factor. By using a smaller weight factor, the reduction amount of the quantization parameter offset of the coding sub-block with lower texture complexity of the video frame is less than the reduction amount of the quantization parameter offset of the coding sub-block with higher texture complexity. Furthermore, according to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs is determined, and when the quantization parameter offset is reduced, the reduction amount of the quantization parameter of the coding block to which the coding sub-block with higher texture complexity belongs is greater. Based on this, it is possible to allocate more code rates to the coding blocks to which the coding sub-blocks with higher texture complexity belong, so as to achieve balanced allocation of code rates to the coding blocks to which the coding sub-blocks with lower texture complexity belong and the coding blocks to which the coding sub-blocks with higher texture complexity belong as much as possible. By allocating code rates to the coding blocks of the video frame in a more balanced manner, the compression efficiency of video coding can be improved.
[0010] In one of the embodiments, when there are at least two coding sub-blocks with different texture complexities in the video frame, reducing the weight factor of the video frame includes:
[0011] When the proportion of the target coding sub-block in the video frame is greater than a preset ratio and less than 1, the weight factor of the video frame is reduced, and the target coding sub-block refers to a coding sub-block whose texture complexity is less than a first complexity threshold or a coding sub-block whose texture complexity is greater than a second complexity threshold, and the first complexity threshold is less than the second complexity threshold.
[0012] In one embodiment, reducing the weight factor of the video frame includes:
[0013] Determine that the weight factor of the video frame is a preset multiple of a preset weight factor, where the preset multiple is a positive multiple less than 1, and when the target coding sub-block refers to a coding sub-block whose texture complexity is less than the first complexity threshold, the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame.
[0014] In one of the embodiments, the first complexity threshold is less than or equal to an average texture complexity of the coding sub-block, and the average texture complexity refers to a first average value of the texture complexity of each of the coding sub-blocks in the video frame.
[0015] In one of the embodiments, when there are at least two coding sub-blocks with different texture complexities in the video frame, before reducing the weight factor of the video frame, the method further includes:
[0016] Determine the texture complexity of the coding sub-block as the sum of a first complexity of a luminance block, a second complexity of a first chrominance block, and a third complexity of a second chrominance block, the coding sub-block comprising the luminance block, the first chrominance block, and the second chrominance block;
[0017] Among them, the first complexity is used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block, the second complexity is used to represent the discrete degree of the first chrominance component value of each pixel in the coding sub-block, and the third complexity is used to represent the discrete degree of the second chrominance component value of each pixel in the coding sub-block.
[0018] In one of the embodiments, before determining that the texture complexity of the coding sub-block is the sum of the first complexity of the luminance block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block, the method further includes:
[0019] respectively determining a second average value of the luminance component value of each pixel point in the coding sub-block, a third average value of the first chrominance component value of each pixel point, and a fourth average value of the second chrominance component value of each pixel point;
[0020] Adding the difference between the brightness component value of each pixel and the second average value to obtain the first complexity of the brightness block;
[0021] Adding a difference between the first chrominance component value of each pixel and the third average value to obtain the second complexity of the first chrominance block;
[0022] The difference between the second chrominance component value of each pixel point and the fourth average value is added to obtain the third complexity of the second chrominance block.
[0023] In one of the embodiments, determining the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block includes:
[0024] Determining a fifth average value of the quantization parameter offsets of the coding sub-blocks belonging to the same coding block;
[0025] The fifth average value is summed with an initial quantization parameter to obtain the quantization parameter of the coding block to which each coding sub-block belongs, and the coding block to which each coding sub-block belongs is the same coding block to which each coding sub-block belongs.
[0026] In a second aspect, the present application further provides a device for determining a quantization parameter, where the quantization parameter is used to characterize the degree of quantization refinement in a video encoding process; the device comprises:
[0027] An acquisition module, used for acquiring a video frame, wherein the video frame includes a coding block, and the coding block includes a coding sub-block;
[0028] an adjustment module, configured to reduce a weight factor of the video frame when at least two coding sub-blocks with different texture complexities exist in the video frame, wherein the weight factor is used to determine a quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, and the quantization parameter offset is proportional to both the weight factor and the texture complexity;
[0029] The first determination module is used to determine the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block, and the quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0030] In one embodiment, the adjustment module is also used to
[0031] When the proportion of the target coding sub-block in the video frame is greater than a preset ratio and less than 1, the weight factor of the video frame is reduced, and the target coding sub-block refers to a coding sub-block whose texture complexity is less than a first complexity threshold or a coding sub-block whose texture complexity is greater than a second complexity threshold, and the first complexity threshold is less than the second complexity threshold.
[0032] In one embodiment, the adjustment module is also used to
[0033] Determine that the weight factor of the video frame is a preset multiple of a preset weight factor, where the preset multiple is a positive multiple less than 1, and when the target coding sub-block refers to a coding sub-block whose texture complexity is less than the first complexity threshold, the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame.
[0034] In one of the embodiments, the first complexity threshold is less than or equal to an average texture complexity of the coding sub-block, and the average texture complexity refers to a first average value of the texture complexity of each of the coding sub-blocks in the video frame.
[0035] In one embodiment, the device further comprises:
[0036] A second determining module, configured to determine that the texture complexity of the coding sub-block is the sum of a first complexity of a luminance block, a second complexity of a first chrominance block, and a third complexity of a second chrominance block, wherein the coding sub-block includes the luminance block, the first chrominance block, and the second chrominance block;
[0037] Among them, the first complexity is used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block, the second complexity is used to represent the discrete degree of the first chrominance component value of each pixel in the coding sub-block, and the third complexity is used to represent the discrete degree of the second chrominance component value of each pixel in the coding sub-block.
[0038] In one embodiment, the second determination module is further configured to:
[0039] respectively determining a second average value of the luminance component value of each pixel point in the coding sub-block, a third average value of the first chrominance component value of each pixel point, and a fourth average value of the second chrominance component value of each pixel point;
[0040] Adding the difference between the brightness component value of each pixel and the second average value to obtain the first complexity of the brightness block;
[0041] Adding a difference between the first chrominance component value of each pixel and the third average value to obtain the second complexity of the first chrominance block;
[0042] The difference between the second chrominance component value of each pixel point and the fourth average value is added to obtain the third complexity of the second chrominance block.
[0043] In one embodiment, the first determining module includes:
[0044] an average value determining unit, configured to determine a fifth average value of the quantization parameter offsets of the coding sub-blocks belonging to the same coding block;
[0045] The quantization parameter determination unit is used to sum the fifth average value and the initial quantization parameter to obtain the quantization parameter of the coding block to which each coding sub-block belongs, and the belonging coding block is the same coding block to which each coding sub-block belongs.
[0046] In a third aspect, the present application further provides a computer device, comprising: a memory and a processor, wherein the memory stores program instructions; when the program instructions are executed by the processor, the processor executes the method shown in the first aspect or any embodiment of the first aspect.
[0047] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium; when the computer program runs on one or more processors, the method shown in the first aspect or any embodiment of the first aspect is executed.
[0048] In a fifth aspect, the present application also provides a computer program product, which includes a computer program or instructions; when the computer program or instructions are run on a computer, the computer is enabled to execute the method shown in the first aspect or any embodiment of the first aspect.
[0049] It can be understood that the quantization parameter determination device provided in the second aspect, the computer device provided in the third aspect, the computer-readable storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the quantization parameter determination method shown in the first aspect of the present application or any embodiment of the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments are introduced as follows.
[0051] Figure 1One of the flowcharts of the method for determining the quantization parameter provided in the embodiment of the present application;
[0052] Figure 2 A second flowchart of a method for determining a quantization parameter provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of a process for determining a quantization parameter of a coding block to which a coding sub-block belongs according to a quantization parameter offset of a coding sub-block provided in an embodiment of the present application;
[0054] Figure 4 The third flowchart of the method for determining the quantization parameter provided in the embodiment of the present application;
[0055] Figure 5 A schematic diagram of the structure of a device for determining a quantization parameter provided in an embodiment of the present application;
[0056] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to facilitate understanding of the embodiments of the present application, the embodiments of the present application will be described more fully below with reference to the relevant drawings. The preferred embodiments of the embodiments of the present application are given in the drawings. However, the embodiments of the present application can be implemented in many different forms and are not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the embodiments of the present application more thorough and comprehensive.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the technical field of the embodiments of the present application. The terms used herein in the description of the embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the embodiments of the present application.
[0059] The terms "first", "second", etc. used herein are used to distinguish different objects rather than to describe a specific order. For the purpose of distinguishing different objects, the "first average value" can also be described as the "second average value", and the "second average value" can be described as the "first average value". When used, the singular expressions "one", "a", "said", "above", "the" and "this" are intended to also include plural expressions, unless the context clearly indicates otherwise. It should also be understood that the term "includes / comprising" specifies the presence of the stated features, wholes, steps, operations, parts or their fusions, but does not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, parts or their fusions.
[0060] The embodiment of the present application provides a method for determining a quantization parameter, where the quantization parameter is used to characterize the degree of quantization refinement during video encoding. The value of the quantization parameter of the coding block of the video frame corresponds to the sequence number of the quantization step. The smaller the quantization parameter, the smaller the quantization step, the higher the degree of quantization refinement during the video encoding process, and the more bitrate is allocated to the coding block of the video frame. When the bitrate is evenly allocated to the coding block of the video frame, the compression efficiency of the video encoding can be improved.
[0061] like Figure 1 As shown, the quantization parameter determination method includes the following steps S101 to S103.
[0062] S101, obtaining a video frame, where the video frame includes a coding block, and the coding block includes a coding sub-block.
[0063] A video frame includes several coding blocks, and the size of the coding block is the quantization parameter adjustment granularity. Video coding is the process of encoding different coding blocks of a video frame separately. The size of a coding block is usually 64x64, 32x32 or 16x16. A coding block includes several coding sub-blocks, and the size of the coding sub-block is less than or equal to the size of the coding block. The size of the coding sub-block is usually 16x16 or 8x8. Exemplarily, if the size of the coding block is 64x64, the size of the coding sub-block can be 16x16; if the size of the coding block is 16x16, the size of the coding sub-block can be 8x8. It can be understood that a video frame includes several coding sub-blocks.
[0064] S102, when there are at least two coding sub-blocks with different texture complexities in the video frame, reduce the weight factor of the video frame. The weight factor is used to determine the quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, and the quantization parameter offset is proportional to the weight factor and the texture complexity.
[0065] Images with repetitive structures, such as cloth patterns, grass, and brick walls, are called texture images. Texture images may show irregularities in local areas, but they show a certain regularity as a whole, and their grayscale distribution often shows a certain periodicity. Usually, this kind of local irregularity and macroscopic regularity in an image is called texture. In this embodiment, the calculation unit of the texture complexity is the coding sub-block, and the texture complexity of the coding sub-block is an important influencing factor of the quantization parameter of the coding block to which the coding sub-block belongs. This embodiment determines the quantization parameter of the coding block based on the texture complexity of the coding sub-block.
[0066] S103, determining the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block. The quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0067] When the texture complexity of the coding sub-blocks of the video frame is different, the quantization parameter offset of the coding sub-block is determined by a preset weight factor and the texture complexity of the coding sub-block. The quantization parameter offset is proportional to the weight factor and the texture complexity. For example, the relationship between the three parameters of the quantization parameter offset, the weight factor and the texture complexity can be expressed by the following formula 1:
[0068] QDQ j =trength×(E j ) p
[0069] Among them, dQP j refers to the quantization parameter offset of the jth coded sub-block of the video frame, strength refers to the weight factor, E j It refers to the texture complexity of the jth coded sub-block of the video frame, and p is a constant.
[0070] Then, according to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs is determined. The quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block. Based on this, the quantization parameter offset of the coding sub-block with higher texture complexity is large, the quantization parameter of the coding block to which the coding sub-block with higher texture complexity belongs is large, and the code rate allocated to the coding block to which the coding sub-block with higher texture complexity belongs is small. The quantization parameter offset of the coding sub-block with lower texture complexity is small, the quantization parameter of the coding block to which the coding sub-block with lower texture complexity belongs is small, and the code rate allocated to the coding block to which the coding sub-block with lower texture complexity belongs is large. For example, assuming that the texture complexity of coding sub-block No. 1 is 2, the texture complexity of coding sub-block No. 2 is 4, the value of p is 1, and the preset weight factor is 0.3. Based on the above formula 1, it can be calculated that the quantization parameter offset of coding sub-block No. 1 is 0.6, and the quantization parameter offset of coding sub-block No. 2 is 1.2. It can be seen that the quantization parameter offset of the coding sub-block No. 2 with higher texture complexity is larger. Since the quantization parameter of the coding block to which it belongs is proportional to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block No. 2 with higher texture complexity belongs is larger. Furthermore, less bit rate is allocated to the coding block to which the coding sub-block No. 2 with higher texture complexity belongs. Based on this, the bit rate allocated to the coding blocks of the video frame is unbalanced. Due to the unbalanced allocation of bit rates to the coding blocks of the video frame, the compression efficiency of the video coding is easily low.
[0071] In this embodiment, there are at least two coding sub-blocks with different texture complexities in the video frame, indicating that there are differences in texture complexities of the coding sub-blocks of the video frame. In this case, the weight factor of the video frame is reduced based on the preset weight factor, so that the weight factor of the video frame is less than the preset weight factor.
[0072] Exemplarily, the preset weight factor is a weight factor set in a common method for determining a quantization parameter offset of a coding sub-block, and this embodiment makes the weight factor of the video frame smaller than the preset weight factor. Exemplarily, the preset weight factor is a weight factor used to determine the quantization parameter offset of the coding sub-block when there is no difference in texture complexity of the coding sub-blocks of the video frame, and makes the weight factor of the video frame smaller than the preset weight factor when there is a difference in texture complexity of the coding sub-blocks of the video frame.
[0073] Furthermore, through a smaller weight factor, the reduction in the quantization parameter offset of the coding sub-block with lower texture complexity of the video frame is smaller than the reduction in the quantization parameter offset of the coding sub-block with higher texture complexity. Still taking the texture complexity of coding sub-block No. 1 as 2, the texture complexity of coding sub-block No. 2 as 4, the value of p as 1, and the preset weight factor as 0.3, the calculation based on the above formula 1 is taken as an example. If the weight factor of the video frame is reduced to 0.2, the calculation based on the above formula 1 can be obtained: the quantization parameter offset of coding sub-block No. 1 is 0.4, and the quantization parameter offset of coding sub-block No. 2 is 0.8. By comparison, it can be seen that the quantization parameter offset of coding sub-block No. 1 is reduced from 0.6 to 0.4, and the reduction is 0.2; the quantization parameter offset of coding sub-block No. 2 is reduced from 1.2 to 0.8, and the reduction is 0.4. That is, the reduction in the quantization parameter offset of coding sub-block No. 2 with higher texture complexity is greater. Furthermore, the quantization parameter of the coding block to which the coding sub-block belongs is determined according to the quantization parameter offset of the coding sub-block. When the quantization parameter offset is reduced, the quantization parameter of the coding block to which the coding sub-block No. 2 with higher texture complexity belongs is reduced more.
[0074] In this embodiment, when there are differences in texture complexity of coding sub-blocks of a video frame, the weight factor of the video frame is reduced to adjust the quantization parameters of different coding blocks of the video frame, so that the quantization parameter of the coding block to which the coding sub-block with higher texture complexity belongs is reduced more. It is possible to allocate more bitrate to the coding block to which the coding sub-block with higher texture complexity belongs, so as to achieve balanced allocation of bitrate to the coding block to which the coding sub-block with lower texture complexity belongs and the coding block to which the coding sub-block with higher texture complexity belongs as much as possible. By allocating bitrate to the coding blocks of the video frame in a more balanced manner, the compression efficiency of the video encoding can be improved.
[0075] In one embodiment, the above step S102, when there are at least two coding sub-blocks with different texture complexities in the video frame, reducing the weight factor of the video frame includes the following steps:
[0076] When the proportion of the target coding sub-block in the video frame is greater than a preset ratio and less than 1, the weight factor of the video frame is reduced, and the target coding sub-block refers to a coding sub-block with a texture complexity less than a first complexity threshold or a coding sub-block with a texture complexity greater than a second complexity threshold, and the first complexity threshold is less than the second complexity threshold.
[0077] Specifically, the target coding sub-block is a coding sub-block with too low texture complexity or a coding sub-block with too high texture complexity in the video frame. In the video frame, if the proportion of the target coding sub-block is greater than the preset ratio and less than 1, it indicates that the difference in texture complexity of the coding sub-blocks in the video frame is large; otherwise, it indicates that the difference in texture complexity of the coding sub-blocks in the video frame is small. In this embodiment, when the difference in texture complexity of the coding sub-blocks in the video frame is large, the weight factor of the video frame is reduced. The quantization parameters of different coding blocks of the video frame are adjusted to achieve a balanced distribution of bit rates to the coding blocks with lower texture complexity and the coding blocks with higher texture complexity as much as possible, thereby improving the compression efficiency of video encoding.
[0078] The preset ratio is a value greater than 0 and less than 1, such as 0.5. When the preset ratio is 0.5, and the proportion of the target coding sub-block in the video frame is greater than 0.5 and less than 1, it indicates that among the coding sub-blocks of the video frame, more than half of the coding sub-blocks have too low texture complexity or more than half of the coding sub-blocks have too high texture complexity, indicating that the difference in texture complexity of the coding sub-blocks in the video frame is large. As discussed in the aforementioned embodiment, when there are differences in the texture complexity of the coding sub-blocks, the allocation of bit rates to the coding blocks of the video frame is uneven, which can easily lead to low compression efficiency of video coding. Through data analysis, it is found that when the difference in texture complexity of the coding sub-blocks of the video frame is large, the degree of influence on the compression efficiency of the video coding is large, which in turn has a greater impact on the quality of the video frame and the video. Based on this, in this embodiment, when the difference in texture complexity of the coding sub-blocks of the video frame is large, the compression efficiency of the video coding is improved to ensure the quality of the video frame and the video.
[0079] It should be understood that when the proportion of the target coding sub-block in the video frame is greater than the preset ratio and less than 1, it can be determined that the difference in texture complexity of the coding sub-blocks of the video frame is large, the compression efficiency of the video coding is highly degraded, and the compression efficiency of the video coding needs to be improved. For this purpose, the value of the preset ratio can be set based on experience.
[0080] Exemplarily, when the proportion of the target coding sub-block in the video frame is less than or equal to a preset ratio, the weight factor of the video frame may be maintained as the preset weight factor.
[0081] Exemplarily, when the target coded block is a coded block with texture complexity less than the first complexity threshold, the number of target coded blocks can be calculated by the following formula:
[0082]
[0083] where, E j refers to the texture complexity of the j-th coded block of the video frame, TLE refers to the first complexity threshold, n refers to the number of coded blocks in the video frame, n is a positive integer, and CLE refers to the number of target coded blocks. When E j < LE, CLE is incremented by 1; otherwise, CLE is incremented by 0.
[0084] Understandably, the proportion of the target coded blocks in the video frame is expressed as CLE / .
[0085] When the target coded block is a coded block with texture complexity greater than the second complexity threshold, the method for calculating the number of target coded blocks and the proportion of the target coded blocks in the video frame is the same. The difference is that: if the texture complexity E j of the j-th coded block is greater than the second complexity threshold, the number of target coded blocks is incremented by 1. The specific calculation process is not elaborated here.
[0086] In this embodiment, according to the proportion of the target coded blocks in the video frame, the difference degree of the texture complexity of the coded blocks of the video frame is determined. When the difference in the texture complexity of the coded blocks of the video frame is large, the weight factor of the video frame is reduced to adjust the quantization parameters of different coded blocks of the video frame, so as to achieve as much as possible an equal distribution of the bit rate to different coded blocks, thereby improving the compression efficiency of video coding and ensuring the quality of the video frame and the video.
[0087] In one of the embodiments, in the above steps: reducing the weight factor of the video frame includes the following steps:
[0088] Determine that the weight factor of the video frame is a preset multiple of the preset weight factor, the preset multiple is a positive multiple less than 1, and when the target coded block is a coded block with texture complexity less than the first complexity threshold, the preset multiple is inversely proportional to the proportion of the target coded blocks in the video frame.
[0089] Among them, the discussion of the preset weight factor in this embodiment can refer to the discussion of the preset weight factor in the foregoing embodiments, and will not be elaborated here.
[0090] When the proportion of the target coding sub-block in the video frame is greater than the preset ratio and less than 1, and the target coding sub-block refers to a coding sub-block whose texture complexity is less than the first complexity threshold, the larger the proportion of the target coding sub-block in the video frame, the greater the difference in texture complexity of the coding sub-blocks of the video frame. The greater the difference, the higher the degree of degradation of the compression efficiency of the video coding. At this time, the smaller the weight factor of the video frame is, the more balanced the bit rate can be allocated to different coding blocks of the video frame, thereby further improving the compression efficiency of the video coding.
[0091] Specifically, the texture complexity of coding sub-block No. 1 is 2, the texture complexity of coding sub-block No. 2 is 4, the value of p is 1, and the preset weight factor is 0.3, and the calculation based on the above formula 1 is taken as an example. If the weight factor of the video frame is reduced to 0.2, it can be calculated based on the above formula 1 that the quantization parameter offset of coding sub-block No. 1 is 0.4, and the quantization parameter offset of coding sub-block No. 2 is 0.8. By comparison, it can be seen that the quantization parameter offset of coding sub-block No. 1 is reduced from 0.6 to 0.4, and the reduction is 0.2; the quantization parameter offset of coding sub-block No. 2 is reduced from 1.2 to 0.8, and the reduction is 0.4. If the weight factor of the video frame is reduced to 0.1, it can be calculated based on the above formula 1 that the quantization parameter offset of coding sub-block No. 1 is 0.2, and the quantization parameter offset of coding sub-block No. 2 is 0.4. By comparison, it can be seen that the quantization parameter offset of coding sub-block No. 1 decreases from 0.6 to 0.2, and the decrease is 0.4; the quantization parameter offset of coding sub-block No. 2 decreases from 1.2 to 0.4, and the decrease is 0.8. It can be concluded that if the weight factor of the video frame is reduced to 0.2, the decrease in the quantization parameter offset of coding sub-block No. 2 is 0.2 more than the decrease in the quantization parameter offset of coding sub-block No. 1; if the weight factor of the video frame is reduced to 0.1, the decrease in the quantization parameter offset of coding sub-block No. 2 is 0.4 more than the decrease in the quantization parameter offset of coding sub-block No. 1. That is, the smaller the weight factor of the video frame, the greater the difference between the decrease in the quantization parameter offset of the coding sub-block with higher texture complexity and the decrease in the quantization parameter offset of the coding sub-block with lower texture complexity. Furthermore, the quantization parameter of the coding block to which the coding sub-block with higher texture complexity belongs can be closer to the quantization parameter of the coding block to which the coding sub-block with lower texture complexity belongs, and the bit rate allocated to different coding blocks of the video frame is more balanced. Based on this, when the proportion of the target coding sub-block in the video frame is larger, the weight factor of the video frame is made smaller, even if the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame, it is possible to achieve a more balanced allocation of bit rates to different coding blocks of the video frame, thereby further improving the compression efficiency of video encoding.
[0092] Referring to the discussion on the number of target coding sub-blocks and the proportion of target coding sub-blocks in the video frame in the aforementioned embodiment, when the target coding sub-block refers to a coding sub-block whose texture complexity is less than the first complexity threshold, the proportion of the target coding sub-block in the video frame is CLE / . Based on this, the relationship between the preset multiple and the proportion of the target coding sub-block in the video frame is inversely proportional, and the weight factor of the video frame is calculated by the following formula 2:
[0093] strength=S×(1.0-CLE / )
[0094] Among them, strength refers to the weight factor of the video frame, S refers to the preset weight factor, and (1.0-CLE / ) refers to the preset multiple.
[0095] Exemplarily, the relationship that the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame can also be expressed by the following formula 3, and then the weight factor of the video frame is calculated by the following formula 3:
[0096] strength=S×(1.0-FLE*(CLE / ))
[0097] Among them, FLE refers to a control parameter, with a value such as 0.5, which is used to adjust the proportion of the target coding sub-block in the video frame to obtain a more appropriate preset multiple and weight factor.
[0098] Substituting the strength in the above formula 2 or formula 3 into formula 1 for calculation, the quantization parameter offset of each coding sub-block of the video frame can be obtained. Compared with making the strength in the public 1 a constant preset weight factor, this embodiment adds the influencing parameters related to the specific content of the video frame, such as the proportion of the target coding sub-block, to achieve the adaptive adjustment of the weight factor of the video frame based on the specific content of the video frame, and optimizes formula 1. On the one hand, the weight factors of different video frames change with the change of the proportion of the target coding sub-block in the video frame, so that the quantization parameters of different coding blocks of the video frame change with the change of the specific content of the video frame, and the adaptive adjustment of the quantization parameters of the coding blocks of the video frame is achieved. On the other hand, based on the specific content of the video frame, by adaptively adjusting the weight factor of the video frame, the adjustment of the quantization parameters and the bit rate of the coding block can be achieved with a more appropriate and accurate weight factor, and the compression efficiency of the video coding can be improved more accurately. The video frame corresponds to the weight factor one by one, which can make the degree of improvement in compression efficiency more in line with the actual situation of the video frame.
[0099] In this embodiment, the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame to determine the weight factor of the video frame, which can achieve a more balanced distribution of bit rates to different coding blocks of the video frame, and thus can improve the compression efficiency of video coding to a greater extent to meet the quality requirements of the video frame and the video. In addition, in this embodiment, the weight factor of the video frame is adaptively adjusted based on the proportion of the target coding sub-block in the video frame, which not only realizes the adaptive adjustment of the quantization parameter of the coding block of the video frame, but also can realize the adjustment of the quantization parameter and the bit rate of the coding block with a more appropriate and accurate weight factor, and more accurately improve the compression efficiency of video coding.
[0100] In one of the embodiments, the first complexity threshold is less than or equal to an average texture complexity of the coding sub-block, where the average texture complexity refers to a first average value of the texture complexities of the coding sub-blocks in the video frame.
[0101] Specifically, when the texture complexity of the coding sub-block is less than the first complexity threshold, the texture complexity of the coding sub-block is considered to be too low. Based on this, the first complexity threshold in any of the aforementioned embodiments may be less than or equal to the first average value of the texture complexity of each coding sub-block in the video frame. That is, when the texture complexity of the coding sub-block is less than the average texture complexity, the texture complexity of the coding sub-block is considered to be too low.
[0102] Exemplarily, the first complexity threshold is less than or equal to the first multiple of the average texture complexity of the coding sub-block, and the first multiple is a positive multiple less than 1. For example, the first multiple is 0.5 times. When the texture complexity of the coding sub-block is smaller than half of the average texture complexity, the texture complexity of the coding sub-block is considered to be too low. In this example, the first complexity threshold is made less than or equal to the first multiple of the average texture complexity of the coding sub-block. When the texture complexity of the coding sub-block is less than the first complexity threshold, it indicates that the difference between the texture complexity of this coding sub-block and the average texture complexity is greater. When the proportion of coding sub-blocks with a texture complexity less than the first complexity threshold is greater than a preset ratio and less than 1, it indicates that a large proportion of the coding sub-blocks in the video frame have a texture complexity that is much smaller than the average texture complexity. Furthermore, it can be shown that the difference in texture complexity of the coding sub-blocks of the video frame is large.
[0103] Exemplarily, the average texture complexity of the coded sub-block can be calculated by the following formula:
[0104]
[0105] Among them, AvgE refers to the average texture complexity of the coded sub-block, E j It refers to the texture complexity of the jth coded sub-block in the video frame, n refers to the number of coded sub-blocks in the video frame, and n is a positive integer.
[0106] Exemplarily, the first complexity threshold in any of the aforementioned embodiments may also be a numerical value such as 10, 20, etc., which indicates the texture complexity of the coding sub-block close to a pure color. In this example, the first complexity threshold is set for the purpose of indicating the numerical value of the texture complexity of the coding sub-block close to a pure color. When the texture complexity of the coding sub-block is smaller than the texture complexity of the coding sub-block close to a pure color, it is considered that the texture complexity of the coding sub-block is too low.
[0107] In this embodiment, the first complexity threshold is made less than or equal to the average texture complexity of the coding sub-block. When the texture complexity of the coding sub-block is less than the first complexity threshold, it is considered that the texture complexity of the coding sub-block is too low, which is conducive to determining the degree of difference in texture complexity of the coding sub-blocks of the video frame.
[0108] In one of the embodiments, in the above step S102, when there are at least two coding sub-blocks with different texture complexities in the video frame, before reducing the weight factor of the video frame, the method for determining the quantization parameter further includes the following steps:
[0109] Determine the texture complexity of the coding sub-block as the sum of the first complexity of the luminance block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block, where the coding sub-block includes the luminance block, the first chrominance block, and the second chrominance block;
[0110] Among them, the first complexity is used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block, the second complexity is used to represent the discrete degree of the first chrominance component value of each pixel in the coding sub-block, and the third complexity is used to represent the discrete degree of the second chrominance component value of each pixel in the coding sub-block.
[0111] Based on YUV color coding, each pixel in the coding sub-block has three component values: Y, U, and V. Among them, the Y component value represents brightness (Luminance or Luma), that is, the grayscale value. In this embodiment, the Y component value is called the brightness component value. The U component value and the V component value represent chrominance (Chrominance or Chroma), which are used to specify the color of the pixel. In this embodiment, the U component value is called the first chrominance component value, and the V component value is called the second chrominance component value. The coding sub-block includes three color blocks corresponding to the three color channels of Y, U, and V. In this embodiment, the Y color block is called the brightness block, the U color block is called the first chrominance block, and the V color block is called the second chrominance block. Based on this, the first complexity calculated by the brightness component value of each pixel in the coding sub-block to represent the discrete degree of the brightness component value is called the first complexity of the brightness block of the coding sub-block; the second complexity calculated by the first chrominance component value of each pixel to represent the discrete degree of the first chrominance component value is called the second complexity of the first chrominance block of the coding sub-block; the third complexity calculated by the second chrominance component value of each pixel to represent the discrete degree of the second chrominance component value is called the third complexity of the second chrominance block of the coding sub-block. The first complexity of the brightness block, the second complexity of the first chrominance block and the third complexity of the second chrominance block in the coding sub-block are summed to obtain the texture complexity of the coding sub-block.
[0112] Exemplarily, the texture complexity of the coding sub-block can be calculated by the following formula:
[0113] E j =E j0 +E j1 +E j2
[0114] Among them, E j It refers to the texture complexity of the jth coded sub-block of the video frame, E j0 、E j1 、E j2 It represents the first complexity of the luminance block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block included in the j-th coding sub-block.
[0115] In this embodiment, the texture complexity of the coding sub-block can be determined based on the sum of the first complexity of the luminance block, the second complexity of the first chrominance block and the third complexity of the second chrominance block included in the coding sub-block.
[0116] In one embodiment, if Figure 2As shown, the quantization parameter determination method further includes the following steps S201 to S208. Among them, steps S201, S207, and S208 correspond to steps S101 to S103 in the aforementioned embodiment. The specific discussion of steps S201, S207, and S208 in this embodiment can refer to the specific discussion of steps S101 to S103 in the aforementioned embodiment, which will not be repeated in this embodiment.
[0117] S201, obtaining a video frame, where the video frame includes a coding block, and the coding block includes a coding sub-block.
[0118] S202, respectively determine a second average value of the luminance component value of each pixel in the coding sub-block, a third average value of the first chrominance component value of each pixel, and a fourth average value of the second chrominance component value of each pixel.
[0119] S203, adding the difference between the brightness component value of each pixel and the second average value to obtain a first complexity of the brightness block. The first complexity is used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block.
[0120] S204, adding the difference between the first chrominance component value of each pixel and the third average value to obtain the second complexity of the first chrominance block. The second complexity is used to represent the discreteness of the first chrominance component value of each pixel in the coding sub-block.
[0121] S205, adding the difference between the second chrominance component value of each pixel and the fourth average value to obtain a third complexity of the second chrominance block. The third complexity is used to represent the discreteness of the second chrominance component value of each pixel in the coding sub-block.
[0122] Specifically, the first complexity, the second complexity, and the third complexity can be calculated by the following formula 4:
[0123]
[0124] Where k refers to the kth pixel in the jth coding sub-block of the video frame, a refers to the number of pixels in the jth coding sub-block, and a is a positive integer. jb For E j0 When x k Refers to the brightness component value of the kth pixel in the jth coding sub-block, It refers to the second average value of the brightness component values of a pixels in the jth coding sub-block; when E jb For E j1 When x x Refers to the first chrominance component value of the kth pixel in the jth coding sub-block, It refers to the third average value of the first chrominance component of a pixels in the jth coding sub-block; when E jb For E j2 When x k Refers to the second chrominance component value of the kth pixel in the jth coding sub-block, It refers to the fourth average value of the second chrominance component values of a pixels in the j-th coding sub-block.
[0125] Based on Formula 4, the first complexity of the luminance block of the coding sub-block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block can be obtained by executing steps S202 to S205. It can be understood that there is no specific order of execution when executing steps S203, S204, and S205.
[0126] S206, determining the texture complexity of the coding sub-block as the sum of the first complexity of the luminance block, the second complexity of the first chrominance block and the third complexity of the second chrominance block. The coding sub-block includes the luminance block, the first chrominance block and the second chrominance block.
[0127] S207, when there are at least two coding sub-blocks with different texture complexities in the video frame, reduce the weight factor of the video frame. The weight factor is used to determine the quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, and the quantization parameter offset is proportional to the weight factor and the texture complexity.
[0128] S208, determining the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block. The quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0129] In this embodiment, the difference between the brightness component value of each pixel of the coding sub-block and the second average value of the brightness component value of each pixel is calculated respectively, and then the differences are summed to obtain the first complexity used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block. The second complexity and the third complexity can be obtained in the same way as in Formula 4. When the first complexity of the brightness block of the coding sub-block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block are obtained, the texture complexity of the coding sub-block can be determined to determine whether the weight factor of the video frame needs to be reduced, and then the quantization parameter of the coding block to which the coding sub-block belongs is determined.
[0130] In one embodiment, if Figure 3 As shown, the above step S103, determining the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block, includes the following steps S301 to S302.
[0131] S301 : Determine a fifth average value of quantization parameter offsets of coding sub-blocks belonging to the same coding block.
[0132] S302: Sum the fifth average value and the initial quantization parameter to obtain the quantization parameter of the coding block to which each coding sub-block belongs. The coding block to which each coding sub-block belongs is the same coding block to which each coding sub-block belongs.
[0133] Specifically, the quantization parameter of the coding block to which the coding sub-block belongs can be determined according to the quantization parameter offset of the coding sub-block by the following formula 5, and the quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block:
[0134]
[0135] Among them, QP i refers to the quantization parameter of the i-th coding block of the video frame, QPslice refers to the initial quantization parameter, dQP t It refers to the quantization parameter offset of the t-th coding sub-block in the ith coding block, m refers to the number of coding sub-blocks in the ith coding block, and m is a positive integer.
[0136] Based on Formula 5, the fifth average value of the quantization parameter offsets of the m coding sub-blocks of the i-th coding block can be obtained by executing step S301. It can be understood that the fifth average value is the quantization parameter offset of the i-th coding block. Then, by executing step S302, the fifth average value is summed with the initial quantization parameter to obtain the quantization parameter of the i-th coding block. Based on this, the quantization parameters of different coding blocks of the video frame can be calculated. Exemplarily, the fifth average value is rounded to the nearest integer.
[0137] Exemplarily, in order to make the quantization parameter of the coding block to which the coding sub-block belongs proportional to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs can also be determined by other means according to the quantization parameter offset of the coding sub-block. For example: determine the fifth average value of the quantization parameter offset of each coding sub-block belonging to the same coding block; calculate the product of the fifth average value and the second multiple, sum the product with the initial quantization parameter, and obtain the quantization parameter of the coding block to which each coding sub-block belongs, and the second multiple is a positive multiple. Among them, the second multiple is used to adjust the fifth average value to obtain a suitable quantization parameter offset of the coding block. By setting the value of the second multiple, the appropriate quantization parameter offset corresponding to each of the different coding blocks is obtained, so as to achieve closer quantization parameters of different coding blocks of the video frame, more balanced bit rates allocated to different coding blocks, and reduce the impact on other performance indicators in the video encoding process, such as the encoding rate. For this purpose, the value of the second multiple can be set based on the changes of other performance indicators in the video encoding process.
[0138] In this embodiment, by determining the fifth average value of the quantization parameter offsets of each coding sub-block belonging to the same coding block, the quantization parameter offset of the same coding block is determined. Then, by summing the fifth average value with the initial quantization parameter, that is, summing the quantization parameter offset of the same coding block with the initial quantization parameter, the quantization parameter of the same coding block can be obtained. Then, the quantization parameters of different coding blocks of the video frame can be obtained. In the case where there are differences in the texture complexity of the coding sub-blocks of the video frame, the quantization parameter offset of the coding sub-block can be adjusted by reducing the weight factor of the video frame. Through the quantization parameter determination method in this embodiment, the quantization parameters of different coding blocks of the video frame can be further adjusted.
[0139] In one embodiment, the quantization parameter is used to characterize the fineness of quantization in the video encoding process, such as Figure 4 As shown, the quantization parameter determination method further includes the following steps S401 to S409.
[0140] S401, obtaining a video frame, where the video frame includes a coding block, and the coding block includes a coding sub-block.
[0141] S402 , respectively determining a second average value of the luminance component value of each pixel in the coding sub-block, a third average value of the first chrominance component value of each pixel, and a fourth average value of the second chrominance component value of each pixel.
[0142] S403, adding the difference between the brightness component value of each pixel and the second average value to obtain the first complexity of the brightness block. The first complexity is used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block.
[0143] S404, adding the difference between the first chrominance component value of each pixel and the third average value to obtain the second complexity of the first chrominance block. The second complexity is used to represent the discreteness of the first chrominance component value of each pixel in the coding sub-block.
[0144] S405, adding the difference between the second chrominance component value of each pixel and the fourth average value to obtain a third complexity of the second chrominance block. The third complexity is used to represent the discreteness of the second chrominance component value of each pixel in the coding sub-block.
[0145] S406, determining the texture complexity of the coding sub-block as the sum of the first complexity of the luminance block, the second complexity of the first chrominance block and the third complexity of the second chrominance block. The coding sub-block includes the luminance block, the first chrominance block and the second chrominance block.
[0146] S407, when the proportion of the target coding sub-block in the video frame is greater than a preset ratio and less than 1, determine the weight factor of the video frame as a preset multiple of the preset weight factor, and the preset multiple is a positive multiple less than 1. The target coding sub-block refers to a coding sub-block whose texture complexity is less than a first complexity threshold or a coding sub-block whose texture complexity is greater than a second complexity threshold, and the first complexity threshold is less than the second complexity threshold. The first complexity threshold is less than or equal to the average texture complexity of the coding sub-block, and the average texture complexity refers to the first average value of the texture complexity of each coding sub-block in the video frame. The weight factor is used to determine the quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, and the quantization parameter offset is proportional to the weight factor and the texture complexity.
[0147] Wherein, when the target coding sub-block refers to a coding sub-block whose texture complexity is less than a first complexity threshold, the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame.
[0148] S408: Determine a fifth average value of the quantization parameter offsets of the coding sub-blocks belonging to the same coding block.
[0149] S409, summing the fifth average value and the initial quantization parameter to obtain the quantization parameter of the coding block to which each coding sub-block belongs. The coding block to which each coding sub-block belongs is the same coding block to which each coding sub-block belongs. The quantization parameter of the coding block to which each coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0150] The quantization parameter determination method in this embodiment uses the texture complexity information in the video frame, calculates the texture complexity of each coding sub-block by block division, and adaptively adjusts the weight factor of the video frame based on the proportion of the coding sub-blocks that meet the requirements in the video frame. Then, the quantization parameters of different coding blocks in the video frame are adjusted to allocate the bit rate to different coding blocks more evenly, thereby achieving the beneficial effect of improving the compression efficiency of video encoding. In this embodiment, the more comprehensive beneficial effects that can be achieved by the quantization parameter determination method and the specific process of achieving the corresponding beneficial effects can refer to the beneficial effects and implementation process that can be achieved by the quantization parameter determination method described in any of the aforementioned embodiments, and will not be described in detail in this embodiment.
[0151] The embodiment of the present application also provides a device for determining a quantization parameter, where the quantization parameter is used to characterize the degree of quantization refinement during video encoding. Figure 5As shown, the quantization parameter determination device 500 includes an acquisition module 501, an adjustment module 502 and a first determination module 503. The acquisition module 501 is used to acquire a video frame, wherein the video frame includes a coding block, and the coding block includes a coding sub-block. The adjustment module 502 is used to reduce the weight factor of the video frame when there are at least two coding sub-blocks with different texture complexities in the video frame. The weight factor is used to determine the quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block. The quantization parameter offset is proportional to the weight factor and the texture complexity. The first determination module 503 is used to determine the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block. The quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0152] In one of the embodiments, the above-mentioned adjustment module 502 is also used to reduce the weight factor of the video frame when the proportion of the target coding sub-block in the video frame is greater than a preset ratio and less than 1, and the target coding sub-block refers to a coding sub-block with a texture complexity less than a first complexity threshold or a coding sub-block with a texture complexity greater than a second complexity threshold, and the first complexity threshold is less than the second complexity threshold.
[0153] In one of the embodiments, the above-mentioned adjustment module 502 is also used to determine that the weight factor of the video frame is a preset multiple of the preset weight factor, and the preset multiple is a positive multiple less than 1. When the target coding sub-block refers to a coding sub-block with a texture complexity less than a first complexity threshold, the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame.
[0154] In one of the embodiments, the first complexity threshold is less than or equal to an average texture complexity of the coding sub-block, where the average texture complexity refers to a first average value of the texture complexities of the coding sub-blocks in the video frame.
[0155] In one embodiment, the quantization parameter determination device 500 further includes a second determination module, for determining the texture complexity of the coding sub-block as the sum of the first complexity of the luminance block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block, wherein the coding sub-block includes the luminance block, the first chrominance block, and the second chrominance block; wherein the first complexity is used to represent the discrete degree of the luminance component value of each pixel in the coding sub-block, the second complexity is used to represent the discrete degree of the first chrominance component value of each pixel in the coding sub-block, and the third complexity is used to represent the discrete degree of the second chrominance component value of each pixel in the coding sub-block.
[0156] In one of the embodiments, the above-mentioned second determination module is also used to respectively determine the second average value of the brightness component value of each pixel in the coding sub-block, the third average value of the first chrominance component value of each pixel, and the fourth average value of the second chrominance component value of each pixel; add the difference between the brightness component value of each pixel and the second average value to obtain the first complexity of the brightness block; add the difference between the first chrominance component value of each pixel and the third average value to obtain the second complexity of the first chrominance block; add the difference between the second chrominance component value of each pixel and the fourth average value to obtain the third complexity of the second chrominance block.
[0157] In one embodiment, the first determination module 503 includes an average value determination unit and a quantization parameter determination unit. The average value determination unit is used to determine a fifth average value of the quantization parameter offsets of each coding sub-block belonging to the same coding block. The quantization parameter determination unit is used to sum the fifth average value with the initial quantization parameter to obtain the quantization parameter of the coding block to which each coding sub-block belongs, where the coding block is the same coding block to which each coding sub-block belongs.
[0158] For the explanation of each term, please refer to the relevant description in the aforementioned method embodiment, which will not be elaborated here.
[0159] It should be noted that the specific execution process of the above-mentioned quantization parameter determination device 500 can be found in Figures 1 to 4 The specific description of the illustrated embodiment will not be repeated here.
[0160] Each module in the above-mentioned quantization parameter determination device 500 can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0161] like Figure 6 As shown, the embodiment of the present application further provides a computer device 600. Exemplarily, the computer device 600 may include a processor 601, a communication interface 602, a communication bus 603, and a memory 604. Specifically, the computer device 600 may include:
[0162] At least one processor 601, such as a CPU, at least one communication interface 602, a memory 604, and at least one communication bus 603. The communication bus 603 is used to realize the connection and communication between these components. The communication interface 602 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface or a Bluetooth interface, etc.). The memory 604 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 604 may also be at least one storage device located away from the aforementioned processor 601. Figure 6 As shown, the memory 604 as a computer storage medium may include an operating system and program instructions.
[0163] Exemplarily, the processor 601 may be used to implement the above Figure 5 The steps or methods executed by the acquisition module 501, the adjustment module 502 and the first determination module 503 in the embodiment.
[0164] It is understandable that the above method is only an example, and the processor 601 and other modules in the above computer device 600 may also cooperate to perform the above method. Figure 5 The steps or methods executed by the acquisition module 501, the adjustment module 502 and the first determination module 503 are not limited in this document.
[0165] exist Figure 6 In the computer device 600 shown, the processor 601 may be used to load program instructions stored in the memory 604 and specifically perform the following operations:
[0166] Acquire a video frame, where the video frame includes a coding block, and the coding block includes a coding sub-block;
[0167] When there are at least two coding sub-blocks with different texture complexities in the video frame, a weight factor of the video frame is reduced, where the weight factor is used to determine a quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, and the quantization parameter offset is proportional to the weight factor and the texture complexity;
[0168] According to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs is determined, and the quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
[0169] For the explanation of each term, please refer to the relevant description in the aforementioned method embodiment, which will not be elaborated here.
[0170] It should be noted that the specific implementation process can be found in Figures 1 to 4 The specific description of the illustrated embodiment will not be repeated here.
[0171] The present application also provides a computer-readable storage medium, which can store a plurality of instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figures 1 to 4 The method steps of the embodiment shown in the figure can be found in the specific execution process. Figures 1 to 4 The specific description of the illustrated embodiment will not be repeated here.
[0172] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0173] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any fusion thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0174] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0175] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0176] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for determining a quantization parameter, characterized in that: The quantization parameter is used to characterize the fineness of quantization in the video encoding process; the method comprises: Acquire a video frame, wherein the video frame includes a coding block, and the coding block includes a coding sub-block; In the case where there are at least two coding sub-blocks with different texture complexities in the video frame, reducing a weight factor of the video frame, the weight factor being used to determine a quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, the quantization parameter offset being proportional to both the weight factor and the texture complexity; According to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs is determined, and the quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
2. The method according to claim 1, characterized in that When at least two coding sub-blocks with different texture complexities exist in the video frame, reducing the weight factor of the video frame comprises: When the proportion of the target coding sub-block in the video frame is greater than a preset ratio and less than 1, the weight factor of the video frame is reduced, and the target coding sub-block refers to a coding sub-block whose texture complexity is less than a first complexity threshold or a coding sub-block whose texture complexity is greater than a second complexity threshold, and the first complexity threshold is less than the second complexity threshold.
3. The method according to claim 2, characterized in that The reducing the weight factor of the video frame comprises: Determine that the weight factor of the video frame is a preset multiple of a preset weight factor, where the preset multiple is a positive multiple less than 1, and when the target coding sub-block refers to a coding sub-block whose texture complexity is less than the first complexity threshold, the preset multiple is inversely proportional to the proportion of the target coding sub-block in the video frame.
4. The method according to claim 2, characterized in that: The first complexity threshold is less than or equal to an average texture complexity of the coding sub-block, where the average texture complexity refers to a first average value of the texture complexities of the coding sub-blocks in the video frame.
5. The method according to claim 1, characterized in that: In the case where there are at least two coding sub-blocks with different texture complexities in the video frame, before reducing the weight factor of the video frame, the method further includes: Determine the texture complexity of the coding sub-block as the sum of a first complexity of a luminance block, a second complexity of a first chrominance block, and a third complexity of a second chrominance block, the coding sub-block comprising the luminance block, the first chrominance block, and the second chrominance block; Among them, the first complexity is used to represent the discrete degree of the brightness component value of each pixel in the coding sub-block, the second complexity is used to represent the discrete degree of the first chrominance component value of each pixel in the coding sub-block, and the third complexity is used to represent the discrete degree of the second chrominance component value of each pixel in the coding sub-block.
6. The method according to claim 5, characterized in that Before determining that the texture complexity of the coding sub-block is the sum of the first complexity of the luminance block, the second complexity of the first chrominance block, and the third complexity of the second chrominance block, the method further includes: respectively determining a second average value of the luminance component value of each pixel point in the coding sub-block, a third average value of the first chrominance component value of each pixel point, and a fourth average value of the second chrominance component value of each pixel point; Adding the difference between the brightness component value of each pixel and the second average value to obtain the first complexity of the brightness block; Adding a difference between the first chrominance component value of each pixel and the third average value to obtain the second complexity of the first chrominance block; The difference between the second chrominance component value of each pixel point and the fourth average value is added to obtain the third complexity of the second chrominance block.
7. The method according to any one of claims 1 to 6, characterized in that: The determining, according to the quantization parameter offset of the coding sub-block, the quantization parameter of the coding block to which the coding sub-block belongs includes: Determining a fifth average value of the quantization parameter offsets of the coding sub-blocks belonging to the same coding block; The fifth average value is summed with an initial quantization parameter to obtain the quantization parameter of the coding block to which each coding sub-block belongs, and the coding block to which each coding sub-block belongs is the same coding block to which each coding sub-block belongs.
8. A quantization parameter determination device, characterized in that: The quantization parameter is used to characterize the fineness of quantization in the video encoding process; the device comprises: An acquisition module, used for acquiring a video frame, wherein the video frame includes a coding block, and the coding block includes a coding sub-block; an adjustment module, configured to reduce a weight factor of the video frame when at least two coding sub-blocks with different texture complexities exist in the video frame, wherein the weight factor is used to determine a quantization parameter offset of the coding sub-block together with the texture complexity of the coding sub-block, and the quantization parameter offset is proportional to both the weight factor and the texture complexity; The first determination module is used to determine the quantization parameter of the coding block to which the coding sub-block belongs according to the quantization parameter offset of the coding sub-block, and the quantization parameter of the coding block to which the coding sub-block belongs is proportional to the quantization parameter offset of the coding sub-block.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions; when the program instructions are executed by the processor, the processor executes the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program; when the computer program is run on one or more processors, the method according to any one of claims 1 to 7 is executed.
11. A computer program product, characterized in that The computer program product comprises a computer program or instructions; when the computer program or instructions are run on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Quantization parameter offset determination method and device, equipment, storage medium and program product
CN119299688A
