A code-based multi-model software function coding method and device
By obtaining function selection information and generating function codes through a visual interface, the problem of difficult function coding management for multi-model software is solved, and efficient and secure coding management is achieved.
Patent Information
- Application Number
- CN202510845325.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-23
AI Technical Summary
In the existing technology, the management of multi-model software function codes is difficult, requires manual modification and is prone to errors, and lacks a verification mechanism.
Obtain function selection information through the visual function model selection interface, encode based on attribute values and function information, generate function code, and generate function code through compilation template, including reverse calculation and comparison mechanism to ensure coding correctness.
It reduces the difficulty of operation, improves the security of model management and the efficiency of coding management, reduces manual workload, and reduces the probability of errors.
Smart Images

Figure CN120353452B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of software functions, and in particular, to a code-based multi-model software function encoding method and device. Background Art
[0002] In their product differentiation strategies, manufacturers differentiate hardware specifications and software features, such as the Lite and Pro models of mobile phones. Regarding software features, the current approach is to extract and convert differentiated software features from different models into independent, uncoupled functions. However, when function codes need to be modified, this approach requires the modifier to have certain programming skills. Furthermore, for products with multiple functions and models, the workload increases significantly. Furthermore, manual entry and modification are prone to errors, and there is a lack of a verification mechanism for function codes.
[0003] There is currently no better solution to the above problems. Summary of the Invention
[0004] The embodiments of the present invention provide a code-based multi-model software function coding method and device to at least solve the problem of difficulty in function code management in related technologies.
[0005] According to one embodiment of the present invention, a code-based multi-model software function coding method is provided, comprising:
[0006] Acquiring function selection information, wherein the function selection information is collected by interactively selecting a preset visual function model selection interface;
[0007] determining attribute values and function information according to function selection information;
[0008] Performing function coding based on the attribute value and the function information to obtain a function code;
[0009] Generate a function code based on the function code and a preset compilation template.
[0010] In an exemplary embodiment, before generating the function code based on the function code and a preset compilation template, the method further includes:
[0011] Performing reverse calculation on the function code to obtain first function selection information corresponding to the function code;
[0012] The function information is compared with the first function selection information. If the comparison result is consistent, the function code is determined to be normal; otherwise, it is determined to be abnormal.
[0013] In an exemplary embodiment, generating a function code based on the function code and a preset compilation template includes:
[0014] constructing a function table based on the function code and the function selection information;
[0015] Fill the data in the function table into the structure of the compilation template one by one according to a preset order;
[0016] The model information and the function code in the function table are read in sequence according to a preset order, the model information and the function code are combined, and the combination result is filled into the compilation template.
[0017] In an exemplary embodiment, after determining the attribute value and the function information according to the function selection information, the method further includes:
[0018] Determine encoding parameters according to the attribute value and function information, the encoding parameters including a model identifier, a basic function coefficient, a model enhancement coefficient, a function switch vector, and a weight matrix corresponding to the function switch vector;
[0019] Based on the encoding parameters, a performance value corresponding to the function code is determined.
[0020] According to another embodiment of the present invention, a multi-model software function encoding device based on code is provided, comprising:
[0021] An information collection module is used to obtain function selection information, wherein the function selection information is collected by interactively selecting a preset visual function model selection interface;
[0022] An information determination module, configured to determine attribute values and function information according to the function selection information;
[0023] A function encoding module, configured to perform function encoding based on the attribute value and the function information to obtain a function code;
[0024] The code encoding module is used to generate a function code based on the function code and a preset compilation template.
[0025] In an exemplary embodiment, it further includes:
[0026] a reverse calculation module, configured to perform reverse calculation on the function code before generating the function code based on the function code and a preset compilation template, so as to obtain first function selection information corresponding to the function code;
[0027] The comparison module is used to compare the function information with the first function selection information, and if the comparison result is consistent, determine that the function code is normal, otherwise determine that it is abnormal.
[0028] In an exemplary embodiment, generating a function code based on the function code and a preset compilation template includes:
[0029] constructing a function table based on the function code and the function selection information;
[0030] Fill the data in the function table into the structure of the compilation template one by one according to a preset order;
[0031] The model information and the function code in the function table are read in sequence according to a preset order, the model information and the function code are combined, and the combination result is filled into the compilation template.
[0032] In an exemplary embodiment, the apparatus further comprises:
[0033] After determining the attribute value and the function information according to the function selection information, determining encoding parameters according to the attribute value and the function information, the encoding parameters including a model identifier, a basic function coefficient, a model enhancement coefficient, a function switch vector, and a weight matrix corresponding to the function switch vector;
[0034] Based on the encoding parameters, a performance value corresponding to the function code is determined.
[0035] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0036] According to another embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
[0037] Through the present invention, since visual editing is performed through the function model selection interface, model management can be made more intuitive, which greatly reduces the difficulty of operation. At the same time, a function code verification function can be provided to improve the security of model management and reduce the possibility of errors. Moreover, by automatically generating function code, the code can be copied and used, which reduces the workload. Therefore, the problem of difficulty in software function coding management can be solved, and the efficiency of software function coding management can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a flow chart of a code-based multi-model software function coding method according to an embodiment of the present invention;
[0039] Figure 2 This is a schematic diagram of a specific embodiment of the present invention Figure 1 ;
[0040] Figure 3 This is a schematic diagram of a specific embodiment of the present invention Figure 2 ;
[0041] Figure 4 This is a structural block diagram of a code-based multi-model software function encoding device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0043] Hereinafter, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature identified with "first," "second," etc., may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0044] In addition, in this application, directional terms such as "up", "down", "left", and "right" may be defined including but not limited to the orientation relative to the schematic placement of the components in the drawings. It should be understood that these directional terms may be relative concepts. They are used for relative descriptions and clarifications, and they may change accordingly according to changes in the orientation of the components in the drawings.
[0045] In this application, unless otherwise specified or limited, the term "connection" should be understood broadly. For example, "connection" can mean fixed connection, detachable connection, or integration; it can mean direct connection or indirect connection through an intermediate medium. In addition, the term "coupling" can refer to the manner in which electrical connection is achieved for signal transmission.
[0046] As used herein, "about," "substantially," or "approximately" includes the stated value and an average value that is within an acceptable range of deviation from the particular value as determined by one of ordinary skill in the art taking into account the measurements in question and the errors associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).
[0047] In this embodiment, a multi-model software function coding method based on code is provided. Figure 1 Flowchart of a multi-model software function coding method based on code according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0048] Step S11, obtaining function selection information, wherein the function selection information is collected by interactively selecting a preset visual function model selection interface;
[0049] In this embodiment, the user directly selects functions based on the visual interface, and then the function coding is directly performed based on the functions selected by the user, thus eliminating the need for manual recoding, greatly reducing development difficulty, reducing labor workload, and improving project development efficiency.
[0050] For details, please refer to Figure 2 The table format generates a visual interface; the titles of the rows and columns can be modified according to the required functions and project names, and the options support selected or unselected states. The corresponding function diagram is as follows Figure 3 shown.
[0051] It should be noted that when generating a table visualization interface, first add functions (headers) and models (contents in the first column) to the table, then manually enter the functions of each row, and then right-click and select "Save" to store it in .csv format so that you can load historical content the next time you open it.
[0052] Step S12, determining attribute values and function information according to the function selection information;
[0053] In this embodiment, after the relevant function is checked, the function attributes and corresponding function information are confirmed by identifying the check result.
[0054] Specifically, a check box component is nested in the table of the visual interface, and the component is used to read the attribute value true / false of each option to confirm the check status and corresponding function information.
[0055] Step S13, performing function coding based on the attribute value and function information to obtain a function code;
[0056] In this embodiment, the function to be generated is determined by the function code, thereby generating the required function; for example, 3 functions are selected in the first row, and the function code after calculation is A (such as Figure 3 If only two functions are selected, the function code is B (e.g. Figure 3 The function code "0xff" is used in the code, and the function codes can be used to determine which functions are selected and how many functions are selected, thereby improving coding efficiency.
[0057] After confirming the attribute value, calculate the corresponding function code P according to the preset function code calculation formula:
[0058] (Formula 1)
[0059] Where, is the i-th function in any row of the table, and n is the total number of functions.
[0060] Step S14: Generate a function code based on the function code and a preset compilation template.
[0061] In this embodiment, after the function code is determined, the function code is directly compiled and generated according to the corresponding compilation template, which greatly improves the encoding efficiency.
[0062] Specifically, after obtaining the function code, select the "Generate Code" option button to trigger the code generation instruction, thereby generating the corresponding function code.
[0063] Through the above steps, due to the visual editing through the function model selection interface, model management can be made more intuitive, which greatly reduces the difficulty of operation. At the same time, a function code verification function can be provided to improve the security of model management and reduce the possibility of errors. Moreover, by automatically generating function codes and copying them for use, the workload is reduced, the problem of difficult software function coding management is solved, and the efficiency of software function coding management is improved.
[0064] In an optional embodiment, before generating the function code based on the function code and a preset compilation template, the method further includes:
[0065] Step S1401, reversely calculating the function code to obtain first function selection information corresponding to the function code;
[0066] Step S1402 : comparing the function information with the first function selection information. If the comparison result is consistent, the function code is determined to be normal; otherwise, it is determined to be abnormal.
[0067] In this embodiment, in order to ensure the correctness of code compilation, it is necessary to detect the function code and the like.
[0068] Specifically, after obtaining the function code (for example, constexpr union BMLicense::FunctionCodebm01 = 0x0C), after entering or modifying the function code in the aforementioned table interface, the check status of the corresponding function will be reversely calculated based on the value of each bit of the function code (0 / 1, 0 corresponds to false, 1 corresponds to true) and displayed in the table interface, so that the on / off status of the function can be intuitively understood.
[0069] In an optional embodiment, generating a function code based on the function code and a preset compilation template includes:
[0070] Step S141, constructing a function table based on the function code and the function selection information;
[0071] Step S142, filling the data in the function table into the structure of the compilation template one by one according to a preset order;
[0072] Step S143 , reading the model information and the function code in the function table in sequence according to a preset order, combining the model information and the function code, and filling the combination result into the compilation template.
[0073] In this embodiment, after the table is constructed, the table header and the preset compilation template (assuming it is a FunctionCode template) are read, and the read data are added to the struct structure of the template one by one; then, each row of the table is read in sequence, and the first column of each row (i.e., the model number in the table) is read first; then the last column of the row (i.e., the function code in the table) is read and combined into the initial function code:
[0074] constexpr union BMLicense::FunctionCode model = functioncode;
[0075] The combined code is then written into a file to obtain the function code.
[0076] In an optional embodiment, after determining the attribute value and the function information according to the function selection information, the method further includes:
[0077] Step S131: Determine encoding parameters based on the attribute value and function information, the encoding parameters including a model identifier, a basic function coefficient, a model enhancement coefficient, a function switch vector, and a weight matrix corresponding to the function switch vector;
[0078] Step S132: Determine the performance value corresponding to the function code based on the encoding parameters.
[0079] In this embodiment, the performance value S can be calculated using the following formula:
[0080] (Formula 1)
[0081] Where Bc is the basic function coefficient shared by all models, such as the basic computing power of the standard algorithm, and Ef is the model enhancement coefficient adjusted according to the hardware differences of the models. is the function switch vector matrix used to represent whether the control function is enabled, is the weight matrix, where Used to indicate the basic performance value of each model after encoding; Used to indicate the functional values that can be expanded and superimposed on each model; based on the above formula, users can adjust the relevant functional coefficients as needed, thereby dynamically modifying the parameters so that the final compiled code can achieve the target performance.
[0082] For example, for the software of the image processing pipeline, the parameters of model A100 are: Bc=30, Ef=2.5, =[1,1,0], =[5,3,2], then its performance value S=(30×2.5)+(1×5+1×3+0×2)=75+8=83 FPS; the parameters of model B200 are, Bc=30, Ef=1.8, =[1,0,1], =[5,3,2], then its performance value S=(30×1.8)+(1×5+0×3+1×2)=54+7=61 FPS, so now it instructs to encode according to the compilation template of model A100, and so on.
[0083] Through the description of the above embodiments, those skilled in the art will clearly understand that the methods according to the above embodiments can be implemented using software plus the necessary general-purpose hardware platform. Of course, hardware can also be used, but in many cases the former is a more preferred embodiment. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, or optical disk) and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0084] In this embodiment, a multi-model software function encoding device based on code is also provided. The device is used to implement the above-mentioned embodiments and preferred implementation methods. The details that have been described will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
[0085] Figure 4 This is a structural block diagram of a multi-model software function encoding device based on code according to an embodiment of the present invention. Figure 4 As shown, the device includes:
[0086] An information collection module 41 is used to obtain function selection information, wherein the function selection information is collected by interactively selecting a preset visual function model selection interface;
[0087] An information determination module 42, configured to determine attribute values and function information according to the function selection information;
[0088] A function encoding module 43 is configured to perform function encoding based on the attribute value and the function information to obtain a function code;
[0089] The code encoding module 44 is configured to generate a function code based on the function code and a preset compilation template.
[0090] In an optional embodiment, the method further includes:
[0091] a reverse calculation module, configured to perform reverse calculation on the function code before generating the function code based on the function code and a preset compilation template, so as to obtain first function selection information corresponding to the function code;
[0092] The comparison module is used to compare the function information with the first function selection information, and if the comparison result is consistent, determine that the function code is normal, otherwise determine that it is abnormal.
[0093] In an optional embodiment, generating a function code based on the function code and a preset compilation template includes:
[0094] constructing a function table based on the function code and the function selection information;
[0095] Fill the data in the function table into the structure of the compilation template one by one according to a preset order;
[0096] The model information and the function code in the function table are read in sequence according to a preset order, the model information and the function code are combined, and the combination result is filled into the compilation template.
[0097] In an optional embodiment, the device further comprises:
[0098] After determining the attribute value and the function information according to the function selection information, determining encoding parameters according to the attribute value and the function information, the encoding parameters including a model identifier, a basic function coefficient, a model enhancement coefficient, a function switch vector, and a weight matrix corresponding to the function switch vector;
[0099] Based on the encoding parameters, a performance value corresponding to the function code is determined.
[0100] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0101] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.
[0102] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0103] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0104] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0105] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0106] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0107] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0108] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0109] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.
[0110] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A multi-model software function coding method based on code, characterized in that: include: Acquiring function selection information, wherein the function selection information is collected by interactively selecting a preset visual function model selection interface; determining attribute values and function information according to function selection information; Performing function coding based on the attribute value and the function information to obtain a function code; Generate a function code based on the function code and a preset compilation template; After determining the attribute value and the function information according to the function selection information, the method further includes: Determine encoding parameters according to the attribute value and function information, the encoding parameters including a model identifier, a basic function coefficient, a model enhancement coefficient, a function switch vector, and a weight matrix corresponding to the function switch vector; Based on the encoding parameters, a performance value corresponding to the function code is determined, where the performance value is calculated based on the following formula: Where Bc is the basic function coefficient shared by all models, which includes the basic computing power of the standard algorithm. Ef is the model enhancement coefficient adjusted according to the hardware differences of the models. is the function switch vector matrix used to represent whether the control function is enabled, is the weight matrix, where Used to indicate the basic performance value of each model after encoding; Used to indicate the extended and superimposed functional values of each model.
2. The method according to claim 1, characterized in that Before generating the function code based on the function code and the preset compilation template, the method further includes: Performing reverse calculation on the function code to obtain first function selection information corresponding to the function code; The function information is compared with the first function selection information. If the comparison result is consistent, the function code is determined to be normal; otherwise, it is determined to be abnormal.
3. The method according to claim 1, characterized in that The generating of the function code based on the function code and the preset compilation template includes: constructing a function table based on the function code and the function selection information; Fill the data in the function table into the structure of the compilation template one by one according to a preset order; The model information and the function code in the function table are read in sequence according to a preset order, the model information and the function code are combined, and the combination result is filled into the compilation template.
4. A multi-model software function coding device based on code, characterized in that: include: An information collection module is used to obtain function selection information, wherein the function selection information is collected by interactively selecting a preset visual function model selection interface; An information determination module, configured to determine attribute values and function information according to the function selection information; A function encoding module, configured to perform function encoding based on the attribute value and the function information to obtain a function code; A code encoding module, configured to generate a function code based on the function code and a preset compilation template; After determining the attribute value and the function information according to the function selection information, the method further includes: Determine encoding parameters according to the attribute value and function information, the encoding parameters including a model identifier, a basic function coefficient, a model enhancement coefficient, a function switch vector, and a weight matrix corresponding to the function switch vector; Based on the encoding parameters, a performance value corresponding to the function code is determined, where the performance value is calculated based on the following formula: Where Bc is the basic function coefficient shared by all models, which includes the basic computing power of the standard algorithm. Ef is the model enhancement coefficient adjusted according to the hardware differences of the models. is the function switch vector matrix used to represent whether the control function is enabled, is the weight matrix, where Used to indicate the basic performance value of each model after encoding; Used to indicate the extended and superimposed functional values of each model.
5. The device according to claim 4, characterized in that Also includes: a reverse calculation module, configured to perform reverse calculation on the function code before generating the function code based on the function code and a preset compilation template, so as to obtain first function selection information corresponding to the function code; The comparison module is used to compare the function information with the first function selection information, and if the comparison result is consistent, determine that the function code is normal, otherwise determine that it is abnormal.
6. The device according to claim 4, characterized in that The generating of the function code based on the function code and the preset compilation template includes: constructing a function table based on the function code and the function selection information; Fill the data in the function table into the structure of the compilation template one by one according to a preset order; The model information and the function code in the function table are read in sequence according to a preset order, the model information and the function code are combined, and the combination result is filled into the compilation template.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 3 when executed.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Software configuration code generation method, device and electronic equipment
CN110413265A