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

By calculating the motion characteristic value and spatial characteristic value of the video frame in video compression encoding, adaptively adjusting the frame level and block level intensity, and targeting the quantization parameter offset value of the coded block, the problem of failing to fully utilize video characteristics in the prior art is solved, and video compression efficiency and encoding quality are improved.

CN119562066AActive Publication Date: 2025-03-04RONG MING MICROELECTRONICS (JINAN) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

When calculating the offset value of the encoding block quantization parameter in video frames, the existing time-dependent model fails to fully consider the motion characteristics and airspace characteristics of the video image, resulting in low encoding efficiency.

Method used

By calculating the motion characteristic value of the video frame, the frame-level intensity is adaptively adjusted, and the block-level intensity is adjusted in combination with the spatial characteristic value, thereby targeting the quantized parameter offset value of the encoded block.

Benefits of technology

Improve video compression efficiency, and improve encoding quality and compression performance through more precise quantitative parameter adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119562066A_ABST
    Figure CN119562066A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of video compression coding, in particular to a quantization parameter optimization method and device, electronic equipment and a storage medium. The quantization parameter optimization method comprises the following steps: dynamically adjusting the frame-level strength of each video frame in a model by acquiring the motion characteristics of the video frames when the quantization parameters of the coding blocks are adjusted by utilizing a time-dependent model, and adjusting the block-level strength of each coding block in the model by acquiring the spatial characteristics of the intra-frame coding blocks. According to the technical scheme provided by the invention, the original mode of adopting constant intensity when the quantization parameter is adjusted based on a time-dependent model can be changed, the frame-level intensity of each video frame and the block-level intensity of the intra-frame coding block are adaptively adjusted according to the motion features and the spatial features of the video frames, and the quantization parameter is adjusted through the adaptation of the intensity of the two-level model. Therefore, the quantization parameter offset value of the coding block in the video frame is adjusted in a targeted manner, and the video compression efficiency is improved.
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 equipment and storage medium suitable for video compression coding. Background Art

[0002] In the related art, in the implementation of rate-distortion optimization based on the time-dependent model, the degree of dependence of the current coding block in the current frame on the coding block in the subsequent coding frame is generally evaluated through reverse transfer calculation based on the reference dependency relationship. The more important coding block (Coding Block, referred to as CB) will have its quantization parameter (Quantization Parameter, referred to as QP) lowered to improve the encoding quality, thereby reducing the amount of residual data in the subsequent CB encoding and improving the encoding compression efficiency. However, the existing time-dependent model uses a uniform fixed strength (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 difference between different frame images (Frame) in the time domain, and the difference between coding blocks in the spatial domain. These characteristics will affect the benefits of the algorithm. Summary of the invention

[0003] The purpose of the present application is to provide a quantization parameter optimization method, device, electronic device and storage medium, which can adaptively adjust the frame-level strength of each video frame according to the motion characteristics of the video frame based on the existing time-dependent model, thereby achieving targeted adjustment of the quantization parameter offset value of the coding block in the video frame, thereby improving the 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 implementation, the motion feature value is a probability that the current frame is a low-motion frame.

[0009] In one implementation, 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 jth frame is a low motion frame, block_cnt_inter is the number of coding blocks in the jth frame that satisfy the inter-frame cost is less than the intra-frame cost, block_cnt_motion is the number of coding blocks in the jth frame that satisfy the inter-frame cost is 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 jth frame.

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

[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 implementation, the calculation formula for the initial frame level strength 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 implementation, 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 of the coding blocks, a quantization parameter offset value of the coding block is obtained according to the block-level strength and the importance.

[0023] In one implementation, 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] According to the spatial feature value and the adaptive dynamic frame-level strength, the block-level strength of each coding block in the current frame is calculated using the following calculation formula:

[0025]

[0026] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coded block in the j-th frame, frame_strength (Fj) is the adaptive dynamic frame level strength, frame_avg_cv (Fj) is the average spatial feature value of all coded 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) is the maximum spatial feature value among all the spatial feature values ​​of the coding blocks in the jth frame, min_block_cv (Fj) is the minimum spatial feature value among the spatial feature values ​​of all coding blocks in the jth frame.

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

[0028] In one implementation, for each of the coding blocks, obtaining the 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 calculation 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] Calculate the propagation ratio of the current coding block in the specified position frame in the preset 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 of all accumulated frames of the current coding block transferred from the backward reference to the current coding block;

[0035] Calculate the energy transferred from the current coding block to each of its reference coding blocks according to the sum of the energies 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;

[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 transmitted from the frames that reference the coding block in the backward direction and its intra-frame cost.

[0038] In one embodiment, the calculating the sum of 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 sum of energy transferred from all accumulated frames of the current coding block that refer to 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 according to the propagation ratio, the intra-frame cost of the current coding block, and the sum of all accumulated energies of the current coding block from frames transferred from the backward reference to the coding block:

[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 to the current coding block from all the frames that reference the coding block in the backward direction.

[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 lies in: by calculating the motion feature value of the current frame and obtaining the initial frame-level strength of the current frame, and then obtaining the adaptive dynamic frame-level strength of the current frame according to the motion feature value and the initial frame-level strength, the frame-level strength 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 It is a schematic diagram showing the relationship between a current coding block and a reference coding block according to the related art.

[0050] Figure 2 It is a schematic diagram showing a method of optimizing the rate-distortion of an encoder using a time-dependent model according to the related art.

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

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

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

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

[0055] Figure 7 The figure is a block diagram of 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] Fig. 9 is a block diagram of a quantization parameter optimization device according to another exemplary embodiment.

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

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

[0060] Unless otherwise defined, the technical terms or scientific terms used in this specification and claims shall have the usual meanings understood by persons with ordinary skills in the technical field to which the invention belongs. The 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, in order to provide a concise description, it is impossible for this specification to provide a detailed description of all the 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 technologies 1

[0062] The processing object of the video encoder is a sequence of video images, referred to as a video sequence. A video sequence is a collection of multiple frames of video images (Frame) in time order. The encoder encodes by Frame, and each Frame is divided into several coding blocks (CB). For the encoding of each CB, the adjacent CB is sometimes used as a coding reference to achieve compression based on similarity.

[0063] like Figure 1As shown, poc represents the image order index (image ordinal number), that is, the temporal position of each frame image 10 in the video sequence; the shaded block inside 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 will affect the quality of CB coding. The smaller the QP, the higher the video quality, and vice versa. The quality of the reference frame image 15 will affect the quality of the frames that use it as a reference for coding in the future. If the CB in the current frame image 16 is frequently referenced by the CB in the subsequent coding frame 17, it means that its importance is higher and it needs to be coded with higher quality, that is, the value of its QP needs to be reduced.

[0065] Related Technology 2

[0066] The rate-distortion optimization of the encoder using the time-dependent model is actually implemented in some open source video encoders, such as the "macroblock tree" (MBtree) in the x264 encoder. Figure 2 In order to estimate the importance of each CB and the energy propagated to future frames, the MBtree algorithm applies a model that uses the coding statistics collected over a certain length of time, and calculates deltaQP by backpropagating it to each current coding block 13, according to the formula.

[0067] Figure 2 In the figure, the coding block 11 is divided into three types: the current coding block 13, the reference coding block 14 and the non-reference coding block 17. The non-reference coding block 17 is not used as a reference when encoding the current coding block 13. t0, t1, t2, t3, and t4 represent a time window with a length of 5 frames, that is, from the current frame (head frame) at time t0 to the end frame at time t4. The coding blocks 11 located on the same row represent the coding blocks 11 in the same frame at that moment. The direction 18 of the back propagation calculation is determined according to the reference relationship between the coding blocks 11 in the actual coding, that is, the back propagation is performed from the coding block to its reference block. According to the reverse coding order, first start from the frame at time t4, traverse each coding block 11 in the frame, and propagate the calculation to the reference block in its reference frame according to its reference relationship. Then the frame at time t3 is followed by the same process, and finally all the coding blocks 11 in the frame at time t0 are accumulated, and the deltaQP (quantization parameter offset value) of all the coding blocks 11 in the frame are calculated.

[0068] The statistics used in the back-propagation 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 the QP offset (deltaQP).

[0070] A. Propagation Computation (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 transmitted 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 the 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] In the above formula (2), PropagateCostOut 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 backward, 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. The 0th frame in the time window is the head frame.

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

[0082] C. Calculate 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 frame-level strength value, 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] The current algorithm model usually produces a negative deltaQP, which will make the QP used to encode the residual smaller than the original value, that is, it will retain more high-quality information by increasing the amount of encoded data (bitrate). However, for CBs with large residuals, their bitrate is very sensitive to changes in QP, and a significant reduction in QP does not bring much compression efficiency savings. In order to balance this and make the encoder have good compression performance, it makes sense to set a lower intensity to adjust the QP for coding blocks with large residuals. Usually, video frames and CBs with features such as rich texture areas or intense motion will have large residuals.

[0090] However, the existing time-dependent model uses a uniform and fixed frame-level strength value 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 difference between different frame images (Frame) in the time domain and the difference between coding blocks in the spatial domain, which will affect the benefit of the algorithm. Therefore, the existing time-dependent model lacks adaptive adjustment function when calculating the QP offset value (deltaQP) of the CB.

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

[0092] Figure 3 is a flow chart of a quantization parameter optimization method according to an exemplary embodiment. The quantization parameter optimization method can be applied to an encoder. In this implementation, the frame level strength 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, calculating the motion feature value of the current frame.

[0094] If we do not consider the distribution characteristics of the video image content itself in the spatial domain, no matter whether the coding block is encoded by Intra (intra-frame) or Inter (inter-frame), the coding block can be divided into three categories: low-motion area, general motion area and high-motion area. When the proportion of low-motion area in the video frame is relatively large, the video frame is a low-motion frame, and when the proportion of low-motion area is relatively small, the video frame is 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 calculation formula:

[0097]

[0098] Among them, low_motion_ration(Fj) is the probability that the jth frame is a low motion frame, block_cnt_inter is the number of coding blocks in the jth frame that satisfy the inter-frame cost is less than the intra-frame cost, block_cnt_motion is the number of coding blocks in the jth frame that satisfy the inter-frame cost is less than the intra-frame cost and the motion vector is a non-zero value during inter-frame prediction, and number_of_blocks is the number of all coding blocks in the jth 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, obtaining the initial frame level strength of the current frame.

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

[0102] frame_strength0=strenthRatio*DQP_STRENGTH (7)

[0103] Among them, strenthRatio is the strength scaling factor, which is a parameter configurable by the customer. The customer can set the maximum strength amplitude by configuring the strength scaling factor. DQP_STRENGTH is a fixed strength reference value, which is a fixed strength parameter in the original time-dependent model, and the default value is 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 strength of the current frame may be calculated based on the motion feature value and the initial frame level strength. In one embodiment, the adaptive dynamic frame level strength may be calculated based on the motion feature value and the initial frame level strength 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] It can be seen from the above formula (3) 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 will be 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, by calculating the motion feature value of the current frame and obtaining the initial frame level strength of the current frame, and then obtaining the adaptive dynamic frame level strength of the current frame based on the motion feature value and the initial frame level strength, the frame level strength 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 is a flow chart of a quantization parameter optimization method according to another exemplary embodiment. Figure 4 , the quantization parameter optimization method may include the following steps:

[0113] Step 401, calculating the motion feature value of the current frame.

[0114] Step 402, obtaining the initial frame level strength 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-mentioned 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 may be calculated using the following calculation formula (9): wherein the derivation process of calculation formula (9) is similar to that of calculation 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 frames that reference this CB in the backward direction to the i-th CB in the j-th 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 may be calculated using the following calculation 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 strength 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 is a flow chart of a quantization parameter optimization method 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, calculating the motion feature value of the current frame.

[0128] Step 502, obtaining the initial frame level strength 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-mentioned steps 301 to 303 and will not be described in detail here.

[0131] Step 504, obtaining the spatial feature value of the current frame.

[0132] In the process of adaptively adjusting 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 characterize the spatial feature, wherein the texture feature value can be characterized by using 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 may adopt the intra-frame cost (IntraCost) of the coding block or the variance (Variance) of the coding block. For a CB, a larger value of its intra-frame cost or variance means that it is likely to be a texture area. For a CB in a texture area, it is necessary to reduce the generation of deltaQP by reducing the strength 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 calculation formula:

[0137]

[0138] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coded block in the j-th frame, frame_strength (Fj) is the adaptive dynamic frame level strength, frame_avg_cv (Fj) is the average spatial feature value of all coded 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 in detail 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 calculation 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, and the block-level strength of each coding block in the current frame can be calculated using the following calculation formula according to 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 coded 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 coded block in the j-th frame, max_block_cost (Fj) is the maximum intra-frame cost among all the intra-frame costs of the coded blocks in the jth frame, min_block_cost (Fj) is the minimum intra-frame cost among the 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 according to the variance and the adaptive dynamic frame-level strength using the following calculation formula:

[0150]

[0151] Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coded 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 ith coded block in the jth frame, max_block_cost (Fj) is the maximum variance among all the coded blocks in the jth frame, min_block_cost (Fj) is the minimum variance among the variances of all coded 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, but also the quantization parameter offset value of the coding block in the video frame can be adjusted in a targeted manner to improve the video compression efficiency. Moreover, by obtaining the spatial feature value of the current frame, the block-level strength of each coding block in the current frame is obtained according to the spatial feature value and the adaptive dynamic frame-level strength, so as to adaptively adjust the block-level strength of each coding block according to the spatial feature of each coding block in the video frame, so as to achieve targeted adjustment of the quantization parameter offset value of each coding block in the video frame, and improve the 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 transmitted to the outside 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, calculating the propagation ratio of the current coding block in a frame at a specified position in a preset time window in a sequence from back to front; the frame at the specified position is the current frame.

[0155] In this embodiment, the above calculation formula (1) may 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 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 that refer to 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 calculation formula according to 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 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 is the intra-frame cost of the current coding block, PropagateCostIn cur_blk It is the sum of the energy transferred to the current coding block from all the accumulated frames that reference the current coding block from the backward direction.

[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 according to the sum of the energies 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 transmitted by the current coding block to the reference coding block in the reference frame can be calculated using the above calculation formula (3) according to the energy transmitted by the current coding block to the outside 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 head frame, and repeat the above steps.

[0165] In the 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 transmitted from the frames that reference 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) according to the sum of all accumulated energies transmitted from frames that reference the coding block in the backward direction and the intra-frame cost.

[0168] In summary, in the implementation of rate-distortion optimization based on the time-dependent model, the importance of the current coding block in the current frame to the coding block in the subsequent coding frame is mainly estimated based on the reference dependency relationship. The more important the CB is, the better its coding quality should be. In this way, when it is referenced by the subsequent CB for coding, the amount of residual data can be reduced and the coding compression efficiency can be improved. Improving the coding quality is achieved by reducing the QP, because a smaller QP retains more high-frequency information, increases the amount of encoded data (bit rate), and thus retains more high-quality information. The adjustment of QP is to subtract an appropriate quantization parameter offset value (deltaQP) from the original QP. Therefore, a larger deltaQP value should be given to the CB with a higher degree of importance.

[0169] After predictive coding and transformation of CB, residual data is obtained. For CB with large residual data, its bit rate is very sensitive to changes in QP, that is, a slight change in QP will cause a large change in the amount of data after compression. At this time, if QP is greatly reduced, while retaining the quality of the current CB, the amount of data is also greatly increased. For most video scenes, this does not significantly improve the compression efficiency, and sometimes even leads to a loss of compression efficiency. In order to balance this and make the encoder have good compression performance, it makes sense to slightly adjust the QP for CB with large residuals by setting a weaker strength. Usually, video frames and coding blocks with rich texture content or features such as intense motion will produce large residual data. However, the frame-level strength used in the existing model formula when calculating deltaQP is generally a fixed value, that is, the impact of the characteristics of the video content itself on the compression efficiency mentioned above is not considered, and the adaptive adjustment function is lacking.

[0170] In view of the above shortcomings, the present application optimizes the design of the existing model so that the existing model can adaptively adopt different frame-level deltaQP mapping frame-level strength (frame_strength) and different block-level deltaQP mapping block-level strength (block_strength), so that the model has better flexibility and improves 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 a motion feature value of a 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 also 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 of the coding blocks, a quantization parameter offset value of the coding block according to the importance and the adaptive dynamic frame level strength.

[0179] In one embodiment, Fig. 9 As shown, the quantization parameter optimization device also 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 is 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 acquire the importance of each coding block in the current frame;

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

[0184] In one embodiment, Fig.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 a sequence 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 according to the propagation ratio, the intra-frame cost of the current coding block, and the total energy of all accumulated frames of the current coding block transferred from the backward reference to the current coding block;

[0187] A fourth calculation module 83 is configured to calculate the energy transferred by the current coding block to each of its reference coding blocks according to 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 head 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 transmitted 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 device in the above embodiment, the specific manner in which the processor performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.

[0193] Fig.11 1 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 1100 may be provided as a server. Fig.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 executable by the processing component 1122, such as an application. 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 instructions to perform the above-mentioned method for quantization parameter optimization.

[0194] The device 1100 may also include a power 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 cannot be understood as indicating or implying relative importance. The term "plurality" refers to two or more than two, unless otherwise clearly defined.

[0197] The above description of the embodiments is to facilitate those of ordinary skill in the art to understand and apply the present application. It is obvious that those familiar with the art can easily make various modifications to these embodiments and apply the general principles described herein to other embodiments without having to pay creative labor. Therefore, the present application is not limited to the embodiments herein, and improvements and modifications made by those skilled in the art based on the contents disclosed in the present application without departing from the scope and spirit of the present application are within the scope of the present 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; Acquire 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 strength of the current frame according to the motion feature value and the initial frame level strength, 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 of the coding blocks, a quantization parameter offset value of the coding block is obtained according to the block-level strength and the importance.

2. The quantization parameter optimization method according to claim 1, characterized in that: 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 comprises: According to the spatial feature value and the adaptive dynamic frame-level strength, the block-level strength of each coding block in the current frame is calculated using the following calculation formula: Among them, block_strength (Fj,Bi) is the block-level strength of the i-th coded block in the j-th frame, frame_strength (Fj) is the adaptive dynamic frame level strength, frame_avg_cv (Fj) is the average spatial feature value of all coded 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) is the maximum value of the spatial feature values ​​of all coding blocks in the jth frame, min_block_cv (Fj) is the minimum value of the spatial feature values ​​of all coding blocks in the jth frame.

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

4. The quantization parameter optimization method according to claim 1, characterized in that: The step of obtaining, for each coding block, a quantization parameter offset value of the coding block according to the block-level strength and the importance level includes: According to the block level strength and the importance, the quantization parameter offset value of the coding block is calculated using the following calculation formula: DeltaQP (Fj,Bi) =-block_strength (Fj,Bi) *log_dependence (Fj,Bi) ; 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.

5. The quantization parameter optimization method according to claim 1, characterized in that: The obtaining the importance of each coding block in the current frame includes: Calculate the propagation ratio of the current coding block in the specified position frame in the preset 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 of all accumulated frames of the current coding block transferred from the backward reference to the current coding block; Calculate the energy transferred from the current coding block to each of its reference coding blocks according to the sum of the energies 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; 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 transmitted from the frames that reference the coding block in the backward direction and its intra-frame cost.

6. The quantization parameter optimization method according to claim 5, characterized in that: The calculating the sum of 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 sum of all accumulated energies of the current coding block transferred from frames that reference the current coding block in the backward direction 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 according to the propagation ratio, the intra-frame cost of the current coding block, and the sum of all accumulated energies of the current coding block from frames transferred from the backward reference to the coding block: PropagateCostOut cur_blk =(1+extra_ratio)*PropagateFraction cur_blk *(IntraCost cur_blk +PropagateCostIn cur_blk ); 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 is the intra-frame cost of the current coding block, PropagateCostIn cur_blk It is the sum of the energy transferred to the current coding block from all the frames that reference the coding block in the backward direction.

7. 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 is 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; A seventh acquisition module is configured to acquire the importance of each coding block in the current frame; The eighth acquisition module is configured to acquire, for each of the coding blocks, a quantization parameter offset value of the coding block according to the block-level strength and the importance.

8. 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 6.

9. 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 6 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

  • Encoding method, encoder and computer readable storage medium

    CN114979640A

  • Encoding blocks in video frames containing text using histograms of gradients

    US20160014421A1