Methods, apparatus, equipment, and storage media for determining quantization parameters

By acquiring the quantization parameters and offsets of video frames, predicting quality parameters, and iteratively adjusting the quantization parameters, the problem of insufficient data volume in the VBV model is solved, achieving accurate control of the encoder output data volume and dynamic balance of buffer.

CN116600117BActive Publication Date: 2026-03-10BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-09
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

The existing VBV model has difficulty in accurately determining quantization parameters during video encoding, which leads to the data volume not meeting the reference data volume and is prone to underflow problems.

Method used

By acquiring the quantization parameters and offsets of video frames, quality parameters are predicted, and the quantization parameters are iteratively adjusted to meet the reference data volume. The quantization parameters are then corrected in conjunction with the offsets to ensure that the encoder output data volume meets the balance requirements of the VBV model.

Benefits of technology

It achieves accurate prediction and control of the encoder output data volume, avoids data underflow in the VBV model, and ensures dynamic balance of video buffer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116600117B_ABST
    Figure CN116600117B_ABST
Patent Text Reader

Abstract

This disclosure relates to a method, apparatus, device, and storage medium for determining quantization parameters, and pertains to the field of coding technology. The method includes: acquiring a first quantization parameter and a first offset of a first video frame, wherein the first quantization parameter is used to quantize the first video frame, and the first offset is used to correct the first quantization parameter; predicting a first quality parameter based on the first quantization parameter and the first offset; predicting the output data volume of the encoder within a target time period based on the first quality parameter; if the output data volume does not meet a reference data volume, iteratively adjusting the first quality parameter; if the predicted output data volume meets the reference data volume in any iteration, determining a target quantization parameter based on the first quality parameter in this iteration; and using the target quantization parameter to encode the first video frame. This method can maximize the guarantee that the actual encoded output data volume of the encoder meets the reference data volume, avoiding data underflow in the VBV model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of coding technology, and in particular, to a method and device for determining a quantization parameter, an apparatus, and a storage medium. BACKGROUND

[0002] As an important functional module in video rate control, the VBV (Video Buffering Verifier) model can ensure that the rate output meets the maximum transmission bandwidth limit. The VBV model can be described as a funnel model or a water tank model, the top end of which injects water at a constant rate to simulate the expected data amount obtained by encoding a video frame by an encoder, the bottom end of which discharges water at a variable rate to simulate the actual data amount obtained by encoding the video frame by the encoder, and if the water discharge amount is greater than the water injection amount, i.e., the actual data amount obtained by encoding is higher than the expected data amount, the water in the water tank will continue to drop until the water tank is empty and overflows. The control goal of the VBV model is to ensure the dynamic balance of the water amount in the water tank, i.e., to ensure that it does not overflow, and thus the actual data amount obtained by encoding needs to be controlled, and when a given video source is provided, the actual data amount obtained by encoding is mainly determined by the quantization parameter, and thus it is very important to determine an accurate quantization parameter. SUMMARY

[0003] The present disclosure provides a method and device for determining a quantization parameter, an apparatus, and a storage medium, which can maximize the guarantee that the actual data amount output by the encoder meets the reference data amount, thereby avoiding the overflow of the data amount in the VBV model. The technical solutions of the present disclosure are as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, a method for determining a quantization parameter is provided, and the method comprises the following steps:

[0005] obtaining a first quantization parameter and a first offset of a first video frame, the first quantization parameter being used for quantization processing of the first video frame, and the first offset being used for correcting the first quantization parameter;

[0006] predicting a first quality parameter based on the first quantization parameter and the first offset, the first quality parameter being used for indicating the picture quality of the first video frame after encoding;

[0007] predicting the output data amount of an encoder in a target time period based on the first quality parameter, iteratively adjusting the first quality parameter if the output data amount does not meet a reference data amount, determining a target quantization parameter based on the first quality parameter in the current iteration process if the output data amount predicted in any iteration process meets the reference data amount, the encoder being used for encoding the video frames in the target time period starting from the first video frame, and the target quantization parameter being used for encoding the first video frame.

[0008] According to a second aspect of the embodiments of the present disclosure, a device for determining a quantization parameter is provided, and the device comprises:

[0009] a parameter obtaining unit configured to obtain a first quantization parameter and a first offset for a first video frame, the first quantization parameter being used for quantization processing of the first video frame, and the first offset being used for correcting the first quantization parameter;

[0010] a parameter predicting unit configured to predict a first quality parameter based on the first quantization parameter and the first offset, the first quality parameter being used for indicating a picture quality of the first video frame after encoding;

[0011] a parameter adjusting unit configured to predict an output data amount of an encoder in a target time period based on the first quality parameter, iteratively adjust the first quality parameter if the output data amount does not meet a reference data amount, and determine a target quantization parameter based on the first quality parameter in a current iteration process if the output data amount predicted in any iteration process meets the reference data amount, the encoder being used for encoding video frames in the target time period starting from the first video frame, and the target quantization parameter being used for encoding the first video frame.

[0012] In some embodiments, the parameter adjusting unit is configured to:

[0013] if the output data amount is greater than the reference data amount in any iteration process, increase the first quality parameter by a first multiple;

[0014] if the output data amount is less than the reference data amount, decrease the first quality parameter by a second multiple.

[0015] In some embodiments, the device further comprises:

[0016] a difference determining unit configured to determine a difference between the output data amount and the reference data amount;

[0017] a multiple determining unit configured to determine the first multiple or the second multiple based on the difference, the first multiple being positively correlated with the difference, and the second multiple being negatively correlated with the difference.

[0018] In some embodiments, the encoder processes the first video frame and a plurality of second video frames in the target time period, the second video frames being video frames other than the first video frame, and the parameter adjusting unit is configured to:

[0019] predict a first data amount of the first video frame after encoding and a plurality of second data amounts of the second video frames after encoding based on the first quality parameter.

[0020] The sum of the first data volume and the second data volume of each of the plurality of second video frames is taken as the output data volume of the encoder within the target time period.

[0021] In some embodiments, the parameter adjustment unit is configured to include:

[0022] Based on the first quantization parameter, predict the second quantization parameter of each of the plurality of second video frames;

[0023] For each second video frame, obtain the second offset of the second video frame, and use the second offset to correct the second quantization parameter of the second video frame;

[0024] Based on the second quantization parameter and the second offset of the second video frame, predict the second quality parameter of the second video frame;

[0025] Predict the distortion of the first video frame and the plurality of second video frames during the encoding process;

[0026] Based on the first quality parameter and distortion of the first video frame, predict the first data volume after encoding the first video frame; based on the second quality parameter and distortion of each of the plurality of second video frames, predict the second data volume after encoding the plurality of second video frames.

[0027] In some embodiments, the parameter adjustment unit is configured to:

[0028] Based on the first quality parameter in this iteration, predict the amount of predicted data after encoding the first video frame.

[0029] If the predicted data volume is greater than the reference data volume of the first video frame but less than the target data volume, the first quality parameter in this iteration process is adjusted to obtain the third quality parameter. The target data volume is determined based on the video cache volume in the video cache checker.

[0030] The target quantization parameter is determined based on the third quality parameter.

[0031] In some embodiments, the apparatus further includes:

[0032] The data acquisition unit is configured to acquire a third data quantity, which is the data quantity output by the encoder when the video cache quantity reaches the target proportion of the total video cache quantity;

[0033] The data volume determination unit is configured to determine the target data volume based on the third data volume and the target multiple.

[0034] In some embodiments, the acquisition unit is configured to:

[0035] Multiple offsets are obtained, which are based on offset prediction of the first video frame by multiple parameter adjustment modules respectively;

[0036] The average of the multiple offsets is taken as the first offset.

[0037] In some embodiments, the parameter prediction unit is configured to:

[0038] The first quantization parameter is corrected based on the first offset to obtain the third quantization parameter;

[0039] The first quality parameter is predicted based on the third quantization parameter, and the first quality parameter is positively correlated with the third quantization parameter.

[0040] According to a third aspect of the present disclosure, an electronic device is provided, the electronic device comprising:

[0041] One or more processors;

[0042] Memory used to store the executable program code of the processor;

[0043] The processor is configured to execute the program code to implement the method for determining the quantization parameters described above.

[0044] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, which, when program code in the computer-readable storage medium is executed by a processor of an electronic device, enables the electronic device to perform the method for determining the quantization parameters described above.

[0045] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method for determining the quantization parameters described above.

[0046] This disclosure provides a method for determining quantization parameters. When predicting quality parameters, this method considers the offset factor, resulting in high accuracy of the predicted quality parameters based on both quantization parameters and offset. Furthermore, based on these highly accurate quality parameters, the output data volume of the encoder can be accurately predicted. Further, a target quantization parameter is determined based on the quality parameter that satisfies the reference data volume. This allows the encoder to encode the first video frame based on the target quantization parameter, maximizing the assurance that the actual encoded output data volume of the encoder meets the reference data volume and avoiding underflow of data volume in the VBV model.

[0047] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0049] Figure 1 This is a schematic diagram illustrating an implementation environment according to an exemplary embodiment.

[0050] Figure 2 This is a flowchart illustrating a method for determining quantization parameters according to an exemplary embodiment.

[0051] Figure 3 This is a flowchart illustrating another method for determining quantization parameters according to an exemplary embodiment.

[0052] Figure 4 This is a flowchart illustrating another method for determining quantization parameters according to an exemplary embodiment.

[0053] Figure 5 This is a block diagram illustrating a device for determining quantization parameters according to an exemplary embodiment.

[0054] Figure 6 This is a block diagram illustrating a terminal according to an exemplary embodiment.

[0055] Figure 7 This is a block diagram illustrating a server according to an exemplary embodiment. Detailed Implementation

[0056] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0057] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0058] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the video frames involved in this disclosure were obtained with full authorization.

[0059] The method for determining quantization parameters provided in this disclosure can be executed by an electronic device, which serves as a server. Figure 1 This is a schematic diagram of an implementation environment provided in this embodiment of the disclosure. See also: Figure 1 The implementation environment includes a terminal 101 and a server 102. In this embodiment, a target application is installed on the terminal 101, which may be a video playback application. The server 102 is the backend server for the target application. In some embodiments, the server 102 is used to encode video frames and transmit them to the terminal 101, and the terminal 101 is used to play the video.

[0060] Terminal 101 can be at least one of the following devices: smartphone, smartwatch, desktop computer, laptop, virtual reality terminal, augmented reality terminal, wireless terminal, and laptop computer. Terminal 101 has communication capabilities and can access wired or wireless networks. Terminal 101 can refer to one of multiple terminals; those skilled in the art will understand that the number of terminals can be more or less. Server 102 can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed file system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some embodiments, server 102 and terminal 101 are directly or indirectly connected via wired or wireless communication; this disclosure does not limit this. Optionally, the number of servers 102 can be more or less; this disclosure does not limit this. Of course, server 102 can also include other functional servers to provide more comprehensive and diversified services. In this embodiment, server 102 undertakes the main computing work and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work and terminal 101 undertakes the main computing work; or, server 102 or terminal 101 can each undertake computing work independently, and this embodiment does not limit this.

[0061] Figure 2This is a flowchart illustrating a method for determining quantization parameters according to an exemplary embodiment, such as... Figure 2 As shown, the method is performed by an electronic device and includes the following steps:

[0062] In step S201, the electronic device acquires a first quantization parameter and a first offset of a first video frame. The first quantization parameter is used to quantize the first video frame, and the first offset is used to correct the first quantization parameter.

[0063] In this embodiment of the disclosure, the first video frame is the video frame to be encoded in the VBV model. The VBV model encodes the video frame through an encoder and then outputs the data encoded by the encoder.

[0064] In this embodiment, the electronic device uses the frame-level QP (Quantization Parameter) output by the front-end module as the first quantization parameter. The front-end module includes, but is not limited to, CRF (Constant Rate Factor) and ABR (Average Bitrate). CRF and ABR control the encoding bitrate using different methods. The frame-level quantization parameter is the baseline value for quantization of the current video frame. Generally, the larger the frame-level quantization parameter, the greater the degree of quantization, and the lower the image quality of the video frame.

[0065] In this embodiment, the quantization parameter is the quantization step size number, used to indicate the quantization step size. A larger quantization parameter corresponds to a larger quantization step size, meaning the two are positively correlated. The electronic device performs quantization processing on the video frame based on the quantization step size. For example, during quantization processing, the electronic device transforms the video frame, converting the values ​​of multiple pixels in the video frame into transform coefficients. Dividing these transform coefficients by the quantization step size yields the quantized video frame. The pixel values ​​in the quantized video frame are integer multiples of the quantization step size or zero, thus achieving compressed encoding of the video frame. Optionally, this transformation method is a DCT (Discrete Cosine Transform). Alternatively, during quantization processing, the electronic device directly divides the values ​​of multiple pixels in the video frame by the quantization step size to obtain the quantized video frame; no specific limitation is made here.

[0066] In this embodiment, the first offset is used to indicate the difference between the first quantization parameter and the reference quantization parameter. The reference quantization parameter is determined based on the quality of a reference image after the first video frame is encoded. This reference image quality is determined based on the amount of information referenced by subsequent video frames during frame-level prediction of the first video frame. A larger amount of information indicates a more important first video frame, better reference image quality, and a smaller reference quantization parameter. Therefore, an offset is needed to correct the first quantization parameter based on the reference image quality, so that the image quality obtained based on the corrected first quantization parameter meets the reference image quality.

[0067] The first offset is determined by the parameter adjustment module. Accordingly, in determining the first offset, the parameter adjustment module predicts the amount of information referenced by subsequent video frames during frame-level prediction of the first video frame. Based on this information amount and the correspondence between the information amount and the reference image quality, the reference image quality is determined. The first offset is determined based on the difference between the reference image quality and the image quality corresponding to the first quantization parameter. Optionally, the parameter adjustment module determines the difference between the image quality corresponding to the first quantization parameter and the reference image quality, and determines the first offset based on this difference and the correspondence between the difference and the offset. The parameter adjustment module includes, but is not limited to, Cu Tree (a quantization parameter adjustment tool) and BIM (Block Importance Mapping).

[0068] In step S202, the electronic device predicts a first quality parameter based on a first quantization parameter and a first offset. The first quality parameter is used to indicate the picture quality after the first video frame is encoded.

[0069] In this embodiment, the quantization parameter refers to the frame-level quantization parameter. QS (QScale, quality parameter) is positively correlated with the frame-level quantization parameter; that is, the larger the frame-level quantization parameter, the larger the quality parameter. A first offset is used to correct the first quantization parameter. The electronic device then predicts the first quality parameter based on the corrected first quantization parameter and the correspondence between the quantization parameter and the quality parameter. The first quality parameter is negatively correlated with the image quality after encoding the first video frame; that is, the larger the first quality parameter, the worse the image quality after encoding the first video frame, and the smaller the amount of data after encoding the first video frame.

[0070] In step S203, the electronic device predicts the amount of output data of the encoder in the target time period based on the first quality parameter. If the amount of output data does not meet the reference data amount, the first quality parameter is iteratively adjusted. If the predicted amount of output data meets the reference data amount in any iteration, the target quantization parameter is determined based on the first quality parameter in this iteration. The encoder is used to encode the video frames in the target time period starting from the first video frame, and the target quantization parameter is used to encode the first video frame.

[0071] In this embodiment, the output data volume is the amount of data obtained by the encoder from encoding video frames; that is, the output data volume refers to the number of bits output by the encoder. The reference data volume refers to the expected output data volume of the encoder within the target time period. Since the VBV model is used to output the amount of data obtained by the encoder from encoding video frames, the reference data volume also refers to the expected output data volume of the VBV model within the target time period. When the output data volume meets the reference data volume, the data injection volume and data output volume of the VBV model maintain a dynamic balance, thus avoiding underflow of data volume in the VBV model.

[0072] This disclosure provides a method for determining quantization parameters. When predicting quality parameters, this method considers the offset factor, thus ensuring high accuracy of the predicted quality parameters based on quantization parameters and offset, thereby accurately predicting the output data volume of the encoder. Furthermore, based on the quality parameters that satisfy the reference data volume, a target quantization parameter is determined for final encoding. This allows the encoder to encode the first video frame based on the target quantization parameter, maximizing the guarantee that the actual encoded output data volume of the encoder satisfies the reference data volume and avoiding underflow of data volume in the VBV model.

[0073] In some embodiments, if the output data volume does not meet the reference data volume, the first quality parameter is iteratively adjusted, including: in any iteration, if the output data volume is greater than the reference data volume, the first quality parameter is increased by a first multiple; if the output data volume is less than the reference data volume, the first quality parameter is decreased by a second multiple.

[0074] In this embodiment of the disclosure, when the output data volume is large, increasing the quality parameter can effectively reduce the output data volume; when the output data volume is small, decreasing the quality parameter can effectively increase the output data volume. Thus, by adjusting the quality parameter, the output data volume can be effectively adjusted.

[0075] In some embodiments, the method further includes: determining the difference between the output data volume and the reference data volume; and determining a first multiple or a second multiple based on the difference, wherein the first multiple is positively correlated with the difference and the second multiple is negatively correlated with the difference.

[0076] In this embodiment, the first multiple is positively correlated with the difference; that is, the larger the difference, the larger the first multiple, and the greater the increase in the first quality parameter, thus effectively and quickly reducing the difference between the output data volume and the reference data volume. The second multiple is negatively correlated with the difference; that is, the larger the difference, the smaller the second multiple, and the greater the decrease in the first quality parameter, thus quickly and effectively reducing the difference between the output data volume and the reference data volume. Furthermore, determining the first and second multiples based on the difference avoids overcorrection of the output data volume, thereby enabling accurate adjustment of the first quality parameter.

[0077] In some embodiments, the encoder processes a first video frame and a plurality of second video frames within a target time period, wherein the second video frames are video frames other than the first video frame. Based on a first quality parameter, the encoder predicts the amount of output data within the target time period, including: predicting the first amount of data after encoding the first video frame and the second amount of data after encoding each of the plurality of second video frames based on the first quality parameter; and using the sum of the first amount of data and the second amount of data of each of the plurality of second video frames as the amount of output data of the encoder within the target time period.

[0078] In this embodiment of the disclosure, the sum of the data volume of multiple video frames encoded within the target time period is used as the output data volume of the encoder. When determining whether the VBV model is in a balanced state based on the output data volume, the future output data volume of the encoder is fully considered. In this way, the target quantization parameters determined subsequently enable the VBV model to maintain a balanced state in the long term.

[0079] In some embodiments, predicting the first data volume of the encoded first video frame and the second data volume of each of the plurality of second video frames based on a first quality parameter includes: predicting the second quantization parameter of each of the plurality of second video frames based on a first quantization parameter; for each second video frame, obtaining a second offset of the second video frame, the second offset being used to correct the second quantization parameter of the second video frame; predicting the second quality parameter of the second video frame based on the second quantization parameter and the second offset of the second video frame; predicting the distortion of the first video frame and the plurality of second video frames during the encoding process; predicting the first data volume of the encoded first video frame based on the first quality parameter and distortion of the first video frame, and predicting the second data volume of each of the plurality of second video frames based on the second quality parameter and distortion of each of the plurality of second video frames.

[0080] In this embodiment of the disclosure, the offset is also considered when predicting the quality parameters of the second video frame, thus the accuracy of the predicted second quality parameters of the second video frame is high, and the accuracy of the predicted second data volume based on the second quality parameters is also high. In this way, the accuracy of the output data volume of the encoder in the target time period is improved by predicting the first data volume and the second data volume with high accuracy.

[0081] In some embodiments, determining the target quantization parameter based on the first quality parameter in the current iteration includes: predicting the predicted data volume of the first video frame after encoding based on the first quality parameter in the current iteration; if the target data volume is greater than the reference data volume of the first video frame but less than the target data volume, adjusting the first quality parameter in the current iteration to obtain a third quality parameter, wherein the target data volume is determined based on the video buffer volume in the video buffer checker; and determining the target quantization parameter based on the third quality parameter.

[0082] In this embodiment of the disclosure, when the amount of data after encoding a single video frame is large, its quality parameters are adjusted, thereby adjusting the quantization parameters. This can effectively limit the amount of data after encoding a single video frame and avoid the risk of VBV model underflow caused by excessive data in a single video frame.

[0083] In some embodiments, the method further includes: obtaining a third data volume, wherein the third data volume is the data volume output by the encoder when the video buffer volume reaches a target proportion of the total video buffer volume; and determining a target data volume based on the third data volume and the target multiple.

[0084] In this embodiment of the disclosure, the target data volume is determined based on the video buffer volume. This ensures that after the data volume of a single video frame is encoded and output to the VBV model, the video buffer volume in the VBV model is within a controllable range. This not only prevents the bit rate of a single video frame from decreasing too much, which would lead to a deterioration in picture quality, but also avoids the risk of VBV model underflow.

[0085] In some embodiments, the process of obtaining the first offset includes: obtaining multiple offsets, wherein the multiple offsets are obtained by performing offset prediction on the first video frame based on multiple parameter adjustment modules respectively; and taking the average of the multiple offsets as the first offset.

[0086] In this embodiment of the disclosure, the average of the offsets predicted by multiple parameter adjustment modules is used as the first offset, which fully considers the influence of multiple parameter adjustment modules and improves the accuracy of the first offset.

[0087] In some embodiments, predicting a first quality parameter based on a first quantization parameter and a first offset includes: correcting the first quantization parameter based on the first offset to obtain a third quantization parameter; and predicting the first quality parameter based on the third quantization parameter, wherein the first quality parameter is positively correlated with the third quantization parameter.

[0088] In this embodiment of the disclosure, the first quantization parameter is corrected based on the first offset to obtain a third quantization parameter with high accuracy. Then, the first quality parameter is predicted based on the third quantization parameter to obtain a quality parameter with high accuracy.

[0089] This disclosure provides a method for determining quantization parameters. When predicting quality parameters, this method considers the offset factor, resulting in high accuracy of the predicted quality parameters based on both quantization parameters and offset. Furthermore, based on these highly accurate quality parameters, the output data volume of the encoder can be accurately predicted. Further, a target quantization parameter is determined based on the quality parameter that satisfies the reference data volume. This allows the encoder to encode the first video frame based on the target quantization parameter, maximizing the assurance that the actual encoded output data volume of the encoder meets the reference data volume and avoiding underflow of data volume in the VBV model.

[0090] The above Figure 2 This is the basic process for determining quantization parameters, and the following is based on... Figure 3 The process of determining the quantization parameters is further elaborated. See [link / reference]. Figure 3 , Figure 3 This is a flowchart illustrating a method for determining quantization parameters according to an exemplary embodiment. The method is performed by an electronic device and includes the following steps:

[0091] In step S301, the electronic device acquires the first quantization parameter and the first offset of the first video frame.

[0092] In this embodiment of the disclosure, when the parameter adjustment module is in operation, i.e., when it is enabled, the quantization parameters actually used by the encoder's quantization module will take into account the offset predicted by the parameter adjustment module. Optionally, when the electronic device obtains the first offset, it first determines the parameter adjustment module in operation and obtains the offset predicted by the parameter adjustment module in operation for the first video frame to obtain the first offset.

[0093] Accordingly, if no parameter adjustment module is running, the first offset is zero. If one parameter adjustment module is running, the offset predicted by that module for the first video frame is used as the first offset. If multiple parameter adjustment modules are running, the electronic device acquires multiple offsets and uses the average of these offsets as the first offset. These multiple offsets are obtained based on offset predictions made by the multiple parameter adjustment modules for the first video frame. In this embodiment, the average of the offsets predicted by the multiple parameter adjustment modules is used as the first offset, which fully considers the influence of the multiple parameter adjustment modules and improves the accuracy of the first offset.

[0094] In step S302, the electronic device corrects the first quantization parameter based on the first offset to obtain the third quantization parameter.

[0095] In this embodiment of the disclosure, correcting the first quantization parameter based on the first offset means: adding the first offset to the first quantization parameter, that is, using the sum of the first offset and the first quantization parameter as the third quantization parameter. If the first offset is positive, the first quantization parameter will be increased; if the first offset is negative, the first quantization parameter will be decreased.

[0096] In step S303, the electronic device predicts the first quality parameter based on the third quantization parameter, and the first quality parameter is positively correlated with the third quantization parameter.

[0097] In some embodiments, the electronic device predicts the first quality parameter based on a third quantization parameter using the following formula (1).

[0098]

[0099] Here, QP represents the third quantization parameter, and QScale represents the first quality parameter.

[0100] In this embodiment of the disclosure, based on the above steps S302-S303, the process of predicting the first quality parameter based on the first quantization parameter and the first offset is realized. The first quantization parameter is corrected based on the first offset to obtain a third quantization parameter with high accuracy. Then, the first quality parameter is predicted based on the third quantization parameter to obtain a quality parameter with high accuracy.

[0101] It should be noted that steps S302-S303 described above are only one optional implementation of predicting the first quality parameter. Other optional implementations can also be used to predict the first quality parameter, which are not specifically limited here. For example, the electronic device predicts a fourth quality parameter based on the first quantization parameter, predicts a fifth quality parameter based on the first offset, and corrects the fourth quality parameter based on the fifth quality parameter to obtain the first quality parameter. Optionally, the electronic device uses the sum of the fifth and fourth quality parameters as the first quality parameter.

[0102] In step S304, the electronic device predicts the first data volume after encoding the first video frame and the second data volume after encoding each of the multiple second video frames based on the first quality parameter. The multiple second video frames are video frames other than the first video frame within the target time period, which starts from the first video frame.

[0103] In some embodiments, the electronic device predicts the first data volume of the encoded first video frame and the second data volume of each of the plurality of second video frames based on a first quality parameter, comprising the following steps: the electronic device predicts the second quantization parameter of each of the plurality of second video frames based on a first quantization parameter; for each second video frame, the electronic device obtains a second offset of the second video frame, the second offset being used to correct the second quantization parameter of the second video frame; the electronic device predicts the second quality parameter of the second video frame based on the second quantization parameter and the second offset of the second video frame; the electronic device predicts the distortion of the first video frame and the plurality of second video frames during the encoding process; the electronic device predicts the first data volume of the encoded first video frame based on the first quality parameter and distortion of the first video frame, and predicts the second data volume of each of the plurality of second video frames based on the second quality parameter and distortion of each of the plurality of second video frames.

[0104] In some embodiments, the electronic device predicts a second quantization parameter based on a quantization parameter prediction model. This model is used to predict the quantization parameters of multiple video frames over a future period based on the quantization parameters of the current video frame. In this embodiment, the electronic device obtains the second offset in the same way as it obtains the first offset, and will not be described again here. In some embodiments, the electronic device predicts the distortion (satdCost) of video frames during the encoding process using a Lookahead (an optimization algorithm) model.

[0105] In some embodiments, the electronic device predicts the amount of data after encoding a video frame using a frame type model. It should be noted that different frame type models are used to predict the amount of data after encoding for different types of video frames. In some embodiments, the amount of data after encoding a video frame is also related to the video frame's layer.

[0106] Accordingly, the process by which the aforementioned electronic device predicts the first data volume after encoding the first video frame based on the first quality parameters and distortion of the first video frame includes the following steps: the electronic device determines a frame type model matching the frame type based on the frame type of the first video frame, inputs the first quality parameters, distortion, and hierarchy of the first video frame into the frame type model, and outputs the first data volume after encoding the first video frame through the frame type model. The process by which the electronic device predicts the second data volume is similar and will not be described in detail here.

[0107] In this embodiment of the disclosure, the influence of offset is also considered when predicting the quality parameters of the second video frame, thus the accuracy of the predicted second quality parameters of the second video frame is high, and the accuracy of the predicted second data volume based on the second quality parameters is also high. In this way, the accuracy of the output data volume of the encoder in the target time period is improved by predicting the first data volume and the second data volume with high accuracy.

[0108] In step S305, the electronic device uses the sum of the first data volume and the second data volume of each of the multiple second video frames as the output data volume of the encoder within the target time period. The encoder is used to encode the video frames within the target time period.

[0109] In this embodiment of the disclosure, the above steps S304-S305 realize the process of predicting the output data volume of the encoder within a target time period based on the first quality parameter. This embodiment takes the sum of the data volume of multiple video frames encoded within the target time period as the output data volume of the encoder, and then determines whether the VBV model is in a balanced state based on the output data volume. This fully considers the future output data volume of the encoder, so the target quantization parameter determined subsequently enables the VBV model to maintain a balanced state for a long time.

[0110] It should be noted that steps S304-S305 above are only one optional implementation of predicting the output data volume of the encoder within the target time period. This process can also be implemented in other optional ways, which are not specifically limited here. For example, the average of the first data volume and the second data volume of each of the multiple second video frames can be used as the output data volume of the encoder within the target time period. Correspondingly, the reference data volume is the average of the multiple data volumes expected to be obtained by encoding the multiple video frames.

[0111] In step S306, the electronic device compares the output data quantity with the reference data quantity. If the output data quantity does not meet the reference data quantity, the first quality parameter is iteratively adjusted.

[0112] In this embodiment of the disclosure, the reference data amount is the total amount of data that the encoder is expected to obtain by encoding multiple video frames within the target time period, that is, the reference data amount is the sum of the multiple data amounts that are expected to be obtained by encoding the multiple video frames.

[0113] In some embodiments, "output data quantity not meeting reference data quantity" means that the output data quantity is not equal to the reference data quantity. Accordingly, the process of iteratively adjusting the first quality parameter if the output data quantity does not meet the reference data quantity includes the following steps: in any iteration, if the output data quantity is greater than the reference data quantity, the electronic device increases the first quality parameter by a first multiple; if the output data quantity is less than the reference data quantity, the electronic device decreases the first quality parameter by a second multiple.

[0114] It should be noted that if the first multiple is greater than 1 (e.g., 1.01), and the second multiple is less than 1 and not negative (e.g., 0.98), the electronic device increases the first mass parameter by the first multiple; that is, the product of the first mass parameter and the first multiple is used as the adjusted first mass parameter. Conversely, the electronic device decreases the first mass parameter by the second multiple; that is, the product of the first mass parameter and the second multiple is used as the adjusted first mass parameter.

[0115] It should be noted that the quality parameter is negatively correlated with the output data volume. In this embodiment of the disclosure, when the output data volume is large, increasing the quality parameter can effectively reduce the output data volume, and when the output data volume is small, decreasing the quality parameter can effectively increase the output data volume. Thus, by adjusting the quality parameter, the output data volume can be effectively adjusted.

[0116] In other embodiments, the output data quantity not meeting the reference data quantity means that the difference between the output data quantity and the reference data quantity is not within a preset range. Accordingly, the process of iteratively adjusting the first quality parameter if the output data quantity does not meet the reference data quantity includes the following steps: in any iteration, if the output data quantity is greater than the reference data quantity and the difference between the output data quantity and the reference data quantity is greater than a first preset difference, the electronic device increases the first quality parameter by a first multiple; if the output data quantity is less than the reference data quantity and the difference between the output data quantity and the reference data quantity is greater than a second preset difference, the electronic device decreases the first quality parameter by a second multiple.

[0117] The first preset difference and the second preset difference may be the same or different, and no specific limitation is made here. In the embodiments of this disclosure, controlling the difference between the output data volume and the reference data volume within a preset range also ensures that the amount of data cached in the VBV model is within dynamic balance, thereby improving the controllable range of the output data volume.

[0118] In some embodiments, the first multiple and the second multiple are fixed values. In other embodiments, the first multiple and the second multiple are related to a difference, and accordingly, the process of determining the first multiple or the second multiple includes the following steps: the electronic device determines a difference between the output data amount and the reference data amount; the electronic device determines the first multiple or the second multiple based on the difference, wherein the first multiple is positively correlated with the difference and the second multiple is negatively correlated with the difference.

[0119] In some embodiments, the electronic device establishes a correspondence between the difference and a first multiple and a second multiple in advance, and the electronic device determines the first multiple or the second multiple corresponding to the difference from the correspondence based on the difference.

[0120] In this embodiment, the first multiple is positively correlated with the difference; that is, the larger the difference, the larger the first multiple, and the greater the increase in the first quality parameter, thereby effectively and quickly reducing the difference between the output data volume and the reference data volume. The second multiple is negatively correlated with the difference; that is, the larger the difference, the smaller the second multiple, and the greater the decrease in the first quality parameter, thereby quickly and effectively reducing the difference between the output data volume and the reference data volume. Furthermore, determining the first and second multiples based on the difference avoids overcorrection of the output data volume, thus enabling accurate adjustment of the first quality parameter.

[0121] In this embodiment, if the output data volume meets the reference data volume, the target quantization parameter is directly determined based on the first quality parameter without further iterative adjustment of the first quality parameter. If iterative adjustment is required, the first quality parameter adjusted during the current iteration is used as the first quality parameter for the next iteration.

[0122] In step S307, if the predicted output data volume in any iteration meets the reference data volume, the electronic device determines the target quantization parameter based on the first quality parameter in this iteration. The target quantization parameter is used to encode the first video frame.

[0123] In this embodiment, the electronic device calculates the target quantization parameter based on the first quality parameter using the formula (1) above. In this embodiment, the target quantization parameter is used for the final encoding of the first video frame; that is, the target quantization parameter is the quantization parameter actually used by the encoder to encode the first video frame. It should be noted that the first video frame refers to the video frame to be encoded. For any video frame to be encoded, the target quantization parameter used for final encoding is obtained through the steps S301-S307 above, thereby ensuring that the output data volume and the reference data volume maintain a dynamic balance over a long period, avoiding the underflow risk of the VBV model.

[0124] It should be noted that the encoder may contain a quantization parameter adjustment tool, and the frame-level quantization parameters output by the pre-module are only basic quantization parameters, which are different from the quantization parameters actually used in the encoder's quantization module. The actual quantization parameters take into account the offset predicted by the quantization parameter adjustment tool. However, in this embodiment, the on / off status of the quantization parameter adjustment tool in the encoder is taken into account, and the offset of the frame-level quantization parameters is predicted in advance. The quantization parameters for predicting the data volume are corrected, so the quantization parameters used to predict the data volume are closer to the actual encoding quantization parameters, thereby accurately predicting the output data volume of the encoder.

[0125] In this embodiment of the disclosure, when encoding multiple video frames in any video using an encoder, for any current video frame to be encoded, the electronic device acquires the frame-level quantization parameters of the video frame and the offset predicted by the parameter adjustment module in operation, and corrects the frame-level quantization parameters based on the offset. Then, based on the corrected frame-level quantization parameters, the quality parameters of the video frame are predicted, and based on the quality parameters, the output data volume of the encoder in the future period is predicted. If the output data volume does not meet the expected output data volume, the quality parameters of the video frame are adjusted, and the output data volume of the encoder in the future period is re-predicted based on the adjusted quality parameters. The process of adjusting the quality parameters and predicting the output data volume is iteratively executed until the predicted output data volume in a certain iteration meets the expected output data volume. Based on the quality parameters used in that iteration, a target quantization parameter is calculated, and the encoder performs the final encoding of the current video frame based on the target quantization parameter.

[0126] This disclosure provides a method for determining quantization parameters. When predicting quality parameters, this method considers the offset factor, resulting in high accuracy of the predicted quality parameters based on both quantization parameters and offset. Furthermore, based on these highly accurate quality parameters, the output data volume of the encoder can be accurately predicted. Further, a target quantization parameter is determined based on the quality parameter that satisfies the reference data volume. This allows the encoder to encode the first video frame based on the target quantization parameter, maximizing the assurance that the actual encoded output data volume of the encoder meets the reference data volume and avoiding underflow of data volume in the VBV model.

[0127] The above Figure 3 The implementation example describes the process of determining quantization parameters based on the output data volume within a target time period meeting a reference data volume. Furthermore, the data volume after encoding a single video frame must also meet certain requirements. The following is based on... Figure 4 Let me explain the process. See [link / reference] Figure 4 , Figure 4 This is a flowchart illustrating a method for determining quantization parameters according to an exemplary embodiment. The method is performed by an electronic device and includes the following steps:

[0128] In step S401, the electronic device acquires the first quantization parameter and the first offset of the first video frame.

[0129] In step S402, the electronic device corrects the first quantization parameter based on the first offset to obtain the third quantization parameter.

[0130] In step S403, the electronic device predicts the first quality parameter based on the third quantization parameter, and the first quality parameter is positively correlated with the third quantization parameter.

[0131] In step S404, the electronic device predicts the first data volume after encoding the first video frame and the second data volume after encoding each of the multiple second video frames based on the first quality parameter. The multiple second video frames are video frames other than the first video frame within the target time period, which starts from the first video frame.

[0132] In step S405, the electronic device uses the sum of the first data amount and the second data amount of each of the multiple second video frames as the output data amount of the encoder within the target time period. The encoder is used to encode the video frames within the target time period.

[0133] In step S406, the electronic device compares the output data quantity with the reference data quantity. If the output data quantity does not meet the reference data quantity, the first quality parameter is iteratively adjusted.

[0134] In this embodiment of the disclosure, steps S401-S406 are the same as steps S301-S306, and will not be described again here.

[0135] In step S407, if the predicted output data volume in any iteration meets the reference data volume, the electronic device predicts the predicted data volume after encoding the first video frame based on the first quality parameter in this iteration.

[0136] In this embodiment of the disclosure, the process by which the electronic device predicts the target data volume based on the first quality parameter is the same as step 304, and will not be repeated here.

[0137] In step S408, if the target data volume is greater than the reference data volume of the first video frame but less than the target data volume, the electronic device adjusts the first quality parameter in this iteration process to obtain the third quality parameter. The target data volume is determined based on the video buffer volume in the video buffer checker.

[0138] In this embodiment of the disclosure, the reference data amount of the first video frame refers to the amount of data that the encoder is expected to obtain by encoding the first video frame.

[0139] In some embodiments, the process by which the electronic device determines the target data volume includes the following steps: the electronic device acquires a third data volume, which is the amount of data output by the encoder when the video buffer volume reaches a target proportion of the total video buffer volume; the electronic device determines the target data volume based on the third data volume and a target multiple. Optionally, the electronic device uses the product of the third data volume and the target multiple as the target data volume.

[0140] In this embodiment, the target ratio can be set and changed as needed, for example, to 50%. The target multiple can be set and changed as needed, for example, to 1.1. Optionally, the target multiple can also be 1, meaning the electronic device can directly use the third data amount as the target data amount, without specific limitations.

[0141] In this embodiment of the disclosure, the target data volume is determined based on the video buffer volume. After the data volume of a single video frame is encoded and output to the VBV model, the video buffer volume in the VBV model is within a controllable range. This not only prevents the bit rate of a single video frame from decreasing too much, which would lead to a deterioration in picture quality, but also further avoids the risk of VBV model underflow.

[0142] In this embodiment of the disclosure, adjusting the first quality parameter during the current iteration process refers to increasing the first quality parameter. Optionally, the electronic device increases the first quality parameter by a fixed multiple, that is, the product of the first quality parameter and the fixed multiple is used as the third quality parameter, thus improving the efficiency of adjusting the first quality parameter; or, the third multiple is determined based on the difference between the target data volume and the reference data volume of the first video frame, and the third multiple is positively correlated with the difference, and the product of the first quality parameter and the third multiple is used as the third quality parameter, thus improving the accuracy of adjusting the first quality parameter.

[0143] In step S409, the electronic device determines the target quantization parameter based on the third quality parameter, and the target quantization parameter is used to encode the first video frame.

[0144] In this embodiment of the disclosure, the electronic device calculates the target quantization parameter based on the third quality parameter using the above formula (1).

[0145] In this embodiment of the disclosure, the process of determining the target quantization parameter based on the first quality parameter in the current iteration is realized through the above steps S407-S409. In this way, when the amount of data after encoding a single video frame is large, its quality parameter is adjusted, thereby realizing the adjustment of the quantization parameter. This can effectively limit the amount of data after encoding a single video frame and avoid the risk of VBV model underflow caused by the excessive amount of data in a single video frame.

[0146] It should be noted that steps S407-S409 above are only one optional implementation method for determining the target quantization parameter. Other optional implementation methods can also be used to determine the target quantization parameter, which are not specifically limited here. For example, the target quantization parameter can be obtained by directly inverse calculation based on the first quantization parameter.

[0147] In this embodiment of the disclosure, the complexity of the current scene can be predicted based on the predicted amount of data after encoding the first video frame. If the amount of data after encoding the first video frame is large, it indicates that the current scene may involve complex situations such as scene switching or intense motion. In this embodiment of the disclosure, when the amount of data after encoding the first video frame is large, i.e., the scene is complex, appropriately increasing the quantization parameter fed back by the VBV model can greatly reduce the underflow risk of the VBV model.

[0148] This disclosure provides a method for determining quantization parameters. The method provided by this disclosure can accurately calculate the quality parameters of each video frame. Furthermore, it limits the bitrate of a single video frame, which can significantly reduce the risk of video buffer underflow during bitrate control in the VBV model and improve the stability of video transmission in a fixed bandwidth network environment.

[0149] Figure 5 This is a block diagram illustrating a device for determining quantization parameters according to an exemplary embodiment. (Refer to...) Figure 5 The device includes:

[0150] The parameter acquisition unit 501 is configured to acquire the first quantization parameter and the first offset of the first video frame. The first quantization parameter is used to perform quantization processing on the first video frame, and the first offset is used to correct the first quantization parameter.

[0151] The parameter prediction unit 502 is configured to predict a first quality parameter based on a first quantization parameter and a first offset. The first quality parameter is used to indicate the picture quality after the first video frame is encoded.

[0152] The parameter adjustment unit 503 is configured to predict the amount of output data of the encoder in the target time period based on the first quality parameter. If the amount of output data does not meet the reference data amount, the first quality parameter is iteratively adjusted. If the predicted amount of output data meets the reference data amount in any iteration, the target quantization parameter is determined based on the first quality parameter in this iteration. The encoder is used to encode video frames in the target time period starting from the first video frame, and the target quantization parameter is used to encode the first video frame.

[0153] In some embodiments, the parameter adjustment unit 503 is configured to:

[0154] In any iteration, if the amount of output data is greater than the amount of reference data, the first quality parameter is increased by a first multiple.

[0155] If the output data volume is less than the reference data volume, the first quality parameter is reduced by a second multiple.

[0156] In some embodiments, the apparatus further includes:

[0157] The difference determination unit is configured to determine the difference between the output data volume and the reference data volume;

[0158] The multiple determination unit is configured to determine a first multiple or a second multiple based on the difference, wherein the first multiple is positively correlated with the difference and the second multiple is negatively correlated with the difference.

[0159] In some embodiments, the encoder processes a first video frame and multiple second video frames within a target time period, wherein the second video frames are video frames other than the first video frame, and the parameter adjustment unit 503 is configured to:

[0160] Based on the first quality parameter, predict the first data volume after encoding the first video frame and the second data volume after encoding each of the multiple second video frames;

[0161] The sum of the first data volume and the second data volume of each of the multiple second video frames is used as the output data volume of the encoder within the target time period.

[0162] In some embodiments, the parameter adjustment unit 503 is configured to include:

[0163] Based on the first quantization parameter, predict the second quantization parameter of each of the multiple second video frames;

[0164] For each second video frame, the second offset of the second video frame is obtained, and the second offset is used to correct the second quantization parameter of the second video frame;

[0165] Based on the second quantization parameter and the second offset of the second video frame, predict the second quality parameter of the second video frame;

[0166] Predict the distortion of the first video frame and multiple second video frames during the encoding process;

[0167] Based on the first quality parameters and distortion of the first video frame, predict the first data volume after encoding the first video frame; based on the second quality parameters and distortion of each of the multiple second video frames, predict the second data volume after encoding each of the multiple second video frames.

[0168] In some embodiments, the parameter adjustment unit 503 is configured to:

[0169] Based on the first quality parameter in this iteration, predict the amount of predicted data after encoding the first video frame.

[0170] If the predicted data volume is greater than the reference data volume of the first video frame but less than the target data volume, the first quality parameter in this iteration is adjusted to obtain the third quality parameter. The target data volume is determined based on the video cache volume in the video cache checker.

[0171] The target quantization parameters are determined based on the third quality parameter.

[0172] In some embodiments, the apparatus further includes:

[0173] The data acquisition unit is configured to acquire a third data quantity, which is the amount of data output by the encoder when the video buffer quantity reaches the target proportion of the total video buffer quantity.

[0174] The data volume determination unit is configured to determine the target data volume based on the third data volume and the target multiple.

[0175] In some embodiments, the acquisition unit is configured to:

[0176] Multiple offsets are obtained, which are based on offset prediction of the first video frame by multiple parameter adjustment modules respectively;

[0177] The average of multiple offsets is used as the first offset.

[0178] In some embodiments, the parameter prediction unit 502 is configured to:

[0179] The first quantization parameter is corrected based on the first offset to obtain the third quantization parameter;

[0180] The first quality parameter is predicted based on the third quantization parameter, and the first quality parameter is positively correlated with the third quantization parameter.

[0181] This disclosure provides a device for determining quantization parameters. When predicting quality parameters, the offset factor is considered. This results in high accuracy of the quality parameters predicted based on the quantization parameters and the offset. Furthermore, the output data volume of the encoder can be accurately predicted based on the high-accuracy quality parameters. In addition, a target quantization parameter for final encoding is determined based on the quality parameters when the output data volume meets the reference data volume. This allows the encoder to encode the first video frame based on the target quantization parameter, which can maximize the guarantee that the actual encoded output data volume of the encoder meets the reference data volume and avoid underflow of data volume in the VBV model.

[0182] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0183] Figure 6A structural block diagram of a terminal 600 provided in an exemplary embodiment of this disclosure is shown. The terminal 600 may be a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The terminal 600 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.

[0184] Typically, terminal 600 includes a processor 601 and a memory 602.

[0185] Processor 601 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 601 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 601 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 601 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 601 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0186] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 602 are used to store at least one program code, which is executed by the processor 601 to implement the method for determining quantization parameters provided in the method embodiments of this disclosure.

[0187] In some embodiments, the terminal 600 may optionally include a peripheral device interface 603 and at least one peripheral device. The processor 601, memory 602, and peripheral device interface 603 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 603 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 604, a display screen 605, a camera assembly 606, an audio circuit 607, and a power supply 608.

[0188] Peripheral interface 603 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 601 and memory 602. In some embodiments, processor 601, memory 602 and peripheral interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 601, memory 602 and peripheral interface 603 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0189] The radio frequency (RF) circuit 604 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 604 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 604 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 604 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 604 may also include circuitry related to NFC (Near Field Communication), which is not limited in this disclosure.

[0190] Display screen 605 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 605 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 601 for processing. In this case, display screen 605 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 605, which serves as the front panel of terminal 600; in other embodiments, there may be at least two display screens, respectively disposed on different surfaces of terminal 600 or in a folded design; in still other embodiments, display screen 605 may be a flexible display screen, disposed on a curved or folded surface of terminal 600. Furthermore, display screen 605 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 605 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0191] The camera assembly 606 is used to acquire images or videos. Optionally, the camera assembly 606 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 606 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.

[0192] The audio circuit 607 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 601 for processing, or input to the radio frequency circuit 604 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located at a different part of the terminal 600. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 601 or the radio frequency circuit 604 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 607 may also include a headphone jack.

[0193] Power supply 608 is used to power the various components in terminal 600. Power supply 608 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 608 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0194] Those skilled in the art will understand that Figure 6 The structure shown does not constitute a limitation on terminal 600, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0195] Figure 7 This is a schematic diagram of a server structure according to an embodiment of the present disclosure. The server 700 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 701 and one or more memories 702. The memories 702 are used to store executable program code, and the processors 701 are configured to execute the executable program code to implement the methods for determining quantization parameters provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated here.

[0196] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, which can be executed by a terminal's processor to complete the method for determining the quantization parameters. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0197] In an exemplary embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the method for determining the aforementioned quantization parameters. In some embodiments, the computer program product involved in this disclosure may be deployed on an electronic device for execution, or executed on multiple electronic devices located in one location, or executed on multiple electronic devices distributed across multiple locations and interconnected via a communication network. These multiple electronic devices distributed across multiple locations and interconnected via a communication network may constitute a blockchain system.

[0198] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0199] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A method of determining a quantization parameter, characterized by, The method comprises: obtaining a first quantization parameter and a first offset of a first video frame, the first quantization parameter being used for quantization processing of the first video frame, and the first offset being used for correcting the first quantization parameter; predicting a first quality parameter based on the first quantization parameter and the first offset, the first quality parameter being used for indicating picture quality of the first video frame after encoding; predicting an output data amount of an encoder within a target time period based on the first quality parameter, and iteratively adjusting the first quality parameter if the output data amount does not meet a reference data amount, and determining a target quantization parameter based on the first quality parameter in the current iteration if the output data amount predicted in any iteration meets the reference data amount, the encoder being used for encoding video frames within the target time period starting from the first video frame, and the target quantization parameter being used for encoding the first video frame.

2. The method for determining quantization parameter according to claim 1, wherein, If the output data amount does not meet the reference data amount, the first quality parameter is iteratively adjusted, comprising: in any iteration, if the output data amount is greater than the reference data amount, increasing the first quality parameter by a first multiple; if the output data amount is less than the reference data amount, decreasing the first quality parameter by a second multiple.

3. The method of determining quantization parameter according to claim 2, wherein, The method further comprises: determining a difference between the output data amount and the reference data amount; determining the first multiple or the second multiple based on the difference, the first multiple being positively correlated with the difference, and the second multiple being negatively correlated with the difference.

4. The method for determining quantization parameter according to claim 1, wherein, The encoder processes the first video frame and a plurality of second video frames within the target time period, the second video frames being video frames other than the first video frame, and the prediction of the output data amount of the encoder within the target time period based on the first quality parameter comprises: predicting a first data amount of the first video frame after encoding and a plurality of second data amounts of the second video frames after encoding based on the first quality parameter; taking a sum of the first data amount and the second data amounts of the second video frames as the output data amount of the encoder within the target time period.

5. The method of determining quantization parameter according to claim 4, wherein, The prediction of the first data amount of the first video frame after encoding and the second data amounts of the second video frames after encoding based on the first quality parameter comprises: predicting a second quantization parameter of each of the second video frames based on the first quantization parameter; for each second video frame, obtaining a second offset of the second video frame, the second offset being used for correcting the second quantization parameter of the second video frame; predicting a second quality parameter of the second video frame based on the second quantization parameter and the second offset of the second video frame; predicting distortion of the first video frame and the second video frames in the encoding process; predicting the first data amount of the first video frame after encoding based on the first quality parameter and the distortion of the first video frame, and predicting the second data amounts of the second video frames after encoding based on the second quality parameters and the distortion of the second video frames.

6. The method for determining quantization parameter according to claim 1, wherein, The target quantization parameter is determined based on the first quality parameter in the current iteration process, comprising: predicting a predicted data amount of the first video frame after encoding based on the first quality parameter in the current iteration process; if the predicted data amount is greater than a reference data amount of the first video frame and less than a target data amount, adjusting the first quality parameter in the current iteration process to obtain a third quality parameter, the target data amount being determined based on a video buffer amount in a video buffer verifier; determining the target quantization parameter based on the third quality parameter.

7. The method of determining quantization parameter according to claim 6, wherein, The method further comprises: obtaining a third data amount, the third data amount being a data amount output by the encoder when the video buffer amount reaches a target proportion of a total video buffer amount; determining the target data amount according to the third data amount and a target multiple.

8. The method for determining quantization parameter according to claim 1, wherein, The process of obtaining the first offset amount comprises: obtaining a plurality of offset amounts, the plurality of offset amounts being obtained by a plurality of parameter adjustment modules respectively performing offset amount prediction on the first video frame; taking a mean value of the plurality of offset amounts as the first offset amount.

9. The method for determining quantization parameter according to claim 1, wherein, The process of predicting the first quality parameter based on the first quantization parameter and the first offset amount comprises: correcting the first quantization parameter based on the first offset amount to obtain a third quantization parameter; predicting the first quality parameter based on the third quantization parameter, the first quality parameter being positively correlated with the third quantization parameter.

10. A device for determining quantization parameters, characterized in that, The apparatus comprises: a parameter obtaining unit configured to obtain a first quantization parameter of a first video frame and a first offset amount, the first quantization parameter being used for quantization processing of the first video frame, and the first offset amount being used for correcting the first quantization parameter; a parameter predicting unit configured to predict a first quality parameter based on the first quantization parameter and the first offset amount, the first quality parameter being used for indicating picture quality of the first video frame after encoding; a parameter adjusting unit configured to predict an output data amount of an encoder in a target time period based on the first quality parameter, iteratively adjust the first quality parameter if the output data amount does not satisfy a reference data amount, and determine a target quantization parameter based on the first quality parameter in a current iteration process if the output data amount predicted in any iteration process satisfies the reference data amount, the encoder being used for encoding video frames in the target time period starting from the first video frame, and the target quantization parameter being used for encoding the first video frame.

11. An electronic device, comprising: comprise: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the method for determining a quantization parameter according to any one of claims 1 to 9.

12. A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enabling the electronic device to perform the method for determining a quantization parameter according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Video coding method, device and equipment and storage medium

    CN110049321A

  • Video encoding method and device, and computer readable storage medium

    CN110800297A