Method, apparatus, device, storage medium and program product for determining quantization parameter offset
By determining the quantization parameter offset representation information of the coding unit and combining spatial and temporal information, the target quantization parameter offset is calculated, which solves the contradiction between improving video coding efficiency and maintaining video quality in the existing technology, and achieves the effect of reducing video bitrate while ensuring image quality.
Patent Information
- Application Number
- CN202411369377.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-09-29
AI Technical Summary
While improving coding efficiency, existing video coding technologies cannot effectively reduce video bitrate without affecting video quality. In particular, when the AQ and CuTree algorithms are coupled, the sum of quantization parameter offsets is directly used as the target quantization parameter offset, which makes it impossible to minimize the video bitrate.
By obtaining the first quantization parameter offset and the second quantization parameter offset of the coding unit, its characterization information is determined. Based on the characterization information, the first quantization parameter offset and the second quantization parameter offset, the target quantization parameter offset of the coding unit is calculated so as to reduce the video bitrate without affecting the video quality.
It effectively improves encoding efficiency, ensures that video quality is not affected while reducing video bitrate, and optimizes resource utilization during the encoding process.
Smart Images

Figure CN119299688B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer application, and in particular, relates to a method and device for determining a quantization parameter offset, a storage medium, and a program product. BACKGROUND
[0002] Video encoding is the process of converting video signals into digital data and compressing the data while maintaining as high a visual quality as possible. The goal of video encoding is to reduce the storage space and transmission bandwidth requirements of video data in order to effectively store, transmit, and process video content under limited resource conditions. In video encoding, video signals are decomposed into a series of image frames or inter-frame differences (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 transcoded video and make online viewing more smooth, the encoding efficiency of the encoder needs to be improved to ensure that the video quality is not affected while the video code rate is reduced. Therefore, how to effectively improve the encoding efficiency is a technical problem that needs to be solved at present. SUMMARY
[0004] The embodiments of the present application provide a method and device for determining a quantization parameter offset, a storage medium, and a program product, which can effectively improve the encoding efficiency.
[0005] In one aspect, the embodiments of the present application provide a method for determining a quantization parameter offset, which comprises:
[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 information of the coding unit, and the second quantization parameter offset is calculated based on temporal information of the coding unit;
[0007] determining representation information of the first quantization parameter offset; wherein the representation 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;
[0008] determining a target quantization parameter offset of the coding unit according to the representation information of the first quantization parameter offset, the first quantization parameter offset, and the second quantization parameter offset;
[0009] encoding the coding unit based on the target quantization parameter offset.
[0010] In an embodiment, the 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 comprises:
[0011] If the characterization information of the first quantization parameter offset indicates 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 target quantization parameter offset of the coding unit is determined as the first quantization parameter offset.
[0012] In an embodiment, the method further comprises:
[0013] If the characterization information of the first quantization parameter offset indicates 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 prediction complexity of the coding unit is obtained.
[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 as the minimum value of the first quantization parameter offset and the second quantization parameter offset.
[0015] In an 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 as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0017] In an embodiment, the 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 comprises:
[0018] If the characterization information of the first quantization parameter offset indicates that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, the average intra prediction complexity of the image frame to which the coding unit belongs is obtained.
[0019] The target quantization parameter offset of the coding unit is determined according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit.
[0020] In one embodiment, the method further comprises:
[0021] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than the first preset proportion threshold and less than the second preset proportion 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 by a preset factor to obtain the target quantization parameter offset.
[0022] In one embodiment, the method further comprises:
[0023] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than the first preset proportion threshold and less than the second preset proportion 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 as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0024] In one embodiment, the method further comprises:
[0025] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than or equal to the second preset proportion threshold, then an adjustment factor is obtained.
[0026] The sum of the first quantization parameter offset and the second quantization parameter offset is added by the adjustment factor to obtain the target quantization parameter offset.
[0027] In one embodiment, the method further comprises:
[0028] The adjustment factor is determined according to the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs, and the second preset proportion threshold; wherein the adjustment factor is greater than or equal to a first numerical value, and the adjustment factor is less than or equal to a second numerical value.
[0029] In one embodiment, the method further comprises:
[0030] If a ratio between the intra prediction complexity of the coding unit and an average intra prediction complexity of a frame of an image to which the coding unit belongs is less than or equal to a first preset proportion threshold, a target quantization parameter offset of the coding unit is determined as a sum of the first quantization parameter offset and the second quantization parameter offset.
[0031] In another aspect, an embodiment of the present application provides a quantization parameter offset determination device, which comprises:
[0032] An acquisition unit 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 time domain information of the coding unit.
[0033] A processing unit is configured to determine representation information of the first quantization parameter offset, wherein the representation information of the first quantization parameter offset represents whether the first quantization parameter offset is used to improve reconstruction quality of the coding unit, determine a target quantization parameter offset of the coding unit according to the representation 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] In another aspect, an embodiment of the present application provides a computer device, which comprises a processor, a storage device and a communication interface, and the processor, the storage device and the communication interface are connected to each other, wherein the storage device is configured to store a computer program supporting the computer device to execute the above method, the computer program comprises program instructions, the processor is configured to invoke the program instructions, and the following steps are executed:
[0035] An acquisition unit 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 time domain information of the coding unit.
[0036] A processing unit is configured to determine representation information of the first quantization parameter offset, wherein the representation information of the first quantization parameter offset represents whether the first quantization parameter offset is used to improve reconstruction quality of the coding unit.
[0037] A processing unit is configured to determine a target quantization parameter offset of the coding unit according to the representation information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset.
[0038] encode the coding unit based on the target quantization parameter offset.
[0039] In another aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program includes program instructions, which, when executed by a processor, cause the processor to perform the above-mentioned method for determining a quantization parameter offset.
[0040] In another aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is adapted to be loaded by a processor and perform the above-mentioned method for determining a 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 (AQ), and the second quantization parameter offset can be calculated based on the time domain information of the coding unit through the CuTree algorithm. Since there is a coupling relationship between the AQ and the CuTree algorithm, directly taking the sum of the first quantization parameter offset and the second quantization parameter offset as the target quantization parameter offset of the coding unit cannot guarantee that the minimization of the video code rate is realized on the premise that the video quality is not affected. Therefore, the embodiment of the present application considers the coupling relationship between the AQ and the CuTree algorithm, determines the target quantization parameter offset of the coding unit according to the representation 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 guarantee that the video code rate is reduced on the premise that the video quality is not affected, thereby effectively improving the coding efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0043] Figure 1 is a flowchart of a method for determining a quantization parameter offset provided by an embodiment of the present application;
[0044] Figure 2 is a structural diagram of a quantization parameter offset determination device provided by an embodiment of the present application;
[0045] Figure 3 is a structural diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0046] The background technology related to the embodiments of the present application will be introduced below, so as to better understand the technical solutions of the embodiments of the present application.
[0047] I. First quantization parameter offset
[0048] In the field of video encoding, in order to improve the encoding performance, the encoder can use AQ to automatically adjust the quantization parameter (QP) according to the scene change of the video content. According to the human visual theory, people are more likely to pay attention to the quality change of the flat area, and are not very sensitive to the quality change of the complex area. Therefore, for a complex coding unit, AQ reduces the coding bit rate by increasing the quantization step. For a simple coding unit, AQ maintains the video quality by reducing the quantization step. In the x265 / x264 encoder, the encoder can calculate a quantization parameter offset for the coding unit according to the variance of the coding unit by AQ, that is, the first quantization parameter offset. The first quantization parameter offset is calculated based on the spatial information of the coding unit.
[0049] II. 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 to calculate 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. In simple terms, if the coding unit B completely references the coding unit A, then the intra prediction cost (IntraCostB) and the inter prediction cost (InterCostB) of the coding unit B will be used to analyze the degree to which the coding unit A is referenced. If IntraCostB is similar to InterCostB, it means that the coding unit B obtains less information from the coding unit A, at this time, the degree to which the coding unit A is referenced is weak, therefore, the quality of the coding unit A does not need to be set too high, that is, the second quantization parameter offset is larger. If IntraCostB is much larger than InterCostB, it means that most of the information of the coding unit B can be obtained from the coding unit A, at this time, the degree to which the coding unit A is referenced is strong, therefore, the quality of the coding unit A needs to be set a little higher, that is, the second quantization parameter offset is smaller. The x265 encoder inherits this algorithm and is renamed as cuTree, that is, the x265 encoder calculates the second quantization parameter offset by the cuTree algorithm. The second quantization parameter offset is calculated based on the temporal information of the coding unit.
[0051] In principle, the AQ algorithm calculates the first quantization parameter offset based on spatial domain information, and the cuTree algorithm calculates the second quantization parameter offset based on temporal correlation. Generally, the second quantization parameter offset is negative, i.e., the second quantization parameter offset is less than 0, indicating that the reconstruction quality of the coding unit is to be improved to improve the inter-frame prediction accuracy. The first quantization parameter offset can be positive or negative. The representation information of the first quantization parameter offset can include the sign of the first quantization parameter offset, i.e., a sign indicating whether the first quantization parameter offset is positive or negative. If the first quantization parameter offset is positive, i.e., the first quantization parameter offset is greater than 0, the representation information of the first quantization parameter offset indicates that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, i.e., the representation information of the first quantization parameter offset indicates 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 negative, i.e., the first quantization parameter offset is less than 0, the representation information of the first quantization parameter offset indicates 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, i.e., the target quantization parameter offset. However, since there is a 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 coding unit, i.e., it is impossible to minimize the video code rate without affecting the video quality.
[0053] Based on this, an embodiment of the present application proposes a method for determining a quantization parameter offset. The first quantization parameter offset and the second quantization parameter offset of a coding unit are obtained. The representation information of the first quantization parameter offset is determined, which indicates whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit. The target quantization parameter offset of the coding unit is determined according to the representation 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 reduce the video code rate without affecting the video quality, thereby effectively improving the encoding efficiency.
[0054] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0055] The method for determining a quantization parameter offset provided by the embodiments of the present application can be applied in a client, a server or a computer device. The client or the server can include a video player, an image coding plug-in, etc., and the client or the server can be installed or integrated in a content publishing platform or a browser, which can 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 a quantization parameter offset provided by the embodiments of the present application can be applied in a short video service scenario. A video uploaded by a creator needs to be transcoded by a server, and the transcoded video is then delivered to a user for viewing. In order to reduce the bandwidth of the transcoded video to the greatest extent and make the online viewing of the user more smooth, the coding efficiency of the encoder needs to be improved to ensure that the video quality is not affected and the video code rate is smaller. Specifically, the server can obtain a video uploaded by a creator and code the video. In the process of coding a target frame (i.e., any frame in the video) in the video, the server can obtain a first quantization parameter offset and a second quantization parameter offset of any coding unit in the target frame; determine representation information of the first quantization parameter offset, which 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 representation information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset; and code the coding unit based on the target quantization parameter offset, thereby realizing the coding of any coding unit.
[0057] In another example, the method for determining a quantization parameter offset provided by the embodiments of the present application can be applied in a live broadcast service scenario. In order to maximize the bandwidth of the transcoded video and at the same time make the online viewing of the audience more smooth, the encoding efficiency of the encoder needs to be improved to ensure that the image quality of the live interface is not affected under the premise of making the video code rate smaller, and 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 at present. Specifically, the anchor client can collect a video of an environment in which the anchor is located in real time, and the anchor client can send the video to a server. The server can encode the video and send the encoded video to a viewer client. In the process of encoding any coding unit in a target frame (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 the representation information of the first quantization parameter offset, which 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 representation 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, thereby realizing the encoding of any coding unit.
[0058] In the detailed description of the present application, data related to users, such as videos or images, etc., need to obtain the permission or consent of the users when the embodiments of the present application are applied to specific products or technologies, and the collection, use, and processing of the related data need to comply with the local laws, regulations, and standards.
[0059] Based on the above description, please refer to Figure 1 , Figure 1 is a flowchart of a method for determining a quantization parameter offset provided by the embodiments of the present application, which can be executed by a client, a server, or a computer device; as shown in Figure 1 the method for determining a quantization parameter offset includes but is not limited to steps S101-S104, wherein:
[0060] S101, obtaining a first quantization parameter offset and a second quantization parameter offset of a coding unit, the first quantization parameter offset being calculated based on the spatial domain information of the coding unit, and the second quantization parameter offset being calculated based on the time domain information of the coding unit.
[0061] The coding unit in the embodiments of the present application can refer to any coding unit in a target frame. The target frame can 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, spatial domain information of the coding unit can be obtained, the first quantization parameter offset of the coding unit can be calculated based on the spatial domain information of the coding unit, and specifically, the first quantization parameter offset of the coding unit can be calculated by AQ. The temporal 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 temporal domain information of the coding unit, and specifically, the second quantization parameter offset of the coding unit can be calculated by cuTree algorithm.
[0063] In another example, the first quantization parameter offset and the second quantization parameter offset can be obtained from a preset memory, that is, the first quantization parameter offset and the second quantization parameter offset are calculated offline. For example, before a coding unit is encoded, spatial domain information of the coding unit can be obtained, the first quantization parameter offset of the coding unit can be calculated based on the spatial domain information of the coding unit, and the temporal 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 temporal domain information of the coding unit. The first quantization parameter offset and the second quantization parameter offset of the coding unit are stored in the 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 the representation information of the first quantization parameter offset, the representation information of the first quantization parameter offset indicating whether the first quantization parameter offset is used to improve the reconstruction quality of the coding unit.
[0065] After the first quantization parameter offset is obtained, the representation 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 representation information of the first quantization parameter offset indicates 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 representation information of the first quantization parameter offset indicates that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit.
[0066] The reconstruction quality refers to a quality of a 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, and since the higher the quantization parameter, the lower the quality of the reconstructed coding unit obtained by reconstruction, if the first quantization parameter offset is greater than 0, it is determined that 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. Conversely, if the first quantization parameter offset is less than 0, it indicates that the quantization parameter is reduced, and since the lower the quantization parameter, the higher the quality of the reconstructed coding unit obtained by reconstruction, if the first quantization parameter offset is less than 0, it is determined that 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.
[0067] The coding unit is a basic unit for intra prediction or inter prediction. For a coding unit with a size of 8x4 (i.e., the coding unit includes 8 rows and 4 columns of pixels), a prediction mode can be selected from an intra prediction mode or an inter prediction mode, and prediction pixel values of the coding unit are generated using the prediction mode. Then, the original pixel values of the coding unit are subtracted from the prediction pixel values of the coding unit to generate prediction residuals, and the prediction residuals are subjected to transform and quantization to generate transform and quantization coefficients. The transform and quantization coefficients are subjected to inverse quantization and inverse transformation to generate reconstructed residuals, and the reconstructed residuals are added to the prediction pixel values to generate reconstructed pixel values. The reconstructed pixel values are pixel values of a reconstructed coding unit obtained by reconstructing the coding unit.
[0068] In S103, the target quantization parameter offset of the coding unit is determined according to the representation 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 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 greater than the first quantization parameter offset, the target quantization parameter offset of the coding unit is determined as the first quantization parameter offset.
[0070] Specifically, after the representation information of the first quantization parameter offset is determined, if the representation information of the first quantization parameter offset indicates that the first quantization parameter offset is used to improve the reconstruction quality of the coding unit, i.e., the first quantization parameter offset is less than 0, and since the second quantization parameter offset is also less than 0, 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 calculated by the AQ algorithm (i.e., the first quantization parameter offset) has met the requirements of the CuTree algorithm, and thus in this case, the first quantization parameter offset is taken as the final quantization parameter offset, i.e., the target quantization parameter offset of the coding unit is determined as the first quantization parameter offset. As can be seen, in the case where the representation information of the first quantization parameter offset indicates 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 taken as the final quantization parameter offset, which is different from the prior art in which the sum of the first quantization parameter offset and the second quantization parameter offset is taken as the final quantization parameter offset. In the embodiment of the present application, the final quantization parameter offset determined is greater, and thus the reduction amplitude of the quantization parameter is smaller. Since the lower the quantization parameter is, the lower the compression ratio is, and the higher the video code rate is, the embodiment of the present application reduces the quantization parameter by a smaller amplitude, compared with the prior art, and thus can ensure that the video quality is not affected while reducing the video code rate.
[0071] Optionally, if the representation information of the first quantization parameter offset indicates 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 prediction complexity of the coding unit is obtained; and 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 as the minimum value of the first quantization parameter offset and the second quantization parameter offset.
[0072] Specifically, if the representation information of the first quantization parameter offset indicates 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 IntraSatd of the coding unit can be obtained. If the IntraSatd of the coding unit is less than a 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 in the prior art, since both the first quantization parameter offset and the second quantization parameter offset are less than 0, the sum of the first quantization parameter offset and the second quantization parameter offset will be very small. In the case of a relatively simple coding unit, using a particularly small quantization parameter for coding will only increase the video code rate, and cannot further improve the inter prediction accuracy. 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 less than the first quantization parameter offset, the second quantization parameter offset can be used as the final quantization parameter offset, i.e., the target quantization parameter offset is determined as the second quantization parameter offset.
[0073] Compared with the prior art in which the sum of the first quantization parameter offset and the second quantization parameter offset is used as the final quantization parameter offset, in the case where the representation information of the first quantization parameter offset indicates 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 IntraSatd of the coding unit is less than the 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 quality is not affected while reducing the video code rate.
[0074] Optionally, if the IntraSatd 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 as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0075] In the embodiment, if the representation information of the first quantization parameter offset indicates 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 IntraSatd of the coding unit is greater than or equal to the preset complexity threshold, it indicates that the coding unit is relatively complex. Therefore, a smaller quantization parameter can be used for coding to improve the inter prediction accuracy, so as to ensure that the video quality is not affected. Thus, the target quantization parameter offset of the coding unit is determined as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0076] In an optional implementation, if the representation information of the first quantization parameter offset indicates that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, the average intra prediction complexity of the image frame to which the coding unit belongs is obtained; and the target quantization parameter offset of the coding unit is determined according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit.
[0077] Specifically, after the representation information of the first quantization parameter offset is determined, if the representation information of the first quantization parameter offset indicates that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, i.e., the first quantization parameter offset is greater than 0, and the second quantization parameter offset is less than 0, then the average intra 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 prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit. For example, the average intra prediction complexity of the image frame to which the coding unit belongs can be obtained by averaging the intra prediction complexities of all coding units in the image frame, or by weighting the intra prediction complexities of all coding units in the image frame, or by calculating the variance of the intra prediction complexities of all coding units in the image frame, or by calculating the mean square error of the intra prediction complexities of all coding units in the image frame.
[0078] Optionally, if the ratio of the intra prediction complexity of the coding unit to the average intra prediction complexity of the image frame to which the coding unit belongs is greater than a first preset proportion threshold and less than a second preset proportion threshold, and the second quantization parameter offset is greater than a preset offset threshold, then the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted by a preset factor to obtain the target quantization parameter offset.
[0079] Specifically, after obtaining the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit, a ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs can be obtained. If the ratio is greater than a first preset proportion threshold and less than a second preset proportion threshold, and the second quantization parameter offset is greater than a preset offset threshold, it indicates that the coding unit is not very complex, and the temporal correlation is relatively greater 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 inter prediction accuracy, the final quantization parameter offset can be set to be slightly smaller, that is, the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted by a preset factor to obtain a 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, and the specific value is not limited by the embodiments of the present application.
[0080] In the embodiments, the first preset proportion threshold, the second preset proportion threshold and the preset offset threshold can be threshold values set based on prior knowledge, and the specific value is not limited by the embodiments of the present application.
[0081] In the embodiments, if the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than the first preset proportion threshold and less than the second preset proportion 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 by a preset factor to obtain a target quantization parameter offset, which can increase the temporal correlation and improve the inter prediction accuracy, thereby improving the video quality.
[0082] Optionally, if the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than the first preset proportion threshold and less than the second preset proportion threshold, and the second quantization parameter offset is less than or equal to the preset offset threshold, the target quantization parameter offset of the coding unit is determined as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0083] Specifically, after obtaining the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit, a ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs can be obtained. If the ratio is greater than a first preset proportion threshold and less than a second preset proportion threshold, and the second quantization parameter offset is less than or equal to a preset offset threshold, it indicates that the coding unit is relatively complex, and then a smaller quantization parameter can be used for coding to improve the inter prediction accuracy, so as to ensure that the video quality is not affected, and thus the target quantization parameter offset of the coding unit is determined as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0084] Optionally, if the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than or equal to the second preset proportion threshold, an adjustment factor is obtained, and 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.
[0085] In this embodiment, if the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than or equal to the second preset proportion threshold, it indicates that the coding unit is relatively complex in the image frame to which the coding unit belongs, i.e., the coding unit is relatively complex compared with 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 the temporal correlation is greater than 0, in order to increase the spatial correlation and improve the inter prediction accuracy, the final quantization parameter offset can be set to be slightly larger, i.e., 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 the case that the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than or equal to the second preset proportion 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 correlation and improve the inter prediction accuracy, thereby improving the video quality.
[0086] Optionally, the adjustment factor can be obtained in the following manner: determining the adjustment factor according to the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs and the second preset proportion threshold, wherein the adjustment factor is greater than or equal to a first numerical value and less than or equal to a second numerical value.
[0087] If the adjustment factor is large, the inter prediction accuracy in this embodiment will be sharply reduced compared with the inter prediction accuracy obtained by the prior art. If the adjustment factor is small, the video code rate will not be reduced significantly. Therefore, the determined adjustment factor needs to satisfy greater than or equal to a first value and less than or equal to a second value. 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, and the second value can be 0.7 or 0.8, which are not limited by the embodiments of the present application.
[0088] For example, the adjustment factor can be calculated by the following calculation formula.
[0089] adjustQp = clip3(M, N, 2^(Intra2AvgRatio-thr3))
[0090] Wherein, adjustQp represents the adjustment factor, Intra2AvgRatio represents the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs, thr3 represents the second preset proportion threshold, M represents the first value, and N represents the 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 prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is less than or equal to the first preset proportion threshold, the target quantization parameter offset of the coding unit is determined as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0092] Specifically, after obtaining the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit, the ratio between the intra prediction complexity of the coding unit and the average intra 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 proportion threshold, it indicates that the coding unit is a relatively simple coding unit in the image frame to which the coding unit belongs, i.e., the coding unit is relatively simple compared with 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, encoding the coding unit based on the target quantization parameter offset.
[0094] For example, an initial quantization parameter of a coding unit can be acquired, the initial quantization parameter is added with a target quantization parameter offset to obtain a target quantization parameter of the coding unit, and then the coding unit can be encoded based on the target quantization parameter. The initial quantization parameter of the coding unit is determined in the same manner as the manner of determining the quantization parameter of the coding unit in the prior art, and the embodiment of the present application will not be described herein.
[0095] In the embodiment of the present application, the target quantization parameter offset of the coding unit is determined according to the representation 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, which can ensure that the video quality is not affected and the video code rate is reduced, thereby effectively improving the coding efficiency.
[0096] The embodiment of the present application further provides a computer storage medium, which stores program instructions, and the program instructions are executed to implement the corresponding method described in the above embodiment.
[0097] Referring to Figure 2 , Figure 2 is a structural schematic diagram of a quantization parameter offset determination apparatus provided by the embodiment of the present application.
[0098] In one implementation manner of the quantization parameter offset determination apparatus of the embodiment of the present application, the quantization parameter offset determination apparatus comprises the following structure.
[0099] The acquisition 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 time domain information of the coding unit.
[0100] The processing unit 202 is configured to determine representation information of the first quantization parameter offset, wherein the representation information of the first quantization parameter offset represents whether the first quantization parameter offset is used to improve reconstruction quality of the coding unit, determine a target quantization parameter offset of the coding unit according to the representation 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 coding unit according to the representation information of the first quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset, comprising:
[0102] 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 greater than the first quantization parameter offset, the target quantization parameter offset of the coding unit is determined as 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, the intra prediction complexity of the coding unit is obtained.
[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 as the minimum value of 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 as 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 coding unit according to the representation 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, the average intra prediction complexity of the image frame to which the coding unit belongs is obtained.
[0110] The target quantization parameter offset of the coding unit is determined according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra 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 prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit, including:
[0112] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than a first preset proportion threshold and less than a second preset proportion threshold, and the second quantization parameter offset is greater than a preset offset threshold, then the sum of the first quantization parameter offset and the second quantization parameter offset is subtracted by 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 between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than a first preset proportion threshold and less than a second preset proportion threshold, and the second quantization parameter offset is less than or equal to a preset offset threshold, then the target quantization parameter offset of the coding unit is determined as 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 prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit, including:
[0116] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset proportion threshold, then an adjustment factor is obtained.
[0117] The sum of the first quantization parameter offset and the second quantization parameter offset is added by the adjustment factor to obtain the target quantization parameter offset.
[0118] In one embodiment, the processing unit 202 obtains an adjustment factor, including:
[0119] The adjustment factor is determined according to the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs and the second preset proportion threshold; wherein the adjustment factor is greater than or equal to a first numerical value and the adjustment factor is less than or equal to a second numerical value.
[0120] In one embodiment, the processing unit 202 determines the target quantization parameter offset of the coding unit according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit, including:
[0121] If a ratio between the intra prediction complexity of the coding unit and an average intra prediction complexity of a frame of an image to which the coding unit belongs is less than or equal to a first preset proportion threshold, the target quantization parameter offset of the coding unit is determined as a sum of the first quantization parameter offset and the second quantization parameter offset.
[0122] In the embodiments of the present application, the obtaining unit 201 obtains the first quantization parameter offset and the second quantization parameter offset of the coding unit, the processing unit 202 determines the representation information of the first quantization parameter offset, and determines the target quantization parameter offset of the coding unit according to the representation 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 quality is not affected, reduce the video code rate, and thus effectively improve the encoding efficiency.
[0123] Referring back to Figure 3 , Figure 3 is a structural schematic diagram of a computer device provided in the embodiments of the present application. The computer device in the embodiments of the present application includes a power supply module and the like, 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 interact with each other, and the processor 301 implements the corresponding quantization parameter offset determination method.
[0124] The storage device 302 can include a volatile memory, for example, a random-access memory (RAM); the storage device 302 can also include a non-volatile memory, for example, a flash memory, a solid-state drive (SSD) and the like; the storage device 302 can also include a combination of the above-mentioned kinds of memories.
[0125] The processor 301 can be a central processing unit (CPU). The processor 301 can also be a combination of a CPU and a GPU.
[0126] In one embodiment, the storage device 302 is configured to store program instructions. The processor 301 can invoke the program instructions to implement various methods as described above in the embodiments of the present application.
[0127] In a first possible implementation, the processor 301 of the computer device invokes program instructions stored in the storage 302 to obtain a first quantization parameter offset and a second quantization parameter offset of a coding unit; the first quantization parameter offset is calculated based on spatial information of the coding unit, and the second quantization parameter offset is calculated based on temporal information of the coding unit; determine representation information of the first quantization parameter offset; the representation information of the first quantization parameter offset indicates whether the first quantization parameter offset is used to improve reconstruction quality of the coding unit; determine a target quantization parameter offset of the coding unit according to the representation 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.
[0128] In one embodiment, when the processor 301 determines the target quantization parameter offset of the coding unit according to the representation 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 representation information of the first quantization parameter offset indicates 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 target quantization parameter offset of the coding unit is determined as 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 indicates 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, obtain an intra 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 as the minimum value of 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 as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0135] In an embodiment, the processor 301 is configured to perform the following operation 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:
[0136] If the characterization information of the first quantization parameter offset indicates that the first quantization parameter offset is used to reduce the reconstruction quality of the coding unit, the average intra prediction complexity of the image frame to which the coding unit belongs is obtained.
[0137] The target quantization parameter offset of the coding unit is determined according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit.
[0138] In an embodiment, the processor 301 is configured to perform the following operation when determining the target quantization parameter offset of the coding unit according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit:
[0139] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than a first preset proportion threshold and less than a second preset proportion 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 by a preset factor to obtain the target quantization parameter offset.
[0140] In an embodiment, the processor 301 is further configured to perform the following operation:
[0141] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than a first preset proportion threshold and less than a second preset proportion threshold, and the second quantization parameter offset is less than or equal to a preset offset threshold, the target quantization parameter offset of the coding unit is determined as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0142] In an embodiment, the processor 301 is configured to perform the following operation when determining the target quantization parameter offset of the coding unit according to the average intra prediction complexity of the image frame to which the coding unit belongs and the intra prediction complexity of the coding unit:
[0143] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the image frame to which the coding unit belongs is greater than or equal to a second preset proportion threshold, an adjustment factor is obtained.
[0144] Add the sum of the first quantization parameter offset and the second quantization parameter offset to the adjustment factor to obtain the target quantization parameter offset.
[0145] In one embodiment, the processor 301, when obtaining the adjustment factor, is configured to perform the following operation:
[0146] Determine the adjustment factor according to a ratio between the intra prediction complexity of the coding unit and an average intra prediction complexity of a frame of an image to which the coding unit belongs, and the second preset proportion threshold; wherein the adjustment factor is greater than or equal to a first value, and the adjustment factor is less than or equal to a second value.
[0147] In one embodiment, the processor 301, when determining the target quantization parameter offset of the coding unit according to the average intra prediction complexity of the frame of the image to which the coding unit belongs and the intra prediction complexity of the coding unit, is configured to perform the following operation:
[0148] If the ratio between the intra prediction complexity of the coding unit and the average intra prediction complexity of the frame of the image to which the coding unit belongs is less than or equal to a first preset proportion threshold, determine the target quantization parameter offset of the coding unit as the sum of the first quantization parameter offset and the second quantization parameter offset.
[0149] In the embodiments of the present application, the processor 301 obtains a first quantization parameter offset and a second quantization parameter offset of a coding unit, determines the representation information of the first quantization parameter offset, and determines a target quantization parameter offset of the coding unit according to the representation 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 reduce the video code rate without affecting the video quality, thereby effectively improving the coding efficiency.
[0150] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by a computer program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. The storage medium includes ROM or random access memory (RAM), magnetic disk or optical disk, and various program code storage media.
[0151] The above only describes some embodiments of the present application, and of course cannot limit the scope of the present application. Those skilled in the art can understand that all or part of the processes of the above-mentioned embodiments can be implemented, and equivalent changes made according to the claims of the present application still fall within the scope of the present application.
Claims
1. A method for determining the offset of a quantization parameter, characterized in that, include: Obtain the first quantization parameter offset and the second quantization parameter offset of the coding unit; wherein the first quantization parameter offset is calculated based on the spatial domain information of the coding unit, and the second quantization parameter offset is calculated based on the temporal domain information of the coding unit; Determine the 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; If the representation information of the first quantization parameter offset indicates 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. The encoding unit is encoded based on the target quantization parameter offset.
2. The method as described in claim 1, characterized in that, The method further includes: If the representation information of the first quantization parameter offset indicates 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 is obtained. If the intra-frame prediction complexity of the coding unit is less than a preset complexity threshold, then the target quantization parameter offset of the coding unit is determined to be the minimum value between the first quantization parameter offset and the second quantization parameter offset.
3. The method as described in claim 2, characterized in that, The method further includes: If the intra-frame prediction complexity of the coding unit is greater than or equal to the preset complexity 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.
4. The method as described in claim 1, characterized in that, The method further 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, then the average intra-frame prediction complexity of the image frame to which the coding unit belongs is obtained. The target quantization parameter offset of the coding unit is determined 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.
5. The method as described in claim 4, characterized in that, The step of determining the target quantization parameter offset of the coding unit 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 includes: 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 a preset offset threshold, then 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.
6. The method as described in claim 5, characterized in that, The method further includes: 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 a 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.
7. The method as described in claim 4, characterized in that, The step of determining the target quantization parameter offset of the coding unit 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 includes: 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, then the 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 the target quantization parameter offset.
8. The method as described in claim 7, characterized in that, The process of obtaining the adjustment factor includes: The adjustment factor is determined based on 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 a first value, and the adjustment factor is less than or equal to a second value.
9. The method as described in claim 4, characterized in that, The step of determining the target quantization parameter offset of the coding unit 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 includes: 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, 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.
10. A device for determining the offset of a quantization parameter, characterized in that, The device includes: An acquisition unit is used to acquire a first quantization parameter offset and a second quantization parameter offset of an encoding unit; wherein the first quantization parameter offset is calculated based on the spatial domain information of the encoding unit, and the second quantization parameter offset is calculated based on the temporal domain information of the encoding unit. A processing unit is configured to determine the 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; if the characterization information of the first quantization parameter offset characterizes 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; and the coding unit is encoded based on the target quantization parameter offset.
11. A computer device, characterized in that, The computer device includes a processor, a storage device, and a communication interface, which are interconnected. The storage device is used to store a computer program, the computer program including program instructions; The processor is configured to invoke the program instructions to execute the method for determining the quantization parameter offset as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions, which, when executed by a processor, are used to perform the method for determining the quantization parameter offset as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, The computer program product includes a computer program adapted to be loaded by a processor and executed by the method for determining the quantization parameter offset as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Video coding method, device, equipment, storage medium and computer program product
CN117880507A
Video compression processing method and device, equipment and storage medium
CN118590648A