Coding and decoding task processing method and device, electronic equipment and computer program product
By splitting the codec task into multiple stages and triggering thread pool processing according to the dependency relationship, the resource waste problem of thread pool when there is insufficient tasks is solved, and the encoding and codec speed and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202411659741.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-14
AI Technical Summary
In the multithreaded scheme of codecs, the thread pool is still fully loaded when the number of executable tasks is insufficient, resulting in waste of CPU and power resources.
Split each frame of codec tasks into codec phase tasks of multiple stages, and determine the post-stage task based on the dependencies between these stages. After each codec phase task is executed, it is determined whether the post-stage task meets the triggering condition. If it is met, the post-stage task will be placed in the thread pool for processing.
By splitting tasks and reasonably triggering thread pool processing, the encoding and decoding speed is improved, the system resource consumption is reduced, and the thread pool design is simplified.
Smart Images

Figure CN119621265A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method for processing a coding and decoding task, a coding and decoding task processing device, an electronic device, and a computer program product. Background Art
[0002] In the multi-threaded solution of the codec, in order to improve the efficiency of the codec, the self-developed codec will introduce parallel coding tools to improve the efficiency of coding and decoding. After the codec tool splits the task, it will hand over the task to the thread pool for execution.
[0003] In the current thread pool design, the task determination process is handed over to the thread pool, resulting in the thread pool still being fully loaded when the number of executable tasks is insufficient, idling and wasting CPU and power resources.
[0004] In view of this, there is an urgent need in the art for a coding and decoding task processing method that can improve the coding and decoding speed and reduce system resource consumption.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a method for processing a coding and decoding task, a coding and decoding task processing device, an electronic device and a computer program product, thereby at least to a certain extent being able to improve the coding and decoding speed and reduce system resource consumption.
[0007] According to a first aspect of the present disclosure, a method for processing a coding and decoding task is provided, comprising:
[0008] Splitting each frame encoding and decoding task into multiple stages of encoding and decoding stage tasks, wherein there is a dependency relationship between the encoding and decoding stage tasks in each stage;
[0009] Determining the post-stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks;
[0010] After the encoding and decoding stage task is executed, determining whether the post-stage task of the encoding and decoding stage task meets the triggering condition;
[0011] If the post-stage task meets the trigger condition, the post-stage task is put into the thread pool for processing.
[0012] In an exemplary embodiment of the present disclosure, the determining whether the post-stage task of the encoding and decoding stage task meets the triggering condition includes:
[0013] Determine whether all other preceding stage tasks of the following stage task are completed;
[0014] If all other preceding stage tasks of the following stage task are completed, it is determined that the following stage task meets the trigger condition.
[0015] In an exemplary embodiment of the present disclosure, the method further includes:
[0016] Determining the preceding stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks;
[0017] According to the completion status of the preceding stage task of the encoding and decoding stage task, judging whether the encoding and decoding stage task meets the triggering condition;
[0018] If the encoding and decoding stage task meets the triggering condition, the encoding and decoding stage task is put into the thread pool for processing.
[0019] In an exemplary embodiment of the present disclosure, judging whether the encoding and decoding stage task satisfies the triggering condition according to the completion status of the preceding stage task of the encoding and decoding stage task includes:
[0020] When any preceding stage task of the encoding and decoding stage task is completed, determining whether all preceding stage tasks of the encoding and decoding stage task are completed;
[0021] If all the preceding stage tasks of the encoding and decoding stage task are completed, it is determined that the encoding and decoding stage task meets the triggering condition.
[0022] In an exemplary embodiment of the present disclosure, the dependency relationship between the encoding and decoding stage tasks includes encoding dependency relationship between the same stage and / or encoding dependency relationship between different stages.
[0023] In an exemplary embodiment of the present disclosure, the method further includes:
[0024] Determine whether the encoding and decoding stage task exists in the thread pool;
[0025] If the encoding and decoding stage task exists in the thread pool, the encoding and decoding stage task is executed by the working thread;
[0026] If the encoding and decoding stage task does not exist in the thread pool, the process waits for the next encoding and decoding stage task to enter the thread pool for processing.
[0027] In an exemplary embodiment of the present disclosure, the method further includes:
[0028] When the encoding and decoding stage tasks in the thread pool are completed, the encoding and decoding stage tasks are destroyed.
[0029] According to a second aspect of the present disclosure, there is provided a coding and decoding task processing device, comprising:
[0030] The stage task splitting module is configured to split each frame encoding and decoding task into multiple stages of encoding and decoding stage tasks, wherein there is a dependency relationship between the encoding and decoding stage tasks of each stage;
[0031] A post-task determination module is configured to determine the post-stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks;
[0032] A trigger condition judgment module is configured to judge whether a post-stage task of the encoding and decoding stage task meets a trigger condition after the encoding and decoding stage task is completed;
[0033] The stage task processing module is configured to execute if the post-stage task meets the trigger condition, then put the post-stage task into the thread pool for processing.
[0034] In an exemplary embodiment of the present disclosure, the trigger condition judgment module includes:
[0035] Other preceding task judging units are configured to judge whether other preceding stage tasks of the subsequent stage task are all completed;
[0036] The post-task trigger determination unit is configured to determine whether the post-stage task meets the trigger condition if all other pre-stage tasks of the post-stage task are completed.
[0037] In an exemplary embodiment of the present disclosure, the encoding and decoding task processing device further includes a pre-task judgment module, and the pre-task judgment module includes:
[0038] A pre-stage task determination unit, configured to perform a pre-stage task of determining the encoding and decoding stage task according to the dependency relationship between the encoding and decoding stage tasks;
[0039] A pre-task trigger judgment unit is configured to judge whether the encoding and decoding stage task meets the trigger condition according to the completion status of the pre-task of the encoding and decoding stage task;
[0040] The pre-stage task processing unit is configured to execute, if the encoding and decoding stage task meets the triggering condition, putting the encoding and decoding stage task into the thread pool for processing.
[0041] In an exemplary embodiment of the present disclosure, the preceding task triggering judgment unit includes:
[0042] a pre-task judging unit, configured to judge whether all pre-tasks of the encoding and decoding stage task are completed when any pre-task of the encoding and decoding stage task is completed;
[0043] The trigger condition determination unit is configured to determine whether the encoding and decoding stage task satisfies the trigger condition if all the preceding stage tasks of the encoding and decoding stage task are completed.
[0044] In an exemplary embodiment of the present disclosure, the encoding and decoding task processing device further includes a thread pool processing module, and the thread pool processing module includes:
[0045] A thread pool task determination unit is configured to determine whether there is a task in the encoding and decoding stage in the thread pool;
[0046] a stage task execution unit, configured to execute the encoding and decoding stage task through a worker thread if the encoding and decoding stage task exists in the thread pool;
[0047] The next task waiting unit is configured to execute, if the encoding and decoding stage task does not exist in the thread pool, wait for the next encoding and decoding stage task to enter the thread pool for processing.
[0048] In an exemplary embodiment of the present disclosure, the thread pool processing module further includes:
[0049] The task destroying unit is configured to destroy the encoding and decoding stage tasks after the encoding and decoding stage tasks in the thread pool are executed.
[0050] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any one of the encoding and decoding task processing methods described above.
[0051] According to a fourth aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the encoding and decoding task processing method described in any one of the above is implemented.
[0052] The exemplary embodiments of the present disclosure may have the following beneficial effects:
[0053] In the encoding and decoding task processing method of the example implementation mode of the present disclosure, each frame encoding and decoding task is split into encoding and decoding stage tasks of multiple stages, wherein there is a dependency relationship between the encoding and decoding stage tasks of each stage, and then the post-stage tasks of the encoding and decoding stage tasks are determined according to the dependency relationship between the encoding and decoding stage tasks, so that after each encoding and decoding stage task is executed, it is determined whether its post-stage tasks meet the triggering conditions, and if the triggering conditions are met, the post-stage tasks are placed in the thread pool for processing. The encoding and decoding task processing method in the example implementation mode of the present disclosure analyzes the relationship between the various stages of encoding and decoding, designs the dependency relationship between the encoding and decoding stage tasks, and triggers the available encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks, and places them in the thread pool for processing, so as to ensure that the tasks in the thread pool can be directly executed without judging the task triggering conditions in the thread pool, thereby decoupling the thread pool and task relationship, simplifying the thread pool design, improving the encoding and decoding speed, and reducing system resource consumption.
[0054] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0056] Figure 1 A schematic diagram of a process flow of a thread pool processing task in a related embodiment of the present disclosure is shown;
[0057] Figure 2 A schematic diagram of a process of triggering a CTU task in a related embodiment of the present disclosure is shown;
[0058] Figure 3 A schematic diagram showing a flow chart of a method for processing encoding and decoding tasks according to an exemplary embodiment of the present disclosure;
[0059] Figure 4 A schematic diagram schematically shows a CTU task triggering method according to a specific implementation of the present disclosure;
[0060] Figure 5 A schematic diagram schematically shows the state of each CTU stage of encoding a frame according to a specific implementation of the present disclosure;
[0061] Figure 6A schematic diagram showing a process flow of a thread pool processing encoding and decoding stage tasks according to an exemplary embodiment of the present disclosure;
[0062] Figure 7 A schematic diagram showing a process flow of triggering a task in the pre-stage of an exemplary embodiment of the present disclosure is shown;
[0063] Figure 8 A schematic diagram of a process of triggering a CTU task in a specific implementation manner of the present disclosure is shown;
[0064] Fig. 9 A schematic diagram showing a process flow of a thread pool processing task in a specific implementation manner of the present disclosure is shown;
[0065] Fig.10 A block diagram of a coding and decoding task processing device according to an exemplary embodiment of the present disclosure is shown;
[0066] Fig.11 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0067] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0068] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein.
[0069] The following example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0070] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0071] In some related embodiments, the efficiency of encoding and decoding can be improved by using parallel encoding and decoding tools, and a frame encoding and decoding task can be split into multiple stages at the CTU (Codingtree unit) level according to WPP (Wavefront Parallel Processing) and handed over to the thread pool for execution. The use of a multi-threaded encoding and decoding framework can increase the encoding speed by 300%-800% on the encoding side and the decoding speed by about 300% on the decoding side.
[0072] like Figure 1 The figure is a flowchart of a thread pool processing task in a related embodiment of the present disclosure. The specific steps of the flowchart are as follows:
[0073] Step S110: Get a task from the thread pool.
[0074] Step S120: Determine whether the execution condition is met.
[0075] If the conditions are met, the process proceeds to step S130 ; if not, the process proceeds to step S140 .
[0076] Step S130: Execute the CTU task.
[0077] Step S140: Return to the thread pool.
[0078] In the above-mentioned related embodiments, the CTU task and the thread pool are coupled. The CTU task is generated by the main thread and then put into the thread pool for execution. The execution thread takes out the task from the thread pool each time, and then needs to determine whether the task meets the execution conditions. If it meets the conditions, it is executed, and then the status is updated and put back into the thread pool. If it does not meet the conditions, it is put back into the thread pool.
[0079] like Figure 2 FIG. 1 is a flow chart of CTU task triggering in a related embodiment of the present disclosure. The specific steps of the flow chart are as follows:
[0080] Step S210: Initialize all CTU tasks.
[0081] Step S220: Join the thread pool.
[0082] For CTU tasks, all CTU tasks are put into the thread pool at the beginning of encoding and decoding, waiting for the worker thread to take the task and update the status after execution. The thread pool actually stores various encoding and decoding tasks. There are several tasks in the thread pool, but the tasks in the thread pool may not be executable.
[0083] In the above-mentioned related embodiments, the thread pool and the module are seriously coupled. If each task entering the thread pool needs to perform a condition judgment to determine whether it is satisfied during execution, it may cause the worker thread to repeatedly take out and put down tasks in the thread pool, resulting in a relatively large judgment overhead of the thread pool.
[0084] Based on the above problems, this exemplary embodiment first provides a method for processing a coding and decoding task. Figure 3 As shown, the above encoding and decoding task processing method may include the following steps:
[0085] Step S310: Split each frame encoding and decoding task into multiple stages of encoding and decoding stage tasks, wherein the encoding and decoding stage tasks of each stage have dependencies.
[0086] Step S320: Determine the post-stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks.
[0087] Step S330: After the encoding and decoding stage task is executed, it is determined whether the post-stage task of the encoding and decoding stage task meets the triggering condition.
[0088] Step S340: If the post-stage task meets the triggering condition, the post-stage task is placed in the thread pool for processing.
[0089] In the encoding and decoding task processing method of the example implementation mode of the present disclosure, each frame encoding and decoding task is split into encoding and decoding stage tasks of multiple stages, wherein there is a dependency relationship between the encoding and decoding stage tasks of each stage, and then the post-stage tasks of the encoding and decoding stage tasks are determined according to the dependency relationship between the encoding and decoding stage tasks, so that after each encoding and decoding stage task is executed, it is determined whether its post-stage tasks meet the triggering conditions, and if the triggering conditions are met, the post-stage tasks are placed in the thread pool for processing. The encoding and decoding task processing method in the example implementation mode of the present disclosure analyzes the relationship between the various stages of encoding and decoding, designs the dependency relationship between the encoding and decoding stage tasks, and triggers the available encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks, and places them in the thread pool for processing, so as to ensure that the tasks in the thread pool can be directly executed without judging the task triggering conditions in the thread pool, thereby decoupling the thread pool and task relationship, simplifying the thread pool design, improving the encoding and decoding speed, and reducing system resource consumption.
[0090] Next, combine Figures 4 to 7 The above steps of this exemplary embodiment are described in more detail.
[0091] In step S310, each frame encoding and decoding task is divided into encoding and decoding stage tasks of multiple stages, wherein the encoding and decoding stage tasks of each stage have dependencies.
[0092] In this example implementation, each frame encoding and decoding task may include multiple stages, and possible encoding stages include lookahead (pre-analysis), MCTF (motion compensated temporal filtering), INTER (inter-frame prediction), INTRA (intra-frame prediction), DEBLOCK (deblocking filtering), SAO (sample adaptive compensation), ALF (adaptive loop filtering), etc., and the actual operation may have more / less stages. Each frame encoding and decoding task can be divided into multiple stages of encoding and decoding stage tasks.
[0093] Figure 4 The schematic diagram of the CTU task triggering method in a specific implementation of the present disclosure is schematically shown. There are complex trigger dependencies between different stages. For example, SAO has 8 CTU dependencies: the left, upper left, upper, and upper right CTUs must complete SAO, and the lower left, lower, right, and lower right CTUs must complete LF_HOR. If it is to be modified to triggered parallelism, these 8 dependencies may trigger the SAO of the current CTU. In WPP parallelism, it can be guaranteed that the same stage is executed from left to right in the CTU row, so the SAO dependency can be simplified to the upper right CTU must complete SAO, and the lower right CTU must complete LF_HOR. The reverse trigger relationship is: a CTU completes SAO and checks whether the SAO of the lower left CTU is triggered; a CTU completes LF_HOR and checks whether the SAO of the upper left CTU is triggered.
[0094] In this example implementation, the dependency relationship between the encoding and decoding stage tasks includes the encoding dependency relationship between the same stage and / or the encoding dependency relationship between different stages.
[0095] Taking the encoding dependency between the same stages as an example, assuming that there is an encoding stage A, the current CTU encoding stage A needs to wait until the CTU in the upper right corner completes encoding stage A. This means that when a block completes encoding stage A, it can trigger the CTU in the lower left corner to execute encoding stage A.
[0096] Taking the encoding dependency between different stages as an example, suppose there is an encoding stage A and an encoding stage B, and encoding stage B is the next stage of encoding stage A. The current CTU executes encoding stage B and needs to rely on the CTU on the right to complete encoding stage A. Conversely, when the CTU on the right completes encoding stage A, it can trigger the CTU on its left to execute encoding stage A.
[0097] The above two examples illustrate the encoding dependency between the same stage and different stages. In general, if you want to execute stage A of the current CTU, it will have different dependencies on the surrounding CTUs at different stages. That is, the current CTU can execute stage A only when these conditions are met.
[0098] In step S320, the post-stage tasks of the encoding and decoding stage tasks are determined according to the dependency relationship between the encoding and decoding stage tasks.
[0099] In this example implementation, the preceding stage task of a coding and decoding stage task refers to another coding and decoding stage task that the current coding and decoding stage task depends on and needs to be completed before the current coding and decoding stage task is processed. The following stage task of a coding and decoding stage task refers to the subsequent coding and decoding stage task that depends on the current coding and decoding stage task, that is, the current coding and decoding stage task is one of the preceding stage tasks of its following stage task. The codec has several coding and decoding stage tasks, and there is a dependency relationship between these tasks. A task needs to satisfy several preceding stage tasks before it can be executed.
[0100] In step S330, after the encoding and decoding stage task is executed, it is determined whether the post-stage task of the encoding and decoding stage task meets the triggering condition.
[0101] In this example implementation, after the encoding and decoding stage task is executed, it can be determined whether all other preceding stage tasks of the post-stage task are completed; if all other preceding stage tasks of the post-stage task are completed, it is determined that the post-stage task meets the triggering condition.
[0102] In the CTU parallel of single-frame encoding / decoding, the WPP method is used to determine whether other stage tasks of the upper, lower, left, and right CTUs can be triggered according to the CTU dependency of the encoding / decoding stage. Only when all conditions are met can they be put into the thread pool for execution. By classifying the conditions of each CTU task, each CTU needs to meet N conditions in different task stages. When any of these N conditions is met, check whether all are met. If all conditions are met, put them into the thread pool.
[0103] In this example implementation, the complex dependencies between the various encoding and decoding stages can be simplified. If the dependency of the previous stage of a stage includes part of the dependency of the current stage, there is no need to repeatedly determine the trigger.
[0104] In step S340, if the post-stage task meets the triggering condition, the post-stage task is put into the thread pool for processing.
[0105] When any encoding and decoding stage task is completed, the possible triggered post-stage tasks will be checked according to the dependency relationship, and if the triggering conditions are met, they will be put into the thread pool.
[0106] In order to meet the needs of the thread pool, we can put the executable tasks into the thread pool for execution according to the different conditions of codec parallelism when putting in tasks. By analyzing the task conditions at different stages of encoding and decoding, we can add CTU tasks to the thread pool in a reasonable order.
[0107] Figure 5 The schematic diagram of encoding each CTU stage state of a frame according to a specific implementation of the present disclosure is schematically shown. There will be complex dependencies between the states of each stage. For example, SAO_FILTER depends on the CTU block in the lower right corner to complete LF_HOR. Therefore, when a block completes LF_HOR, it is necessary to check whether the SAO_FILTER in the upper right corner can be triggered. If it is satisfied, the new SAO_FILTER task is sent to the thread pool for execution.
[0108] In this example implementation, in order to solve the problem of coupling between the thread pool and CTU tasks, a thread pool can be designed that does not need to determine task conditions and return tasks, ensuring that each task that enters the thread pool can be completed at one time. Figure 6 As shown, the workflow of threads in the thread pool can include the following steps:
[0109] Step S610: Determine whether there is an encoding and decoding stage task in the thread pool.
[0110] First, the worker thread checks whether there are encoding and decoding tasks that can be processed in the thread pool.
[0111] Step S620: If there are encoding and decoding stage tasks in the thread pool, the encoding and decoding stage tasks are executed through the working thread.
[0112] If there are processable encoding and decoding tasks in the thread pool, the CTU task will be executed directly.
[0113] Step S630: If there is no encoding / decoding stage task in the thread pool, wait for the next encoding / decoding stage task to enter the thread pool for processing.
[0114] If there are no encoding and decoding tasks that can be processed in the thread pool, it will block and wait for new tasks to join the thread pool, and return to the working thread after completing the task. When the encoding and decoding tasks in the thread pool are completed, the encoding and decoding tasks will be destroyed.
[0115] In this example implementation, tasks are triggered, and the thread pool is only used to execute tasks. No judgment is required to ensure that tasks placed in the thread pool can be executed. The working thread only needs to be taken out for execution. After execution, the task is destroyed. No extra judgment overhead is required, which saves the overhead of checking tasks and switching tasks, and can also save CPU resources when there are no tasks.
[0116] In this example implementation, Figure 7 As shown, the encoding and decoding task processing method may also include the following steps:
[0117] Step S710: Determine the preceding stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks.
[0118] In this example implementation, the preceding stage task of the encoding and decoding stage task refers to another encoding and decoding stage task that the current encoding and decoding stage task depends on and needs to be completed before the current encoding and decoding stage task is processed.
[0119] Step S720: Determine whether the encoding and decoding stage task meets the triggering condition according to the completion status of the preceding stage task of the encoding and decoding stage task.
[0120] In this example implementation, when any preceding stage task of the encoding and decoding stage task is completed, it can be determined whether all preceding stage tasks of the encoding and decoding stage task are completed. If all preceding stage tasks of the encoding and decoding stage task are completed, it is determined that the encoding and decoding stage task meets the triggering condition.
[0121] Step S730: If the encoding and decoding stage task meets the triggering condition, the encoding and decoding stage task is put into the thread pool for processing.
[0122] In this example implementation, if all the preceding stage tasks of the encoding and decoding stage task have been completed, the encoding and decoding stage task is put into the thread pool for processing.
[0123] like Figure 8 The figure is a flow chart of CTU task triggering in a specific implementation manner of the present disclosure, which is an example of the above steps in this example implementation manner. The specific steps of the flow chart are as follows:
[0124] Step S810: Check whether there is a triggerable CTU task condition.
[0125] If it exists, go to step S820; if it does not exist, go to step S830.
[0126] Step S820: Join the thread pool.
[0127] If there is a CTU task that can be triggered, it will be put into the thread pool for execution.
[0128] Step S830: End the CTU task.
[0129] At the end of each CTU execution phase, all possible triggered tasks are judged once, and if the conditions are met, they are put into the thread pool for execution.
[0130] like Fig. 9 The figure is a flowchart of a thread pool processing task in a specific implementation mode of the present disclosure, which is an example of the above steps in this example implementation mode. The specific steps of the flowchart are as follows:
[0131] Step S910: Check whether the thread pool has any tasks.
[0132] If there is a task, go to step S920; if there is no task, go to step S930.
[0133] Step S920: Execute the CTU task.
[0134] Step S930: Wait for new tasks.
[0135] The thread pool only executes tasks without judgment. After the task is executed, it is destroyed. There is no need for extra judgment overhead, which can save CPU resources when there are no tasks.
[0136] In this example implementation, by designing an efficient thread pool and a triggered CTU task flow, in the KVC3.0 encoding and decoding task processor, the CPU occupancy rate of the KVC3.0 encoder is reduced by 17.8% at the same speed, effectively saving the encoding machine cost; in the KVC3.0 decoder, the power consumption of the mobile decoder is reduced by 61%, greatly reducing the power consumption of the decoding end and improving the user experience of the consumer end.
[0137] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0138] Furthermore, the present disclosure also provides a coding and decoding task processing device. Fig.10As shown, the encoding and decoding task processing device may include a stage task splitting module 1010, a post-task determining module 1020, a trigger condition judging module 1030 and a stage task processing module 1040. Among them:
[0139] The stage task splitting module 1010 is configured to split each frame encoding and decoding task into multiple stages of encoding and decoding stage tasks, wherein there is a dependency relationship between the encoding and decoding stage tasks of each stage;
[0140] The post-task determination module 1020 is configured to determine the post-stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks;
[0141] The trigger condition determination module 1030 is configured to determine whether the post-stage task of the encoding and decoding stage task meets the trigger condition after the encoding and decoding stage task is executed;
[0142] The stage task processing module 1040 is configured to put the post-stage task into the thread pool for processing if the post-stage task meets the triggering condition.
[0143] In some exemplary embodiments of the present disclosure, the trigger condition judgment module 1030 may include other pre-task judgment units and post-task trigger judgment units.
[0144] The other preceding task judging unit is configured to judge whether all the other preceding stage tasks of the subsequent stage task are completed;
[0145] The post-task trigger determination unit is configured to determine that the post-stage task meets the trigger condition if all other pre-stage tasks of the post-stage task are completed.
[0146] In some exemplary embodiments of the present disclosure, a coding and decoding task processing device provided by the present disclosure may further include a pre-task judgment module, which may include a pre-stage task determination unit, a pre-task trigger judgment unit, and a pre-stage task processing unit. Wherein:
[0147] The preceding stage task determination unit is configured to determine the preceding stage task of the encoding and decoding stage task according to the dependency relationship between the encoding and decoding stage tasks;
[0148] The pre-task trigger judgment unit is configured to judge whether the encoding and decoding stage task meets the trigger condition according to the completion status of the pre-task of the encoding and decoding stage task;
[0149] The pre-stage task processing unit is configured to put the encoding and decoding stage task into the thread pool for processing if the encoding and decoding stage task meets the triggering condition.
[0150] In some exemplary embodiments of the present disclosure, the preceding task triggering judgment unit may include a preceding task judgment unit triggering condition judgment unit.
[0151] The pre-task judgment unit is configured to judge whether all pre-tasks of the encoding and decoding stage task are completed when any pre-task of the encoding and decoding stage task is completed;
[0152] The trigger condition determination unit is configured to determine that the encoding and decoding stage task meets the trigger condition if all the preceding stage tasks of the encoding and decoding stage task are completed.
[0153] In some exemplary embodiments of the present disclosure, the dependency relationship between tasks in the encoding and decoding stages includes encoding dependencies between the same stages and / or encoding dependencies between different stages.
[0154] In some exemplary embodiments of the present disclosure, a coding and decoding task processing device provided by the present disclosure may further include a thread pool processing module, which may include a thread pool task judgment unit, a stage task execution unit, and a next task waiting unit.
[0155] The thread pool task determination unit is configured to determine whether there is an encoding and decoding phase task in the thread pool;
[0156] The stage task execution unit is configured to execute the encoding and decoding stage task through the worker thread if there is an encoding and decoding stage task in the thread pool;
[0157] The next task waiting unit is configured to wait for the next encoding and decoding stage task to enter the thread pool for processing if there is no encoding and decoding stage task in the thread pool.
[0158] In some exemplary embodiments of the present disclosure, the thread pool processing module may further include a task destroying unit configured to destroy the encoding and decoding stage tasks after the encoding and decoding stage tasks in the thread pool are executed.
[0159] The specific details of each module / unit in the above-mentioned encoding and decoding task processing device have been described in detail in the corresponding method embodiment part, and will not be repeated here.
[0160] Fig.11 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.
[0161] It should be noted that Fig.11 The computer system 1100 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0162] like Fig.11As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage part 1108 into a random access memory (RAM) 1103. Various programs and data required for system operation are also stored in the RAM 1103. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0163] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed, so that a computer program read therefrom is installed into the storage section 1108 as needed.
[0164] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1109, and / or installed from a removable medium 1111. When the computer program is executed by a central processing unit (CPU) 1101, various functions defined in the system of the present disclosure are executed.
[0165] The exemplary embodiment of the present disclosure also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the information prompt method for reward redemption is implemented.
[0166] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.
[0167] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.
[0168] The code of the computer program can be written in one or more programming languages. Programming languages such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).
[0169] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on the electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure, such as the information prompt method for reward redemption described above.
[0170] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0171] It should be noted that, although several modules of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be concretized.
[0172] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.
[0173] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for processing a coding and decoding task, characterized in that: include: Splitting each frame encoding and decoding task into multiple stages of encoding and decoding stage tasks, wherein there is a dependency relationship between the encoding and decoding stage tasks in each stage; Determining the post-stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks; After the encoding and decoding stage task is executed, determining whether the post-stage task of the encoding and decoding stage task meets the triggering condition; If the post-stage task meets the trigger condition, the post-stage task is put into the thread pool for processing.
2. The encoding and decoding task processing method according to claim 1, characterized in that: The determining whether the post-stage task of the encoding and decoding stage task meets the triggering condition includes: Determine whether all other preceding stage tasks of the following stage task are completed; If all other preceding stage tasks of the following stage task are completed, it is determined that the following stage task meets the trigger condition.
3. The encoding and decoding task processing method according to claim 1, characterized in that: The method further comprises: Determining the preceding stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks; According to the completion status of the preceding stage task of the encoding and decoding stage task, judging whether the encoding and decoding stage task meets the triggering condition; If the encoding and decoding stage task meets the triggering condition, the encoding and decoding stage task is put into the thread pool for processing.
4. The encoding and decoding task processing method according to claim 3, characterized in that: The step of judging whether the encoding and decoding stage task satisfies the triggering condition according to the completion status of the preceding stage task of the encoding and decoding stage task includes: When any preceding stage task of the encoding and decoding stage task is completed, determining whether all preceding stage tasks of the encoding and decoding stage task are completed; If all the preceding stage tasks of the encoding and decoding stage task are completed, it is determined that the encoding and decoding stage task meets the triggering condition.
5. The encoding and decoding task processing method according to claim 1, characterized in that: The dependency relationship between the encoding and decoding stage tasks includes the encoding dependency relationship between the same stage and / or the encoding dependency relationship between different stages.
6. The encoding and decoding task processing method according to claim 1, characterized in that: The method further comprises: Determine whether the encoding and decoding stage task exists in the thread pool; If the encoding and decoding stage task exists in the thread pool, the encoding and decoding stage task is executed by the working thread; If the encoding and decoding stage task does not exist in the thread pool, the process waits for the next encoding and decoding stage task to enter the thread pool for processing.
7. The encoding and decoding task processing method according to claim 4, characterized in that: The method further comprises: When the encoding and decoding stage tasks in the thread pool are completed, the encoding and decoding stage tasks are destroyed.
8. A coding and decoding task processing device, characterized in that: include: The stage task splitting module is configured to split each frame encoding and decoding task into multiple stages of encoding and decoding stage tasks, wherein there is a dependency relationship between the encoding and decoding stage tasks of each stage; A post-task determination module is configured to determine the post-stage tasks of the encoding and decoding stage tasks according to the dependency relationship between the encoding and decoding stage tasks; A trigger condition judgment module is configured to judge whether a post-stage task of the encoding and decoding stage task meets a trigger condition after the encoding and decoding stage task is completed; The stage task processing module is configured to execute if the post-stage task meets the trigger condition, then put the post-stage task into the thread pool for processing.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the encoding and decoding task processing method as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the encoding and decoding task processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Coding and decoding task processing method and device, electronic equipment and readable storage medium
CN122340277A