Quantization parameter optimization method, device, electronic device and storage medium

By calculating the motion and spatial features of video frames during video compression and adaptively adjusting the quantization parameter offset value, the problem of failing to consider the differences between video frames and spatial domains in the existing technology is solved, thereby improving the efficiency and quality of video compression.

CN119562066BActive Publication Date: 2025-10-03RONG MING MICROELECTRONICS (JINAN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411617067.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-20
Publication Date
2025-10-03
Estimated Expiration
2043-12-20

AI Technical Summary

Technical Problem

Existing time-dependent models fail to consider the differences between video image frames and spatial coding blocks in video compression, resulting in a lack of adaptive adjustment of quantization parameter offset values, affecting video compression efficiency.

Method used

By calculating the motion and spatial features of video frames, adaptively adjusting the frame-level and block-level strengths, and dynamically optimizing the quantization parameter offset value, video compression efficiency is improved.

Benefits of technology

The quantization parameters are adaptively adjusted according to the characteristics of the video frame and coding block, which improves the video compression efficiency and coding quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119562066B_ABST
    Figure CN119562066B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of video compression coding, and specifically to a quantization parameter optimization method, device, electronic device and storage medium. The quantization parameter optimization method includes: when adjusting the quantization parameter of the coding block based on a time-dependent model, dynamically adjusting the frame-level intensity of each video frame in the model by obtaining the motion characteristics of the video frame, and adjusting the block-level intensity of each coding block in the model by obtaining the spatial characteristics of the coding block within the frame. The technical solution of the present application can change the original constant intensity method used when adjusting the quantization parameter based on the time-dependent model, and instead adaptively adjust the frame-level intensity of each video frame and the block-level intensity of the coding block within the frame according to the motion characteristics and spatial characteristics of the video frame. By adapting the two-level model intensity, the quantization parameter offset value of the coding block in the video frame can be adjusted in a targeted manner, thereby improving the video compression efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video compression, and in particular to a quantization parameter optimization method, device, electronic device and storage medium suitable for video compression coding. Background Art

[0002] In the related art, in the implementation of rate-distortion optimization based on a time-dependent model, the degree of dependency of the current coding block in the current frame on the coding blocks in the subsequent coding frames is generally evaluated through a backward propagation calculation based on the reference dependency relationship. The more important coding blocks (CBs) will have their quantization parameters (QPs) lowered to improve the encoding quality, thereby reducing the amount of residual data when encoding the CBs, thereby improving the encoding compression efficiency. However, the existing time-dependent model uses a uniform fixed strength when calculating the QP offset value (deltaQP) of the CB, and does not take into account the characteristics of the video image itself, such as the differences between different frame images (Frame) in the time domain and the differences between coding blocks in the spatial domain. These characteristics will affect the benefits of the algorithm. Summary of the Invention

[0003] The purpose of this application is to provide a quantization parameter optimization method, device, electronic device and storage medium, which, based on the existing time-dependent model, can adaptively adjust the frame-level intensity of each video frame according to the motion characteristics of the video frame, thereby achieving targeted adjustment of the quantization parameter offset value of the coding block in the video frame, thereby improving video compression efficiency.

[0004] According to a first aspect of an embodiment of the present application, a quantization parameter optimization method is provided, including:

[0005] Calculate the motion feature value of the current frame;

[0006] Obtaining an initial frame-level intensity of the current frame;

[0007] The adaptive dynamic frame-level intensity of the current frame is obtained according to the motion feature value and the initial frame-level intensity.

[0008] In one embodiment, the motion feature value is a probability that the current frame is a low-motion frame.

[0009] In one embodiment, the current frame is the jth frame, and the probability that the current frame is a low-motion frame is calculated as follows:

[0010]

[0011] Among them, low_motion_ration(Fj) is the probability that the j-th frame is a low motion frame, block_cnt_inter is the number of coding blocks in the j-th frame that satisfy the inter-frame cost less than the intra-frame cost, block_cnt_motion is the number of coding blocks in the j-th frame that satisfy the inter-frame cost less than the intra-frame cost and the inter-frame predicted motion vector is a non-zero value, and number_of_blocks is the number of all coding blocks in the j-th frame.

[0012] In one embodiment, the adaptive dynamic frame-level intensity is calculated according to the motion feature value and the initial frame-level intensity using the following formula:

[0013] frame_strength (Fj) =frame_strength0*(1+3*low_motion_ration(Fj)) / 2;

[0014] Among them, frame_strength (Fj) is the adaptive dynamic frame level strength, and frame_strength0 is the initial frame level strength.

[0015] In one embodiment, the calculation formula of the initial frame level intensity is as follows:

[0016] frame_strength0=strenthgRatio*DQP_STRENGTH;

[0017] Among them, strenthgRatio is the scaling factor of the strength, and DQP_STRENGTH is the fixed strength reference value.

[0018] In one embodiment, after obtaining the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity, the method further includes:

[0019] Obtaining spatial feature values ​​of the current frame;

[0020] Obtaining a block-level strength of each coding block in the current frame according to the spatial feature value and the adaptive dynamic frame-level strength;

[0021] Obtaining the importance of each coding block in the current frame;

[0022] For each coding block, a quantization parameter offset value of the coding block is obtained according to the block-level strength and the importance.

[0023] In one embodiment, obtaining the block-level strength of each coding block in the current frame according to the spatial feature value and the adaptive dynamic frame-level strength includes:

[0024] The block-level strength of each coding block in the current frame is calculated according to the spatial feature value and the adaptive dynamic frame-level strength using the following calculation formula:

[0025]

[0026] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coding block in the j-th frame, frame_strength (Fj) is the adaptive dynamic frame level intensity, frame_avg_cv (Fj) is the average spatial feature value of all coding blocks in the jth frame, block_cv (Fj,Bi) is the spatial feature value of the i-th coding block in the j-th frame, max_block_cv (Fj) min_block_cv is the maximum spatial feature value among all the spatial feature values ​​of the coding blocks in the jth frame, (Fj) is the minimum spatial feature value among the spatial feature values ​​of all coding blocks in the jth frame.

[0027] In one embodiment, the spatial feature value is a texture feature value that can represent a spatial feature, wherein the texture feature value is represented by using an intra-frame cost of a coding block or a variance of a coding block.

[0028] In one embodiment, for each coding block, obtaining a quantization parameter offset value of the coding block according to the block-level strength and the importance includes:

[0029] According to the block-level strength and the importance, the quantization parameter offset value of the coding block is calculated using the following formula:

[0030] DeltaQP (Fj,Bi) =-block_strength (Fj,Bi) *log_dependence (Fj,Bi) ;

[0031] Among them, DeltaQP (Fj,Bi) is the quantization parameter offset value of the i-th coding block in the j-th frame, block_strength (Fj,Bi) is the block-level strength of the i-th coded block in the j-th frame, log_dependence (Fj,Bi) is the importance of the i-th coding block in the j-th frame.

[0032] In one implementation, obtaining the importance of each coding block in the current frame includes:

[0033] Calculating a propagation ratio of a current coding block in a specified position frame in a predetermined time window in a backward order; the specified position frame is the current frame;

[0034] Calculate the total energy transferred from the current coding block to its reference coding block according to the propagation ratio, the intra-frame cost of the current coding block, and the total energy transferred from all accumulated frames of the current coding block to the frames that reference the current coding block in the backward direction;

[0035] Calculating the energy transferred from the current coding block to each of its reference coding blocks based on the sum of the energies transferred from the current coding block to its reference coding blocks and the weight coefficients transferred from the current coding block to each of its reference coding blocks;

[0036] In reverse coding order, traverse all frames in the preset time window, from the last frame to the first frame, and repeat the above steps;

[0037] Finally, for each coding block in the head frame in the preset time window, the importance of the coding block is calculated according to the sum of all accumulated energies transferred from the frames that reference the coding block in the backward direction and its intra-frame cost.

[0038] In one embodiment, the calculating the total energy transferred from the current coding block to its reference coding block based on the propagation ratio, the intra-frame cost of the current coding block, and the total energy transferred from all accumulated frames of the current coding block that reference the current coding block in the backward direction includes:

[0039] When the SKIP mode is used to encode the current coding block, the energy transferred from the current coding block to its reference coding block is calculated using the following formula based on the propagation ratio, the intra-frame cost of the current coding block, and the sum of all accumulated energies of the current coding block transferred from frames that reference the coding block in the backward direction:

[0040] PropagateCostOut cur_blk =(1+extra_ratio)*PropagateFraction cur_blk* (IntraCost cur_blk +PropagateCostIn cur_blk );

[0041] Among them, PropagateCostOut cur_blk is the energy transferred from the current coding block to its reference coding block, extra_ratio is the additional weight, PropagateFractioncur_blk IntraCost is the propagation ratio of the current coding block. cur_blk is the intra-frame cost of the current coding block, PropagateCostIn cur_blk It is the sum of the energy transferred from all the frames that reference the current coding block to the backward frames.

[0042] According to a second aspect of an embodiment of the present application, a quantization parameter optimization device is provided, including:

[0043] A first calculation module is configured to calculate a motion feature value of a current frame;

[0044] A first acquisition module is configured to acquire an initial frame-level intensity of the current frame;

[0045] The second acquisition module is configured to acquire the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity.

[0046] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store a computer program executable by the processor; and the processor is used to execute the computer program in the memory to implement the above method.

[0047] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the executable computer program in the storage medium is executed by a processor, the above method can be implemented.

[0048] Compared with the prior art, the beneficial effect of the present application is that by calculating the motion feature value of the current frame and obtaining the initial frame-level intensity of the current frame, and then obtaining the adaptive dynamic frame-level intensity of the current frame based on the motion feature value and the initial frame-level intensity, the frame-level intensity of each video frame can be adaptively adjusted according to the motion characteristics of the video frame, thereby achieving targeted adjustment of the quantization parameter offset value of the coding block in the video frame, thereby improving the video compression efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is a schematic diagram showing the relationship between a current coding block and a reference coding block according to related art.

[0050] Figure 2 This is a schematic diagram illustrating rate-distortion optimization of an encoder using a time-dependent model according to related art.

[0051] Figure 3 The figure is a flowchart of a quantization parameter optimization method according to an exemplary embodiment.

[0052] Figure 4 The figure is a flowchart of a quantization parameter optimization method according to another exemplary embodiment.

[0053] Figure 5 The figure is a flowchart of a quantization parameter optimization method according to another exemplary embodiment.

[0054] Figure 6 The figure is a flowchart of a quantization parameter optimization method according to another exemplary embodiment.

[0055] Figure 7 The figure is a block diagram showing a quantization parameter optimization device according to an exemplary embodiment.

[0056] Figure 8 is a block diagram of a quantization parameter optimization device according to another exemplary embodiment.

[0057] Figure 9 is a block diagram of a quantization parameter optimization device according to another exemplary embodiment.

[0058] Figure 10 is a block diagram of a quantization parameter optimization device according to another exemplary embodiment.

[0059] Figure 11 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0060] Unless otherwise defined, the technical or scientific terms used in this specification and claims shall have the ordinary meanings understood by persons having ordinary skills in the technical field to which the invention belongs. Specific embodiments of the present invention will be described below in conjunction with the accompanying drawings. It should be noted that in the specific description of these embodiments, for the sake of clarity and clarity, this specification cannot provide a detailed description of all features of the actual embodiments. Without departing from the spirit and scope of the present invention, those skilled in the art may modify and replace the embodiments of the present invention, and the resulting embodiments are also within the scope of protection of the present invention.

[0061] Related Technology 1

[0062] Video encoders process sequences of video images, often referred to as video sequences. A video sequence is a collection of multiple frames arranged in chronological order. Encoders encode frames, dividing each frame into several coding blocks (CBs). When encoding each CB, adjacent CBs are sometimes used as coding references to achieve compression based on similarity.

[0063] like Figure 1As shown, poc represents the image order index (image number), that is, the temporal position of each frame image 10 in the video sequence; the shaded block within each frame image 10 represents a coding block 11; the line segment with an arrow represents the reference direction 12, that is, the coding block pointed by the arrow needs to refer to the coding block at the other end of the arrow. For example, the current coding block 13 needs to refer to the reference coding block 14.

[0064] The quantization parameter (QP) of the coding block affects the quality of the CB encoding: a smaller QP indicates higher video quality, and vice versa. The quality of the reference frame 15 will affect the quality of future frames encoded using it as a reference. The more frequently the CB in the current frame 16 is referenced by the CB in subsequent coded frames 17, the more important it is, and higher-quality encoding is required, meaning its QP value should be reduced.

[0065] Related Technology 2

[0066] The time-dependent model is used to optimize the rate-distortion of the encoder. It is actually implemented in some open source video encoders, such as the "macroblock tree" (MBtree) in the x264 encoder. Figure 2 To estimate the importance of each CB and the energy propagated to future frames, the MBtree algorithm applies a model that uses coding statistics collected over a certain period of time, propagates the data backward to each current coding block, and calculates deltaQP according to the formula

[13] .

[0067] Figure 2 In the figure, coding blocks 11 are divided into three types: current coding block 13, reference coding block 14, and non-reference coding block 17. Non-reference coding block 17 is not used as a reference when encoding current coding block 13. t0, t1, t2, t3, and t4 represent a time window of 5 frames, from the current frame (head frame) at time t0 to the last frame at time t4. Coding blocks 11 on the same row represent coding blocks 11 in the same frame at that time. The direction 18 of backpropagation calculation is determined by the reference relationship between coding blocks 11 in the actual encoding, that is, propagation from a coding block to its reference block. Following the reverse encoding order, starting with the frame at time t4, the calculation is propagated from each coding block 11 within the frame to the reference block in its reference frame based on their reference relationship. Next, the frame at time t3 is followed, and this process is repeated until all coding blocks 11 in the frame at time t0 are accumulated and the deltaQP (quantization parameter offset) for all coding blocks 11 in that frame is calculated.

[0068] The statistics used in the backpropagation calculation include IntraCost (the cost when CB uses intra-frame coding), InterCost (the cost when CB uses inter-frame coding), Reference Index (reference index) and MotionVectors (motion vectors for inter-frame prediction).

[0069] The traditional algorithm model includes the following steps to process statistical data and output QP offset (deltaQP).

[0070] A. Spread Computing (Current CB)

[0071] (1) Calculate the current CB propagation ratio using the following formula:

[0072]

[0073] Among them, PropagateFraction cur_blk is the current CB propagation ratio, IntraCost cur_blk The cost of intra-frame coding for the current CB, min(IntraCost, InterCost) cur_blk The minimum value between the cost when the current CB uses intra-frame coding and the cost when the current CB uses inter-frame coding is obtained. The subscript cur_blk of the parameter in the formula indicates that the parameter is the parameter of the current CB.

[0074] (2) Calculate the amount of current CB transferred outward

[0075] PropagateCostOut cur_blk =PropagateFraction cur_blk *(IntraCost cur_blk +PropagateCostIn cur_blk ) (2)

[0076] Among them, PropagateCostOut cur_blk PropagateCostIn is the energy currently transferred outward by CB, cur_blk It is the sum of all accumulated energies of the current CB from the frames that reference the current CB in the backward direction.

[0077] (3) The current CB is assigned to its reference CB

[0078] The PropagateCostOut in the above formula (2) cur_blk Proportionally assigned to its corresponding CB in the reference frame.

[0079] PropagateCostIn(Fj,Bi) +=weight (Fj,Bi) *PropagateCostOut cur_blk (3)

[0080] Among them, PropagateCostIn (Fj,Bi) is the sum of all accumulated energies of the i-th CB in the j-th frame image from the frames that reference the CB in the backward direction, weight (Fj,Bi) It is the weight coefficient of the i-th CB in the j-th frame image, which is determined based on the ratio of the number of predicted pixels used. The subscript (Fj, Bi) of the parameter in the formula indicates that the parameter is the parameter of the i-th CB in the j-th frame image, and the 0th frame in the time window is the head frame.

[0081] B. Traverse all frames in the time window in reverse coding order, starting from the last frame and ending with the first frame, and repeat the above steps. Finally, determine the deltaQP of each CB in the first frame.

[0082] C. Calculating deltaQP

[0083] (1) Based on the results of the above reverse recursive propagation, the following formula is used to evaluate the importance of each CB in the head frame

[0084]

[0085] Among them, log_dependence (Fj,Bi) is the importance of the i-th CB in the header frame.

[0086] (2) Based on the importance of the CB block and the strength value at the frame level, deltaQP is mapped using the following formula

[0087] DeltaQP (F0,Bi) =-framestrength*log_dependence (F0,Bi) (5)

[0088] Among them, DeltaQP (F0,Bi) is the quantization parameter offset value of the i-th CB in the header frame, and framestrength is the strength value at the frame level.

[0089] Current algorithm models often generate negative deltaQP values, which results in a QP lower than the original value for encoding the residual. This means that the QP used to encode the residual increases the amount of encoded data (bitrate) to preserve more high-quality information. However, for CBs with large residuals, the bitrate is very sensitive to changes in QP, and significantly reducing the QP does not lead to significant compression efficiency savings. To balance this and ensure good compression performance, it makes sense to adjust the QP with a lower intensity for coded blocks with large residuals. Video frames and CBs with features such as rich textures or intense motion typically have large residuals.

[0090] However, existing time-dependent models use a fixed, uniform frame-level intensity value when calculating the CB's QP offset (deltaQP). This fails to consider the inherent characteristics of the video image, such as the differences between frames in the temporal domain and between coding blocks in the spatial domain. These characteristics can affect the algorithm's performance. Therefore, existing time-dependent models lack adaptive adjustment capabilities when calculating the CB's QP offset (deltaQP).

[0091] In order to solve the above technical problems, the present application proposes a quantization parameter optimization method, device, electronic device and storage medium, which can.

[0092] Figure 3 This is a flow chart of a quantization parameter optimization method according to an exemplary embodiment. This quantization parameter optimization method can be applied to an encoder. In this embodiment, the frame-level intensity can be adaptively adjusted based on the motion information of non-I frames (I frames are frames using intra-frame prediction). Figure 3 , the quantization parameter optimization method may include the following steps:

[0093] Step 301: Calculate the motion feature value of the current frame.

[0094] Without considering the spatial distribution characteristics of the video image content itself, regardless of whether intra or inter coding is used for the coding blocks, the coding blocks can be divided into three categories: low-motion areas, normal-motion areas, and high-motion areas. When the proportion of low-motion areas in a video frame is relatively large, the video frame is considered a low-motion frame; when the proportion of low-motion areas is relatively small, the video frame is considered a high-motion frame.

[0095] In one embodiment, the motion feature value of the current frame is the probability that the current frame is a low-motion frame.

[0096] In one embodiment, the current frame is the jth frame, and the probability that the current frame is a low-motion frame can be calculated using the following formula:

[0097]

[0098] Among them, low_motion_ration(Fj) is the probability that the j-th frame is a low motion frame, block_cnt_inter is the number of coding blocks in the j-th frame that satisfy the inter-frame cost less than the intra-frame cost, block_cnt_motion is the number of coding blocks in the j-th frame that satisfy the inter-frame cost less than the intra-frame cost and the motion vector during inter-frame prediction is a non-zero value, and number_of_blocks is the number of all coding blocks in the j-th frame.

[0099] In addition, it should be noted that, when calculating the quantization parameter offset value, j=0, that is, the first video frame of each time.

[0100] Step 302: Obtain the initial frame-level intensity of the current frame.

[0101] In one embodiment, the initial frame level intensity is a fixed intensity parameter set before dynamic adjustment. The calculation formula of the initial frame level intensity is as follows:

[0102] frame_strength0=strenthRatio*DQP_STRENGTH (7)

[0103] Among them, strenthRatio is the intensity scaling factor, which is a parameter configurable by the customer. The customer can set the maximum intensity amplitude by configuring the intensity scaling factor. DQP_STRENGTH is a fixed intensity baseline value, which is a fixed intensity parameter in the original time-dependent model and has a default value of 2.

[0104] Step 303: Obtain the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity.

[0105] In one embodiment, the adaptive dynamic frame-level intensity of the current frame may be calculated based on the motion feature value and the initial frame-level intensity. In one embodiment, the adaptive dynamic frame-level intensity may be calculated based on the motion feature value and the initial frame-level intensity using the following calculation formula:

[0106] frame_strength (Fj) =frame_strength0*(1+3*low_motion_ration(Fj)) / 2 (8)

[0107] Among them, frame_strength (Fj) is the adaptive dynamic frame-level strength of the current frame.

[0108] From the above formula (3), it can be seen that when low_motion_ration(Fj) is equal to 1 / 3, that is, 1 / 3 of the area of ​​a frame of video image is the low motion area, the frame level intensity calculated using the original algorithm is maintained, that is, the adaptive dynamic frame level intensity is equal to the initial frame level intensity.

[0109] When low_motion_ration (Fj) is greater than 1 / 3, that is, the proportion of low motion areas is large, the frame level strength is increased to make a larger adjustment to deltaQP, because frames with low motion characteristics are suitable for larger adjustments to deltaQP.

[0110] When low_motion_ration (Fj) is less than 1 / 3, that is, the proportion of high motion areas is large, the frame level strength will be reduced to make smaller adjustments to deltaQP, because frames with high motion characteristics are suitable for smaller adjustments to deltaQP.

[0111] In this embodiment, the motion feature value of the current frame is calculated and the initial frame-level intensity of the current frame is obtained. Then, the adaptive dynamic frame-level intensity of the current frame is obtained based on the motion feature value and the initial frame-level intensity. In this way, the frame-level intensity of each video frame can be adaptively adjusted according to the motion characteristics of the video frame, thereby achieving targeted adjustment of the quantization parameter offset value of the coding block in the video frame, thereby improving the video compression efficiency.

[0112] Figure 4 FIG. 1 is a flow chart showing a method for optimizing quantization parameters according to another exemplary embodiment. Figure 4 , the quantization parameter optimization method may include the following steps:

[0113] Step 401: Calculate the motion feature value of the current frame.

[0114] Step 402: Obtain the initial frame-level intensity of the current frame.

[0115] Step 403: Obtain the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity.

[0116] Steps 401 to 403 are similar to the above steps 301 to 303 and will not be described in detail here.

[0117] Step 404: Obtain the importance of each coding block in the current frame.

[0118] In this embodiment, the importance of each coding block in the current frame can be calculated using the following formula (9). The derivation process of formula (9) is similar to that of formula (4), and will not be repeated here.

[0119]

[0120] Among them, log_dependence (Fj,Bi) is the importance of the i-th CB in the j-th frame, PropagateCostIn (Fj,Bi) IntraCost is the sum of all accumulated energies transferred from the backward frames that refer to the CB in the jth frame. (Fj,Bi) is the intra-frame cost of the i-th CB in the j-th frame.

[0121] Step 405 : For each coding block, obtain a quantization parameter offset value of the coding block according to the importance and the adaptive dynamic frame level strength.

[0122] In this embodiment, for each coding block in the jth frame, the quantization parameter offset value of the coding block can be calculated using the following formula according to the importance of the coding block and the adaptive dynamic frame level strength:

[0123] DeltaQP (Fj,Bi) =-frame_strength (Fj) *log_dependence (Fj,Bi) (10)

[0124] Among them, DeltaQP (Fj,Bi) is the quantization parameter offset value of the i-th coding block in the j-th frame, frame_strength (Fj) is the adaptive dynamic frame-level intensity of the j-th frame, log_dependence (Fj,Bi) is the importance of the i-th coding block in the j-th frame, where j is 0.

[0125] In this embodiment, the frame-level strength of each video frame can be adaptively adjusted according to the motion characteristics of the video frame, so as to achieve targeted adjustment of the quantization parameter offset value of the coding block in the video frame and improve the video compression efficiency.

[0126] Figure 5 FIG2 is a flow chart showing a method for optimizing quantization parameters according to another exemplary embodiment. In this embodiment, the strength of each coding block can be adaptively adjusted according to the spatial distribution characteristics of the video frame. Figure 5 , the quantization parameter optimization method may include the following steps:

[0127] Step 501: Calculate the motion feature value of the current frame.

[0128] Step 502: Obtain the initial frame-level intensity of the current frame.

[0129] Step 503: Obtain the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity.

[0130] Steps 501 to 503 are similar to the above steps 301 to 303 and will not be described again here.

[0131] Step 504: Obtain the spatial feature value of the current frame.

[0132] During the adaptive adjustment of the frame-level intensity, the spatial distribution characteristics within the video image, such as the texture distribution of the image, are not taken into account. Therefore, in this embodiment, the intensity of each CB is adaptively adjusted based on the spatial distribution characteristics of each CB in the video image.

[0133] In one embodiment, the spatial feature value of the current frame is a texture feature value that can represent the spatial feature, wherein the texture feature value can be represented by the intra-frame cost of the coding block or the variance of the coding block.

[0134] In one embodiment, the spatial feature value of the current frame can be the intra-frame cost (IntraCost) or variance (Variance) of the coding block. For a CB, a larger intra-frame cost or variance indicates a higher probability of it being a texture region. For CBs in textured regions, the deltaQP generation needs to be reduced by reducing the intensity value.

[0135] Step 505 : Obtain the block-level strength of each coding block in the current frame according to the spatial feature value and the adaptive dynamic frame-level strength.

[0136] In one embodiment, the block-level strength of each coding block in the current frame may be calculated according to the spatial feature value and the adaptive dynamic frame-level strength using the following formula:

[0137]

[0138] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coding block in the j-th frame, frame_strength (Fj) is the adaptive dynamic frame level intensity, frame_avg_cv (Fj) is the average spatial feature value of all coding blocks in the jth frame, block_cv (Fj,Bi) is the spatial feature value of the i-th coding block in the j-th frame, max_block_cv (Fj) min_block_cv is the maximum spatial feature value among all the spatial feature values ​​of the coding blocks in the jth frame, (Fj) is the minimum spatial feature value among the spatial feature values ​​of all coding blocks in the jth frame.

[0139] Step 506: Obtain the importance of each coding block in the current frame.

[0140] Step 506 is similar to the above-mentioned step 404 and will not be described again here.

[0141] Step 507: For each coding block, obtain a quantization parameter offset value of the coding block according to the block-level strength and importance.

[0142] In one embodiment, for each coding block, the quantization parameter offset value of the coding block may be calculated using the following formula according to the block-level strength of the coding block and the importance of the coding block:

[0143] DeltaQP (Fj,Bi) =-block_strength (Fj,Bi) *log_dependence (Fj,Bi) (12)

[0144] Among them, DeltaQP (Fj,Bi) is the quantization parameter offset value of the i-th coding block in the j-th frame, block_strength (Fj,Bi) is the block-level strength of the i-th coded block in the j-th frame, log_dependence (Fj,Bi) is the importance of the i-th coding block in the j-th frame.

[0145] In one embodiment, the spatial feature value is the intra-frame cost of the coding block. The block-level strength of each coding block in the current frame can be calculated using the following formula based on the intra-frame cost and the adaptive dynamic frame-level strength:

[0146]

[0147] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coding block in the j-th frame, frame_strength (Fj) For adaptive dynamic frame level strength, frame_avg_cost (Fj) is the average intra-frame cost of all coded blocks in the jth frame, block_cost (Fj,Bi) is the intra-frame cost of the i-th coding block in the j-th frame, max_block_cost (Fj) The maximum intra-frame cost among all the intra-frame costs of the coding blocks in the j-th frame, min_block_cost (Fj) is the minimum intra-frame cost among all intra-frame costs of all coding blocks in the j-th frame.

[0148] When the intra-frame cost of the current CB is greater than the average intra-frame cost of all blocks in the frame, the block-level strength will be reduced based on the frame-level strength; when the intra-frame cost of the current CB is less than the average intra-frame cost of all blocks in the frame, the block-level strength will be increased based on the frame-level strength, and finally the deltaQP of the current CB can be dynamically generated.

[0149] In another embodiment, the spatial feature value is the variance of the coding block, and the block-level strength of each coding block in the current frame can be calculated using the following formula based on the variance and the adaptive dynamic frame-level strength:

[0150]

[0151] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coding block in the j-th frame, frame_strength (Fj) For adaptive dynamic frame level intensity, frame_avg_var (Fj) is the average variance of all coded blocks in the jth frame, block_var (Fj,Bi) is the variance of the i-th coded block in the j-th frame, max_block_cost (Fj) is the maximum variance among the variances of all coded blocks in the jth frame, min_block_cost (Fj) is the minimum variance among the variances of all coding blocks in the jth frame.

[0152] In this embodiment, not only can the frame-level strength of each video frame be adaptively adjusted according to the motion characteristics of the video frame, thereby achieving targeted adjustment of the quantization parameter offset value of the coding block in the video frame, thereby improving video compression efficiency. In addition, by obtaining the spatial feature value of the current frame, the block-level strength of each coding block in the current frame is obtained based on the spatial feature value and the adaptive dynamic frame-level strength, thereby achieving adaptive adjustment of the block-level strength of each coding block according to the spatial feature of each coding block in the video frame, thereby achieving targeted adjustment of the quantization parameter offset value of each coding block in the video frame, thereby improving video compression efficiency.

[0153] Another exemplary embodiment of the present application further provides a quantization parameter optimization method. In this embodiment, when the SKIP mode is used to encode the coding block, the method for calculating the energy transferred outward by the coding block is improved. Figure 6 As shown, the above step 404 or step 506 may include the following steps:

[0154] Step 601 : Calculate the propagation ratio of the current coding block in a frame at a designated position in a preset time window in a backward order; the frame at the designated position is the current frame.

[0155] In this embodiment, the above calculation formula (1) can be used to calculate the propagation ratio of the current coding block in the head frame in the preset time window.

[0156] Step 602 : Calculate the total energy transferred from the current coding block to its reference coding block based on the propagation ratio, the intra-frame cost of the current coding block, and the total energy transferred from all accumulated frames of the current coding block that reference the current coding block in the backward direction.

[0157] In this embodiment, when the SKIP mode is used to encode the current coding block, the energy transferred from the current coding block to its reference coding block can be calculated using the following formula based on the propagation ratio, the intra-frame cost of the current coding block, and the sum of all accumulated energies transferred from the current coding block to the frames that reference the current coding block in the backward direction:

[0158] PropagateCostOut cur_blk =(1+extra_ratio)*PropagateFraction cur_blk* (IntraCost cur_blk +PropagateCostIn cur_blk ) (15)

[0159] Among them, PropagateCostOut cur_blk is the energy transferred from the current coding block to its reference coding block, extra_ratio is the additional weight, PropagateFraction cur_blk IntraCost is the propagation ratio of the current coding block. cur_blk PropagateCostIn is the intra-frame cost of the current coding block, cur_blk It is the sum of the energy transferred from all the frames of the current coding block that are accumulated from the backward reference to the current coding block.

[0160] In one embodiment, extra_ratio may be an experimental value, and the default value may be 1 / 10.

[0161] When the SKIP mode is used to encode the current coding block, the quality of the reference coding block referenced by the current coding block will have a greater impact on the current coding block, that is, the reference coding block is more important. By setting extra_ratio to increase the weight of the reference coding block, the current coding block can transfer more energy to its reference coding block during the reverse transfer calculation.

[0162] Step 603 : Calculate the energy transferred from the current coding block to each of its reference coding blocks based on the total energy transferred from the current coding block to its reference coding blocks and the weight coefficient transferred from the current coding block to each of its reference coding blocks.

[0163] In this embodiment, the energy transferred from the current coding block to the reference coding block in the reference frame may be calculated using the above calculation formula (3) according to the energy transferred outward by the current coding block and the weight coefficient of the current coding block.

[0164] Step 604: traverse all frames in the preset time window in reverse coding order, from the last frame to the first frame, and repeat the above steps.

[0165] In reverse coding order, all frames in the preset time window are traversed, from the last frame to the head frame, and the above steps 601 to 603 are repeated.

[0166] Step 605 : For each coding block in the head frame in the preset time window, the importance of the coding block is calculated according to the sum of all accumulated energies transferred from frames referencing the coding block in the backward direction and its intra-frame cost.

[0167] In this embodiment, the importance of each coding block in the current frame can be calculated using the above calculation formula (9) based on the sum of all accumulated energies transferred from the frames that reference the coding block in the backward direction and the intra-frame cost.

[0168] In summary, in implementing rate-distortion optimization based on a time-dependent model, the primary approach is to estimate the importance of the current coded block in the current frame to the coded blocks in subsequent coded frames based on the reference dependency relationship. The more important the CB, the higher its encoding quality should be. This reduces the amount of residual data when used as a reference for subsequent CBs, improving encoding compression efficiency. Improving encoding quality is achieved by reducing the QP, as a smaller QP preserves more high-frequency information, increasing the amount of encoded data (bitrate), and thus retaining more high-quality information. QP adjustment is achieved by subtracting an appropriate quantization parameter offset (deltaQP) from the original QP. Therefore, CBs with higher assessed importance should be assigned a larger deltaQP value.

[0169] After predictive coding and transforming the CB, residual data is generated. CBs with large residual data have a very sensitive bitrate to changes in QP. That is, even a slight change in QP can significantly alter the amount of compressed data. Significantly reducing the QP in this situation, while preserving the quality of the current CB, also significantly increases the amount of data. For most video scenarios, this does not significantly improve compression efficiency and may even result in a loss of compression efficiency. To balance this and ensure good encoder compression performance, it makes sense to slightly adjust the QP by setting a weaker strength for CBs with large residuals. Video frames and coding blocks with rich textures or intense motion typically generate large residual data. Existing model formulas generally use a fixed frame-level strength when calculating deltaQP. This fails to account for the impact of the aforementioned video content characteristics on compression efficiency and lacks adaptive adjustment capabilities.

[0170] To address the above shortcomings, this application optimizes the existing model so that it can adaptively use different frame-level deltaQP mappings to frame-level strength (frame_strength) and different block-level deltaQP mappings to block-level strength (block_strength), making the model more flexible and improving video compression efficiency.

[0171] Figure 7 FIG. 1 is a block diagram of a quantization parameter optimization device according to an exemplary embodiment. Figure 7 As shown, in this embodiment, the quantization parameter optimization device includes:

[0172] A first calculation module 71 is configured to calculate the motion feature value of the current frame;

[0173] A first acquisition module 72 is configured to acquire an initial frame-level intensity of the current frame;

[0174] The second acquisition module 73 is configured to acquire the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity.

[0175] In one embodiment, the motion feature value is a probability that the current frame is a low-motion frame.

[0176] In one embodiment, Figure 8 As shown, the quantization parameter optimization device further includes:

[0177] A third acquisition module 74 is configured to obtain the importance of each coding block in the current frame;

[0178] The fourth acquisition module 75 is configured to acquire, for each coding block, a quantization parameter offset value of the coding block according to the importance and the adaptive dynamic frame level strength.

[0179] In one embodiment, Figure 9 As shown, the quantization parameter optimization device further includes:

[0180] A fifth acquisition module 76 is configured to acquire the spatial feature value of the current frame;

[0181] a sixth acquisition module 77 configured to acquire a block-level strength of each coding block in the current frame according to the spatial feature value and the adaptive dynamic frame-level strength;

[0182] A seventh acquisition module 78 is configured to obtain the importance of each coding block in the current frame;

[0183] The eighth acquisition module 79 is configured to acquire, for each coding block, a quantization parameter offset value of the coding block according to the block-level strength and the importance.

[0184] In one embodiment, Figure 10 As shown, the third acquisition module 74 or the seventh acquisition module 78 may include:

[0185] The second calculation module 81 is configured to calculate the propagation ratio of the current coding block in the specified position frame in the preset time window in the order from back to front; the specified position frame is the current frame

[0186] A third calculation module 82 is configured to calculate the total energy transferred from the current coding block to its reference coding block based on the propagation ratio, the intra-frame cost of the current coding block, and the total energy transferred from all accumulated frames of the current coding block to the frames that reference the current coding block in the backward direction;

[0187] a fourth calculation module 83, configured to calculate the energy transferred by the current coding block to each of its reference coding blocks based on the sum of the energies transferred by the current coding block to its reference coding blocks and the weight coefficient transferred by the current coding block to each of its reference coding blocks;

[0188] The traversal module 84 is configured to traverse all frames in the preset time window in reverse coding order, from the last frame to the first frame, and repeat the above steps;

[0189] The fifth calculation module 85 is configured to calculate the importance of each coding block in the head frame in the preset time window according to the sum of all accumulated energies transferred from the backward frames referencing the coding block and its intra-frame cost.

[0190] An embodiment of the present application also proposes an electronic device, including a processor and a memory; the memory is used to store a computer program executable by the processor; the processor is used to execute the computer program in the memory to implement the quantization parameter optimization method of any of the above embodiments.

[0191] The embodiments of the present application further provide a computer-readable storage medium. When the executable computer program in the storage medium is executed by a processor, the quantization parameter optimization method of any of the above embodiments can be implemented.

[0192] Regarding the apparatus in the above embodiment, the specific manner in which the processor performs operations has been described in detail in the embodiment of the method, and will not be elaborated on here.

[0193] Figure 11 1 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 1100 can be provided as a server. Figure 11 The device 1100 includes a processing component 1122, which further includes one or more processors, and a memory resource represented by a memory 1132 for storing instructions, such as an application, that can be executed by the processing component 1122. The application stored in the memory 1132 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1122 is configured to execute the instructions to perform the above-mentioned method for quantization parameter optimization.

[0194] The device 1100 may also include a power supply component 1126 configured to perform power management of the device 1100, a wired or wireless network interface 1150 configured to connect the device 1100 to a network, and an input / output (I / O) interface 1158. The device 1100 may operate based on an operating system stored in the memory 1132, such as Windows Server™, MacOS X™, Unix™, Linux™, FreeBSD™, or the like.

[0195] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1132 including instructions, which can be executed by the processing component 1122 of the device 1100 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0196] In the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The term "plurality" refers to two or more, unless otherwise clearly defined.

[0197] The above description of the embodiments is intended to facilitate understanding and application of the present application by those skilled in the art. It will be apparent that those skilled in the art can readily make various modifications to these embodiments and apply the general principles described herein to other embodiments without expending any creative effort. Therefore, the present application is not limited to the embodiments described herein, and improvements and modifications made by those skilled in the art based on the disclosure of this application without departing from the scope and spirit of this application are within the scope of this application.

Claims

1. A quantization parameter optimization method, characterized in that: include: Calculate the motion feature value of the current frame; Obtaining an initial frame-level intensity of the current frame; Obtaining an adaptive dynamic frame-level intensity of a current frame according to the motion feature value and the initial frame-level intensity; After obtaining the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity, the method further includes: Obtaining spatial feature values ​​of the current frame; Obtaining a block-level strength of each coding block in the current frame according to the spatial feature value and the adaptive dynamic frame-level strength; Obtaining the importance of each coding block in the current frame; For each coding block, obtaining a quantization parameter offset value of the coding block according to the block-level strength and the importance; The obtaining, according to the spatial feature value and the adaptive dynamic frame-level strength, a block-level strength of each coding block in the current frame, includes: The block-level strength of each coding block in the current frame is calculated according to the spatial feature value and the adaptive dynamic frame-level strength using the following calculation formula: ; in, block_strength (Fj,Bi) For the j Frame i The block-level strength of the coded blocks, frame_strength (Fj) is the adaptive dynamic frame-level intensity, frame_avg_cv (Fj) For the j The average spatial feature value of all coding blocks in the frame, block_cv (Fj,Bi) For the j Frame i The spatial feature value of the coding block, max_block_cv (Fj) For the j The maximum value of the spatial feature values ​​of all coding blocks in the frame, min_block_cv (Fj) For the j The minimum value of the spatial feature values ​​of all coding blocks in the frame.

2. The quantization parameter optimization method according to claim 1, wherein: The spatial feature value is a texture feature value that can represent a spatial feature, wherein the texture feature value is represented by using an intra-frame cost of a coding block or a variance of a coding block.

3. The quantization parameter optimization method according to claim 1, wherein: The obtaining, for each coding block, a quantization parameter offset value of the coding block according to the block-level strength and the importance, includes: According to the block-level strength and the importance, the quantization parameter offset value of the coding block is calculated using the following formula: ; in, DeltaQP (Fj,Bi) For the j Frame i The quantization parameter offset value of the coding block, block_strength (Fj,Bi) For the j Frame i The block-level strength of the coded blocks, log_dependence (Fj,Bi) For the j Frame i The importance of the coding block.

4. The quantization parameter optimization method according to claim 1, wherein: The obtaining the importance of each coding block in the current frame includes: Calculating a propagation ratio of a current coding block in a specified position frame in a predetermined time window in a backward order; the specified position frame is the current frame; Calculate the total energy transferred from the current coding block to its reference coding block according to the propagation ratio, the intra-frame cost of the current coding block, and the total energy transferred from all accumulated frames of the current coding block to the frames that reference the current coding block in the backward direction; Calculating the energy transferred from the current coding block to each of its reference coding blocks based on the sum of the energies transferred from the current coding block to its reference coding blocks and the weight coefficients transferred from the current coding block to each of its reference coding blocks; In reverse coding order, traverse all frames in the preset time window, from the last frame to the first frame, and repeat the above steps; Finally, for each coding block in the head frame in the preset time window, the importance of the coding block is calculated according to the sum of all accumulated energies transferred from the frames that reference the coding block in the backward direction and its intra-frame cost.

5. The quantization parameter optimization method according to claim 4, wherein: The calculating, based on the propagation ratio, the intra-frame cost of the current coding block, and the sum of all accumulated energies of the current coding block transferred from frames that reference the current coding block in a backward direction, the sum of the energies transferred from the current coding block to its reference coding block includes: When the SKIP mode is used to encode the current coding block, the energy transferred from the current coding block to its reference coding block is calculated using the following formula based on the propagation ratio, the intra-frame cost of the current coding block, and the sum of all accumulated energies of the current coding block transferred from frames that reference the coding block in the backward direction: ; in, PropagateCostOut cur_blk is the energy transferred from the current coding block to its reference coding block, extra_ratio is the additional weight, PropagateFraction cur_blk is the propagation ratio of the current coding block, IntraCost cur_blk is the intra-frame cost of the current coding block, PropagateCostIn cur_blk It is the sum of the energy transferred from all the frames that reference the current coding block to the backward frames.

6. A quantization parameter optimization device, characterized in that: include: A first calculation module is configured to calculate a motion feature value of a current frame; A first acquisition module is configured to acquire an initial frame-level intensity of the current frame; A second acquisition module is configured to acquire the adaptive dynamic frame-level intensity of the current frame according to the motion feature value and the initial frame-level intensity; a fifth acquisition module, configured to acquire the spatial feature value of the current frame; a sixth acquisition module, configured to acquire a block-level strength of each coding block in the current frame according to the spatial feature value and the adaptive dynamic frame-level strength; The obtaining, according to the spatial feature value and the adaptive dynamic frame-level strength, a block-level strength of each coding block in the current frame, includes: The block-level strength of each coding block in the current frame is calculated according to the spatial feature value and the adaptive dynamic frame-level strength using the following calculation formula: ; in, block_strength (Fj,Bi) For the j Frame i The block-level strength of the coded blocks, frame_strength (Fj) is the adaptive dynamic frame-level intensity, frame_avg_cv (Fj) For the j The average spatial feature value of all coding blocks in the frame, block_cv (Fj,Bi) For the j Frame i The spatial feature value of the coding block, max_block_cv (Fj) For the j The maximum value of the spatial feature values ​​of all coding blocks in the frame, min_block_cv (Fj) For the j The minimum value of the spatial feature values ​​of all coding blocks in the frame; a seventh acquisition module, configured to acquire the importance of each coding block in the current frame; An eighth acquisition module is configured to acquire, for each coding block, a quantization parameter offset value of the coding block according to the block-level strength and the importance.

7. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store a computer program executable by the processor; and the processor is used to execute the computer program in the memory to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the executable computer program in the storage medium is executed by a processor, the method according to any one of claims 1 to 5 can be implemented.

Citation Information

Patent Citations

  • Quantification adjustment method and system based on exercise intensity detection

    CN103281532A

  • Image coding method and device, equipment and storage medium

    CN113784126A