Video encoding method, device and electronic device

The video encoding method addresses the issue of encoding complexity not being considered in the JVT-G012 algorithm by dynamically allocating bits based on relative encoding complexity, thereby reducing PSNR curve fluctuations and improving video quality.

JP7682297B2Active Publication Date: 2025-05-23VIVO MOBILE COMM CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2023564189
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-04-26
Filing Date
2022-04-25
Publication Date
2025-05-23
Estimated Expiration
2042-04-25

AI Technical Summary

Technical Problem

The JVT-G012 code rate control algorithm in video encoding does not consider encoding complexity at the frame level, leading to fluctuations in the PSNR curve and reduced average PSNR of the entire video sequence, resulting in poor video quality.

Method used

A video encoding method that determines a second number of bits for encoding a first image based on a first ratio, a first number of bits, and a first number, where the first ratio represents the relative encoding complexity between the first image and already encoded images in the target image group, allowing for dynamic bit allocation based on encoding complexity.

Benefits of technology

This approach reduces the fluctuation of the PSNR curve for each frame image in the image group, improves the quality of the encoded video by maintaining the average encoding code rate close to the target, and enhances the overall video quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007682297000057
    Figure 0007682297000057
  • Figure 0007682297000058
    Figure 0007682297000058
  • Figure 0007682297000059
    Figure 0007682297000059
Patent Text Reader

Abstract

This application discloses a video encoding method, apparatus and electronic device, which belongs to the field of communication technology. The method includes: determining a second number of bits for encoding a first image based on a first ratio, a first number of bits and a first number; and encoding the first image based on the second number of bits, where the first ratio is a ratio between a predicted encoding complexity of the first image and an actual encoding complexity of a second image of M frames, the first image is an unencoded first frame image in a target image group, the second image of M frames is an already encoded image in the target image group, the first number of bits is a remaining number of bits in the target image group, the first number is a number of unencoded images in the target image group, and M is an integer greater than 1.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] (CROSS REFERENCE TO RELATED APPLICATIONS) This application claims priority to China Patent Application No. 202110454418.X, filed in China on April 26, 2021, the entire contents of which are incorporated herein by reference.

[0002] The present application relates to the field of communication technology, and in particular to a video encoding method, apparatus and electronic device. [Background technology]

[0003] Video coding is a data compression method for digital video, which aims to remove redundancy in the original video image, save storage and transmission costs, and reduce the distortion of the encoded video image as much as possible under the same encoding code rate condition, thereby improving the quality of the encoded video.

[0004] Currently, video can be encoded by the JVT-G012 code rate control algorithm in the video encoding standard H.264 / AVC, which realizes three-level code rate control, namely, GOP (Group of Pictures) level, frame level, and macroblock level, and the control function is relatively comprehensive.

[0005] However, when a group of pictures in a video sequence does not include a P frame picture (i.e., a forward search frame), the JVT-G012 code rate control algorithm allocates bits to the P frame pictures in this group of pictures in a uniform allocation manner, that is, the JVT-G012 code rate control algorithm does not consider the coding complexity problem at the frame level when performing bit allocation, thus causing the Peak Signal-to-Noise Ratio (PSNR) curve of each frame picture in a GOP to fluctuate, thereby reducing the average Peak Signal-to-Noise Ratio PSNR of the entire video sequence, thus causing the quality of the video after encoding to be relatively poor. Summary of the Invention [Problem to be solved by the invention]

[0006] The objective of the embodiments of the present application is to provide a video encoding method, apparatus and electronic device that can solve the problem that the encoding complexity is not taken into account at the frame level, which reduces the average peak signal-to-noise ratio PSNR of the encoded video, thereby causing the quality of the encoded video to be relatively poor. [Means for solving the problem]

[0007] According to a first aspect, an embodiment of the present application provides a video encoding method, the method including: determining a second number of bits for encoding a first image based on a first ratio, a first number of bits and a first number; and encoding the first image based on the second number of bits, where the first ratio is a ratio between a predicted encoding complexity of the first image and an actual encoding complexity of a second image of M frames, the first image is an uncoded first frame image in a target image group, the second image of the M frames is an already coded image in the target image group, the first number of bits is a number of remaining bits in the target image group, the first number is a number of uncoded images in the target image group, and M is an integer greater than 1.

[0008] According to a second aspect, an embodiment of the present application provides a video encoding apparatus, the apparatus including: a determination module and an encoding module, the determination module is used for determining a second number of bits for encoding a first image based on a first ratio, a first number of bits and a first number, the encoding module is used for encoding the first image based on the second number of bits determined by the determination module, where the first ratio is a ratio between a predicted encoding complexity of the first image and an actual encoding complexity of a second image of M frames, the first image is an unencoded first frame image in a target image group, the second image of the M frames is an already encoded image in the target image group, the first number of bits is a remaining number of bits in the target image group, the first number is a number of unencoded images in the target image group, and M is an integer greater than 1.

[0009] According to a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a processor, a memory, and a program or instructions stored in the memory and operable to run on the processor, the program or instructions being operable when executed by the processor to implement steps of the method according to the first aspect.

[0010] According to a fourth aspect, an embodiment of the present application provides a readable storage medium having stored thereon a program or instructions which, when executed by a processor, implements the steps of the method according to the first aspect.

[0011] According to a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface coupled to the processor, the processor running a program or instructions and used to implement the method according to the first aspect. Effect of the Invention

[0012] In an embodiment of the present application, a second number of bits for encoding a first image can be determined based on a first ratio, a first number of bits and a first number, and the first image can be encoded based on the second number of bits, where the first ratio is a ratio between the predicted encoding complexity of the first image and the actual encoding complexity of a second image of M frames, the first image is an unencoded first frame image in a target image group, the second image of M frames is an already encoded image in the target image group, the first number of bits is the number of remaining bits in the target image group, the first number is the number of unencoded images in the target image group, and M is an integer greater than 1. According to this solution, the first ratio can indicate the relative coding complexity between the first image and the second image of the already coded M frames in the target image group, that is, the video coding method according to the embodiment of the present application can allocate the number of bits to the image to be coded based on the relative coding complexity between the image to be coded and the already coded images in the target image group, the number of remaining bits in the target image group, and the number of remaining frames in the target image group, so that it is possible to realize saving coding bits from images with low coding complexity in the target image group, and by using the saved coding bits for coding images with high coding complexity, under the premise that the average coding code rate is kept close to the target code rate (average coding code rate), the fluctuation of the PSNR curve of each frame image in the image group can be reduced, and the quality of the video after coding can be further improved. [Brief description of the drawings]

[0013] [Figure 1] FIG. 1 is a diagram illustrating a basic framework for code rate control in video encoding. [Diagram 2] FIG. 2 is a schematic diagram of a buffer. [Diagram 3] FIG. 1 is a general structural diagram of a code rate control algorithm. [Figure 4] 1 is a flowchart of a video encoding method according to an embodiment of the present application; [Diagram 5] 1 is a schematic diagram of a video encoding device according to an embodiment of the present application; [Figure 6] 1 is a schematic diagram of an electronic device according to an embodiment of the present application. [Figure 7] FIG. 2 is a hardware schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0014] The following clearly describes the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present application are all within the scope of protection of the present application.

[0015] The terms "first," "second," and the like in the specification and claims of the present application are intended to distinguish between similar objects and are not intended to describe a particular order or sequence. It is to be understood that the terms so used are interchangeable where appropriate, such that the embodiments of the present application may be performed in an order other than that shown or described herein. Furthermore, the objects distinguished by "first," "second," and the like are generally of the same type and do not limit the number of objects, e.g., the first object may be one or more. In addition, "and / or" in the specification and claims represents at least one of the objects connected, and the character " / " generally represents an "or" relationship between the related objects.

[0016] In the following, we will first interpret and explain some nouns or terms related to the claims and specification of this application.

[0017] Basic unit (BU): A set of one or more macro blocks (MBs). The number of MBs included in one BU should be divisible by the number of MBs included in one frame image. For example, in a video sequence in QCIF format, if one frame image includes 99 MBs, one BU of this image may include 99, 33, 11, 9, 3, or 1 MBs, and therefore the image may include 1, 3, 9, 11, 33, or 99 BUs.

[0018] As can be seen, one BU may include one MB, one slice, one field or one frame image.

[0019] For example, take one basic unit BU as at least one macroblock. If one image is composed of a macroblocks MB, and one BU is composed of b consecutive MBs, then c=a / b, where c is the number of all BUs contained in this image, and a, b, and c are all positive integers.

[0020] It should be noted that all macroblocks MB in one basic unit BU are coded using the same quantization parameter QP. The more MBs included in one BU, the larger the size of this BU, which represents the lower computational complexity of coding this BU and the lower control precision; the less MBs included in one BU, the smaller the size of this BU, which represents the higher computational complexity of coding this BU and the higher control precision. In real-time applications, a relatively large size BU is generally selected, for example, all MBs in one line of an image are configured as one basic unit BU, or one frame image is one basic unit BU.

[0021] Traffic round trip model: Used to calculate the target bits allocated to the current frame image, i.e. the number of bits to be allocated to the current frame image.

[0022] JPEG0007682297000001.jpg112169

[0023] Buffer: Also called a buffer register, it is used to temporarily store data sent from an external device (e.g., an encoder) so that the data can be transmitted over the channel bandwidth. The buffer area in the embodiment of the present invention is the buffer area of ​​a buffer.

[0024] MAD linear prediction model: Used to predict the MAD of the jth frame image based on the actual MAD of the j-1th frame image, or to predict the MAD of a basic unit at a corresponding position in the jth frame image based on the MAD of one basic unit in the j-1th frame image, where j is a positive integer greater than 1.

[0025] JPEG0007682297000002.jpg20160

[0026] JPEG0007682297000003.jpg28169

[0027] Image MAD: The absolute average difference between the YUV value (e.g., Y value) of the current frame image and the YUV value (e.g., Y value) of the frame image one frame before the current frame image (which should be a P frame image or an I frame image).

[0028] Here, "Y" in YUV stands for brightness (Luminance or Luma), and "U" and "V" stand for chrominance or density (Chroma), with "U" and "V" serving to describe the color and saturation of an image and being used to indicate the saturation of an image.

[0029] MAD of basic unit BU: The absolute average difference between the YUV values ​​of one BU and the YUV values ​​of another BU, where the other BU is a BU in the frame image (e.g., the j-1th frame image) immediately preceding the image in which the one BU is located (e.g., the jth frame image), the coordinate information of the one BU in the jth frame image is the same as the coordinate information of the j-1th frame image of the other BU, the jth frame image belongs to the same image group as the j-1th frame image, and j is an integer greater than 1.

[0030] Hereinafter, a video encoding method according to an embodiment of the present application will be described in detail with reference to specific embodiments and application scenarios thereof in conjunction with the drawings.

[0031] The video signal transmission bandwidth is generally subject to certain limitations, and in order to effectively transmit video data under the circumstances of satisfying the channel bandwidth and transmission delay, and to ensure the playback quality of the video business, it is necessary to perform code rate control for the video encoding process. The code rate control is to select an appropriate encoding parameter, for example, a quantization parameter QP, and encode the image corresponding to this quantization parameter according to this quantization parameter, so that the bit rate after encoding the video signal meets the bandwidth limitation and the encoding distortion is as small as possible. As can be seen, the code rate control is a typical multi-constraint, multi-target rate distortion optimization problem, which may be written as determining the optimal encoding parameters for each encoding unit so that the total distortion is minimized under the condition that the total encoding bit number of the video signal is equal to or less than Rc (the limit bit, or the target bit), and specifically, it can be expressed as the following formula (3).

[0032] JPEG0007682297000004.jpg54169

[0033] A video sequence can be encoded by an encoder, and the encoded bit stream after encoding generally needs to be transmitted through a communication channel. In practical applications, most communication channels are constant bit rate CBR (Constant Bitrate, CBR) channels, but most of the encoded code streams output by an encoder are variable bit rate VBR (Variable Bitrate, VBR) code streams. Therefore, in order to effectively transmit the VBR code stream in the CBR channel, a buffer may be installed at the encoder output. For example, the basic framework of the code rate control in video encoding is shown in Figure 1.

[0034] As shown in Figure 2, Figure 2 is a schematic diagram of a buffer. A in Figure 2 represents the coded bit stream that the video encoder outputs to the buffer, Bs represents the size of the buffer area of ​​the buffer, Bc (i.e., the filling area in Figure 2) is the number of bits to be transmitted in the buffer area of ​​the buffer, Cb is the channel bandwidth, Fr is the coding frame rate, and Cb / Fr represents the amount of data transmitted through the communication channel within the time length that the encoder codes one frame image.

[0035] The following is an illustrative explanation of the principle of the code rate control algorithm in the prior art.

[0036] The goal of code rate control is to obtain better video quality with limited bandwidth. To achieve this goal, two problems need to be solved: how to allocate the number of coding bits, and how to effectively utilize the allocated number of bits to estimate optimal coding parameters. In other words, a code rate control algorithm generally includes two steps: bit allocation and quantization parameter QP estimation. Here, bit allocation refers to allocating limited resources to image units such as picture groups, frames, and macroblocks. Quantization parameter estimation refers to estimating optimal coding parameters corresponding to resource 0 based on the resource allocated to an image unit (hereinafter referred to as resource 0, i.e., the number of bits), so that the distortion of the video after encoding is minimized.

[0037] The code rate control algorithm, on the one hand, requires that the encoded code stream is suitable for transmission on a band-limited channel (e.g., a CBR channel), and on the other hand, requires that it obtains better video quality with a limited channel transmission bandwidth. To judge whether the video quality is good or not, generally, two aspects need to be considered: the first is to check the average PSNR of all frames in the entire sequence, and the better the average PSNR is, the better the quality of the video sequence; the second is to check the change situation of the PSNR curve during the video sequence encoding process, and the smoother the PSNR curve is, the better the quality of the video sequence is.

[0038] In the conventional code rate control algorithm, the above two problems are studied in three profiles, which are the GOP layer, the frame layer and the BU layer respectively. In video coding, the code rate control is generally performed in the GOP unit in a "3-layer 2-step" manner, as shown in Figure 3.

[0039] A GOP generally starts with an I frame that adopts intraframe predictive coding, followed by some P frames and / or B frames that adopt interframe predictive coding. Here, the I frame is a key frame in the GOP, and belongs to intraframe compression. The image of the I frame is fully reserved, and the decoding of the I frame can be completed only with the current frame data. The P frame is a forward search frame, also called a difference frame or interframe compression. After encoding the P frame, it represents the difference information between the current frame and the I frame or the P frame before the current frame. When decoding the P frame, it is necessary to superimpose the coding difference information defined in the current frame on the image cached in the P frame or I frame before the current frame, and reconstruct the image of the current frame. The B frame is a bidirectional difference frame, that is, the B frame after encoding records the difference information between the current frame (i.e., the current frame) and the previous and subsequent frames. In other words, to decode the B frame, it is not only necessary to obtain the previous cached image, but also to decode the subsequent image, and the current frame image is reconstructed by the coding data of the previous and subsequent frames and the current frame.

[0040] As can be seen from the above, since the amount of data generated by encoding an I frame is much larger than the amount of data generated by encoding a P frame and a B frame, after encoding an I frame, the buffer occupancy Bc reaches a relatively high level, and this occupancy Bc gradually decreases in the process of encoding the P frame and the B frame following the I frame. After the encoding of the images in one GOP is completed, the buffer occupancy can be restored to the level before encoding this GOP.

[0041] In practical implementation, from the GOP layer to the BU layer, the code rate control algorithm allocates coding resources from top to bottom and determines the quantization parameter QP based on the number of available coding bits. The main task of GOP layer code rate control is to allocate the number of coding bits to the whole GOP, and the basis for the allocation is the number of frames contained in the current GOP, the occupancy of the encoder output buffer area, and the channel bandwidth. Then, the QP of the I-frame at the start of the GOP needs to be calculated, and the process of calculating the I-frame QP is the process of allocating coding resources between intra-frame predicted frames and inter-frame predicted frames. In JVT-G012, the I-frame QP of each GOP is calculated based on the average QP of all P-frames in the previous GOP, and for the first GOP, a QP can be selected for the I-frame in the first GOP based on experience.

[0042] Frame layer code rate control is an important part in video coding, and whether it is GOP layer code rate control or BU layer code rate control, it is mainly done in frame layer code rate control. In frame layer code rate control, it needs to first allocate coding bits in the form of target bits between each P frame in a GOP, and then estimate the QP of the current frame based on the allocated number of coding bits.

[0043] In the coding bit allocation of GOP layer code rate control and frame layer code rate control, the coding bit number allocation between I frames and P frames and between different P frames is completed by setting the I frame QP and the coding bit number of each P frame. In the QP calculation of frame layer code rate control and BU layer code rate control, the main task is to make the actual number of bits generated by coding match the target number of bits by setting an appropriate QP for each MB in the frame.

[0044] In the following, the code rate control methods of the prior art are illustratively described by taking the JVT-F086 code rate control algorithm and the JVT-G012 code rate control algorithm recommended for H.264 / AVC video encoding as examples.

[0045] JVT-F086 Code Rate Control Algorithm and JVT-G012 Code Rate Control Algorithm I. The JVT-F086 code rate control algorithm is based on the MPEG-2 TM5 code rate model, and allocates bits according to the buffer status to ensure that the buffer does not overflow or underflow as much as possible. In the JVT-F086 code rate control algorithm, before encoding a frame image, it is necessary to estimate the number of bits required to encode this frame image, and then, based on the buffer feedback, it pre-assumes a QP, and encodes this frame image according to this QP, and then, based on the actual encoding result of the current frame image, it is determined whether the pre-assumed QP needs to be adjusted, and if it needs to be adjusted, it can first adjust the QP and then re-encode this frame image according to the adjusted QP, that is, in the JVT-F086 code rate control algorithm, when encoding each frame image, it is necessary to determine whether to re-assign the QP, and then re-encode this frame image according to the re-assigned QP, so that the computational complexity of JVT-F086 is relatively high. At the same time, the JVT-F086 code rate control algorithm controls the code rate from the perspective of buffer saturation, which has better control over the buffer and the change in buffer occupancy is smoother, but the fluctuation of the video quality after encoding is larger.

[0046] II. The JVT-G012 code rate control algorithm inherits the concept of the MPEG-4 VM8 code rate control algorithm, reuses the quadratic rate-distortion model, and can timely adjust the model parameters based on the source characteristics. The main technologies of the JVT-G012 code rate control algorithm include the traffic round-trip model, the MAD linear prediction model and the quadratic rate-distortion model. The JVT-G012 code rate control algorithm allocates the target coding bits to the current frame based on the predefined bit rate, frame rate, buffer fullness and buffer target line, and predicts the MAD of the current frame image using the linear tracking theory, and finally calculates the QP of the current frame image according to the quadratic rate-distortion model. The JVT-G012 code rate control algorithm uses the method of predicting the MAD to solve the QP paradox problem, and compared with the JVT-F086 code rate control algorithm, each frame image to be coded only needs to be coded once, so the computational complexity of the JVT-G012 code rate control algorithm is relatively low. In addition, the JVT-G012 code rate control algorithm realizes three-level code rate control of the GOP layer, the frame layer and the macroblock layer, and the control function is relatively comprehensive.

[0047] The following describes in detail how the JVT-G012 code rate control algorithm achieves three-stage code rate control at the GOP layer, frame layer and macroblock layer.

[0048] JPEG0007682297000005.jpg72169

[0049] JPEG0007682297000006.jpg56169

[0050] JPEG0007682297000007.jpg13169

[0051] JPEG0007682297000008.jpg29169

[0052] The initial quantization parameters of the I frame and the first P frame of the other GOPs except the first GOP in the video sequence can be calculated by the following equation (7).

[0053] JPEG0007682297000009.jpg64169

[0054] Frame Layer Code Rate Control Frame layer code rate control includes two stages: a pre-encoding stage and a post-encoding stage.

[0055] (1) Pre-encoding stage The main task of this stage is to calculate the quantization parameters for all coding frames, including P frames and B frames. B frames are generally not used as reference frames, so their QPs are obtained by simple linear interpolation from the QPs of adjacent frames, while P frames are reference frames for subsequent frames, so their QP values ​​are obtained by precise calculation. Therefore, it is necessary to consider the calculation methods of the quantization parameters of different frames respectively.

[0056] JPEG0007682297000010.jpg20162

[0057] JPEG0007682297000011.jpg13169

[0058] JPEG0007682297000012.jpg17169

[0059] When E>1, that is, when there is one or more B frames between two adjacent P frames, the calculation formula for the quantization parameter of the B frame is Equation (9).

[0060] JPEG0007682297000013.jpg35169

[0061] JPEG0007682297000014.jpg62167

[0062] JPEG0007682297000015.jpg15164

[0063] JPEG0007682297000016.jpg45169

[0064] JPEG0007682297000017.jpg51169

[0065] JPEG0007682297000018.jpg83169

[0066] JPEG0007682297000019.jpg40169

[0067] JPEG0007682297000020.jpg22169

[0068] JPEG0007682297000021.jpg62169

[0069] JPEG0007682297000022.jpg34169

[0070] JPEG0007682297000023.jpg22169

[0071] JPEG0007682297000024.jpg30169

[0072] JPEG0007682297000025.jpg41162

[0073] JPEG0007682297000026.jpg13169

[0074] JPEG0007682297000027.jpg23169

[0075] JPEG0007682297000028.jpg8169

[0076] (2) Post-encoding stage There are three main tasks in this stage: updating the parameters in the linear prediction model, updating the parameters in the quadratic rate-distortion model, and determining the number of frames to skip.

[0077] JPEG0007682297000029.jpg10152

[0078] JPEG0007682297000030.jpg40169

[0079] JPEG0007682297000031.jpg28169

[0080] The buffer occupancy can be calculated by the following equation (22):

[0081] JPEG0007682297000032.jpg15153

[0082] To summarize, as can be seen from the above formulas (12) to (17), when there is no B frame in a GOP, the JVT-G012 code rate control algorithm does not consider the coding complexity between each P frame at the frame level when performing bit allocation. That is, it is assumed that the coding complexity of each P frame in the same GOP is the same, and coding resources are allocated equally to each P frame. However, in an actual video sequence, the coding complexity of each frame varies depending on the width and amount of motion contained in each frame, and adopting an equal allocation policy not only causes fluctuations in the PSNR curve of each frame within the GOP, but also causes a decrease in the average PSNR of the entire sequence, thereby reducing the overall quality of video coding.

[0083] In code rate control, accurate estimation of the coding complexity of the control target is the basis for rational and effective resource allocation. In JVT-G012, it is assumed that the coding complexity of each P frame in the same GOP is the same, and coding resources are allocated equally to each P frame. Meanwhile, in real video, the coding complexity of each frame image in the video varies according to the width and amount of motion contained in each frame image, and adopting a policy of equal allocation will cause fluctuations in the video quality after compression. In response to the above problems, the embodiment of the application proposes a video coding method based on coding complexity, and optimizes the step of calculating the number of bits of a P frame in the frame layer code rate control in the JVT-G012 method.

[0084] Specifically, the video encoding method according to the embodiment of the present application performs frame layer bit allocation based on encoding complexity within one GOP of pictures of a video to be encoded, and saves encoding bits from low-complexity frame encoding and uses them for high-complexity frame encoding, thereby reducing the fluctuation of each frame picture PSNR curve in the picture group, for example, under the premise that the average encoding code rate is kept close to the target code rate, and thereby improving the quality of the encoded video.

[0085] In order to make the picture quality of each frame image in a video sequence closer to each other after encoding, it is necessary to allocate an appropriate number of encoding bits to each frame image based on the encoding complexity, and such bit number allocation is generally performed within each GOP. To allocate bits between different images in the same GOP, it is necessary to know the relative encoding complexity between images, and calculate a weighting parameter based on the relative encoding complexity to modify the number of bits allocated using the equal allocation policy in JVT-G012 frame layer code rate control.

[0086] An embodiment of the present application provides a video encoding method, and as shown in Fig. 4, the method may include the following steps 101 and 102. In the following, the method is illustratively described by taking a video encoding device as an execution body.

[0087] Step 101, the video encoding device determines a second number of bits for encoding a first image based on a first ratio, a first number of bits and a first number.

[0088] Step 102, the video encoding device encodes the first image based on a second number of bits.

[0089] Wherein the first ratio is a ratio between the predicted coding complexity of the first image and the actual coding complexity of the second image of M frames, the first image is an uncoded first frame image in the target image group, the second image of said M frames is an already coded image in the target image group, the first number of bits is a remaining number of bits in the target image group, the first number is a number of uncoded images in the target image group, and M may be an integer greater than 1.

[0090] In an embodiment of the present application, the second number of bits is the number of bits that the video encoding device configures for the first image, ie the second number of bits is the target number of bits for the first image.

[0091] In an embodiment of the present application, the first ratio may be used to represent the relative encoding complexity of a first image to be encoded relative to a second image of already encoded M frames in a target image group.

[0092] It should be noted that the first image, the M second images and the first number are determined according to the encoding progress of the target image group.

[0093] For example, if the target image group includes 10 frame images, which are image 1, image 2, image 3, image 4, image 5, image 6, image 7, image 8, image 9 and image 10, respectively, and image 3 is the most recently encoded image, the first image is image 4, and the M (M=3) second images include image 1, image 2 and image 3, and the first number is 7. And after the encoding of the encoded image 4 is completed, image 5 becomes the first uncoded frame image in the target image group, so the video encoding apparatus may take image 5 as the new first image and re-perform the above steps 101 and 102, and infer accordingly, until the encoding of image 10 is completed. Then, the video encoding apparatus may continue to encode the next image group.

[0094] In the video encoding method according to the embodiment of the present application, the first ratio can indicate the relative encoding complexity between the first image and the second image of the already encoded M frames in the target image group, that is, the video encoding method according to the embodiment of the present application can determine the number of bits of the image to be encoded based on the relative encoding complexity between the image to be encoded and the already encoded images in the target image group, the number of remaining bits in the target image group, and the number of remaining frames in the target image group, so that it can realize saving encoding bits from images with low encoding complexity in the target image group, and the saved encoding bits can be used to encode images with high encoding complexity, for example, under the premise that the average encoding code rate is kept close to the target code rate (average encoding code rate), thereby reducing the fluctuation of the PSNR curve of each frame image in the image group, and thereby improving the quality of the encoded video.

[0095] Alternatively, in the embodiment of the present application, the above step 101 can be specifically realized by the following steps 101a and 101b.

[0096] Step 101a, the video encoding apparatus determines, according to a first ratio, a weighting parameter corresponding to the first ratio.

[0097] JPEG0007682297000033.jpg20169

[0098] JPEG0007682297000034.jpg31169

[0099] Alternatively, in the embodiment of the present application, a and b in the above formula (23) are constants, for example, a=1.1, b=3.5. Of course, in practical implementation, a and b may be other values, for example, a=1.1±0.5, b=3.5±1.

[0100] JPEG0007682297000035.jpg10148

[0101] JPEG0007682297000036.jpg28169

[0102] To help you understand, high If the value is too large, a high-complexity image will consume too many coding resources, affecting the coding quality of subsequent frames, and S high If the value is too small, the coding resources allocated to high-complexity images will be limited, affecting the improvement of their coding quality. low If the value is too large, it will affect resource savings when encoding images with relatively low complexity, and S low If the value is too small, some images may suffer from severely degraded encoding quality due to too few encoding resources being allocated to them.

[0103] Optionally, in the embodiments of the present application, S high and S. low The value of may be a constant, e.g., S high =1.5, S low =0.45 may also be used.

[0104] Step 101b, determining a weighting parameter based on the video encoding device, a first number of bits and a first number, a second number of bits for encoding the first image.

[0105] JPEG0007682297000037.jpg17169

[0106] JPEG0007682297000038.jpg41169

[0107] In an embodiment of the present application, a weighting parameter corresponding to a first ratio representing the relative encoding complexity between the first image and the already encoded images in the target image group is first determined, and then the number of bits for encoding the first image may be determined based on this weighting parameter, the number of remaining bits and the number of unencoded images, i.e., the number of bits for an encoded image may be determined based on the relative encoding complexity between each frame image in the image group. Therefore, compared with a method of determining the number of bits for an encoded image using an equal allocation method, the video encoding method according to an embodiment of the present application can relatively well suppress the variation in video quality between frames after encoding.

[0108] Optionally, in an embodiment of the present application, the number of bits of the image to be encoded may be determined based on the relative encoding complexity between the image to be encoded (the first image as described above) and the already encoded images, the number of remaining bits, the number of remaining frames and the buffer status, e.g. to avoid overflow and underflow of the buffer occupancy.

[0109] Optionally, in the embodiment of the present application, the above step 101 can be specifically realized by the following step 101c.

[0110] In step 101c, the video encoding device determines a second number of bits to encode the first image based on the first ratio, the first number of bits, the first number and the target parameter.

[0111] Here, the target parameters include the estimated occupancy of the buffer, the actual occupancy of the buffer space, the encoding frame rate, and the available channel transmission rate before encoding the first image. For a CBR channel, the available channel transmission rate before encoding each frame image is the same.

[0112] In the embodiment of the present application, the second bit number for encoding the first image can be determined according to the first ratio, the first bit number, the first number and the target parameter, so that the variation of encoding quality between frames can be suppressed and the overflow or underflow of the buffer occupancy can be avoided, thus the quality of the encoded video can be further improved.

[0113] Alternatively, in the embodiment of the present application, the above step 101c can be specifically realized by the following steps A and B.

[0114] Step A, the video encoding device determines a third number of bits based on the first ratio, the first number of bits and the first number.

[0115] As can be seen, step A determines the number of bits to encode the first image based on the relative encoding complexities between the images in the target image set.

[0116] In an embodiment of the present application, the video encoding apparatus may first determine a weighting parameter corresponding to the first ratio based on the first ratio, and then determine a third bit number based on the weighting parameter, the first bit number and the first number, see above equation (25). Specifically, refer to the relevant description of step 101a and step 101b, and will not be further described here to avoid repetition.

[0117] Step B, the video encoding device determines a fourth number of bits based on the target parameter.

[0118] As can be seen, in the embodiment of the present application, the fourth number of bits determines the number of bits to encode the first image based on the capacity of the encoder.

[0119] JPEG0007682297000039.jpg18169

[0120] JPEG0007682297000040.jpg33169

[0121] Step C, the video encoding device performs a weighted addition of the third number of bits and the fourth number of bits to obtain the second number of bits.

[0122] JPEG0007682297000041.jpg30164

[0123] JPEG0007682297000042.jpg50169

[0124] In the embodiment of the present application, the third bit number for encoding the first image can be determined from the angle of relative encoding complexity, and the fourth bit number for encoding the first image can be determined from the angle of buffer occupancy, and the sum of the weighted values ​​of the third bit number and the fourth bit number can be the final bit number for encoding the first image, so that the quality of the encoded image with high complexity can be improved, and the smoothness of the PSNR curve of each frame image in the target image group can be improved, and the fluctuation of the PSNR curve can be reduced, so that the average PSNR of the entire video sequence after encoding can be improved. Thus, the quality of the encoded video can be improved.

[0125] Alternatively, in the embodiment of the present application, the above step 102 can be specifically realized by the following steps 102a and 102b.

[0126] In step 102a, the video encoding apparatus determines a quantization parameter (hereinafter referred to as a target quantization parameter) for the first image using a quadratic rate-distortion model based on the second number of bits and the predicted encoding complexity of the first image.

[0127] In step 102b, the video encoder encodes the first image according to the target quantization parameter.

[0128] Optionally, the predictive coding complexity of the first image is represented by a predictive MAD value of the first image, the predictive MAD value of the first image is predicted by a linear prediction model based on an actual MAD value of a frame image (hereinafter referred to as a third image) immediately preceding the first image, and a target quantization parameter is predicted by a quadratic rate-distortion model based on the predictive coding complexity of the first image and the actual coding complexity of the third image.

[0129] JPEG0007682297000043.jpg18169

[0130] JPEG0007682297000044.jpg34169

[0131] JPEG0007682297000045.jpg18169

[0132] JPEG0007682297000046.jpg20169

[0133] JPEG0007682297000047.jpg41169

[0134] The following provides an exemplary description of a method for controlling the BU layer code rate by a video encoding device.

[0135] For I and B frames in a picture group, all macroblocks MB in one frame image are coded using the same quantization parameters, for example, all are coded using the quantization parameters of this image. Therefore, the main target of the code rate control of the BU layer is the P frame in the picture group.

[0136] For each P frame in the set of pictures, we first need to allocate the number of bits allocated to one P frame to each BU in this P frame. Since the MAD values ​​(i.e., coding complexity) of the uncoded elementary units in the current P frame are unknown, the number of available bits remaining in the current P frame can be allocated equally to the uncoded elementary units in the current P frame.

[0137] The BU layer code rate control algorithm may include five steps as follows.

[0138] Step 1, calculate the target number of bits for the BU to be coded, i.e. the number of bits to be allocated to this BU with coding.

[0139] JPEG0007682297000048.jpg39169

[0140] JPEG0007682297000049.jpg17169

[0141] JPEG0007682297000050.jpg50169

[0142] JPEG0007682297000051.jpg10148

[0143] JPEG0007682297000052.jpg41169

[0144] JPEG0007682297000053.jpg35169

[0145] Step 5: According to the calculated quantization parameter, perform rate-distortion optimization coding for all macroblocks in the cth BU, and update the remaining bit number of the ith frame image, the parameters of the MAD linear prediction model, and the parameters of the binomial rate-distortion model after the coding is completed. For details, please refer to the relevant description in the above embodiment.

[0146] Optionally, in an embodiment of the present application, before the above step 101, the video encoding method according to an embodiment of the present application may further include the following step 103.

[0147] Step 103, the video encoding apparatus determines a first ratio based on the predictive encoding complexity of the first image and the average encoding complexity of the second image of M frames.

[0148] JPEG0007682297000054.jpg17169

[0149] JPEG0007682297000055.jpg45169

[0150] JPEG0007682297000056.jpg17169

[0151] In the embodiment of the present application, when allocating the number of bits to a frame image, it is only necessary to refer to the average encoding complexity of the already encoded images in the GOP in which this image is located, so that the encoded video quality of images in the same GOP can be made closer to each other after encoding, thereby reducing the fluctuation of the peak signal-to-noise ratio curves of each frame image in the same GOP, for example, improving the encoded video quality.

[0152] It should be mentioned that in the video encoding method according to the embodiment of the present application, the execution body may be a video encoding device, or a control module for executing the video encoding method in the video encoding device. In the embodiment of the present application, the execution of the video encoding method by the video encoding device is taken as an example to describe the video encoding device according to the embodiment of the present application.

[0153] Fig. 5 is a possible structural schematic diagram of a video encoding device according to an embodiment of the present application, as shown in Fig. 5, the video encoding device 50 may include a determining module 51 and an encoding module 52. The determining module 51 may be used to determine a second number of bits for encoding the first image according to a first ratio, a first number of bits and a first number, and the encoding module 52 may be used to encode the first image according to the second number of bits determined by the determining module 51, where the first ratio may be a ratio between the predicted encoding complexity of the first image and the actual encoding complexity of the second image of M frames, the first image is an unencoded first frame image in the target image group, the second image of the M frames is an already encoded image in the target image group, the first number of bits is the remaining number of bits in the target image group, the first number is the number of unencoded images in the target image group, and M is an integer greater than 1.

[0154] Optionally, in the embodiment of the present application, the determination module 51 may be specifically used for determining a weighting parameter corresponding to the first ratio according to the first ratio, and determining a second number of bits for encoding the first image based on the weighting parameter, the first number of bits and the first number.

[0155] Optionally, in an embodiment of the present application, the determination module 51 may be specifically used for determining a second number of bits for encoding the first image based on the first ratio, the first number of bits, the first number and target parameters, where the target parameters include the estimated occupancy of the buffer space, the actual occupancy of the buffer space, the encoding frame rate, and the available channel transmission rate before encoding the first image.

[0156] Optionally, in an embodiment of the present application, the determination module 51 may include a first determination sub-module and a processing sub-module, the first determination sub-module may be used to determine a third number of bits based on the first ratio, the first number of bits and the first number, and to determine a fourth number of bits based on a target parameter, and the processing sub-module may be used to weightedly add the third number of bits and the fourth number of bits determined by the first determination sub-module to obtain a second number of bits.

[0157] Optionally, in an embodiment of the present application, the encoding module 52 may include a second determining sub-module and an encoding sub-module; The second determining submodule may be used to determine a quantization parameter of the first image according to a quadratic rate-distortion model based on the second number of bits and a predicted coding complexity of the first image; The encoding sub-module may be used to encode the first image according to the quantization parameter determined by the second determining sub-module.

[0158] Optionally, in an embodiment of the present application, the determination module 51 may be further used for determining the first ratio based on the predictive encoding complexity of the first image and the average encoding complexity of the second image of M frames, before determining the second number of bits for encoding the first image based on the first ratio, the first number of bits and the first number.

[0159] In the video encoding device according to the embodiment of the present application, the first ratio can indicate the relative encoding complexity between the first image and the second image of the already encoded M frames in the target image group, that is, the video encoding method according to the embodiment of the present application can determine the number of bits of the image to be encoded based on the relative encoding complexity between the image to be encoded and the already encoded images in the target image group, the number of remaining bits in the target image group, and the number of remaining frames in the target image group, so that it is possible to realize saving encoding bits from images with low encoding complexity in the target image group, and by using the saved encoding bits for encoding images with high encoding complexity, under the premise that the average encoding code rate is kept close to the target code rate (average encoding code rate), the fluctuation of the PSNR curve of each frame image in the image group can be reduced, and the quality of the video after encoding can be further improved.

[0160] The beneficial effects of various implementation methods in this embodiment may be specifically referred to the beneficial effects of the corresponding implementation methods in the above method embodiments, and will not be described further here in order to avoid repetition.

[0161] The video encoding device in the embodiment of the present application may be a device, or may be a component, integrated circuit, or chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palmtop computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), and the non-mobile electronic device may be a network attached storage (NAS), a personal computer (PC), a television (TV), a deposit machine, or a self-service machine, and the embodiment of the present application is not specifically limited.

[0162] The video encoding device in the embodiment of the present application may be a device having an operating system, which may be the Android operating system, the ios operating system, or other possible operating systems, and the embodiment of the present application is not specifically limited.

[0163] The video encoding apparatus according to the embodiment of the present application can implement each process implemented by the method embodiment of Figures 1 to 4, and will not be further described here to avoid repetition of description.

[0164] As shown in Fig. 6, the embodiment of the present application further provides an electronic device 200, which includes a processor 202, a memory 201, and a program or instruction stored in the memory 201 and capable of running on the processor 202, which, when executed by the processor 202, can realize each process of the embodiment of the above-mentioned video encoding method and achieve the same technical effect. In order to avoid repetition, no further description will be given here.

[0165] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices described above.

[0166] FIG. 7 is a schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present application.

[0167] As shown in FIG. 7, the electronic device 1000 includes components such as, but not limited to, a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010.

[0168] As can be understood by those skilled in the art, the electronic device 1000 may further include a power source (e.g., a battery) for powering each component, and the power source may be logically connected to the processor 1010 by a power management system, so that the power management system can realize functions such as charge / discharge management and power consumption management. The electronic device structure shown in FIG. 7 does not constitute a limitation on the electronic device, and the electronic device may include more or less components than the number of components shown, or a combination of some components, or a different arrangement of components, which will not be further described here.

[0169] Here, the processor 1010 may be used to determine a second number of bits to encode the first image based on the first ratio, the first number of bits and the first number, and encode the first image based on the second number of bits, where the first ratio may be a ratio between the predicted encoding complexity of the first image and the actual encoding complexity of the second image of the M frame, the first image is an uncoded first frame image in the target image group, the second image of the M frame is an already coded image in the target image group, the first number of bits is the remaining number of bits in the target image group, the first number is the number of uncoded images in the target image group, and M is an integer greater than 1.

[0170] Optionally, in an embodiment of the present application, the processor 1010 may be specifically used to determine a weighting parameter corresponding to the first ratio according to the first ratio, and determine a second number of bits to encode the first image based on the weighting parameter, the first number of bits and the first number.

[0171] Optionally, in an embodiment of the present application, the processor 1010 may be specifically used to determine a second number of bits to encode the first image based on the first ratio, the first number of bits, the first number and target parameters, where the target parameters include an estimated occupancy of the buffer space, an actual occupancy of the buffer space, an encoding frame rate, and an available channel transmission rate before encoding the first image.

[0172] Optionally, in an embodiment of the present application, the processor 1010 may be used to determine a third number of bits based on the first ratio, the first number of bits and the first number, and determine a fourth number of bits based on a target parameter, and weightedly add the third number of bits and the fourth number of bits to obtain the second number of bits.

[0173] Optionally, in an embodiment of the present application, the processor 1010 may be used to determine a quantization parameter of the first image according to a quadratic rate-distortion model based on the second number of bits and the predicted coding complexity of the first image, and to encode the first image according to the quantization parameter.

[0174] Optionally, in an embodiment of the present application, the processor 1010 may be further used to determine the first ratio based on the predictive encoding complexity of the first image and the average encoding complexity of the second image of M frames before determining the second number of bits to encode the first image based on the first ratio, the first number of bits and the first number.

[0175] In the video encoding device according to the embodiment of the present application, the first ratio can indicate the relative encoding complexity between the first image and the second image of the already encoded M frames in the target image group, that is, the video encoding method according to the embodiment of the present application can determine the number of bits of the image to be encoded based on the relative encoding complexity between the image to be encoded and the already encoded images in the target image group, the number of remaining bits in the target image group, and the number of remaining frames in the target image group, so that it is possible to realize saving encoding bits from images with low encoding complexity in the target image group, and by using the saved encoding bits for encoding images with high encoding complexity, under the premise that the average encoding code rate is kept close to the target code rate (average encoding code rate), the fluctuation of the PSNR curve of each frame image in the image group can be reduced, and the quality of the video after encoding can be further improved.

[0176] The beneficial effects of various implementation methods in this embodiment may be specifically referred to the beneficial effects of the corresponding implementation methods in the above method embodiments, and will not be described further here in order to avoid repetition.

[0177] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes image data of still or video images obtained by an image capture device (e.g., a camera) in a video capture mode or an image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. The other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control buttons, switch buttons, etc.), a trackball, a mouse, and an operation lever, which will not be described further herein. The memory 1009 may be used to store software programs and various data, including but not limited to application programs and an operating system. The processor 1010 may integrate an application processor and a modem processor, where the application processor is mainly for processing the operating system, the user interface, and the application programs, etc., and the modem processor is mainly for processing wireless communication. As can be understood, the modem processor may not be integrated into the processor 1010.

[0178] The embodiments of the present application further provide a readable storage medium, on which a program or instruction is stored, which, when executed by a processor, can realize each process of the above-mentioned embodiment of the video encoding method and achieve the same technical effect. In order to avoid repetition, no further description will be given here.

[0179] Here, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0180] Embodiments of the present application further provide a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor runs a program or instructions and is used to implement each process of the embodiments of the above video encoding method, and the same technical effects can be achieved. To avoid repetition of the description, it will not be described further here.

[0181] It should be understood that the chip referred to in the embodiments of the present application may also be referred to as a system-level chip, a system-on-chip, a chip system, or a system-on-a-chip, etc.

[0182] It should be explained that in this specification, the terms "comprise", "include", or any other variants thereof are intended to cover the non-exclusive "comprise", whereby a process, method, article, or apparatus that includes a set of elements includes not only those elements, but also other elements not expressly listed or inherent to such process, method, article, or apparatus. In the absence of further limitations, an element limited by the phrase "comprises a" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes this element. It should be pointed out that the scope of the method and apparatus in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may include performing functions in an essentially simultaneous manner or in reverse order based on the functions involved, for example, the described method can be performed in a different order than described, and various steps can be added, omitted, or combined. Also, features described with reference to some examples can be combined in other examples.

[0183] From the above description of the embodiments, it is clear to those skilled in the art that the methods of the above embodiments can be realized in the form of software and a necessary general-purpose hardware platform. Of course, they can also be realized in hardware, but in many cases the former is a more preferred embodiment. In light of this understanding, the technical proposal of the present application may be substantially or the part that contributes to the prior art may be embodied in the form of a computer software product, which is stored in a storage medium (e.g., ROM / RAM, magnetic disk, optical disk) and includes some instructions for causing a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0184] The above describes the embodiments of the present application in conjunction with the drawings, but the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not limiting. Those skilled in the art can take the suggestions of this application and make many forms without departing from the spirit and scope of the claims of this application, all of which belong to the protection scope of this application.

Claims

1. 1. A video encoding method comprising the steps of: determining a second number of bits to encode the first image based on the first ratio, the first number of bits, and the first number; encoding the first image based on the second number of bits; Determining a second number of bits for encoding the first image based on the first ratio, the first number of bits, and the first number includes: determining a weighting parameter corresponding to the first ratio according to the first ratio; determining the second number of bits for encoding the first image based on the weighting parameter, the first number of bits and the first number; After determining a weighting parameter corresponding to the first ratio according to the first ratio, the method further comprises: constraining the weighting parameter based on a buffer space adjustment parameter, the buffer space adjustment parameter including an upper limit of a buffer space adjustment range and a lower limit of a buffer space adjustment range; wherein the first ratio is the ratio between the predictive coding complexity of the first image and the actual coding complexity of a second image of M frames, the first image being an uncoded first frame image in a target image group, the second image of M frames being an already coded image in the target image group, the first number of bits being the number of remaining bits in the target image group, the first number being the number of uncoded images in the target image group, and M being an integer greater than 1.

2. Determining a second number of bits for encoding the first image based on the first ratio, the first number of bits, and the first number includes: determining the second number of bits to encode the first image based on the first ratio, the first number of bits, the first number and a target parameter; 2. The method of claim 1, wherein the target parameters include an estimated occupancy of a buffer space, an actual occupancy of the buffer space, an encoding frame rate, and an available channel transmission rate before encoding the first image.

3. Determining the second number of bits to encode the first image based on the first ratio, the first number of bits, the first number and a target parameter includes: determining a third number of bits based on the first ratio, the first number of bits, and the first number; determining a fourth number of bits based on the target parameter; and 3. The method of claim 2, further comprising weighting and adding the third number of bits and the fourth number of bits to obtain the second number of bits.

4. said encoding the first image based on the second number of bits includes:

2. The method of claim 1, further comprising: determining a quantization parameter for the first image according to a quadratic rate-distortion model based on the second number of bits and a predictive coding complexity of the first image; and encoding the first image according to the quantization parameter.

5. Before determining a second number of bits for encoding the first image based on the first ratio, the first number of bits, and the first number, the method further comprises: The method of claim 1 , further comprising: determining the first ratio based on a predictive coding complexity of the first image and an average coding complexity of a second image of the M frames.

6. 1. A video encoding device, comprising: a determining module and an encoding module; a determination module for determining a second number of bits for encoding the first image based on the first ratio, the first number of bits, and the first number; the encoding module is adapted to encode the first image based on the second number of bits determined by the determination module; Specifically, the determination module: determining a weighting parameter corresponding to the first ratio according to the first ratio, and using the weighting parameter, the first number of bits and the first number to determine the second number of bits for encoding the first image; Specifically, the determination module: After determining a weighting parameter corresponding to the first ratio according to the first ratio, the weighting parameter is used to constrain the weighting parameter based on a buffer area adjustment parameter, the buffer area adjustment parameter including an upper limit of a buffer area adjustment range and a lower limit of a buffer area adjustment range; wherein the first ratio is the ratio between the predictive encoding complexity of the first image and the actual encoding complexity of a second image of M frames, the first image being an uncoded first frame image in a target image group, the second image of M frames being an already coded image in the target image group, the first number of bits being the number of remaining bits in the target image group, the first number being the number of uncoded images in the target image group, and M being an integer greater than 1.

7. 7. The apparatus of claim 6, wherein the determination module is specifically used to determine the second number of bits for encoding the first image based on the first ratio, the first number of bits, the first number and target parameters, where the target parameters include an estimated occupancy of a buffer space, an actual occupancy of the buffer space, an encoding frame rate, and an available channel transmission rate before encoding the first image.

8. The determination module includes a first determination sub-module and a processing sub-module; the first determination submodule is used for determining a third number of bits based on the first ratio, the first number of bits and the first number, and for determining a fourth number of bits based on the target parameter; The apparatus of claim 7 , wherein the processing submodule is used to weight and add the third number of bits and the fourth number of bits determined by the first determination submodule to obtain the second number of bits.

9. the encoding module includes a second determining sub-module and an encoding sub-module; the second determining submodule is used for determining a quantization parameter of the first image according to a quadratic rate-distortion model based on the second number of bits and a predictive coding complexity of the first image; The apparatus of claim 6 , wherein the encoding sub-module is used for encoding the first image according to the quantization parameter determined by the second determination sub-module.

10. 7. The apparatus of claim 6, wherein the determination module is further used for determining the first ratio based on a predictive coding complexity of the first image and an average coding complexity of a second image of the M frames before determining the second number of bits for encoding the first image based on the first ratio, the first number of bits and the first number.

11. 6. An electronic device comprising a processor, a memory, and a program or instructions stored in the memory and operable to run on the processor, the program or instructions implementing the steps of the video encoding method of any one of claims 1 to 5 when executed by the processor.

12. A readable storage medium having stored thereon a program or instructions, which, when executed by a processor, implements the steps of the video encoding method according to any one of claims 1 to 5.

13. Computer software which, when executed by at least one processor, implements the video encoding method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • A method for VBR code rate control in AVX decoding of real time video signals

    CN101188755A

  • H.264 code rate control method

    CN101895759B

  • Image encoding device and image encoding method

    JP2008005337A

  • Moving image encoding device, moving image encoding method and computer program

    JP2010062999A

  • Image encoder

    JP2013128189A