Coding method, apparatus, electronic device, and readable storage medium

By determining and fine-tuning the quantization parameters of the coding unit in the AV1 standard, the problem of mismatch between quantization parameters and quantization step size was solved, resulting in better coding performance.

CN116471405BActive Publication Date: 2026-07-24SHANGHAI BILIBILI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI BILIBILI TECH CO LTD
Filing Date
2023-05-22
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In the AV1 standard, the quantization parameters and quantization step size do not perfectly conform to an exponential function relationship, resulting in unsatisfactory encoding performance.

Method used

By determining the first quantization parameter of the coding unit, the target quantization step size is calculated using the quantization parameter-quantization step size function, and the corresponding second quantization parameter is matched by looking up the standard lookup table, so as to achieve fine-tuning of the quantization parameter and improve the coding effect.

Benefits of technology

It improves encoding performance, obtains more accurate quantization parameters for encoding, and enhances the encoding quality of images or videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116471405B_ABST
    Figure CN116471405B_ABST
Patent Text Reader

Abstract

The application provides an encoding method, device, electronic equipment and readable storage medium. The method comprises the following steps: determining a first quantization parameter of an encoding unit; determining a target quantization step according to the first quantization parameter and a quantization parameter-quantization step function; searching a standard comparison table according to the target quantization step to determine a second quantization parameter matched with the target quantization step; the standard comparison table comprises a corresponding relationship between a plurality of quantization steps and a plurality of quantization parameters; and encoding the encoding unit based on the second quantization parameter. In the embodiment of the application, after the target quantization step is obtained based on the estimated first quantization parameter and the quantization parameter-quantization step function, the second quantization parameter corresponding to the target quantization step is obtained by searching the standard comparison table, the fine adjustment of the quantization parameter is realized, and the second quantization parameter is used for encoding, so that the encoding effect of an image or a video is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of multimedia data transmission technology and video encoding processing technology, and in particular to an encoding method, apparatus, electronic device and readable storage medium. Background Technology

[0002] With the development of computer and video technologies, more and more video coding standards have been proposed, such as AV1 (Alliance for Open Media Video 1) and HEVC (High Efficiency Video Coding).

[0003] The encoding process involves compressing the image with a specific quantization step size to reduce unnecessary information. Each quantization step size has a corresponding quantization parameter. During encoding, appropriate quantization parameters can be selected for different parts of the image. In standards such as H.264 / AVC, the quantization parameter and quantization step size follow a specific exponential function relationship. However, in the AV1 standard, the quantization parameter and quantization step size do not entirely conform to an exponential function relationship. Summary of the Invention

[0004] This application provides an encoding method, apparatus, electronic device, and readable storage medium to solve the problems existing in related technologies. The technical solution is as follows:

[0005] In a first aspect, embodiments of this application provide an encoding method, including:

[0006] Determine the first quantization parameter of the coding unit;

[0007] The target quantization step size is determined based on the first quantization parameter and the quantization parameter-quantization step size function.

[0008] Based on the target quantization step size, a standard lookup table is consulted to determine the second quantization parameter that matches the target quantization step size; the standard lookup table includes the correspondence between multiple quantization step sizes and multiple quantization parameters.

[0009] The encoding unit is encoded based on the second quantization parameter.

[0010] Secondly, embodiments of this application provide an encoding device, including:

[0011] The first quantization parameter determination unit is used to determine the first quantization parameter of the encoding unit;

[0012] The target quantization step size determination unit is used to determine the target quantization step size based on the first quantization parameter and the quantization parameter-quantization step size function;

[0013] The second quantization parameter determination unit is used to look up a standard lookup table based on the target quantization step size and determine the second quantization parameter that matches the target quantization step size; the standard lookup table includes the correspondence between multiple quantization step sizes and multiple quantization parameters.

[0014] An encoding unit is used to encode the encoding unit based on the second quantization parameter.

[0015] Thirdly, embodiments of this application provide an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to execute the above-described encoding method.

[0016] Fourthly, embodiments of this application provide a computer-readable storage medium that stores computer instructions, wherein when the computer instructions are executed on a computer, the methods in any of the above-described embodiments are performed.

[0017] Based on the estimated first quantization parameter and the quantization parameter-quantization step size function, the target quantization step size is calculated and then the second quantization parameter corresponding to the target quantization step size is obtained by looking up a standard lookup table. This enables fine-tuning of the quantization parameter and encoding with the second quantization parameter, thereby improving the encoding effect of the image or video.

[0018] The above overview is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of this application will become readily apparent from the accompanying drawings and the following detailed description. Attached Figure Description

[0019] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the various drawings denote the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings depict only some embodiments disclosed in this application and should not be construed as limiting the scope of this application.

[0020] Figure 1 This diagram schematically illustrates the operating environment of an encoding method according to an embodiment of this application;

[0021] Figure 2 A flowchart illustrating an encoding method according to an embodiment of this application is shown schematically;

[0022] Figure 3 A block diagram of an encoding apparatus according to an embodiment of this application is shown schematically;

[0023] Figure 4 A schematic diagram of the hardware architecture of a computer device according to an embodiment of this application is shown. Detailed Implementation

[0024] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of this application. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.

[0025] It should be noted that the descriptions involving "first," "second," etc., in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0026] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order of the steps, but are only used to facilitate the description of this application and to distinguish each step, and therefore should not be construed as a limitation of this application.

[0027] When multimedia data such as video is transmitted via communication, the media data needs to be encoded first to achieve data compression for easy transmission; when the receiving end receives the compressed multimedia data, it then decodes it to play or display the multimedia data.

[0028] Among various encoding methods, the dual encoding method of pre-analysis plus master coding, which has relatively high coding efficiency, has become one of the more ideal encoding methods for video. Pre-analysis is performed before entering the master coding process by evaluating the impact of each part of the image on the overall coding and adjusting the quantization parameters (QP) of each part. Master coding then encodes the corresponding image units based on the adjusted quantization parameters.

[0029] The following explains the relevant terms used in this application:

[0030] AV1 (Alliance for Open Media Video 1) is a royalty-free video coding standard developed by the Alliance for Open Media (AOM). Depending on the application, AV1 can achieve higher compression efficiency than VP9 and H.264 / AVC.

[0031] H.264 / AVC: An international video coding standard jointly developed by ITU-T and ISO.

[0032] x264: A video encoder based on the H.264 / AVC standard.

[0033] H.265 / HEVC (High Efficiency Video Coding): An international video coding standard jointly developed by ITU-T and ISO.

[0034] x265: A video encoder based on the H.265 / HEVC standard.

[0035] Quantization refers to the process of mapping continuous values ​​(or a large number of possible discrete values) of a signal to a finite number of discrete values; it is a many-to-one mapping. In video coding, the transform coefficients of the residual signal typically have a large range after transformation. Therefore, quantizing the transform coefficients can effectively reduce the signal value space, thereby obtaining a suitable bit rate. However, due to the many-to-one mapping nature, the quantization process inevitably introduces data loss. Quantization is a significant source of video distortion in video coding.

[0036] Quantization step (Qstep): The Qstep reflects the compression of spatial details. The smaller the Qstep value, the finer the quantization, the higher the image quality, and the longer the resulting bitstream. If the Qstep is small, most details will be preserved; if the Qstep is large, some details will be lost, but the bitrate will decrease.

[0037] Quantization Parameter (QP): In modern video coding, QP is generally a label reflecting the quantization step size used, usually a non-negative integer value. Generally, the larger the quantization step size, the larger the corresponding QP.

[0038] To facilitate understanding of the technical solutions provided in the embodiments of this application by those skilled in the art, the relevant technologies are described below:

[0039] Encoders are used to encode multimedia data. Common video encoders include x264 encoders based on the H.264 / AVC standard and x265 encoders based on the H.265 / HEVC standard. Encoders based on the AV1 standard are a newer type of encoder. During encoding, the encoder obtains quantization parameters, each with a corresponding quantization step size, and then encodes using the quantization step size corresponding to the quantization parameter.

[0040] In the H.264 / AVC and H.265 / HEVC standards, the quantization parameter and the quantization step size satisfy an exponential relationship:

[0041]

[0042] Where c is a constant, Qstep is the quantization step size, and QP is the quantization parameter.

[0043] Common encoders based on H.264 / AVC and H.265 / HEVC, such as x264 and x265, utilize mbtree or cutree algorithms based on this exponential relationship to accurately predict quantization parameters, resulting in good encoding performance. However, in the AV1 standard, the quantization step size and quantization parameters do not perfectly conform to an exponential relationship. Therefore, directly using existing methods relying on exponential relationships to estimate quantization parameters may result in errors between the expected quantization step size and the actual quantization step size used during encoding, leading to unsatisfactory encoding performance. To address this, this application provides an encoding method and corresponding encoding apparatus, aiming to obtain more accurate quantization parameters for encoding using the AV1 standard, thereby improving encoding performance. The encoding apparatus can be a module within the encoder, enabling the use of the encoding method improved in this application during encoding.

[0044] The following provides an exemplary application environment for this application, which, for example, can be used in a computer device.

[0045] Computer devices can be configured to access the content (e.g., videos) and services of server 2.

[0046] Computer equipment may include electronic devices 6 with built-in or external display panels, such as mobile devices, tablets, laptops, workstations, virtual reality devices, gaming devices, digital streaming media devices, vehicle user terminals, smart TVs, set-top boxes, etc., and may also include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc.

[0047] A computer device can be associated with one or more users. A single user can also use one or more computer devices to access the server. The computer device can travel to various locations and use different networks to access the server. The computer device may include multiple client programs, such as video codecs, for providing encoding and decoding services. These video codecs can encode and compress video or images to facilitate their transmission or storage.

[0048] The following will provide various embodiments in the above exemplary application environment to illustrate the technical solutions of this application.

[0049] Figure 2 A flowchart illustrating an encoding method according to an embodiment of this application is shown. Figure 2 As shown, the encoding method may include:

[0050] S210, determine the first quantization parameter of the coding unit.

[0051] Multimedia data, such as images or videos. Videos consist of multiple consecutive, dynamic frames. Each frame is encoded to obtain compressed video data for transmission. Simultaneously, an image, or multiple frames, contains multiple image blocks. An image can be divided into multiple image blocks according to a preset strategy, and each block is then encoded to obtain compressed image data. Each image block can be a coding unit.

[0052] The first quantization parameter of the coding unit can be determined by referencing or comparing a reference image block with the current image block, and may be an estimated quantization parameter. The estimated quantization parameter may be determined based on a specific quantization step size required during encoding. The reference image block can be another image block in the current image or a similar image block between adjacent image frames.

[0053] In an image, multiple image blocks can be distinguished by equal area or by unequal area based on the specific content of the image. For example, the background area can be divided into multiple larger image blocks, while the main subject area can be divided into multiple smaller image blocks. The distinction of image blocks can be achieved using existing techniques or techniques that may be used by those skilled in the art in the future.

[0054] The first quantization parameter of the coding unit can be obtained using the mbtree or cutree method. These two methods are commonly used by x264 and x265 encoders to obtain quantization parameters, respectively.

[0055] S220, determine the target quantization step size based on the first quantization parameter and the quantization parameter-quantization step size function.

[0056] The quantization parameter-quantization step size function is used to represent the correspondence between multiple quantization parameters and multiple quantization step sizes. In other words, the relationship between multiple quantization parameters and multiple quantization step sizes is represented in the form of a function.

[0057] In the H.264 / AVC and H.265 / HEVC standards, quantization parameters and quantization step sizes exhibit an exponential relationship. Therefore, using the mbtree or cutree method based on this exponential relationship yields more accurate quantization parameter predictions, and the quantization step size used by the encoder during encoding is the expected quantization step size when predicting that quantization parameter. In the AV1 standard, the quantization parameter-quantization step size function can be a function fitted from the correspondence between multiple quantization parameters and multiple quantization step sizes in the AV1 standard's lookup table, representing the AV1 standard's quantization parameter-quantization step size correspondence.

[0058] In this embodiment, the first quantization parameter is an estimated quantization parameter, which represents the target quantization step size expected during encoding. The target quantization step size can be obtained by substituting the first quantization parameter into the quantization parameter-quantization step size function.

[0059] S230, based on the target quantization step size, look up a standard lookup table to determine a second quantization parameter that matches the target quantization step size; the standard lookup table includes the correspondence between multiple quantization step sizes and multiple quantization parameters.

[0060] Since the quantization parameter-quantization step size function is a fitted function, some discrete points will inevitably not fall exactly on the fitted curve.

[0061] Based on this, the embodiments of this application obtain the quantization parameters that best match the target quantization step size by matching from a standard lookup table, thereby achieving fine-tuning of the quantization parameters, enabling encoding with more accurate quantization parameters, and improving the encoding effect.

[0062] In one example, the difference between multiple real quantization step sizes in a standard lookup table and the target quantization step size can be calculated, and the quantization parameter corresponding to the quantization step size with the smallest difference can be determined as the second quantization parameter.

[0063] S240, the encoding unit is encoded based on the second quantization parameter.

[0064] The second quantization parameter is a quantization parameter obtained by fine-tuning based on the true correspondence of the AV1 standard. Its corresponding quantization step size is more in line with the quantization step size expected for the desired coding effect. Therefore, encoding with this second quantization parameter yields better coding results.

[0065] Based on the estimated first quantization parameter and the quantization parameter-quantization step size function, the target quantization step size is calculated and then the second quantization parameter corresponding to the target quantization step size is obtained by looking up a standard reference table. This enables fine-tuning of the quantization parameter and encoding with the second quantization parameter, resulting in better encoding performance.

[0066] In one embodiment, the encoding method further includes: performing data fitting based on the correspondence between multiple quantization parameters and multiple quantization step sizes in the standard lookup table to obtain the quantization parameter-quantization step size function.

[0067] In the standard lookup table, one quantization parameter corresponds to one quantization step size. The quantization parameter is the ordinal number representing the corresponding quantization step size. Therefore, the quantization parameter is used to identify the quantization step size. The actual value used during encoding is the quantization step size. However, the encoder determines the quantization step size corresponding to the quantization parameter according to the correspondence specified in the encoding standard.

[0068] Assuming a coordinate system with the quantization parameter on the horizontal axis and the quantization step size on the vertical axis, the data in the standard lookup table represents multiple discrete points in the coordinate system. Fitting these discrete points to a curve yields the expression for that curve, which is the fitted quantization parameter-quantization step size function.

[0069] The fitted quantization parameter-quantization step size function can be used to approximate the relationship between quantization parameters and quantization step size in the AV1 standard, but there is still a certain deviation in reality. Therefore, in this embodiment, the target quantization step size is obtained through the functional relationship, and then the second quantization parameter is obtained by looking up a table to adjust the deviation, so that the obtained second quantization parameter more accurately meets the encoding requirements.

[0070] In one implementation, when determining the first quantization parameter of the coding unit, the fitting quantization parameter-quantization step size function can be relied upon, so that the target quantization step size corresponding to the estimated first quantization parameter is more accurate, thereby making the obtained second quantization parameter more accurate, so as to further improve the coding effect.

[0071] In this embodiment, a first quantization parameter is determined by fitting a quantization parameter-quantization step size function, and a second quantization parameter is determined by adjusting the quantization parameter. Finally, encoding is performed using the second quantization parameter. This allows the encoder to avoid relying on exponential function relationships in existing estimation methods when using AV1 standard encoding.

[0072] In one implementation, the encoding method further includes:

[0073] Obtain the preset quantization parameter range;

[0074] Based on the correspondence between multiple quantization parameters and multiple quantization step sizes within the quantization parameter range in the standard reference table, data fitting is performed to obtain the quantization parameter-quantization step size function.

[0075] In this embodiment, the preset quantization parameter range can be manually configured. The quantization parameter range can be configured according to encoding needs, allowing the encoder to encode according to certain requirements. For example, if a clearer image is required, a smaller quantization parameter range can be set, such as (1-30), indicating a higher image quality requirement, which will sacrifice some bitrate. Alternatively, a quantization parameter range of (50-120) can be set, indicating a slightly lower image quality requirement but with a desired lower bitrate.

[0076] In this embodiment, assuming the quantization parameter range is configured as (1-100), data fitting can be performed using multiple quantization step size values ​​within the (1-100) range. This results in a more accurate quantization parameter-quantization step size function and a smaller error between the calculated quantization step size function value and the actual quantization step size value. The function obtained by fitting data within this small range determines a more accurate second quantization parameter, further improving the coding performance.

[0077] In one example, when the quantization parameter range is configured as (1-100), if the first quantization parameter exceeds the boundary value, such as 110, it can be encoded using the maximum boundary value of the quantization parameter range, 100, so that the overall encoding effect is uniform and meets the desired encoding effect.

[0078] In one example, when the quantization parameter range is configured as (1-100), if the obtained first quantization parameter exceeds the boundary value, such as 110, the second quantization parameter can be obtained by adjusting the first quantization parameter to 110 and the quantization parameter-quantization step size function to fit the function obtained from the quantization parameter range.

[0079] This application embodiment configures the quantization parameter range and fits multiple quantization step size data within the quantization parameter range to obtain a fitting function, so that the fitted function performs better when encoded within a certain range.

[0080] The quantization parameter range can also be configured based on historical experience data. For example, quantization parameters that are not frequently used can be avoided. As an example, the quantization parameter range commonly used during encoding is (50-125). Considering that when the quantization parameter is less than 50, the image quality is good, but the bitrate is too high, affecting transmission; when the quantization parameter is greater than 125, the bitrate is low, but the image quality is blurry and difficult to use; therefore, the quantization parameter range can be configured to (50-125), and then data fitting can be performed separately with multiple quantization steps within (50-125) to make the fitting function more accurate.

[0081] In one implementation, the encoding method further includes:

[0082] Obtain the preset multi-segment quantization parameter range;

[0083] For each quantization parameter range, data fitting is performed based on the correspondence between multiple quantization parameters and multiple quantization step sizes within the quantization parameter range; thus obtaining multiple quantization parameter-quantization step size functions for the corresponding multiple quantization parameter ranges.

[0084] In this embodiment, multiple quantization parameter ranges are configured, and fitting functions are obtained for each range, resulting in multiple fitting functions. In practical application, a fitting function is determined for the first quantization parameter, and then adjusted using the corresponding fitting function to obtain the second quantization parameter for encoding.

[0085] Configuring multiple quantization parameter ranges can be based on the distribution of discrete points. For example, if the quantization parameter range (51-100) approximates a smooth curve, and starting from 101, an inflection point appears or the trend differs significantly from the (51-100) curve, then (51-100) can be configured as one quantization parameter range. If no inflection point appears after starting from 101, then (101-255) can be used as another quantization parameter range. Thus, by segmenting the data, the obtained fitted function curve more closely approximates the true correspondence, making the fitted function more accurate.

[0086] Configuring multiple quantization parameter ranges can also be based on encoding requirements. For example, if better encoding performance is desired with a quantization parameter range of (25-100), while the encoding performance requirements are not high with quantization parameter ranges of (1-24) or (101-255), data fitting can be performed using (25-100) as one quantization parameter range to obtain a first fitting function; then, data fitting can be performed again using (1-255) as another quantization parameter range to obtain a second fitting function. If the first quantization parameter falls within (25-100), the first fitting function is used for adjustment; if the first quantization parameter does not fall within (25-100), the second fitting function is used for adjustment.

[0087] This application embodiment performs multi-segment data fitting by configuring multiple quantization parameter ranges, allowing users to adjust the quantization parameters according to actual encoding needs to meet various user requirements.

[0088] In one implementation, determining the target quantization step size based on the first quantization parameter and the quantization parameter-quantization step size function includes:

[0089] Based on the first quantization parameter, determine the target quantization parameter range into which the first quantization parameter falls;

[0090] The target quantization step size is determined based on the quantization parameter-quantization step size function corresponding to the target quantization parameter range and the first quantization parameter.

[0091] In the example above, when the multiple quantization parameter ranges include (25-100) and (1-255), if the first quantization parameter is 120, the target quantization parameter range is (1-255), and the second fitting function is used to adjust the quantization parameter. If the first quantization parameter is 40, the target quantization parameter range is (25-100), and the first fitting function is used to adjust the quantization parameter.

[0092] In one implementation, data fitting is performed based on the correspondence between multiple quantization parameters and multiple quantization step sizes, including:

[0093] The quantization parameter-quantization step size function is determined to be an exponential function, and the exponent of the exponential function is the quantization parameter; the exponential function includes two constant terms, one of which is the base of the exponential function, and the other is the coefficient of the exponential function;

[0094] If the error value of the quantization step size meets the preset conditions, the two constant terms are determined. The error value is the absolute value error or standard deviation between the true value of the quantization step size in the standard lookup table and the value of the quantization step size function of the exponential function. Based on the trend of the discrete curve, the quantization parameter-quantization step size function of this application embodiment can be represented in the form of an exponential function.

[0095] In one example, the following exponential function form can be used for fitting:

[0096] Qstep = s·t QP

[0097] Where s and t are constant terms. t is the base, which is greater than 0 and not equal to 1. s is the coefficient.

[0098] In one example, by calculating the error between the true value of the quantization step size and the quantization step size function value corresponding to multiple quantization parameters, and if the error meets the preset conditions, the two constant terms s and t are determined, thereby obtaining the fitting function.

[0099] The error value of the quantization step meets the preset conditions. This can be that the error values ​​of multiple quantization steps all meet the preset threshold range. For example, if the preset threshold range of the error value is within (-1.019, 1.019), two constant terms can be determined.

[0100] If the error value of the quantization step size meets the preset condition, it can also be determined that the sum of the calculated error values ​​is the smallest among the sums of error values ​​in multiple fittings, and the fitting function is then determined as the final fitting function.

[0101] In this embodiment, the exponential function used can also be in other forms, and multiple constant terms can be included, which can be selected according to the specific application. For example, it can also be an exponent of (QP-c) / d, where c and d are constant terms.

[0102] The embodiments of this application use an exponential function to fit the data in the standard lookup table, which can be more conveniently applied to determine the first quantization parameter or the second quantization parameter.

[0103] In one implementation, the relationship between the multiple quantization parameter ranges includes inclusion and / or mutual exclusion relationships;

[0104] The step of determining the target quantization parameter range into which the first quantization parameter falls based on the first quantization parameter includes:

[0105] The differences between the boundary values ​​of multiple quantization parameter ranges and the first quantization parameter are obtained respectively;

[0106] The range of quantization parameters corresponding to the minimum absolute value of the difference is the target quantization parameter range.

[0107] For example, in the above example, when the range of multiple quantization parameters includes (25-100) and (1-255), the ranges of quantization parameters at both ends are inclusive.

[0108] For example, if the range of multiple quantization parameters includes (12-50), (51-100), (101-180), and (1-255), then it includes both inclusion and mutual exclusion relationships.

[0109] Given the first quantization parameter, the target quantization parameter range is determined by calculating the difference between the first quantization parameter and the boundary values ​​of the multiple quantization parameter ranges.

[0110] For example, if the first quantization parameter is 55, then the boundary difference 55-51=4 between it and the second quantization parameter range (51-100) is minimized. Therefore, the target quantization parameter range that the first quantization parameter 55 falls into is (51-100). When adjusting the quantization parameter, the fitting function corresponding to (51-100) is used.

[0111] Figure 3 A structural block diagram of an encoding device 300 according to an embodiment of this application is shown. Figure 3 As shown, the encoding device 300 may include:

[0112] The first quantization parameter determination unit 310 is used to determine the first quantization parameter of the encoding unit;

[0113] The target quantization step size determination unit 320 is used to determine the target quantization step size based on the first quantization parameter and the quantization parameter-quantization step size function;

[0114] The second quantization parameter determination unit 330 is used to look up a standard lookup table according to the target quantization step size and determine the second quantization parameter that matches the target quantization step size; the standard lookup table includes the correspondence between multiple quantization step sizes and multiple quantization parameters.

[0115] Encoding unit 340 is used to encode the encoding unit based on the second quantization parameter.

[0116] In one embodiment, the encoding device 300 further includes:

[0117] The fitting unit is used to perform data fitting based on the correspondence between multiple quantization parameters and multiple quantization step sizes in the standard reference table, so as to obtain the quantization parameter-quantization step size function.

[0118] In one embodiment, the encoding device 300 further includes:

[0119] The first configuration unit is used to obtain a preset range of quantization parameters;

[0120] The fitting unit is used to perform data fitting based on the correspondence between multiple quantization parameters and multiple quantization step sizes within the quantization parameter range in the standard reference table, and to obtain the quantization parameter-quantization step size function.

[0121] In one embodiment, the encoding device 300 further includes:

[0122] The second configuration unit is used to obtain a preset multi-segment quantization parameter range;

[0123] The fitting unit is used to fit data for each quantization parameter range based on the correspondence between multiple quantization parameters and multiple quantization step sizes within the quantization parameter range; and obtain multiple quantization parameter-quantization step size functions for the corresponding multiple quantization parameter ranges.

[0124] In one implementation, the target quantization step size determination unit is used for:

[0125] Based on the first quantization parameter, determine the target quantization parameter range into which the first quantization parameter falls;

[0126] The target quantization step size is determined based on the quantization parameter-quantization step size function corresponding to the target quantization parameter range and the first quantization parameter.

[0127] In one implementation, the fitting unit is used for:

[0128] The quantization parameter-quantization step size function is determined to be an exponential function, and the exponent of the exponential function is the quantization parameter; the exponential function includes two constant terms, one of which is the base of the exponential function, and the other is the coefficient of the exponential function;

[0129] If the error value of the quantization step size meets the preset conditions, the two constant terms are determined. The error value is the absolute value error or standard deviation between the true value of the quantization step size in the standard lookup table and the quantization step size function value of the exponential function.

[0130] In one implementation, the relationship between the multiple quantization parameter ranges includes inclusion and / or mutual exclusion relationships;

[0131] The target quantization step size determination unit is also used for:

[0132] The differences between the boundary values ​​of multiple quantization parameter ranges and the first quantization parameter are obtained respectively;

[0133] The range of quantization parameters corresponding to the minimum absolute value of the difference is the target quantization parameter range.

[0134] The functions of each module in each device in the embodiments of this application can be found in the corresponding descriptions in the above methods, and will not be repeated here.

[0135] Figure 4 This illustration schematically shows a hardware architecture diagram of a computer device 400 suitable for implementing a video encoding method according to Embodiment 3 of this application. The computer device 400 can be part of a server 2 or an electronic device 6. In this embodiment, the computer device 400 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. For example, it can be a smartphone, tablet computer, laptop, personal computer, virtual device, set-top box, television, projector, vehicle terminal, headphones, etc. In other embodiments, the computer device 400 can also be a rack server, blade server, tower server, or cabinet server (including independent servers or server clusters composed of multiple servers), etc. Figure 4 As shown, the computer device 400 includes, but is not limited to, a memory 410, a processor 420, and a network interface 430 that can communicate with each other via a system bus.

[0136] in:

[0137] The memory 410 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 410 may be an internal storage module of the computer device 400, such as the hard disk or memory of the computer device 400. In other embodiments, the memory 410 may also be an external storage device of the computer device 400, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 410 may include both the internal storage module and the external storage device of the computer device 400. In this embodiment, the memory 410 is typically used to store the operating system and various application software installed on the computer device 400, such as program code for encoding methods. In addition, the memory 410 can also be used to temporarily store various types of data that have been output or will be output.

[0138] In some embodiments, processor 420 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. Processor 420 is typically used to control the overall operation of computer device 400, such as performing control and processing related to data interaction or communication with computer device 400. In this embodiment, processor 420 is used to run program code stored in memory 410 or process data.

[0139] Network interface 430 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 400 and other computer devices. For example, network interface 430 is used to connect computer device 400 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 400 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.

[0140] It should be pointed out that, Figure 4 Only a computer device with components 410-430 is shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0141] In this embodiment, the encoding method stored in memory 410 can be further divided into one or more program modules and executed by one or more processors (processor 420 in this embodiment) to complete the embodiment of this application.

[0142] This application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the encoding method in the embodiment.

[0143] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the computer-readable storage medium can also include both internal storage units and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code of the encoding method in the embodiment. Furthermore, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.

[0144] Obviously, those skilled in the art should understand that the modules or steps of the embodiments of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of this application are not limited to any particular combination of hardware and software.

[0145] It should be noted that the above are merely preferred embodiments of this application and do not limit the scope of patent protection of this application. Any equivalent structural or procedural changes made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this application.

Claims

1. An encoding method, characterized in that, include: Determine the first quantization parameter of the coding unit; The target quantization step size is determined based on the first quantization parameter and the quantization parameter-quantization step size function. Based on the target quantization step size, a standard lookup table is consulted to determine the second quantization parameter that matches the target quantization step size; the standard lookup table includes the correspondence between multiple quantization step sizes and multiple quantization parameters. The encoding unit is encoded based on the second quantization parameter; The first quantization parameter is obtained using the mbtree or cutree method based on exponential relationships; the quantization parameter-quantization step size function is obtained by fitting a lookup table based on the AV1 standard; and the lookup table is based on the AV1 standard.

2. The method according to claim 1, characterized in that, Also includes: Based on the correspondence between multiple quantization parameters and multiple quantization step sizes in the standard reference table, data fitting is performed to obtain the quantization parameter-quantization step size function.

3. The method according to claim 1, characterized in that, Also includes: Obtain the preset quantization parameter range; Based on the correspondence between multiple quantization parameters and multiple quantization step sizes within the quantization parameter range in the standard reference table, data fitting is performed to obtain the quantization parameter-quantization step size function.

4. The method according to claim 1, characterized in that, Also includes: Obtain the preset multi-segment quantization parameter range; For each quantization parameter range, data fitting is performed based on the correspondence between multiple quantization parameters and multiple quantization step sizes within the quantization parameter range; thus obtaining multiple quantization parameter-quantization step size functions for the corresponding multiple quantization parameter ranges.

5. The method according to claim 4, characterized in that, The step of determining the target quantization step size based on the first quantization parameter and the quantization parameter-quantization step size function includes: Based on the first quantization parameter, determine the target quantization parameter range into which the first quantization parameter falls; The target quantization step size is determined based on the quantization parameter-quantization step size function corresponding to the target quantization parameter range and the first quantization parameter.

6. The method according to any one of claims 2 to 5, characterized in that, Based on the correspondence between multiple quantization parameters and multiple quantization step sizes, data fitting is performed, including: The quantization parameter-quantization step size function is determined to be an exponential function, and the exponent of the exponential function is the quantization parameter; the exponential function includes two constant terms, one of which is the base of the exponential function, and the other is the coefficient of the exponential function; If the error value of the quantization step size meets the preset conditions, the two constant terms are determined. The error value is the absolute value error or standard deviation between the true value of the quantization step size in the standard lookup table and the quantization step size function value of the exponential function.

7. The method according to claim 5, characterized in that, The relationships between the ranges of the multiple quantization parameters include inclusion relationships and / or mutual exclusion relationships; The step of determining the target quantization parameter range into which the first quantization parameter falls based on the first quantization parameter includes: The differences between the boundary values ​​of multiple quantization parameter ranges and the first quantization parameter are obtained respectively; The range of quantization parameters corresponding to the minimum absolute value of the difference is the target quantization parameter range.

8. An encoding device, characterized in that, include: The first quantization parameter determination unit is used to determine the first quantization parameter of the encoding unit; The target quantization step size determination unit is used to determine the target quantization step size based on the first quantization parameter and the quantization parameter-quantization step size function; The second quantization parameter determination unit is used to look up a standard lookup table based on the target quantization step size and determine the second quantization parameter that matches the target quantization step size; the standard lookup table includes the correspondence between multiple quantization step sizes and multiple quantization parameters. An encoding unit is configured to encode the encoding unit based on the second quantization parameter; The first quantization parameter is obtained using the mbtree or cutree method based on exponential relationships; the quantization parameter-quantization step size function is obtained by fitting a lookup table based on the AV1 standard; and the lookup table is based on the AV1 standard.

9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method as described in any one of claims 1-7.

11. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by a processor, implement the method as described in any one of claims 1-7.