Data coding method and device, computer equipment, medium and product

Determining the hierarchical prediction structure of incomplete MiniGOP through recursive packet processing solves the problem of low encoding efficiency caused by incomplete MiniGOP, and achieves more efficient video encoding and more accurate encoding quality.

CN119071481APending Publication Date: 2024-12-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310632748.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In video encoding, when MiniGOP is incomplete, the inability to effectively utilize the reference video frame leads to low encoding efficiency. How to determine the hierarchical prediction structure of the incomplete MiniGOP to improve encoding efficiency.

Method used

By acquiring the target image group of the target video, performing recursive grouping processing, encoding indication information for each video frame is generated to determine its hierarchical prediction structure, ensuring that each video frame can be reference-encoded using the corresponding reference video frame.

Benefits of technology

It improves the encoding efficiency of incomplete MiniGOP and the encoding efficiency of the entire video, avoids the problem of missing reference video frames, and improves the encoding accuracy and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071481A_ABST
    Figure CN119071481A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data coding method and device, computer equipment, a medium and a product. The method comprises the following steps: acquiring a target image group of a target video; the target video comprises a coded image group, the coded image group is divided into a standard image group and a target image group, the length of the standard image group and the reference length have an exponential relationship, and the length of the target image group and the reference length do not have an exponential relationship; generating a grouping length for the target image group based on the reference length and the target length; performing recursive grouping processing on the video frames in the target image group based on the grouping length, and generating coding indication information of each video frame in the target image group based on recursive grouping information; the recursive grouping information indicates a recursive grouping level in a recursive grouping process of the video frames in the target image group; performing coding processing on the target image group based on the coding indication information of each video frame in the target image group to generate coded data; the video coding efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data encoding method, device, computer equipment, medium and product. Background Art

[0002] In video coding, the video frame sequence of a video can usually be divided into several GOPs (Group Of Pictures), and each video frame in each GOP is coded in units of GOP, thereby realizing the coding of the video. Among them, a GOP can be composed of several MiniGOPs (Mini Group Of Pictures), and each MiniGOP is coded using a complete hierarchical prediction structure to ensure the coding efficiency of the MiniGOP.

[0003] In video coding, MiniGOP can refer to a number of image groups in GOP that use the same hierarchical prediction structure. The lengths of GOP and MiniGOP can change dynamically. When the length of GOP is not an integer multiple of the length of MiniGOP, some video frames will be left at the end of GOP. These video frames are an incomplete MiniGOP. These video frames are not enough for the length of a MiniGOP and cannot directly use the hierarchical prediction structure of MiniGOP. If MiniGOP is directly used for the incomplete MiniGOP during video coding, the hierarchical prediction structure of the complete MiniGOP will still be directly used, but due to the insufficient length, some video frames in the incomplete MiniGOP will have some reference video frames that do not exist; then, when encoding these video frames, the reference video frames cannot be used for reference encoding, which will lead to low encoding (compression) efficiency of the incomplete MiniGOP, and then low video encoding efficiency. Therefore, how to determine the hierarchical prediction structure of the incomplete MiniGOP to improve the encoding efficiency has become an urgent problem to be solved. Summary of the invention

[0004] Embodiments of the present application provide a data encoding method, apparatus, computer equipment, medium, and product, which can determine complete encoding indication information for a target image group in a video, so as to improve the encoding efficiency of the video based on the encoding indication information.

[0005] In a first aspect, an embodiment of the present application provides a data encoding method, including:

[0006] Acquire a target image group of a target video; the target video includes a coded image group, the coded image group includes a plurality of continuous video frames in the target video, the coded image group is used to be divided into at least one standard image group and the target image group, the length of each standard image group has an exponential relationship with a reference length, the length of the target image group does not have an exponential relationship with the reference length, and the length of any image group is used to represent the number of video frames included in the any image group;

[0007] Based on the reference length and the target length, generating a group length for the target image group; the target length refers to the length of the target image group, the group length has an exponential relationship with the reference length, and the group length is less than the target length;

[0008] recursively grouping the video frames in the target image group based on the grouping length, and generating encoding indication information of each video frame in the target image group based on recursive grouping information; the recursive grouping information is used to indicate a recursive grouping level in the process of recursively grouping the video frames in the target image group;

[0009] Based on the encoding indication information of each video frame in the target image group, the target image group is encoded to generate encoding data of the target image group.

[0010] In a second aspect, an embodiment of the present application provides a data encoding device, including:

[0011] an acquisition unit, configured to acquire a target image group of a target video; the target video comprises a coded image group, the coded image group comprises a plurality of continuous video frames in the target video, the coded image group is configured to be divided into at least one standard image group and the target image group, the length of each standard image group has an exponential relationship with a reference length, the length of the target image group does not have an exponential relationship with the reference length, and the length of any image group is configured to represent the number of video frames contained in the any image group;

[0012] a generating unit, configured to generate a packet length for the target image group based on the reference length and a target length; the target length refers to the length of the target image group, the packet length has an exponential relationship with the reference length, and the packet length is smaller than the target length;

[0013] a grouping unit, configured to recursively group the video frames in the target image group based on the grouping length, and generate encoding indication information of each video frame in the target image group based on recursive grouping information; the recursive grouping information is used to indicate a recursive grouping level in the process of recursively grouping the video frames in the target image group;

[0014] The encoding unit is used to perform encoding processing on the target image group based on the encoding indication information of each video frame in the target image group to generate encoding data of the target image group.

[0015] In a third aspect, an embodiment of the present application provides a computer device, the computer device comprising: a processor and a memory, the processor being used to execute the method of the first aspect above.

[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which program instructions are stored, and when the program instructions are executed, the method of the first aspect described above is implemented.

[0017] In a fifth aspect, an embodiment of the present application further provides a computer program product or a computer program, wherein the computer program product or the computer program comprises program instructions, and when the program instructions are executed by a processor, the method of the first aspect described above is implemented.

[0018] In an embodiment of the present application, a target image group of a target video can be obtained; the target video includes a coded image group, the coded image group includes a plurality of continuous video frames in the target video, the coded image group is used to be divided into at least one standard image group and a target image group, the length of each standard image group has an exponential relationship with a reference length, the length of the target image group does not have an exponential relationship with the reference length, and the length of any image group is used to represent the number of video frames included in the any image group; further, based on the reference length and the target length, a grouping length for the target image group can be generated; the target length refers to the length of the target image group, the grouping length has an exponential relationship with the reference length, and the grouping length is less than the target length; then, the video frames in the target image group can be recursively grouped based on the grouping length, and encoding indication information of each video frame in the target image group can be generated based on the recursive grouping information; the recursive grouping information is used to indicate the recursive grouping level in the process of recursively grouping the video frames in the target image group; finally, based on the encoding indication information of each video frame in the target image group, the target image group can be encoded to generate encoding data of the target image group. By implementing the above method, the target image group (tail frame group) in the target video frame can be recursively grouped to determine the encoding indication information (hierarchical prediction structure), and a complete hierarchical prediction structure for the target image group can be obtained. Due to the integrity of the hierarchical prediction structure of each video frame in the target image group (such as the integrity of the reference video frame, etc.), the missing problem (such as the missing problem of the reference video frame) is avoided. When the video frames in the target image group are encoded, the corresponding reference video frames can be used for reference encoding, thereby effectively improving the encoding efficiency of the target image group, and further improving the encoding efficiency of the entire video encoding. Encoding the target image group using this complete hierarchical prediction structure can also avoid the missing problem of the reference video frame caused by the target image group directly using the hierarchical prediction structure corresponding to the standard image group, thereby effectively improving the encoding accuracy, and further improving the encoding quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 It is a schematic diagram of the architecture of a data encoding system provided in an embodiment of the present application;

[0021] Figure 2 It is a flowchart of a data encoding method provided in an embodiment of the present application;

[0022] Figure 3 is a schematic diagram of the structure of a GOP provided in an embodiment of the present application;

[0023] Figure 4 It is a flowchart of another data encoding method provided in an embodiment of the present application;

[0024] Figure 5a is a schematic diagram of a grouping hierarchy of a target image group with a length of 7 provided in an embodiment of the present application;

[0025] Figure 5b is a schematic diagram of a grouping hierarchy of a target image group with a length of 23 provided in an embodiment of the present application;

[0026] Figure 6a is a schematic diagram of encoding indication information of a target image group with a length of 7 provided in an embodiment of the present application;

[0027] Figure 6b is a schematic diagram of encoding indication information of a target image group with a length of 23 provided in an embodiment of the present application;

[0028] Figure 7 is a logic diagram of an algorithm for recursively grouping a target image group provided by an embodiment of the present application;

[0029] Figure 8 is a structural schematic diagram of a data encoding device provided in an embodiment of the present application;

[0030] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] 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.

[0032] The embodiment of the present application proposes a data coding scheme, through which a complete and efficient hierarchical prediction structure suitable for the tail frame group of any length can be derived for the tail frame group at the end of the GOP that is not enough for a MiniGOP, so as to improve the coding efficiency of these tail frames, thereby effectively improving the coding efficiency of the entire video coding. Specifically, the principle of the scheme is as follows: first, a target image group of a target video can be obtained; wherein the target image group can refer to the above-mentioned tail frame group; then, the video frames in the target image group can be recursively grouped to generate coding indication information for each video frame in the target image group based on the recursive grouping information; wherein the recursive grouping information can be used to indicate the recursive grouping level in the process of recursively grouping the video frames in the target image group; the coding indication information of the video frame can also refer to a hierarchical prediction structure; further, based on the coding indication information of each video frame in the target image group, the target image group can be coded to generate coding data for the target image group.

[0033] The target video may include a coded picture group, which may include a plurality of continuous video frames in the target video. The coded picture group is used to be divided into at least one standard picture group and a target picture group. The length of each standard picture group may refer to a picture group that is long enough for a MiniGOP, and the target picture group refers to a picture group that is short of a MiniGOP. The length of any picture group is used to indicate the number of video frames included in any picture group. The length of a MiniGOP usually has an exponential relationship with the reference length, and the length of each standard picture group has an exponential relationship with the reference length, while the length of the target picture group does not have an exponential relationship with the reference length.

[0034] In one embodiment, when recursively grouping the target image group, first, a group length for the target image group can be generated based on a reference length and a target length; wherein the target length refers to the length of the target image group, the group length has an exponential relationship with the reference length, and the group length is less than the target length. Then, the video frames in the target image group can be recursively grouped based on the group length, and encoding indication information of each video frame in the target image group can be generated based on the recursive grouping information.

[0035] In a specific implementation, the execution subject of the above-mentioned data encoding scheme may be a computer device, which may be a terminal or a server. The terminal mentioned here may be a smart phone, tablet computer, laptop computer, desktop computer and other devices; the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, etc.

[0036] It should be noted that when the computer device is a server, the embodiment of the present application provides a data encoding system, such as Figure 1 As shown, the data encoding system includes at least one terminal and at least one server; the terminal can obtain a target video and upload the obtained target video to the server (i.e., a computer device), so that the computer device can obtain a target image group of the target video, and encode the target image group based on a data encoding scheme to obtain encoded data corresponding to the target image group.

[0037] Practice has shown that the data encoding scheme proposed in the embodiment of the present application can have the following beneficial effects: the encoding indication information (hierarchical prediction structure) can be determined for the target image group (tail frame group) in the target video frame by recursive grouping, and a complete hierarchical prediction structure for the target image group can be obtained. Due to the integrity of the hierarchical prediction structure of each video frame in the target image group (such as the integrity of the reference video frame, etc.), the missing problem (such as the missing problem of the reference video frame) is avoided. When the video frames in the target image group are encoded, the corresponding reference video frames can be used for reference encoding, thereby effectively improving the encoding efficiency of the target image group, and further improving the encoding efficiency of the entire video encoding. Encoding the target image group using this complete hierarchical prediction structure can also avoid the missing problem of the reference video frame caused by the target image group directly using the hierarchical prediction structure corresponding to the standard image group, thereby effectively improving the encoding accuracy, and further improving the encoding quality.

[0038] Among them, the hierarchical prediction structure of the video frame may include a temporal hierarchical identifier, a coding order, and a reference video frame. By determining the hierarchical prediction structure in a recursive grouping manner, the temporal hierarchical identifiers (or so-called temporal hierarchical identifiers) of each video frame in the target image group can be interspersed more evenly, that is, it is possible to ensure that for each video frame, there are video frames with a lower temporal hierarchical identifier than the video frame before and after the video frame; and, based on the generation order of the temporal hierarchical identifier of each video frame in the target image group, the coding order for each video frame in the target image group is determined respectively, which can also ensure that the video frames with a lower temporal hierarchical identifier can be encoded first; thus, when determining the reference video frame of a video frame, video frames with a temporal hierarchical identifier less than or equal to the temporal hierarchical identifier of the video frame can be determined from adjacent video frames, and these video frames can be used as reference video frames. A timing layer identifier can be used to identify the coding quality level of the video frame, and the timing layer identifier of the video frame is negatively correlated with the coding quality level. Therefore, for a video frame, when determining the video frame, a video frame with the same or higher coding quality level can be used for reference encoding, thereby effectively improving the coding effect (such as coding quality and coding accuracy).

[0039] Based on the data encoding scheme provided above, the embodiment of the present application provides a data encoding method, which can be executed by the computer device mentioned above. Figure 2 , the data encoding method includes but is not limited to the following steps:

[0040] S201, obtaining a target image group of a target video.

[0041] The target video may refer to a video to be encoded, and the target video may be a video of any type or length, and is not limited thereto.

[0042] It should be understood that in video encoding (compression), the video frame sequence corresponding to the video can be divided into at least one GOP. A GOP is a set of pictures in the video frame sequence, and a GOP is a group of continuous video frames. Among them, GOP refers to a group of coded pictures starting with an I frame and ending with the next I frame, so the length of GOP is the I frame interval; the first picture of GOP must be an I frame, so that GOP can be decoded independently without reference to other pictures.

[0043] Among them, a GOP can be composed of at least one MiniGOP, and each MiniGOP can adopt a complete hierarchical prediction structure to encode a group of images. A hierarchical prediction structure can contain three types of information: the encoding order of each video frame (or called the encoding sequence), the temporal layer identifier of each video frame (or called the temporal layer number), and the reference video frame of each video frame. The temporal layer identifier of a video frame can be used to identify the encoding quality level of the video frame. The temporal layer identifier of the video frame is negatively correlated with the encoding quality level; the encoding quality level of the video frame indicates the required level of encoding quality of the video frame during the encoding process.

[0044] It should be noted that in the embodiment of the present application, the coding order and the timing layer identifier can be represented by numerical values. For the coding order, the smaller the numerical value corresponding to the coding order of a video frame, the earlier the video frame is encoded; for the timing layer identifier, the smaller the numerical value corresponding to the timing layer identifier of a video frame, the higher the encoding quality level of the video frame.

[0045] For example, the encoding order of a video frame can be represented by a value starting from 0, and as the value increases successively, it indicates that the encoding order of the video frame is later; for example, assuming that the encoding order of a video frame is 0, it means that the video frame is the first video frame to be encoded, and assuming that the encoding order of a video frame is 1, it means that the video frame is the second video frame to be encoded.

[0046] The timing layer identifier of a video frame may also be represented by a value starting from 0, and as the value increases successively, it indicates that the encoding quality level of the video frame is lower; for example, assuming that the timing layer identifier of a video frame is 0, it indicates that the video frame is a video frame of the first highest (i.e., highest) encoding quality level; assuming that the timing layer identifier of a video frame is 1, it indicates that the video frame is a video frame of the second highest encoding quality level.

[0047] In video coding, MiniGOP can refer to a group of coded images in a GOP that use the same prediction structure. The length and structure of MiniGOP are configurable. The length of MiniGOP is generally an integer power of 2, so that a symmetrical hierarchical prediction structure can be used. The length of GOP and MiniGOP can be set, that is, it can be dynamically changed. For example, see Figure 3 As shown, Figure 3 The figure shows a schematic diagram of a MiniGOP length of 4 in a GOP.

[0048] It is understandable that, because the lengths of GOP and MiniGOP can be set, when the length of GOP is not an integer multiple of the length of MiniGOP, some video frames will remain at the end of GOP; for example, assuming that the length of MiniGOP is S, then there may be 1 to S-1 frames remaining at the end of GOP, and the video frames with a length of T (T ranges from 1 to S-1) remaining at the end are incomplete MiniGOP, and this incomplete MiniGOP is the target image group (or tail frame group) of an embodiment of the present application.

[0049] Based on the above description, it can be known that the target video may include a coded picture group, which may include multiple continuous video frames in the target video, and the coded picture group is used to be divided into at least one standard picture group and a target picture group. Among them, the standard picture group and the target picture group can be understood as the above-mentioned complete MiniGOP and incomplete MiniGOP, respectively. In addition, the length of each standard picture group has an exponential relationship with the reference length, and the length of the target picture group does not have an exponential relationship with the reference length; the length of any picture group can be used to represent the number of video frames contained in any picture group. For example, if the length of a picture group is 7, it means that the number of video frames contained in the picture group is 7.

[0050] The reference length may be 2; the exponential relationship between the length of an image group and the reference length may mean that the length of the image group is an integer power of the reference length; that is, it indicates that the length of the image group is an integer power of 2. The fact that the length of each standard image group has an exponential relationship with the reference length may indicate that the length of each standard image group is an integer power of 2, and the fact that the length of the target image group does not have an exponential relationship with the reference length may indicate that the length of the target image group is not an integer power of 2. For example, the length of the standard image group is 32, and the length of the target image group is 23.

[0051] It should be noted that the length of each standard image group may be the same or different, and there is no limitation on this. For example, the length of each standard image group is 4 or 16; for another example, when there are multiple standard image groups, the length of some of the multiple standard image groups is 4, and the length of another part of the standard image groups is 8.

[0052] S202: Generate a group length for a target image group based on a reference length and a target length.

[0053] The target length may refer to the length of the target image group; there is an exponential relationship between the group length and the reference length, and the group length is smaller than the target length; that is, the group length is an integer power of 2.

[0054] As mentioned above, when the length of MiniGOP is an integer power of 2, MiniGOP can use a set of symmetrical hierarchical prediction structures; that is, when constructing the hierarchical prediction structure of MiniGOP, it is constructed when the length of MiniGOP is an integer power of 2. Based on this, it can be known that the hierarchical prediction structure of the target image group can be determined by dividing an image group with a length of an integer power of 2 from the target image group and constructing a hierarchical prediction structure for the image group. Then, the target image group can be grouped to obtain an image group with a length of an integer power of 2 and another image group.

[0055] It should be understood that in the hierarchical prediction structure of the image group, the more time-domain hierarchical levels the image group has, or the more types of temporal hierarchical identifiers, the richer the coding quality levels of each video frame in the image group, and the richer the coding quality levels, the higher the coding effect and coding efficiency of the image group. Among them, the coding effect involves coding quality and accuracy, that is, the more time-domain hierarchical levels the image group has, the higher the coding quality and coding accuracy of the image group.

[0056] It should be understood that the above mentioned temporal layer identifier can be represented by a numerical value, and a type of temporal layer identifier here can be understood as a numerical value corresponding to the temporal layer identifier. For example, assuming that the temporal layer identifier of an image group includes 0, 1, and 2, the type of the temporal layer identifier of the image group is 3; for another example, assuming that the temporal layer identifier of an image group includes 0, 1, 2, and 3, the type of the temporal layer identifier of the image group is 4.

[0057] For example, if the temporal hierarchical level of the GOP is 3, it means that the temporal grouping identifier of the video frames in the GOP can be any one of 0 to 3; for another example, if the temporal hierarchical level of the GOP is 4, it means that the temporal grouping identifier of the video frames in the GOP can be any one of 0 to 4. Based on the above description, it can be seen that the encoding effect and encoding efficiency when the temporal hierarchical level is 3 are lower than the encoding effect and encoding efficiency when the temporal hierarchical level is 4.

[0058] Then, in order to improve the coding effect and coding efficiency, when grouping the target picture group, the length of one picture group in the target picture group can be set to the largest integer power of the reference length (i.e., the value 2) as much as possible, because the larger the integer power, the more time domain grouping levels of the picture group. For example, assuming that the target length is 23, the largest integer power of 2 in the value 23 is 4, and the group length of the target picture group is 2 to the fourth power, that is, the group length is 16.

[0059] In one implementation, the target packet length may be calculated using the following formula (1) or formula (2):

[0060] R=1<<(ceil(log2(end–start))–1) (1)

[0061] R=2 (ceil(log2(end–start))–1) (2)

[0062] Among them, R represents the packet length, "<<" represents left shift, and the left shift here can be understood as left shift on a binary basis; ceil() represents rounding up, end-start represents the length of the image group, end represents the frame number of the last video frame in the image group, and start represents the frame number of the first video frame in the image group. In order to calculate the length of the image group conveniently, the initial value of start can be set to 0. For example, assuming that the length of the target image group is 23, then end is 23, start is 0, and the calculation shows that ceil(log2(end-start))-1 is 4. According to formula (1), it can be seen that the left shift of 4 bits is 16, and according to formula (2), it can be seen that 2 to the power of 4 is 16, that is, the packet length of the target image group with a length of 23 is 16. For another example, assuming that the length of the target image group is 7, the packet length is 4 calculated by formula (1) or formula (2).

[0063] S203, recursively grouping the video frames in the target image group based on the grouping length, and generating encoding indication information of each video frame in the target image group based on the recursive grouping information.

[0064] The recursive grouping information may be used to indicate the recursive grouping level in the process of recursively grouping the video frames in the target group of pictures. The coding indication information may refer to the above-mentioned hierarchical prediction structure, that is, the coding indication information may include the coding order, the temporal hierarchical identifier and the reference video frame.

[0065] In one implementation, the embodiment of the present application can use the principle of recursive binary grouping to recursively binary group the target image group until the length of the image group obtained by grouping the target image group is less than the reference length; that is, recursive binary grouping of the target image group can be used to generate a hierarchical prediction structure.

[0066] Based on this, it can be known that the video frames in the target image group can be grouped based on the grouping length to obtain the first image group and the second image group of the target image group; the length of the first image group has an exponential relationship with the reference length, and the length of the second image group does not have an exponential relationship with the reference length. Further, the first image group and the second image group can be recursively grouped to obtain the encoding indication information of each video frame in the target image group. In one embodiment, the first image group can be recursively grouped based on the reference length to generate a recursive grouping level for each video frame in the first image group, and the second image group can be recursively grouped based on the reference length to generate a recursive grouping level for each video frame in the second image group; then, based on the recursive grouping level of each video frame in the first image group and the recursive grouping level of each video frame in the second image group, the encoding indication information of each video frame in the target image group can be generated.

[0067] As mentioned above, the encoding indication information of each video frame in the target image group may include the temporal layer identifier, encoding order and reference video frame of each video frame in the target image group. In one embodiment, the temporal layer identifier, encoding order and reference video frame of each video frame in the target image group may be determined in the following manner: for the temporal layer identifier of each video frame, the recursive grouping level of each video frame in the first image group may be determined as the temporal layer identifier of each video frame in the first image group, and the recursive grouping level of each video frame in the second image group may be determined as the temporal layer identifier of each video frame in the second image group, thereby obtaining the temporal layer identifier of each video frame in the target video frame. For the encoding order of each video frame, the generation order of the temporal layer identifier of each video frame in the target image group may be determined as the encoding order for each video frame in the target image group. For the reference video frame of each video frame, the reference video frame used for reference encoding of each video frame in the target image group may be determined based on the temporal layer identifier of each video frame in the target image group.

[0068] S204, performing encoding processing on the target image group based on the encoding indication information of each video frame in the target image group to generate encoding data of the target image group.

[0069] In one implementation, each video frame in the target image group can be encoded in the encoding order of each video frame in the target image group and with the reference video frame of each video frame in the target image group as a reference to generate encoding data for each video frame in the target image group; further, the encoding data of each video frame in the target image group can be determined as the encoding data of the target image group.

[0070] In an embodiment of the present application, a recursive grouping method can be used to determine the encoding indication information (hierarchical prediction structure) for the target image group (tail frame group) in the target video frame, and a complete hierarchical prediction structure for the target image group can be obtained. Due to the integrity of the hierarchical prediction structure of each video frame in the target image group (such as the integrity of the reference video frame, etc.), the missing problem (such as the missing problem of the reference video frame) is avoided. When the video frames in the target image group are encoded, the corresponding reference video frames can be used for reference encoding, thereby effectively improving the encoding efficiency of the target image group, and then the encoding efficiency of the entire video encoding can be improved. Encoding the target image group using this complete hierarchical prediction structure can also avoid the missing problem of the reference video frame caused by the target image group directly using the hierarchical prediction structure corresponding to the standard image group, thereby effectively improving the encoding accuracy and then improving the encoding quality.

[0071] Based on the above embodiments, the present application provides another data encoding method, which can be executed by the above-mentioned computer device. Figure 4 , the data encoding method includes but is not limited to the following steps:

[0072] S401, obtaining a target image group of a target video.

[0073] S402: Generate a group length for a target image group based on a reference length and a target length.

[0074] The specific implementation of steps S401-S402 may refer to the specific implementation of steps S201-S202 above, which will not be repeated here.

[0075] S403 , performing grouping processing on the video frames in the target image group based on the grouping length to obtain a first image group and a second image group of the target image group.

[0076] Among them, there is an exponential relationship between the length of the first image group and the reference length, and there is no exponential relationship between the length of the second image group and the reference length; for example, if the reference length is 2, it means that the length of the first image group is an integer power of 2, and the length of the second image group is not an integer power of 2.

[0077] For example, assuming that the length of the target image group is 23 and the group length is 16, the target image group can be divided into a first image group with a length of 16 and a second image group with a length of 7, wherein the frame numbers of the video frames in the first image group are 1 to 16, and the frame numbers of the video frames in the second image group are 17 to 23. The frame number of a video frame is used to indicate the position of the video frame in the target image group, for example, if the frame number of a video frame is 2, it indicates that the video frame is the second video frame in the target image group.

[0078] It can be understood that if the target image group is divided into two image groups based on the grouping length, then determining the grouping length can also be to determine the grouping frame of the target image group. The grouping frame can be understood as the video frame at the grouping position when an image group is divided into two groups, that is, the target image group can be divided into two image groups based on the grouping frame. The grouping frame can also be understood as the splitting center for splitting the image group. Or the grouping center for grouping the image group. Based on the method of determining the grouping length in the above step S202, it can be known that the specific implementation of determining the grouping frame of the target image group can be obtained by the following formula (3) or formula (4):

[0079] mid=1<<(ceil(log2(end–start))–1)(3)

[0080] mid=2 (ceil(log2(end–start))–1) (4)

[0081] Among them, mid represents the frame number corresponding to the packet frame.

[0082] For example, assuming that the length of the target image group is 23, then by calculating from formula (3) or formula (4), it can be known that mid is 16, which means that the video frame with frame number 16 in the target image group (that is, the 16th video frame in the target image group) is the grouped frame.

[0083] S404, recursively grouping the first image group based on the reference length to generate a recursive grouping level for each video frame in the first image group, and recursively grouping the second image group based on the reference length to generate a recursive grouping level for each video frame in the second image group.

[0084] In one implementation, after the target image group is grouped (split) to obtain a first image group and a second image group, the first image group and the second image group need to be recursively binary grouped respectively to obtain encoding indication information for each video frame of the target image group based on the recursive grouping level generated in the recursive binary division process.

[0085] Considering that the principles of recursive binary division of the first image group and the second image group are consistent, the following description of recursive binary division is made by taking any image group in the first image group and the second image group as an example. For the convenience of description, any image group in the first image group and the second image group can be referred to as a transition image group. The transition image group can be used for recursive binary grouping based on a reference length until the length of the image group obtained by grouping the transition image group is less than the reference length, so as to obtain image groups of M grouping levels. Because the reference length is 2, the condition for stopping recursive binary grouping can also be understood as the length of the image group obtained by grouping the transition image group is less than or equal to 1, that is, if the length of the image group obtained by recursive binary grouping is less than or equal to 1, the recursive binary grouping can be stopped.

[0086] In each grouping, it is ensured that the length of the image group arranged on the left is an integer power of 2. Through this operation, the image group arranged on the left can have a relatively complete, full and symmetrical GOP layered structure.

[0087] For example, Figure 5a The structure diagram of recursive grouping is shown when the length of the target image group is 7; wherein the value marked by 51 is the frame number of the video frame in the target image group, and the length marked by 52 is the group length.

[0088] See also Figure 5a As shown, assuming that the length of a target image group is 7 and the grouping length of the target image group is 4, the target image group can be split into: a first image group with a length of 4 and a second image group with a length of 3, and then the first image group with a length of 4 and the second image group with a length of 3 are recursively divided into two groups respectively.

[0089] For the first image group with a length of 4, the image groups obtained by recursively grouping the first image group can be described as follows: for the first image group with a length of 4, the grouping length is 2, then the first image group with a length of 4 can be further divided into two image groups with a length of 2; for the image group with a length of 2, the grouping length is 1, then each image group with a length of 2 can be further divided into two image groups with a length of 1.

[0090] For the second image group with a length of 3, the image groups obtained by recursively grouping the second image group can be described as follows: for the second image group with a length of 3, the grouping length is 2, then the second image group with a length of 3 can be further divided into an image group with a length of 2 and an image group with a length of 1; and an image group with a length of 2 can be further divided into two image groups with a length of 1.

[0091] Another example: Figure 5bThe structure of recursive grouping is shown in FIG. 1 when the length of the target image group is 23; the value marked by 54 is the frame number of the video frame in the target image group, and the length marked by 55 is the group length. Figure 5b As shown, assuming that the length of a target image group is 23 and the grouping length of the target image group is 16, the target image group can be split into a first image group with a length of 16 and a second image group with a length of 7, and then the first image group with a length of 16 and the second image group with a length of 7 are recursively divided into two groups respectively.

[0092] For the first image group with a length of 16, the image groups obtained by recursively grouping the first image group can be described as follows: the grouping length of the first image group with a length of 16 is 8, so the first image group with a length of 16 can be divided into two image groups with a length of 8; the grouping length of the image group with a length of 8 is 4, then each image group with a length of 8 can be further divided into two image groups with a length of 4; and each image group with a length of 4 can be further divided into two image groups with a length of 2; each image group with a length of 2 can be further divided into two image groups with a length of 1.

[0093] For the second image group of length 7, the image groups obtained by recursively grouping the second image group can be described as follows: for the second image group of length 7, the grouping length is 4, so the second image group of length 7 can be divided into an image group of length 4 and an image group of length 3; and the image group of length 4 can be further divided into two image groups of length 2; each image group of length 2 can be further divided into two image groups of length 1. The image group of length 3 can be further divided into one image group of length 2 and one image group of length 1; the image group of length 2 can be further divided into two image groups of length 1.

[0094] Based on the above description, it can be known that, assuming that the grouping level of the target image group is M, the image group of the i-th grouping level among the image groups of the M grouping levels can contain two image groups of the i-1-th grouping level, i is a positive integer less than or equal to M, and M is a positive integer. That is, an image group under each grouping level can be divided again to obtain two image groups of a deeper grouping level. For example, if i is 1, it means that the image group of the first grouping level can contain two image groups of the second grouping level.

[0095] Among them, the grouping level of any image group in the image groups of M grouping levels is equal to N+1, N is the number of recursive groupings for any image group, the recursive grouping level of the grouping frame in the image group of the i-th grouping level is equal to the grouping level i of the image group of the i-th grouping level, and the grouping frame is the video frame at the grouping position when the image group of the i-th grouping level is binary grouped. That is, for the grouping level of the image group of the i-th grouping level, the grouping level can be used to determine the recursive grouping level of the grouping frame used when the image group of the i-th grouping level is binary grouped.

[0096] For example, see Figure 5a As shown, Figure 5a The value marked with 53 is the grouping level. For a target image group with a length of 7, the target image group can be divided into: a first image group with a length of 4 and a second image group with a length of 3 using a grouping length of 4. Because the above description is based on the recursive grouping process of the first image group and the second image group, the first image group with a length of 4 and the second image group with a length of 3 can be understood as: an image group of the first grouping level, and the number of recursive groupings for the first image group with a length of 4 and the second image group with a length of 3 can be understood as 0. Moreover, the grouping frame when the image group of the first grouping level is binary grouped is the 4th video frame, and the recursive grouping level of the 4th video frame is 1.

[0097] Furthermore, taking the first image group of length 4 as an example, this first image group at the first grouping level can be further divided into two image groups of length 2 and grouping level 2; and, the grouping frame when the image group of the second grouping level is grouped into two is the second video frame, and the recursive grouping level of the second video frame is 2. Similarly, taking the second image group of length 3 as an example, this second image group at the first grouping level can be further divided into one image group of length 2 and another image group of length 1, and both of these grouping levels are 2; and, the grouping frame when the image group of the second grouping level is grouped into two is the sixth video frame, and the recursive grouping level of the sixth video frame is 2. By analogy, we can obtain that, Figure 5a As shown, the recursive grouping level of the 1st video frame, the 3rd video frame and the 5th video frame is 3.

[0098] For example, see Figure 5b As shown, Figure 5bThe value marked with 56 is the grouping level. For a target image group with a length of 23, the target image group can be divided into: a first image group with a length of 16 and a second image group with a length of 7 using a grouping length of 16. The first image group with a length of 16 and the second image group with a length of 7 can both be understood as: an image group of the first grouping level, and the number of recursive groupings for the first image group with a length of 16 and the second image group with a length of 7 can be understood as 0. Moreover, the grouping frame when the image group of the first grouping level is binary-grouped is the 16th video frame, and the recursive grouping level of the 16th video frame is 1.

[0099] Furthermore, taking the first image group with a length of 16 as an example, this first image group at the first grouping level can be further divided into two image groups with a length of 8 and a grouping level of 2; and, the grouping frame when the image group at the second grouping level is grouped into two is the 4th video frame, and the recursive grouping level of the 4th video frame is 2. Similarly, taking the second image group with a length of 7 as an example, this second image group at the first grouping level can be further divided into one image group with a length of 4 and another image group with a length of 3, and both of these grouping levels are 2; and, the grouping frame when the image group at the second grouping level is grouped into two is the 20th video frame, and the recursive grouping level of the 20th video frame is 2. By analogy, we can obtain that, Figure 5b As shown, the recursive grouping level of the 4th video frame, the 12th video frame, the 18th video frame and the 18th video frame is 3; the recursive grouping level of the 2nd video frame, the 6th video frame, the 10th video frame, the 14th video frame, the 17th video frame, the 19th video frame and the 21st video frame is 4; the recursive grouping level of the 1st video frame, the 3rd video frame, the 5th video frame, the 7th video frame, the 9th video frame, the 11th video frame, the 13th video frame and the 15th video frame is 5.

[0100] S405 : Generate encoding indication information of each video frame in the target group of images based on the recursive grouping level of each video frame in the first group of images and the recursive grouping level of each video frame in the second group of images.

[0101] In one implementation, the recursive grouping level of each video frame in the first image group can be determined as the temporal layer identifier of each video frame in the first image group; similarly, the recursive grouping level of each video frame in the second image group can be determined as the temporal layer identifier of each video frame in the second image group. For example, taking the first image group as an example, assuming that the recursive grouping level of a certain video frame in the first image group is 2, the temporal layer identifier of the video frame is 2; assuming that the recursive grouping level of a certain video frame in the first image group is 4, the temporal layer identifier of the video frame is 4. For another example, taking the second image group as an example, assuming that the recursive grouping level of a certain video frame in the second image group is 3, the temporal layer identifier of the video frame is 2; assuming that the recursive grouping level of a certain video frame in the second image group is 4, the temporal layer identifier of the video frame is 4.

[0102] For example, see Figure 6a As shown, the length of the target image group is 7. Figure 6a The value marked by 61 in FIG. 1 represents the frame number of the video frame. Figure 5a As can be seen from the described recursive grouping levels of the respective video frames, the temporal hierarchical identifier of each video frame in the target image group can be shown as the value marked 62 .

[0103] For example, see Figure 6b As shown, the length of the target image group is 23. Figure 6b The value marked by 64 in the figure represents the frame number of the video frame. Figure 5b From the described recursive grouping levels of the respective video frames, it can be seen that the temporal hierarchical identifier of each video frame in the target image group can be shown as the value marked with 65.

[0104] After determining the timing layer identifier of each video frame in the first image group and the timing layer identifier of each video frame in the second image group, encoding indication information for each video frame in the target image group can be further generated based on the timing layer identifier of each video frame in the first image group and the timing layer identifier of each video frame in the second image group.

[0105] Optionally, the encoding indication information of each video frame in the target picture group may include: a temporal layer identifier of each video frame in the target picture group.

[0106] Optionally, the coding indication information of each video frame may include the coding order (or coding sequence) of each video frame in addition to the temporal layer identifier of each video frame. The following is an explanation of the determination of the coding order of each video frame.

[0107] It should be understood that video frames of a low coding quality layer can be used as reference video frames of video frames of a high coding quality layer, and the reference video frames are video frames that need to be encoded. In order to ensure that video frames of a low coding quality layer can be used as reference video frames of video frames of a high coding quality layer, video frames of a low coding quality layer can be encoded as early as possible, and video frames of a high coding quality layer can be encoded as late as possible. Then, the generation order of the timing layer identifier of each video frame in the target image group can be determined as the encoding order for each video frame in the target image group. By determining this encoding order, video frames of a low coding quality layer in the target image group can be encoded first. For example, if the generation order of the timing layer identifier of a video frame in the target image group is 5, the encoding order of the video frame can be determined as 5.

[0108] Among them, the generation order of the temporal hierarchical identifier of a video frame may refer to: the order in which the video frame is generated. It should be noted that the temporal hierarchical identifier of the video frame in the image group of each grouping level of the transition image group is generated in sequence according to the grouping level of the image group of each grouping level from small to large and the arrangement position of the image group from left to right. Among them, the two image groups of the i-1th grouping level include: the image group arranged on the left of the i-th grouping level and the image group arranged on the right of the i-th grouping level, that is, the two image groups of one grouping level may include: the image group arranged on the left of a deeper grouping level and the image group arranged on the right of a deeper grouping level. For example, if i is 2, it means that the two image groups of the first grouping level include the image group arranged on the left of the second grouping level and the image group arranged on the right of the second grouping level.

[0109] The generation order of the timing layer identifier of each video frame in the second image group is obtained by accumulating the generation order of the timing layer identifier of the video frames in the first image group. For example, assuming that the generation order of the last generation of the timing layer identifier in the first image group is 4, the generation order of the first video frame generating the timing layer identifier in the second image group is 5 (i.e., 4+1), and the generation order of the second video frame generating the timing layer identifier in the second image group is 6, and so on, the generation order of the timing layer identifier of each video frame in the second image group can be obtained.

[0110] For example, see Figure 6a As shown, Figure 6a The numerical value marked by 63 is the encoding order of each video frame; for example, see Figure 6b As shown, Figure 6b The numerical value marked by 66 is the encoding order of each video frame.

[0111] That is to say, when recursively grouping to determine the temporal hierarchical identifier of the video frame in the image group of each grouping level, the temporal hierarchical identifier of the grouped frame of the image group arranged on the left is determined first each time. After determining the temporal hierarchical identifier of the video frame in the image group of each grouping level, the image group arranged on the left and the image group arranged on the right under this grouping level are respectively regarded as root nodes, and then recursively grouping is performed until the length of the image group arranged on the left and the image group arranged on the right is less than or equal to 1. The order of recursive division is always to process the image group arranged on the left first, and then process the image group arranged on the right. First, the image group arranged on the left is nested layer by layer until it reaches the leaf node, and then the image group arranged on the right is recursively processed layer by layer.

[0112] In one implementation, for the last video frame in the target image group, the temporal layer information of the last video frame in the target image group can be determined as a designated temporal layer identifier and the coding order can be determined as a designated coding order; the designated temporal layer identifier is a temporal layer identifier for identifying the highest coding quality level, and the designated coding order is an order indicating the first coding. For example, the designated temporal layer identifier can be identified by 0, and the designated coding order can also be identified by 0.

[0113] Through this recursive grouping method, the grouping level identifiers of each video frame in the target grouped image can be evenly interspersed as much as possible. When the reference video frame of each video frame is subsequently determined, it can be ensured as much as possible that there are video frames with lower grouping level identifiers than the video frame before and after the video frame. Therefore, the reference video frame of the video frame can be ensured to have a video frame with a lower or the same grouping level identifier, and can also be ensured to be as adjacent as possible to ensure the video encoding effect.

[0114] In one implementation, the above process of determining the grouping level identifier can be understood as a recursive grouping algorithm. In the recursive grouping algorithm,

[0115] It can be understood that when the length of MiniGOP (i.e., standard group of pictures) is S, then 1 to S-1 frames may remain at the end of GOP, and the incomplete MiniGOP with a length of T (T ranges from 1 to S-1) is the target group of pictures of the embodiment of the present application. The following is a method for deriving the coding order and the temporal hierarchical identification in the hierarchical prediction structure of the incomplete MiniGOP (i.e., target group of pictures) with a length of T as follows:

[0116] For aspect description, E represents the encoding order, L represents the temporal hierarchical identifier, and P t ={L,E} means that the temporal layer identifier of the t-th video frame in the target image group is L, and the encoding order is E(0~T-1); where t ranges from 1 to T, and E ranges from 0 to T-1.T ={0,0} is the initial value, that is, the last video frame in the target picture group is always the first encoded and must be an I frame in the hierarchical prediction structure of the target picture group. This I frame is the starting point of the next new GOP, and its time domain layer is always the 0th layer.

[0117] The algorithm logic for determining the coding order and the timing layer identification can be as follows: Figure 7 As shown, Figure 7 The process of how to perform binary recursion (which can be understood as the recursive binary grouping mentioned above) for the target image group to generate a hierarchical prediction structure is specifically demonstrated.

[0118] The algorithm logic can be described as follows: First, find the split position Mid of a certain layer of MiniGOP to be divided, which can be calculated by the above formula (3) or formula 4, that is, each split ensures that the length of the left half (i.e., the image group arranged on the left) is an integer power of 2. The purpose of this is to make it have a relatively complete and full symmetrical GOP hierarchical structure. For example, if the length of the incomplete MiniGOP (i.e., the target image group) is 13, then the target image group can be split into image groups of length 8 and length 5. At each split, the tail frame of the left half obtained by each split (i.e., the last video frame in the image group arranged on the left) is assigned a value, i.e., P end ={L,E}, then the temporal hierarchical identification and coding order of the last frame of the left half obtained by each split can be obtained. After the values ​​are assigned, the left half and the right half of this layer (i.e., the image group arranged on the right) can be used as root nodes respectively, and the recursive division can be repeated until the length of the left half and the right half is less than or equal to 1. The order of division is always the left half first, then the right half. First, let the left half be nested layer by layer until it reaches the leaf node, and then recursively process the right half layer by layer to ensure the logic of the recursive grouping. The corresponding program code can be as follows:

[0119]

[0120]

[0121] Among them, ProcessLeftPart(start,end,L) is used to represent a group of images arranged on the left at a grouping level. The start in ProcessLeftPart() represents the frame number of the first video frame in the group of images arranged on the left at this grouping level, and the end in ProcessLeftPart() represents the frame number of the last video frame in the group of images arranged on the left at this grouping level.

[0122] Among them, ProcessRightPart(start,end,L) represents the representation of the image group arranged on the right at a grouping level, the start in ProcessRightPart() represents the frame number of the first video frame in the image group arranged on the right at this grouping level, and the end in ProcessRightPart() represents the frame number of the last video frame in the image group arranged on the right at this grouping level.

[0123] Among them, for the code segment:

[0124]

[0125]

[0126] This code segment indicates recursive grouping of the image group arranged on the left until the corresponding length of the image group is less than or equal to 1, and assigning a value to the last video frame of the image group arranged on the left in the two image groups obtained by each grouping to determine the encoding order and timing layer identifier of the last video frame of the image group arranged on the left in the two image groups obtained by each grouping.

[0127] For the code snippet:

[0128]

[0129] This code segment indicates recursive grouping of the image group arranged on the right until the corresponding length of the image group is less than or equal to 1, and assigning a value to the last video frame of the image group arranged on the left of the two image groups obtained in each grouping to determine the encoding order and timing layer identifier of the last video frame of the image group arranged on the left of the two image groups obtained in each grouping.

[0130] For the code snippet:

[0131]

[0132] This code segment represents grouping an image group to obtain an image group arranged on the left and an image group arranged on the right, wherein the grouping of the image group is determined by using the split position mid=GetGOPSplitPos(start, end), and the split position may refer to the position of the grouping frame mentioned above.

[0133] For the code snippet:

[0134]

[0135]

[0136] This code segment involves a specific calculation formula for the split position Mid.

[0137] It should be noted that, in order to facilitate the grouping (division) of the image groups, the start of the target image group is set to 0; and when the image groups of a grouping level are grouped to obtain the image groups arranged on the left and the image groups arranged on the right, the frame number of the last video frame of the image group arranged on the left is the same as the frame number of the first video frame of the image group arranged on the right. For example, in the above code segment, the frame number of the last video frame of ProcessLeftPart(start,start+mid,L+1) is expressed as start+mid; the frame number of the first video frame of ProcessRightPart(start+mid,end,L+1) is also expressed as start+mid.

[0138] Regarding the above Figure 7 It can be seen from the algorithm logic shown that the grouping frame of the target image group can be determined based on the above formula (3) or formula (4), and then the target video frame can be grouped for the first time based on the grouping frame to divide the target image group into two image groups, which are the image group arranged on the left (left half) and the image group arranged on the right (right half); and the last video frame of the image group arranged on the left obtained by the division can be assigned a value to determine the encoding order and timing layer identifier of the video frame. When assigning a value to the last video frame in the image group arranged on the left obtained by the first grouping, the encoding order can be set to 1, and the timing layer identifier can be set to 1.

[0139] Among them, the image group arranged on the left here can be understood as the above-mentioned first image group, and the image group arranged on the right can be understood as the above-mentioned second image group; the last video frame of the image group arranged on the left obtained by each division can be understood as the above-mentioned grouping frame.

[0140] Then, the image group arranged on the left can be recursively grouped again until the length corresponding to the image group is less than the reference length, and the last video frame of the image group arranged on the left of the two image groups obtained by each grouping is assigned a value to determine the encoding order and timing layer identifier of the last video frame of the image group arranged on the left of the two image groups obtained by each grouping. The encoding order and timing layer identifier of the last video frame of the image group arranged on the left obtained by each grouping is the encoding order and timing layer identifier of the video frame obtained by the previous grouping plus 1.

[0141] After completing the recursive grouping of the image groups obtained by the first grouping, the image groups arranged on the right corresponding to the image groups arranged on the left obtained by each recursive grouping are recursively grouped in turn in a reverse recursive processing manner, that is, the image groups arranged on the right corresponding to the image groups arranged on the left are recursively processed back layer by layer; and the last video frame of the image group arranged on the left of the two image groups obtained by each division of the image group arranged on the right is assigned a value to determine the encoding order and timing layer identifier of the last video frame of the image group arranged on the left obtained by each division.

[0142] For example, taking the length of the target image group as 7 as an example, the above determination logic can be combined when T=7, and the calling sequence can be as follows:

[0143] ProcessGOP(0,7,0);

[0144] ProcessLeftPart(0,4,1);->P4={1,1}

[0145] ProcessGOP(0,4,1);

[0146] ProcessLeftPart(0,2,2);->P2={2,2}

[0147] ProcessGOP(0,2,2);

[0148] ProcessLeftPart(0,1,3);->P1={3,3} / / Exit and no longer recurse

[0149] ProcessRightPart(1,2,3); / / Exit and no longer recurse

[0150] ProcessRightPart(2,4,2);

[0151] ProcessGOP(2,4,2);

[0152] ProcessLeftPart(2,3,3);->P3={3,4} / / Exit and no longer recurse

[0153] ProcessRightPart(3,4,3); / / Exit and no longer recurse

[0154] ProcessRightPart(4,7,1);

[0155] ProcessGOP(4,7,1);

[0156] ProcessLeftPart(4,6,2);->P6={2,5}

[0157] ProcessGOP(4,6,2);

[0158] ProcessLeftPart(4,5,3);->P5={3,6} / / Exit and no longer recurse

[0159] ProcessRightPart(5,6,3); / / Exit and no longer recurse

[0160] ProcessRightPart(6,7,2); / / Exit and no longer recurse

[0161] Among them, ProcessLeftPart(0,4,1) and ProcessRightPart(4,7,1) represent the image group arranged on the left and the image group arranged on the right obtained by grouping the image group ProcessLeftPart(0,7,0); ProcessLeftPart(0,2,2) and ProcessRightPart(2,4,2) represent the image group arranged on the left and the image group arranged on the right obtained by grouping the image group ProcessLeftPart(0,4,1); ProcessLeftPart(0,1,3) and ProcessRightPart(1,2,3) represent the image group arranged on the left and the image group arranged on the right obtained by grouping the image group ProcessLeftPart(0,2,2). group; ProcessLeftPart(2,3,3) and ProcessRightPart(3,4,3) are the image group arranged on the left and the image group arranged on the right obtained by grouping the image group ProcessRightPart(2,4,2); ProcessLeftPart(4,6,2) and ProcessRightPart(6,7,2) are the image group arranged on the left and the image group arranged on the right obtained by grouping the image group ProcessRightPart(4,7,1); ProcessLeftPart(4,5,3) and ProcessRightPart(5,6,3) are the image group arranged on the left and the image group arranged on the right obtained by grouping the image group ProcessLeftPart(4,6,2).

[0162] Based on the above P4={1,1}, P2={2,2}, P1={3,3}, P3={3,4}, P6={2,5}, P5={3,6} and P7={0,0}, the subscript of P here represents the frame number of the video frame in the target video frame, the first value in P{} represents the temporal layer identifier of the video frame, and the second value in P{} represents the encoding order of the video frame. It can be seen that according to the order of the 7 video frames from first to last in the target video, the temporal layer identifiers of the 7 video frames can be: 3, 2, 3, 1, 3, 2, 0; the encoding order can be: 3, 2, 4, 1, 6, 5, 0. For example, see Figure 6a As shown, Figure 6a The value marked by 62 is the temporal layer identifier corresponding to each video frame, and the value marked by 63 is the encoding order corresponding to each video frame.

[0163] For another example, according to the above algorithm logic, for a target image group with a length of 23, the temporal hierarchical identifier of each video frame in the target image group can be as follows: Figure 6b As shown by the value marked with 65 in FIG. 1 , the encoding order of each video frame can be as follows: Figure 6b As shown by the value marked with 66 in FIG.

[0164] Optionally, the encoding indication information of each video frame may include, in addition to the timing layer identifier and encoding order of each video frame, a reference video frame for reference encoding of each video frame; that is, the encoding indication information of each video frame in the target image group includes the timing layer identifier, encoding order and reference video frame of each video frame in the target image group.

[0165] The following is an explanation of how to determine the reference video frame for each video frame.

[0166] In one embodiment, a reference video frame for reference encoding of each video frame in the target image group can be determined based on the temporal hierarchical identifier of each video frame in the target image group. Considering that the principle of determining the reference video frame of any video frame in the target image group is consistent, the following describes the determination of the reference video frame by taking any video frame in the target image group as an example. For the convenience of description, any video frame in the target image group can be referred to as a target video frame, and the process of determining the reference video frame of the target video frame can be described as follows.

[0167] The reference video frame of the target video frame can be searched in the target image group based on the temporal layer identifier of each video frame in the target image group. As mentioned above, the temporal layer identifier of a video frame can be used to identify the encoding quality level of any video frame, and the temporal layer identifier of any video frame is negatively correlated with the encoding quality level, that is, the lower the temporal layer identifier of a video frame, the higher the encoding quality level of the video frame, that is, the better the encoding effect of the video frame. In order to ensure the encoding effect of the video frame, when selecting a reference video frame for the target video frame, a video frame with better encoding quality can be preferentially selected to improve the encoding quality of the target video frame as much as possible. In addition, the correlation between the target video frame and the adjacent video frame is strong. In the encoding process, the video frame adjacent to the target video frame can also be selected as the reference video frame as much as possible.

[0168] In summary, the reference video frame of the target video frame can be a video frame in the target image group that is adjacent to the target video frame and whose temporal layer identifier is less than or equal to the temporal layer identifier of the target video frame. That is, a video frame that is adjacent to the target video frame and whose temporal layer identifier is less than or equal to the temporal layer identifier of the target video frame can be searched in the target image group, and the reference video frame of the target video frame is determined based on the searched video frame.

[0169] It should also be noted that, because the video frames in the target image group have a corresponding coding order, when encoding, the video frames in the target image group are encoded in sequence according to the coding order, and the reference video frame of a video frame needs to have been encoded; that is, the reference video frame of the target video frame has been encoded, that is, the coding order of the reference video frame is before the coding order of the target video frame. In summary, it can be seen that while ensuring that the reference video frame of the target video frame is: a video frame adjacent to the target video frame and whose timing layer identifier is less than or equal to the timing layer identifier of the target video frame, it is also necessary to ensure that the coding order of the reference video frame is less than the coding order of the target video frame.

[0170] In one implementation, when performing an encoding processing task for a target video, frame information of a reference video frame may be set, and the frame information may include the frame number of the reference video frame or the frame type of the reference video frame; the frame type here may refer to one or more of a forward type and a backward type. If the frame type is a forward type, it indicates that the reference video frame is a forward reference video frame; if the frame type is a backward type, it indicates that the reference video frame is a backward reference video frame; if the frame type is a forward type and a backward type, it indicates that the reference video frame is a forward reference video frame and a backward reference video frame.

[0171] For example, the frame information is set with the frame number for the forward type; or, the frame information is set with the frame number for the backward type; or, the frame information is set with the frame number for the forward type and the frame number for the backward type; or, the frame information is only set with the frame number of the reference video frame. In this case, the frame types can be defaulted to the forward type and the backward type, and the frame numbers of the forward type and the backward type are the set frame numbers.

[0172] Among them, when the frame type is a forward type, the video frame before the target video frame can be searched in a forward search mode; when the frame type is a backward type, the video frame after the target video frame can be searched in a backward search mode.

[0173] Based on the above description, it can be known that, in the case where frame information for a reference video frame is set, based on the temporal hierarchical identifier of each video frame in the target image group, the specific implementation of searching for a reference video frame of a target video frame in the target image group can be: the frame information preset for the reference video frame can be obtained, so as to search for the reference video frame of the target video frame in the target image group based on the frame information and the temporal hierarchical identifier of each video frame in the target image group. The frame information may include the number of frames and the frame type.

[0174] In one embodiment, if the frame type is a forward type, the target video frame is taken as the current video frame, and the video frames before the current video frame are traversed sequentially within the scope of the target image group until the number of video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame reaches that frame number, the traversal operation is stopped, and the video frame whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame is used as the forward reference video frame of the target video frame.

[0175] For example, see Figure 6a As shown, Figure 6a The figure shows the temporal hierarchical identification of each video frame in the target image group when the length of the target image group is 7. Assuming that the target video frame is the 5th video frame, the number of frames is 2, and the frame type is the forward type; then Figure 6a The identified direction is 1, and the target video frame is used as the current video frame, and the search starts frame by frame to obtain the reference video frame of the 5th video frame. It can be seen that the reference video frames of the 5th video frame are the 4th video frame and the 3rd video frame.

[0176] For example, see Figure 6b As shown, Figure 6bThe figure shows the temporal hierarchical identification of each video frame in the target image group when the length of the target image group is 23. Assuming that the target video frame is the 12th video frame, the number of frames is 2, and the frame type is the forward type; then Figure 6b The identified direction is 1, and the target video frame is used as the current video frame, and the search starts frame by frame to obtain the reference video frame of the 12th video frame. It can be seen that the reference video frames of the 12th video frame are the 8th video frame and the 4th video frame.

[0177] In one embodiment, if the frame type is a backward type, the target video frame is taken as the current video frame, and the video frames after the current video frame are traversed sequentially within the scope of the target image group until the number of video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame reaches that frame number, the traversal operation is stopped, and the video frame whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame is used as the backward reference video frame of the target video frame.

[0178] For example, see Figure 6a As shown in FIG. 1 , assuming that the target video frame is the fifth video frame, the number of frames is 2, and the frame type is the backward type; then Figure 6a The identified direction 2 is set, and the target video frame is used as the current video frame, and the search starts frame by frame to obtain the reference video frame of the 5th video frame. It can be seen that the reference video frames of the 5th video frame are the 6th video frame and the 7th video frame.

[0179] For example, see Figure 6b Assume that the target video frame is the 12th video frame, the number of frames is 2, and the frame type is the forward type; then Figure 6b The identified direction 2 is set, and the target video frame is used as the current video frame, and the search starts frame by frame to obtain the reference video frame of the 12th video frame. It can be seen that the reference video frames of the 12th video frame are the 16th video frame and the 23rd video frame.

[0180] In one embodiment, if the frame type is a forward type or a backward type, the target video frame is taken as the current video frame, and the video frames before the current video frame are sequentially traversed within the scope of the target image group until the number of video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame is the number of frames corresponding to the forward type, then the traversal operation is stopped; and the video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame are used as the forward reference video frames of the target video frame. Furthermore, the video frames after the current video frame can be sequentially traversed within the scope of the target image group until the number of video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame is the number of frames corresponding to the backward type, then the traversal operation is stopped, and the video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame are used as the backward reference video frames of the target video frame.

[0181] For example, see Figure 6a As shown, assuming that the target video frame is the 5th video frame, the frame number is 2, and the frame types are forward type and backward type; then the forward reference video frames of the 5th video frame are the 4th video frame and the 3rd video frame, and the backward reference video frames are the 6th video frame and the 7th video frame.

[0182] For example, see Figure 6b As shown, assuming that the target video frame is the 12th video frame, the frame number is 2, and the frame types are forward type and backward type; then the forward reference video frames of the 12th video frame are the 8th video frame and the 4th video frame, and the backward reference video frames are the 16th video frame and the 23rd video frame.

[0183] It should be noted that if, when searching for reference video frames in the target image group, after traversing the video frames in the target image group, the actual number of video frames whose timing layer identifiers are less than or equal to the timing layer identifiers of the target video frames is less than the number of frames in the frame information, the traversal operation can be stopped, and the traversed video frames that meet the conditions can be directly used as reference frames of the target video frames, and the actual number of frames of the reference video frames finally obtained is not limited to the number of frames in the frame information. Among them, the video frames that meet the conditions refer to the video frames whose timing layer identifiers are less than or equal to the timing layer identifiers of the target video frames.

[0184] Alternatively, when the actual number of frames of the forward reference video frame is less than the number of frames in the frame information, video frames can be extracted from the backward reference video frames as the forward reference video frames; and when the actual number of frames of the backward reference video frame is less than the number of frames in the frame information, video frames can be extracted from the forward reference video frames as the backward reference video frames.

[0185] For example, see Figure 6bAs shown, assuming that the target video frame is the 22nd video frame, and the number of backward reference video frames is 2; it is known that, in the backward search, only one backward reference video frame (i.e., the 23rd video frame) can be searched. Then, the reference video frame of the 22nd video frame can directly include the 23rd video frame; or, a frame can be extracted from the forward reference video frame as the backward reference video frame, such as the reference video frame of the 22nd video frame can include the 23rd video frame and the 20th video frame.

[0186] In one implementation, when determining the reference video frame of the target video frame and the frame type is a forward type, in addition to searching in the target image group, the image group arranged to the left of the target image group can also be searched, that is, when the frame type includes a forward type, the target video frame can be taken as the current video frame, and the video frames before the current video frame can be traversed in sequence until the number of video frames whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame is the number of frames corresponding to the forward type, and the traversal operation is stopped; and the video frame whose timing layer identifiers are less than or equal to the timing layer identifier of the target video frame is used as the forward reference video frame of the target video frame.

[0187] In one implementation, when the number of selectable frames of the forward reference video frame or the backward reference video frame is greater than the number of frames in the frame information, the following three types of reference video frames of the reference video frame of the target video frame can be prioritized to improve the encoding quality and encoding efficiency of the video encoding.

[0188] 1) A reference video frame that is closest to the target video frame and has a temporal hierarchical identifier that is 1 less than that of the target video frame;

[0189] 2) a reference video frame that is closest to the target video frame and has the same temporal hierarchical identifier as the target video frame;

[0190] 3) a reference video frame with a temporal layer identifier of 0;

[0191] Among them, for the reference video frame whose timing layer identifier is close to the target video frame, the coding quality level of this reference video frame is not much different from that of the target video frame, that is, when encoding the target video frame, the required level of coding quality is not much different, so when encoding, the encoding can be performed more quickly, so as to ensure the coding quality and improve the coding effect as much as possible. For the reference video frame whose timing layer identifier is 0, although the distance between this reference video frame and the target video frame may be farther, the QP (Quantization Parameter) of this reference video frame is smaller and the coding quality is better. Then, using the video frame with this coding quality number for reference encoding can also improve the coding quality of the target video frame as much as possible.

[0192] In summary, the embodiments of the present application can determine a reference video frame for each video frame in the hierarchical prediction structure of the tail frame group (target image group). Usually, the encoder for encoding the target video is set with the number of reference video frames. If the number of frames is R, the forward reference video frame of each video frame in the tail frame group can be searched frame by frame from the current video frame. When the timing layer identifier of the previous video frame is less than or equal to the timing layer identifier of the current video frame, then the video frame can be used as the forward reference video frame of the current video frame until R reference video frames are obtained. Among them, when searching forward, the search can be performed within the range of the target image group or within the range of all video frames before the current video frame. Similarly, the backward reference video frame can be searched frame by frame from the current video frame. When the timing layer identifier of the subsequent video frame is less than or equal to the timing layer identifier of the current video frame, then the frame can be used as the backward reference video frame of the current video frame. It should be understood that generally, the backward reference video frame only exists in the same MiniGOP, that is, the backward reference video frame search is performed within the scope of the target picture group, and the search can be stopped when the boundary of the backward tail frame group is searched. Because the video frames after the target picture group have not been encoded, that is, there are no encoded video frames, there is no need to search for reference video frames from the video frames after the target picture group.

[0193] S406, performing encoding processing on the target image group based on the encoding indication information of each video frame in the target image group to generate encoding data of the target image group.

[0194] As mentioned above, the encoding indication information of any video frame in the target image group may include the encoding order and reference video frame of the any video frame, and the encoding process of the any video frame may be performed based on the encoding order and reference video frame of the any video frame. Based on this, it can be known that the specific implementation of step S406 may be: according to the encoding order of each video frame in the target image group, and taking the reference video frame of each video frame in the target image group as a reference, encoding process is performed on each video frame in the target image group to generate encoding data of each video frame in the target image group; and then the encoding data of each video frame in the target image group may be determined as the encoding data of the target image group.

[0195] As mentioned above, the encoding indication information of any video frame in the target image group may include the temporal layer identifier of any video frame, and the temporal layer identifier of any video frame is used to identify the encoding quality level of any video frame, and the temporal layer identifier of the video frame is negatively correlated with the encoding quality level; the encoding quality level of the video frame indicates the required level of encoding quality of the video frame during encoding processing. In order to enable each video frame to achieve different encoding quality levels, it is possible to consider using the encoding bit rate to achieve differentiation of the encoding quality level. It should be understood that, for the encoding process of the video frame, the encoding quality of the video frame is positively correlated with the encoding bit rate, that is, the higher the encoding bit rate of a video frame, the better the encoding quality of the video frame, and the lower the encoding bit rate of a video frame, the worse the encoding quality of the video frame.

[0196] Then, for video frames with higher coding quality levels, more coding bit rates can be allocated to them, so that the video frames can be coded with high quality, and then the video frames are high-coding quality video frames to ensure the coding quality of these video frames, and because a faster coding bit rate is used for coding, the coding process of these video frames can also be completed quickly. For video frames with lower coding quality levels, less coding bit rates can be allocated to them, so that the video frames can be coded with low quality, and then the video frames are low-coding quality video frames. Through this processing method, the coding bit rates can be allocated to effectively save the coding bit rates and the data transmission bandwidth; the coding quality of each video frame in the target image group can also be hierarchical, and while ensuring the coding quality of the video frames, the coding speed can also be guaranteed.

[0197] Based on this, it can be known that the specific implementation of step S406 can also be: first, the encoding bit rate of each video frame in the target image group can be determined separately based on the timing layer identifier of each video frame in the target image group. Among them, when determining the encoding bit rate of each video frame in the target image group, the encoding bit rate can be determined (allocated) according to a reference determination rule, and the reference determination rule can be a rule that the encoding quality level identified by the timing layer identifier of the video frame is positively correlated with the encoding bit rate. That is, the higher the encoding quality level identified by the timing layer identifier of the video frame, the higher the encoding bit rate of the video frame; correspondingly, the lower the encoding quality level identified by the timing layer identifier of the video frame, the lower the encoding bit rate of the video frame.

[0198] Then, each video frame in the target image group can be encoded according to the encoding order and encoding bit rate of each video frame in the target image group, and the reference video frame of each video frame in the target image group is used as a reference to generate encoding data for each video frame in the target image group; finally, the encoding data of each video frame in the target image group can be determined as the encoding data of the target image group.

[0199] In one implementation, the target video is divided into GOPs, and a corresponding hierarchical prediction structure is determined for the MiniGOP in the GOP, so that the structure of the video frames in the target video can be made more hierarchical. In practical applications, certain aspects of the video can be processed more flexibly based on the hierarchical prediction structure. For example, in the process of transmitting the encoded data to the decoder for decoding, if the network transmission pressure is large, the frames with higher timing hierarchical identifiers in the encoded data can be dropped, that is, the video frames with lower encoding quality levels can be discarded. For another example, in the process of decoding by the decoder, if the decoding pressure is large, the frames with higher timing hierarchical identifiers in the encoded data can also be dropped, that is, the video frames with lower encoding quality levels can be discarded. This ensures that video frames with higher encoding quality can be retained, thereby ensuring the encoding quality while reducing various pressures (such as transmission pressure or decoding pressure, etc.). For example, in the process of video encoding and decoding, if the encoding bit rate cannot be evenly distributed, the encoding bit rate can be allocated according to the level of the timing layer identifier. For example, the encoding quality level identified by the timing layer identifier of the video frame is positively correlated with the encoding bit rate. This bit rate allocation method can not only improve the encoding efficiency, but also reduce the encoding bit rate and effectively save the transmission data bandwidth.

[0200] In summary, the embodiment of the present application can derive a set of efficient and complete hierarchical prediction structures suitable for the tail frame group of any length for an incomplete MiniGOP (tail frame group), and can realize dynamic adjustment of the hierarchical prediction structure in video coding; and based on this complete hierarchical prediction structure, the coding efficiency and coding quality of the tail frame group can be effectively improved, thereby improving the coding efficiency and coding quality of the entire video coding. In the actual use of the product, the coding bit rate can be allocated through the temporal hierarchical identification in the hierarchical prediction structure, which can also effectively save the coding bit rate, thereby effectively saving the transmission data bandwidth.

[0201] As mentioned above, the encoding data of the target image group in the target video can be obtained through step S406. It can be understood that for the complete target video, the target video also includes a standard image group. In order to obtain the complete encoding data of the target video, the encoding data of the standard image group in the target video can be further obtained to generate the encoding data of the target video from the encoding data of the standard image group and the encoding data of the target image group.

[0202] Based on this, it can be seen that in one implementation method, in addition to obtaining the encoding data of the target image group in the target video through the above method, the encoding data of each standard image group in at least one standard image group in the target video can also be obtained; and then the encoding data of each standard image group and the encoding data of the target image group can be combined and processed to generate the encoding data of the target video.

[0203] Optionally, the specific implementation of obtaining the coded data of each standard image group may be: first, the coding indication information of each standard image group may be obtained; wherein, the method for determining the coding indication information of each standard image group may be similar to the principle of the method for determining the coding indication information of the first image group described above. Then, based on the coding indication information of each standard image group, each standard image group may be coded separately to generate the coded data of each standard image group. The coding process of any standard image group is consistent with the principle of the coding process of the target image group mentioned above, and the coding process of the standard image group will not be described in detail here.

[0204] In a specific application scenario, after the target video encoding data is generated, the target video encoding data can also be decoded so that the decoded target video can be played. Based on this, in one implementation, the target video encoding data can be sent to a video client, so that the video client decodes the target video encoding data to obtain the target video; and after obtaining the target video, the video client can also play the target video.

[0205] It should be noted that the target video obtained by the decoding process here may be consistent with or different from the target video before the encoding process. In one embodiment, in the scenario of lossless compression, since lossless compression can achieve the purpose of complete restoration, the target video obtained by the decoding process is consistent with the target video before the encoding process. In the scenario of lossy compression, since some information will be lost in the compression process, the original data cannot be completely restored during the decoding process, that is, the target video obtained by the decoding process cannot be completely restored to the target video before the encoding process; then, there are usually some differences between the target video obtained by the decoding process and the target video before the encoding process. These differences may be differences in video clarity or video color, such as the video clarity of the target video obtained by the decoding process is worse than the video clarity of the target video before the encoding process.

[0206] In an embodiment of the present application, a recursive grouping method can be used to determine the encoding indication information (hierarchical prediction structure) for the target image group (tail frame group) in the target video frame, and a complete hierarchical prediction structure for the target image group can be obtained. Due to the integrity of the hierarchical prediction structure of each video frame in the target image group (such as the integrity of the reference video frame, etc.), the missing problem (such as the missing problem of the reference video frame) is avoided. When the video frames in the target image group are encoded, the corresponding reference video frames can be used for reference encoding, thereby effectively improving the encoding efficiency of the target image group, and then the encoding efficiency of the entire video encoding can be improved. Encoding the target image group using this complete hierarchical prediction structure can also avoid the missing problem of the reference video frame caused by the target image group directly using the hierarchical prediction structure corresponding to the standard image group, thereby effectively improving the encoding accuracy and then improving the encoding quality.

[0207] Moreover, by determining the hierarchical prediction structure by recursive grouping, the temporal hierarchical identifiers of each video frame in the target image group can be interspersed more evenly, that is, it is possible to ensure that for each video frame, there are video frames with lower temporal hierarchical identifiers than the video frame before and after the video frame; and, based on the generation order of the temporal hierarchical identifier of each video frame in the target image group, the encoding order for each video frame in the target image group is determined respectively, which can also ensure that the video frame with lower temporal hierarchical identifier can be encoded first; thus, when determining the reference video frame of a video frame, the video frame with a temporal hierarchical identifier less than or equal to the temporal hierarchical identifier of the video frame can be determined from the adjacent video frames, and these video frames can be used as reference video frames. A temporal hierarchical identifier can be used to identify the encoding quality level of the video frame, and the temporal hierarchical identifier of the video frame is negatively correlated with the encoding quality level. Therefore, for a video frame, when determining the video frame, a video frame with the same or higher encoding quality level can be used for reference encoding, thereby effectively improving the encoding effect.

[0208] See also Figure 8 , is a schematic diagram of the structure of a data encoding device provided in an embodiment of the present application. The data encoding device described in this embodiment includes:

[0209] The acquisition unit 801 is used to acquire a target picture group of a target video; the target video includes a coded picture group, the coded picture group includes a plurality of continuous video frames in the target video, the coded picture group is used to be divided into at least one standard picture group and a target picture group, the length of each standard picture group has an exponential relationship with the reference length, the length of the target picture group does not have an exponential relationship with the reference length, and the length of any picture group is used to represent the number of video frames included in the any picture group;

[0210] A generating unit 802 is used to generate a packet length for a target image group based on a reference length and a target length; the target length refers to the length of the target image group, the packet length has an exponential relationship with the reference length, and the packet length is less than the target length;

[0211] A grouping unit 803 is used to recursively group the video frames in the target image group based on the grouping length, and generate encoding indication information of each video frame in the target image group based on the recursive grouping information; the recursive grouping information is used to indicate the recursive grouping level in the process of recursively grouping the video frames in the target image group;

[0212] The encoding unit 804 is used to perform encoding processing on the target image group based on the encoding indication information of each video frame in the target image group to generate encoding data of the target image group.

[0213] In one implementation, the grouping unit 803 is specifically configured to:

[0214] The video frames in the target image group are grouped based on the grouping length to obtain a first image group and a second image group of the target image group; the length of the first image group has an exponential relationship with the reference length, and the length of the second image group does not have an exponential relationship with the reference length;

[0215] Recursively grouping the first image group based on the reference length to generate a recursive grouping level for each video frame in the first image group, and recursively grouping the second image group based on the reference length to generate a recursive grouping level for each video frame in the second image group;

[0216] Based on the recursive grouping level of each video frame in the first group of images and the recursive grouping level of each video frame in the second group of images, encoding indication information of each video frame in the target group of images is generated.

[0217] In one implementation, any one of the first image group and the second image group is a transition image group, and the transition image group is used for recursive binary grouping based on a reference length until the length of an image group obtained by grouping the transition image group is less than the reference length, so as to obtain image groups of M grouping levels; an image group of the i-th grouping level among the image groups of the M grouping levels includes two image groups of the i-1-th grouping level, where i is a positive integer less than or equal to M, and M is a positive integer;

[0218] The grouping level of any image group in the image groups of M grouping levels is equal to N+1, N is the number of recursive groupings for any image group, the recursive grouping level of the grouping frame in the image group of the i-th grouping level is equal to the grouping level i of the image group of the i-th grouping level, and the grouping frame is the video frame at the grouping position when the image group of the i-th grouping level is binary grouped.

[0219] In one implementation, the grouping unit 803 is specifically configured to:

[0220] The recursive grouping level of each video frame in the first image group is respectively determined as the temporal layer identifier of each video frame in the first image group; the temporal layer identifier of any video frame is used to identify the encoding quality level of any video frame, and the temporal layer identifier of any video frame is negatively correlated with the encoding quality level;

[0221] Determining the recursive grouping level of each video frame in the second group of images as a temporal hierarchical identifier of each video frame in the second group of images;

[0222] Based on the temporal layer identifier of each video frame in the first group of pictures and the temporal layer identifier of each video frame in the second group of pictures, encoding indication information of each video frame in the target group of pictures is generated.

[0223] In one implementation, the temporal hierarchical identifiers of the video frames in the image groups of each grouping level of the transition image group are generated in sequence according to the order of the grouping levels of the image groups of each grouping level from small to large and the arrangement positions of the image groups from left to right, and the two image groups of the i-1th grouping level include the image group arranged on the left of the i-th grouping level and the image group arranged on the right of the i-th grouping level; the generation order of the temporal hierarchical identifier of each video frame in the second image group is accumulated on the generation order of the temporal hierarchical identifiers of the video frames in the first image group; the grouping unit 803 is specifically used to:

[0224] Determining the generation order of the temporal hierarchical identifier of each video frame in the target picture group as the encoding order for each video frame in the target picture group;

[0225] Determining a reference video frame for reference encoding each video frame in the target group of pictures based on the temporal hierarchical identifier of each video frame in the target group of pictures;

[0226] The coding indication information of each video frame in the target picture group includes the temporal layer identifier, coding order and reference video frame of each video frame in the target picture group.

[0227] In one implementation, any video frame in the target image group is a target video frame; the grouping unit 803 is specifically configured to:

[0228] Based on the temporal hierarchical identification of each video frame in the target image group, searching for a reference video frame of the target video frame in the target image group;

[0229] The reference video frame of the target video frame is a video frame in the target image group that is adjacent to the target video frame and has a temporal hierarchy identifier that is less than or equal to the temporal hierarchy identifier of the target video frame.

[0230] In one implementation, the encoding indication information of any video frame in the target picture group includes the encoding order, the temporal layer identifier and the reference video frame of the any video frame, and the temporal layer identifier of the any video frame is used to identify the encoding quality level of the any video frame; the encoding unit 804 is specifically used to:

[0231] Determine the encoding bit rate of each video frame in the target image group based on the temporal hierarchical identifier of each video frame in the target image group;

[0232] According to the encoding order and encoding bit rate of each video frame in the target image group, and taking the reference video frame of each video frame in the target image group as a reference, encoding each video frame in the target image group is processed to generate encoding data of each video frame in the target image group;

[0233] The coded data of each video frame in the target image group is determined as the coded data of the target image group.

[0234] In one implementation, the encoding unit 804 is further configured to:

[0235] Obtaining encoded data for each standard group of pictures;

[0236] The coded data of each standard picture group and the coded data of the target picture group are combined to generate the coded data of the target video.

[0237] In one implementation, the encoding unit 804 is further configured to:

[0238] The encoded data of the target video is sent to the video client, so that the video client decodes the encoded data of the target video to obtain the target video, and plays the target video.

[0239] It is understood that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. The functional units in the embodiments of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of software functional units.

[0240] See also Fig. 9 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device described in this embodiment includes: a processor 901, a memory 902, and a network interface 903. The processor 901, the memory 902, and the network interface 903 can exchange data.

[0241] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0242] The memory 902 may include a read-only memory and a random access memory, and provide program instructions and data to the processor 901. A portion of the memory 902 may also include a non-volatile random access memory. When the processor 901 calls the program instructions, it is used to execute:

[0243] Acquire a target image group of a target video; the target video includes a coded image group, the coded image group includes a plurality of continuous video frames in the target video, the coded image group is used to be divided into at least one standard image group and the target image group, the length of each standard image group has an exponential relationship with a reference length, the length of the target image group does not have an exponential relationship with the reference length, and the length of any image group is used to represent the number of video frames included in the any image group;

[0244] Based on the reference length and the target length, generating a group length for the target image group; the target length refers to the length of the target image group, the group length has an exponential relationship with the reference length, and the group length is less than the target length;

[0245] recursively grouping the video frames in the target image group based on the grouping length, and generating encoding indication information of each video frame in the target image group based on recursive grouping information; the recursive grouping information is used to indicate a recursive grouping level in the process of recursively grouping the video frames in the target image group;

[0246] Based on the encoding indication information of each video frame in the target image group, the target image group is encoded to generate encoding data of the target image group.

[0247] In one implementation, the processor 901 is specifically configured to:

[0248] The video frames in the target image group are grouped based on the grouping length to obtain a first image group and a second image group of the target image group; the length of the first image group has an exponential relationship with the reference length, and the length of the second image group does not have an exponential relationship with the reference length;

[0249] Recursively grouping the first image group based on the reference length to generate a recursive grouping level for each video frame in the first image group, and recursively grouping the second image group based on the reference length to generate a recursive grouping level for each video frame in the second image group;

[0250] Based on the recursive grouping level of each video frame in the first group of images and the recursive grouping level of each video frame in the second group of images, encoding indication information of each video frame in the target group of images is generated.

[0251] In one implementation, any one of the first image group and the second image group is a transition image group, and the transition image group is used for recursive binary grouping based on a reference length until the length of an image group obtained by grouping the transition image group is less than the reference length, so as to obtain image groups of M grouping levels; an image group of the i-th grouping level among the image groups of the M grouping levels includes two image groups of the i-1-th grouping level, where i is a positive integer less than or equal to M, and M is a positive integer;

[0252] The grouping level of any image group in the image groups of M grouping levels is equal to N+1, N is the number of recursive groupings for any image group, the recursive grouping level of the grouping frame in the image group of the i-th grouping level is equal to the grouping level i of the image group of the i-th grouping level, and the grouping frame is the video frame at the grouping position when the image group of the i-th grouping level is binary grouped.

[0253] In one implementation, the processor 901 is specifically configured to:

[0254] The recursive grouping level of each video frame in the first image group is respectively determined as the temporal layer identifier of each video frame in the first image group; the temporal layer identifier of any video frame is used to identify the encoding quality level of any video frame, and the temporal layer identifier of any video frame is negatively correlated with the encoding quality level;

[0255] Determining the recursive grouping level of each video frame in the second group of images as a temporal hierarchical identifier of each video frame in the second group of images;

[0256] Based on the temporal layer identifier of each video frame in the first group of pictures and the temporal layer identifier of each video frame in the second group of pictures, encoding indication information of each video frame in the target group of pictures is generated.

[0257] In one implementation, the temporal hierarchical identifiers of the video frames in the image groups of each grouping level of the transition image group are generated in sequence according to the order of the grouping levels of the image groups of each grouping level from small to large and the arrangement positions of the image groups from left to right, and the two image groups of the i-1th grouping level include the image group arranged on the left of the i-th grouping level and the image group arranged on the right of the i-th grouping level; the generation order of the temporal hierarchical identifier of each video frame in the second image group is accumulated on the generation order of the temporal hierarchical identifiers of the video frames in the first image group; the processor 901 is specifically used to:

[0258] Determining the generation order of the temporal hierarchical identifier of each video frame in the target picture group as the encoding order for each video frame in the target picture group;

[0259] Determining a reference video frame for reference encoding each video frame in the target group of pictures based on the temporal hierarchical identifier of each video frame in the target group of pictures;

[0260] The coding indication information of each video frame in the target picture group includes the temporal layer identifier, coding order and reference video frame of each video frame in the target picture group.

[0261] In one implementation, any video frame in the target image group is a target video frame; the processor 901 is specifically configured to:

[0262] Based on the temporal hierarchical identification of each video frame in the target image group, searching for a reference video frame of the target video frame in the target image group;

[0263] The reference video frame of the target video frame is a video frame in the target image group that is adjacent to the target video frame and has a temporal hierarchy identifier that is less than or equal to the temporal hierarchy identifier of the target video frame.

[0264] In one implementation, the encoding indication information of any video frame in the target picture group includes the encoding order, the temporal layer identifier and the reference video frame of the any video frame, and the temporal layer identifier of the any video frame is used to identify the encoding quality level of the any video frame; the processor 901 is specifically configured to:

[0265] Determine the encoding bit rate of each video frame in the target image group based on the temporal hierarchical identifier of each video frame in the target image group;

[0266] According to the encoding order and encoding bit rate of each video frame in the target image group, and taking the reference video frame of each video frame in the target image group as a reference, encoding each video frame in the target image group is processed to generate encoding data of each video frame in the target image group;

[0267] The coded data of each video frame in the target image group is determined as the coded data of the target image group.

[0268] In one implementation, the processor 901 is further configured to:

[0269] Obtaining encoded data for each standard group of pictures;

[0270] The coded data of each standard picture group and the coded data of the target picture group are combined to generate the coded data of the target video.

[0271] In one implementation, the processor 901 is further configured to:

[0272] The encoded data of the target video is sent to the video client, so that the video client decodes the encoded data of the target video to obtain the target video, and plays the target video.

[0273] The present application also provides a computer storage medium in which program instructions are stored. When the program instructions are executed, the following may be included: Figure 2 or Figure 4 Part or all of the steps of the data encoding method in the corresponding embodiment.

[0274] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0275] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0276] The embodiment of the present application also provides a computer program product or computer program, which includes program instructions, and the program instructions are stored in a computer-readable storage medium. The processor of the computer device reads the program instructions from the computer-readable storage medium, and the processor executes the program instructions, so that the computer device executes the steps performed in the embodiments of the above methods.

[0277] The above is a detailed introduction to a data encoding method, device, computer equipment, medium and product provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data encoding method, characterized in that: The method comprises: Acquire a target image group of a target video; the target video includes a coded image group, the coded image group includes a plurality of continuous video frames in the target video, the coded image group is used to be divided into at least one standard image group and the target image group, the length of each standard image group has an exponential relationship with a reference length, the length of the target image group does not have an exponential relationship with the reference length, and the length of any image group is used to represent the number of video frames included in the any image group; Based on the reference length and the target length, generating a group length for the target image group; the target length refers to the length of the target image group, the group length has an exponential relationship with the reference length, and the group length is less than the target length; recursively grouping the video frames in the target image group based on the grouping length, and generating encoding indication information of each video frame in the target image group based on recursive grouping information; the recursive grouping information is used to indicate a recursive grouping level in the process of recursively grouping the video frames in the target image group; Based on the encoding indication information of each video frame in the target image group, the target image group is encoded to generate encoding data of the target image group.

2. The method according to claim 1, characterized in that: The recursive grouping of the video frames in the target group of images based on the grouping length, and generating encoding indication information of each video frame in the target group of images based on the recursive grouping information, comprises: The video frames in the target image group are grouped based on the grouping length to obtain a first image group and a second image group of the target image group; the length of the first image group has an exponential relationship with the reference length, and the length of the second image group has no exponential relationship with the reference length; recursively grouping the first image group based on the reference length to generate a recursive grouping level for each video frame in the first image group, and recursively grouping the second image group based on the reference length to generate a recursive grouping level for each video frame in the second image group; Based on the recursive grouping level of each video frame in the first group of images and the recursive grouping level of each video frame in the second group of images, encoding indication information of each video frame in the target group of images is generated.

3. The method according to claim 2, characterized in that Any one of the first image group and the second image group is a transition image group, and the transition image group is used for recursively performing binary grouping based on the reference length until the length of an image group obtained by grouping the transition image group is less than the reference length, so as to obtain image groups of M grouping levels; The image group of the i-th grouping level among the M grouping levels of image groups includes two image groups of the i-1-th grouping level, where i is a positive integer less than or equal to M, and M is a positive integer; The grouping level of any image group in the M grouping levels of image groups is equal to N+1, N is the number of recursive groupings for any image group, the recursive grouping level of the grouping frame in the image group of the i-th grouping level is equal to the grouping level i of the image group of the i-th grouping level, and the grouping frame is the video frame at the grouping position when the image group of the i-th grouping level is binary grouped.

4. The method according to claim 3, characterized in that The generating, based on the recursive grouping level of each video frame in the first group of images and the recursive grouping level of each video frame in the second group of images, encoding indication information of each video frame in the target group of images includes: The recursive grouping level of each video frame in the first image group is determined as the temporal layer identifier of each video frame in the first image group; the temporal layer identifier of any video frame is used to identify the coding quality level of any video frame, and the temporal layer identifier of any video frame is negatively correlated with the coding quality level; Determining the recursive grouping level of each video frame in the second group of images as the temporal hierarchical identifier of each video frame in the second group of images; Based on the temporal layer identifier of each video frame in the first image group and the temporal layer identifier of each video frame in the second image group, encoding indication information of each video frame in the target image group is generated.

5. The method according to claim 4, characterized in that The temporal hierarchical identifiers of the video frames in the image groups of each grouping level of the transition image group are generated in sequence according to the order of the grouping levels of the image groups of each grouping level from small to large and the arrangement positions of the image groups from left to right, and the two image groups of the i-1th grouping level include the image group arranged on the left of the i-th grouping level and the image group arranged on the right of the i-th grouping level; the generation order of the temporal hierarchical identifier of each video frame in the second image group is obtained by accumulating the generation order of the temporal hierarchical identifiers of the video frames in the first image group; The generating, based on the temporal layer identifier of each video frame in the first group of images and the temporal layer identifier of each video frame in the second group of images, encoding indication information of each video frame in the target group of images comprises: Determining the generation order of the temporal hierarchical identifier of each video frame in the target picture group as the encoding order for each video frame in the target picture group; Determining, based on the temporal hierarchical identifier of each video frame in the target group of pictures, a reference video frame for reference encoding each video frame in the target group of pictures; The encoding indication information of each video frame in the target picture group includes a temporal layer identifier, an encoding order and a reference video frame of each video frame in the target picture group.

6. The method according to claim 5, characterized in that Any video frame in the target image group is a target video frame; based on the temporal hierarchical identifier of each video frame in the target image group, determining a reference video frame for reference encoding each video frame in the target image group includes: Based on the temporal hierarchical identifier of each video frame in the target image group, searching for a reference video frame of the target video frame in the target image group; The reference video frame of the target video frame is a video frame in the target image group that is adjacent to the target video frame and has a temporal layer identifier that is less than or equal to the temporal layer identifier of the target video frame.

7. The method according to claim 1, characterized in that The encoding indication information of any video frame in the target image group includes the encoding order, the temporal layer identifier and the reference video frame of the any video frame, and the temporal layer identifier of the any video frame is used to identify the encoding quality level of the any video frame; The step of encoding the target image group based on the encoding indication information of each video frame in the target image group to generate the encoded data of the target image group includes: Determining the encoding bit rate of each video frame in the target image group based on the temporal hierarchical identifier of each video frame in the target image group; According to the encoding order and encoding bit rate of each video frame in the target image group, and taking the reference video frame of each video frame in the target image group as a reference, encoding each video frame in the target image group is processed to generate encoding data of each video frame in the target image group; The coded data of each video frame in the target image group is determined as the coded data of the target image group.

8. The method according to claim 1, characterized in that The method further comprises: Obtaining the encoded data of each standard picture group; The coded data of each standard picture group and the coded data of the target picture group are combined to generate the coded data of the target video.

9. The method according to claim 8, characterized in that The method further comprises: The encoded data of the target video is sent to a video client, so that the video client decodes the encoded data of the target video to obtain the target video, and plays the target video.

10. A data encoding device, characterized in that: include: An acquisition unit, used for acquiring a target image group of a target video; The target video includes a coded picture group, the coded picture group includes a plurality of continuous video frames in the target video, the coded picture group is used to be divided into at least one standard picture group and the target picture group, the length of each standard picture group has an exponential relationship with a reference length, the length of the target picture group does not have an exponential relationship with the reference length, and the length of any picture group is used to represent the number of video frames included in the any picture group; a generating unit, configured to generate a packet length for the target image group based on the reference length and a target length; the target length refers to the length of the target image group, the packet length has an exponential relationship with the reference length, and the packet length is smaller than the target length; a grouping unit, configured to perform recursive grouping processing on the video frames in the target image group based on the grouping length, and generate encoding indication information of each video frame in the target image group based on the recursive grouping information; The recursive grouping information is used to indicate a recursive grouping level in a process of recursively grouping video frames in the target group of pictures; The encoding unit is used to perform encoding processing on the target image group based on the encoding indication information of each video frame in the target image group to generate encoding data of the target image group.

11. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and when the program instructions are executed, they are used to implement the method according to any one of claims 1 to 9.

13. A computer program product or a computer program, comprising program instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.