Code processing method, device and equipment

By combining multiple subcodes into a converged code group in the terminal device and sharing the same memory access code, the problem of high memory occupancy rate of multiple algorithm modules in the terminal device is solved, and efficient resource utilization is achieved.

CN114327485BActive Publication Date: 2025-07-18XIAN UNISOC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111670212.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2025-07-18
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

Multiple algorithm modules in terminal devices occupy a large memory during data processing, resulting in waste of resources.

Method used

By determining multiple subcodes in the project code, the subcodes with memory access requirements are combined into a fused code group based on the demand information, and the same memory access code is shared to reduce the memory usage rate.

Benefits of technology

Through fusion processing, the terminal device only needs to allocate bandwidth and memory to the target code once to complete the data processing tasks of multiple subcodes, reducing the memory usage rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114327485B_ABST
    Figure CN114327485B_ABST
Patent Text Reader

Abstract

The present application provides a code processing method, apparatus and device. The method includes: determining a plurality of sub-codes included in project code; determining a plurality of candidate sub-codes from the plurality of sub-codes according to the requirement information of the plurality of sub-codes, where the candidate sub-codes have memory access requirements; determining at least one fusion code group from the plurality of candidate sub-codes, where the fusion code group includes at least two candidate sub-codes; respectively performing fusion processing on the sub-codes in each fusion code group to obtain target code corresponding to the project code, wherein, in the target code, the sub-codes in one fusion code group share the same memory access code. The occupancy rate of memory is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and in particular, to a code processing method, apparatus, and device. Background Art

[0002] Multiple algorithm modules can be set in a terminal device, and each algorithm module needs to access the memory of the terminal device when processing data.

[0003] Currently, memory access codes can be configured in the algorithm module to enable the algorithm module to access the memory of the terminal device. For example, the noise reduction module in the chip can independently access the on-chip storage DDR, and the deinterlacing module can also independently access the on-chip storage DDR. However, each algorithm module needs to occupy the corresponding bandwidth and memory when reading and writing the DDR, which leads to a relatively large occupancy rate of the memory. Summary of the Invention

[0004] This application provides a code processing method, apparatus, and device, which are used to solve the technical problem of relatively large occupancy rate of the memory in the prior art.

[0005] In a first aspect, this application provides a code processing method, which includes:

[0006] Determine multiple sub-codes included in the project code;

[0007] According to the requirement information of the multiple sub-codes, determine multiple candidate sub-codes in the multiple sub-codes, and the candidate sub-codes have memory access requirements;

[0008] Determine at least one fusion code group in the multiple candidate sub-codes, and the fusion code group includes at least two candidate sub-codes;

[0009] Perform fusion processing on the sub-codes in each fusion code group respectively to obtain the target code corresponding to the project code. Among them, in the target code, the sub-codes in one fusion code group share the same memory access code.

[0010] In a possible implementation manner, determining at least one fusion code group in the multiple candidate sub-codes includes:

[0011] Perform a test operation, and the test operation includes: determine at least one group of i-th sub-codes in the multiple candidate sub-codes, perform fusion processing on the at least one group of i-th sub-codes respectively to obtain the i-th candidate fusion code, and obtain the i-th test data processing result corresponding to the i-th candidate fusion code;

[0012] If the similarity between the processing result of the i-th test data and the preset data processing result is greater than or equal to the preset threshold, then determine the at least one i-th sub-code group as the at least one fusion code group;

[0013] If the similarity between the processing result of the i-th test data and the preset data processing result is less than the preset threshold, then set i to i + 1 and perform the test operation until i is N, or when the similarity between the processing result of the i-th test data and the preset data processing result is greater than or equal to the preset threshold, determine the at least one i-th sub-code group as the at least one fusion code group;

[0014] Wherein, initially, i is 1; there is one sub-code group in the at least one i-th sub-code group that includes N + 1 - i candidate sub-codes, and N is the number of the multiple candidate sub-codes.

[0015] In a possible implementation manner, determining at least one i-th sub-code group among the multiple candidate sub-codes includes:

[0016] Determine the first i-th sub-code group among the multiple candidate sub-codes, and the first i-th sub-code group includes N + 1 - i sub-codes;

[0017] If i is less than or equal to 2, then determine the first i-th sub-code group as the at least one i-th sub-code group;

[0018] If i is greater than 2, then perform a fusion process on the other sub-codes in the multiple candidate sub-codes except the first i-th sub-code group to obtain a sub-code group, and determine the sub-code group and the first i-th sub-code group as the at least one i-th sub-code group.

[0019] In a possible implementation manner, obtaining the processing result of the i-th candidate fusion code corresponding to the i-th test data includes:

[0020] Obtain preset data;

[0021] Process the preset data through the i-th candidate fusion code to obtain the processing result of the i-th test data.

[0022] In a possible implementation manner, the preset data processing result is obtained by processing the preset data through the project code.

[0023] In a possible implementation manner, for any one fusion code group; performing a fusion process on the candidate sub-codes in the fusion code group includes:

[0024] Determine the memory access code corresponding to each candidate sub-code in the fusion code group;

[0025] According to the memory access codes corresponding to each sub-code, perform a fusion process on the sub-codes in the fusion code group to obtain the sub-codes after the fusion process that share the memory access codes.

[0026] In a possible implementation, the project code is an image processing code.

[0027] In a second aspect, the present application provides a code processing device, which includes a first determination module, a second determination module, a third determination module, and a fusion module, where:

[0028] The first determination module is configured to determine a plurality of sub-codes included in the project code;

[0029] The second determination module is configured to determine a plurality of candidate sub-codes from the plurality of sub-codes according to the requirement information of the plurality of sub-codes, and the candidate sub-codes have memory access requirements;

[0030] The third determination module is configured to determine at least one fusion code group from the plurality of candidate sub-codes, and the fusion code group includes at least two candidate sub-codes;

[0031] The fusion module is configured to perform a fusion process on the sub-codes in each fusion code group respectively to obtain the target code corresponding to the project code. Among them, in the target code, the sub-codes in one fusion code group share the same memory access code.

[0032] In a possible implementation, the third determination module is specifically configured to:

[0033] Perform a test operation, where the test operation includes: determining at least one i-th sub-code group from the plurality of candidate sub-codes, performing a fusion process on the at least one i-th sub-code group respectively to obtain an i-th candidate fusion code, and obtaining an i-th test data processing result corresponding to the i-th candidate fusion code;

[0034] If the similarity between the i-th test data processing result and a preset data processing result is greater than or equal to a preset threshold, then determine the at least one i-th sub-code group as the at least one fusion code group;

[0035] If the similarity between the i-th test data processing result and the preset data processing result is less than the preset threshold, then set i to i + 1 and perform the test operation until i is N, or when the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, determine the at least one i-th sub-code group as the at least one fusion code group;

[0036] Wherein, initially, i is 1; there is one sub-code group among the at least one i-th sub-code group that includes N + 1 - i candidate sub-codes, and N is the number of the multiple candidate sub-codes.

[0037] In a possible implementation manner, the third determination module is specifically configured to:

[0038] Determine the first i-th sub-code group among the multiple candidate sub-codes, where the first i-th sub-code group includes N + 1 - i sub-codes;

[0039] If i is less than or equal to 2, determine the first i-th sub-code group as the at least one i-th sub-code group;

[0040] If i is greater than 2, perform a fusion process on the other sub-codes among the multiple candidate sub-codes except the first i-th sub-code group to obtain a sub-code group, and determine the sub-code group and the first i-th sub-code group as the at least one i-th sub-code group.

[0041] In a possible implementation manner, the third determination module is specifically configured to:

[0042] Obtain preset data;

[0043] Process the preset data through the i-th candidate fusion code to obtain the i-th test data processing result.

[0044] In a possible implementation manner, the fusion module is specifically configured to:

[0045] Determine the memory access code corresponding to each candidate sub-code in the fusion code group;

[0046] According to the memory access code corresponding to each sub-code, perform a fusion process on the sub-codes in the fusion code group to obtain the sub-codes after the fusion process sharing the memory access code.

[0047] In a possible implementation manner, the project code is an image processing code.

[0048] In a third aspect, the present application provides a terminal device, including: a processor and a memory;

[0049] The memory stores computer execution instructions;

[0050] The processor executes the computer execution instructions stored in the memory, so that the processor executes the code processing method as described in the first aspect.

[0051] Fourthly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the code processing method described in any one of the foregoing items.

[0052] Fifthly, the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the steps of the code processing method described in any one of the foregoing items.

[0053] The present application provides a code processing method, device, and equipment, which determine a plurality of sub-codes included in a project code, and determine a plurality of candidate sub-codes among the plurality of sub-codes according to the requirement information of the plurality of sub-codes. Among them, the candidate sub-codes have memory access requirements. At least one fusion code group is determined among the plurality of candidate sub-codes. The fusion code group includes at least two candidate sub-codes. The sub-codes in each fusion code group are respectively fused to obtain the target code corresponding to the project code. Among them, in the target code, the sub-codes in one fusion code group share the same memory access code. In the above method, the terminal device can determine at least one fusion code group among the plurality of candidate sub-codes. Since the fusion code group includes at least two sub-codes, when the memory is read and written through the fusion code group, the terminal device only needs to allocate the bandwidth and memory once to complete the tasks of the two sub-codes, thereby reducing the occupancy rate of the memory. Description of the Drawings

[0054] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0055] Figure 2 It is a schematic flowchart of a code processing method provided by an embodiment of the present application;

[0056] Figure 3 It is a schematic diagram of an image processing process provided by an embodiment of the present application;

[0057] Figure 4 It is a schematic diagram of the processing result of test data provided by an embodiment of the present application;

[0058] Figure 5 It is a schematic flowchart of another code processing method provided by an embodiment of the present application;

[0059] Figure 6A It is a schematic diagram of the process of determining the i-th sub-code group provided by an embodiment of the present application;

[0060] Figure 6B It is a schematic diagram of another process of determining the i-th sub-code group provided by an embodiment of the present application;

[0061] Figure 6C Another schematic diagram of the process for determining the i-th sub-code group provided by the embodiment of the present application;

[0062] Figure 7 A schematic diagram of the process of a code processing method provided by the embodiment of the present application;

[0063] Figure 8 A schematic diagram of the structure of a code processing device provided by the embodiment of the present application;

[0064] Figure 9 A schematic diagram of the hardware structure of the terminal device provided by the present application. Detailed implementation manners

[0065] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0066] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or device including that element.

[0067] For the sake of easy understanding, first, the concepts involved in the embodiment of the present application will be described.

[0068] Terminal device: A device with wireless transceiver functions. The terminal device can be deployed on land, including indoors or outdoors, handheld, wearable, or vehicle-mounted; it can also be deployed on water (such as ships, etc.); it can also be deployed in the air (such as airplanes, balloons, satellites, etc.). The terminal device can be a mobile phone, a tablet computer (Pad), a computer with wireless transceiver functions, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a vehicle-mounted terminal device, a wireless terminal in self-driving, a wireless terminal device in remote medical, a wireless terminal device in smart grid, a wireless terminal device in transportation safety, a wireless terminal device in smart city, a wireless terminal device in smart home, a wearable terminal device, etc. The terminal device involved in the embodiments of the present application can also be referred to as a terminal, a user equipment (UE), an access terminal device, a vehicle-mounted terminal, an industrial control terminal, a UE unit, a UE station, a mobile station, a mobile unit, a remote station, a remote terminal device, a mobile device, a UE terminal device, a wireless communication device, a UE agent, or a UE device, etc. The terminal device can also be fixed or mobile.

[0069] In the related art, multiple algorithm modules in a terminal device need to access the memory of the terminal device when performing data processing. For example, when the terminal device performs image magnification, multiple image algorithm modules can be used to process the image, and then the effect of image magnification can be achieved. Currently, when the algorithm modules of the terminal device perform data processing, they need to separately access the memory of the terminal device and perform read and write operations in the memory. For example, when performing image processing, first, the image is processed by algorithm module A, then the output of algorithm module A is processed by algorithm module B, and finally, the output of algorithm module B is processed by algorithm module C to obtain the processed image. However, during the image processing process, each algorithm module needs to perform read and write operations in the memory, and each time a read and write operation is performed, the terminal device needs to allocate corresponding bandwidth and memory. For example, the terminal device needs to allocate bandwidth and memory for the above algorithm module A, algorithm module B, and algorithm module C respectively. This results in a relatively large occupancy rate of the memory during data processing.

[0070] To solve the technical problem of large memory occupancy during data processing in related technologies, an embodiment of the present application provides a code processing method. Determine multiple sub-codes included in the project code. According to the requirement information of the multiple sub-codes, determine multiple candidate sub-codes that need to access memory among the multiple sub-codes. By traversing, determine at least one fusion code group among the multiple candidate sub-codes. Each fusion code group includes at least two candidate sub-codes. Determine the memory access code corresponding to each sub-code in the fusion code group, and according to the memory access code corresponding to each sub-code, perform fusion processing on the sub-codes in the fusion code group to obtain the memory access code shared by the sub-codes after fusion processing, and then obtain the target code corresponding to the project code. In this way, since the multiple candidate sub-codes are fused, when the target code processes data, the terminal device only needs to allocate bandwidth and memory once for the target code to implement the data processing tasks of two sub-codes, thereby reducing the memory occupancy rate.

[0071] Next, in combination with Figure 1 , the application scenario of the present application will be described.

[0072] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application. Please refer to Figure 1 , including: project code and DDR. Among them, the project code includes sub-code A and a fusion code, and the fusion code includes sub-code B and sub-code C. When processing an image through the project code, sub-code A performs one read operation and one write operation on the DDR, and the fusion code performs one read operation and one write operation on the DDR. In this way, since the fusion code includes sub-code B and sub-code C, once you, the project code only needs to access the DDR 2 times to complete the processing of the image, thereby reducing the memory occupancy rate.

[0073] Next, the technical solution shown in the present application will be described in detail through specific embodiments. It should be noted that the following embodiments can exist independently or be combined with each other. For the same or similar content, it will not be repeated in different embodiments.

[0074] Figure 2 It is a flowchart of a code processing method provided by an embodiment of the present application. Please refer to Figure 2 , the method may include:

[0075] S201. Determine multiple sub-codes included in the project code.

[0076] The execution subject of the embodiment of the present application can be a terminal device or a code processing device set in the terminal device. Optionally, the code processing device can be implemented by software or by a combination of software and hardware.

[0077] Optionally, the project code is used to process data. For example, the project code is an image processing code. Optionally, each project code has a corresponding project function. For example, the project function corresponding to the project code can be an image magnification function, an image reduction function, an image cropping function, etc. For example, when the project function corresponding to the project code is an image magnification function, the project code can magnify the image; when the project function corresponding to the project code is an image reduction function, the project code can reduce the image.

[0078] The sub-code can be a function code in the project code. For example, if the project function corresponding to the project code is an image magnification function, the sub-code can be the function code required for image magnification; if the project function corresponding to the project code is an image reduction function, the sub-code can be the function code required for image reduction. For example, when performing the image magnification function, multiple sub-codes corresponding to the project code can include a noise reduction sub-code, a de-interlacing sub-code, etc. Optionally, multiple sub-codes can be obtained from the project code. For example, after the terminal device obtains the project code input by the user, the terminal device can determine multiple sub-codes in the project code.

[0079] Optionally, the sub-code can be an algorithm module integrated in the chip. Each algorithm module is set with a corresponding sub-code, and the project function corresponding to the project code is implemented through multiple algorithm modules.

[0080] Next, in conjunction with Figure 3 , the process of processing the image by the project code will be described.

[0081] Figure 3 FIG. is a schematic diagram of an image processing process provided by an embodiment of the present application. Please refer to Figure 3 , which includes a project code and an image A. Among them, the project code includes sub-code A, sub-code B, and sub-code C. The image A is input into the project code. The sub-code A processes the image A to obtain an image B and sends the image B to the sub-code B. When the sub-code B receives the image B, the sub-code B processes the image B to obtain an image C and sends the image C to the sub-code C. When the sub-code C receives the image C, the sub-code C processes the image C to obtain an image D. Among them, the image D is the code after the project code processes the image A.

[0082] S202. According to the requirement information of multiple sub-codes, determine multiple candidate sub-codes among the multiple sub-codes. The candidate sub-codes have memory access requirements.

[0083] Optionally, the requirement information is used to indicate whether the sub-code needs to access the memory. Optionally, the memory of the terminal device can be on-chip storage DDR. For example, when the sub-code performs image processing, read and write operations of the image can be performed in the DDR.

[0084] Optionally, the sub-code to be selected is a sub-code with memory access requirements. Optionally, it is possible to determine whether the sub-code has memory access requirements according to the requirement information of the sub-code. For example, if the requirement information of the sub-code indicates that the sub-code needs to perform read and / or write operations on the DDR during image processing, it is determined that the sub-code has memory access requirements. If the requirement information of the sub-code indicates that the sub-code does not need to perform read and / or write operations in the DDR during image processing, it is determined that the sub-code does not have memory access requirements.

[0085] Optionally, it is possible to determine the sub-code to be selected from multiple sub-codes according to the memory access requirements of the sub-code. For example, if the sub-code has memory access requirements during image processing, it is determined that the sub-code is the sub-code to be selected. If the sub-code does not have memory access requirements during image processing, it is determined that the sub-code is not the sub-code to be selected. For example, the project code includes sub-code A, sub-code B, and sub-code C. When the project code processes the image, if sub-code A and sub-code B need to perform read and write operations in the DDR, and sub-code C does not need to perform read or write operations in the DDR, the terminal device determines that the sub-codes to be selected in the project code are sub-code A and sub-code B.

[0086] S203. Determine at least one fusion code group from multiple sub-codes to be selected. The fusion code group includes at least two sub-codes to be selected.

[0087] Optionally, the fusion code group includes at least two sub-codes to be selected. For example, if the sub-codes to be selected in the project code include sub-code A and sub-code B, and sub-code A and sub-code B can be fused, the fusion code group includes sub-code A and sub-code B.

[0088] Optionally, at least one set of merged codes can be determined from multiple candidate sub-codes according to the following feasible implementation methods: perform a test operation. Optionally, the test operation includes: determining at least one set of i-th sub-codes from multiple candidate sub-codes. Among them, at the initial stage of the test, i is 1, and there is a sub-code group in at least one set of i-th sub-codes that includes N + 1 - i sub-codes, where N is the number of multiple candidate sub-codes. For example, the set of i-th sub-codes may include one sub-code group or multiple sub-code groups, but there is a sub-code group that includes N + 1 - i candidate sub-codes. For example, the project code includes 8 candidate sub-codes. When i is 1, the first set of sub-codes includes 8 candidate sub-codes (i.e., all candidate sub-codes). When i is 3, the third set of sub-codes includes 2 sub-code groups, one of which includes 6 (8 + 1 - 3) candidate sub-codes, and the other includes 2 candidate sub-codes.

[0089] Perform a merging process on at least one set of i-th sub-codes respectively to obtain the i-th candidate merged code. For example, if the set of i-th sub-codes includes one sub-code group, perform a merging process on all candidate sub-codes in this sub-code group. If the set of i-th sub-codes includes sub-code group A and sub-code group B, perform a merging process on the candidate sub-codes in sub-code group A and perform a merging process on the candidate sub-codes in sub-code group B. Optionally, after performing the merging process on the set of i-th sub-codes, the i-th candidate merged code includes the code functions of the candidate sub-codes in the set of i-th sub-codes. For example, if the candidate sub-codes included in the set of i-th sub-codes are noise reduction codes and deinterlacing codes, when the i-th candidate merged code performs image processing, it can perform noise reduction processing and deinterlacing processing on the image.

[0090] Obtain the i-th test data processing result corresponding to the i-th candidate merged code. Among them, the test data processing result is the processing result after the i-th candidate merged code processes the data. For example, the test data processing result is the image obtained after the i-th candidate merged code processes the initial image. Optionally, the i-th test data processing result can be obtained according to the following feasible implementation methods: obtain preset data, and process the preset data through the i-th candidate merged code to obtain the i-th test data processing result. Optionally, the preset data can be image data. After the terminal device obtains the i-th candidate merged code, it can process the image data, and then obtain the i-th test data processing result. For example, the set of i-th sub-codes includes candidate sub-code A and candidate sub-code B. After performing a merging process on them, the i-th candidate merged code is obtained. Input the image data into the project code including the i-th candidate merged code, and then obtain the i-th test data processing result.

[0091] Next, in combination with Figure 4 , the test data processing result will be described.

[0092] Figure 4 A schematic diagram of the test data processing result provided by the embodiment of the present application. Please refer to Figure 4 , including a project code. Among them, the project code includes a sub-code A and a fusion code, and the fusion code includes a sub-code B and a sub-code C. The preset data is image A. Input image A into the project code. The sub-code A processes image A to obtain image B, and inputs image B into the fusion code. The fusion code processes image B to obtain image C. Among them, the test data processing result of the fusion code is image C.

[0093] If the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, at least one i-th sub-code is determined as at least one fusion code group. Optionally, the preset data processing result is obtained by processing the preset data through the project code. For example, the preset data processing result is the result after the sub-codes in the project code separately process the preset data. For example, if the project code includes sub-code A and sub-code B, the preset data processing result is that sub-code A processes the preset data to obtain the processed preset data, and then sub-code B processes the processed preset data to obtain the preset data processing result.

[0094] Optionally, if the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, it means that after the multiple candidate codes in the i-th candidate fusion code are fused, the similarity between the processing result of the preset data and the processing results of the multiple candidate sub-codes separately processing the preset data is relatively high. Furthermore, the multiple candidate sub-codes can be fused. For example, if the i-th test data processing result is the same as the preset data processing result, it means that after the multiple candidate sub-codes in the i-th candidate fusion code are fused, the processing result of the preset data will not be changed. Therefore, the i-th candidate fusion code can be determined as the fusion code group, and then the access times to the DDR are reduced through the fusion code group, thereby reducing the memory occupancy rate.

[0095] If the similarity between the processing result of the i-th test data and the preset data processing result is less than the preset threshold, then increment i by 1 and perform the test operation until i is N, or when the similarity between the processing result of the i-th test data and the preset data processing result is greater than or equal to the preset threshold, determine at least one i-th sub-code group as at least one fusion code group. For example, when i is 1, if the similarity between the processing result of the first test data in the first sub-code group and the preset data processing result is less than the preset threshold, then increment i by 1 to obtain the second sub-code group, and obtain the second test result of the second code group. If the similarity between the processing result of the second test data and the preset data processing result is greater than or equal to the preset threshold, then determine the second sub-code group as the fusion code group. If the similarity between the processing result of the second test data and the preset data is less than the preset threshold, then obtain the processing result of the third test data corresponding to the third sub-code group and determine the similarity between the processing result of the third test data and the preset data processing result.

[0096] S204. Perform a fusion process on the candidate sub-codes in each fusion code group to obtain the target code corresponding to the project code.

[0097] Optionally, in the target code, the sub-codes in a fusion code group share the same memory access code. Optionally, for any one fusion code group, the sub-codes in the fusion code group can be fused according to the following feasible implementation method to obtain the i-th candidate fusion code: Determine the memory access code corresponding to each candidate sub-code in the fusion code group. Optionally, there is a memory access code in each candidate sub-code, and the candidate sub-code accesses the memory of the terminal device through the memory access code. For example, if the candidate sub-code needs to access the image data in the DDR, the candidate sub-code accesses the DDR through the memory access code.

[0098] Fuse the sub-codes in the fusion code group according to the memory access code corresponding to each sub-code to obtain the fused sub-codes sharing the memory access code. For example, when fusing the candidate sub-codes, the terminal device can fuse the memory access codes of multiple candidate sub-codes so that the fusion code group only needs to access the DDR once when performing data processing, thereby reducing the occupancy rate of the memory.

[0099] An embodiment of the present application provides a code processing method, which determines a plurality of sub-codes included in project code, determines a plurality of candidate sub-codes that need to perform memory access among the plurality of sub-codes according to the requirement information of the plurality of sub-codes, determines at least one fusion code group among the plurality of candidate sub-codes in a traversal manner, each fusion code group includes at least two candidate sub-codes, determines the memory access code corresponding to each sub-code in the fusion code group, and performs a fusion process on the sub-codes in the fusion code group according to the memory access code corresponding to each sub-code, to obtain the memory access code shared by the sub-codes after the fusion process, and further obtain the target code corresponding to the project code. In this way, since the plurality of candidate sub-codes are fused, when the target code processes data, the terminal device only needs to allocate bandwidth and memory to the target code once, and can implement the data processing tasks of two sub-codes, thereby reducing the memory occupancy rate.

[0100] Based on the embodiment shown in Figure 2 , the following will combine Figure 5 to elaborate on the above code processing method in detail.

[0101] Figure 5 It is a schematic flowchart of another code processing method provided by an embodiment of the present application. Please refer to Figure 5 , and the method process includes:

[0102] S501. Determine a plurality of sub-codes included in the project code.

[0103] It should be noted that the execution process of step S501 is the same as that of step S201, and this embodiment of the present application will not elaborate on it again.

[0104] S502. Determine a plurality of candidate sub-codes among the plurality of sub-codes according to the requirement information of the plurality of sub-codes, and the candidate sub-codes have memory access requirements.

[0105] It should be noted that the execution process of step S502 is the same as that of step S202, and this embodiment of the present application will not elaborate on it again.

[0106] S503. Determine at least one i-th sub-code group among the plurality of candidate sub-codes.

[0107] Optionally, according to the following feasible implementation methods, at least one group of the i-th sub-codes can be determined from multiple candidate sub-codes: Determine the first group of the i-th sub-codes among multiple candidate sub-codes. Among them, the first group of the i-th sub-codes includes N + 1 - i sub-codes. For example, if there are 10 candidate sub-codes in the project code, when i is 1, the first group of the 1st sub-codes includes 10 candidate sub-codes; when i is 2, the first group of the 2nd sub-codes includes 9 candidate sub-codes; when i is 3, the first group of the 3rd sub-codes includes 8 candidate sub-codes, and the second group of the 3rd sub-codes includes the remaining 2 candidate sub-codes.

[0108] If i is less than or equal to 2, determine the first group of the i-th sub-codes as at least one group of the i-th sub-codes. For example, when performing a test operation, if i is less than or equal to 2, at least one group of the i-th sub-codes only includes the first group of the i-th sub-codes. For example, if there are 10 candidate sub-codes in the project code, when i is 1, the first group of the 1st sub-codes includes 10 candidate sub-codes, and the first group of the 1st sub-codes is determined as the 1st sub-code group; when i is 2, the first group of the 2nd sub-codes includes 9 candidate sub-codes, and the first group of the 2nd sub-codes is determined as the 2nd sub-code group. Optionally, the first group of the i-th sub-codes can be obtained by traversing. For example, the project code includes candidate sub-code A, candidate sub-code B, and candidate sub-code C. When i is 2, the first group of the 2nd sub-codes includes 2 candidate sub-codes. Therefore, the first group of the 2nd sub-codes can be: candidate sub-code A and candidate sub-code B, or candidate sub-code B and candidate sub-code C, or candidate sub-code A and candidate sub-code C.

[0109] If i is greater than 2, perform a fusion process on the other sub-codes in the multiple candidate sub-codes except the i-th sub-code group to obtain a sub-code group, and determine the sub-code group and the first group of the i-th sub-codes as at least one group of the i-th sub-codes. For example, if there are 10 candidate sub-codes in the project code and i is 3, the first group of the 3rd sub-codes includes 8 candidate sub-codes. Perform a fusion process on the remaining 2 candidate sub-codes to obtain a sub-code group, and then determine the sub-code group and the first group of the 3rd sub-codes as the 3rd sub-code group.

[0110] Optionally, when i is greater than 3, the sub-code group includes multiple combinations. For example, if there are 10 candidate sub-codes in the project code and i is 4, the first group of the 4th sub-codes includes 7 candidate sub-codes, and the remaining 3 candidate sub-codes can be combined into a sub-code combination of 2 candidate sub-codes and a sub-code group of 3 candidate sub-codes.

[0111] Next, in combination with Figures 6A - 6C , the process of determining the i-th sub-code group will be described.

[0112] Figure 6ASchematic diagram of a process for determining the i-th sub-code group provided by an embodiment of the present application. In Figure 6A the illustrated embodiment, i is equal to 2. Please refer to Figure 6A , which includes project codes. Among them, the project codes include sub-code A, sub-code B, sub-code C, and sub-code D. When i is 2, it is determined that the first 2nd sub-code group includes sub-code A, code B, and sub-code C.

[0113] Optionally, Figure 6A the first 2nd sub-code group is only an example. In the actual application process, multiple groups of the first 2nd sub-code groups can be obtained by traversing.

[0114] Figure 6B Another schematic diagram of a process for determining the i-th sub-code group provided by an embodiment of the present application. In Figure 6B the illustrated embodiment, i is equal to 3. Please refer to Figure 6B , which includes project codes. Among them, the project codes include sub-code A, sub-code B, sub-code C, sub-code D, and sub-code E. When i is 3, it is determined that the first 3rd sub-code group includes sub-code A, code B, and sub-code C, and it is determined that the sub-code group includes sub-code D and sub-code E.

[0115] Figure 6C Another schematic diagram of a process for determining the i-th sub-code group provided by an embodiment of the present application. In Figure 6C the illustrated embodiment, i is equal to 4. Please refer to Figure 6C , which includes project codes. Among them, the project codes include sub-code A, sub-code B, sub-code C, sub-code D, and sub-code E. When i is 4, it is determined that the first 4th sub-code group includes sub-code A and code B, and it is determined that the sub-code group includes sub-code group A and sub-code group B, where sub-code group A includes sub-code C and sub-code D, and sub-code group B includes sub-code C, sub-code D, and sub-code E.

[0116] S504. Respectively perform a fusion process on at least one i-th sub-code group to obtain an i-th candidate fusion code, and obtain an i-th test data processing result corresponding to the i-th candidate fusion code.

[0117] It should be noted that the execution process of step S504 is the same as that of step S203, and the embodiments of the present application will not elaborate on this again.

[0118] S505. Determine at least one fusion code group from the i-th candidate fusion code according to the i-th test data processing result and the processing result of the preset data.

[0119] It should be noted that the execution process of step S504 is the same as that of step S203, and the embodiments of the present application will not elaborate on this again.

[0120] S506. Perform a fusion process on the sub - codes in each fusion code group respectively to obtain the target code corresponding to the project code.

[0121] Optionally, in the target code, the sub - codes in a fusion code group share the same memory access code. For example, the target code includes candidate sub - code A and candidate sub - code B. If the bandwidth generated by one read or write operation is X, then one read - write operation of candidate sub - code A and candidate sub - code B respectively will generate a bandwidth of 4X. If both candidate sub - code A and candidate sub - code B require the data of the previous frame and the data volume is Y, then the memory sizes required for candidate sub - code A and candidate sub - code B are both Y, and a total of 2Y of memory is required. However, the target code will generate a bandwidth of 2X for one read or write operation. If the target code requires the data of the previous frame and the data volume is Y, then the target sub - code requires Y of memory. In this way, both the bandwidth and the memory are reduced by 50%, thereby reducing the memory occupancy rate.

[0122] The embodiment of the present application provides a code processing method. Determine multiple sub - codes included in the project code. According to the requirement information of the multiple sub - codes, determine multiple candidate sub - codes among the multiple sub - codes. The candidate sub - codes have memory access requirements. Determine at least one group of the i - th sub - codes among the multiple candidate sub - codes. Perform a fusion process on at least one group of the i - th sub - codes respectively to obtain the i - th candidate fusion code, and obtain the processing result of the i - th test data corresponding to the i - th candidate fusion code. According to the processing result of the i - th test data and the processing result of the preset data, determine at least one fusion code group in the i - th candidate fusion code. Perform a fusion process on the sub - codes in each fusion code group respectively to obtain the target code corresponding to the project code. In this way, since the multiple candidate sub - codes are fused, when the target code processes data, the terminal device only needs to allocate bandwidth and memory for the target code once to complete the data - processing tasks of two sub - codes, thereby reducing the memory occupancy rate.

[0123] Based on any of the above embodiments, below, in combination with Figure 7 , the process of the above - mentioned code processing method will be described.

[0124] Figure 7 It is a schematic diagram of the process of a code processing method provided by an embodiment of the present application. Please refer to Figure 7, including: project code A and project code B. Among them, project code A includes sub-code A, sub-code B, and sub-code C. Input image A into project code A, and obtain image B output by project code A. When i is 2, it is determined that the first sub-code group in the project code includes sub-code group A, sub-code group B, and sub-code group C. Among them, sub-code group A includes sub-code A and sub-code B, sub-code group B includes sub-code A and sub-code C, and sub-code group B includes sub-code B and sub-code C.

[0125] Please refer to Figure 7 , perform a test operation, input image A into project code B, and project code B outputs image B. Among them, project code B includes a fusion code and sub-code C, and the fusion code includes sub-code A and sub-code B. Since the processing result of project code B on image A is the same as that of project code A on image A, it is determined that the fusion code group includes sub-code A and sub-code B, and then project code B is obtained. In this way, due to the fusion processing of multiple sub-codes, when project code B processes data, the terminal device only needs to allocate bandwidth and memory to project code B once to complete the data processing tasks of sub-code A and sub-code B, thereby reducing the memory occupancy rate.

[0126] Figure 8 It is a schematic structural diagram of a code processing device provided by an embodiment of the present application. Please refer to Figure 8 , the code processing device 10 includes a first determination module 11, a second determination module 12, a third determination module 13, and a fusion module 14, where:

[0127] The first determination module 11 is used to determine multiple sub-codes included in the project code;

[0128] The second determination module 12 is used to determine multiple candidate sub-codes among the multiple sub-codes according to the requirement information of the multiple sub-codes, and the candidate sub-codes have memory access requirements;

[0129] The third determination module 13 is used to determine at least one fusion code group among the multiple candidate sub-codes, and the fusion code group includes at least two candidate sub-codes;

[0130] The fusion module 14 is used to perform fusion processing on the sub-codes in each fusion code group respectively to obtain the target code corresponding to the project code. Among them, in the target code, the sub-codes in one fusion code group share the same memory access code.

[0131] In a possible implementation manner, the third determination module 13 is specifically used for:

[0132] Perform a test operation, where the test operation includes: determining at least one group of the i-th sub-codes among the multiple candidate sub-codes, respectively performing a fusion process on the at least one group of the i-th sub-codes to obtain the i-th candidate fusion code, and obtaining the i-th test data processing result corresponding to the i-th candidate fusion code;

[0133] If the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, determine the at least one group of the i-th sub-codes as the at least one group of fusion codes;

[0134] If the similarity between the i-th test data processing result and the preset data processing result is less than the preset threshold, set i to i + 1, and perform the test operation until i is N, or when the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, determine the at least one group of the i-th sub-codes as the at least one group of fusion codes;

[0135] Wherein, initially, i is 1; there is one sub-code group in the at least one group of the i-th sub-codes that includes N + 1 - i candidate sub-codes, and N is the number of the multiple candidate sub-codes.

[0136] In a possible implementation manner, the third determination module 13 is specifically configured to:

[0137] Determine the first group of the i-th sub-codes among the multiple candidate sub-codes, where the first group of the i-th sub-codes includes N + 1 - i sub-codes;

[0138] If i is less than or equal to 2, determine the first group of the i-th sub-codes as the at least one group of the i-th sub-codes;

[0139] If i is greater than 2, perform a fusion process on the other sub-codes among the multiple candidate sub-codes except the first group of the i-th sub-codes to obtain a sub-code group, and determine the sub-code group and the first group of the i-th sub-codes as the at least one group of the i-th sub-codes.

[0140] In a possible implementation manner, the third determination module 13 is specifically configured to:

[0141] Obtain preset data;

[0142] Process the preset data through the i-th candidate fusion code to obtain the i-th test data processing result.

[0143] In a possible implementation manner, the fusion module 14 is specifically configured to:

[0144] Determine the memory access code corresponding to each of the candidate sub-codes in the group of fusion codes;

[0145] Fuse the sub-codes in the fused code group according to the memory access code corresponding to each sub-code, so that the sub-codes after the fusion process share the memory access code.

[0146] In a possible implementation manner, the project code is an image processing code.

[0147] The code processing device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, so details are not described herein again.

[0148] The code processing device shown in the embodiments of the present application can be a chip, a hardware module, a processor, etc. Of course, the code processing device can be in other forms, and the embodiments of the present application do not make specific limitations thereto.

[0149] Figure 9 This is a schematic hardware structure diagram of the terminal device provided by the present application. Please refer to Figure 9 , the terminal device 20 may include: a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can communicate; exemplarily, the processor 21 and the memory 22 communicate through a communication bus 23, the memory 22 is used to store program instructions, and the processor 21 is used to call the program instructions in the memory to execute the code processing method shown in any of the above method embodiments.

[0150] Optionally, the terminal device 20 may further include a communication interface, and the communication interface may include a transmitter and / or a receiver.

[0151] Optionally, the above-mentioned processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the present application can be directly implemented by a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.

[0152] The embodiments of the present application provide a readable storage medium, on which a computer program is stored; the computer program is used to implement the code processing method as described in any of the above embodiments.

[0153] An embodiment of the present application provides a computer program product, which includes instructions that, when executed, cause a computer to execute the above-mentioned code processing method.

[0154] All or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a readable memory. When the program is executed, it executes the steps including the above method embodiments; and the foregoing memory (storage medium) includes: read-only memory (abbreviation: ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.

[0155] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. 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 the processing unit of a general-purpose computer, a special-purpose computer, an embedded processing machine, or other programmable terminal devices to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable terminal devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0156] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable terminal devices to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0157] These computer program instructions can also be loaded onto a computer or other programmable terminal devices, so that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0158] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

[0159] In the present application, the term "including" and its variations may mean non-limiting inclusion; the term "or" and its variations may mean "and / or". In the present application, terms such as "first", "second", etc. are used to distinguish similar objects and do not necessarily have to be used to describe a specific order or sequence. In the present application, "a plurality of" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

Claims

1. A code processing method, characterized in that, Including: Determine multiple sub-codes included in the project code; According to the requirement information of the multiple sub-codes, determine multiple candidate sub-codes in the multiple sub-codes, and the candidate sub-codes have memory access requirements; Determine at least one fusion code group in the multiple candidate sub-codes, and the fusion code group includes at least two candidate sub-codes; Perform fusion processing on the sub-codes in each fusion code group respectively to obtain the target code corresponding to the project code. Among them, in the target code, the sub-codes in one fusion code group share the same memory access code; Determine at least one fusion code group in the multiple candidate sub-codes, including: Perform a test operation, and the test operation includes: determine at least one i-th sub-code group in the multiple candidate sub-codes, perform fusion processing on the at least one i-th sub-code group respectively to obtain the i-th candidate fusion code, and obtain the i-th test data processing result corresponding to the i-th candidate fusion code; If the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, then determine the at least one i-th sub-code group as the at least one fusion code group; If the similarity between the i-th test data processing result and the preset data processing result is less than the preset threshold, then set i to i + 1 and perform the test operation until i is N, or when the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, determine the at least one i-th sub-code group as the at least one fusion code group; Wherein, initially, i is 1; there is one sub-code group in the at least one i-th sub-code group that includes N + 1 - i candidate sub-codes, and N is the number of the multiple candidate sub-codes; Obtain the i-th test data processing result corresponding to the i-th candidate fusion code, including: Obtain preset data; Process the preset data through the i-th candidate fusion code to obtain the i-th test data processing result.

2. The method according to claim 1, wherein Determine at least one i-th sub-code group in the multiple candidate sub-codes, including: Determine the first i-th sub-code group in the multiple candidate sub-codes, and the first i-th sub-code group includes N + 1 - i sub-codes; If i is less than or equal to 2, then determine the first i-th sub-code group as the at least one i-th sub-code group; If i is greater than 2, then perform fusion processing on the other sub-codes in the multiple candidate sub-codes except the first i-th sub-code group to obtain a sub-code group, and determine the sub-code group and the first i-th sub-code group as the at least one i-th sub-code group.

3. The method according to claim 1, wherein The preset data processing result is obtained by processing the preset data through the project code.

4. The method according to any one of claims 1-3, characterized in that For any one fusion code group; Perform fusion processing on the candidate sub-codes in the fusion code group, including: Determine the memory access code corresponding to each candidate sub-code in the fusion code group; According to the memory access code corresponding to each sub-code, the sub-codes in the fused code group are fused to obtain the fused sub-codes that share the memory access code.

5. The method according to claim 4, wherein The project code is image processing code.

6. A code processing device, characterized in that, It includes: A first determination module, a second determination module, a third determination module, and a fusion module, where: The first determination module is used to determine a plurality of sub-codes included in the project code; The second determination module is used to determine a plurality of candidate sub-codes among the plurality of sub-codes according to the requirement information of the plurality of sub-codes, and the candidate sub-codes have memory access requirements; The third determination module is used to determine at least one fused code group among the plurality of candidate sub-codes, and the fused code group includes at least two candidate sub-codes; The fusion module is used to respectively fuse the sub-codes in each fused code group to obtain the target code corresponding to the project code. Among them, in the target code, the sub-codes in one fused code group share the same memory access code; Specifically, the third determination module is used to perform a test operation, and the test operation includes: determining at least one i-th sub-code group among the plurality of candidate sub-codes, respectively fusing the at least one i-th sub-code group to obtain an i-th candidate fused code, and obtaining an i-th test data processing result corresponding to the i-th candidate fused code; if the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, then determine the at least one i-th sub-code group as the at least one fused code group; if the similarity between the i-th test data processing result and the preset data processing result is less than the preset threshold, then set i to i + 1 and perform the test operation until i is N, or when the similarity between the i-th test data processing result and the preset data processing result is greater than or equal to the preset threshold, determine the at least one i-th sub-code group as the at least one fused code group; where, initially, i is 1; there is a sub-code group in the at least one i-th sub-code group that includes N + 1 - i candidate sub-codes, and N is the number of the plurality of candidate sub-codes; Specifically, the third determination module is used to: obtain preset data; process the preset data through the i-th candidate fused code to obtain the i-th test data processing result.

7. A terminal device, characterized in that, It includes: A processor and a memory; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory, so that the processor executes the code processing method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by the processor, they are used to implement the code processing method according to any one of claims 1-5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the code processing method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Operator fusion method, system and device and storage medium

    CN113065639A