Code stream processing method and device, storage medium, chip and electronic equipment

By judging and releasing the hardware resources of low-priority code stream segmentation processing tasks in the chip, the problem of low code stream processing efficiency caused by insufficient hardware memory is solved, and efficient processing of important code streams is achieved.

CN118567848APending Publication Date: 2024-08-30XIANGDIXIAN COMPUTING TECH (CHONGQING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410694484.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

When existing chips process code streams, due to limited hardware memory resources, the processing efficiency of important code streams cannot be guaranteed, and the processing of other code streams needs to be suspended until a certain code stream is completed to release hardware memory resources.

Method used

By judging whether there is a target code stream segmentation processing task with a lower priority than the new code stream segmentation processing task in the historical code stream segmentation processing task, if it exists, its intermediate variables will be temporarily stored in the software memory to release the hardware resources for the new code stream segmentation processing task. Code stream segmentation processing tasks to improve the processing efficiency of important code streams.

Benefits of technology

It effectively improves the chip's efficiency in processing important code streams, avoids processing pauses caused by insufficient hardware resources, and ensures timely processing of important code streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567848A
    Figure CN118567848A
Patent Text Reader

Abstract

The invention provides a code stream processing method and device, a storage medium, a chip and electronic equipment, and the method comprises the steps: judging whether a target code stream segmentation processing task exists in historical code stream segmentation processing tasks or not under the condition that a new code stream segmentation processing task is received and no idle chip hardware resource exists at present; the historical code stream segmentation processing task is a code stream segmentation processing task currently occupying the chip hardware resource, and the priority of the target code stream segmentation processing task is lower than that of the new code stream segmentation processing task; and if yes, temporarily storing an intermediate variable stored in a target chip hardware resource currently occupied by the target code stream segmentation processing task into a software memory, and releasing the target chip hardware resource to the new code stream segmentation processing task, so that a hardware acceleration engine processes the new code stream segmentation processing task. Through the method, the processing efficiency of the important code stream segmentation task can be ensured as much as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of chip technology, and in particular to a code stream processing method, device, storage medium, chip and electronic device. Background Art

[0002] To ensure data security, encryption / decryption functions are used for the data in transmission during the data transmission process. For the chip, when different master devices (master) send code streams of different numbers and sizes, they can be processed by segmented encryption / decryption. In the process of segmented encryption / decryption of the code stream, each segment of data will generate an intermediate variable after encryption / decryption to serve as the input for the encryption / decryption of the next segment of data. Based on the above premise, the prior art will open up a dedicated hardware memory from the hardware memory resources of the chip, and the dedicated hardware memory is dedicated to storing the above intermediate variables. In the process of uninterrupted segmented encryption / decryption of the same code stream, the dedicated hardware memory of the chip will be occupied to store the intermediate variables of the code stream and continuously update the intermediate variables until all the segmented data of the code stream have completed encryption / decryption, and then the dedicated hardware memory occupied by the intermediate variables of the code stream can be released.

[0003] However, due to limited hardware memory resources, if the dedicated hardware memory used to temporarily store intermediate variables in the chip is insufficient, it is necessary to suspend the segmented encryption / decryption operation of other new code streams until a code stream is processed and the dedicated hardware memory resources occupied by it are released, and then the segmented encryption / decryption operation of the new code stream can be performed. Obviously, the existing processing mechanism makes the chip unable to guarantee the processing efficiency of important code streams. Summary of the invention

[0004] The purpose of the present disclosure is to provide a code stream processing method, a chip electronic component and an electronic device, which can ensure the processing efficiency of important code streams as much as possible.

[0005] According to one aspect of the present disclosure, a code stream processing method is provided, comprising: when a new code stream segmentation processing task is received and there are currently no idle chip hardware resources, determining whether there is a target code stream segmentation processing task in the historical code stream segmentation processing tasks; the historical code stream segmentation processing task is the code stream segmentation processing task currently occupying the chip hardware resources, and the priority of the target code stream segmentation processing task is lower than the priority of the new code stream segmentation processing task; if so, temporarily storing the intermediate variables stored in the target chip hardware resources currently occupied by the target code stream segmentation processing task in the software memory, and releasing the target chip hardware resources to the new code stream segmentation processing task, so that the hardware acceleration engine processes the new code stream segmentation processing task.

[0006] In a feasible implementation of the present disclosure, the determining whether there is a target code stream segmentation processing task in the historical code stream segmentation processing tasks includes: comparing a first size relationship between a first priority and a second priority, the first priority being the priority of the new code stream segmentation processing task, and the second priority being the priority of a candidate code stream segmentation processing task with the lowest priority in the historical code stream segmentation processing tasks; when the first size relationship indicates that the first priority is higher than the second priority, determining the candidate code stream segmentation processing task as the target code stream segmentation processing task; otherwise, determining that the target code stream segmentation processing task does not exist.

[0007] In a feasible implementation of the present disclosure, the determining whether there is a target codestream segmentation processing task in the historical codestream segmentation processing tasks includes: comparing a second size relationship between a first priority and a priority threshold; the first priority is the priority of the new codestream segmentation processing task, and the priority threshold indicates the lowest priority that may exist among all codestream segmentation processing tasks; when the second size relationship indicates that the first priority is higher than the priority threshold, comparing a first size relationship between the first priority and a second priority, the second priority being the priority of a candidate codestream segmentation processing task with the lowest priority among the historical codestream segmentation processing tasks; when the first size relationship indicates that the first priority is higher than the second priority, determining that the candidate codestream segmentation processing task is the target codestream segmentation processing task; when the second size relationship indicates that the first priority is not higher than the priority threshold, or when the first size relationship indicates that the first priority is not higher than the second priority, determining that the target codestream segmentation processing task does not exist.

[0008] In a feasible implementation of the present disclosure, the determining the candidate code stream segmentation processing task as the target code stream segmentation processing task includes: when the number of the candidate code stream segmentation processing tasks is not one, selecting a candidate code stream segmentation processing task that meets a preset condition from multiple candidate code stream segmentation processing tasks as the target code stream segmentation processing task; the preset condition includes any one of the following: the task execution degree of the candidate code stream segmentation processing task is the lowest and the number of remaining unprocessed segments of the candidate code stream segmentation processing task is the largest.

[0009] In a feasible implementation of the present disclosure, the task execution degree of the candidate code stream segment processing task is equal to the ratio of the number of processed segments of the candidate code stream segment processing task to the total number of segments of the candidate code stream segment processing task.

[0010] In a feasible implementation of the present disclosure, the method further includes: obtaining the priority of each of the historical code stream segment processing tasks, and dynamically recording the current lowest priority, where the current lowest priority is the second priority.

[0011] In a feasible implementation of the present disclosure, the method further includes: when there is currently no new code stream segmentation processing task whose priority is higher than the target code stream segmentation processing task, and there are currently idle chip hardware resources, saving the intermediate variables temporarily stored in the software memory to the idle chip hardware resources, so that the hardware acceleration engine continues to process the target code stream segmentation processing task.

[0012] In a feasible implementation of the present disclosure, the code stream segment processing task is used to perform segment-by-segment encryption or segment-by-segment decryption on the code stream.

[0013] In a feasible implementation of the present disclosure, the method further includes: in the case where the target bitstream segment processing task does not exist, temporarily storing all data of the new bitstream segment processing task in the software memory.

[0014] According to another aspect of the present disclosure, a code stream processing device is also provided, including a judgment module and an execution module. The judgment module is used to judge whether there is a target code stream segmentation processing task in the historical code stream segmentation processing tasks when a new code stream segmentation processing task is received and there are no idle chip hardware resources at present; the historical code stream segmentation processing task is the code stream segmentation processing task currently occupying the chip hardware resources, and the priority of the target code stream segmentation processing task is lower than the priority of the new code stream segmentation processing task; the execution module is used to temporarily store the intermediate variables stored in the target chip hardware resources currently occupied by the target code stream segmentation processing task to the software memory when the judgment module judges that it is yes, and release the target chip hardware resources to the new code stream segmentation processing task, so that the hardware acceleration engine in the chip processes the new code stream segmentation processing task.

[0015] In a feasible implementation of the present disclosure, the judgment module is specifically used to: compare a first size relationship between a first priority and a second priority, the first priority being the priority of the new code stream segmentation processing task, and the second priority being the priority of a candidate code stream segmentation processing task with the lowest priority among the historical code stream segmentation processing tasks; when the first size relationship indicates that the first priority is higher than the second priority, determine that the candidate code stream segmentation processing task is the target code stream segmentation processing task; otherwise, determine that the target code stream segmentation processing task does not exist.

[0016] In a feasible implementation of the present disclosure, the judgment module is specifically used to: compare the second size relationship between the first priority and the priority threshold; the first priority is the priority of the new code stream segmentation processing task, and the priority threshold represents the lowest priority that may exist among all code stream segmentation processing tasks; when the second size relationship represents that the first priority is higher than the priority threshold, compare the first size relationship between the first priority and the second priority, and the second priority is the priority of the candidate code stream segmentation processing task with the lowest priority among the historical code stream segmentation processing tasks; when the first size relationship represents that the first priority is higher than the second priority, determine that the candidate code stream segmentation processing task is the target code stream segmentation processing task; when the second size relationship represents that the first priority is not higher than the priority threshold, or when the first size relationship represents that the first priority is not higher than the second priority, determine that the target code stream segmentation processing task does not exist.

[0017] In a feasible implementation of the present disclosure, the judgment module is specifically used to: when the number of the candidate bitstream segmentation processing tasks is not one, select a candidate bitstream segmentation processing task that meets a preset condition from multiple candidate bitstream segmentation processing tasks as the target bitstream segmentation processing task;

[0018] The preset condition includes any one of the following: the task execution degree of the candidate code stream segment processing task is the lowest, and the number of remaining unprocessed segments of the candidate code stream segment processing task is the largest.

[0019] In a feasible implementation of the present disclosure, the task execution degree of the candidate code stream segment processing task is equal to the ratio of the number of processed segments of the candidate code stream segment processing task to the total number of segments of the candidate code stream segment processing task.

[0020] In a feasible implementation of the present disclosure, the device further includes an acquisition module, which is used to acquire the priority of each of the historical code stream segment processing tasks and dynamically record the current lowest priority, where the current lowest priority is the second priority.

[0021] In a feasible implementation of the present disclosure, the execution module is also used to: when there is currently no new code stream segmentation processing task whose priority is higher than the target code stream segmentation processing task, and there are currently idle chip hardware resources, save the intermediate variables temporarily stored in the software memory to the idle chip hardware resources, so that the hardware acceleration engine continues to process the target code stream segmentation processing task.

[0022] In a feasible implementation of the present disclosure, the code stream segment processing task is used to perform segment-by-segment encryption or segment-by-segment decryption on the code stream.

[0023] In a feasible implementation of the present disclosure, the execution module is further configured to temporarily store all data of the new bitstream segmentation processing task in the software memory when the target bitstream segmentation processing task does not exist.

[0024] According to another aspect of the present disclosure, a computer-readable storage medium is further provided, on which a bitstream processing program is stored. When the bitstream processing program is executed, the bitstream processing method provided by any of the above feasible implementations is implemented.

[0025] According to another aspect of the present disclosure, a chip is also provided, including a processor, a memory connected to the processor, and a hardware acceleration engine, wherein a bitstream processing program that can be executed by the processor is stored on the memory, and when the bitstream processing program is executed by the processor, the bitstream processing method provided by any of the above-mentioned feasible implementation modes is implemented.

[0026] In some usage scenarios, the chip is in the form of a graphics card; in other usage scenarios, the chip is in the form of a CPU motherboard.

[0027] According to another aspect of the present disclosure, an electronic device is also provided, comprising the above-mentioned chip. In some usage scenarios, the product form of the electronic device is a portable electronic device, such as a smart phone, a tablet computer, a VR device, etc.; in some usage scenarios, the product form of the electronic device is a personal computer, a game console, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 is a flowchart of a code stream processing method according to an embodiment of the present disclosure;

[0029] Figure 2 It is a structural block diagram of a bit stream processing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] Before introducing the embodiments of the present disclosure, it should be noted that:

[0031] Some embodiments of the present disclosure are described as processing flows. Although the various operation steps of the flow may be given sequential step numbers, the operation steps therein may be implemented in parallel, concurrently or simultaneously.

[0032] In the embodiments of the present disclosure, the terms "first", "second", etc. may be used to describe various features, but these features should not be limited by these terms. These terms are used only to distinguish one feature from another.

[0033] The term “and / or” may be used in embodiments of the present disclosure. “And / or” includes any and all combinations of one or more of the listed associated features.

[0034] It should be understood that when describing the connection or communication relationship between two components, unless it is explicitly stated that the two components are directly connected or directly communicating, the connection or communication between the two components can be understood as direct connection or communication, or as indirect connection or communication through an intermediate component.

[0035] In order to make the technical solutions and advantages of the embodiments of the present disclosure more clearly understood, the exemplary embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0036] In the prior art, a dedicated hardware memory (i.e., the chip hardware resource hereinafter) is opened up from the hardware memory resources of the chip, and the dedicated hardware memory is dedicated to storing the intermediate variables generated by the code stream segmentation processing task sent by the master during the segmentation processing process. In the process of uninterrupted segmentation encryption / decryption of the same code stream, the dedicated hardware memory of the chip is always occupied to store the intermediate variables of the code stream segmentation processing task and continuously update the intermediate variables until all the segmentation data of the code stream segmentation processing task have completed encryption / decryption, and then the dedicated hardware memory occupied by the intermediate variables of the code stream segmentation processing task can be released. However, due to limited hardware memory resources, if the dedicated hardware memory used to temporarily store intermediate variables in the chip is insufficient, it is necessary to suspend the segmentation encryption / decryption operation of other new code stream segmentation processing tasks until a code stream segmentation processing task is processed and the dedicated hardware memory resources occupied by it are released, and then the segmentation encryption / decryption operation of the new code stream segmentation processing task can be performed.

[0037] Obviously, the existing processing mechanism makes the chip unable to guarantee the processing efficiency of important code streams.

[0038] In order to solve the above problems, the purpose of the present disclosure is to provide a code stream processing solution to ensure the processing efficiency of important code streams as much as possible. The present disclosure will be introduced below.

[0039] First, if Figure 1 As shown, the embodiment of the present disclosure provides a code stream processing method, including the following steps.

[0040] S110: When a new bitstream segment processing task is received and there is no idle chip hardware resource currently, it is determined whether there is a target bitstream segment processing task in the historical bitstream segment processing tasks.

[0041] For the chip, in different application scenarios, different masters may generate code streams with different data sizes. After the chip receives the code stream segmentation processing task, it can perform segmented encryption or segmented decryption operations on it, and then send the processed code stream to other IP (intellectual property) modules for subsequent processing.

[0042] For example, if the encrypted coded data needs to be displayed, the HOST end (host end) sends the encrypted code stream data (code stream segmentation processing task) to the chip. After the chip receives the encrypted code stream data, the execution subject in the chip for executing this method processes the encrypted code stream data in segments by calling the hardware acceleration engine (Security System Acceleration Engine, SSE) in the chip. In this application scenario, the encrypted code stream data is specifically decrypted in segments, the decrypted code stream data is sent to the VPU (Video Processing Unit) for decoding, and the decoded final data is sent to the DC (Dispaly Control) for display.

[0043] The execution subject for executing the method may be a processor with data processing capability located in a chip, such as a CPU.

[0044] Based on the above, in the embodiment of the present disclosure, a dedicated hardware memory (i.e., the chip hardware resources hereinafter) is pre-opened in the hardware memory resources of the chip to store the intermediate variables generated by the hardware acceleration engine during the segmented encryption / decryption process of each code stream.

[0045] When the chip hardware resources are initially sufficient, the execution subject of this method will allocate the segment processing tasks of each code stream received successively to each chip hardware resource in turn, so that the hardware acceleration engine can perform segmented encryption / decryption on the code stream allocated with the chip hardware resources.

[0046] As the number of code stream segmentation processing tasks in chip processing gradually increases, there may be a situation where there are no idle chip hardware resources temporarily. In this case, in order to prevent code stream segmentation processing tasks with lower importance from occupying chip hardware resources for a long time, in the embodiment of the present disclosure, when the execution subject receives a new code stream segmentation processing task and there are currently no idle chip hardware resources, it starts to determine whether there is a target code stream segmentation processing task in the historical code stream segmentation processing tasks.

[0047] The historical code stream segment processing task is a code stream segment processing task currently occupying chip hardware resources, and the priority of the target code stream segment processing task is lower than the priority of the new code stream segment processing task.

[0048] S120: If yes, the intermediate variables stored in the target chip hardware resources currently occupied by the target stream segmentation processing task are temporarily stored in the software memory, and the target chip hardware resources are released to the new stream segmentation processing task, so that the hardware acceleration engine in the chip processes the new stream segmentation processing task.

[0049] In the above process, when insufficient chip hardware resources occur, the embodiment of the present disclosure compares the priority of the new code stream segmentation processing task with the priority of the historical code stream segmentation processing task that is occupying the chip hardware resources, and releases the chip hardware resources currently occupied by the target code stream segmentation processing task whose priority is lower than the priority of the new code stream segmentation processing task to the new code stream segmentation processing task with a higher priority, so that the hardware acceleration engine can process the new code stream segmentation processing task with a higher degree of importance in a timely manner, thereby ensuring the processing efficiency of important code streams as much as possible.

[0050] Of course, if there is no target stream segmentation processing task, it means that the importance of the new stream segmentation processing task is not higher than the historical stream segmentation processing task that is occupying the chip hardware resources. At this time, all the data of the new stream segmentation processing task can be temporarily stored in the software memory to wait for the chip hardware resources to be released before being allocated to the new stream segmentation processing task.

[0051] The above process will be explained in detail below.

[0052] As mentioned above, the priority of each code stream segment processing task is predetermined by the execution subject of the method, and the priority can be used to indicate the importance of each code stream segment processing task.

[0053] For a stream segmentation processing task, the higher its priority, the higher the importance of the corresponding stream. For example, the stream corresponding to the high-priority stream segmentation processing task can be a stream related to data security; it can also be a stream with high real-time requirements, such as video; or it can be a relatively urgent stream. Of course, the above description of the high-importance stream category is only an example. It can be understood that in actual application, adaptive adjustments can be made according to user needs.

[0054] In some embodiments, the process or virtual machine used to generate the bitstream segment processing task is pre-determined with a corresponding priority. When determining the priority of each bitstream segment processing task, the priority of the bitstream segment processing task generated by it can be determined according to the priority corresponding to the process or virtual machine that generates the bitstream segment processing task.

[0055] On the basis that each code stream segmentation processing task has a corresponding priority, for the convenience of description, the embodiment of the present disclosure refers to the priority of a new code stream segmentation processing task as the first priority, and the code stream segmentation processing task with the lowest priority among the historical code stream segmentation processing tasks currently occupying chip hardware resources as a candidate code stream segmentation processing task, and the priority of the candidate code stream segmentation processing task is referred to as the second priority.

[0056] In one embodiment of the present disclosure, the first priority can be directly compared with the lowest priority in the historical code stream segmentation processing tasks to determine whether there is a target code stream segmentation processing task currently. Specifically, judging whether there is a target code stream segmentation processing task in the historical code stream segmentation processing tasks can include: directly comparing the first priority and the second priority. In the case where the first priority indicates that the first priority is higher than the second priority, determining that the candidate code stream segmentation processing task is the target code stream segmentation processing task; otherwise, determining that the target code stream segmentation processing task does not currently exist.

[0057] Among them, the priority can be represented by numbers, and the larger the value of the number, the higher the priority it represents. Correspondingly, the first size relationship indicates that the first priority is higher than the second priority, which means that the value of the number corresponding to the first priority is greater than the value of the number corresponding to the second priority.

[0058] Of course, when using numbers to represent priority, the smaller the number, the higher the priority it represents. Correspondingly, the first size relationship indicates that the first priority is higher than the second priority, which means that the number corresponding to the first priority is smaller than the number corresponding to the second priority.

[0059] In addition, other characters can be used to indicate priority, and the priority relationship between different characters can be agreed upon in advance. Correspondingly, the first size relationship indicates that the first priority is higher than the second priority, which means that the priority of the character corresponding to the first priority is higher than the priority of the character corresponding to the second priority.

[0060] In another embodiment of the present disclosure, before comparing the first priority with the lowest priority (i.e., the second priority) in the historical code stream segmentation processing tasks, a pre-judgment can be performed on the new code stream segmentation processing task, and the pre-judgment is used to determine whether the new code stream segmentation processing task is the code stream segmentation processing task with the lowest priority among all possible code stream segmentation processing tasks. If so, it can be directly determined that there is no target code stream segmentation processing task at present, and no subsequent judgment is required, thereby saving comparison time and computing power; if not, the first priority is compared with the lowest priority (i.e., the second priority) in the historical code stream segmentation processing tasks.

[0061] Accordingly, in this implementation, judging whether there is a target stream segmentation processing task in the historical stream segmentation processing tasks may include: comparing the first priority and the second size relationship of the priority threshold; the first priority is the priority of the new stream segmentation processing task, and the priority threshold represents the lowest priority that may exist for all stream segmentation processing tasks. The priority threshold is determined in advance by the execution subject according to the priority division mechanism. For example, there may be 64 priorities for all stream segmentation processing tasks, and the priority is represented by numbers 1 to 64. The larger the value, the smaller the priority. Accordingly, the priority threshold is set to 64.

[0062] In the case where the second size relationship indicates that the first priority is higher than the priority threshold, the first size relationship between the first priority and the second priority is compared, and the second priority is the priority of the candidate code stream segmentation processing task with the lowest priority among the historical code stream segmentation processing tasks; in the case where the first size relationship indicates that the first priority is higher than the second priority, the candidate code stream segmentation processing task is determined to be the target code stream segmentation processing task.

[0063] Correspondingly, when the second size relationship indicates that the first priority is not higher than the priority threshold, or when the first size relationship indicates that the first priority is not higher than the second priority, it is determined that the target code stream segment processing task does not exist.

[0064] Regarding the acquisition of the above-mentioned second priority, the priorities of various historical code stream segment processing tasks can be monitored, the current lowest priority can be dynamically recorded and updated in real time, wherein the current lowest priority is the second priority.

[0065] Based on any of the above implementations, if there is currently a candidate code stream segmentation processing task, then when the first size relationship indicates that the first priority is higher than the second priority, the candidate code stream segmentation processing task is determined as the target code stream segmentation processing task, that is, the current only candidate code stream segmentation processing task is determined as the target code stream segmentation processing task.

[0066] Based on any of the above implementations, if there are currently multiple candidate code stream segmentation processing tasks with the same priority, then when the first size relationship indicates that the first priority is higher than the second priority, determining the candidate code stream segmentation processing task as the target code stream segmentation processing task may specifically include: from multiple candidate code stream segmentation processing tasks, selecting a candidate code stream segmentation processing task that meets preset conditions as the target code stream segmentation processing task.

[0067] The preset condition includes any one of the following:

[0068] The task execution degree of the candidate code stream segment processing task is the lowest, and the number of remaining unprocessed segments of the candidate code stream segment processing task is the largest.

[0069] Among them, the number of segments of each code stream segmentation processing task is determined by software when the code stream segmentation processing task is generated, and the task execution degree of the candidate code stream segmentation processing task is equal to the ratio of the number of processed segments of the candidate code stream segmentation processing task to the total number of segments of the candidate code stream segmentation processing task.

[0070] As mentioned above, after determining the target bitstream segmentation processing task, it is necessary to temporarily store the intermediate variables stored in the target chip hardware resources currently occupied by the target bitstream segmentation processing task in the software memory. Subsequently, with the continuous processing of each bitstream segmentation processing task, idle chip hardware resources may be generated. In this case, if there is no new bitstream segmentation processing task with a higher priority than the target bitstream segmentation processing task, and there are currently idle chip hardware resources, the intermediate variables temporarily stored in the software memory will be moved back to the idle chip hardware resources, so that the hardware acceleration engine can resume the processing progress of the target bitstream segmentation processing task.

[0071] In addition, based on similar inventive concepts, the embodiment of the present disclosure also provides a bit stream processing device 400, such as Figure 2 As shown, the bit stream processing device 400 includes a determination module 410 and an execution module 420 .

[0072] The judging module 410 is used to judge whether there is a target stream segmentation processing task in the historical stream segmentation processing tasks when a new stream segmentation processing task is received and there is no idle chip hardware resource at present; the historical stream segmentation processing task is the stream segmentation processing task currently occupying the chip hardware resource, and the priority of the target stream segmentation processing task is lower than the priority of the new stream segmentation processing task;

[0073] The execution module 420 is used to temporarily store the intermediate variables stored in the target chip hardware resources currently occupied by the target code stream segmentation processing task into the software memory when the judgment module judges that it is yes, and release the target chip hardware resources to the new code stream segmentation processing task so that the hardware acceleration engine in the chip can process the new code stream segmentation processing task.

[0074] In a feasible implementation of the present disclosure, the judgment module 410 is specifically used to: compare a first size relationship between a first priority and a second priority, wherein the first priority is the priority of the new code stream segmentation processing task, and the second priority is the priority of the candidate code stream segmentation processing task with the lowest priority among the historical code stream segmentation processing tasks; when the first size relationship indicates that the first priority is higher than the second priority, determine that the candidate code stream segmentation processing task is the target code stream segmentation processing task; otherwise, determine that the target code stream segmentation processing task does not exist.

[0075] In a feasible implementation of the present disclosure, the judgment module 410 is specifically used to: compare the second size relationship between the first priority and the priority threshold; the first priority is the priority of the new code stream segmentation processing task, and the priority threshold represents the lowest priority that may exist among all code stream segmentation processing tasks; when the second size relationship represents that the first priority is higher than the priority threshold, compare the first size relationship between the first priority and the second priority, and the second priority is the priority of the candidate code stream segmentation processing task with the lowest priority among the historical code stream segmentation processing tasks; when the first size relationship represents that the first priority is higher than the second priority, determine that the candidate code stream segmentation processing task is the target code stream segmentation processing task; when the second size relationship represents that the first priority is not higher than the priority threshold, or when the first size relationship represents that the first priority is not higher than the second priority, determine that the target code stream segmentation processing task does not exist.

[0076] In a feasible implementation of the present disclosure, the judging module 410 is specifically configured to: when the number of the candidate bitstream segment processing tasks is not one, select a candidate bitstream segment processing task that meets a preset condition from a plurality of candidate bitstream segment processing tasks as the target bitstream segment processing task;

[0077] The preset condition includes any one of the following: the task execution degree of the candidate code stream segment processing task is the lowest, and the number of remaining unprocessed segments of the candidate code stream segment processing task is the largest.

[0078] In a feasible implementation of the present disclosure, the task execution degree of the candidate code stream segment processing task is equal to the ratio of the number of processed segments of the candidate code stream segment processing task to the total number of segments of the candidate code stream segment processing task.

[0079] In a feasible implementation of the present disclosure, the device further includes an acquisition module, which is used to acquire the priority of each of the historical code stream segment processing tasks and dynamically record the current lowest priority, where the current lowest priority is the second priority.

[0080] In a feasible implementation of the present disclosure, the execution module 420 is also used to: when there is currently no new code stream segmentation processing task whose priority is higher than the target code stream segmentation processing task, and there are currently idle chip hardware resources, save the intermediate variables temporarily stored in the software memory to the idle chip hardware resources, so that the hardware acceleration engine continues to process the target code stream segmentation processing task.

[0081] In a feasible implementation of the present disclosure, the code stream segment processing task is used to perform segment-by-segment encryption or segment-by-segment decryption on the code stream.

[0082] In a feasible implementation of the present disclosure, the execution module 420 is further configured to temporarily store all data of the new bitstream segmentation processing task in the software memory when the target bitstream segmentation processing task does not exist.

[0083] It is worth pointing out that for matters not mentioned in the device embodiment, reference can be made to the relevant description of the aforementioned method embodiment, which will not be repeated here.

[0084] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a bitstream processing program is stored. When the bitstream processing program is executed, the bitstream processing method provided by any of the above feasible implementations is implemented.

[0085] In addition, an embodiment of the present disclosure also provides a chip, including a processor, a memory connected to the processor, and a hardware acceleration engine, wherein a bit stream processing program that can be executed by the processor is stored in the memory, and when the bit stream processing program is executed by the processor, the bit stream processing method provided by any of the above-mentioned feasible implementation methods is implemented.

[0086] In some usage scenarios, the chip is in the form of a graphics card; in other usage scenarios, the chip is in the form of a CPU motherboard.

[0087] The memory, processor, and other components that may be present in the chip may be electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components may be electrically connected to each other via one or more communication buses or signal lines.

[0088] The memory is used to store computer programs, such as software function modules, i.e., the bitstream processing device 400. The bitstream processing device 400 includes at least one software function module that can be stored in the memory in the form of software (Software) or firmware (Firmware) or in an operating system (OS) fixed in the chip.

[0089] The processor is used to execute the executable modules stored in the memory, such as the software function modules or computer programs included in the bit stream processing device 400.

[0090] The memory can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.

[0091] The processor may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed.

[0092] According to another aspect of the present disclosure, an electronic device is also provided, comprising the above-mentioned chip. In some usage scenarios, the product form of the electronic device is a portable electronic device, such as a smart phone, a tablet computer, a VR device, etc.; in some usage scenarios, the product form of the electronic device is a personal computer, a game console, etc.

[0093] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0094] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram and the combination of processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0095] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0096] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure rather than to limit its protection scope. Although the present disclosure has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the present disclosure, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the disclosed claims to be approved.

Claims

1. A code stream processing method, comprising: When a new bitstream segmentation processing task is received and there is no idle chip hardware resource at present, determining whether there is a target bitstream segmentation processing task in the historical bitstream segmentation processing tasks; the historical bitstream segmentation processing task is the bitstream segmentation processing task currently occupying the chip hardware resources, and the priority of the target bitstream segmentation processing task is lower than the priority of the new bitstream segmentation processing task; If so, the intermediate variables stored in the target chip hardware resources currently occupied by the target code stream segmentation processing task are temporarily stored in the software memory, and the target chip hardware resources are released to the new code stream segmentation processing task so that the hardware acceleration engine in the chip can process the new code stream segmentation processing task.

2. The bitstream processing method according to claim 1, wherein the step of determining whether there is a target bitstream segment processing task in the historical bitstream segment processing tasks comprises: Comparing a first size relationship between a first priority and a second priority, wherein the first priority is the priority of the new code stream segment processing task, and the second priority is the priority of a candidate code stream segment processing task with the lowest priority among the historical code stream segment processing tasks; In a case where the first size relationship indicates that the first priority is higher than the second priority, determining the candidate bitstream segment processing task as the target bitstream segment processing task; Otherwise, it is determined that there is no target code stream segment processing task.

3. The bitstream processing method according to claim 1, wherein the step of determining whether there is a target bitstream segment processing task in the historical bitstream segment processing tasks comprises: comparing the first priority level with a second magnitude relationship of the priority threshold; The first priority is the priority of the new bitstream segment processing task, and the priority threshold represents the lowest priority that may exist among all bitstream segment processing tasks; When the second size relationship indicates that the first priority is higher than the priority threshold, comparing the first size relationship between the first priority and the second priority, the second priority being the priority of the candidate code stream segment processing task with the lowest priority among the historical code stream segment processing tasks; In a case where the first size relationship indicates that the first priority is higher than the second priority, determining the candidate bitstream segment processing task as the target bitstream segment processing task; When the second size relationship indicates that the first priority is not higher than the priority threshold, or when the first size relationship indicates that the first priority is not higher than the second priority, it is determined that the target code stream segment processing task does not exist.

4. The bitstream processing method according to claim 2 or 3, wherein determining the candidate bitstream segment processing task as the target bitstream segment processing task comprises: When the number of the candidate bitstream segment processing tasks is not one, selecting a candidate bitstream segment processing task that meets a preset condition from a plurality of candidate bitstream segment processing tasks as the target bitstream segment processing task; The preset condition includes any of the following: The task execution degree of the candidate code stream segment processing task is the lowest, and the number of remaining unprocessed segments of the candidate code stream segment processing task is the largest.

5. According to the code stream processing method of claim 4, the task execution degree of the candidate code stream segmentation processing task is equal to the ratio of the number of processed segments of the candidate code stream segmentation processing task to the total number of segments of the candidate code stream segmentation processing task.

6. The code stream processing method according to claim 2 or 3, the method further comprising: The priorities of the various historical code stream segment processing tasks are obtained, and the current lowest priority is dynamically recorded, where the current lowest priority is the second priority.

7. The code stream processing method according to any one of claims 1 to 3, further comprising: When there is no new code stream segmentation processing task whose priority is higher than the target code stream segmentation processing task, and there are idle chip hardware resources, the intermediate variables temporarily stored in the software memory are saved to the idle chip hardware resources so that the hardware acceleration engine continues to process the target code stream segmentation processing task.

8. According to the bit stream processing method according to any one of claims 1 to 3, the bit stream segment processing task is used to perform segment-by-segment encryption or segment-by-segment decryption on the bit stream.

9. The code stream processing method according to any one of claims 1 to 3, further comprising: In the case that the target code stream segment processing task does not exist, all data of the new code stream segment processing task are temporarily stored in the software memory.

10. A code stream processing device, comprising: A judgment module, used for judging whether there is a target stream segmentation processing task in the historical stream segmentation processing tasks when a new stream segmentation processing task is received and there is no idle chip hardware resource at present; the historical stream segmentation processing task is the stream segmentation processing task currently occupying the chip hardware resource, and the priority of the target stream segmentation processing task is lower than the priority of the new stream segmentation processing task; The execution module is used to temporarily store the intermediate variables stored in the target chip hardware resources currently occupied by the target code stream segmentation processing task into the software memory when the judgment module judges that the result is yes, and release the target chip hardware resources to the new code stream segmentation processing task so that the hardware acceleration engine can process the new code stream segmentation processing task.

11. A computer-readable storage medium, wherein a bitstream processing program is stored on the computer-readable storage medium, and when the bitstream processing program is executed, the bitstream processing method according to any one of claims 1 to 9 is implemented.

12. A chip comprising a processor, a memory connected to the processor, and a hardware acceleration engine, wherein a bitstream processing program executable by the processor is stored in the memory, and when the bitstream processing program is executed by the processor, the bitstream processing method according to any one of claims 1 to 9 is implemented.

13. An electronic device comprising the chip according to claim 12.