A frame layered parallel encoding method and related device

CN116112665BActive Publication Date: 2026-10-20PENG CHENG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310116993.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-30
Publication Date
2026-10-20
Estimated Expiration
2043-01-30

AI Technical Summary

Technical Problem

然而,在并行多帧编码中存在帧间相互参考,RA模型中的编码顺序会存在大量的帧要等上面层的参考帧编好后才能编码,不然会有部分帧被阻塞,特别是在跨GOP编码时,阻塞情况会更加明显,进行会影响多线程帧级编码效率

Benefits of technology

[0030]有益效果:与现有技术相比,本申请提供了一种帧分层并行编码方法及相关装置,所述方法包括将待编码GOP中的图像帧按照其所处编码层由下向上的顺序进行排序,以确定待编码GOP对应的编码顺序;按照所述编码顺序对所述待编码GOP中的图像帧进行编码。本申请在不改变RA模型的编码结构的情况下,通过将待编码GOP中的图像帧按照其所处编码层由下向上的顺序进行排序的方式来避免大量的帧要等参考帧编好后才能编码的问题,使得编码效率在多线程并行编码时有显著提升。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116112665B_ABST
    Figure CN116112665B_ABST
Patent Text Reader

Abstract

The application discloses a frame layering parallel encoding method and a related device. The method comprises the following steps: arranging image frames in a to-be-encoded GOP in a sequence from lower to upper according to the encoding layers of the image frames, so as to determine an encoding sequence corresponding to the to-be-encoded GOP; and encoding the image frames in the to-be-encoded GOP according to the encoding sequence. The application avoids the problem that a large number of frames cannot be encoded until reference frames are encoded by arranging the image frames in the to-be-encoded GOP in a sequence from lower to upper according to the encoding layers of the image frames, so that the encoding efficiency is significantly improved in multi-thread parallel encoding.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video image coding technology, and in particular to a frame-layered parallel coding method and related apparatus. Background Technology

[0002] In Random Access (RA) coding mode, the coding reference relationship is hierarchical. A Group of Pictures (GOP) is divided into 5 layers from top to bottom, with the 5th layer being the top layer and the 1st layer being the bottom layer. The encoded frames within a GOP are arranged in a binary tree structure, and the preorder traversal of the binary tree structure is used as the coding order. However, in parallel multi-frame coding, there are inter-frame references. In the RA model, a large number of frames cannot be encoded until the reference frames of the upper layers are completed; otherwise, some frames will be blocked. This blocking is particularly pronounced when coding across GOPs, impacting the efficiency of multi-threaded frame-level coding.

[0003] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention

[0004] The technical problem to be solved by this application is to provide a frame layered parallel coding method and related apparatus to address the shortcomings of the existing technology.

[0005] To address the aforementioned technical problems, a first aspect of this application provides a frame-layered parallel coding method, the method comprising:

[0006] The image frames in the GOP to be encoded are sorted from bottom to top according to their coding layers to determine the coding order corresponding to the GOP to be encoded.

[0007] The image frames in the GOP to be encoded are encoded according to the encoding order.

[0008] The frame-layered parallel coding method, wherein sorting the image frames in the GOP to be encoded according to their coding layer from bottom to top to determine the coding order corresponding to the GOP to be encoded specifically includes:

[0009] The bottom coding layer is selected in order from bottom to top, and a coding sequence number is set for the image frames in the bottom coding layer. The coding sequence numbers of the image frames in the same coding layer are the same.

[0010] This process continues until the image frames in the topmost coding layer are assigned coding numbers. In any two adjacent coding layers, the coding number of the image frame in the upper coding layer is greater than the coding number of the image frame in the lower coding layer.

[0011] The image frames in a Group of Pictures (GOPs) are sorted in ascending order of their encoding sequence numbers to obtain the encoding order corresponding to the GOP to be encoded.

[0012] The frame-layered parallel coding method, wherein before encoding the image frames in the GOP according to the coding order, the method further includes:

[0013] Obtain the I-frame corresponding to the GOP and encode the I-frame.

[0014] The frame-layered parallel coding method further includes:

[0015] When encoding across GOPs, obtain the GOP arrangement order corresponding to each GOP in the cross-GOP encoding, where the I-frames corresponding to each GOP are the same;

[0016] The GOPs are merged according to the GOP arrangement order to obtain the GOP to be encoded.

[0017] The frame-layered parallel coding method, wherein merging the GOPs according to their arrangement order to obtain the GOP to be encoded specifically includes:

[0018] For each coding layer in the first GOP in the GOP arrangement, a corresponding candidate coding layer is selected from the GOPs following the first GOP, and the candidate coding layer is merged into the coding layer. The difference between the layer number of the coding layer and the layer number of the candidate coding layer is equal to the difference between the GOP arrangement order of the candidate coding layer and the GOP arrangement order of the coding layer.

[0019] For each coding layer in the second-ranked GOP that is not a candidate coding layer, the process of selecting its corresponding candidate coding layer from each GOP following the GOP is repeated until the last GOP is obtained, to obtain the GOP to be encoded.

[0020] In the frame-layered parallel coding method, when encoding image frames in the GOP according to the coding order, image frames with the same coding sequence number are encoded in parallel.

[0021] The frame-layered parallel coding method further includes:

[0022] When encoding across multiple I-frame periods, for each I-frame period, the image frames in the GOP to be encoded are sorted in order from bottom to top according to their coding layer to determine the coding order of the GOP to be encoded; and the image frames in the GOP to be encoded are encoded according to the coding order to perform parallel encoding of multiple I-frame periods.

[0023] A second aspect of this application provides a frame-layered parallel coding system, the system comprising:

[0024] The sorting module is used to sort the image frames in the GOP to be encoded in order from bottom to top according to their coding layer, so as to determine the coding order corresponding to the GOP to be encoded.

[0025] An encoding module is used to encode the image frames in the GOP to be encoded according to the encoding order.

[0026] A third aspect of this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in any of the frame layered parallel coding methods described above.

[0027] A fourth aspect of this application provides a terminal device, which includes: a processor, a memory, and a communication bus; the memory stores a computer-readable program that can be executed by the processor;

[0028] The communication bus enables communication between the processor and the memory;

[0029] When the processor executes the computer-readable program, it implements the steps in any of the frame layered parallel coding methods described above.

[0030] Beneficial Effects: Compared with existing technologies, this application provides a frame-layered parallel coding method and related apparatus. The method includes sorting image frames in a Group of Pictures (GOPs) to be encoded according to their coding layers from bottom to top to determine the coding order corresponding to the GOP; and encoding the image frames in the GOP according to the coding order. Without changing the coding structure of the Relational Animation (RA) model, this application avoids the problem of a large number of frames having to wait for reference frames to be encoded before they can be encoded by sorting the image frames in the GOP according to their coding layers from bottom to top, thus significantly improving coding efficiency in multi-threaded parallel coding. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram of a GOP.

[0033] Figure 2This is a flowchart of the frame layered parallel coding method provided in this embodiment.

[0034] Figure 3 A schematic diagram of the parallel distribution formed by multiple GOPs.

[0035] Figure 4 This is a schematic diagram of the parallel distribution formed by multiple I-frame periods.

[0036] Figure 5 This is a schematic diagram of the frame layered parallel coding system provided in this embodiment.

[0037] Figure 6 A schematic diagram of the terminal device provided in this application. Detailed Implementation

[0038] This application provides a frame-layered parallel coding method and related apparatus. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.

[0039] Those skilled in the art will understand that, unless explicitly stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application’s specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0040] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0041] It should be understood that the sequence number and size of each step in this embodiment do not imply the order of execution. The execution order of each process is determined by its function and internal logic, and should not constitute any limitation on the implementation process of this application embodiment.

[0042] The inventors discovered through research that in the Random Access (RA) coding mode, the coding reference relationship is hierarchical. A Group of Pictures (GOP) is divided into 5 layers from top to bottom, with the 5th layer being the top layer and the 1st layer being the bottom layer. The encoded frames in a GOP are arranged in a binary tree structure, and the preorder traversal of the binary tree structure is used as the coding order for encoding. However, in parallel multi-frame coding, there are inter-frame references. In the RA model, the coding order will result in a large number of frames waiting to be encoded after the reference frames of the upper layers are encoded. For example, an image frame located in the 4th layer needs to wait for all the reference frames in the image frames located in the 1st, 2nd, and 3rd layers to be encoded before it can be synchronized in parallel. Otherwise, some frames will be blocked, especially when encoding across GOPs, where the blocking will be more obvious, thus affecting the efficiency of multi-threaded frame-level coding.

[0043] To address the aforementioned issues, in this embodiment, image frames within a Group of Pictures (GOPs) to be encoded are sorted from bottom to top according to their respective coding layers to determine the coding order corresponding to the GOP. The image frames within the GOP are then encoded according to this coding order. This application, without altering the coding structure of the Relational Animation (RA) model, determines the coding order of the image frames by sorting them from bottom to top according to their respective coding layers, without changing the coding reference order of each image frame. This significantly improves coding efficiency in multi-threaded parallel coding while ensuring that the reference frame order of the hierarchical parallel coding method remains the same as the original AVS3 reference frame order.

[0044] The application content will be further explained below with reference to the accompanying drawings and the description of the embodiments.

[0045] This embodiment provides a frame-layered parallel coding method applied to the RA coding mode. In the RA coding mode, the coding reference relationship is hierarchical. A GOP is divided into 5 layers from top to bottom, arranged in a binary tree structure, where the 5th layer is the top layer and the 1st layer is the bottom layer. The coding of upper-layer image frames needs to refer to lower-layer image frames. For example, ... Figure 1 As shown, an image frame located in the upper layer can refer to a pre-encoded frame located in the lower layer. For example, an encoded frame in layer 5 can select a reference frame from layers 1, 2, 3, and 4.

[0046] The frame-layered parallel coding method provided in this embodiment, such as Figure 2 As shown, the method includes:

[0047] S10. Sort the image frames in the GOP to be encoded in order from bottom to top according to their coding layer to determine the coding order corresponding to the GOP to be encoded.

[0048] S20. Encode the image frames in the GOP to be encoded according to the encoding order.

[0049] Specifically, the image frames in a Group of Pictures (GOP) to be encoded are layer-referenced, with upper-layer image frames referencing lower-layer image frames. Therefore, when performing parallel encoding on the image frames in the GOP, lower-layer image frames can be encoded first, followed by upper-layer image frames. Consequently, when determining the encoding order for a GOP, the encoding layers within the GOP can be sorted from bottom to top to obtain the encoding order. Image frames within the same encoding layer have the same encoding order, allowing for parallel encoding of image frames within the same layer.

[0050] In one implementation, the step of sorting the image frames in the GOP to be encoded according to their coding layers from bottom to top to determine the coding order corresponding to the GOP to be encoded specifically includes:

[0051] The bottom coding layer is selected in order from bottom to top, and a coding sequence number is set for the image frames in the bottom coding layer. The coding sequence numbers of the image frames in the same coding layer are the same.

[0052] This process continues until the image frames in the topmost coding layer are assigned coding numbers. In any two adjacent coding layers, the coding number of the image frame in the upper coding layer is greater than the coding number of the image frame in the lower coding layer.

[0053] The image frames in a Group of Pictures (GOPs) are sorted in ascending order of their encoding sequence numbers to obtain the encoding order corresponding to the GOP to be encoded.

[0054] Specifically, the bottom layer is the lowest coding layer in the Group of Pictures (GOP). The image frames in this layer only need to reference the corresponding I-frames of the GOP frames, allowing the coding order of the image frames in this layer to be set to first. The image frames in this layer have the same coding sequence number, enabling parallel coding of these frames. Furthermore, after setting the coding sequence number for the image frames in the bottom layer, the coding sequence for the layer preceding it is set. The coding sequence number of the image frames in the layer preceding it can be greater than that of the image frames in the bottom layer. This allows for coding in ascending order, where the bottom layer can be encoded first, followed by the layer preceding it, so that the image frames in the layer preceding it can reference the image frames in the bottom layer. Of course, in practical applications, the coding sequence number of the image frames in the layer preceding it can be less than that of the image frames in the bottom layer, allowing coding in descending order of coding sequence number. Similarly, an encoding sequence number is assigned to each image frame in each encoding layer, and the encoding sequence number is the same for all image frames in each encoding layer.

[0055] For example, the GOP to be encoded is as follows: Figure 1 The GOP shown is divided into 5 layers, from bottom to top: Layer 1, Layer 2, Layer 3, Layer 4, and Layer 5. Layer 1 has 1 image, Layer 2 has 1 image, Layer 3 has 2 images, Layer 4 has 4 images, and Layer 5 has 8 images. The encoding order of this GOP from top to bottom is: Layer 1: 16; Layer 2: 8; Layer 3: 4, 12; Layer 4: 2, 6, 10, 14; Layer 5: 1, 3, 5, 7, 9, 11, 13, 15. Therefore, the encoding order of this GOP is 16, 8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15.

[0056] Furthermore, in one implementation, since all image frames in a Group of Pictures (GOP) need to reference the corresponding I-frame, the I-frame corresponding to the GOP needs to be encoded before encoding the GOP itself, so that the image frames in the GOP can reference the already encoded I-frame. Based on this, before encoding the image frames in the GOP according to the encoding order, the method further includes: obtaining the I-frame corresponding to the GOP and encoding the I-frame. That is, the encoding order corresponding to the GOP is the I-frame followed by the image frames in the GOP arranged in the encoding order.

[0057] In one implementation, under RA coding mode, cross-GOP coding can also be performed, meaning multiple GOPs can be encoded in parallel, where the I-frames corresponding to these GOPs are the same. In other words, the GOP to be encoded can be a single GOP or a combination of multiple GOPs. When the GOP to be encoded is a single GOP, the coding layers within the GOP can be arranged in a bottom-up order to obtain the corresponding coding order. When multiple GOPs are encoded in parallel, they need to be merged to form the GOP to be encoded.

[0058] Based on this, the method further includes:

[0059] When encoding across GOPs, obtain the GOP arrangement order corresponding to each GOP in the cross-GOP encoding;

[0060] The GOPs are merged according to the GOP arrangement order to obtain the GOP to be encoded.

[0061] Specifically, during cross-GOP encoding, multiple GOPs are encoded simultaneously. Each GOP in these synchronously encoded GOPs corresponds to the same I-frame; that is, multiple GOPs correspond to the same I-frame. The GOPs within these GOPs have a specific order. For example, when encoding across GOPs, four GOPs are encoded in parallel, and these four GOPs are designated as the first, second, third, and fourth GOPs according to their order. After obtaining the GOP order for each GOP, the GOPs are merged according to this order, thus combining different layers from different GOPs into a single layer for parallel encoding.

[0062] In one implementation, the GOPs are merged according to their arrangement order to obtain the GOP to be encoded, specifically including:

[0063] For each coding layer in the first GOP in the GOP order, select its corresponding candidate coding layer from the GOPs that follow it, and merge the candidate coding layer into the coding layer.

[0064] For each coding layer in the second-ranked GOP that is not a candidate coding layer, the process of selecting its corresponding candidate coding layer from each GOP following the GOP is repeated until the last GOP is obtained, to obtain the GOP to be encoded.

[0065] Specifically, for the lowest coding layer in the first GOP, there is no coding layer in subsequent GOPs that satisfies the condition that the difference between the coding layer's layer number and the candidate coding layer's layer number is equal to the difference between the GOP arrangement order of the candidate coding layer's GOP and the GOP arrangement order of the coding layer's GOP. Therefore, this coding layer is designated as the lowest coding layer. For the coding layer preceding the lowest coding layer in the first GOP, and the lowest coding layer in the second GOP that satisfies the condition that the difference between the coding layer's layer number and the candidate coding layer's layer number is equal to the difference between the GOP arrangement order of the candidate coding layer's GOP and the GOP arrangement order of the coding layer's GOP, this coding layer is merged with the coding layer preceding the lowest coding layer in the first GOP into the same coding layer. This process continues until the highest coding layer in the first GOP. However, following a bottom-up order, the coding layer in the second-ranked GOP is selected to be merged into the first-ranked GOP. Candidate coding layers for this layer are then selected from the GOPs following the second-ranked GOP. These candidate coding layers satisfy the condition that the difference between the layer number of the original coding layer and the layer number of the candidate coding layer is equal to the difference between the GOP order of the candidate coding layer and the GOP order of the original coding layer. This process continues until the topmost coding layer in the last GOP, thus obtaining the GOP to be encoded. Furthermore, it is worth noting that, according to the GOP order, the coding layer determined by a later GOP is the upper layer of the coding layer determined by an earlier GOP; that is, the coding order of the coding layer determined by a later GOP is later than the coding order of the coding layer determined by an earlier GOP.

[0066] For example: Suppose that when encoding 4 GOPs in parallel, the GOP to be encoded formed by encoding across GOPs is:

[0067] Step 1: Encode I-frames.

[0068] Step 2: Encode the first layer of the first GOP.

[0069] Step 3: The second layer of the first GOP can be placed on the same layer as the first layer of the second GOP;

[0070] Step 4: The third layer (2 frames) of the first GOP, the second layer (1 frame) of the second GOP, and the first layer (1 frame) of the third GOP can be placed on the same layer;

[0071] Step 5: The fourth layer (4 frames) of the first GOP, the third layer (2 frames) of the second GOP, the second layer (1 frame) of the third GOP, and the first layer (1 frame) of the fourth GOP can be placed on the same layer.

[0072] Step 6: The fifth layer of the first GOP (8 frames), the fourth layer of the second GOP (4 frames), the third layer of the third GOP (2 frames), and the second layer of the fourth GOP (1 frame) can be placed on the same layer.

[0073] After one round of combination, all five layers of the first GOP are encoded. Then, the fifth layer of the second GOP, the fourth layer of the third GOP, and the third layer of the fourth GOP can be placed on the same layer, and so on, until the fifth layer of the fifth GOP is treated as a single layer.

[0074] Based on this, sorting the GOPs obtained by merging the GOPs can form the following: Figure 3 The distribution structure shown is as follows. Figure 3 Each column in the diagram represents a Group of Pictures (GOP), and x1, x2, x4, x8 represent the number of coded frames at each layer within a GOP. The gray frames in the diagram are the bottom-level B-frames, connecting two GOPs. Taking frame 16 as an example, it connects the first and second GOPs, so frame 16 from the first GOP is placed in the second column. (The text continues with further details about the diagram and its structure.) Figure 3 In the example shown, the encoding order of the upper encoding layer precedes that of the lower encoding layer, and the encoding order of image frames within the same layer is the same. Therefore, when encoding this encoding layer, all image frames within the layer can be encoded in parallel, i.e., in... Figure 3 The example shown can encode 15 frames (8+4+2+1) in parallel at the same time, which can significantly improve the efficiency of parallel coding.

[0075] In one implementation, since the encoding time of the top-level B-frame in each layer is much longer than that of other B-frames, the encoding time of all coded frames in each layer is limited by the encoding speed of the top-level B-frame. In other words, the encoding speed of the top-level B-frame determines the parallel encoding speed of all frames in its encoding layer. Therefore, when encoding in the order of encoding, the top-level B-frames that depend only on I-frames in the encoding layer composed of image frames with the same encoding order can be encoded, while the other image frames that depend on the top-level B-frames are encoded with a delay. By delaying the encoding by a preset frame, the top-level B-frames can start parallel encoding in advance, thus avoiding the influence of the B-frame encoding time.

[0076] In one implementation, when the thread resources of the encoding device are sufficient to encode multiple I-frame periods (Intra_period) simultaneously, the encoding of multiple I-frame periods can be performed in parallel. Therefore, the method further includes:

[0077] When encoding across multiple I-frame periods, for each I-frame period, the image frames in the GOP to be encoded are sorted in order from bottom to top according to their coding layer to determine the coding order of the GOP to be encoded; and the image frames in the GOP to be encoded are encoded according to the coding order to perform parallel encoding of multiple I-frame periods.

[0078] Specifically, such as Figure 4 As shown, the encoding order is obtained by encoding the GOPs included in each intra_period, and then multiple intra_periods are encoded synchronously. It can be understood that when multiple I-frame periods are encoded in parallel, multiple GOPs within each I-frame period will be encoded in parallel, for example, synchronously. Figure 4 The image frames included in the coding layer located in the third layer are encoded, etc.

[0079] For example, assuming an I-frame period has 4 GOPs, and each GOP is set to 16 frames, there will be 1 I-frame and 64 B-frames, for a total of 65 frames. The specific implementation steps of the frame-level layering method for encoding these 65 frames are as follows: Construct an array *enc_order of length 65; scan the merged GOPs to be encoded and store the scanned image frames into the array *enc_order; finally, retrieve the sequence number of the encoded frame from the enc_order array and encode it according to the sequence number. The scanning order is from top to bottom and from left to right. The sequence number of the encoded I-frame is n, and the sequence number of the encoded B-frame is m. The sequence number of the I-frame stored in the array enc_order is n, and the sequence number of the B-frame is mn.

[0080] Furthermore, each Intra_period has one I-frame. I-frames do not need to reference other frames, so when encoding multiple Intra_periods in parallel, the I-frames can be pre-encoded. When encoding B-frames, the B-frames need to reference already encoded I-frames or other B-frames. Therefore, B-frames that only need to reference I-frames are pre-encoded in parallel (i.e., the top-level B-frames). This embodiment can achieve simultaneous encoding of up to 64 frames across multiple Intra_periods, thereby improving encoding efficiency. In practical applications, with the same encoding time for each frame and a sufficient number of CPU cores, when encoding multiple I-frame cycles synchronously, up to 64 frames can be distributed on the same layer and begin encoding simultaneously, achieving a maximum speedup of 64 times.

[0081] In summary, this embodiment provides a frame-layered parallel coding method. The method includes sorting image frames in a Group of Pictures (GOPs) to be encoded according to their coding layers from bottom to top to determine the coding order corresponding to the GOP; and encoding the image frames in the GOP according to the coding order. This application, without changing the coding structure of the Relational Animation (RA) model, avoids the problem of a large number of frames having to wait for reference frames to be encoded before encoding by sorting the image frames in the GOP according to their coding layers from bottom to top, thus significantly improving coding efficiency in multi-threaded parallel coding.

[0082] Based on the above-described frame-layered parallel coding method, this embodiment provides a frame-layered parallel coding system, such as... Figure 5 As shown, the system includes:

[0083] The sorting module 100 is used to sort the image frames in the GOP to be encoded in order from bottom to top according to their coding layers, so as to determine the coding order corresponding to the GOP to be encoded.

[0084] The encoding module 200 is used to encode the image frames in the GOP to be encoded according to the encoding order.

[0085] Based on the above-described frame-layered parallel coding method, this embodiment provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in the frame-layered parallel coding method described in the above embodiment.

[0086] Based on the above-described frame-layered parallel coding method, this application also provides a terminal device, such as... Figure 6 As shown, it includes at least one processor 20; a display screen 21; and a memory 22, and may also include a communications interface 23 and a bus 24. The processor 20, display screen 21, memory 22, and communications interface 23 can communicate with each other via the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setup mode. The communications interface 23 can transmit information. The processor 20 can invoke logical instructions in the memory 22 to execute the methods described in the above embodiments.

[0087] Furthermore, the logical instructions in the aforementioned memory 22 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0088] The memory 22, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, such as program instructions or modules corresponding to the methods in the embodiments of this disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions, or modules stored in the memory 22, thereby implementing the methods in the above embodiments.

[0089] The memory 22 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 22 may include high-speed random access memory (RAM) and non-volatile memory. Examples include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, as well as transient storage media.

[0090] Furthermore, the specific process of loading and executing multiple instruction processors in the aforementioned storage medium and terminal device has been described in detail in the above method, and will not be repeated here.

[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A frame-layered parallel coding method, characterized in that, The method, which applies the RA coding mode, includes: The bottom coding layer is selected in order from bottom to top, and a coding sequence number is set for the image frames in the bottom coding layer. The coding sequence numbers of the image frames in the same coding layer are the same. This process continues until the image frames in the topmost coding layer are assigned coding numbers. In any two adjacent coding layers, the coding number of the image frame in the upper coding layer is greater than the coding number of the image frame in the lower coding layer. The image frames in a group of pictures (GOPs) are sorted in ascending order of their encoding sequence numbers to obtain the encoding order corresponding to the GOP to be encoded. The image frames in the GOP to be encoded are encoded according to the encoding order, so that the original frame reference relationship of the RA model is not changed during the encoding process, and only the image frame encoding execution order is adjusted. Specifically, when encoding according to the encoding order, the top B frame that only depends on the I frame in the encoding layer composed of image frames with the same encoding order is encoded, while the other image frames that depend on the top B frame are delayed in encoding. The method further includes: When encoding across GOPs, obtain the GOP arrangement order corresponding to each GOP in the cross-GOP encoding, where the I-frames corresponding to each GOP are the same; For each coding layer in the first GOP in the GOP arrangement, a corresponding candidate coding layer is selected from the GOPs following the first GOP, and the candidate coding layer is merged into the coding layer. The difference between the layer number of the coding layer and the layer number of the candidate coding layer is equal to the difference between the GOP arrangement order of the candidate coding layer and the GOP arrangement order of the coding layer. For each coding layer in the second-ranked GOP that is not a candidate coding layer, the process of selecting its corresponding candidate coding layer from each GOP following the GOP is repeated until the last GOP is obtained, to obtain the GOP to be encoded.

2. The frame-layered parallel coding method according to claim 1, characterized in that, Before encoding the image frames in the GOP according to the encoding order, the method further includes: Obtain the I-frame corresponding to the GOP and encode the I-frame.

3. The frame-layered parallel coding method according to any one of claims 1-2, characterized in that, When encoding the image frames in the GOP according to the encoding order, image frames with the same encoding sequence number are encoded in parallel.

4. The frame-layered parallel coding method according to claim 1, characterized in that, The method further includes: When encoding across multiple I-frame periods, for each I-frame period, the image frames in the GOP to be encoded are sorted in order from bottom to top according to their coding layer to determine the coding order of the GOP to be encoded; and the image frames in the GOP to be encoded are encoded according to the coding order to perform parallel encoding of multiple I-frame periods.

5. A frame-layered parallel coding system, characterized in that, The system, employing the RA coding mode, includes: The sorting module is used to select the bottommost coding layer in ascending order of coding layers and set the coding sequence number for the image frames in the bottommost coding layer. This process is repeated until the image frames in the topmost coding layer are set with coding sequence numbers. The image frames in the GOP are sorted in ascending order of coding sequence numbers to obtain the coding order corresponding to the GOP to be encoded. Among them, the coding sequence numbers of the image frames in the same coding layer are the same, and the coding sequence number of the image frame in the upper coding layer is greater than the coding sequence number of the image frame in the lower coding layer in any two adjacent coding layers. The encoding module is used to encode the image frames in the GOP to be encoded according to the encoding order, so that the original frame reference relationship of the RA model is not changed during the encoding, and only the image frame encoding execution order is adjusted. Specifically, when encoding according to the encoding order, the top B frame that only depends on the I frame in the encoding layer composed of image frames with the same encoding order is encoded, while the other image frames that depend on the top B frame are delayed in encoding. The sorting module is further used for: When encoding across GOPs, obtain the GOP arrangement order corresponding to each GOP in the cross-GOP encoding, where the I-frames corresponding to each GOP are the same; For each coding layer in the first GOP in the GOP arrangement, a corresponding candidate coding layer is selected from the GOPs following the first GOP, and the candidate coding layer is merged into the coding layer. The difference between the layer number of the coding layer and the layer number of the candidate coding layer is equal to the difference between the GOP arrangement order of the candidate coding layer and the GOP arrangement order of the coding layer. For each coding layer in the second-ranked GOP that is not a candidate coding layer, the process of selecting its corresponding candidate coding layer from each GOP following the GOP is repeated until the last GOP is obtained, to obtain the GOP to be encoded.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps in the frame layered parallel coding method as described in any one of claims 1-4.

7. A terminal device, characterized in that, include: Processor, memory, and communication bus; the memory stores a computer-readable program that can be executed by the processor; The communication bus enables communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the frame layered parallel coding method as described in any one of claims 1-4.