Quantization parameter adjustment method and device and related equipment
By estimating importance and estimating quantization distortion of the video encoding tree unit CTU and adjusting the quantization parameter offset, the problem of quantization parameter deviation in the video encoding process is solved and encoding efficiency is improved.
Patent Information
- Application Number
- CN202411960644.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-11
AI Technical Summary
In the video encoding process, the quantization parameters after the motion compensation time domain filtering module appear to be biased, affecting the encoding efficiency of the encoder.
By acquiring the target encoding tree unit CTU in the video frame to be processed, the importance estimation is performed based on the preset algorithm, the initial quantization parameter offset is obtained, and the offset is adjusted through the quantization distortion estimation, and the target quantization parameter offset is obtained.
The accuracy of the quantization parameter offset is improved, ensuring that the target CTU uses appropriate quantization parameters, and effectively improving the encoding efficiency of the video.
Smart Images

Figure CN119815002A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video processing technology, and in particular to a quantization parameter adjustment method, a quantization parameter adjustment device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the video encoding process, the bit rate control module is used to analyze the input source video and determine the quantization parameter (QP) used to control the compression quality. However, the motion compensated temporal filter (MCTF) module is usually placed after the bit rate control module. The source video is modified after the MCTF filter, which makes the quantization parameter determined based on the source video used in the video image after the MCTF filter, resulting in deviations in the quantization parameter, affecting the encoding efficiency of the encoder.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The present disclosure provides a quantization parameter adjustment method, a quantization parameter adjustment device, an electronic device, a computer-readable storage medium, and a computer program product to overcome the above problems or at least partially solve the above problems.
[0005] The present disclosure provides a quantization parameter adjustment method, which includes: obtaining a target coding tree unit CTU in a video frame to be processed; performing importance estimation on the target CTU based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU; performing quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU; and adjusting the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU.
[0006] In some embodiments of the present disclosure, the performing quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU includes: acquiring each image block in the target CTU, performing quantization distortion estimation on the image block, and obtaining a quantization factor of the image block; determining an average quantization factor of the target CTU according to the quantization factors of all image blocks in the target CTU; determining a degree of quantization distortion of the target CTU relative to the processed video frame according to the average quantization factor of the target CTU and an average quantization factor of CTUs other than the target CTU in the video frame to be processed; and determining quantization distortion information of the target CTU according to the degree of quantization distortion of the target CTU relative to the processed video frame.
[0007] In some embodiments of the present disclosure, the estimating quantization distortion of the image block to obtain the quantization factor of the image block includes: acquiring a prediction block of the image block; determining the pre-quantization prediction distortion of the image block according to the prediction block of the image block; determining the residual block of the image block according to the prediction block of the image block and the image block, performing quantization transformation processing on the residual block of the image block to obtain a quantized residual block; determining the post-quantization prediction distortion of the image block according to the quantized residual block; and calculating the quantization factor of the image block based on the post-quantization prediction distortion of the image block and the pre-quantization prediction distortion of the image block.
[0008] In some embodiments of the present disclosure, obtaining the prediction block of the image block includes: searching for a first matching block matching the image block in an adjacent reference frame of the video frame to be processed, and calculating a first distortion value between the image block and the first matching block; searching for a second matching block matching the image block in the video frame to be processed, and calculating a second distortion value between the image block and the second matching block; determining a smaller distortion value between the first distortion value and the second distortion value, and using the matching block corresponding to the smaller distortion value as the prediction block of the image block.
[0009] In some embodiments of the present disclosure, adjusting the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU includes: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, reducing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0, increasing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU.
[0010] In some embodiments of the present disclosure, in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, reducing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU, including: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, and the quantization distortion information of the target CTU being less than a first preset threshold, reducing the initial quantization parameter offset of the target CTU by a first offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, and the quantization distortion information of the target CTU being less than a second preset threshold, reducing the initial quantization parameter offset of the target CTU by a second offset to obtain the target quantization parameter offset of the target CTU.
[0011] In some embodiments of the present disclosure, in response to the initial quantization parameter offset of the target CTU being less than 0, increasing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU, including: in response to the initial quantization parameter offset of the target CTU being less than 0, and the quantization distortion information of the target CTU being greater than a third preset threshold, increasing the initial quantization parameter offset of the target CTU by a third offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0, and the quantization distortion information of the target CTU being greater than a fourth preset threshold, increasing the initial quantization parameter offset of the target CTU by a fourth offset to obtain the target quantization parameter offset of the target CTU.
[0012] In some embodiments of the present disclosure, the preset algorithm includes a block importance mapping algorithm.
[0013] An embodiment of the present disclosure provides a quantization parameter adjustment device, which includes: an offset acquisition unit, configured to acquire a target CTU in a video frame to be processed; performing importance estimation on the target CTU based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU; a quantization distortion estimation unit, configured to perform quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU; and an offset adjustment unit, configured to adjust the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU.
[0014] In some embodiments of the present disclosure, the quantization distortion estimation unit is further configured to: obtain each image block in the target CTU, perform quantization distortion estimation on the image block, and obtain a quantization factor of the image block; determine an average quantization factor of the target CTU based on the quantization factors of all image blocks in the target CTU; determine a degree of quantization distortion of the target CTU relative to the processed video frame based on the average quantization factor of the target CTU and the average quantization factor of CTUs other than the target CTU in the video frame to be processed; determine quantization distortion information of the target CTU based on the degree of quantization distortion of the target CTU relative to the processed video frame.
[0015] In some embodiments of the present disclosure, the quantization distortion estimation unit is further configured to: obtain a prediction block of the image block; determine the pre-quantization prediction distortion of the image block based on the prediction block of the image block; determine the residual block of the image block based on the prediction block of the image block and the image block, perform quantization transformation processing on the residual block of the image block to obtain a quantized residual block; determine the post-quantization prediction distortion of the image block based on the quantized residual block; and calculate the quantization factor of the image block based on the post-quantization prediction distortion of the image block and the pre-quantization prediction distortion of the image block.
[0016] In some embodiments of the present disclosure, the quantization distortion estimation unit is further configured to: search for a first matching block matching the image block in an adjacent reference frame of the video frame to be processed, and calculate a first distortion value between the image block and the first matching block; search for a second matching block matching the image block in the video frame to be processed, and calculate a second distortion value between the image block and the second matching block; determine a smaller distortion value between the first distortion value and the second distortion value, and use the matching block corresponding to the smaller distortion value as a prediction block of the image block.
[0017] In some embodiments of the present disclosure, the offset adjustment unit is further configured to: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, reduce the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0, increase the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU.
[0018] In some embodiments of the present disclosure, the offset adjustment unit is further configured to: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0 and the quantization distortion information of the target CTU being less than a first preset threshold, reduce the initial quantization parameter offset of the target CTU by a first offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0 and the quantization distortion information of the target CTU being less than a second preset threshold, reduce the initial quantization parameter offset of the target CTU by a second offset to obtain the target quantization parameter offset of the target CTU.
[0019] In some embodiments of the present disclosure, the offset adjustment unit is further configured to: in response to the initial quantization parameter offset of the target CTU being less than 0 and the quantization distortion information of the target CTU being greater than a third preset threshold, increase the initial quantization parameter offset of the target CTU by the third offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0 and the quantization distortion information of the target CTU being greater than a fourth preset threshold, increase the initial quantization parameter offset of the target CTU by a fourth offset to obtain the target quantization parameter offset of the target CTU.
[0020] In some embodiments of the present disclosure, the preset algorithm includes a block importance mapping algorithm.
[0021] An embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the executable instructions to implement the above-mentioned quantization parameter adjustment method.
[0022] An embodiment of the present disclosure provides a computer-readable storage medium. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the above-mentioned quantization parameter adjustment method.
[0023] An embodiment of the present disclosure provides a computer program product, including a computer program, and when the computer program is executed by a processor, the above-mentioned quantization parameter adjustment method is implemented.
[0024] The quantization parameter adjustment method provided by the embodiment of the present disclosure performs importance estimation on the target CTU based on a preset algorithm to obtain the initial quantization parameter offset of the target CTU; introduces quantization distortion estimation, that is, introduces a quantization transformation process in the pre-analysis process, based on which quantization distortion estimation is performed to obtain quantization distortion information of the target CTU; and then adjusts its initial quantization parameter offset according to the quantization distortion information of the target CTU, and finally determines the target quantization parameter offset of the target CTU. In this way, by introducing importance estimation and quantization distortion estimation, a precise target quantization parameter offset can be calculated for the target CTU, thereby improving the accuracy of the quantization parameter offset, ensuring that the target CTU uses appropriate quantization parameters, and effectively improving the encoding efficiency of the video.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0027] Figure 1 A schematic diagram showing the relationship between the rate control module and the MCTF module in the video coding framework;
[0028] Figure 2 A schematic diagram showing an exemplary system architecture to which the quantization parameter adjustment method according to an embodiment of the present disclosure can be applied;
[0029] Figure 3 A flow chart of a quantization parameter adjustment method according to an embodiment of the present disclosure is shown;
[0030] Figure 4 A schematic diagram showing MCTF processing of a video frame to be processed according to an embodiment of the present disclosure is shown;
[0031] Figure 5 A flowchart of performing quantization distortion estimation on a target CTU to obtain quantization distortion information of the target CTU in a quantization parameter adjustment method according to an embodiment of the present disclosure is shown;
[0032] Figure 6 A flow chart showing the process of performing quantization distortion estimation on an image block to obtain a quantization factor of the image block in the quantization parameter adjustment method according to an embodiment of the present disclosure is shown;
[0033] Figure 7A block diagram of a quantization parameter adjustment device according to an embodiment of the present disclosure is shown;
[0034] Figure 8 A schematic structural diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0035] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0036] The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0037] The collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of the user personal information involved in this disclosure are in compliance with the relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0038] The accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in at least one hardware module or integrated circuit, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0039] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0040] In this specification, the terms "a", "an", "the", "said" and "at least one" are used to indicate the presence of at least one element / component / etc.; the term "plurality" refers to two or more; the terms "comprising", "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first", "second" and "third" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0041] Figure 1 The diagram shows the relationship between the bit rate control module and the MCTF module in the video coding framework. The bit rate control module is used to guide the encoder to encode each image block in the video image, so as to maximize the video compression efficiency. The bit rate control module analyzes the input source video and determines the quantization parameter used to control the image compression quality. The quantization parameter value is inversely correlated with the image quality. The lower the quantization parameter, the higher the image quality. MCTF is a pre-coding processing filtering algorithm widely used by many coding standards. The algorithm is used to remove the temporal noise of the video before encoding, so as to improve the overall coding compression rate of the video.
[0042] like Figure 1 As shown, in the video encoding process, the MCTF module is placed after the bit rate control module. After MCTF processing, the source video is filtered and modified, which makes the quantization parameters determined based on the source video used in the video image after MCTF filtering, resulting in deviations in the quantization parameters, affecting the encoding efficiency of the encoder.
[0043] In the related art, a block-level QP adjustment method based on MCTF motion compensation information is proposed, such as the Block Importance Mapping (BIM) algorithm. However, this method only considers the motion compensation distortion solved by MCTF in the QP adjustment process, but is not directly related to the quantization parameter. In particular, the MCTF motion compensation process is based on the uncoded original frame, which means that given any initial coding parameters, the motion compensation distortion solved is consistent. Therefore, the QP offset obtained by this method is also consistent for any baseline quantization parameter, which makes it difficult to achieve accurate QP offset estimation for different baseline quantization parameters. In other words, the quantization operation in the encoding process will affect the motion estimation and compensation process, resulting in different motion distortion estimation results for different input quantization parameters, but this is not considered in this method.
[0044] In order to solve the above problems, the embodiment of the present disclosure provides a quantization parameter adjustment method, which introduces quantization distortion estimation, that is, a quantization transformation process is introduced in the pre-analysis process to estimate the quantization distortion, so as to obtain the quantization distortion information of the coding tree unit (Coding Tree Unit, CTU), and then use the quantization distortion information of the CTU to adjust the initial quantization parameter offset to obtain the target quantization parameter offset, thereby improving the accuracy of the quantization parameter offset and effectively improving the coding efficiency of the video.
[0045] Figure 2 A schematic diagram showing an exemplary system architecture to which the quantization parameter adjustment method according to an embodiment of the present disclosure can be applied.
[0046] like Figure 2 As shown, the system architecture may include a server 201, a network 202 and a terminal device 203. The network 202 is used to provide a medium for a communication link between the terminal device 203 and the server 201. The network 202 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0047] In an exemplary embodiment, the terminal device 203 for data transmission with the server 201 may include but is not limited to a smart phone, a tablet computer, a laptop computer, a smart speaker, a digital assistant, an AR (Augmented Reality) device, a VR (Virtual Reality) device, a smart wearable device, etc., or the terminal device 203 may also be a personal computer, such as a laptop computer and a desktop computer, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux, Windows, etc.
[0048] Server 201 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some practical applications, server 201 can also be a server of a network platform, which can be, for example, a trading platform, a live broadcast platform, a social platform, or an audio platform, etc., which is not limited in the embodiments of the present disclosure. Among them, the server can be a single server or a cluster formed by multiple servers, and the present disclosure does not limit the specific architecture of the server.
[0049] In some embodiments of the present disclosure, the process of adjusting the quantization parameter by the server 201 may be: obtaining a target coding tree unit CTU in a video frame to be processed; performing importance estimation on the target CTU based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU; performing quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU; adjusting the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU.
[0050] In addition, it should be noted that Figure 2 What is shown is only one application environment of the quantization parameter adjustment method provided by the present disclosure. Figure 2 The number of terminal devices 203, networks 202 and servers 201 is only for illustration, and any number of terminal devices, networks and servers may be provided according to actual needs.
[0051] Figure 3 A flowchart of a quantization parameter adjustment method according to an embodiment of the present disclosure is shown. Figure 3 The execution subject of the method provided in the embodiment may be any electronic device, such as Figure 2 The server 201 in the embodiment is also as follows Figure 2 The terminal device 203 in Figure 2 The server 201 and the terminal device 203 in the embodiment jointly implement the quantization parameter adjustment method, but the present disclosure is not limited thereto. Figure 3 The quantization parameter adjustment method provided by the embodiment of the present disclosure includes the following steps.
[0052] Step S310: obtaining a target CTU in a video frame to be processed.
[0053] The video frame to be processed is composed of a series of pixel data, which is further decomposed into smaller processing units, namely CTU. CTU can be regarded as the basic unit for segmenting video frames in video encoding. Specifically, it can be divided into blocks of different sizes according to different resolutions, such as 128x 128, 64x64, 32x32 and other sizes.
[0054] In the disclosed embodiment, the video frame to be processed includes one or more CTUs, and the quantization parameter of each CTU is adjusted to obtain the target quantization parameter offset of the CTU, wherein the target CTU can be understood as a CTU that is being processed or about to have its quantization parameter adjusted.
[0055] Step S320: Estimate the importance of the target CTU based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU.
[0056] In the disclosed embodiment, when adjusting the quantization parameter of the target CTU, the target CTU may be processed based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU, and the initial quantization parameter offset may be adjusted subsequently. The preset algorithm may be understood as a method for evaluating the importance of a CTU, which may be evaluated based on a variety of factors, such as the content complexity, texture information, motion information, etc. of the CTU, and an initial quantization parameter offset may be allocated to the target CTU, and the initial quantization parameter offset may be adjusted subsequently.
[0057] Step S330: perform quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU.
[0058] In the disclosed embodiment, a quantization transformation process is introduced in the pre-analysis process, based on which quantization distortion estimation is performed to obtain quantization distortion information of the target CTU.
[0059] Among them, the quantization distortion information of the target CTU can be used to evaluate the impact of quantization distortion on video quality. For example, when the quantization distortion is large, it means that the current quantization parameter may be too high, resulting in a decrease in image quality. On the contrary, when the quantization distortion is small, it means that the current quantization parameter may be moderate or low, and the image quality is well maintained.
[0060] Step S340: adjusting the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU.
[0061] In the disclosed embodiment, the target quantization parameter offset of the target CTU refers to the offset of the quantization parameter of the target CTU adjusted in order to optimize the coding efficiency and video quality during the video encoding process. After obtaining the initial quantization parameter offset and quantization distortion information of the target CTU, the initial quantization parameter offset is adjusted according to the quantization distortion information to obtain the target quantization parameter offset of the target CTU.
[0062] According to the above method, after adjusting the quantization parameters of one or more CTUs in the processed video frame, the target quantization parameter offset of each CTU is obtained, and the encoder uses these target quantization parameter offsets to adjust the quantization parameters of the corresponding CTU, and then uses the adjusted quantization parameters for quantization processing, and performs subsequent encoding operations based on this.
[0063] The quantization parameter adjustment method provided by the embodiment of the present disclosure performs importance estimation on the target CTU based on a preset algorithm to obtain the initial quantization parameter offset of the target CTU; introduces quantization distortion estimation, that is, introduces a quantization transformation process in the pre-analysis process, based on which quantization distortion estimation is performed to obtain quantization distortion information of the target CTU; and then adjusts its initial quantization parameter offset according to the quantization distortion information of the target CTU, and finally determines the target quantization parameter offset of the target CTU. In this way, by introducing importance estimation and quantization distortion estimation, a precise target quantization parameter offset can be calculated for the target CTU, thereby improving the accuracy of the quantization parameter offset, ensuring that the target CTU uses appropriate quantization parameters, and effectively improving the encoding efficiency of the video.
[0064] In some embodiments of the present disclosure, the preset algorithm includes a BIM algorithm. The BIM algorithm is a method for evaluating the importance of a target CTU in a video frame to be processed, and can determine the relative importance of a target CTU in a video frame by analyzing factors such as texture complexity, motion information, and edge features of the video content.
[0065] The core of the BIM algorithm is to adjust the QP of the corresponding CTU according to the block error E of the matching block calculated by MCTF during the motion compensation process. MCTF is a pre-coding processing filtering algorithm widely used by many coding standards (such as HEVC, VVC, AVS, AV1, AV2, etc.). The algorithm is used to remove the temporal noise of the video before encoding, thereby improving the overall coding compression rate of the video. The MCTF algorithm can mainly include motion compensation and temporal filtering. Figure 4 shown.
[0066] Figure 4 In the process, the video frame P t To filter, first determine P t The reference video frame, that is, t The four adjacent frames before and after are denoted as P t-4 , P t-3 , P t-2 , P t-1 , P t+1 , P t+2 , P t+3 , P t+4 For example, the video frame to be processed is a frame with a play order number (Picture Order Count, POC) of 8, and the 4th, 5th, 6th, 7th, 9th, 10th, 11th, and 12th frames are set as reference video frames.
[0067] Sequentially with P t Block-level motion estimation is performed on eight adjacent frames to search for P tThe position offset of each 8x8 MCTF sub-block in the 8 reference video frames is defined as the motion vector (MV). t There are 8 reference frames, so P t Each 8x8 MCTF sub-block in has 8 MVs, denoted as MV t-4 , MV t-3 , MV t-2 , MV, MV t+1 , MV t+2 , MV t+3 , MV t+4 ,like Figure 4 shown.
[0068] Through the motion estimation process, P t The matching block of each 8x8 MCTF sub-block in , and then calculate the block error E between the MCTF sub-block and the matching block, E is calculated as follows:
[0069]
[0070] In formula (1), SSD is the matching error between the current MCTF sub-block and the matching block, which can also be called the sum of squares due to error (SSE) distortion between the current MCTF sub-block and the matching block. The specific calculation formula is as follows:
[0071]
[0072] In formula (2), I1 and I2 represent the current MCTF sub-block and the matching block, respectively, W and H represent the width and height of the current MCTF sub-block I1, respectively, and (i, j) represents the pixel coordinates.
[0073] In formula (1), V represents the variance of the current MCTF sub-block I1, which is calculated as follows:
[0074]
[0075] Wherein, W and H are the width and height of the current MCTF sub-block I1, respectively, I1 represents the current MCTF sub-block, (i, j) represents the pixel coordinates, and μ represents the average pixel value of the current MCTF sub-block I1.
[0076] For each MCTF sub-block, there are 8 matching blocks, each matching block corresponds to a block error E, and the block errors between the MCTF sub-block and the 8 matching blocks are E t-4 ,E t-3 ,E t-2 ,E t-1 ,Et+1 ,E t+2 ,E t+3 ,E t+4 After obtaining the block errors between the MCTF sub-block and the eight matching blocks, different weight parameters are assigned to the eight matching blocks and the MCTF sub-block according to the obtained block errors, which are W t-4 ,W t-3 ,W t-2 ,W t-1 ,W t, W t+1 ,W t+2 ,W t+3 ,W t+4 ,like Figure 4 shown.
[0077] from Figure 4 It can be seen that the video frame to be processed P t Each 8x8 MCTF sub-block in the video frame P is weighted with the 8 matching blocks searched in the 8 adjacent reference video frames. A total of 9 MCTF sub-blocks are weighted in a certain proportion according to the assigned weight parameters to obtain the result of time domain filtering, that is, a filtered 8x8 MCTF sub-block. This MCTF sub-block will replace the video frame to be processed P t The original MCTF sub-block in .
[0078] From the above, it can be seen that MCTF performs motion compensation and temporal filtering in a block size of 8x8, while in the actual encoding process, CTU is used as a unit. For example, in H.266 / VVC, the largest CTU is defined as 128x128, so a CTU usually contains 256 8x8 MCTF sub-blocks (i.e., MCTF sub-blocks). In addition, the quantization parameter adjustment of the bit rate control is usually also based on CTU, and the BIM algorithm of the embodiment of the present disclosure is also based on CTU.
[0079] In an exemplary embodiment of the present disclosure, the importance of the target CTU is evaluated based on the BIM algorithm, and the algorithm logic for obtaining the initial quantization parameter offset of the target CTU is as follows.
[0080] (1) For frames filtered by MCTF, Figure 4 The video frame P to be processed in t , assuming that the size of CTU is 128x128, then each CTU contains 256 8x8 MCTF sub-blocks.
[0081] For the video frame P to be processed t The target CTU in the calculation is the MCTF of the 256 8x8 sub-blocks contained in the target CTU in the two frames before and after it with a distance of 1 (i.e., Figure 4 P t-1 , Pt+1 ) is the average value of E of the matching block corresponding to , recorded as E1. Specifically, for each 8x8 MCTF sub-block in the target CTU, the two frames before and after it with a distance of 1 (i.e., Figure 4 P t-1 , P t+1 ) will have a matching block obtained in the motion estimation process. According to the above formula (1), the block error between the MCTF sub-block and the matching block is calculated; the block errors between all 8x8 MCTF sub-blocks in the target CTU and the corresponding matching blocks (i.e., the matching blocks in the two frames before and after it with a distance of 1) are summed, a total of 512 block errors are summed, and then the average is calculated to obtain E1.
[0082] Calculate the 256 8x8 MCTF sub-blocks contained in the target CTU in the two frames before and after it with a distance of 2 (i.e., Figure 4 P t-2 , P t+2 ) is the average value of E of the matching block corresponding to , recorded as E2. Specifically, for each 8x8 MCTF sub-block in the target CTU, in the two frames before and after it with a distance of 2 (i.e., Figure 4 P t-2 , P t+2 ) will have a matching block obtained in the motion estimation process. According to the above formula (1), the block error between the MCTF sub-block and the matching block is calculated; the block errors between all 8x8 MCTF sub-blocks in the target CTU and the corresponding matching blocks (i.e., the matching blocks in the two frames before and after it with a distance of 2) are summed, a total of 512 block errors are summed, and then the average is calculated to obtain E2.
[0083] (2) Quantize E1 and E2 to obtain E4. The quantization of E4 is consistent with the video frame to be processed P t If the video frame to be processed P t The POC is divisible by 16, and the calculation formula of E4 is as follows:
[0084] E4=max(E1,E2)+abs(E2-E1)*3 (5)
[0085] If the video frame to be processed P t The POC is divisible by 16, but divisible by 8. After E4 is calculated by formula (5), it is calculated again as follows: formula (6), where Ccenter is equal to 45.
[0086] E4 = 0.6*E4+ 0.4*C center (6)
[0087] (3) Obtain E4 of the target CTU through the above steps (1) and (2), and determine the initial quantization parameter offset DQ of the target CTU according to the mapping relationship shown in Table 1 BIM .
[0088] Table 1 E4 and DQ obtained based on BIM algorithm BIM Mapping relationship table
[0089]
[0090]
[0091] In the quantization parameter adjustment method of the disclosed embodiment, the importance of the target CTU is evaluated based on the BIM algorithm to obtain the initial quantization parameter offset of the target CTU, taking into account the motion compensation distortion solved by MCTF. The initial quantization parameter offset can be adjusted subsequently, thereby effectively optimizing the bit rate allocation and improving the coding efficiency while maintaining the video quality.
[0092] Figure 5 The flowchart of performing quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU in the quantization parameter adjustment method of the embodiment of the present disclosure is shown. Figure 5 , the quantization distortion estimation of the target CTU can be performed according to the following steps to obtain the quantization distortion information of the target CTU.
[0093] Step S510: Obtain each image block in the target CTU, perform quantization distortion estimation on the image block, and obtain a quantization factor of the image block.
[0094] The target CTU can be further decomposed into smaller processing units, namely image blocks. The target CTU includes one or more image blocks. The quantization distortion estimation is performed on each image block to obtain the quantization factor of the image block. For example, if the size of the image block is 8x8, the quantization factor can be solved according to the 8x8 size. Of course, other block sizes can also be set to solve the quantization factor, which is not limited in the embodiments of the present disclosure.
[0095] There is a pre-analysis process in the encoder, such as the pre-analysis process in the encoder x264 / x265, which uses the original frame for motion estimation to obtain intra-frame and inter-frame prediction distortion for bit rate allocation, which can provide key information for the subsequent encoding process. In the embodiment of the present disclosure, a quantization transformation process is introduced in the pre-analysis process, based on which quantization distortion estimation is performed to obtain quantization distortion information of the target CTU, and the quantization distortion information of the target CTU is subsequently used to adjust the initial quantization parameter offset of the target CTU.
[0096] In step S510, quantization distortion estimation is performed on each image block in the target CTU to obtain a quantization factor of the image block. Figure 6 The flowchart of the method for adjusting the quantization parameter of the embodiment of the present disclosure is shown, which is to estimate the quantization distortion of the image block to obtain the quantization factor of the image block. Figure 6 , the quantization distortion estimation of the image block can be performed according to the following steps to obtain the quantization factor of the image block.
[0097] Step S610: obtaining a prediction block of an image block.
[0098] In the disclosed embodiment, the predicted block of the image block refers to a block that is most similar to the image block after searching, or a block that has the highest matching degree with the image block.
[0099] In some embodiments of the present disclosure, obtaining a prediction block of an image block includes: searching for a first matching block matching the image block in an adjacent reference frame of a video frame to be processed, and calculating a first distortion value between the image block and the first matching block; searching for a second matching block matching the image block in the video frame to be processed, and calculating a second distortion value between the image block and the second matching block; determining a smaller distortion value between the first distortion value and the second distortion value, and using the matching block corresponding to the smaller distortion value as the prediction block of the image block.
[0100] In the embodiment of the present disclosure, for the video frame P to be processed t The image block I c , search for the first matching block I that is most similar in the adjacent reference frame p1 , wherein the adjacent reference frame can be based on the actual demand device, such as the adjacent reference frame to be processed P t The distance between the two frames is 1, for example, it can be the same as the video frame P to be processed. t Four adjacent frames before and after, and then calculate I c and I p1 The first distortion value OE between inter , the distortion is inter-frame prediction distortion.
[0101] According to the intra-frame prediction method in the video coding standard, in the video frame to be processed P t Intra-frame prediction is performed to obtain image block I c The second matching block I p2 , calculate I c and I p2 The second distortion value between is OE intra , the distortion is intra-frame prediction distortion.
[0102] By comparing OE inter and OE intra , the matching block with smaller distortion is obtained as the image block I c The prediction block I t , the corresponding distortion is OE t , as shown in the following formula:
[0103]
[0104] In the embodiment of the present disclosure, the first distortion value and the second distortion value may be SSE distortion, that is, the first distortion value is used to calculate I c and I p1 The SSE distortion between the two values is I c and I p2 Of course, the first distortion value and the second distortion value may also be other distortions, such as SATD distortion, which is not limited in the embodiment of the present disclosure.
[0105] In the quantization parameter adjustment method provided by the embodiment of the present disclosure, by introducing the matching block search within the adjacent reference frames and the current video frame to be processed, an accurate prediction block is found for the image block, which not only improves the accuracy of the prediction and reduces the size of the residual block, but also makes the subsequent quantization distortion estimation closer to the actual encoding process.
[0106] Step S620: determining the pre-quantization prediction distortion of the image block according to the prediction block of the image block.
[0107] In determining the prediction block I of the image block t After that, the image block I c With the prediction block I t Distortion value between OE t As the image block I c The pre-quantization prediction distortion of the image block I c The prediction distortion before quantization is OE t .
[0108] In a possible implementation, the second matching block I is determined p2 is the prediction block of the image block, then the image block I c With the second matching block I p2 The second distortion value OE between intra For the image block I c Pre-quantization prediction distortion OE t .
[0109] In another possible implementation, the first matching block I is determined p1 is the prediction block of the image block, then the image block I c With the first matching block I p1 The first distortion value OE between inter For the image block I c Pre-quantization prediction distortion OE t .
[0110] Step S630, determining a residual block of the image block according to the prediction block and the image block of the image block, and performing quantization transformation processing on the residual block of the image block to obtain a quantized residual block.
[0111] In determining the image block I c The prediction block I t Afterwards, the image block I can be calculated c The residual block I r , as shown in the following formula:
[0112] I r =I c -I t (8)
[0113] After obtaining the residual block I r Afterwards, the residual block I r Perform quantization transformation processing to obtain the quantized residual block As shown in the following formula:
[0114]
[0115] In formula (9), T(·) is the sum of T -1 (·) represents the transformation and inverse transformation operations; Q(·) represents the sum Q -1 (·) represents quantization and inverse quantization operations. The method used for quantization transformation can be set according to actual needs, such as using DCT-2 transformation or DST-7 transformation, which is not limited in the embodiments of the present disclosure.
[0116] In the disclosed embodiment, the quantization transformation process depends on the current quantization parameter before adjustment, so different base quantization parameters can be given to perform corresponding processing to obtain different quantization features.
[0117] Step S640: determining the post-quantization prediction distortion of the image block according to the quantized residual block.
[0118] After obtaining the quantized residual block Afterwards, the quantized residual block can be used Calculate the image block I c The quantization prediction distortion QE t .
[0119] In a possible implementation, the image block I can be calculated as follows: c The quantization prediction distortion QE t : According to the prediction block I t And the quantized residual block Get the reconstructed image block Calculate the image block I c and reconstructed image block Ic-recon The distortion between the two is taken as the image block I c The quantization prediction distortion QE t Among them, the quantized prediction distortion QE t The calculation method used is the same as the prediction distortion OE before quantization t The calculation method used is the same, which may be SSE distortion or SATD distortion, and the embodiments of the present disclosure do not limit this.
[0120] Step S650: Calculate a quantization factor of the image block based on the post-quantization prediction distortion of the image block and the pre-quantization prediction distortion of the image block.
[0121] After obtaining the image block I c Pre-quantization prediction distortion OE t and quantization prediction distortion QE t Afterwards, the image block I is calculated according to the following formula: c The quantization factor q is:
[0122] q=(QE t +0.001) / (OE t +0.001) (10)
[0123] In the quantization parameter adjustment method provided in the embodiment of the present disclosure, the quantization factor of the image block is calculated by estimating the quantization distortion of the image block. Not only the prediction distortion before and after quantization is considered, but also the residual block is quantized and transformed, so that the calculated quantum factor more accurately reflects the influence of the quantization process, providing more reliable data support for subsequent quantization parameter adjustment.
[0124] Step S520: Determine an average quantization factor of the target CTU according to the quantization factors of all image blocks in the target CTU.
[0125] After obtaining the quantization factor q of each image block in the target CTU, the quantization factors q of all image blocks in the target CTU are averaged to obtain the average quantization factor Q of the target CTU. ave , as shown in the following formula:
[0126]
[0127] In formula (11), N represents the number of image blocks contained in the current target CTU, q i is the quantization factor of the i-th image block. For example, if the size of the target CTU is 128x128 and the size of the image block is 8x8, then the target CTU contains 256 image blocks, that is, N is equal to 256, and q i is the quantization factor of the i-th 8x8 image block.
[0128] Step S530 , determining a quantization distortion degree of the target CTU relative to the processed video frame according to an average quantization factor of the target CTU and an average quantization factor of CTUs other than the target CTU in the video frame to be processed.
[0129] Step S540: Determine quantization distortion information of the target CTU according to the quantization distortion degree of the target CTU relative to the processed video frame.
[0130] Taking the average quantization factor of the target CTU as the reference quantization factor, traverse the CTUs other than the target CTU in the video frame to be processed. For each CTU, compare its average quantization factor with the reference quantization factor, and count the number of CTUs whose average quantization factor is greater than the reference quantization factor. Then calculate the ratio of the number of CTUs counted to the number of CTUs in the video frame to be processed. This ratio can be regarded as a quantitative indicator of the degree of quantization distortion of the target CTU relative to the entire video frame to be processed. Finally, the obtained quantization indicator is determined as the quantization distortion information of the target CTU. The specific implementation is as follows: after obtaining the average quantization factor Q of the target CTU, ave Then, the average quantization factor of other CTUs in the processed video frame is compared with the average quantization factor Q of the target CTU. ave Compare and calculate the average quantization factor Q of the target CTU ave The number of large CTUs is then calculated, and the ratio of the number of CTUs counted to the total CTUs in the video frame to be processed is calculated as follows:
[0131]
[0132] In formula (12), CTUN is the number of all CTUs in the video frame to be processed, is the average quantization factor of the target CTU, is the average quantization factor of the i-th CTU in the video frame to be processed, QRatio is the quantization distortion information of the target CTU, which reflects the relative quantization distortion of the target CTU relative to other CTUs in the video frame to be processed. It can be seen that the QRatio of the target CTU is a feature obtained after considering the quantization prediction distortion and performing overall equalization.
[0133] In the quantization parameter adjustment method provided by the embodiment of the present disclosure, quantization distortion estimation is performed on each image block in the video frame to be processed, and the quantization factor of each image block is calculated. The quantization factors are further averaged to obtain the average quantization factor of the target CTU. Then, with the average quantization factor of the target CTU as a reference, other CTUs in the entire video frame to be processed are traversed, and the proportion of CTUs with an average quantization factor greater than the benchmark is counted and calculated. This proportion reflects the degree of quantization distortion of the target CTU relative to the entire video frame to be processed, that is, the relative quantization distortion. This feature can provide a global perspective for the adjustment of the initial quantization parameter offset, and can evaluate the relative quantization distortion degree of the target CTU in the entire frame of video as a whole, providing strong support for the subsequent precise adjustment of the quantization parameters.
[0134] In some embodiments of the present disclosure, an initial quantization parameter offset of the target CTU is adjusted according to quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU, including: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, reducing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0, increasing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU.
[0135] In the embodiment of the present disclosure, after obtaining the initial quantization parameter offset DQ of the target CTU, BIM After the quantization distortion information QRatio is obtained, the initial quantization parameter offset DQ is adjusted using the quantization distortion information QRatio. BIM In an exemplary embodiment, if DQ BIM If it is greater than or equal to 0, then DQ is reduced according to QRatio BIM , on the contrary, if DQ BIM If it is less than 0, DQ will be increased according to QRatio. BIM .
[0136] In one possible implementation, if DQ BIM If it is greater than 0, DQ is reduced according to QRatio. BIM , on the contrary, if DQ BIM If it is less than or equal to 0, DQ is increased according to QRatio BIM That is, when DQ BIM When it is equal to 0, DQ can be reduced according to QRatio BIM , you can also increase DQ according to QRatio BIM .
[0137] In the quantization parameter adjustment method provided in the embodiment of the present disclosure, the quantization parameter offset is flexibly adjusted according to the positive or negative sign of the initial quantization parameter offset of the target CTU and the quantization distortion information, thereby optimizing the video encoding efficiency while ensuring the video quality.
[0138] In some embodiments of the present disclosure, in response to an initial quantization parameter offset of a target CTU being greater than or equal to 0, the initial quantization parameter offset of the target CTU is reduced according to quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU, including: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, and the quantization distortion information of the target CTU being less than a first preset threshold, reducing the initial quantization parameter offset of the target CTU by a first offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, and the quantization distortion information of the target CTU being less than a second preset threshold, reducing the initial quantization parameter offset of the target CTU by a second offset to obtain the target quantization parameter offset of the target CTU.
[0139] In some embodiments of the present disclosure, in response to an initial quantization parameter offset of a target CTU being less than 0, the initial quantization parameter offset of the target CTU is increased according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU, including: in response to the initial quantization parameter offset of the target CTU being less than 0, and the quantization distortion information of the target CTU being greater than a third preset threshold, the initial quantization parameter offset of the target CTU is increased by the third offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0, and the quantization distortion information of the target CTU being greater than a fourth preset threshold, the initial quantization parameter offset of the target CTU is increased by the fourth offset to obtain the target quantization parameter offset of the target CTU.
[0140] In the embodiment of the present disclosure, the quantization distortion information QRatio is used to calculate the initial quantization parameter offset DQ BIM Make reverse adjustments, the specific logic is as follows:
[0141] (1) When DQ BIM >=0, determine whether QRatio is less than the first preset threshold, if so, then in DQ BIM If yes, reduce the first offset, otherwise jump to condition (2).
[0142] (2) When DQ BIM >=0, determine whether QRatio is less than the second preset threshold, if so, then in DQ BIM On this basis, reduce the second offset, otherwise no adjustment is made.
[0143] (3) When DQBIM <0, determine whether QRatio is greater than the third preset threshold, if so, then in DQ BIM Add the third offset to the value, otherwise jump to condition (4).
[0144] (4) When DQ BIM <, determine whether QRatio is greater than the fourth preset threshold, if so, then in DQ BIM Add the fourth offset based on the condition, otherwise jump to condition (2).
[0145] In a possible implementation, the values of the first preset threshold to the fourth preset threshold are 0.1, 0.2, 0.9, and 0.8, respectively, and the values of the first offset to the fourth offset are 2, 1, 2, and 1, respectively.
[0146] In the quantization parameter adjustment method provided in the embodiment of the present disclosure, the adjustment strategy of the quantization parameter offset is further refined. By setting different preset thresholds and offsets, the adjustment of the quantization parameter is made more precise and flexible, which helps to maintain high-quality encoding effects in complex video content.
[0147] In summary, the quantization parameter adjustment method provided by the embodiment of the present disclosure performs importance estimation on the target CTU based on a preset algorithm to obtain the initial quantization parameter offset of the target CTU; introduces quantization distortion estimation, that is, introduces a quantization transformation process in the pre-analysis process, based on which quantization distortion estimation is performed to obtain quantization distortion information of the target CTU; and then adjusts its initial quantization parameter offset according to the quantization distortion information of the target CTU, and finally determines the target quantization parameter offset of the target CTU. In this way, by introducing importance estimation and quantization distortion estimation, a precise target quantization parameter offset can be calculated for the target CTU, thereby improving the accuracy of the quantization parameter offset, ensuring that the target CTU uses appropriate quantization parameters, and effectively improving the encoding efficiency of the video.
[0148] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.
[0149] Figure 7 FIG. 4 is a block diagram of a quantization parameter adjustment device according to an embodiment of the present disclosure. Figure 7 As shown, the device 700 includes an offset acquisition unit 710 , a quantization distortion estimation unit 720 and an offset adjustment unit 730 .
[0150] The offset acquisition unit 710 is configured to: acquire the target CTU in the video frame to be processed; estimate the importance of the target CTU based on a preset algorithm to obtain the initial quantization parameter offset of the target CTU. The quantization distortion estimation 720 is configured to: perform quantization distortion estimation on the target CTU to obtain the quantization distortion information of the target CTU. The offset adjustment unit 730 is configured to: adjust the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU.
[0151] In some embodiments of the present disclosure, the quantization distortion estimation unit 720 is further configured to: obtain each image block in the target CTU, perform quantization distortion estimation on the image block, and obtain a quantization factor of the image block; determine an average quantization factor of the target CTU based on the quantization factors of all image blocks in the target CTU; determine a degree of quantization distortion of the target CTU relative to the processed video frame based on the average quantization factor of the target CTU and the average quantization factor of CTUs other than the target CTU in the video frame to be processed; determine quantization distortion information of the target CTU based on the degree of quantization distortion of the target CTU relative to the processed video frame.
[0152] In some embodiments of the present disclosure, the quantization distortion estimation unit 720 is further configured to: obtain a prediction block of an image block; determine the pre-quantization prediction distortion of the image block based on the prediction block of the image block; determine the residual block of the image block based on the prediction block of the image block and the image block, perform quantization transformation processing on the residual block of the image block to obtain a quantized residual block; determine the post-quantization prediction distortion of the image block based on the quantized residual block; and calculate the quantization factor of the image block based on the post-quantization prediction distortion of the image block and the pre-quantization prediction distortion of the image block.
[0153] In some embodiments of the present disclosure, the quantization distortion estimation unit 720 is further configured to: search for a first matching block matching the image block in an adjacent reference frame of the video frame to be processed, and calculate a first distortion value between the image block and the first matching block; search for a second matching block matching the image block in the video frame to be processed, and calculate a second distortion value between the image block and the second matching block; determine a smaller distortion value between the first distortion value and the second distortion value, and use the matching block corresponding to the smaller distortion value as a prediction block of the image block.
[0154] In some embodiments of the present disclosure, the offset adjustment unit 730 is further configured to: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, reduce the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0, increase the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU.
[0155] In some embodiments of the present disclosure, the offset adjustment unit 730 is further configured to: in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0 and the quantization distortion information of the target CTU being less than a first preset threshold, reduce the initial quantization parameter offset of the target CTU by a first offset to obtain a target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being greater than or equal to 0 and the quantization distortion information of the target CTU being less than a second preset threshold, reduce the initial quantization parameter offset of the target CTU by a second offset to obtain a target quantization parameter offset of the target CTU.
[0156] In some embodiments of the present disclosure, the offset adjustment unit 730 is further configured to: in response to the initial quantization parameter offset of the target CTU being less than 0 and the quantization distortion information of the target CTU being greater than a third preset threshold, increase the initial quantization parameter offset of the target CTU by the third offset to obtain the target quantization parameter offset of the target CTU; in response to the initial quantization parameter offset of the target CTU being less than 0 and the quantization distortion information of the target CTU being greater than a fourth preset threshold, increase the initial quantization parameter offset of the target CTU by the fourth offset to obtain the target quantization parameter offset of the target CTU.
[0157] In some embodiments of the present disclosure, the preset algorithm includes a block importance mapping algorithm.
[0158] Regarding the device in the above embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0159] Figure 8 FIG. 1 is a schematic diagram showing the structure of an electronic device according to an embodiment of the present disclosure. It should be noted that: Figure 8 The electronic device 800 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0160] like Figure 8As shown, the electronic device 800 is in the form of a general computing device. The components of the electronic device 800 may include but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including the storage unit 820 and the processing unit 810).
[0161] The storage unit stores program codes, which can be executed by the processing unit 810, so that the processing unit 810 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 810 can perform the following steps: Figure 3 Follow the steps shown in .
[0162] The storage unit 820 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 8201 and / or a cache memory unit 8202 , and may further include a read-only memory unit (ROM) 8203 .
[0163] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0164] Bus 830 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0165] The electronic device 800 may also communicate with one or more external devices 900 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 800, and / or communicate with any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 850. Furthermore, the electronic device 800 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 840. As shown, the network adapter 840 communicates with other modules of the electronic device 800 via a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0166] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0167] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0168] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0169] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0170] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0171] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0172] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0173] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0174] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0175] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
[0176] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A quantization parameter adjustment method, characterized in that: The method comprises: Obtain a target coding tree unit CTU in a video frame to be processed; Performing importance estimation on the target CTU based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU; Performing quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU; According to the quantization distortion information of the target CTU, an initial quantization parameter offset of the target CTU is adjusted to obtain a target quantization parameter offset of the target CTU.
2. The method according to claim 1, characterized in that The performing quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU includes: Acquire each image block in the target CTU, perform quantization distortion estimation on the image block, and obtain a quantization factor of the image block; Determining an average quantization factor of the target CTU according to quantization factors of all image blocks in the target CTU; Determining a quantization distortion degree of the target CTU relative to the processed video frame according to an average quantization factor of the target CTU and an average quantization factor of CTUs other than the target CTU in the video frame to be processed; According to the quantization distortion degree of the target CTU relative to the processed video frame, quantization distortion information of the target CTU is determined.
3. The method according to claim 2, characterized in that The step of performing quantization distortion estimation on the image block to obtain a quantization factor of the image block includes: Obtaining a prediction block of the image block; Determining a pre-quantization prediction distortion of the image block according to a prediction block of the image block; Determine a residual block of the image block according to the prediction block of the image block and the image block, and perform quantization transformation processing on the residual block of the image block to obtain a quantized residual block; Determining a post-quantization prediction distortion of the image block according to the quantized residual block; A quantization factor of the image block is calculated based on the post-quantization prediction distortion of the image block and the pre-quantization prediction distortion of the image block.
4. The method according to claim 3, characterized in that The obtaining of the prediction block of the image block comprises: Searching for a first matching block matching the image block in an adjacent reference frame of the video frame to be processed, and calculating a first distortion value between the image block and the first matching block; Searching for a second matching block matching the image block in the to-be-processed video frame, and calculating a second distortion value between the image block and the second matching block; A smaller distortion value between the first distortion value and the second distortion value is determined, and a matching block corresponding to the smaller distortion value is used as a prediction block of the image block.
5. The method according to claim 1, characterized in that The adjusting, according to the quantization distortion information of the target CTU, the initial quantization parameter offset of the target CTU to obtain the target quantization parameter offset of the target CTU includes: In response to an initial quantization parameter offset of the target CTU being greater than or equal to 0, reducing the initial quantization parameter offset of the target CTU according to quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU; In response to an initial quantization parameter offset of the target CTU being less than 0, the initial quantization parameter offset of the target CTU is increased according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU.
6. The method according to claim 5, characterized in that In response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, reducing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU, including: In response to the initial quantization parameter offset of the target CTU being greater than or equal to 0, and the quantization distortion information of the target CTU being less than a first preset threshold, reducing the initial quantization parameter offset of the target CTU by a first offset to obtain a target quantization parameter offset of the target CTU; In response to an initial quantization parameter offset of the target CTU being greater than or equal to 0, and the quantization distortion information of the target CTU being less than a second preset threshold, the initial quantization parameter offset of the target CTU is reduced by a second offset to obtain a target quantization parameter offset of the target CTU.
7. The method according to claim 5, characterized in that In response to the initial quantization parameter offset of the target CTU being less than 0, increasing the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain the target quantization parameter offset of the target CTU, including: In response to an initial quantization parameter offset of the target CTU being less than 0, and the quantization distortion information of the target CTU being greater than a third preset threshold, increasing the initial quantization parameter offset of the target CTU by a third offset to obtain a target quantization parameter offset of the target CTU; In response to an initial quantization parameter offset of the target CTU being less than 0 and the quantization distortion information of the target CTU being greater than a fourth preset threshold, the initial quantization parameter offset of the target CTU is increased by a fourth offset to obtain a target quantization parameter offset of the target CTU.
8. The method according to any one of claims 1 to 7, characterized in that: The preset algorithm includes a block importance mapping algorithm.
9. A quantization parameter adjustment device, characterized in that: The device comprises: An offset acquisition unit is configured to acquire a target CTU in a video frame to be processed; perform importance estimation on the target CTU based on a preset algorithm to obtain an initial quantization parameter offset of the target CTU; a quantization distortion estimation unit, configured to perform quantization distortion estimation on the target CTU to obtain quantization distortion information of the target CTU; The offset adjustment unit is configured to adjust the initial quantization parameter offset of the target CTU according to the quantization distortion information of the target CTU to obtain a target quantization parameter offset of the target CTU.
10. An electronic device, characterized in that: include: processor; A memory for storing the processor executable instructions; wherein the processor is configured to execute the executable instructions to implement the quantization parameter adjustment method according to any one of claims 1 to 8. 11 . A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the quantization parameter adjustment method according to any one of claims 1 to 8.
12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the quantization parameter adjustment method according to any one of claims 1 to 8 is implemented.