Task scheduling method and device, electronic equipment, storage medium and product
By receiving the target photo task in the electronic device and determining the priority order based on the photo time, the problem that traditional task scheduling methods cannot complete the real-time photo task in a timely manner is solved, and the effect of timely outputting images is achieved.
Patent Information
- Application Number
- CN202311095435.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
Traditional task scheduling methods cannot complete the photo tasks corresponding to the real-time photo mode in a timely manner, resulting in the inability to output images in a timely manner.
By receiving the target photo task triggered by the user, the first priority order between tasks is determined based on the target photo task and the current photo task, and the priority is inversely proportional to the photo time, and the task schedule is carried out in this order.
It realizes the timely completion of real-time photo shooting tasks, ensures timely output of images, and improves the efficiency of photo shooting tasks.
Smart Images

Figure CN119545150A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a task scheduling method, device, electronic device, storage medium, and product. Background Art
[0002] With the development of electronic devices and image processing technology, more and more users use electronic devices to take photos and obtain images. Since electronic devices can support multiple photo modes (such as real-time photo mode, time-lapse photo mode, etc.), users can select a suitable photo mode to take photos. After the user selects a suitable photo mode, a photo task corresponding to the photo mode will be generated on the electronic device.
[0003] However, when the task queue includes photographing tasks of multiple photographing modes at the same time, the traditional task scheduling method cannot complete the photographing tasks corresponding to the real-time photographing mode in a timely manner, and thus output the image in a timely manner. Summary of the invention
[0004] The embodiments of the present application provide a task scheduling method, device, electronic device, storage medium, and product, which can complete the photography task corresponding to the real-time photography mode in a timely manner, and thus can output the image in a timely manner.
[0005] In one aspect, a task scheduling method is provided, which is applied to an electronic device, and the method comprises:
[0006] Receive target photo taking tasks triggered by users;
[0007] Determining a first priority order between the target photographing task and the current photographing task in the electronic device according to the target photographing task and the current photographing task; the target photographing task and the current photographing task include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task;
[0008] According to the first priority order, the target photographing task and the current photographing task are scheduled.
[0009] In another aspect, a task scheduling device is provided, which is applied to an electronic device, and the device comprises:
[0010] A receiving module, used to receive a target photo taking task triggered by a user;
[0011] a first priority order determining module, configured to determine a first priority order between the target photographing task and the current photographing task in the electronic device according to the target photographing task and the current photographing task; the target photographing task and the current photographing task include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task;
[0012] A task scheduling module is used to schedule the target photographing task and the current photographing task according to the first priority order.
[0013] On the other hand, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the task scheduling method described above.
[0014] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task scheduling method described above are implemented.
[0015] On the other hand, a computer program product is provided, comprising a computer program, which implements the steps of the task scheduling method described above when executed by a processor.
[0016] The above-mentioned task scheduling method, device, electronic device, storage medium, and product receive a target photo task triggered by a user; determine the first priority order between the target photo task and the current photo task according to the target photo task and the current photo task in the electronic device; the target photo task and the current photo task include photo tasks with different photo durations, and the priority of the photo task in the first priority order is inversely proportional to the photo duration of the photo task; and schedule the target photo task and the current photo task according to the first priority order. Since the target photo task and the current photo task in the present application include photo tasks with different photo durations, and the priority of the photo task in the first priority order is inversely proportional to the photo duration of the photo task, therefore, according to the target photo task and the current photo task, the first priority order between the target photo task and the current photo task can be more accurately determined based on the inverse relationship between the priority of the photo task and the photo duration of the photo task, and the photo duration of each photo task. Among them, the photo task with a shorter photo duration in the target photo task and the current photo task has a higher corresponding priority. Thus, the target photographing task and the current photographing task can be scheduled according to a more accurate first priority order, that is, the target photographing task and the photographing task with a shorter photographing time among the current photographing tasks can be executed preferentially, and then, the image corresponding to the photographing task with a shorter photographing time can be output in time. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 An application environment diagram of a task scheduling method in one embodiment;
[0019] Figure 2 is a flowchart of a task scheduling method in one embodiment;
[0020] Figure 3 A flowchart of a first priority order determination step in one embodiment;
[0021] Figure 4 A flowchart of the task execution steps in one embodiment;
[0022] Figure 5 A flowchart of a task execution step in an embodiment;
[0023] Figure 6 A flowchart of another task execution step in one embodiment;
[0024] Figure 7 is a flowchart of a task scheduling method in an optional embodiment;
[0025] Figure 8 It is a flowchart of task scheduling steps in an embodiment when a time-delayed photography task is executed and a real-time photography task type is triggered;
[0026] Fig. 9 It is a flowchart of task scheduling steps in another embodiment when a delayed photo task type is triggered while a real-time photo task is being executed;
[0027] Fig.10 is a structural block diagram of a task scheduling device in one embodiment;
[0028] Fig.11 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0030] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first preset condition may be referred to as a second preset condition, and similarly, a second preset condition may be referred to as a first preset condition. Both the first preset condition and the second preset condition are preset conditions, but they are not the same preset condition.
[0031] With the development of electronic devices and image processing technology, more and more users use electronic devices to take photos and obtain images. Since electronic devices can support multiple photo modes (such as real-time photo mode, time-lapse photo mode, etc.), users can select a suitable photo mode to take photos. After the user selects a suitable photo mode, a photo task corresponding to the photo mode will be generated on the electronic device.
[0032] However, since the photography tasks corresponding to the real-time photography mode have high requirements for timeliness, when the task queue includes photography tasks of multiple photography modes at the same time, the traditional task scheduling method cannot complete the photography tasks corresponding to the real-time photography mode in a timely manner, and then output the image in a timely manner.
[0033] Figure 1 FIG. 1 is a schematic diagram of an application environment of a task scheduling method in an embodiment. Figure 1 As shown, the application environment includes an electronic device 120, which receives a target photo task triggered by a user; determines the first priority order between the target photo task and the current photo task according to the target photo task and the current photo task in the electronic device; the target photo task and the current photo task include photo tasks with different photo durations, and the priority of the photo task in the first priority order is inversely proportional to the photo duration of the photo task; and schedules the target photo task and the current photo task according to the first priority order. Among them, the electronic device 120 can be, but is not limited to, various personal computers, laptops, smart phones, drones, camera devices, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, smart cars, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc.
[0034] Figure 2 FIG. 1 is a flowchart of a task scheduling method in an embodiment. The task scheduling method in this embodiment is to run on Figure 1 The electronic device 120 in FIG. 1 is used as an example for description. Figure 2 As shown, the task scheduling method includes steps 220 to 260, wherein:
[0035] Step 220: receiving a target photo-taking task triggered by a user.
[0036] The target photo task refers to the photo task currently triggered by the user, and the target photo task may be any of the photo tasks corresponding to various photo modes. Exemplarily, the photo mode may include but is not limited to real-time photo mode, time-delay photo mode and other photo modes. Optionally, the user may trigger the target photo task by touching the electronic device or clicking the electronic device, and send the target photo task to the electronic device. Thus, the electronic device 120 may receive the target photo task currently triggered by the user.
[0037] Step 240, determining a first priority order between the target photographing task and the current photographing task in the electronic device according to the target photographing task and the current photographing task; the target photographing task and the current photographing task include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task.
[0038] Among them, the current photo task refers to the photo task being executed in the electronic device, and the current photo task may include one or more photo tasks. The current photo task may be any one of the photo tasks corresponding to various photo modes. The first priority order refers to the priority order of each photo task in the target photo task and at least one current photo task. Photo duration refers to the time required for taking photos through an electronic device. It should be noted that in the embodiment of the present application, the target photo task and the current photo task include photo tasks with different photo durations, and the priority of the photo task in the first priority order is inversely proportional to the photo duration of the photo task. That is, it can be understood that the photo duration of the target photo task is different from the photo duration of the current photo task, and in the first priority order, the priority of the photo task with a short photo duration is higher than the priority of the photo task with a long photo duration, that is, if the photo duration of the photo task is shorter, the priority of the photo task is higher; conversely, if the photo duration of the photo task is longer, the priority of the photo task is lower.
[0039] Optionally, the electronic device 120 may also determine the current photographing task being executed in the electronic device. Thus, the electronic device 120 may determine the photographing duration of the target photographing task and the photographing duration of the current photographing task according to the target photographing task currently triggered by the user and the current photographing task being executed in the electronic device. Furthermore, the electronic device 120 may determine the first priority order between the target photographing task and the current photographing task according to the photographing duration of the target photographing task and the photographing duration of the current photographing task, thereby determining the first priority order of each photographing task.
[0040] Step 260, scheduling the target photographing task and the current photographing task according to the first priority order.
[0041] Optionally, the electronic device 120 may schedule the target photographing task and the current photographing task according to the first priority order. Exemplarily, the electronic device 120 may determine the priority of the target photographing task and the priority of the current photographing task according to the first priority order. Thus, the electronic device 120 may give priority to processing the photographing task with the highest priority among the target photographing task and the current photographing task, and then, process the target photographing task and the current photographing task in sequence according to the priority of each photographing task, thereby implementing task scheduling for the target photographing task and the current photographing task. Among them, the process of task scheduling refers to the process of automatically executing multiple tasks queued for execution in the electronic device according to a predetermined time and / or predetermined rules.
[0042] In the embodiment of the present application, since the target photographing task and the current photographing task in the present application include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task, therefore, according to the target photographing task and the current photographing task, the first priority order between the target photographing task and the current photographing task can be more accurately determined based on the inverse relationship between the priority of the photographing task and the photographing duration of the photographing task, and the photographing duration of each photographing task. Among them, the photographing task with a shorter photographing duration among the target photographing task and the current photographing task has a higher priority. Thus, the target photographing task and the current photographing task can be scheduled according to a more accurate first priority order, that is, the photographing task with a shorter photographing duration among the target photographing task and the current photographing task can be executed preferentially, and then, the image corresponding to the photographing task with a shorter photographing duration can be output in time.
[0043] In the previous embodiment, the process of determining the first priority order between the target photographing task and the current photographing task in the electronic device is described. Figure 3 As shown, the specific implementation steps of determining the first priority order between the target photographing task and the current photographing task in the electronic device according to the target photographing task and the current photographing task include:
[0044] Step 320, determining the task type of the target photo task according to the photo taking time of the target photo task.
[0045] Step 340, determining the task type of the current photo-taking task according to the photo-taking duration of the current photo-taking task.
[0046] Among them, the task type may include but is not limited to the first real-time photo task type, the second real-time photo task type, the first delayed photo task type, the second delayed photo task type, etc., and different task types can be divided according to the length of the photo duration. Optionally, the electronic device 120 determines the task type of the target photo task according to the photo duration of the target photo task. The electronic device 120 can determine the task type of the current photo task according to the photo duration of the current photo task. It should be noted that there is no limited order for step 320 and step 340.
[0047] Exemplarily, it is assumed that the photographing duration threshold corresponding to the first real-time photographing task type is the first duration, the photographing duration threshold corresponding to the second real-time photographing task type is the second duration, the photographing duration threshold corresponding to the first delayed photographing task type is the third duration, and the first duration is less than the second duration, and the second duration is less than the third duration. Then, the electronic device 120 can determine the photographing duration of each photographing task. If the photographing duration of the target photographing task is less than or equal to the first duration, the electronic device 120 can determine that the task type of the target photographing task is the first real-time photographing task type; if the photographing duration of the current photographing task is greater than the second duration and less than or equal to the third duration, the electronic device 120 can determine that the task type of the current photographing task is the first delayed photographing task type.
[0048] Step 360: Determine the first priority order between the target photographing task and the current photographing task according to the task type of the target photographing task and the task type of the current photographing task.
[0049] Optionally, the electronic device 120 can determine the relationship between the priority of the photo task and the task type of the photo task based on the inverse relationship between the priority of the photo task and the photo duration of the photo task. Thus, the electronic device 120 can determine the first priority order between the target photo task and the current photo task based on the relationship between the priority of the photo task and the task type of the photo task, the task type of the target photo task and the task type of the current photo task. Exemplarily, if the photo duration of the photo task is less than the first duration, the task type of the photo task is the first real-time photo task type, and the priority of the photo task is the highest.
[0050] In the embodiment of the present application, the task type of the target photo task can be determined more accurately according to the photo duration of the target photo task; and the task type of the current photo task can be determined more accurately according to the photo duration of the current photo task. Thus, based on the relationship between the photo duration of the photo task, the task type of the photo task and the priority of the photo task, the first priority order between the target photo task and the current photo task can be determined more accurately according to the more accurate task type of the target photo task and the more accurate task type of the current photo task. And in the determined first priority order, the task type corresponding to the photo task with a shorter photo duration in the target photo task and the current photo task has a higher priority.
[0051] In the previous embodiment, the process of determining the first priority order between the target photographing task and the current photographing task according to the task type of the target photographing task and the task type of the current photographing task is described. In this embodiment, the task type includes a real-time photographing task type and a delayed photographing task type; the specific implementation steps of determining the first priority order between the target photographing task and the current photographing task according to the task type of the target photographing task and the task type of the current photographing task include:
[0052] If the task type of the target photographing task is a real-time photographing task type, and the task type of the current photographing task is a delayed photographing task type, then the first priority order is determined to be that the priority of the target photographing task is higher than the priority of the current photographing task.
[0053] If the task type of the target photographing task is a delayed photographing task type, and the task type of the current photographing task is a real-time photographing task type, then the first priority order is determined to be that the priority of the current photographing task is higher than the priority of the target photographing task.
[0054] Optionally, the job scheduling component (jobDispatch) in the electronic device 120 can determine the task type of each photo task. Since the task types include real-time photo task types and delayed photo task types, and the photo duration corresponding to the real-time photo task type is less than the photo duration corresponding to the delayed photo task type, the priority corresponding to the real-time photo task type is higher than the priority corresponding to the delayed photo task type. Based on this, if the electronic device 120 determines that the task type of the target photo task is a real-time photo task type, and the task type of the current photo task is a delayed photo task type, it can be understood that when the electronic device 120 triggers the real-time photo task corresponding to the real-time photo task type, it detects that the delayed photo task corresponding to the delayed photo task type is currently being executed, then the electronic device 120 can determine that the priority of the target photo task in the first priority order is higher than the priority of the current photo task.
[0055] If the electronic device 120 determines that the task type of the target photographing task is a delayed photographing task type, and the task type of the current photographing task is a real-time photographing task type, that is, it can be understood that when the electronic device 120 triggers the delayed photographing task corresponding to the delayed photographing task type, it detects that the real-time photographing task corresponding to the real-time photographing task type is currently being executed, then the electronic device 120 can determine that the priority of the current photographing task is higher than the priority of the target photographing task in the first priority order. Among them, the real-time photographing task type refers to the task type corresponding to the photographing task with a shorter required photographing time, and the real-time photographing task (Real time capture job, RTJob) refers to the photographing task with a shorter required photographing time. Since the real-time photographing task has a high requirement for imaging timeliness, the electronic device needs to execute the real-time photographing task as quickly as possible to obtain the image corresponding to the real-time photographing task; and the power consumption required when executing the real-time photographing task is relatively high. The delayed capture task type refers to the task type corresponding to the capture task that requires a longer capture time. The delayed capture task (Defercapture job, deferJob) refers to the capture task that requires a longer capture time. The delayed capture task processes image data on the disk, therefore, it can reduce the power consumption required in the process of processing image data; however, it takes a lot of time to execute the delayed capture task.
[0056] In the embodiment of the present application, since the task type includes a real-time photography task type and a time-delay photography task type, and the priority corresponding to the real-time photography task type is higher than the priority corresponding to the time-delay photography task type, based on this, the first priority order can be determined more accurately according to whether the task type of the target photography task is a real-time photography task type or a time-delay photography task type, and whether the task type of the current photography task is a real-time photography task type or a time-delay photography task type.
[0057] In the previous embodiment, the process of scheduling the target photo task and the current photo task according to the first priority order of each photo task is described. Figure 4 As shown, the specific implementation steps of scheduling the target photo task and the current photo task according to the first priority order include:
[0058] Step 420: Determine a second priority order between the first thread corresponding to the target photographing task and the second thread corresponding to the current photographing task according to the first priority order.
[0059] Optionally, the electronic device 120 may create different threads for the target photographing task and the current photographing task, respectively, so that photographing tasks of different task types are executed in different threads. Among them, the thread corresponding to the target photographing task may be referred to as the first thread, and the thread corresponding to the current photographing task may be referred to as the second thread. Since the priority of the photographing task is positively correlated with the priority of the thread corresponding to the photographing task, the electronic device 120 may determine the second priority order between the first thread corresponding to the target photographing task and the second thread corresponding to the current photographing task according to the first priority order.
[0060] In one of the optional embodiments, step 420 includes:
[0061] If the first priority order is that the priority of the target photographing task is higher than the priority of the current photographing task, then the second priority order is determined to be that the priority of the first thread is higher than the priority of the second thread.
[0062] If the first priority order is that the priority of the current photographing task is higher than the priority of the target photographing task, then the second priority order is determined to be that the priority of the second thread is higher than the priority of the first thread.
[0063] Optionally, since the priority of the photographing task is positively correlated with the priority of the thread corresponding to the photographing task, the higher the priority of the photographing task, the higher the priority of the thread corresponding to the photographing task. Based on this, if the first priority order determined is that the priority of the target photographing task is higher than the priority of the current photographing task, the electronic device 120 can determine the second priority order as follows: the priority of the first thread corresponding to the target photographing task is higher than the priority of the second thread corresponding to the current photographing task. If the first priority order determined is that the priority of the current photographing task is higher than the priority of the target photographing task, the electronic device 120 can determine the second priority order as follows: the priority of the second thread corresponding to the current photographing task is higher than the priority of the first thread corresponding to the target photographing task.
[0064] Step 440, according to the second priority order, execute the target photographing task through the first thread, and execute the current photographing task through the second thread.
[0065] Optionally, the electronic device 120 may execute the target photographing task through the first thread and the current photographing task through the second thread according to the second priority order. Exemplarily, the electronic device 120 may determine the priority of the first thread corresponding to the target photographing task and the priority of the second thread corresponding to the current photographing task according to the second priority order. Thus, the electronic device 120 may execute the target photographing task through the first thread and the current photographing task through the second thread according to the priority of the threads corresponding to each photographing task, thereby implementing task scheduling for the target photographing task and the current photographing task respectively through different threads.
[0066] In the embodiment of the present application, since the priority of the photographing task is positively correlated with the priority of the thread corresponding to the photographing task, the second priority order between the first thread corresponding to the target photographing task and the second thread corresponding to the current photographing task can be more accurately determined according to the first priority order. Thus, the target photographing task can be executed through the first thread and the current photographing task can be executed through the second thread according to the more accurate second priority order, that is, based on the second priority order, the target photographing task and the photographing task with a shorter photographing time in the current photographing task can be executed preferentially. In addition, using different threads to respectively execute photographing tasks of different task types can further improve the efficiency of task execution.
[0067] In the previous embodiment, the process of executing the target photo-taking task through the first thread and executing the current photo-taking task through the second thread is described. Figure 5 As shown, if the second priority order is that the priority of the first thread is higher than the priority of the second thread, the specific implementation steps of executing the target photo task through the first thread and executing the current photo task through the second thread include:
[0068] Step 520: Acquire image data through the first thread, and send a task pause instruction to the second thread.
[0069] Optionally, if a real-time photography task is triggered while executing a delayed photography task, that is, the task type of the target photography task is a real-time photography task type, and the task type of the current photography task is a delayed photography task type, then the second priority order is that the priority of the first thread is higher than the priority of the second thread. Then, the electronic device 120 can obtain the image data of the target photography task and the current photography task through the first thread, and send a task pause instruction to the second thread. The image data may include but is not limited to the image frame data required during the photography process and the corresponding parameters required for capturing the image. The task pause instruction is used to instruct the second thread to suspend the execution of the currently executing photography task.
[0070] Step 540: The second thread responds to the task suspension instruction, suspends the execution of the current photo-taking task, and sends a response signal corresponding to the task suspension instruction to the first thread.
[0071] Optionally, after the second thread receives the task suspension instruction, the electronic device 120 can respond to the task suspension instruction through the second thread, suspend the execution of the current photographing task (i.e., the delayed photographing task) in a preset suspension manner, and send a response signal corresponding to the task suspension instruction to the first thread. In addition, the data related to the current photographing task can also be saved through the second thread, so that when the current photographing task is started later, the saved data can be directly used to continue to execute the current photographing task without having to re-execute the current photographing task from the beginning, thereby improving the efficiency of task execution.
[0072] The preset suspension mode includes at least one of a suspension mode based on a preset condition variable, a suspension mode based on a preset semaphore, a suspension mode based on a preset mutex lock, and a suspension mode based on a preset system function, etc. The response signal is a signal used to notify the first thread that the current photo-taking task has been suspended, and the response signal has a one-to-one correspondence with the task suspension instruction.
[0073] Step 560, starting to execute the target photo-taking task in response to the response signal through the first thread.
[0074] Optionally, after the first thread receives the response signal, the electronic device 120 can respond to the response signal through the first thread and start executing the target photo task until the target photo task is completed, and then output the image corresponding to the target photo task. Exemplarily, the process of executing the target photo task can be: inputting the acquired image data of the target photo task into the algorithm processing module (Algo process service, APS) for algorithm post-processing, thereby obtaining the image corresponding to the completed target photo task.
[0075] In the embodiment of the present application, the first thread acquires image data and sends a task pause instruction to the second thread; the second thread responds to the task pause instruction, pauses the current photo task, and sends a response signal corresponding to the task pause instruction to the first thread; the first thread responds to the response signal and starts to execute the target photo task. In this way, the real-time photo task can be given the highest priority, and by pausing the delayed photo task, a dynamic switch can be made between the real-time photo task and the delayed photo task, thereby ensuring that the real-time photo task is executed first, and then the image corresponding to the real-time photo task can be output in time.
[0076] In the previous embodiment, it is described that the second thread responds to the task pause instruction, pauses the execution of the current photo-taking task, and sends a response signal corresponding to the task pause instruction to the first thread; and the first thread responds to the response signal to start executing the target photo-taking task. In this embodiment, the task scheduling method further includes:
[0077] After the target photographing task is started, a task start instruction is sent to the second thread through the first thread.
[0078] The second thread responds to the task start instruction and starts executing the current photo taking task.
[0079] Optionally, after starting to execute the target photographing task (i.e., the current photographing task) through the first thread, the electronic device 120 may send a task start instruction to the second thread through the first thread. Thus, after the second thread receives the task start instruction, the electronic device 120 may respond to the task start instruction through the second thread and start to execute the current photographing task until the current photographing task is completed, and then the image corresponding to the current photographing task may be output. Exemplarily, the process of executing the current photographing task may be: inputting the image data of the acquired current photographing task into the algorithm processing module (Algoprocess service, APS) for algorithm post-processing, thereby obtaining the image corresponding to the processed current photographing task.
[0080] In the embodiment of the present application, after the target photographing task is started, the first thread sends a task start instruction to the second thread; the second thread responds to the task start instruction and starts to execute the current photographing task. After the real-time photographing task is started, the delayed photographing task can be continued according to the task start instruction, so that the real-time photographing task and the delayed photographing task can be dynamically switched according to the priority order of each photographing task.
[0081] In the previous embodiment, the process of executing the target photo-taking task through the first thread and executing the current photo-taking task through the second thread is described. Figure 6 As shown, if the second priority order is that the priority of the second thread is higher than the priority of the first thread, the specific implementation steps of executing the target photo-taking task through the first thread and executing the current photo-taking task through the second thread include:
[0082] Step 620: Acquire image data through the second thread, and send the image data to the first thread.
[0083] Optionally, if a delayed photography task is triggered while executing a real-time photography task, that is, the task type of the target photography task is a delayed photography task type, and the task type of the current photography task is a real-time photography task type, then the second priority order is that the priority of the second thread is higher than the priority of the first thread. Then, the electronic device 120 can obtain the image data of the target photography task and the current photography task through the second thread, and send the image data of the target photography task to the first thread. Thus, the image data of the target photography task can be received through the first thread, and a notification signal can be received. The image data may include but is not limited to the image frame data required during the photography process and the corresponding parameters required for capturing the image.
[0084] Step 640: Execute the current photographing task through the second thread, and send a notification signal to the first thread after the current photographing task is completed.
[0085] Optionally, the electronic device 120 can execute the current photographing task through the second thread until the current photographing task is completed, and then the image corresponding to the current photographing task can be output. After the current photographing task is completed and it is detected that there is no current photographing task being executed, the electronic device 120 can send a notification signal to the first thread through the second thread. The notification signal is a signal used to notify the first thread that the current photographing task has been completed and the target photographing task can be executed.
[0086] Step 660, starting to execute the target photo-taking task in response to the notification signal through the first thread.
[0087] Optionally, after the first thread receives the notification signal, the electronic device 120 can respond to the notification signal through the first thread and start executing the target photo task until the target photo task is completed, and then output the image corresponding to the target photo task. The execution process of the current photo task and the target photo task can refer to the above embodiment, and will not be repeated here.
[0088] In the embodiment of the present application, the second thread acquires image data and sends the image data to the first thread; the second thread executes the current photo task and sends a notification signal to the first thread after the current photo task is completed; the first thread responds to the notification signal and starts executing the target photo task. The real-time photo task can be given the highest priority, and the real-time photo task and the delayed photo task can be dynamically switched through the transmission of the notification signal between the first thread and the second thread, thereby ensuring that the real-time photo task is executed first, and then the image corresponding to the real-time photo task can be output in time.
[0089] In an exemplary embodiment, Figure 7As shown, a task scheduling method is provided, which is applied to an electronic device, comprising:
[0090] Step 702, receiving a target photo taking task triggered by a user;
[0091] Step 704, determining the task type of the target photo task according to the photo duration of the target photo task; determining the task type of the current photo task according to the photo duration of the current photo task;
[0092] Step 706, if the task type of the target photographing task is a real-time photographing task type, and the task type of the current photographing task is a delayed photographing task type, then determining that the first priority order is such that the priority of the target photographing task is higher than the priority of the current photographing task;
[0093] Step 708, if the first priority order is that the priority of the target photographing task is higher than the priority of the current photographing task, then determining the second priority order is that the priority of the first thread is higher than the priority of the second thread;
[0094] Step 710, acquiring image data through the first thread, and sending a task pause instruction to the second thread;
[0095] Step 712, responding to the task suspension instruction through the second thread, suspending the execution of the current photo-taking task, and sending a response signal corresponding to the task suspension instruction to the first thread;
[0096] Step 714, starting to execute the target photo-taking task in response to the response signal through the first thread;
[0097] Step 716, after starting to execute the target photo taking task, sending a task start instruction to the second thread through the first thread;
[0098] Step 718, starting to execute the current photo-taking task in response to the task start instruction through the second thread;
[0099] Step 720: If the task type of the target photographing task is a delayed photographing task type, and the task type of the current photographing task is a real-time photographing task type, then determining that the first priority order is that the priority of the current photographing task is higher than the priority of the target photographing task;
[0100] Step 722, if the first priority order is that the priority of the current photographing task is higher than the priority of the target photographing task, then determining the second priority order is that the priority of the second thread is higher than the priority of the first thread;
[0101] Step 724, acquiring image data through the second thread, and sending the image data to the first thread;
[0102] Step 726, executing the current photo-taking task through the second thread, and sending a notification signal to the first thread after the current photo-taking task is completed;
[0103] Step 728, starting to execute the target photo-taking task through the first thread in response to the notification signal.
[0104] Optional, such as Figure 8 As shown, Figure 8 The flowchart of the task scheduling steps in one embodiment is as follows: when a time-delay photography task is executed and a real-time photography task type is triggered. When S802, the first thread in the electronic device detects that the user triggers a photography operation, S804, the first thread can obtain image data and send the image data to the algorithm processing module in the first thread. S806, the job scheduling component in the algorithm processing module in the first thread can determine that the currently triggered target photography task is a real-time photography task based on the image data. S808, the first thread can detect whether there is a time-delay photography task (i.e., the current photography task) currently being executed.
[0105] S810, if there is no time-delay photography task currently being executed, the first thread can start to execute the real-time photography task until the real-time photography task is completed, S812, the image corresponding to the real-time photography task can be output. S814, if there is a time-delay photography task currently being executed, the first thread can send a task pause instruction to the second thread. S816, the second thread can respond to the task pause instruction, suspend the execution of the time-delay photography task, save the data related to the time-delay photography task, S818, and send a response signal corresponding to the task pause instruction to the first thread. S820, the first thread can respond to the response signal and start to execute the real-time photography task. S822, after the first thread starts to execute the real-time photography task, the first thread sends a task start instruction to the second thread through the first thread. S824, the second thread responds to the task start instruction and starts to execute the time-delay photography task until the time-delay photography task is completed, S826, the image corresponding to the time-delay photography task can be output.
[0106] like Fig. 9 As shown, Fig. 9The present invention is a flowchart of the task scheduling steps in another embodiment in which a delayed photography task type is triggered while a real-time photography task is being executed. When S902, the second thread in the electronic device detects that the user has triggered a photography operation, S904, the second thread can obtain image data and send the image data to the algorithm processing module in the second thread. S906, the job scheduling component in the algorithm processing module in the second thread can determine, based on the image data, that the currently triggered target photography task is a delayed photography task. In addition, S908, the second thread can also send the image data to the first thread, so that the first thread receives the image data and waits to receive a notification signal. Afterwards, S910, the second thread can detect whether there is a real-time photography task (i.e., the current photography task) currently being executed.
[0107] S912, if there is a real-time photography task currently being executed, the second thread can start to execute the real-time photography task until the real-time photography task is completed, S914, the image corresponding to the real-time photography task can be output. In addition, the second thread can also continue to detect whether there is a real-time photography task currently being executed. S916, if there is no time-delay photography task currently being executed, the second thread can send a notification signal to the first thread. S918, the first thread can respond to the notification signal and start to execute the time-delay photography task according to the image data until the time-delay photography task is completed, S920, the image corresponding to the time-delay photography task can be output.
[0108] In the embodiment of the present application, since the target photographing task and the current photographing task in the present application include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task, therefore, according to the target photographing task and the current photographing task, the first priority order between the target photographing task and the current photographing task can be more accurately determined based on the inverse relationship between the priority of the photographing task and the photographing duration of the photographing task, and the photographing duration of each photographing task. Among them, the photographing task with a shorter photographing duration among the target photographing task and the current photographing task has a higher priority. Thus, the target photographing task and the current photographing task can be scheduled according to a more accurate first priority order, that is, the photographing task with a shorter photographing duration among the target photographing task and the current photographing task can be executed preferentially, and then, the image corresponding to the photographing task with a shorter photographing duration can be output in time.
[0109] In one embodiment, Fig.10 As shown, a task scheduling device 1000 is provided, the device comprising:
[0110] The receiving module 1020 is used to receive a target photo taking task triggered by a user.
[0111] The first priority order determination module 1040 is used to determine the first priority order between the target photographing task and the current photographing task in the electronic device; the target photographing task and the current photographing task include photographing tasks with different photographing times, and the priority of the photographing task in the first priority order is inversely proportional to the photographing time of the photographing task.
[0112] The task scheduling module 1060 is used to schedule the target photographing task and the current photographing task according to the first priority order.
[0113] In one embodiment, the first priority order determination module 1040 includes:
[0114] A first task type determination unit, configured to determine a task type of a target photo task according to a photo taking duration of the target photo task;
[0115] A second task type determination unit, used to determine the task type of the current photo task according to the photo duration of the current photo task;
[0116] The first priority order determining unit is used to determine the first priority order between the target photographing task and the current photographing task according to the task type of the target photographing task and the task type of the current photographing task.
[0117] In one embodiment, the task types include real-time photography task types and delayed photography task types; the first priority order determination unit includes:
[0118] a first priority determination subunit, configured to determine, when the task type of the target photographing task is a real-time photographing task type and the task type of the current photographing task is a delayed photographing task type, that the first priority order is such that the priority of the target photographing task is higher than the priority of the current photographing task;
[0119] The second priority determination subunit is used to determine that the first priority order is that the priority of the current photographing task is higher than the priority of the target photographing task when the task type of the target photographing task is a delayed photographing task type and the task type of the current photographing task is a real-time photographing task type.
[0120] In one embodiment, the task scheduling module 1060 includes:
[0121] A second priority order determining unit, used to determine a second priority order between a first thread corresponding to a target photographing task and a second thread corresponding to a current photographing task according to the first priority order;
[0122] The task execution unit is used to execute the target photographing task through the first thread and the current photographing task through the second thread according to the second priority order.
[0123] In one embodiment, the second priority order determination unit includes:
[0124] a third priority determination subunit, configured to determine, when the first priority order is that the priority of the target photographing task is higher than the priority of the current photographing task, that the second priority order is that the priority of the first thread is higher than the priority of the second thread;
[0125] The fourth priority determination subunit is used to determine the second priority order as follows: the priority of the second thread is higher than the priority of the first thread when the first priority order is that the priority of the current photographing task is higher than the priority of the target photographing task.
[0126] In one embodiment, if the second priority order is that the priority of the first thread is higher than the priority of the second thread, the task execution unit includes:
[0127] A task pause instruction sending subunit, used for acquiring image data through the first thread and sending a task pause instruction to the second thread;
[0128] The task suspension subunit is used to respond to the task suspension instruction through the second thread, the task suspension instruction executes the current photo-taking task, and sends a response signal corresponding to the task suspension instruction to the first thread;
[0129] The first target photographing task execution subunit is used to start executing the target photographing task in response to the response signal through the first thread.
[0130] In one embodiment, the task scheduling device 1000 further includes:
[0131] A task start instruction sending module, used to send a task start instruction to the second thread through the first thread after starting to execute the target photo taking task;
[0132] The current photographing task execution module is used to respond to the task starting instruction through the second thread and start executing the current photographing task.
[0133] In one embodiment, if the second priority order is that the priority of the second thread is higher than the priority of the first thread, the task execution unit includes:
[0134] An image data sending subunit, used for acquiring image data through the second thread, and sending the image data to the first thread;
[0135] A notification signal sending subunit, used to execute the current photo-taking task through the second thread, and send a notification signal to the first thread after the current photo-taking task is completed;
[0136] The second target photographing task execution subunit is used to start executing the target photographing task in response to the notification signal through the first thread.
[0137] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0138] The division of the various modules in the above-mentioned task scheduling device is only for illustration. In other embodiments, the task scheduling device may be divided into different modules as needed to complete all or part of the functions of the above-mentioned task scheduling device.
[0139] For the specific definition of the task scheduling device, please refer to the definition of the task scheduling method above, which will not be repeated here. Each module in the above-mentioned task scheduling device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0140] Fig.11 Schematic diagram of the internal structure of an electronic device in an embodiment. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, a wearable device, etc. The electronic device includes a processor and a memory connected via a system bus. Among them, the processor may include one or more processing units. The processor may be a CPU (Central Processing Unit) or a DSP (Digital Signal Processing), etc. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a task scheduling method provided in each of the following embodiments. The internal memory provides a cached operating environment for the operating system computer program in the non-volatile storage medium.
[0141] The implementation of each module in the task scheduling device provided in the embodiment of the present application can be in the form of a computer program. The computer program can be run on an electronic device. The program module constituted by the computer program can be stored in the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.
[0142] The embodiment of the present application also provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, enable the processors to perform the steps of the task scheduling method.
[0143] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the task scheduling method.
[0144] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0145] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include ROM (Read-Only Memory), PROM (Programmable Read-only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-only Memory) or flash memory. Volatile memory may include RAM (Random Access Memory), which is used as an external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as SRAM (Static Random Access Memory), DRAM (Dynamic Random Access Memory), SDRAM (Synchronous Dynamic Random Access Memory), Double Data Rate DDRSDRAM (Double Data Rate Synchronous Dynamic Random Access memory), ESDRAM (Enhanced Synchronous Dynamic Random Access memory), SLDRAM (Sync Link Dynamic Random Access Memory), RDRAM (Rambus Dynamic Random Access Memory), and DRDRAM (Direct Rambus Dynamic Random Access Memory).
[0146] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A task scheduling method, characterized in that: Applied to electronic equipment, the method comprises: Receive target photo taking tasks triggered by users; Determining a first priority order between the target photographing task and the current photographing task in the electronic device according to the target photographing task and the current photographing task; the target photographing task and the current photographing task include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task; According to the first priority order, the target photographing task and the current photographing task are scheduled.
2. The method according to claim 1, characterized in that The determining, according to the target photographing task and the current photographing task in the electronic device, a first priority order between the target photographing task and the current photographing task comprises: Determining a task type of the target photo task according to a photo taking time of the target photo task; Determining a task type of the current photo-taking task according to a photo-taking duration of the current photo-taking task; According to the task type of the target photographing task and the task type of the current photographing task, a first priority order between the target photographing task and the current photographing task is determined.
3. The method according to claim 2, characterized in that The task type includes a real-time photography task type and a delayed photography task type; and determining a first priority order between the target photography task and the current photography task according to the task type of the target photography task and the task type of the current photography task includes: If the task type of the target photographing task is the real-time photographing task type, and the task type of the current photographing task is the delayed photographing task type, determining that the first priority order is that the priority of the target photographing task is higher than the priority of the current photographing task; If the task type of the target photographing task is the delayed photographing task type, and the task type of the current photographing task is the real-time photographing task type, then the first priority order is determined to be that the priority of the current photographing task is higher than the priority of the target photographing task.
4. The method according to any one of claims 1 to 3, characterized in that: The step of scheduling the target photographing task and the current photographing task according to the first priority order includes: Determine, according to the first priority order, a second priority order between the first thread corresponding to the target photographing task and the second thread corresponding to the current photographing task; According to the second priority order, the target photographing task is executed by the first thread, and the current photographing task is executed by the second thread.
5. The method according to claim 4, characterized in that The determining, according to the first priority order, a second priority order between the first thread corresponding to the target photographing task and the second thread corresponding to the current photographing task includes: If the first priority order is that the priority of the target photographing task is higher than the priority of the current photographing task, determining the second priority order is that the priority of the first thread is higher than the priority of the second thread; If the first priority order is that the priority of the current photographing task is higher than the priority of the target photographing task, then the second priority order is determined to be that the priority of the second thread is higher than the priority of the first thread.
6. The method according to claim 5, characterized in that If the second priority order is that the priority of the first thread is higher than the priority of the second thread, executing the target photographing task through the first thread and executing the current photographing task through the second thread include: Acquire image data through the first thread, and send a task pause instruction to the second thread; In response to the task suspension instruction, the second thread suspends the execution of the current photographing task, and sends a response signal corresponding to the task suspension instruction to the first thread; The target photographing task is started by the first thread in response to the response signal.
7. The method according to claim 6, characterized in that The method further comprises: After starting to execute the target photographing task, sending a task starting instruction to the second thread through the first thread; The second thread responds to the task start instruction to start executing the current photo-taking task.
8. The method according to claim 5, characterized in that If the second priority order is that the priority of the second thread is higher than the priority of the first thread, then executing the target photographing task through the first thread and executing the current photographing task through the second thread include: Acquire image data through the second thread, and send the image data to the first thread; Execute the current photographing task by the second thread, and send a notification signal to the first thread after the current photographing task is completed; In response to the notification signal, the first thread starts executing the target photo-taking task.
9. A task scheduling device, characterized in that: Applied to electronic equipment, the device comprises: A receiving module, used to receive a target photo taking task triggered by a user; a first priority order determining module, configured to determine a first priority order between the target photographing task and the current photographing task in the electronic device according to the target photographing task and the current photographing task; the target photographing task and the current photographing task include photographing tasks with different photographing durations, and the priority of the photographing task in the first priority order is inversely proportional to the photographing duration of the photographing task; A task scheduling module is used to schedule the target photographing task and the current photographing task according to the first priority order.
10. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the processor is caused to perform the steps of the task scheduling method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the task scheduling method according to any one of claims 1 to 8 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the task scheduling method described in any one of claims 1 to 8 are implemented.