Image group size determination method, electronic device, and storage medium

By adaptively selecting the image group size by calculating the motion complexity of the image set, the problem of poor coding rate distortion performance caused by the fixed image group size in the existing technology is solved, and a better coding effect is achieved.

CN116233447BActive Publication Date: 2025-10-24ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310223126.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-02
Publication Date
2025-10-24
Estimated Expiration
2043-03-02

AI Technical Summary

Technical Problem

In existing video coding technologies, the fixed image group size leads to poor rate-distortion performance of the coding results.

Method used

The image group size is adaptively determined by calculating the motion complexity of the image set corresponding to the candidate size and selecting the image group size that matches the motion complexity of the image frame content from multiple candidate sizes based on preset operations.

Benefits of technology

It improves the rate-distortion performance of the encoding results and achieves better encoding effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116233447B_ABST
    Figure CN116233447B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a picture group size determination method and device, electronic equipment and storage medium. The picture group size determination method comprises: determining a plurality of candidate sizes; calculating the motion complexity of the image set corresponding to the candidate size; the image set comprises continuous to-be-encoded image frames, the number of to-be-encoded image frames in the image set is equal to the corresponding candidate size, and the total number of image frames in the image set is greater than 1; the motion complexity represents the complexity of the image content motion between the image frames in the corresponding image set; performing a preset operation based on the motion complexity of each image set, and selecting a target size from the plurality of candidate sizes as the size of the picture group according to the operation result; wherein the picture group is composed of continuous to-be-encoded image frames in the image set corresponding to the target size. Based on the picture group size determined by the embodiments of the present application, the rate-distortion performance of the encoding result can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a method for determining size of group of pictures, an electronic device and a computer storage medium. BACKGROUND

[0002] In the field of video coding, a set of continuous image frames in a video stream to be coded is usually referred to as group of pictures (GOP), and the size of the group of pictures is the number of image frames included in the group of pictures. Commonly used group of pictures types include GOP32, GOP16, GOP8, GOP4, GOP2, GOP1, etc. Taking GOP32 as an example, it indicates that the size of the group of pictures is 32, i.e. the group of pictures includes 32 continuous image frames.

[0003] The coding process is usually performed in units of a single group of pictures, so the size of the group of pictures needs to be determined before video coding. After the size of the group of pictures is determined, the hierarchical structure and reference relationship between the image frames in the group of pictures are also determined accordingly. Thereafter, the video coding can be performed on the image frames in the group of pictures based on the determined hierarchical structure and reference relationship.

[0004] In related coding schemes, a fixed size of group of pictures is maintained for each video frame in a video stream for the sake of simplicity of operation, which results in poor rate-distortion performance of subsequent coding results. SUMMARY

[0005] In view of this, embodiments of the present application provide a scheme for determining size of group of pictures to at least partially solve the above problems.

[0006] According to a first aspect of embodiments of the present application, a method for determining size of group of pictures is provided, comprising:

[0007] determining a plurality of candidate sizes;

[0008] calculating motion complexity of image sets corresponding to the candidate sizes; each image set includes a number of continuous image frames to be coded corresponding to a candidate size; the motion complexity represents the complexity of motion of image contents between the image frames in the corresponding image set;

[0009] performing a preset operation based on the motion complexity of each image set, and selecting a candidate size from the plurality of candidate sizes as the size of the group of pictures according to the operation result.

[0010] According to a second aspect of embodiments of the present application, a coding method is provided, comprising:

[0011] receiving continuous image frames to be coded;

[0012] determining the size of the group of pictures adopted in the coding process;

[0013] encoding the continuous to-be-encoded image frames in the group of pictures based on a preset encoding mode corresponding to the group of pictures size, to obtain a video bitstream.

[0014] The group of pictures size is determined by using the method in the first aspect.

[0015] According to a third aspect of the embodiments of the present application, an encoding method is provided, comprising:

[0016] obtaining video data;

[0017] determining a group of pictures size used in an encoding process, and encoding the video data based on a preset encoding mode corresponding to the group of pictures size, to obtain a video bitstream;

[0018] sending the video bitstream to a client device, so that the client device decodes the video bitstream and displays a video picture;

[0019] The group of pictures size is determined by using the method in the first aspect.

[0020] According to a fourth aspect of the embodiments of the present application, an electronic device is provided, comprising a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform operations corresponding to the method in any one of the first aspect to the third aspect.

[0021] According to a fifth aspect of the embodiments of the present application, a computer storage medium is provided, and the computer storage medium stores a computer program, and the program is executed by a processor to implement the method in any one of the first aspect to the third aspect.

[0022] According to the group of pictures size determination scheme provided in the embodiments of the present application, based on the motion complexity of image contents in groups of pictures with different sizes, a group of pictures size that matches the motion complexity of image contents of to-be-encoded image frames can be adaptively determined from multiple candidate sizes. In this way, when a subsequent encoding process is performed based on the determined matching group of pictures size, the rate-distortion performance of the encoding result can be effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments described in the embodiments of the present application, and other drawings can also be obtained by those skilled in the art based on these drawings.

[0024] Figure 1 This is a flowchart of a method for determining the size of an image group according to the first embodiment of the present application;

[0025] Figure 2 It is a diagram of the temporal hierarchical distribution and inter-frame reference relationship between image frames within GOP32;

[0026] Figure 3 for Figure 1 A schematic diagram of an example scenario in the illustrated embodiment;

[0027] Figure 4 This is a flowchart of a method for determining the size of an image group according to the second embodiment of the present application;

[0028] Figure 5 This is a simplified diagram of the encoding cost distribution within GOP32;

[0029] Figure 6 Schematic diagram of the simplified encoding cost distribution of two GOP16s;

[0030] Figure 7 for Figure 4 A schematic diagram of an example scenario in the illustrated embodiment;

[0031] Figure 8 This is a flowchart of a coding method according to the third embodiment of the present application;

[0032] Figure 9 This is a flowchart of a coding method according to the fourth embodiment of the present application;

[0033] Figure 10 for Figure 9 A schematic diagram of an example scenario in the illustrated embodiment;

[0034] Figure 11 This is a structural block diagram of a device for determining image group size according to a fifth embodiment of the present application;

[0035] Figure 12 This is a structural diagram of an electronic device according to embodiment 6 of the present application. DETAILED DESCRIPTION

[0036] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present application.

[0037] The embodiments of the present application are further illustrated below with reference to the accompanying drawings of the embodiments of the present application.

[0038] Embodiment One

[0039] With reference to Figure 1 , Figure 1 A flow chart of steps of a group of pictures size determination method according to Embodiment One of the present application.

[0040] Specifically, the group of pictures size determination method provided by the present embodiment comprises the following steps:

[0041] Step 102, determining a plurality of candidate sizes.

[0042] The candidate sizes in the present embodiment are candidate group of pictures sizes that can be used as group of pictures sizes. For example, common candidate sizes can be 32 (corresponding to a group of pictures type of GOP32), 16 (corresponding to a group of pictures type of GOP16), 8 (corresponding to a group of pictures type of GOP8), 4 (corresponding to a group of pictures type of GOP4), 2 (corresponding to a group of pictures type of GOP2), and 1 (corresponding to a group of pictures type of GOP1), etc. In this step, a plurality of candidate sizes can be determined in advance according to actual conditions, and the determination method of the candidate sizes, the number of the candidate sizes, and the specific size of the candidate sizes are not limited in the present embodiment.

[0043] Step 104, calculating a motion complexity of a picture set corresponding to the candidate size; the picture set comprises a plurality of consecutive to-be-encoded picture frames, the number of the to-be-encoded picture frames in the picture set is equal to the candidate size, and the total number of picture frames in the picture set is greater than 1; the motion complexity represents a complexity of image content motion between picture frames in the picture set.

[0044] For any candidate size in the plurality of candidate sizes determined in step 102, the picture set corresponding to the candidate size can comprise a plurality of consecutive to-be-encoded picture frames equal in number to the candidate size, and the motion complexity of the picture set corresponding to the candidate size represents a complexity of image content motion between picture frames in the picture set.

[0045] The encoding process is usually performed on each to-be-encoded picture frame in a video stream comprising a plurality of consecutive picture frames, and therefore, in the encoding process, there can be consecutive encoded picture frames and consecutive to-be-encoded picture frames in the video stream. For example, for a video stream comprising 100 picture frames, at a certain encoding time, the first 50 consecutive picture frames can be encoded picture frames, and the next 50 consecutive picture frames can be to-be-encoded picture frames.

[0046] In the embodiments of the present application, the image set corresponding to the candidate size can be composed of the candidate size number of continuous to-be-encoded image frames. For example, for the candidate size 32, the corresponding image set can be composed of 32 continuous to-be-encoded image frames starting from the initial to-be-encoded image frame, and the motion complexity of the set represents the complexity of the image content motion between the 32 continuous to-be-encoded image frames.

[0047] In addition, the image set corresponding to the candidate size can also be composed of the candidate size number of continuous to-be-encoded image frames and other image frames in the video stream.

[0048] For example, the set can start from the last encoded image frame in the video stream and contain the candidate size number of continuous to-be-encoded image frames, wherein the last encoded image frame is the image frame with the latest encoding time among the encoded image frames in the video stream. Taking the candidate size 32 as an example, the corresponding image set can be composed of the last encoded image frame and the 32 continuous to-be-encoded image frames. For example, for a video stream containing 100 image frames, at a certain encoding time, the first 50 continuous image frames are encoded image frames, and the next 50 continuous image frames are to-be-encoded image frames. The image set corresponding to the candidate size 32 can be composed of the 50th image frame (the last encoded image frame) as the starting frame and the 32 to-be-encoded image frames, i.e., the image frame set starting from the 50th frame and ending at the 82nd frame.

[0049] Further, in the embodiments of the present application, the specific representation form of the motion complexity of the image set is not limited. For example, the motion complexity of the image set can be obtained based on the encoding cost when the image set is encoded as a group of pictures, or based on the number of stationary blocks between the image frames in the image set, or based on the pixel difference value between the image frames in the image set, etc.

[0050] In step 106, a preset operation is performed based on the motion complexity of each image set, and a target size is selected from the multiple candidate sizes as the size of the group of pictures according to the operation result.

[0051] The image group is composed of continuous to-be-encoded image frames in the image set corresponding to the target size. As described above, the image set can be composed of continuous to-be-encoded image frames of the candidate size number; or can be composed of continuous to-be-encoded image frames of the candidate size number and other image frames in the video stream. When the image set is composed of continuous to-be-encoded image frames of the candidate size number, the image group is the image set corresponding to the target size; when the image set is composed of continuous to-be-encoded image frames of the target size number and other image frames in the video stream, the image group is composed of continuous to-be-encoded image frames of the target size number, and the image set corresponding to the target size is not identical to the image group.

[0052] After obtaining the motion complexity of the image set corresponding to the candidate size in step 104, the motion complexity of each image set can be operated in a certain operation, and then the operation result is taken as a reference factor to select a candidate size from the plurality of candidate sizes as the image group size.

[0053] In the embodiments of the present application, the specific content of the preset operation is not limited, and can be set according to the actual situation. For example, the size relationship of each motion complexity obtained by comparison can be calculated, so that the candidate size corresponding to the minimum motion complexity is determined as the image group size, or the candidate size corresponding to the motion complexity located at the Nth position is determined as the image group size according to the order from small to large, wherein N is a natural number less than or equal to the total number of candidate sizes; for another example, for each motion complexity, a scaling weight can be determined based on the corresponding candidate size, and each motion complexity and the weight product are calculated as the scaled motion complexity, then the size relationship of each scaled motion complexity is compared, and then according to the size relationship, one is selected from the candidate sizes as the image group size; for another example, each motion complexity can be taken as an independent variable, a preset function expression is used for operation, and an operation result is used to select one from the candidate sizes as the image group size, and the like.

[0054] The size of the image group is determined before video encoding, and when the size of the image group is determined, the hierarchical structure and reference relationship between the image frames in the image group are also determined. Referring to Figure 2 , Figure 2 The time domain hierarchical distribution and interframe reference relationship diagram of the image frames in the GOP 32 is shown from Figure 2 It can be seen that the time domain layer where each image frame is located, and the reference relationship between the image frames, for example, the image group is divided into 6 time domain layers, which are T0, T1, T2, T3, T4 and T5, wherein the image frames with sequence numbers 0 and 32 are located in the T0 layer, the image frame with sequence number 16 is located in the T1 layer, and so on, and the image frame with sequence number 16 forwardly references the image frame with sequence number 0 and backwardly references the image frame with sequence number 32, and the like.

[0055] Through step 106, the image group size matching the motion complexity degree of the image content of the current to-be-encoded image frame can be determined, and then the current continuous to-be-encoded image frame can be encoded according to the encoding mode corresponding to the determined image group size, to obtain a bit stream, wherein the total number of image frames of the current continuous to-be-encoded image frame is equal to the image group size.

[0056] Specifically, the encoding process of the video stream is usually encoded frame by frame. After obtaining the starting to-be-encoded image frame, the current image group size can be determined by using the scheme of the embodiment of the application, and then the continuous image group size image frames starting from the starting to-be-encoded image frame are encoded by using the encoding mode corresponding to the image group size. After that, the first to-be-encoded image frame obtained subsequently in the video stream is taken as a new starting to-be-encoded image frame, and the scheme provided by the embodiment of the application is repeated until the encoding operation of the entire video stream is completed.

[0057] Referring to Figure 3 , Figure 3 is a scene diagram corresponding to the first embodiment of the application. Hereinafter, the first embodiment of the application will be described by taking a specific scene as an example with reference to the scene diagram shown in Figure 3

[0058] N candidate sizes are determined: candidate size 1, …, candidate size N, wherein N is a natural number greater than 1; after obtaining the plurality of candidate sizes, the first image set corresponding to the candidate size 1, …, the Nth image set corresponding to the candidate size N are determined in the video stream; the motion complexity of each image set is calculated respectively: the first motion complexity corresponding to the first image set, …, the Nth motion complexity corresponding to the Nth image set; the N motion complexities determined above are subjected to a preset operation, to obtain an operation result; finally, the candidate size 1 is determined as the size of the image group according to the operation result.

[0059] According to the image group size determination scheme provided by the embodiment of the application, based on the motion complexity of the image content in the image set of different sizes, the image group size matching the motion complexity degree of the image content of the current to-be-encoded image frame can be adaptively determined from the plurality of candidate sizes. In this way, when the subsequent encoding process is performed based on the determined matching image group size, the rate-distortion performance of the encoding result can be effectively improved.

[0060] ​The image group size determination method provided by the embodiment one of the present application can be performed by a video encoding end (encoder) before encoding a video stream, to adaptively select a group size that matches the content of an image frame from a plurality of different candidate sizes, and then perform subsequent encoding operation based on the group size. The video encoding end can be a client or a server. The image group size determination method provided by the embodiment of the present application can be applied to various scenarios, such as video on demand scenarios, and the corresponding video encoding end is a (cloud) server. Specifically, the (cloud) server device can determine the image group size used when encoding the locally stored video media data (such as movie, TV series, etc.) by using the image group size determination method provided by the embodiment of the present application. Then, the video media data is encoded based on the encoding method corresponding to the image group size, to obtain a video bit stream; and the video bit stream is delivered to the client device for decoding in the client device to obtain the corresponding video media data and play it. For another example, storage and streaming of a regular video game. Specifically, the image group size involved in the encoding process can be determined by using the image group size determination method provided by the embodiment of the present application. Then, the video content is encoded using the determined image group size to form a corresponding video bit stream, which is stored and transmitted in a video streaming service or other similar application. For another example, in a low-latency scenario such as video conferencing or video live streaming, the video encoding end is a client-conference terminal. Specifically, the conference video data can be collected by a video collection device, and the image group size involved in the encoding process can be determined by using the image group size determination method provided by the embodiment of the present application. Then, the collected conference video data is encoded using the determined image group size to form a corresponding video bit stream, which is sent to the conference terminal. The video bit stream is decoded by the conference terminal to obtain the corresponding conference video picture. For another example, in a virtual reality scenario, the image group size involved in the encoding process can be determined by using the image group size determination method provided by the embodiment of the present application. Then, the collected video data is encoded using the determined image group size to form a corresponding video bit stream, which is sent to a virtual reality related device (such as VR virtual glasses, etc.). The video bit stream is decoded by the VR device to obtain the corresponding video picture, and the corresponding VR function is realized based on the video picture.

[0061] Embodiment two

[0062] Reference Figure 4 , Figure 4 A step flowchart of an image group size determination method according to the embodiment one of the present application.

[0063] Specifically, the image group size determination method provided by the embodiment includes the following steps:

[0064] Step 402, selecting an unselected maximum size from the preset multiple candidate sizes as a first candidate size.

[0065] Step 404, determining a second candidate size from the multiple candidate sizes which is smaller than the first candidate size and has the minimum difference with the first candidate size.

[0066] For example, the candidate sizes are 32, 16, 8, 4, 2 and 1 respectively, if the first candidate size is selected as 16, the second candidate size will be determined as 8.

[0067] Step 406, respectively calculating a first motion complexity of the first image set, a second motion complexity of the second image set and a third motion complexity of the third image set.

[0068] The first image set starts from the last coded image frame, and the number of to-be-coded image frames is equal to the first candidate size; the second image set starts from the last coded image frame, and the number of to-be-coded image frames is equal to the second candidate size; the third image set starts from the last to-be-coded image frame in the second image set, and includes the image frames in the first image set which are not in the second image set.

[0069] For example, the first candidate size is 32, and the second candidate size is 16, the first image set is a set of 32 continuous to-be-coded image frames starting from the last coded image frame (supposed to be the i-th frame), that is, a set of continuous image frames from the i-th frame to the i+32-th frame; the second image set is a set of 16 continuous to-be-coded image frames starting from the last coded image frame (the i-th frame), that is, a set of continuous image frames from the i-th frame to the i+16-th frame; the third image set is a set of image frames starting from the i+16-th frame, that is, a set of continuous image frames from the i+16-th frame to the i+32-th frame.

[0070] Optionally, in the embodiments of the present application, the motion complexity of the image set can be represented based on the encoding cost when the image set is encoded as a group of pictures; can also be represented based on the number of stationary blocks between the image frames in the image set; and can also be represented based on the pixel difference value between the image frames in the image set.

[0071] Specifically, when the motion complexity of the image set is represented based on the encoding cost when the image set is encoded as a group of pictures, the step 406 can include:

[0072] The first encoding cost when the first image set is encoded as an image group is calculated as a first motion complexity of the first image set; the second encoding cost when the second image set is encoded as an image group is calculated as a second motion complexity of the second image set; and the third encoding cost when the third image set is encoded as an image group is calculated as a third motion complexity of the third image set.

[0073] Further, the first encoding cost when the first image set is encoded as an image group is calculated as a first motion complexity of the first image set, which can include: selecting a first preset number of first image frames from the first image set, and obtaining the first encoding cost when the first image set is encoded as an image group based on the inter-frame encoding cost of each first image frame.

[0074] The second encoding cost when the second image set is encoded as an image group is calculated as a second motion complexity of the second image set, which can include: selecting a second preset number of second image frames from the second image set, and obtaining the second encoding cost when the second image set is encoded as an image group based on the inter-frame encoding cost of each second image frame.

[0075] The third encoding cost when the third image set is encoded as an image group is calculated as a third motion complexity of the third image set, which can include: selecting a third preset number of third image frames from the third image set, and obtaining the third encoding cost when the third image set is encoded as an image group based on the inter-frame encoding cost of each third image frame.

[0076] In the embodiments of the present application, the number and selection method of the first image frames are not limited, and can be set according to actual conditions; and the specific manner of obtaining the first encoding cost based on the inter-frame encoding cost of each first image frame is also not limited. For example, the tail frame located at the tail and the middle frame located at the middle position in the first image set can be taken as the first image frames, the inter-frame encoding cost of the tail frame forwardly referencing the first frame (the first frame located at the head of the first image set) is calculated, and the inter-frame encoding cost of the middle frame forwardly referencing the first frame and backwardly referencing the tail frame is calculated, and the sum of the above two encoding costs is taken as the first encoding cost, that is, the first motion complexity.

[0077] In the embodiments of the present application, the number and selection method of the second image frames are not limited, and can be set according to actual conditions; and the specific manner of obtaining the second encoding cost based on the inter-frame encoding cost of each second image frame is also not limited. For example, the tail frame located at the tail in the second image set can be taken as the second image frame, and the inter-frame encoding cost of the tail frame forwardly referencing the first frame (the first frame located at the head of the second image set) is calculated as the second encoding cost, that is, the second motion complexity.

[0078] In the embodiments of the present application, the number of third image frames and the selection method are not limited, and can be set according to actual conditions; and the specific method of obtaining the third encoding cost according to the inter-frame encoding cost of each third image frame is also not limited. For example, the tail frame located at the tail of the third image set can be selected as the third image frame, the inter-frame encoding cost of the tail frame with the first frame (the first frame located at the head of the third image set) as the forward reference is calculated as the third encoding cost, that is, the third motion complexity.

[0079] Still taking the first candidate size as 32, the second candidate size as 16, and the last encoded image frame as the i-th frame as an example: the (i+32)-th image frame and the (i+16)-th image frame can be selected from the first image set as the first image frame, the inter-frame encoding cost of the (i+32)-th frame with the i-th frame as the forward reference, that is, FrmInterCost(i+32,i), and the sum of the inter-frame encoding cost of the (i+16)-th frame with the i-th frame as the forward reference and the (i+32)-th frame as the backward reference, that is, FrmInterCost(i+16,i)(i+16,i+32), are calculated as the first encoding cost GOP32Cost_32(i,i+32); the (i+16)-th image frame can be selected from the second image set as the second image frame, and the inter-frame encoding cost of the (i+16)-th frame with the i-th frame as the forward reference, that is, FrmInterCost(i+16,i), is calculated as the second encoding cost; the (i+32)-th image frame can be selected from the third image set as the third image frame, and the inter-frame encoding cost of the (i+32)-th frame with the (i+16)-th frame as the forward reference, that is, FrmInterCost(i+32,i+16), is calculated as the third encoding cost.

[0080] Referring to Figure 5 , Figure 5 FIG. 4 is a simplified encoding cost distribution diagram of a GOP32. In Figure 5 , i=0, FrmInterCost(16,0)(16,32) represents the inter-frame encoding cost of the 16-th frame with the 0-th frame as the forward reference and the 32-th frame as the backward reference; and FrmInterCost(32,0) represents the inter-frame encoding cost of the 32-th frame with the 0-th frame as the forward reference.

[0081] Referring to Figure 6 , Figure 6 FIG. 5 is a simplified encoding cost distribution diagram of two GOP16s. In Figure 6 , i=0, FrmInterCost(16,0) represents the inter-frame encoding cost of the 16-th frame with the 0-th frame as the forward reference; and FrmInterCost(32,16) represents the inter-frame encoding cost of the 32-th frame with the 16-th frame as the forward reference.

[0082] Specifically, when the motion complexity of the image set is represented based on the number of stationary blocks between image frames in the image set, the step 406 can include:

[0083] calculating a first number of stationary blocks between image frames in the first image set, and obtaining a first motion complexity of the first image set based on the first number of stationary blocks; wherein the greater the first number of stationary blocks is, the smaller the first motion complexity is;

[0084] calculating a second number of stationary blocks between image frames in the second image set, and obtaining a second motion complexity of the second image set based on the second number of stationary blocks;

[0085] calculating a third number of stationary blocks between image frames in the third image set, and obtaining a third motion complexity of the third image set based on the third number of stationary blocks.

[0086] The number of stationary blocks in the image set can be the number of stationary blocks between a plurality of preset image frames in the corresponding image set, and the specific determination manner of the number of stationary blocks is not limited in the embodiments of the present application.

[0087] Specifically, when the motion complexity of the image set is represented based on the pixel difference value between image frames in the image set, the step 406 can include:

[0088] calculating a first pixel difference value between image frames in the first image set as a first motion complexity of the first image set;

[0089] calculating a second pixel difference value between image frames in the second image set as a second motion complexity of the second image set;

[0090] calculating a third pixel difference value between image frames in the third image set as a third motion complexity of the third image set.

[0091] The pixel difference value in the image set can be the pixel difference value between a plurality of preset image frames in the corresponding image set, and the specific determination manner and specific representation form of the pixel difference value are not limited in the embodiments of the present application.

[0092] Exemplarily, the pixel values can be divided into a plurality of different pixel intervals according to different sizes (for example, 0-100 is a first pixel value interval, 101-200 is a second pixel value interval, and 201-255 is a third pixel value interval); for each image frame, the number of pixel points falling into each pixel value interval is counted to obtain the pixel value distribution of each image frame, and then the pixel value distribution of each image frame is compared to obtain the pixel difference value between image frames.

[0093] Specifically, for example: for each image frame, the number of pixel points falling into each pixel interval can be counted in the form of a histogram or the like (e.g., the abscissa represents the pixel value, and the ordinate represents the number of pixel points), to form a pixel value distribution diagram of the image frame, and then the pixel value distribution diagrams of the image frames are compared to obtain the pixel difference values between the image frames.

[0094] Step 408: fusing the second motion complexity and the third motion complexity to obtain a fused motion complexity. If the first motion complexity is less than the fused motion complexity, step 410 is performed; otherwise, if the second candidate size is the minimum value in the plurality of candidate sizes, step 412 is performed, and if the second candidate size is not the minimum value in the plurality of candidate sizes, step 402 is returned to be performed.

[0095] In the embodiments of the present application, the specific motion complexity fusion manner is not limited, and can be determined according to actual conditions. For example, the second motion complexity and the third motion complexity can be added to obtain the fused motion complexity; or the second motion complexity and the third motion complexity can be respectively assigned a weight value, and then weighted summation is performed to obtain the fused motion complexity; or the second motion complexity and the third motion complexity can be taken as independent variables, and a preset function expression is used for calculation to obtain the fused motion complexity, and the like.

[0096] Step 410: determining the first candidate size as the group of images size.

[0097] Step 412: determining the second candidate size as the group of images size.

[0098] Referring to Figure 7 , Figure 7 is a scene diagram corresponding to the second embodiment of the present application. Hereinafter, the second embodiment of the present application will be described with reference to the scene diagram shown in Figure 7 .

[0099] Assume candidate sizes are 32, 16, 8, 4, 2 and 1 respectively; obtain a current video stream to be encoded, and the image serial number of the last encoded image frame in the video stream at the beginning (i.e. the first frame in the video stream, usually the encoding type is I frame) is i=0; select 32 as the first candidate size from the above multiple candidate sizes, then 16 can be determined as the second candidate size; calculate the first encoding cost GOP32Cost_32(i,i+32) of a first image set composed of the i-th frame to the i+32-th frame in the video stream, and GOP32Cost_16(i,i+32), wherein GOP32Cost_16(i,i+32) is the fusion encoding cost, i.e. the sum of the second encoding cost of a second image set composed of the i-th frame to the i+16-th frame in the video stream and the third encoding cost of a third image set composed of the i+16-th frame to the i+32-th frame; when GOP32Cost_32(i,i+32)calculating a first coding cost GOP8Cost_8(i, i+8) of a first image set composed of the i-th frame to the i+8-th frame in the video stream, and a GOP8Cost_4(i, i+8), wherein the GOP8Cost_4(i, i+8) is a fusion coding cost, i.e. a sum of a second coding cost of a second image set composed of the i-th frame to the i+4-th frame in the video stream and a third coding cost of a third image set composed of the i+4-th frame to the i+8-th frame; when GOP8Cost_8(i, i+8) < GOP8Cost_4(i, i+8), then encoding the consecutive image frames from the i+1-th frame to the i+8-th frame using the coding structure of GOP8, updating i by i+8, and returning to the step of selecting 32 as the first candidate size from the multiple candidate sizes and determining 16 as the second candidate size; when GOP8Cost_8(i, i+8) ≥ GOP8Cost_4(i, i+8), then selecting the largest size 4 which has not been selected as the new first candidate size from the candidate sizes, and correspondingly, determining 2 as the second candidate size; calculating a first coding cost GOP4Cost_4(i, i+4) of a first image set composed of the i-th frame to the i+4-th frame in the video stream, and a GOP4Cost_2(i, i+4), wherein the GOP4Cost_2(i, i+4) is a fusion coding cost, i.e. a sum of a second coding cost of a second image set composed of the i-th frame to the i+2-th frame in the video stream and a third coding cost of a third image set composed of the i+2-th frame to the i+4-th frame; when GOP4Cost_4(i, i+4) < GOP4Cost_2(i, i+4), then encoding the consecutive image frames from the i+1-th frame to the i+4-th frame using the coding structure of GOP4, updating i by i+4, and returning to the step of selecting 32 as the first candidate size from the multiple candidate sizes and determining 16 as the second candidate size; when GOP4Cost_4(i, i+4) ≥ GOP4Cost_2(i, i+4), then selecting the largest size 2 which has not been selected as the new first candidate size from the candidate sizes, and correspondingly, determining 1 as the second candidate size; calculating a first coding cost GOP2Cost_2(i, i+2) of a first image set composed of the i-th frame to the i+2-th frame in the video stream, and a GOP2Cost_1(i, i+2), wherein the GOP2Cost_1(i, i+2) is a fusion coding cost, i.e. a sum of a second coding cost of a second image set composed of the i-th frame to the i+1-th frame in the video stream and a third coding cost of a third image set composed of the i+1-th frame to the i+2-th frame;When GOP2Cost_2(i, i+2) < GOP2Cost_1(i, i+2), then the i+1th frame to the i+2th frame of the continuous image frames are encoded by using the encoding structure of GOP2, i is updated by using i+2, and the step of selecting 32 as the first candidate size and determining 16 as the second candidate size from the plurality of candidate sizes is returned; when GOP2Cost_2(i, i+2) ≥ GOP2Cost_1(i, i+2), then the i+1th frame of the image frames is encoded by using the encoding structure of GOP1, that is, the i+1th frame is encoded by using P frame, i is updated by using i+1, and the step of selecting 32 as the first candidate size and determining 16 as the second candidate size from the plurality of candidate sizes is returned.

[0100] In the above example:

[0101] GOP32Cost_32(i, i+32) = FrmlnterCost(i+32, i) + FrmlnterCost(i+16, i)(i+16, i+32)

[0102] GOP32Cost_16(i, i+32) = FrmlnterCost(i+16, i) + FrmlnterCost(i+32, i+16)

[0103] GOP16Cost_16(i, i+16) = FrmlnterCost(i+16, i) + FrmlnterCost(i+8, i)(i+8, i+16)

[0104] GOP16Cost_8(i, i+16) = FrmlnterCost(i+8, i) + FrmlnterCost(i+16, i+8)

[0105] GOP8Cost_8(i, i+8) = FrmlnterCost(i+8, i) + FrmlnterCost(i+4, i)(i+4, i+8)

[0106] GOP8Cost_4(i, i+8) = FrmlnterCost(i+4, i) + FrmlnterCost(i+8, i+4)

[0107] GOP4Cost_4(i, i+4) = FrmlnterCost(i+4, i) + FrmlnterCost(i+2, i)(i+2, i+4)

[0108] GOP4Cost_2(i,i+4) = FrmInterCost(i+2,i) + FrmInterCost(i+4,i+2)

[0109] FrmInterCost(A,B) represents the encoding cost of the frame A forwardly referencing the frame B;

[0110] FrmInterCost(C,D)(C,E) represents the encoding cost of the frame C forwardly referencing the frame D and backwardly referencing the frame E.

[0111] In addition, the encoding cost of each frame in the image group can be calculated as follows:

[0112] 1. down-sampling the original image frames to obtain down-sampled images;

[0113] 2. dividing the down-sampled images into multiple processing units with the size of 8x8, for each processing unit: using multi-angle direction prediction to obtain a predicted image of the processing unit, then performing sum of absolute transformed differences (SATD) operation on the processing unit in the original image frame and the corresponding processing unit in the predicted image, comparing the SATD values to obtain the minimum SATD value, thereby obtaining the intra-frame encoding cost CuIntraCost of each processing unit;

[0114] 3. dividing the down-sampled images into multiple processing units with the size of 8x8, for each processing unit: performing motion search in its reference frames to obtain multiple predicted images, then calculating the SATD of the processing unit in the original image and the corresponding processing unit in the predicted image, comparing the SATD values to obtain the minimum SATD value, thereby obtaining the forward inter-frame encoding cost L0_CuInterCost, the backward inter-frame encoding cost L1_CuInterCost and the bidirectional inter-frame encoding cost Bi_CuInterCost of each processing unit in the current reference direction; finally, comparing the CuIntraCost, L0_CuInterCost, L1_CuInterCost and Bi_CuInterCost of each processing unit to obtain the minimum value as the inter-frame encoding cost CuInterCost of each processing unit;

[0115] The steps 2 and 3 are sequentially performed on each processing unit in the current down-sampled image frame to obtain Cu IntraCost and Cu InterCost of each processing unit in the current down-sampled image frame, and Cu IntraCost of each processing unit is accumulated to obtain an intra-frame encoding cost of the original image frame, and Cu InterCost of each processing unit is accumulated to obtain an inter-frame encoding cost of the original image frame.

[0116] According to the image group size determination scheme provided in the embodiments of the present application, the motion complexity of image contents in image groups of different sizes is used to adaptively determine a size of an image group that matches the motion complexity of image contents of a current image frame to be encoded from multiple candidate sizes. In this way, the rate-distortion performance of the encoding result can be effectively improved when a subsequent encoding process is performed based on the determined matching image group size.

[0117] In addition, in the embodiments of the present application, the larger size in the candidate sizes is preferentially considered when the size of the image group is selected, and when the larger size cannot meet the motion complexity requirement of the image contents, smaller sizes are gradually refined and selected. Compared with the scheme that preferentially considers the smaller size in the candidate sizes, the scheme can effectively reduce redundant invalid judgments and avoid the selection process from falling into a local optimal solution.

[0118] Embodiment Three

[0119] Reference Figure 8 , Figure 8 A step flowchart of an encoding method according to Embodiment Three of the present application. The encoding method can be applied to a server device or a client device that has an encoding requirement. Specifically, the encoding method provided in the embodiment includes the following steps:

[0120] Step 802, receiving consecutive image frames to be encoded.

[0121] Step 804, determining a size of an image group used in an encoding process.

[0122] Specifically, the step can be implemented by using the image group size determination method provided in Embodiment One or Embodiment Two, and the specific implementation process is not described here.

[0123] Step 806, encoding the consecutive image frames to be encoded in the image group based on a preset encoding mode corresponding to the size of the image group to obtain a video bitstream.

[0124] The encoding method provided in the embodiments of the present application can be executed by a video encoding end (encoder) to adaptively select a group of picture size that matches the content of an image frame from a plurality of different candidate sizes, and then perform subsequent encoding operations based on the group of picture size. The video encoding end can be a client or a server. The encoding method provided in the embodiments of the present application can be applied to various scenarios, such as a video on demand scenario, and the corresponding video encoding end is a (cloud) server. Specifically, the (cloud) server device can determine a group of picture size used when encoding locally stored video media data (such as movie, television series, and the like), and then encode the video media data based on the encoding manner corresponding to the group of picture size to obtain a video bitstream; and deliver the video bitstream to a client device for decoding in the client device to obtain corresponding video media data and play the video media data. For another example, storage and streaming of a regular video game. Specifically, the group of picture size involved in the encoding process can be determined by the method provided in the embodiments of the present application, and then the determined group of picture size is used to encode the video content to form a corresponding video bitstream for storage and transmission in a video streaming service or other similar application. For another example, a low-latency scenario such as a video conference or a video live broadcast, and the corresponding video encoding end is a client-conference terminal. Specifically, conference video data can be collected by a video collection device, and the group of picture size involved in the encoding process can be determined, and then the determined group of picture size is used to encode the collected conference video data to form a corresponding video bitstream, which is sent to the conference terminal, and the video bitstream is decoded by the conference terminal to obtain corresponding conference video pictures. For another example, a virtual reality scenario. The group of picture size involved in the encoding process can be determined, and then the determined group of picture size is used to encode the collected video data to form a corresponding video bitstream, which is sent to a virtual reality related device (such as a VR virtual glasses), and the video bitstream is decoded by the VR device to obtain corresponding video pictures, and the corresponding VR function is realized based on the video pictures, and the like.

[0125] Embodiment Four

[0126] Reference Figure 9 , Figure 9 FIG. 1 is a step flowchart of an encoding method according to an embodiment of the present application. The encoding method can be applied to a (cloud) server device with encoding requirements. Specifically, the encoding method provided in the embodiment includes the following steps:

[0127] Step 902, obtaining video data.

[0128] Specifically, the server device can obtain locally stored high-quality video data, such as a movie, a television series, and the like with high definition.

[0129] Step 904 : Determine the GOP size used in the encoding process, and encode the video data based on a preset encoding method corresponding to the GOP size to obtain a video bitstream.

[0130] Specifically, in this step, the image group size may be determined by using the image group size determination method provided in the first or second embodiment above, and the specific determination process will not be described in detail here.

[0131] After the GOP size is determined, the video data acquired in step 902 may be encoded based on an encoding method corresponding to the GOP size, thereby obtaining a video bitstream.

[0132] Step 906: Send the video bitstream to the client device, so that the client device decodes the video bitstream and displays the video image.

[0133] After the encoded video bit stream is sent to the client device, the client device can decode the video bit stream to obtain corresponding video data, and display and play the video data in the display section.

[0134] See also Figure 10 , Figure 10 This is a schematic diagram of the scene corresponding to the fourth embodiment of the present application. Figure 10 The schematic diagram shown in the figure illustrates an embodiment of the present application using a specific scenario as an example:

[0135] Figure 10 Corresponding to the video data on-demand scenario, specifically: the server device and each client device (client device 1, ..., client device N) are connected through network communication; when the user wants to watch movie A, he can send a on-demand request to the server device through the client device (assuming client device 1); after the server device receives the above-mentioned on-demand request, it can determine the movie data of movie A in the database, and use the image group size determination method provided in any embodiment of the present application to determine the image group size; the server device encodes the movie data based on the encoding method corresponding to the above-mentioned image group size, thereby obtaining a video bit stream; the server device returns the above-mentioned video bit stream to the client device 1 through the communication network; after receiving the above-mentioned video bit stream, the client device 1 can decode it to obtain the movie data of movie A, and play it in the player for the user to watch.

[0136] Example 5

[0137] Figure 11 : This is a structural block diagram of a device for determining the size of an image group according to Embodiment 5 of the present application. The device for determining the size of an image group provided in this embodiment of the present application includes:

[0138] The candidate size determination module 1102 is configured to determine a plurality of candidate sizes.

[0139] The motion complexity calculation module 1104 is configured to calculate motion complexity of an image set corresponding to the candidate size, wherein the image set comprises a plurality of consecutive to-be-encoded image frames, the number of the to-be-encoded image frames in the image set is equal to the corresponding candidate size, and the total number of the image frames in the image set is greater than 1; and the motion complexity represents the complexity of the motion of the image content between the image frames in the corresponding image set.

[0140] The image group size determination module 1106 is configured to perform a preset operation based on the motion complexity of each image set, and select a target size from the plurality of candidate sizes as the size of the image group according to the operation result, wherein the image group is composed of the consecutive to-be-encoded image frames in the image set corresponding to the target size.

[0141] Optionally, in some embodiments, the candidate size determination module 1102 is specifically configured to determine a first candidate size and a second candidate size, wherein the first candidate size is greater than the second candidate size.

[0142] Optionally, in some embodiments, the motion complexity calculation module 1104 is specifically configured to:

[0143] calculate a first motion complexity of a first image set, a second motion complexity of a second image set and a third motion complexity of a third image set respectively, and fuse the second motion complexity and the third motion complexity to obtain a fused motion complexity.

[0144] The first image set takes the last encoded image frame as a starting frame, and the number of the to-be-encoded image frames is equal to the first candidate size; the second image set takes the last encoded image frame as a starting frame, and the number of the to-be-encoded image frames is equal to the second candidate size; and the third image set takes the last to-be-encoded image frame in the second image set as a starting frame, and comprises the image frames in the first image set that do not belong to the second image set.

[0145] Optionally, in some embodiments, the image group size determination module 1106 is specifically configured to: if the first motion complexity is less than the fused motion complexity, determine the first candidate size as the size of the image group.

[0146] Optionally, in some embodiments, the candidate size determination module 1102 is specifically configured to: select an unselected maximum size from a plurality of preset candidate sizes as the first candidate size; and determine a candidate size smaller than the first candidate size and having the smallest difference with the first candidate size from the plurality of candidate sizes as the second candidate size.

[0147] The candidate size determination module 1102 is further configured to: if the first motion complexity is greater than or equal to the fusion motion complexity, return to the step of selecting the largest size that has not been selected from a plurality of preset candidate sizes as the first candidate size.

[0148] Optionally, in some embodiments, the candidate size determination module 1102 is further used to: when the second candidate size is the minimum value among multiple candidate sizes and the first motion complexity is greater than or equal to the fusion motion complexity, determine the second candidate size as the image group size.

[0149] Optionally, in some embodiments, the motion complexity calculation module 1104, when executing the steps of respectively calculating the first motion complexity of the first image set, the second motion complexity of the second image set, and the third motion complexity of the third image set, is specifically configured to:

[0150] Calculating a first coding cost when encoding the first image set as an image group as a first motion complexity of the first image set;

[0151] calculating a second coding cost when encoding the second image set as the image group as a second motion complexity of the second image set;

[0152] A third coding cost when encoding is performed using the third picture set as the picture group is calculated as a third motion complexity of the third picture set.

[0153] Optionally, in some embodiments, the motion complexity calculation module 1104, when executing the steps of respectively calculating the first motion complexity of the first image set, the second motion complexity of the second image set, and the third motion complexity of the third image set, is specifically configured to:

[0154] Calculating the number of first still blocks between image frames in the first image set, and obtaining a first motion complexity of the first image set based on the number of the first still blocks; wherein a greater number of the first still blocks indicates a smaller first motion complexity;

[0155] calculating a second number of still blocks between image frames in the second image set, and obtaining a second motion complexity of the second image set based on the second number of still blocks;

[0156] The number of third still blocks between image frames in the third image set is calculated, and a third motion complexity of the third image set is obtained based on the third still blocks.

[0157] Optionally, in some embodiments, the motion complexity calculation module 1104, when executing the steps of respectively calculating the first motion complexity of the first image set, the second motion complexity of the second image set, and the third motion complexity of the third image set, is specifically configured to:

[0158] a pixel difference value between image frames in the first image set is calculated as a first motion complexity of the first image set;

[0159] a pixel difference value between image frames in the second image set is calculated as a second motion complexity of the second image set;

[0160] a pixel difference value between image frames in the third image set is calculated as a third motion complexity of the third image set.

[0161] The image group size determination apparatus of the embodiment is used to implement the corresponding image group size determination method in the foregoing method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described here. In addition, the functions of each module in the image group size determination apparatus of the embodiment can be implemented by referring to the description of the corresponding part in the foregoing method embodiments, which will not be described here either.

[0162] Embodiment Six

[0163] Referring to Figure 12 , a structural schematic diagram of an electronic device according to an embodiment of the present application is shown, and the embodiment of the present application does not limit the specific implementation of the electronic device.

[0164] As Figure 12 shown, the electronic device can include a processor 1202, a communications interface 1204, a memory 1206, and a communications bus 1208.

[0165] Among them:

[0166] The processor 1202, the communications interface 1204, and the memory 1206 complete mutual communication through the communications bus 1208.

[0167] The communications interface 1204 is configured to communicate with other electronic devices or servers.

[0168] The processor 1202 is configured to execute the program 1210, and specifically can execute the related steps in the foregoing image group size determination method or encoding method embodiments.

[0169] Specifically, the program 1210 can include program code, and the program code includes computer operation instructions.

[0170] The processor 1202 can be a CPU, or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application. The one or more processors of the smart device can be of the same type, such as one or more CPUs; or can be of different types, such as one or more CPUs and one or more ASICs.

[0171] The memory 1206 is configured to store a program 1210. The memory 1206 can include a high-speed RAM memory, and can further include a non-volatile memory, such as at least one disk memory.

[0172] The program 1210 can include a plurality of computer instructions, and the program 1210 can specifically cause the processor 1202 to perform operations corresponding to the image group size determination method or the encoding method described in any one of the foregoing method embodiments.

[0173] The specific implementation of each step in the program 1210 can refer to the corresponding description in the corresponding step and unit in the foregoing method embodiments, and has corresponding beneficial effects, which will not be described herein. It can be clearly understood by those skilled in the art that, for the convenience and brevity of description, the specific working process of the device and the module described above can refer to the corresponding process description in the foregoing method embodiments, which will not be described herein.

[0174] The embodiments of the present application further provide a computer storage medium, which stores a computer program. The program is executed by a processor to implement the method described in any one of the foregoing method embodiments. The computer storage medium includes, but is not limited to, a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk, or a magneto-optical disk, etc.

[0175] The embodiments of the present application further provide a computer program product, which includes computer instructions. The computer instructions instruct a computing device to perform operations corresponding to any one of the image group size determination method or the encoding method in the foregoing method embodiments.

[0176] In addition, it should be noted that the information related to the user (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to sample data for training the model, data for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of the country and region, and provide corresponding operation portal for user to choose authorization or refusal.

[0177] It should be noted that, according to the needs of implementation, each component / step described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or part of the operation of the components / steps can be combined into new components / steps, to achieve the purpose of the embodiments of the present application.

[0178] The above method according to the embodiments of the present application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk, or downloaded through a network and originally stored in a remote recording medium or non-transitory machine readable medium and then stored in a local recording medium, so that the method described herein can be stored in a recording medium on a general computer, special processor or programmable or special hardware (such as Application Specific Integrated Circuit (ASIC) or Field Programmable Gate Array (FPGA)) using such software processing. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes storage components (for example, Random Access Memory (RAM), Read-Only Memory (ROM), flash memory, etc.) that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, processor or hardware, the method described herein is implemented. In addition, when the general computer accesses the code for implementing the method shown herein, the execution of the code will convert the general computer into a special computer for executing the method shown herein.

[0179] Those skilled in the art can understand that the units and method steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software manner depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered as beyond the scope of the embodiments of the present application.

[0180] The above implementation is only used to illustrate the embodiments of the present application, and is not intended to limit the embodiments of the present application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application, and the patent protection scope of the embodiments of the present application should be defined by the claims.

Claims

1. A method for determining a group of pictures size, comprising: determining a plurality of candidate sizes; calculating motion complexity of image sets corresponding to the candidate sizes; the image sets each comprising consecutive to-be-encoded image frames, the number of to-be-encoded image frames in the image set being equal to the corresponding candidate size, and the total number of image frames in the image set being greater than 1; the motion complexity representing the complexity of image content motion between image frames in the corresponding image set; performing a preset operation based on the motion complexity of each image set, and selecting a target size from the plurality of candidate sizes as the size of the group of pictures according to the operation result; wherein the group of pictures is composed of consecutive to-be-encoded image frames in the image set corresponding to the target size. The determining of the plurality of candidate sizes comprises: determining a first candidate size and a second candidate size; the first candidate size being greater than the second candidate size. The calculating of the motion complexity of the image set corresponding to the candidate size comprises: calculating a first motion complexity of a first image set, a second motion complexity of a second image set, and a third motion complexity of a third image set respectively; and fusing the second motion complexity and the third motion complexity to obtain a fused motion complexity. The first image set takes a last encoded image frame as a starting frame, and the number of to-be-encoded image frames is equal to the first candidate size; the second image set takes the last encoded image frame as a starting frame, and the number of to-be-encoded image frames is equal to the second candidate size; the third image set takes a last to-be-encoded image frame in the second image set as a starting frame, and comprises image frames in the first image set that do not belong to the second image set. The performing of the preset operation based on the motion complexity of each image set, and the selecting of the target size from the plurality of candidate sizes as the size of the group of pictures according to the operation result, comprises: if the first motion complexity is less than the fused motion complexity, determining the first candidate size as the size of the group of pictures.

2. The method of claim 1, wherein, The determining of the first candidate size and the second candidate size comprises: selecting an unselected maximum size from a plurality of preset candidate sizes as the first candidate size; and determining a candidate size smaller than the first candidate size and having the smallest difference with the first candidate size from the plurality of candidate sizes as the second candidate size. The method further comprises: if the first motion complexity is greater than or equal to the fused motion complexity, returning to the step of selecting an unselected maximum size from a plurality of preset candidate sizes as the first candidate size. The method further comprises: when the second candidate size is the smallest value in the plurality of candidate sizes, and the first motion complexity is greater than or equal to the fused motion complexity, determining the second candidate size as the size of the group of pictures. The calculating of the first motion complexity of the first image set, the second motion complexity of the second image set, and the third motion complexity of the third image set respectively comprises: calculating a first encoding cost when encoding the first image set as a group of pictures as the first motion complexity of the first image set. ​ 3. The method of claim 2, wherein, ​ ​ 4. The method of claim 3, wherein, ​ ​ ​ ​ ​ 5. The method of claim 4, wherein, ​ ​ 6. The method according to any one of claims 2-5, wherein, ​ ​ calculate a second encoding cost when the second image set is encoded as a group of pictures, as a second motion complexity of the second image set; calculate a third encoding cost when the third image set is encoded as a group of pictures, as a third motion complexity of the third image set.

7. The method according to any one of claims 2-5, wherein, The calculating the first motion complexity of the first image set, the second motion complexity of the second image set and the third motion complexity of the third image set respectively includes: calculate a first still block quantity between image frames in the first image set, and obtain the first motion complexity of the first image set based on the first still block quantity; wherein the greater the first still block quantity is, the smaller the first motion complexity is; calculate a second still block quantity between image frames in the second image set, and obtain the second motion complexity of the second image set based on the second still block quantity; calculate a third still block quantity between image frames in the third image set, and obtain the third motion complexity of the third image set based on the third still block quantity.

8. The method of any one of claims 2-5, wherein, The calculating the first motion complexity of the first image set, the second motion complexity of the second image set and the third motion complexity of the third image set respectively includes: calculate a pixel difference value between image frames in the first image set, as the first motion complexity of the first image set; calculate a pixel difference value between image frames in the second image set, as the second motion complexity of the second image set; calculate a pixel difference value between image frames in the third image set, as the third motion complexity of the third image set.

9. An encoding method, comprising: receiving continuous image frames to be encoded; determining a group of pictures size adopted by an encoding process; encoding the continuous image frames to be encoded in a group of pictures based on a preset encoding mode corresponding to the group of pictures size, to obtain a video bitstream; wherein the group of pictures size is determined by the method in any one of claims 1-8.

10. An encoding method, comprising: obtaining video data; determining a group of pictures size adopted by an encoding process, and encoding the video data based on a preset encoding mode corresponding to the group of pictures size, to obtain a video bitstream; sending the video bitstream to a client device, so that the client device decodes the video bitstream and displays a video picture; wherein the group of pictures size is determined by the method in any one of claims 1-8.

11. An electronic device comprising: a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction makes the processor execute the operation corresponding to the method in any one of claims 1-10.

12. A computer storage medium having a computer program stored thereon, the program being executed by a processor to implement the method in any one of claims 1-10.

13. A computer program product comprising computer instructions, the computer instructions instructing a computing device to execute the operation corresponding to the method in any one of claims 1-10.

Citation Information

Patent Citations

  • Video Encoder, Method Of Detecting Scene Change And Method Of Controlling Video Encoder

    CN104038762A

  • Video coding method and device, electronic equipment and storage medium

    CN115514960A