Video encoding method, video encoder, electronic device and storage medium
Optimizing the target encoding code word count and quantization parameters through the picture state transition information of the video frame solves the problem that the fixed code rate control model in the existing technology cannot match the content characteristics of the video frame, and improves the video compression performance and encoding quality.
Patent Information
- Application Number
- CN202410796170.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-19
AI Technical Summary
In existing video coding technology, the fixed bit rate control model cannot accurately match the content characteristics of video frames, resulting in low video compression performance and poor coding quality.
After predictive coding of the video frame, its picture state transition information is determined. Based on the dynamic and static state transition, the number of target encoding code words is flexibly determined, and the quantization parameters are accurately determined according to the target number of code words, and quantization processing is performed.
It improves video compression performance and encoding quality, effectively matches the content characteristics of video frames, optimizes codeword allocation during the encoding process, and reduces encoding waste and defects.
Smart Images

Figure CN118368423B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a video encoding method and a video encoder, an electronic device and a storage medium. Background Art
[0002] During the video encoding process, the coding residual obtained after predictive coding of the video frame will be quantized. There are usually two ways to select the quantization parameter (Quantitative Parameter, QP). The first is fixed QP, which refers to setting a fixed quantization parameter, that is, using the same quantization parameter for each video frame; the second is dynamic QP, which refers to selecting an appropriate QP for different video frames, and the basis for QP selection is the encoding bit rate assigned to the video frame. For the dynamic QP selection method, the existing technology usually calls a fixed bit rate control model to determine the given encoding bit rate of each video frame, and then calculates the QP of the video frame only based on the given encoding bit rate of each video frame. However, in the actual encoding process, the above two quantization parameter determination methods are not accurate enough, which will result in low video compression performance and poor video encoding quality. Summary of the invention
[0003] The present disclosure proposes a video encoding method and a technical solution of a video encoder, an electronic device and a storage medium.
[0004] According to one aspect of the present disclosure, a video encoding method is provided, comprising: after predictive encoding of the ith video frame, determining picture state transition information of the ith video frame, wherein the picture state transition information is used to indicate the dynamic and static state transition of the video picture, and i is a positive integer greater than or equal to 2; based on the picture state transition information of the ith video frame, determining a target number of encoding codewords for the ith video frame; based on the target number of encoding codewords for the ith video frame, determining a target quantization parameter of the ith video frame, wherein the target quantization parameter of the ith video frame is used to quantize the encoding residual obtained after predictive encoding of the ith video frame.
[0005] In a possible implementation, after predictive encoding the i-th video frame, determining the picture state transition information of the i-th video frame includes: after predictive encoding the i-th video frame, determining the picture state information of the i-th video frame according to a prediction mode adopted in the predictive encoding process, wherein the picture state information includes a motion state and a still state; determining the picture state transition information of the i-th video frame according to the picture state information of the i-th video frame and the picture state information of the i-1-th video frame.
[0006] In a possible implementation, the determining the picture state information of the i-th video frame according to the prediction mode adopted in the prediction coding process includes: counting the intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, wherein the intra-frame prediction blocks are used to indicate the image blocks that are predictively encoded based on the intra-frame prediction mode, and the inter-frame prediction blocks are used to indicate the image blocks that are predictively encoded based on the inter-frame prediction mode; determining the picture state information of the i-th video frame according to the proportion of the intra-frame prediction blocks and the inter-frame prediction blocks in the i-th video frame.
[0007] In a possible implementation, the determining the picture state information of the i-th video frame according to the proportion of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame includes: taking a weighted sum of the proportions of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame to determine the prediction mode proportion of the i-th video frame; when the prediction mode proportion of the i-th video frame is less than or equal to a first threshold, determining that the picture state information of the i-th video frame is a static state; when the prediction mode proportion of the i-th video frame is greater than the first threshold and the proportion of intra-frame prediction blocks in the i-th video frame is greater than a second threshold, determining that the picture state information of the i-th video frame is a motion state.
[0008] In a possible implementation, the determining the picture state transition information of the ith video frame based on the picture state information of the ith video frame and the picture state information of the i-1th video frame includes: determining the picture state transition information of the ith video frame between a motion state and a still state based on the picture state information of the ith video frame and the picture state information of the i-1th video frame.
[0009] In a possible implementation, the determining, based on the picture state information of the i-th video frame and the picture state information of the i-1-th video frame, the picture state transition information of the i-th video frame between the motion state and the static state includes: when the picture state information of the i-th video frame is a static state and the picture state information of the i-1-th video frame is a static state, determining the picture state transition information of the i-th video frame to be a first transition state, wherein the first transition state is used to indicate that the video picture remains static; when the picture state information of the i-th video frame is a static state and the picture state information of the i-1-th video frame is a motion state, determining the picture state transition information of the i-th video frame to be a first transition state, wherein the first transition state is used to indicate that the video picture remains static; The picture state conversion information is a second conversion state, wherein the second conversion state is used to indicate that the video picture is converted from motion to stillness; when the picture state information of the i-th video frame is a motion state, and the picture state information of the i-1-th video frame is a stillness state, the picture state conversion information of the i-th video frame is determined to be a third conversion state, wherein the third conversion state is used to indicate that the video picture is converted from stillness to motion; when the picture state information of the i-th video frame is a motion state, and the picture state information of the i-1-th video frame is a motion state, the picture state conversion information of the i-th video frame is determined to be a fourth conversion state, wherein the fourth conversion state is used to indicate that the video picture keeps moving.
[0010] In a possible implementation, determining a target number of encoding codewords for the ith video frame based on the picture state transition information of the ith video frame includes: determining a preset number of encoding codewords for the ith video frame based on a preset encoding bit rate assigned to the ith video frame; when the picture state transition information of the ith video frame is the first transition state or the second transition state, determining the target number of encoding codewords for the ith video frame to be a first number of encoding codewords, wherein the first number of encoding codewords is less than the preset number of encoding codewords; when the picture state transition information of the ith video frame is the third transition state or the fourth transition state, determining the target number of encoding codewords for the ith video frame to be a second number of encoding codewords, wherein the second number of encoding codewords is greater than or equal to the preset number of encoding codewords.
[0011] In a possible implementation, the method further includes: determining the difference between the preset number of encoding codewords and the first number of encoding codewords; adding the difference to the number of unconsumed encoding codewords, wherein the number of unconsumed encoding codewords is used to indicate the number of encoding codewords that have been allocated and not consumed during the video encoding process.
[0012] In a possible implementation, when the picture state conversion information of the i-th video frame is the third conversion state or the fourth conversion state, determining the target number of encoding codewords of the i-th video frame as the second number of encoding codewords includes: when the picture state conversion information of the i-th video frame is the third conversion state or the fourth conversion state, judging whether the number of unconsumed encoding codewords is 0, wherein the number of unconsumed encoding codewords is used to indicate the number of encoding codewords that have been allocated and not consumed in the video encoding process; when the number of unconsumed encoding codewords is not 0, determining the second number of encoding codewords by adding the preset number of encoding codewords, wherein the second number of encoding codewords is greater than the preset number of encoding codewords and is less than or equal to the sum of the preset number of encoding codewords and the number of unconsumed encoding codewords; when the number of unconsumed encoding codewords is 0, determining the preset number of encoding codewords as the second number of encoding codewords.
[0013] According to one aspect of the present disclosure, a video encoder is provided, comprising: a picture state transition detection module, for determining picture state transition information of the i-th video frame after predictive encoding of the i-th video frame, wherein the picture state transition information is used to indicate the dynamic and static state transition of the video picture, and i is a positive integer greater than or equal to 2; a coding codeword determination module, for determining a target number of coding codewords for the i-th video frame based on the picture state transition information of the i-th video frame; a quantization parameter determination module, for determining a target quantization parameter of the i-th video frame according to the target number of coding codewords of the i-th video frame, wherein the target quantization parameter of the i-th video frame is used to quantize a coding residual obtained after predictive encoding of the i-th video frame.
[0014] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
[0015] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor.
[0016] In the disclosed embodiment, after predictive encoding is performed on the ith video frame, the picture state transition information of the ith video frame is determined. Since the picture state transition information is used to indicate the dynamic and static state transition of the video picture, the dynamic and static state transition of the video picture is effectively considered. Based on the picture state transition information of the ith video frame, the target number of encoding codewords of the video picture that meets the ith video frame is determined. Then, based on the target number of encoding codewords of the ith video frame, the target quantization parameter of the ith video frame is accurately determined, so that the encoding residual obtained after predictive encoding of the ith video frame can be quantized, thereby effectively improving the video compression performance and video encoding quality.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only and do not limit the present disclosure. Other features and aspects of the present disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0019] Figure 1 A flowchart of a video encoding method according to an embodiment of the present disclosure is shown.
[0020] Figure 2 A flow chart of determining picture state transition information of a video frame according to an embodiment of the present disclosure is shown.
[0021] Figure 3 A flowchart of codeword reallocation according to an embodiment of the present disclosure is shown.
[0022] Figure 4 A block diagram of a video encoder according to an embodiment of the present disclosure is shown.
[0023] Figure 5 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0024] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0025] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0026] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0027] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0028] In the current mainstream video coding technology, a fixed bit rate control model is usually called to determine the given encoding bit rate of each video frame, and then the QP of the video frame is calculated only based on the given encoding bit rate of each video frame. However, in the actual encoding process, the given encoding bit rate of each video frame may not match the content characteristics of the video frame, thus resulting in low video compression performance and poor video encoding quality.
[0029] In order to solve the above technical problems, the present disclosure provides a video encoding method, which can effectively consider the dynamic and static state transition of the video picture and accurately determine the quantization parameter, so as to effectively improve the video compression performance and video encoding quality. The video encoding method provided by the embodiment of the present disclosure is described in detail below.
[0030] Figure 1 A flowchart of a video encoding method according to an embodiment of the present disclosure is shown. The method is applied to a video encoder, wherein the method can be executed by a video encoder in an electronic device such as a terminal device or a server. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor in the video encoder calling a computer-readable instruction stored in a memory in the video encoder. Alternatively, the method can be executed by a video encoder in a server. Figure 1 As shown, the method includes:
[0031] In step S11, after predictive coding is performed on the i-th video frame, the picture state conversion information of the i-th video frame is determined, wherein the picture state conversion information is used to indicate the dynamic and static state conversion of the video picture, and i is a positive integer greater than or equal to 2.
[0032] The i-th video frame here can be any video frame except the first video frame in the video stream that is input during the video encoding process and has not yet been encoded. Since the first video frame is the starting video frame, there is no static or dynamic state transition in the video screen. Therefore, for the first video frame, a conventional encoding method in the related art can be used to determine the quantization parameter and perform encoding, and the present disclosure does not make specific limitations on this.
[0033] For the i-th video frame in the video stream, predictive coding is first performed on it to obtain a coding residual after predictive coding. The predictive coding process can refer to the video predictive coding process in the related art, and the present disclosure does not make any specific limitation on this.
[0034] After predictive coding is performed on the i-th video frame, picture state conversion information of the i-th video frame may be determined to determine the dynamic and static state conversion of the video picture of the i-th video frame.
[0035] How to determine the picture state information of the i-th video frame will be described in detail later in conjunction with possible implementations of the present disclosure, and will not be elaborated here.
[0036] In step S12, based on the picture state conversion information of the i-th video frame, the target number of encoding codewords of the i-th video frame is determined.
[0037] Based on the picture state transition information of the i-th video frame, the target number of encoding codewords that meets the motion characteristics of the video content of the i-th video frame can be flexibly determined by considering the dynamic and static state transitions of the video picture of the i-th video frame.
[0038] How to determine the target number of encoding codewords for the i-th video frame based on the picture state transition information of the i-th video frame will be described in detail later in conjunction with possible implementation methods of the present disclosure, and will not be elaborated here.
[0039] In step S13, a target quantization parameter of the ith video frame is determined according to the target number of encoding codewords of the ith video frame, wherein the target quantization parameter of the ith video frame is used to quantize the encoding residual obtained after predictive encoding of the ith video frame.
[0040] According to the target number of encoding codewords of the ith video frame, the target quantization parameter of the ith video frame can be determined, and then the encoding residual obtained after predictive encoding of the ith video frame is quantized based on the target quantization parameter of the ith video frame, thereby effectively realizing video encoding compression of the ith video frame.
[0041] In the disclosed embodiment, after predictive encoding is performed on the ith video frame, the picture state transition information of the ith video frame is determined. Since the picture state transition information is used to indicate the dynamic and static state transition of the video picture, the dynamic and static state transition of the video picture is effectively considered. Based on the picture state transition information of the ith video frame, the target number of encoding codewords of the video picture that meets the ith video frame is determined. Then, based on the target number of encoding codewords of the ith video frame, the target quantization parameter of the ith video frame is accurately determined, so that the encoding residual obtained after predictive encoding of the ith video frame can be quantized, thereby effectively improving the video compression performance and video encoding quality.
[0042] In a possible implementation, after predictive coding is performed on the ith video frame, the picture state transition information of the ith video frame is determined, including: after predictive coding is performed on the ith video frame, the picture state information of the ith video frame is determined according to the prediction mode adopted in the predictive coding process, wherein the picture state information includes a motion state and a still state; and the picture state transition information of the ith video frame is determined according to the picture state information of the ith video frame and the picture state information of the i-1th video frame.
[0043] When predictive coding is performed on the i-th video frame, the i-th video frame is first divided into image blocks, and then a suitable prediction mode is selected to predictively code the image block according to the motion characteristics of each image block. After predictive coding is performed on each image block in the i-th video frame, the picture state information of the i-th video frame can be determined to be a moving state or a stationary state according to the prediction mode used in the predictive coding process. Furthermore, according to the picture state information of the current i-th video frame and the picture state information of the previous i-1-th video frame, the picture state conversion information of the current i-th video frame can be determined. The method for determining the picture state information of the i-1-th video frame is the same as the method for determining the picture state information of the i-th video frame.
[0044] In a possible implementation, the picture state information of the i-th video frame is determined according to the prediction mode adopted in the prediction coding process, including: counting the proportion of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, wherein the intra-frame prediction block is used to indicate the image block that is predictively encoded based on the intra-frame prediction mode, and the inter-frame prediction block is used to indicate the image block that is predictively encoded based on the conventional inter-frame prediction mode; the picture state information of the i-th video frame is determined according to the proportion of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame.
[0045] The proportion of intra-frame prediction blocks can reflect the picture changes within the video frame, and the proportion of inter-frame prediction blocks can reflect the picture changes between video frames. Therefore, based on the proportion of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, the picture state information of the i-th video frame can be effectively determined.
[0046] In one example, the inter-frame prediction block includes: a normal inter-frame prediction block, an inter-frame skip prediction block, and an inter-frame merge prediction block.
[0047] The intra-frame prediction mode (Intra mode) is applicable to areas in the video frame with similar local textures or structures, or some areas that are not suitable for inter-frame prediction (for example, areas with fast-moving objects); the conventional inter-frame prediction mode (Inter mode) is applicable to areas in the video frame with a large number of moving objects; the inter-frame skip prediction mode is applicable to areas in the video frame that are very similar to the reference video frame and have almost no changes; the inter-frame merge prediction mode is applicable to areas in the video frame with similar or identical motion vectors to adjacent image blocks.
[0048] Therefore, after predictive encoding of the i-th video frame, the picture state information indicating whether the i-th video frame is in motion or still state can be effectively determined by counting the proportions of intra-frame prediction blocks, conventional inter-frame prediction blocks, inter-frame skip prediction blocks, and inter-frame merge prediction blocks in the i-th video frame. Figure 2 FIG. 2 shows a flow chart of determining picture state transition information of a video frame according to an embodiment of the present disclosure. Figure 2 As shown, the picture state transition information determination process is called for the i-th video frame. The i-th video frame is pre-encoded, and after pre-encoding, the proportion of intra-frame prediction blocks, conventional inter-frame prediction blocks, inter-frame skip prediction blocks, and inter-frame merge prediction blocks in the i-th video frame are counted.
[0049] In one example, in order to improve statistical efficiency, the i-th video frame can be divided into multiple image blocks, and then the proportion of intra-frame prediction blocks, conventional inter-frame prediction blocks, inter-frame skip prediction blocks, and inter-frame merge prediction blocks are counted in units of image blocks. The size of the image block divided by the statistical prediction mode proportion can be the same as or different from the size of the image block divided for predictive coding, and the present disclosure does not make specific limitations on this.
[0050] In a possible implementation, the picture state information of the ith video frame is determined according to the proportion of intra-frame prediction blocks and inter-frame prediction blocks in the ith video frame, including: taking a weighted sum of the proportions of intra-frame prediction blocks and inter-frame prediction blocks in the ith video frame to determine the prediction mode proportion of the ith video frame; when the prediction mode proportion of the ith video frame is less than or equal to a first threshold, determining that the picture state information of the ith video frame is a static state; when the prediction mode proportion of the ith video frame is greater than the first threshold and the proportion of intra-frame prediction blocks in the ith video frame is greater than a second threshold, determining that the picture state information of the ith video frame is a motion state.
[0051] In one example, the intra prediction block ratio in the i-th video frame is determined by statistics as intra_rate, the inter prediction block ratio (including: the conventional inter prediction block ratio is inter_rate, the inter skip prediction block ratio is skip_rate, and the inter merge prediction block ratio is merge_rate). Then, the prediction mode ratio mode_rate of the i-th video frame can be determined by the following formula (1):
[0052] mode_rate=th1×intra_rate+th2×inter_rate+th3×(skip_rate+merge_rate)(1).
[0053] Among them, th1 is the weight of the intra-frame prediction mode, th2 is the weight of the conventional inter-frame prediction mode, and th3 is the ratio of the inter-frame skip prediction and inter-frame merge prediction modes. The specific values of th1, th2, and th3 can be flexibly set according to actual conditions, and this disclosure does not make specific restrictions on this. Figure 2 As shown, in the process of processing the i-th video frame based on the picture state transition information determination process, the prediction mode ratio of the i-th video frame is determined according to the ratio of intra-frame prediction blocks, the ratio of conventional inter-frame prediction blocks, the ratio of inter-frame skip prediction blocks, and the ratio of inter-frame merge prediction blocks in the i-th video frame.
[0054] First, determine whether the prediction mode ratio mode_rate of the i-th video frame is less than or equal to the first threshold. When it is determined that the prediction mode ratio mode_rate of the i-th video frame is less than or equal to the first threshold, it can be determined that the picture state information of the i-th video frame is a static state; secondly, when it is determined that the prediction mode ratio mode_rate of the i-th video frame is greater than the first threshold, further determine whether the ratio intra_rate of the intra-frame prediction block in the i-th video frame is greater than the second threshold. When it is determined that the ratio intra_rate of the intra-frame prediction block in the i-th video frame is greater than the second threshold, it can be determined that the picture state information of the i-th video frame is a motion state. The specific values of the first threshold and the second threshold can be flexibly set according to actual conditions, and the present disclosure does not make specific limitations on this.
[0055] like Figure 2 As shown, in the process of processing the i-th video frame based on the picture state conversion information determination process, it is determined whether the prediction mode ratio of the i-th video frame is less than or equal to the first threshold; when the prediction mode ratio of the i-th video frame is less than or equal to the first threshold, it is determined that the picture state information of the i-th video frame is a static state; when the prediction mode ratio of the i-th video frame is greater than the first threshold, it is further determined whether the ratio of intra-frame prediction blocks in the i-th video frame is greater than the second threshold; when the ratio of intra-frame prediction blocks in the i-th video frame is greater than the second threshold, it can be determined that the picture state information of the i-th video frame is a motion state.
[0056] In one example, the picture state information may be indicated by a motion flag move_flag and a still flag still_flag. For example, when the picture state information of the i-th video frame is in a motion state, move_flag_i=1 and still_flag_i=0 corresponding to the i-th video frame; when the picture state information of the i-th video frame is in a still state, move_flag_i=0 and still_flag_i=1 corresponding to the i-th video frame.
[0057] In one example, when the proportion of the prediction mode of the i-th video frame is greater than the first threshold, and the proportion of the intra-frame prediction block in the i-th video frame is not greater than the second threshold, the picture state information of the i-th video frame cannot be determined. At this time, the i-th video frame can be encoded using a conventional video encoding method. Furthermore, since the picture state information of the i-th video frame cannot be determined, the i+1-th video frame can be used as a new starting video frame to re-execute the above processing flow.
[0058] After determining the picture state information of the ith video frame, the picture state information of the ith video frame is stored, and the picture state conversion information of the ith video frame is determined according to the previously stored picture state information of the i-1th video frame.
[0059] For example, after determining the picture status information of the first video frame, the picture status information of the first video frame is stored; after determining the picture status information of the second video frame, the picture status information of the second video frame is stored, and the picture status conversion information of the second video frame is determined based on the previously stored picture status information of the first video frame; after determining the picture status information of the third video frame, the picture status information of the third video frame is stored, and the picture status conversion information of the third video frame is determined based on the previously stored picture status information of the second video frame; and so on.
[0060] In one possible implementation, the picture state transition information of the ith video frame is determined based on the picture state information of the ith video frame and the picture state information of the i-1th video frame, including: determining the picture state transition information of the ith video frame between a motion state and a still state based on the picture state information of the ith video frame and the picture state information of the i-1th video frame.
[0061] Since the picture state information includes the motion state and the still state, the picture state conversion information of the i-th video frame between the motion state and the still state can be effectively determined based on the picture state information of the i-th video frame and the picture state information of the i-1-th video frame.
[0062] like Figure 2 As shown, the i-1th video frame can also call the picture state conversion information determination process to determine the picture state information of the i-1th video frame. The specific process is similar to the determination process of the i-th video frame and will not be repeated here.
[0063] In a possible implementation, according to the picture state information of the ith video frame and the picture state information of the i-1th video frame, the picture state transition information of the ith video frame between the motion state and the static state is determined, including: when the picture state information of the ith video frame is the static state and the picture state information of the i-1th video frame is the static state, determining the picture state transition information of the ith video frame as a first transition state, wherein the first transition state is used to indicate that the video picture remains static; when the picture state information of the ith video frame is the static state and the picture state information of the i-1th video frame is the motion state, determining the picture state transition information of the ith video frame as a first transition state, wherein the first transition state is used to indicate that the video picture remains static; when the picture state information of the ith video frame is the static state and the picture state information of the i-1th video frame is the motion state, determining the picture state transition information of the ith video frame as a first transition state, wherein the first transition state is used to indicate that the video picture remains static; The state transition information is a second transition state, wherein the second transition state is used to indicate that the video screen transitions from motion to stillness; when the screen state information of the i-th video frame is a motion state, and the screen state information of the i-1-th video frame is a stillness state, the screen state transition information of the i-th video frame is determined to be a third transition state, wherein the third transition state is used to indicate that the video screen transitions from stillness to motion; when the screen state information of the i-th video frame is a motion state, and the screen state information of the i-1-th video frame is a motion state, the screen state transition information of the i-th video frame is determined to be a fourth transition state, wherein the fourth transition state is used to indicate that the video screen keeps moving.
[0064] like Figure 2 As shown, the picture state information of the i-th video frame may include a motion state and a still state, and the picture state information of the i-1-th video frame may also include a motion state and a still state. Therefore, according to the picture state information of the i-th video frame and the picture state information of the i-1-th video frame, it can be determined that the picture state conversion information of the i-th video frame is one of the following four conversion states:
[0065] The first conversion state (case 1): the video screen remains still;
[0066] The second transition state (case 2): the video image changes from motion to stillness;
[0067] The third transition state (case 3): the video image changes from static to dynamic;
[0068] Fourth transition state (case 4): the video picture keeps moving.
[0069] In a possible implementation, based on the picture state transition information of the ith video frame, a target number of encoding codewords for the ith video frame is determined, including: based on a preset encoding bit rate assigned to the ith video frame, determining the preset number of encoding codewords for the ith video frame; when the picture state transition information of the ith video frame is a first transition state or a second transition state, determining the target number of encoding codewords for the ith video frame to be a first number of encoding codewords, wherein the first number of encoding codewords is less than the preset number of encoding codewords; when the picture state transition information of the ith video frame is a third transition state or a fourth transition state, determining the target number of encoding codewords for the ith video frame to be a second number of encoding codewords, wherein the second number of encoding codewords is greater than or equal to the preset number of encoding codewords.
[0070] After the picture state conversion information of the i-th video frame is determined, different processing operations are performed on the i-th video frame according to different conversion states.
[0071] In the video encoding process, bitrate control is an important step, which can minimize the file size while maintaining video quality. In the video encoding process, a corresponding preset encoding bitrate is assigned to each video frame according to the characteristics of the video content and encoding requirements of the video frame.
[0072] In the prior art, for any video frame, based on the preset encoding bit rate assigned to the video frame, the preset number of encoding codewords of the video frame can be determined, and the preset number of encoding codewords is the upper limit of the number of encoding codewords assigned to the video frame. However, this may not match the actual encoding scene, resulting in poor video encoding quality. For example, a video frame of a static scene may require a smaller number of encoding codewords, while a video frame of a dynamic scene may require a larger number of encoding codewords, resulting in a waste or loss of encoding codewords.
[0073] In the disclosed embodiment, when the picture state transition information of the ith video frame is case 1 or case 2, that is, when the video picture of the ith video frame remains still or the video picture of the ith video frame is converted from motion to stillness, a first number of encoding codewords less than a preset number of encoding codewords can be flexibly allocated to the ith video frame to reduce the probability of wasting encoding codewords; when the picture state transition information of the ith video frame is case 3 or case 4, that is, when the video picture of the ith video frame is converted from stillness to motion or the video picture of the ith video frame remains in motion, a second number of encoding codewords greater than or equal to the preset number of encoding codewords can be flexibly allocated to the ith video frame to fully encode the ith video frame and improve the video encoding quality.
[0074] In a possible implementation, the method also includes: determining the difference between the first number of encoding codewords and the preset number of encoding codewords; adding the difference to the number of unconsumed encoding codewords, wherein the number of unconsumed encoding codewords is used to indicate the number of encoding codewords that have been allocated and not consumed during the video encoding process.
[0075] When the picture state conversion information of the i-th video frame is case 1 or case 2, that is, the video picture of the i-th video frame remains still or the video picture of the i-th video frame is converted from motion to stillness, since the number of first encoding codewords actually consumed by the i-th video frame is less than the allocated preset number of encoding codewords, the encoding codewords allocated to the i-th video frame but not consumed can be accumulated as encoding codewords that have been allocated but not consumed in the video encoding process, and the corresponding number of unconsumed encoding codewords can be accumulated to determine.
[0076] For example, before the i-th video frame, the number of unconsumed coding codewords is 0, that is, there are no allocated but unconsumed coding codewords; the picture state transition information of the i-th video frame is case1 or case2, and the preset number of coding codewords allocated to the i-th video frame is a bits, but the first number of coding codewords actually encoded and consumed by the i-th video frame is b bits, where b is less than a. Therefore, the difference (ab) bits between the preset number of coding codewords a bits and the first number of coding codewords b bits can be determined, and the difference is added to the number of unconsumed coding codewords to obtain the current number of unconsumed coding codewords as (ab) bits.
[0077] The picture state transition information of the i+1th video frame is still case1 or case2, and the preset number of encoding codewords allocated to the i+1th video frame is a bits, but the number of first encoding codewords actually consumed by the i+1th video frame is c bits, where c is less than a. Therefore, the difference (ac) bits between the preset number of encoding codewords a bits and the first number of encoding codewords c bits can be determined, and the difference is added to the number of unconsumed encoding codewords, resulting in the current number of unconsumed encoding codewords being (2a-bc) bits.
[0078] The allocated but unconsumed coding codewords accumulated from the video frames in the case 1 or case 2 state can be flexibly allocated to the video frames in the case 3 or case 4 state.
[0079] In a possible implementation, when the picture state transition information of the i-th video frame is the third transition state or the fourth transition state, determining the target number of encoding codewords for the i-th video frame as the second number of encoding codewords includes: when the picture state transition information of the i-th video frame is the third transition state or the fourth transition state, judging whether the number of unconsumed encoding codewords is 0, wherein the number of unconsumed encoding codewords is used to indicate the number of encoding codewords that have been allocated and not consumed in the video encoding process; when the number of unconsumed encoding codewords is not 0, determining the second number of encoding codewords by adding a preset number of encoding codewords, wherein the second number of encoding codewords is greater than the preset number of encoding codewords and is less than or equal to the sum of the preset number of encoding codewords and the number of unconsumed encoding codewords; when the number of unconsumed encoding codewords is 0, determining the preset number of encoding codewords as the second number of encoding codewords.
[0080] When the picture state conversion information of the i-th video frame is case 3 or case 4, that is, the video picture of the i-th video frame is converted from static to motion or the video picture of the i-th video frame remains in motion, first, determine whether the number of currently unconsumed encoding codewords is 0.
[0081] If the number of unconsumed coding codewords is not 0, it means that a certain number of allocated but unconsumed coding codewords have been accumulated before the i-th video frame. At this time, the number of coding codewords that can be used by the i-th video frame can be increased by allocating the allocated but unconsumed coding codewords accumulated before the i-th video frame to the i-th video frame on the basis of the preset number of coding codewords already allocated to the i-th video frame, wherein the second number of coding codewords that can actually be used by the i-th video frame is greater than the preset number of coding codewords, and is less than or equal to the sum of the preset number of coding codewords and the number of unconsumed coding codewords. When the second number of coding codewords that can actually be used by the i-th video frame is equal to the sum of the preset number of coding codewords and the number of unconsumed coding codewords, that is, all the allocated but unconsumed coding codewords accumulated before the i-th video frame are allocated to the i-th video frame, and at this time, the number of unconsumed coding codewords becomes 0.
[0082] If the number of unconsumed encoding codewords is 0, it means that there is no accumulated allocated but unconsumed encoding codewords in the i-th video frame. At this time, the i-th video frame can only use the allocated preset number of encoding codewords.
[0083] Figure 3 FIG. 4 is a flowchart showing codeword reallocation according to an embodiment of the present disclosure. Figure 3 As shown, for any video frame, it is first determined whether the picture state conversion information of the video frame is case 3 or case 4.
[0084] If not, it means that the picture state transition information of the video frame is case 1 or case 2. At this time, since the number of encoding codewords actually consumed by the video frame is less than the number of allocated encoding codewords, the encoding codewords allocated to the video frame but not consumed can be accumulated as encoding codewords that have been allocated but not consumed in the video encoding process, that is, codeword accumulation.
[0085] If so, it is further determined whether the current number of unconsumed encoding codewords is greater than 0. If it is greater than 0, the unconsumed encoding codewords are allocated to the video frame, that is, encoding codewords are added to the video frame so that the number of encoding codewords actually consumed by the video frame is greater than the number of allocated encoding codewords, and the number of unconsumed encoding codewords is reduced accordingly; if it is equal to 0, it means that there are currently no extra encoding codewords that can be allocated to the video frame, and the video frame still uses the allocated encoding codewords, that is, the encoding codewords for the video frame remain unchanged.
[0086] In the embodiment of the present disclosure, for the target number of coding codewords actually consumed by each video frame, a target quantization parameter that is more in line with the video picture dynamic and static state transition of each video frame can be flexibly determined, and then the coding residual obtained after predictive coding is quantized based on the target quantization parameter of each video frame, thereby effectively realizing video coding compression. Among them, the method for determining the coding residual and the method for determining the target quantization parameter based on the target coding codeword can refer to the relevant technology, and the present disclosure does not make specific limitations on this.
[0087] In the disclosed embodiment, after predictive encoding is performed on the ith video frame, the picture state transition information of the ith video frame is determined. Since the picture state transition information is used to indicate the dynamic and static state transition of the video picture, the dynamic and static state transition of the video picture is effectively considered. Based on the picture state transition information of the ith video frame, the target number of encoding codewords of the video picture that meets the ith video frame is determined. Then, based on the target number of encoding codewords of the ith video frame, the target quantization parameter of the ith video frame is accurately determined, so that the encoding residual obtained after predictive encoding of the ith video frame can be quantized, thereby effectively improving the video compression performance and video encoding quality.
[0088] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0089] In addition, the present disclosure also provides a video encoder, an electronic device, a computer-readable storage medium, and a program, all of which can be used to implement any video encoding method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to in the corresponding records of the method part and will not be repeated here.
[0090] Figure 4 A block diagram of a video encoder according to an embodiment of the present disclosure is shown. Figure 4 As shown, the video encoder 40 includes:
[0091] A picture state transition detection module 41 is used to determine picture state transition information of the i-th video frame after predictive coding the i-th video frame, wherein the picture state transition information is used to indicate a dynamic or static state transition of the video picture, and i is a positive integer greater than or equal to 2;
[0092] The coding codeword determination module 42 is used to determine the target number of coding codewords of the i-th video frame based on the picture state conversion information of the i-th video frame;
[0093] The quantization parameter determination module 43 is used to determine the target quantization parameter of the ith video frame according to the target number of encoding codewords of the ith video frame, wherein the target quantization parameter of the ith video frame is used to quantize the encoding residual obtained after predictive encoding of the ith video frame.
[0094] In a possible implementation, the screen state transition detection module 41 is specifically configured to:
[0095] After predictive coding is performed on the i-th video frame, the picture state information of the i-th video frame is determined according to the prediction mode used in the predictive coding process, wherein the picture state information includes a motion state and a static state;
[0096] The picture state conversion information of the i-th video frame is determined according to the picture state information of the i-th video frame and the picture state information of the (i-1)-th video frame.
[0097] In a possible implementation, the screen state transition detection module 41 is specifically configured to:
[0098] Counting the intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, wherein the intra-frame prediction block is used to indicate the image block that is predictively encoded based on the intra-frame prediction mode, and the inter-frame prediction block is used to indicate the image block that is predictively encoded based on the inter-frame prediction mode;
[0099] The picture state information of the i-th video frame is determined according to the proportion of the intra-frame prediction block and the inter-frame prediction block in the i-th video frame.
[0100] In a possible implementation, the screen state transition detection module 41 is specifically configured to:
[0101] Taking a weighted sum of the proportions of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, determining the prediction mode proportion of the i-th video frame;
[0102] When the prediction mode ratio of the i-th video frame is less than or equal to the first threshold, determining that the picture state information of the i-th video frame is a static state;
[0103] When the prediction mode ratio of the i-th video frame is greater than a first threshold and the intra prediction block ratio in the i-th video frame is greater than a second threshold, it is determined that the picture state information of the i-th video frame is a motion state.
[0104] In a possible implementation, the screen state transition detection module 41 is specifically configured to:
[0105] According to the picture state information of the i-th video frame and the picture state information of the (i-1)-th video frame, picture state conversion information of the i-th video frame between the motion state and the static state is determined.
[0106] In a possible implementation, the screen state transition detection module 41 is specifically configured to:
[0107] When the picture state information of the i-th video frame is a static state, and the picture state information of the i-1-th video frame is a static state, determining that the picture state conversion information of the i-th video frame is a first conversion state, wherein the first conversion state is used to indicate that the video picture remains static;
[0108] When the picture state information of the i-th video frame is a static state and the picture state information of the i-1-th video frame is a motion state, determining that the picture state conversion information of the i-th video frame is a second conversion state, wherein the second conversion state is used to indicate that the video picture is converted from motion to static;
[0109] When the picture state information of the i-th video frame is a motion state and the picture state information of the i-1-th video frame is a static state, determining that the picture state conversion information of the i-th video frame is a third conversion state, wherein the third conversion state is used to indicate that the video picture is converted from static to motion;
[0110] When the picture state information of the i-th video frame is a motion state and the picture state information of the i-1-th video frame is a motion state, the picture state conversion information of the i-th video frame is determined to be a fourth conversion state, wherein the fourth conversion state is used to indicate that the video picture keeps moving.
[0111] In a possible implementation, the encoding codeword determination module 42 is specifically configured to:
[0112] Determining a preset number of encoding codewords for the i-th video frame based on a preset encoding bit rate assigned to the i-th video frame;
[0113] When the picture state conversion information of the i-th video frame is the first conversion state or the second conversion state, determining the target number of encoding codewords of the i-th video frame to be the first number of encoding codewords, wherein the first number of encoding codewords is less than the preset number of encoding codewords;
[0114] When the picture state conversion information of the i-th video frame is the third conversion state or the fourth conversion state, the target encoding codeword number of the i-th video frame is determined to be the second encoding codeword number, wherein the second encoding codeword number is greater than or equal to the preset encoding codeword number.
[0115] In a possible implementation, the video encoder 40 further includes: a codeword accumulation module, configured to:
[0116] Determine the difference between the number of preset encoding code words and the number of first encoding code words;
[0117] The quantity difference is accumulated into the number of unconsumed encoding codewords, wherein the number of unconsumed encoding codewords is used to indicate the number of encoding codewords that have been allocated and not consumed during the video encoding process.
[0118] In a possible implementation, the encoding codeword determination module 42 is specifically configured to:
[0119] When the picture state transition information of the i-th video frame is the third transition state or the fourth transition state, determining whether the number of unconsumed coding codewords is 0, wherein the number of unconsumed coding codewords is used to indicate the number of coding codewords that have been allocated and not consumed in the video encoding process;
[0120] When the number of unconsumed encoding codewords is not 0, a second number of encoding codewords is determined by increasing the preset number of encoding codewords, wherein the second number of encoding codewords is greater than the preset number of encoding codewords and less than or equal to the sum of the preset number of encoding codewords and the number of unconsumed encoding codewords;
[0121] When the number of unconsumed encoding codewords is 0, the preset number of encoding codewords is determined as the second number of encoding codewords.
[0122] This method has a specific technical connection with the internal structure of the computer system, and can solve the technical problem of how to improve the hardware computing efficiency or execution effect (including reducing the amount of data storage, reducing the amount of data transmission, increasing the hardware processing speed, etc.), thereby obtaining the technical effect of improving the internal performance of the computer system in accordance with the laws of nature.
[0123] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0124] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0125] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
[0126] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0127] The electronic device may be provided as a terminal, a server, or a device in other forms.
[0128] Figure 5 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Figure 5 , the electronic device 1900 can be provided as a server or a terminal device. Figure 5 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0129] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as a Microsoft Server operating system (Windows Server 2003). TM ), Apple's graphical user interface operating system (Mac OS X TM ), a multi-user, multi-process computer operating system (Unix TM), a free and open source Unix-like operating system (Linux TM ), an open source Unix-like operating system (FreeBSD TM ) or similar.
[0130] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0131] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0132] Computer-readable storage media can be a tangible device that can hold and store instructions used by an instruction execution device. Computer-readable storage media can be, for example, (but not limited to) an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive lists) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer-readable storage media used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.
[0133] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0134] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of the computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.
[0135] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0136] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0137] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0138] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0139] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0140] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0141] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0142] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0143] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A video encoding method, It is characterized in that include: After predictive coding the i-th video frame, determine the picture state conversion information of the i-th video frame, wherein the picture state conversion information is used to indicate the dynamic and static state conversion of the video picture, and i is a positive integer greater than or equal to 2; Determining a target number of encoding codewords for the i-th video frame based on the picture state conversion information of the i-th video frame; Determining a target quantization parameter of the i-th video frame according to a target number of encoding codewords of the i-th video frame, wherein the target quantization parameter of the i-th video frame is used to quantize an encoding residual obtained after predictive encoding of the i-th video frame; After predictive coding the i-th video frame, determining the picture state conversion information of the i-th video frame includes: After predictive coding is performed on the i-th video frame, the picture state information of the i-th video frame is determined according to the prediction mode used in the predictive coding process, wherein the picture state information includes a motion state and a static state; The picture state conversion information of the i-th video frame is determined according to the picture state information of the i-th video frame and the picture state information of the (i-1)-th video frame.
2. The method according to claim 1, It is characterized in that The step of determining the picture state information of the i-th video frame according to the prediction mode adopted in the prediction coding process includes: Counting the intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, wherein the intra-frame prediction block is used to indicate the image block that is predictively encoded based on the intra-frame prediction mode, and the inter-frame prediction block is used to indicate the image block that is predictively encoded based on the inter-frame prediction mode; The picture state information of the i-th video frame is determined according to the proportion of the intra-frame prediction blocks and the inter-frame prediction blocks in the i-th video frame.
3. The method according to claim 2, It is characterized in that The determining the picture state information of the i-th video frame according to the proportion of the intra-frame prediction block and the inter-frame prediction block in the i-th video frame includes: Taking a weighted sum of the proportions of intra-frame prediction blocks and inter-frame prediction blocks in the i-th video frame, to determine the prediction mode proportion of the i-th video frame; When the prediction mode ratio of the i-th video frame is less than or equal to a first threshold, determining that the picture state information of the i-th video frame is a static state; When the prediction mode ratio of the i-th video frame is greater than the first threshold and the intra-frame prediction block ratio in the i-th video frame is greater than the second threshold, it is determined that the picture state information of the i-th video frame is a motion state.
4. The method according to claim 1, It is characterized in that The determining the picture state conversion information of the i-th video frame according to the picture state information of the i-th video frame and the picture state information of the i-1-th video frame includes: According to the picture state information of the i-th video frame and the picture state information of the (i-1)-th video frame, picture state conversion information of the i-th video frame between a motion state and a static state is determined.
5. The method according to claim 4, It is characterized in that The determining, according to the picture state information of the i-th video frame and the picture state information of the i-1-th video frame, picture state conversion information of the i-th video frame between a motion state and a static state comprises: When the picture state information of the i-th video frame is a static state, and the picture state information of the i-1-th video frame is a static state, determining that the picture state conversion information of the i-th video frame is a first conversion state, wherein the first conversion state is used to indicate that the video picture remains static; When the picture state information of the i-th video frame is a static state and the picture state information of the i-1-th video frame is a motion state, determining that the picture state conversion information of the i-th video frame is a second conversion state, wherein the second conversion state is used to indicate that the video picture is converted from motion to static; When the picture state information of the i-th video frame is a motion state and the picture state information of the i-1-th video frame is a static state, determining that the picture state conversion information of the i-th video frame is a third conversion state, wherein the third conversion state is used to indicate that the video picture is converted from static to motion; When the picture state information of the i-th video frame is a motion state, and the picture state information of the i-1-th video frame is a motion state, the picture state conversion information of the i-th video frame is determined to be a fourth conversion state, wherein the fourth conversion state is used to indicate that the video picture keeps moving.
6. The method according to claim 5, It is characterized in that The step of determining a target number of encoding codewords for the i-th video frame based on the picture state conversion information of the i-th video frame comprises: Determining a preset number of encoding codewords for the i-th video frame based on a preset encoding bit rate assigned to the i-th video frame; When the picture state conversion information of the i-th video frame is the first conversion state or the second conversion state, determining the target number of encoding codewords of the i-th video frame to be a first number of encoding codewords, wherein the first number of encoding codewords is less than the preset number of encoding codewords; When the picture state conversion information of the i-th video frame is the third conversion state or the fourth conversion state, the target encoding codeword number of the i-th video frame is determined to be the second encoding codeword number, wherein the second encoding codeword number is greater than or equal to the preset encoding codeword number.
7. The method according to claim 6, It is characterized in that The method further comprises: Determine the difference between the preset number of encoding codewords and the first number of encoding codewords; The quantity difference is accumulated into the number of unconsumed encoding codewords, wherein the number of unconsumed encoding codewords is used to indicate the number of encoding codewords that have been allocated and not consumed during the video encoding process.
8. The method according to claim 6, It is characterized in that The step of determining, when the picture state conversion information of the i-th video frame is the third conversion state or the fourth conversion state, the target number of encoding codewords of the i-th video frame is the second number of encoding codewords, comprises: When the picture state conversion information of the i-th video frame is the third conversion state or the fourth conversion state, determining whether the number of unconsumed coding codewords is 0, wherein the number of unconsumed coding codewords is used to indicate the number of coding codewords that have been allocated and not consumed in the video encoding process; When the number of unconsumed encoding codewords is not 0, the second number of encoding codewords is determined by adding the preset number of encoding codewords, wherein the second number of encoding codewords is greater than the preset number of encoding codewords and less than or equal to the sum of the preset number of encoding codewords and the number of unconsumed encoding codewords; When the number of unconsumed encoding codewords is 0, the preset number of encoding codewords is determined as the second number of encoding codewords.
9. A video encoder, It is characterized in that include: A picture state transition detection module, used for determining picture state transition information of the i-th video frame after predictive coding the i-th video frame, wherein the picture state transition information is used to indicate a dynamic or static state transition of the video picture, and i is a positive integer greater than or equal to 2; A coding codeword determination module, configured to determine a target number of coding codewords for the i-th video frame based on the picture state conversion information of the i-th video frame; a quantization parameter determination module, configured to determine a target quantization parameter of the i-th video frame according to a target number of encoding codewords of the i-th video frame, wherein the target quantization parameter of the i-th video frame is used to quantize an encoding residual obtained after predictive encoding of the i-th video frame; The screen state conversion detection module is specifically used for: After predictive coding is performed on the i-th video frame, the picture state information of the i-th video frame is determined according to the prediction mode used in the predictive coding process, wherein the picture state information includes a motion state and a static state; The picture state conversion information of the i-th video frame is determined according to the picture state information of the i-th video frame and the picture state information of the (i-1)-th video frame.
10. An electronic device, It is characterized in that include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 8.
11. A computer readable storage medium having computer program instructions stored thereon, It is characterized in that When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
