Quantization parameter offset determination method and device, equipment, storage medium and program product
By acquiring and processing the quantized parameter offsets of the video encoding unit, combining the results of the AQ and CuTree algorithms, the target quantized parameter offsets are calculated, and the problem of improving encoding efficiency in the existing technology is solved, and the video quality is achieved. Effective reduction of video code rate.
Patent Information
- Application Number
- CN202411369377.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-09-29
AI Technical Summary
When the existing video encoding technology improves encoding efficiency, it is difficult to effectively reduce the video code rate while ensuring that the video image quality is not affected, especially the calculation of quantized parameter offset caused by the coupling relationship between AQ and CuTree algorithm. unreasonable.
By obtaining the first quantization parameter offset and the second quantization parameter offset of the encoding unit, determining its characterization information, and calculating the target quantization parameter offset based on this information, so as to reasonably combine the results of the AQ and CuTree algorithms to ensure that the video is Reduce the video code rate without affecting the image quality.
It realizes that the encoding efficiency and the video code rate are improved without affecting the video quality, thereby improving the overall performance of video encoding.
Smart Images

Figure CN119299688A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer application technology, and in particular to a method, device, equipment, storage medium and program product for determining a quantization parameter offset. Background Art
[0002] Video coding is the process of converting video signals into digital data and compressing the data while maintaining the highest possible visual quality. The goal of video coding is to reduce the storage space and transmission bandwidth requirements of video data so as to efficiently store, transmit and process video content under limited resource conditions. In video coding, the video signal is decomposed into a series of image frames or differences between frames (prediction residuals), which are then processed and compressed through various techniques and algorithms.
[0003] In the video encoding process, in order to effectively reduce the bandwidth of the transcoded video and make users watch online more smoothly, it is necessary to improve the encoding efficiency of the encoder to ensure that the video bit rate is reduced without affecting the video quality. Therefore, how to effectively improve the encoding efficiency is a technical problem that needs to be solved urgently. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, device, storage medium and program product for determining a quantization parameter offset, which can effectively improve coding efficiency.
[0005] On the one hand, an embodiment of the present application provides a method for determining a quantization parameter offset, the method comprising:
[0006] Obtaining a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit;
[0007] Determining characterization information of the first quantization parameter offset; wherein the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit;
[0008] Determining a target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset;
[0009] The coding unit is encoded based on the target quantization parameter offset.
[0010] In an embodiment, determining the target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset includes:
[0011] If the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is greater than the first quantization parameter offset, then the target quantization parameter offset of the coding unit is determined to be the first quantization parameter offset.
[0012] In one embodiment, the method further comprises:
[0013] If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is less than or equal to the first quantization parameter offset, then obtaining the intra-frame prediction complexity of the coding unit;
[0014] If the intra prediction complexity of the coding unit is less than a preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be a minimum value between the first quantization parameter offset and the second quantization parameter offset.
[0015] In one embodiment, the method further comprises:
[0016] If the intra prediction complexity of the coding unit is greater than or equal to the preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0017] In an embodiment, determining the target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset includes:
[0018] If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, obtaining an average intra-frame prediction complexity of the image frame to which the coding unit belongs;
[0019] A target quantization parameter offset of the coding unit is determined according to an average intra-frame prediction complexity of an image frame to which the coding unit belongs and an intra-frame prediction complexity of the coding unit.
[0020] In one embodiment, determining the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit includes:
[0021] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is greater than a preset offset threshold, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from a preset factor to obtain the target quantization parameter offset.
[0022] In one embodiment, the method further comprises:
[0023] If the ratio of the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, then the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0024] In one embodiment, determining the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit includes:
[0025] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset ratio threshold, obtaining an adjustment factor;
[0026] The sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain the target quantization parameter offset.
[0027] In one embodiment, obtaining the adjustment factor includes:
[0028] The adjustment factor is determined according to the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs, and the second preset ratio threshold; wherein the adjustment factor is greater than or equal to the first value, and the adjustment factor is less than or equal to the second value.
[0029] In one embodiment, determining the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit includes:
[0030] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is less than or equal to a first preset ratio threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0031] On the other hand, an embodiment of the present application provides a device for determining a quantization parameter offset, the device for determining a quantization parameter offset comprising:
[0032] An acquisition unit, configured to acquire a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit;
[0033] A processing unit, used to determine characterization information of the first quantization parameter offset; wherein the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; determine a target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; and encode the coding unit based on the target quantization parameter offset.
[0034] On the other hand, an embodiment of the present application provides a computer device, including a processor, a storage device, and a communication interface, wherein the processor, the storage device, and the communication interface are connected to each other, wherein the storage device is used to store a computer program that supports the computer device to execute the above method, the computer program includes program instructions, and the processor is configured to call the program instructions to perform the following steps:
[0035] Obtaining a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit;
[0036] Determining characterization information of the first quantization parameter offset; wherein the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit;
[0037] Determining a target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset;
[0038] The coding unit is encoded based on the target quantization parameter offset.
[0039] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the above-mentioned method for determining the quantization parameter offset.
[0040] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned method for determining the quantization parameter offset.
[0041] In the embodiment of the present application, the first quantization parameter offset can be calculated based on the spatial domain information of the coding unit through the adaptive quantization model (Adaptive Quantization Model, AQ), and the second quantization parameter offset can be calculated based on the temporal information of the coding unit through the CuTree algorithm. Due to the coupling relationship between the AQ and the CuTree algorithm, the sum of the first quantization parameter offset and the second quantization parameter offset is directly used as the target quantization parameter offset of the coding unit, which cannot guarantee that the video bit rate is minimized without affecting the video quality. Therefore, the embodiment of the present application takes into account the coupling relationship between the AQ and the CuTree algorithm, determines the target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset, and encodes the coding unit based on the target quantization parameter offset, which can ensure that the video bit rate is reduced without affecting the video quality, thereby effectively improving the coding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 It is a flowchart of a method for determining a quantization parameter offset provided in an embodiment of the present application;
[0044] Figure 2 It is a structural schematic diagram of a device for determining a quantization parameter offset provided in an embodiment of the present application;
[0045] Figure 3 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will introduce the background technology involved in the embodiments of the present application to better understand the technical solutions of the embodiments of the present application.
[0047] 1. First Quantization Parameter Offset
[0048] In the field of video coding, in order to improve coding performance, the encoder can use AQ to automatically adjust the quantization parameter (Quantizer Parameter, QP) according to the scene changes of the video content. According to the theory of human vision, people are more likely to pay attention to the quality changes in flat areas, but are not very sensitive to the quality changes in complex areas. Therefore, for complex coding units, AQ reduces the encoding bit rate by increasing the quantization step size. For simple coding units, AQ maintains video quality by reducing the quantization step size. In the x265 / x264 encoder, the encoder can use AQ to calculate a quantization parameter offset, i.e., the first quantization parameter offset, for the coding unit based on the variance of the coding unit. The first quantization parameter offset is calculated based on the spatial domain information of the coding unit.
[0049] 2. Second Quantization Parameter Offset
[0050] For inter-frame reference, the quality of the reference frame has a direct impact on the encoding quality of the current frame. Therefore, the encoder can also automatically adjust the quantization parameter according to the inter-frame correlation. The x264 encoder first introduced the mbTree algorithm, which calculates a quantization parameter offset for the current coding unit according to the degree to which the current coding unit is referenced, that is, the second quantization parameter offset. Simply put, if coding unit B completely references coding unit A, then the intra-frame prediction cost (IntraCostB) and inter-frame prediction cost (InterCostB) of coding unit B will be used to analyze the degree to which coding unit A is referenced. If IntraCostB is close to InterCostB, it means that coding unit B obtains less information from coding unit A. At this time, the degree to which coding unit A is referenced is weak. Therefore, there is no need to set the quality of coding unit A too high, that is, the second quantization parameter offset is large. If IntraCostB is much larger than InterCostB, it means that most of the information of coding unit B can be obtained from coding unit A. At this time, the degree to which coding unit A is referenced is strong. Therefore, it is necessary to set the quality of coding unit A a little higher, that is, the second quantization parameter offset is small. The x265 encoder inherits this algorithm and renamed it cuTree, that is, the x265 encoder calculates the second quantization parameter offset through the cuTree algorithm. The second quantization parameter offset is calculated based on the time domain information of the coding unit.
[0051] In principle, the AQ algorithm calculates the first quantization parameter offset based on spatial information, while the cuTree algorithm calculates the second quantization parameter offset based on temporal correlation. Generally speaking, the second quantization parameter offset is a negative number, that is, the second quantization parameter offset is less than 0, indicating that the reconstruction quality of the coding unit should be improved to improve the accuracy of inter-frame prediction. The first quantization parameter offset can be a positive number or a negative number. The characterization information of the first quantization parameter offset can include the sign of the first quantization parameter offset, that is, the sign indicating that the first quantization parameter offset is a positive number or a negative number. If the first quantization parameter offset is a positive number, that is, the first quantization parameter offset is greater than 0, then the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, that is, the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is not used to improve the reconstruction quality of the coding unit. If the first quantization parameter offset is a negative number, that is, the first quantization parameter offset is less than 0, then the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit.
[0052] In the encoding process, the existing encoder uses the sum of the first quantization parameter offset and the second quantization parameter offset as the final quantization parameter offset, that is, the target quantization parameter offset. However, due to the coupling relationship between the AQ algorithm and the CuTree algorithm, it is unreasonable to directly use the sum of the first quantization parameter offset and the second quantization parameter offset as the target quantization parameter offset of the encoding unit, that is, it is impossible to ensure that the video bit rate is minimized without affecting the video quality.
[0053] Based on this, an embodiment of the present application proposes a method for determining a quantization parameter offset, obtaining a first quantization parameter offset and a second quantization parameter offset of a coding unit; determining characterization information of the first quantization parameter offset, the characterization information of the first quantization parameter offset characterizing whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; determining a target quantization parameter offset of the coding unit based on the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; encoding the coding unit based on the target quantization parameter offset can ensure that the video bit rate is reduced without affecting the video quality, thereby effectively improving the coding efficiency.
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] The method for determining the quantization parameter offset provided in the embodiment of the present application can be applied in a client, a server or a computer device. The client or the server may include a video player, an image encoding plug-in, etc. The client or the server may be installed or integrated in a content publishing platform or a browser, and the content publishing platform or the browser may run in a computer device. The computer device includes but is not limited to a smart phone, a camera, a wearable device, a vehicle-mounted device or a personal computer, etc.
[0056] In one example, the method for determining the quantization parameter offset provided in the embodiment of the present application can be applied to the short video business scenario, and the video uploaded by the creator needs to be transcoded by the server, and the transcoded video is sent to the user for viewing. In order to minimize the bandwidth of the transcoded video and make the user's online viewing smoother, we need to improve the encoding efficiency of the encoder to ensure that the video bit rate is reduced under the premise that the video quality is not affected. Specifically, the server can obtain the video uploaded by the creator and encode the video. In the process of encoding the target frame in the video (i.e., any frame in the video), the server can obtain the first quantization parameter offset and the second quantization parameter offset of any coding unit in the target frame; determine the characterization information of the first quantization parameter offset, and the characterization information of the first quantization parameter offset represents whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; determine the target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; encode the coding unit based on the target quantization parameter offset, thereby realizing the encoding of any coding unit.
[0057] In another example, the method for determining the quantization parameter offset provided by the embodiment of the present application can be applied in a live broadcast business scenario. In order to minimize the bandwidth of the transcoded video and make the audience watch online more smoothly, we need to improve the encoding efficiency of the encoder to ensure that the video bit rate becomes smaller under the premise that the image quality of the live broadcast interface is not affected. The encoder needs to achieve a higher encoding efficiency. Therefore, improving the encoding efficiency of the video encoder is a technical problem that needs to be solved urgently. Specifically, the anchor client can collect the video of the anchor's environment in real time, and the anchor client can send the video to the server. The server can encode the video and send the encoded video to the audience client. In the process of encoding any coding unit in a target frame in the video (i.e., any frame in the video), the server can obtain a first quantization parameter offset and a second quantization parameter offset of the coding unit; determine characterization information of the first quantization parameter offset, where the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; determine a target quantization parameter offset of the coding unit based on the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset; encode the coding unit based on the target quantization parameter offset, thereby achieving encoding of any coding unit.
[0058] In the specific implementation of this application, user-related data, such as videos or images, is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with local laws, regulations and standards.
[0059] Based on the above description, see Figure 1 , Figure 1 is a flow chart of a method for determining a quantization parameter offset provided in an embodiment of the present application. The method for determining a quantization parameter offset can be executed by a client, a server or a computer device; Figure 1 The method for determining the quantization parameter offset shown includes but is not limited to steps S101 to S104, wherein:
[0060] S101, obtaining a first quantization parameter offset and a second quantization parameter offset of a coding unit, wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit.
[0061] The coding unit in the embodiment of the present application may refer to any coding unit in a target frame. The target frame may refer to any image or any frame in a video, and the video refers to a video to be encoded.
[0062] In one example, the first quantization parameter offset and the second quantization parameter offset can be calculated in real time. For example, when a coding unit needs to be encoded, the spatial domain information of the coding unit can be obtained, and the first quantization parameter offset of the coding unit can be calculated based on the spatial domain information of the coding unit. Specifically, the first quantization parameter offset of the coding unit can be calculated by AQ. The time domain information of the coding unit can also be obtained, and the second quantization parameter offset of the coding unit can be calculated based on the time domain information of the coding unit. Specifically, the second quantization parameter offset of the coding unit can be calculated by the cuTree algorithm.
[0063] In another example, the first quantization parameter offset and the second quantization parameter offset may be obtained from a preset memory, that is, the first quantization parameter offset and the second quantization parameter offset are obtained by offline calculation. For example, before encoding a coding unit, the spatial domain information of the coding unit may be obtained, and the first quantization parameter offset of the coding unit may be calculated based on the spatial domain information of the coding unit. The time domain information of the coding unit may also be obtained, and the second quantization parameter offset of the coding unit may be calculated based on the time domain information of the coding unit. The first quantization parameter offset and the second quantization parameter offset of the coding unit are stored in a preset memory. When the coding unit needs to be encoded, the first quantization parameter offset and the second quantization parameter offset of the coding unit are directly obtained from the preset memory.
[0064] S102: Determine characterization information of a first quantization parameter offset, where the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve reconstruction quality of a coding unit.
[0065] After obtaining the first quantization parameter offset, characterization information of the first quantization parameter offset can be determined. If the first quantization parameter offset is greater than 0, it is determined that the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit. If the first quantization parameter offset is less than 0, it is determined that the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit.
[0066] Among them, the reconstruction quality refers to the quality of the reconstructed coding unit obtained by reconstructing the coding unit based on the first quantization parameter offset. If the first quantization parameter offset is greater than 0, it indicates that the quantization parameter is increased. Since the higher the quantization parameter, the lower the quality of the reconstructed coding unit, if the first quantization parameter offset is greater than 0, it is determined that the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit. Conversely, if the first quantization parameter offset is less than 0, it indicates that the quantization parameter is reduced. Since the lower the quantization parameter, the higher the quality of the reconstructed coding unit, if the first quantization parameter offset is less than 0, it is determined that the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit.
[0067] Among them, the coding unit is the basic unit for intra-frame prediction or inter-frame prediction. For a coding unit of size 8×4 (i.e., the coding unit includes 8 rows and 4 columns of pixels), a prediction mode can be selected from the intra-frame prediction mode or the inter-frame prediction mode, and the prediction mode is used to generate the predicted pixel value of the coding unit. Then, the original pixel value of the coding unit is subtracted from the predicted pixel value of the coding unit to generate a prediction residual, and the prediction residual is transformed and quantized to generate a transform quantization coefficient. The transform quantization coefficient is dequantized and de-transformed to generate a reconstruction residual, and the reconstruction residual is added to the predicted pixel value to generate a reconstructed pixel value. The reconstructed pixel value is the pixel value of the reconstructed coding unit obtained by reconstructing the coding unit.
[0068] S103: Determine a target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset.
[0069] In an optional implementation, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is greater than the first quantization parameter offset, then the target quantization parameter offset of the coding unit is determined to be the first quantization parameter offset.
[0070] Specifically, after determining the characterization information of the first quantization parameter offset, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, that is, the first quantization parameter offset is less than 0, since the second quantization parameter offset is also less than 0, then the first quantization parameter offset and the second quantization parameter offset can be compared. If the second quantization parameter offset is greater than the first quantization parameter offset, it indicates that the quantization parameter offset (that is, the first quantization parameter offset) calculated by the AQ algorithm has met the requirements of the CuTree algorithm, so in this case, the first quantization parameter offset is used as the final quantization parameter offset, that is, the target quantization parameter offset of the coding unit is determined to be the first quantization parameter offset. It can be seen that in the embodiment of the present application, when the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is greater than the first quantization parameter offset, the first quantization parameter offset is used as the final quantization parameter offset. Compared with the prior art, the sum of the first quantization parameter offset and the second quantization parameter offset is used as the final quantization parameter offset. The final quantization parameter offset determined by the embodiment of the present application is larger, so that the magnitude of the quantization parameter reduction is smaller. Since the lower the quantization parameter, the lower the compression ratio, and the higher the video bit rate, the embodiment of the present application reduces the quantization parameter by a smaller margin compared to the prior art, thereby ensuring that the video bit rate is reduced without affecting the video quality.
[0071] Optionally, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is less than or equal to the first quantization parameter offset, the intra-frame prediction complexity of the coding unit is obtained; if the intra-frame prediction complexity of the coding unit is less than a preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be the minimum value of the first quantization parameter offset and the second quantization parameter offset.
[0072] Specifically, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is less than or equal to the first quantization parameter offset, then the intra-frame prediction complexity of the coding unit, that is, IntraSatd, can be obtained. If the intra-frame prediction complexity of the coding unit is less than the preset complexity threshold, it indicates that the coding unit is relatively simple. If the sum of the first quantization parameter offset and the second quantization parameter offset is used as the final quantization parameter offset using the prior art, since the first quantization parameter offset and the second quantization parameter offset are both less than 0, the sum of the first quantization parameter offset and the second quantization parameter offset will be very small. In the case where the coding unit is relatively simple, using a particularly small quantization parameter for encoding will only increase the video bit rate, but will not be able to further improve the accuracy of inter-frame prediction. Therefore, the minimum value of the first quantization parameter offset and the second quantization parameter offset is used as the final quantization parameter offset. For example, assuming that the first quantization parameter offset is -3 and the second quantization parameter offset is -10, since the second quantization parameter offset is smaller than the first quantization parameter offset, the second quantization parameter offset can be used as the final quantization parameter offset, that is, the target quantization parameter offset is determined to be the second quantization parameter offset.
[0073] Compared with the prior art which uses the sum of the first quantization parameter offset and the second quantization parameter offset as the final quantization parameter offset, in this embodiment, the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and when the second quantization parameter offset is less than or equal to the first quantization parameter offset and the intra-frame prediction complexity of the coding unit is less than a preset complexity threshold, the minimum value of the first quantization parameter offset and the second quantization parameter offset is used as the target quantization parameter offset of the coding unit, which can ensure that the video bit rate is reduced without affecting the video quality.
[0074] Optionally, if the intra-frame prediction complexity of the coding unit is greater than or equal to a preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0075] In this embodiment, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, the second quantization parameter offset is less than or equal to the first quantization parameter offset, and the intra-frame prediction complexity of the coding unit is greater than or equal to the preset complexity threshold, indicating that the coding unit is more complex, then a smaller quantization parameter encoding can be used to improve the inter-frame prediction accuracy, thereby ensuring that the video quality is not affected, and therefore the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0076] In an optional implementation, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, the average intra-frame prediction complexity of the image frame to which the coding unit belongs is obtained; based on the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the target quantization parameter offset of the coding unit is determined.
[0077] Specifically, after determining the characterization information of the first quantization parameter offset, if the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, that is, the first quantization parameter offset is greater than 0, since the second quantization parameter offset is less than 0, then the average intra-frame prediction complexity of the image frame to which the coding unit belongs can be obtained, and the target quantization parameter offset of the coding unit is determined according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit. Exemplarily, the average intra-frame prediction complexity of the image frame to which the coding unit belongs can be obtained by: obtaining the intra-frame prediction complexity of each coding unit in the image frame to which the coding unit belongs, and obtaining the average intra-frame prediction complexity of the image frame according to the intra-frame prediction complexity of each coding unit. For example, the intra-frame prediction complexity of each coding unit can be averaged to obtain the average intra-frame prediction complexity of the image frame. For another example, the intra-frame prediction complexity of each coding unit can be weighted to obtain the average intra-frame prediction complexity of the image frame. For another example, a variance operation may be performed on the intra-frame prediction complexity of each coding unit to obtain an average intra-frame prediction complexity of the image frame. For another example, a mean square error operation may be performed on the intra-frame prediction complexity of each coding unit to obtain an average intra-frame prediction complexity of the image frame.
[0078] Optionally, if the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is greater than the preset offset threshold, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from the preset factor to obtain the target quantization parameter offset.
[0079] Specifically, after obtaining the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs can be obtained. If the ratio is greater than the first preset ratio threshold and less than the second preset ratio threshold, and the second quantization parameter offset is greater than the preset offset threshold, it indicates that the coding unit is not very complex, then the temporal correlation will be larger than the spatial correlation. Since the first quantization parameter offset calculated by the temporal correlation is greater than 0, in order to increase the temporal correlation and improve the accuracy of inter-frame prediction, the final quantization parameter offset can be set slightly smaller, that is, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from the preset factor to obtain the target quantization parameter offset. The preset factor can be a value set based on prior knowledge, and the preset factor is greater than 0. For example, the preset factor can be 0.5, 1 or 1.3, etc., which is not limited by the embodiments of the present application.
[0080] Among them, the first preset ratio threshold, the second preset ratio threshold and the preset offset threshold can be threshold values set based on prior knowledge, and are not specifically limited by the embodiments of the present application.
[0081] In this embodiment, if the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than the first preset ratio threshold and less than the second preset ratio threshold, and the second quantization parameter offset is greater than the preset offset threshold, then the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from the preset factor to obtain the target quantization parameter offset, which can increase the time domain correlation to improve the inter-frame prediction accuracy, thereby improving the video quality.
[0082] Optionally, if the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, then the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0083] Specifically, after obtaining the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs can be obtained. If the ratio is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, indicating that the coding unit is relatively complex, a smaller quantization parameter can be used for encoding to improve the accuracy of inter-frame prediction, thereby ensuring that the video quality is not affected. Therefore, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0084] Optionally, if the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset ratio threshold, an adjustment factor is obtained; the sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain a target quantization parameter offset.
[0085] In this embodiment, if the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to the second preset ratio threshold, it indicates that the coding unit is a relatively complex coding unit in the image frame to which the coding unit belongs, that is, the coding unit is relatively complex relative to other coding units in the image frame, and the coding unit is relatively complex in the spatial domain. Since the first quantization parameter offset calculated by time domain correlation is greater than 0, in order to increase the spatial domain correlation to improve the accuracy of inter-frame prediction, the final quantization parameter offset can be set slightly larger, that is, the sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain the target quantization parameter offset. Therefore, in this embodiment, when the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to the second preset ratio threshold, the sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain the target quantization parameter offset, which can increase the spatial domain correlation to improve the accuracy of inter-frame prediction, thereby improving the video quality.
[0086] Optionally, a method for obtaining the adjustment factor may include: determining the adjustment factor based on a ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs, and a second preset ratio threshold; wherein the adjustment factor is greater than or equal to the first value, and the adjustment factor is less than or equal to the second value.
[0087] In this embodiment, if the adjustment factor is large, the accuracy of inter-frame prediction will drop sharply relative to the accuracy of inter-frame prediction obtained by the prior art. If the adjustment factor is small, the reduction in video bit rate will not be obvious. Therefore, the determined adjustment factor needs to satisfy the requirement of being greater than or equal to the first value and less than or equal to the second value. Among them, the first value and the second value are set according to prior knowledge, and the second value is greater than the first value. For example, the first value can be 0.2 or 0.3, etc., and the second value can be 0.7 or 0.8, etc., which is not specifically limited by the embodiments of the present application.
[0088] Exemplarily, the adjustment factor can be calculated using the following calculation formula.
[0089] adjustQp=clip3(M,N,2^(Intra2AvgRatio-thr3))
[0090] Wherein, adjustQp represents an adjustment factor, Intra2AvgRatio represents the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs, thr3 represents a second preset ratio threshold, M represents a first value, and N represents a second value. adjustQp=clip3(M,N,2^(Intra2AvgRatio-thr3)) can be understood as: adjustQp=2^(Intra2AvgRatio-thr3, and M≤adjustQp≤N.
[0091] Optionally, if the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is less than or equal to a first preset ratio threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0092] Specifically, after obtaining the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs can be obtained. If the ratio is less than or equal to the first preset ratio threshold, it indicates that the coding unit is a relatively simple coding unit in the image frame to which the coding unit belongs, that is, the coding unit is relatively simple relative to other coding units in the image frame. Then, in order to ensure that the video quality is not affected, the target quantization parameter offset of the coding unit can be determined as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0093] S104: Encode the coding unit based on the target quantization parameter offset.
[0094] For example, an initial quantization parameter of a coding unit may be obtained, and the initial quantization parameter may be added to a target quantization parameter offset to obtain a target quantization parameter of the coding unit, and then the coding unit may be encoded based on the target quantization parameter. The method for determining the initial quantization parameter of the coding unit is the same as the method for determining the quantization parameter of the coding unit in the prior art, and will not be described in detail in the embodiments of the present application.
[0095] In an embodiment of the present application, a target quantization parameter offset of a coding unit is determined based on characterization information of a first quantization parameter offset, a first quantization parameter offset, and a second quantization parameter offset, and the coding unit is encoded based on the target quantization parameter offset. This can ensure that the video bit rate is reduced without affecting the video quality, thereby effectively improving the coding efficiency.
[0096] An embodiment of the present application further provides a computer storage medium, in which program instructions are stored. When the program instructions are executed, they are used to implement the corresponding methods described in the above embodiments.
[0097] See also Figure 2 , Figure 2 It is a structural diagram of a device for determining a quantization parameter offset provided in an embodiment of the present application.
[0098] In one implementation of the device for determining a quantization parameter offset in an embodiment of the present application, the device for determining a quantization parameter offset includes the following structure.
[0099] An acquiring unit 201 is configured to acquire a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit;
[0100] A processing unit 202 is used to determine characterization information of the first quantization parameter offset; wherein the characterization information of the first quantization parameter offset represents whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; determine a target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; and encode the coding unit based on the target quantization parameter offset.
[0101] In one embodiment, the processing unit 202 determines the target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset, including:
[0102] If the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is greater than the first quantization parameter offset, then the target quantization parameter offset of the coding unit is determined to be the first quantization parameter offset.
[0103] In one embodiment, the processing unit 202 is further configured to:
[0104] If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is less than or equal to the first quantization parameter offset, then obtaining the intra-frame prediction complexity of the coding unit;
[0105] If the intra prediction complexity of the coding unit is less than a preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be a minimum value between the first quantization parameter offset and the second quantization parameter offset.
[0106] In one embodiment, the processing unit 202 is further configured to:
[0107] If the intra prediction complexity of the coding unit is greater than or equal to the preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0108] In one embodiment, the processing unit 202 determines the target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset, including:
[0109] If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, obtaining an average intra-frame prediction complexity of the image frame to which the coding unit belongs;
[0110] A target quantization parameter offset of the coding unit is determined according to an average intra-frame prediction complexity of an image frame to which the coding unit belongs and an intra-frame prediction complexity of the coding unit.
[0111] In one embodiment, the processing unit 202 determines the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, including:
[0112] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is greater than a preset offset threshold, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from a preset factor to obtain the target quantization parameter offset.
[0113] In one embodiment, the processing unit 202 is further configured to:
[0114] If the ratio of the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, then the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0115] In one embodiment, the processing unit 202 determines the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, including:
[0116] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset ratio threshold, obtaining an adjustment factor;
[0117] The sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain the target quantization parameter offset.
[0118] In one embodiment, the processing unit 202 obtains the adjustment factor, including:
[0119] The adjustment factor is determined according to the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs, and the second preset ratio threshold; wherein the adjustment factor is greater than or equal to the first value, and the adjustment factor is less than or equal to the second value.
[0120] In one embodiment, the processing unit 202 determines the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, including:
[0121] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is less than or equal to a first preset ratio threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0122] In the embodiment of the present application, the acquisition unit 201 acquires the first quantization parameter offset and the second quantization parameter offset of the coding unit, the processing unit 202 determines the characterization information of the first quantization parameter offset, and determines the target quantization parameter offset of the coding unit based on the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset, and encodes the coding unit based on the target quantization parameter offset, which can ensure that the video bit rate is reduced without affecting the video quality, thereby effectively improving the coding efficiency.
[0123] See also Figure 3 , Figure 3 3 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device in the embodiment of the present application includes a power supply module and other structures, and includes a processor 301, a storage device 302 and a communication interface 303. The processor 301, the storage device 302 and the communication interface 303 can exchange data, and the processor 301 implements the corresponding quantization parameter offset determination method.
[0124] The storage device 302 may include a volatile memory, such as a random-access memory (RAM); the storage device 302 may also include a non-volatile memory, such as a flash memory, a solid-state drive (SSD), etc.; the storage device 302 may also include a combination of the above types of memory.
[0125] The processor 301 may be a central processing unit (CPU), or a combination of a CPU and a GPU.
[0126] In one embodiment, the storage device 302 is used to store program instructions. The processor 301 can call the program instructions to implement the various methods involved in the embodiments of the present application.
[0127] In a first possible implementation, a processor 301 of a computer device calls a program instruction stored in a storage device 302 to obtain a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on time domain information of the coding unit; characterization information of the first quantization parameter offset is determined; wherein the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; a target quantization parameter offset of the coding unit is determined according to the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; and the coding unit is encoded based on the target quantization parameter offset.
[0128] In one embodiment, when determining the target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset, the processor 301 is configured to perform the following operations:
[0129] If the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is greater than the first quantization parameter offset, then the target quantization parameter offset of the coding unit is determined to be the first quantization parameter offset.
[0130] In one embodiment, the processor 301 is further configured to perform the following operations:
[0131] If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is less than or equal to the first quantization parameter offset, then obtaining the intra-frame prediction complexity of the coding unit;
[0132] If the intra prediction complexity of the coding unit is less than a preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be a minimum value between the first quantization parameter offset and the second quantization parameter offset.
[0133] In one embodiment, the processor 301 is further configured to perform the following operations:
[0134] If the intra prediction complexity of the coding unit is greater than or equal to the preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0135] In one embodiment, when determining the target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset, the processor 301 is configured to perform the following operations:
[0136] If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, obtaining an average intra-frame prediction complexity of the image frame to which the coding unit belongs;
[0137] A target quantization parameter offset of the coding unit is determined according to an average intra-frame prediction complexity of an image frame to which the coding unit belongs and an intra-frame prediction complexity of the coding unit.
[0138] In one embodiment, when determining the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the processor 301 is configured to perform the following operations:
[0139] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is greater than a preset offset threshold, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from a preset factor to obtain the target quantization parameter offset.
[0140] In one embodiment, the processor 301 is further configured to perform the following operations:
[0141] If the ratio of the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, then the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0142] In one embodiment, when determining the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the processor 301 is configured to perform the following operations:
[0143] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset ratio threshold, obtaining an adjustment factor;
[0144] The sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain the target quantization parameter offset.
[0145] In one embodiment, the processor 301 is configured to perform the following operations when acquiring the adjustment factor:
[0146] The adjustment factor is determined according to the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs, and the second preset ratio threshold; wherein the adjustment factor is greater than or equal to the first value, and the adjustment factor is less than or equal to the second value.
[0147] In one embodiment, when determining the target quantization parameter offset of the coding unit according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, the processor 301 is configured to perform the following operations:
[0148] If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is less than or equal to a first preset ratio threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
[0149] In an embodiment of the present application, the processor 301 obtains a first quantization parameter offset and a second quantization parameter offset of a coding unit, determines characterization information of the first quantization parameter offset, and determines a target quantization parameter offset of the coding unit based on the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset. The coding unit is encoded based on the target quantization parameter offset, which can ensure that the video bit rate is reduced without affecting the video quality, thereby effectively improving the coding efficiency.
[0150] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0151] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiments and making equivalent changes according to the claims of this application are still within the scope of the present invention.
Claims
1. A method for determining a quantization parameter offset, characterized in that: include: Obtaining a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit; Determining characterization information of the first quantization parameter offset; wherein the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; Determining a target quantization parameter offset of the encoding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset; The coding unit is encoded based on the target quantization parameter offset.
2. The method according to claim 1, characterized in that The determining, according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset, a target quantization parameter offset of the encoding unit includes: If the characterization information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is greater than the first quantization parameter offset, then the target quantization parameter offset of the coding unit is determined to be the first quantization parameter offset.
3. The method according to claim 2, characterized in that The method further comprises: If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, and the second quantization parameter offset is less than or equal to the first quantization parameter offset, then obtaining the intra-frame prediction complexity of the coding unit; If the intra prediction complexity of the coding unit is less than a preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be a minimum value between the first quantization parameter offset and the second quantization parameter offset.
4. The method according to claim 3, characterized in that The method further comprises: If the intra prediction complexity of the coding unit is greater than or equal to the preset complexity threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
5. The method according to claim 2, characterized in that The determining, according to the characterization information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset, a target quantization parameter offset of the encoding unit includes: If the representation information of the first quantization parameter offset represents that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, obtaining an average intra-frame prediction complexity of the image frame to which the coding unit belongs; A target quantization parameter offset of the coding unit is determined according to an average intra-frame prediction complexity of an image frame to which the coding unit belongs and an intra-frame prediction complexity of the coding unit.
6. The method according to claim 5, characterized in that The determining, according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, a target quantization parameter offset of the coding unit comprises: If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is greater than a preset offset threshold, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted from a preset factor to obtain the target quantization parameter offset.
7. The method according to claim 6, characterized in that The method further comprises: If the ratio of the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than a first preset ratio threshold and less than a second preset ratio threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, then the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
8. The method according to claim 5, characterized in that The determining, according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, a target quantization parameter offset of the coding unit comprises: If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset ratio threshold, obtaining an adjustment factor; The sum of the first quantization parameter offset and the second quantization parameter offset is added to the adjustment factor to obtain the target quantization parameter offset.
9. The method according to claim 8, characterized in that The obtaining of the adjustment factor comprises: The adjustment factor is determined according to the ratio between the intra-frame prediction complexity of the coding unit and the average intra-frame prediction complexity of the image frame to which the coding unit belongs, and the second preset ratio threshold; wherein the adjustment factor is greater than or equal to the first value, and the adjustment factor is less than or equal to the second value.
10. The method according to claim 5, characterized in that The determining, according to the average intra-frame prediction complexity of the image frame to which the coding unit belongs and the intra-frame prediction complexity of the coding unit, a target quantization parameter offset of the coding unit comprises: If the ratio of the intra-frame prediction complexity of the coding unit to the average intra-frame prediction complexity of the image frame to which the coding unit belongs is less than or equal to a first preset ratio threshold, the target quantization parameter offset of the coding unit is determined to be the sum of the first quantization parameter offset and the second quantization parameter offset.
11. A device for determining a quantization parameter offset, characterized in that: The device comprises: An acquisition unit, configured to acquire a first quantization parameter offset and a second quantization parameter offset of a coding unit; wherein the first quantization parameter offset is calculated based on spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on temporal domain information of the coding unit; A processing unit, used to determine characterization information of the first quantization parameter offset; wherein the characterization information of the first quantization parameter offset characterizes whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit; determine a target quantization parameter offset of the coding unit according to the characterization information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; and encode the coding unit based on the target quantization parameter offset.
12. A computer device, characterized in that: The computer device comprises a processor, a storage device and a communication interface, wherein the processor, the storage device and the communication interface are connected to each other, wherein: The storage device is used to store a computer program, wherein the computer program includes program instructions; The processor is used to call the program instructions to execute the method for determining the quantization parameter offset as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, they are used to execute the method for determining a quantization parameter offset as described in any one of claims 1 to 10.
14. A computer program product, characterized in that The computer program product comprises a computer program, and the computer program is suitable for being loaded by a processor and executing the method for determining a quantization parameter offset according to any one of claims 1 to 10.
Citation Information
Patent Citations
Video coding method, device, system and computer readable storage medium
CN112584143A
Video coding method, device, equipment, storage medium and computer program product
CN117880507A
Video coding method and device, computer equipment, storage medium and program product
CN118317085A
Quantization parameter determination method and related product
CN118540477A
Video compression processing method and device, equipment and storage medium
CN118590648A