Photographing method and device
By migrating threads from CPU cores with weaker computing power to stronger CPU cores during the photo processing, and combining the increase of GPU frequency and DDR frequency, the problem of lag during the photo processing is solved and the photo performance is improved.
Patent Information
- Application Number
- CN202410142436.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2025-08-08
AI Technical Summary
During the photo processing process, due to high computing demand for electronic devices, there is obvious lag when responding to users viewing the photo image.
By creating a first thread during the photo processing and binding it to the first CPU core, as the thread run time exceeds the threshold, it is bound to the second CPU core with stronger computing power, and combining to increase the GPU frequency, DDR frequency and thread priority, timeout detection and scheduling of threads is realized to speed up processing.
It reduces the time-consuming process of taking photos, alleviates the lag in the process of displaying and taking photos of electronic devices, and improves the performance of taking photos.
Smart Images

Figure CN120448044A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a photographing method and device. Background Art
[0002] With the widespread adoption and development of the internet, people's demands for the functionality of electronic devices are becoming increasingly diverse. For example, electronic devices can not only support photography but also process the captured images to obtain high-quality images. This processing can involve portrait detection, blurring, and filtering.
[0003] For example, in response to a user's triggering operation on a photo button, the electronic device can obtain an original image and then process the original image to obtain a photographic image. However, if the photographic processing process is long, the electronic device may experience noticeable lag when the user views the photographic image. Summary of the Invention
[0004] The embodiments of the present application provide a photographing method and device, which are applied to the field of terminal technology to improve photographing performance, reduce the time consumption of the photographing processing process, and thereby alleviate the jamming phenomenon when an electronic device displays a photographed image.
[0005] In a first aspect, an embodiment of the present application proposes a photographing method, which is applied to an electronic device, wherein the electronic device includes a central processing unit (CPU), and the CPU includes a first CPU core and a second CPU core. The method includes: in response to an operation of opening a camera application, displaying a first interface, wherein the first interface includes: a preview screen and a photographing button; at a first moment, in response to an operation on the photographing button, creating a first thread, wherein at the first moment, the first thread is bound to the first CPU core, and the CPU is at a first frequency; at a second moment, when the running time of the first thread is greater than a first threshold, binding the first thread to the second CPU core, wherein the second moment is later than the first moment, the computing power of the second CPU core is stronger than the computing power of the first CPU core, and at the second moment, the CPU is at a second frequency, and the second frequency is greater than the first frequency.
[0006] The first interface can be Figure 1 The first threshold value may be duration 1 as described in the embodiments of this application. The first CPU core may be a small core, and the second CPU core may be a large core. The first thread may be any image processing thread in the photo processing process, such as thread 1 as described in the embodiments of this application.
[0007] In this way, the electronic device can schedule the first thread by detecting the timeout of the first thread in the photo processing process, so that the first thread can continue to run under a high CPU frequency and a CPU core with high computing power, so as to increase the running time of the first thread in the photo processing process, thereby alleviating the lag phenomenon in the electronic device displaying the photo image.
[0008] In one possible implementation, at a first moment, the electronic device satisfies one or more of the following conditions: a graphics processor (GPU) of the electronic device is at a third frequency, a double data rate (DDR) of the electronic device is at a fourth frequency, or the first thread is at a first priority; at a second moment, the electronic device satisfies one or more of the following conditions: the GPU is at a fifth frequency, the DDR is at a sixth frequency, or the first thread is at a second priority; wherein the fifth frequency is greater than the third frequency, the sixth frequency is greater than the fourth frequency, and the second priority is higher than the first priority.
[0009] It is understandable that the electronic device can also further increase the running time of the first thread by increasing the GPU frequency, and / or increasing the DDR frequency, and / or thread priority, thereby speeding up the entire photo processing process.
[0010] In one possible implementation, the method further includes: creating a second thread, wherein the second thread is bound to the first CPU core, the CPU is at a first frequency, and during the running of the second thread, the running time of the second thread is less than or equal to a first threshold.
[0011] The second thread is different from the first thread. It is understandable that when the running time of the second thread does not exceed the first threshold, it can be determined that the running of the second thread does not need to occupy too many system resources, thereby achieving the purpose of saving power consumption.
[0012] In a possible implementation, before creating the second thread, the method further includes: when the first thread finishes running, binding the first thread to the first CPU core, and the CPU is at the first frequency.
[0013] It is understandable that the electronic device can restore the system resources to the previous state when the first thread ends, so as to avoid the waste of power consumption caused by the electronic device being in a high CPU computing power state.
[0014] In one possible implementation, the method further includes: creating a third thread; after creating the first thread, in response to receiving a first message from the first thread, the third thread starts a first timer, a first threshold is set in the first timer, and the first message is used to indicate that the first thread starts running; when the running time of the first thread is greater than the first threshold, binding the first thread to the second CPU core, including: when the third thread does not receive a second message from the first thread within the first threshold, binding the first thread to the second CPU core, and the second message is used to indicate that the first thread ends running.
[0015] The first timer may be the timer 1 described in the embodiment of the present application.
[0016] The third thread may be the monitoring thread described in the embodiment of the present application, the first message may be the message described in S510, and the second message may be the message described in S516.
[0017] It is understandable that the electronic device can implement timeout monitoring of the first process based on the first threshold set in the watchdog mechanism, and when it is determined that the running time of the first process exceeds the first threshold, bind the first thread to the second CPU core with stronger computing power to speed up the running of the first process.
[0018] In one possible implementation, after receiving a first message from the first thread, the method further includes: a third thread recording first information, the first information including: an identifier of the first thread and the time when the first thread started running; after binding the first thread to the second CPU core, the method further includes: deleting the first information when the third thread receives a second message. The first information may be the dotting information 1 described in the embodiments of this application.
[0019] It is understood that the third thread can record the first information and use the time when the first thread started running in the first information and the first timer to determine whether it has timed out. In addition, the third thread can delete the first information when it detects that the first thread has ended to prevent it from affecting the monitoring of other threads.
[0020] In a possible implementation, the third thread is a thread for performing timeout monitoring on the photographing process.
[0021] In one possible implementation, the first thread is different from the second thread, and the first thread or the second thread is: a thread for performing artificial intelligence raw data processing on an image, or a thread for blurring an image, or a thread for performing image pre-processing on an image.
[0022] It is understood that the photo processing process may include multiple processing methods for performing different levels of image processing, and these different processing methods can be run in different threads. Therefore, the electronic device can implement timeout monitoring for any image processing method, especially processing methods that require high CPU computing power during the photo processing process, to improve the running time of the entire photo processing process.
[0023] In one possible implementation, after responding to an operation on a camera button, the method further includes: acquiring a first image using a camera; performing image processing on the first image via a first thread to obtain a camera image; and displaying the camera image in response to an operation to open the camera image. The first image may be Image 1 described in the embodiments of this application.
[0024] The first image may be Image 1 as described in the embodiments of this application. When the photographing process includes only one image processing process, the electronic device may obtain the photographed image by processing Image 1. Alternatively, when the photographing process includes multiple processing processes, the electronic device may process Image 1 into Image 2 based on the first thread, and then process Image 2 into the photographed image.
[0025] It is understandable that the electronic device can reduce the time consumption of the photo processing process by speeding up the processing progress of the first thread, thereby alleviating the jamming phenomenon when the electronic device displays the photo image.
[0026] In one possible implementation, before creating the first thread, the method further includes: setting the CPU frequency to the first frequency, and before responding to the operation of the photo button, the CPU is at a third frequency, which is less than the first frequency; after obtaining the photo image, the method further includes: setting the CPU frequency to the third frequency.
[0027] It is understood that the electronic device also provides a setting for increasing the CPU frequency during the photo processing process to ensure that the entire photo processing process can run faster. In addition, the electronic device can also support restoring the CPU frequency at the end of the photo processing process to reduce the use of system resources.
[0028] In a second aspect, embodiments of the present application provide a photographing device, which may be an electronic device or a chip or chip system within an electronic device. The photographing device may include a display unit and a processing unit. When the photographing device is an electronic device, the display unit may be a display screen. The display unit is configured to perform a display step, so that the electronic device implements a photographing method described in the first aspect or any possible implementation of the first aspect. When the photographing device is an electronic device, the processing unit may be a processor. The photographing device may also include a storage unit, which may be a memory. The storage unit is configured to store instructions, and the processing unit executes the instructions stored in the storage unit, so that the electronic device implements a photographing method described in the first aspect or any possible implementation of the first aspect. When the photographing device is a chip or chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit, so that the electronic device implements a photographing method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit within the chip (e.g., a register, a cache, etc.), or a storage unit within the electronic device located external to the chip (e.g., a read-only memory, a random access memory, etc.).
[0029] Specifically, in response to the operation of opening the camera application, the display unit is used to display a first interface, which includes: a preview screen and a photo button; at a first moment, in response to the operation on the photo button, the processing unit is used to create a first thread, wherein, at the first moment, the first thread is bound to the first CPU core, and the CPU is at a first frequency; at a second moment, when the running time of the first thread is greater than a first threshold, the processing unit is used to bind the first thread to the second CPU core, wherein the second moment is later than the first moment, the computing power of the second CPU core is stronger than the computing power of the first CPU core, and at the second moment, the CPU is at a second frequency, and the second frequency is greater than the first frequency.
[0030] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.
[0032] In a fifth aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program product includes computer program code, when the computer program code runs on an electronic device, the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.
[0033] In a sixth aspect, the present application provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0034] In one possible implementation, the chip system described above in this application further includes at least one memory, in which instructions are stored. The memory may be a storage unit within the chip system, such as a register, a cache, etc., or a storage unit of the chip system (e.g., a read-only memory, a random access memory, etc.).
[0035] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic diagram of a scenario provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0039] Figure 4 A schematic diagram of a photographing process provided in an embodiment of the present application;
[0040] Figure 5 A schematic diagram of module interaction of a photographing method provided in an embodiment of the present application;
[0041] Figure 6 A schematic diagram of CPU computing power provided in an embodiment of the present application;
[0042] Figure 7 A schematic diagram of a process for photographing provided in an embodiment of the present application;
[0043] Figure 8 A schematic diagram of the structure of a watchdog mechanism provided in an embodiment of the present application;
[0044] Figure 9 A schematic diagram of a process for photographing provided in an embodiment of the present application;
[0045] Figure 10 A schematic structural diagram of a photographing device provided in an embodiment of the present application;
[0046] Figure 11 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] To facilitate a clear description of the technical solutions of the embodiments of the present application, some of the terms and technologies involved in the embodiments of the present application are briefly introduced below:
[0048] 1. Watchdog mechanism
[0049] The watchdog mechanism is a detection tool. Its basic concept is to monitor specific processes in the system through instrumentation (e.g., implanting detection code). It then sets a timer to check whether the process has completed within a predetermined time threshold. If the system fails to complete the process within the set time threshold, the watchdog mechanism deems a timeout and takes appropriate action. These actions may include logging an error message, triggering an alarm, or automatically recovering the system to ensure system stability and reliability.
[0050] The watchdog mechanism can be applied to photography to monitor timeouts during the photo processing process. For example, in response to a user triggering a photo button, the electronic device uses the watchdog mechanism to monitor the processing time of the photo processing process. If the processing time exceeds a preset time threshold, the electronic device executes a scheduling policy to speed up the remaining photo processing process.
[0051] 2. Big core and small core
[0052] Big core and small core are two core concepts in a central processing unit (CPU), which have different performances.
[0053] The large cores are primarily responsible for high-performance tasks and can handle high-load tasks such as running large applications and power-intensive algorithms. The small cores focus on low-power, low-performance tasks such as web browsing, text editing, and email. The large cores have greater computing power than the small cores.
[0054] It is understood that the CPU also includes other cores, such as medium cores or super cores, and the computing power of the medium core is stronger than that of the small core, the computing power of the large core is stronger than that of the medium core, and the computing power of the super core is stronger than that of the large core. The number and type of cores included in the CPU are not limited in the embodiments of this application.
[0055] 3. Other terms
[0056] In the embodiments of this application, terms such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the terms "first chip" and "second chip" are used solely to distinguish between different chips and do not define their order. Those skilled in the art will understand that terms such as "first" and "second" do not define the quantity or execution order, and do not necessarily define differences.
[0057] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0058] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0059] 4. Electronic devices
[0060] An electronic device may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. An electronic device may be a mobile phone with a touch screen, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) electronic device, an augmented reality (AR) electronic device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the electronic device.
[0061] As an example and not a limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for wearable devices that are intelligently designed and developed using wearable technology for everyday wear, such as glasses, gloves, watches, clothing, and shoes.
[0062] The electronic devices in the embodiments of the present application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0063] For example, Figure 1 A schematic diagram of a scenario provided in an embodiment of the present application. Figure 1 In the corresponding embodiments, an electronic device is taken as a mobile phone as an example for illustration, and this example does not constitute a limitation on the embodiments of the present application.
[0064] like Figure 1The scene shown in a in the figure may include a person in the foreground and the sun and its rays in the background. It is understood that to ensure photo quality, the electronic device may perform blur processing on the captured image to obtain a clear foreground portrait area; alternatively, the electronic device may perform beautification or skin beautification processing on the captured image to obtain an image with a better portrait effect.
[0065] In response to the user turning on the camera function, the electronic device may display Figure 1 The interface shown in b in FIG. 1 may be a preview interface. The preview interface may include one or more of the following: a photo button 103, a preview screen 104, controls for switching cameras, or controls for indicating the use of other photo functions. The camera application may also include other functions besides portrait photography, such as aperture photography, night photography, video recording, and short video.
[0066] In response to the user's triggering operation on the photo button 103, the electronic device obtains the original image, obtains the thumbnail by thumbnail processing of the original image, and obtains the photographed image by photographing the original image. In response to the user's triggering operation on the thumbnail, the electronic device displays the following Figure 1 The photographed image 105 in the interface shown in c in FIG. The photographed image 105 may be an image obtained by the electronic device after performing image pre-processing, blurring, beautifying, and skin beautifying on the captured image. For example, the photographed image 105 may include a clear portrait area and a blurred background area.
[0067] However, when the photo processing process is long, in response to the user's triggering operation on the thumbnail, the electronic device will produce obvious lag in the process of displaying the photo image.
[0068] In one possible implementation, the electronic device could increase CPU efficiency when it detects the start of a photo capture, maintaining high power consumption throughout the entire capture process. However, as the CPU frequency increases, the electronic components within the CPU will operate more frequently, generating heat. This thermal constraint limits the ability to increase CPU computing power.
[0069] In view of this, an embodiment of the present application provides a photo-taking method, which can realize timeout monitoring of at least one thread in the photo-taking process. For example, when it is monitored that the running time of a certain thread exceeds a preset time threshold, the thread is scheduled so that the thread can continue to run under high CPU computing power, so as to reduce the time consumption of the thread in the photo-taking process and alleviate the interface jamming caused by the long photo-taking process.
[0070] Therefore, in order to better understand the embodiments of the present application, the structure of the electronic device of the embodiments of the present application is introduced below. Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0071] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194, etc.
[0072] The sensor module 180 may include one or more of the following: a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, or a bone conduction sensor ( Figure 2 (not shown), etc., which is not specifically limited in the embodiments of the present application.
[0073] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0074] The processor 110 may include one or more processing units. The different processing units may be independent devices or integrated into one or more processors. The processor 110 may also include a memory for storing instructions and data. For example, the processor 110 may be used to implement the steps of the image processing method provided in the embodiments of the present application, as well as to store instructions and data related to the image processing method.
[0075] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. The power management module 141 is used to connect the charging management module 140 to the processor 110.
[0076] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0077] Electronic devices implement display functions through a graphics processing unit (GPU), display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. For example, the GPU is used to perform the graphics rendering process in image processing methods.
[0078] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. In some embodiments, the electronic device may include one or N display screens 194, where N is a positive integer greater than 1. For example, display screen 194 is used to display preview images and captured images in a camera application.
[0079] The electronic device can realize the shooting function through the ISP, camera 193, video codec, GPU, display 194 and application processor.
[0080] The camera 193 is used to capture still images or videos. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1. For example, in response to a user's photo-taking operation, the camera 193 may be used to obtain a raw image sequence.
[0081] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 can include a program storage area and a data storage area. For example, the internal memory 121 can be used to store executable program code in an image processing method.
[0082] The electronic device can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0083] The touch sensor can be provided on the display screen 194, and the touch sensor and the display screen 194 form a touch screen, or a "touch screen." For example, the touch sensor is used to receive a user's trigger operation on a photo button.
[0084] Keys 190 include a power button, a volume button, and the like. Keys 190 may be mechanical keys or touch-sensitive keys. The electronic device may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device. In some scenarios, the electronic device may also implement a photo-taking operation in response to a user pressing one or more of keys 190. The specific method of the photo-taking operation is not limited in the embodiments of this application.
[0085] The software system of the electronic device can adopt a layered architecture, event-driven architecture, micro-kernel architecture, microservice architecture, or cloud architecture, etc., which will not be described here.
[0086] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other. For the same or similar concepts or processes, some embodiments may not be described in detail.
[0087] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.
[0088] A layered architecture divides the system into several layers, each with distinct roles and responsibilities. Layers communicate with each other via software interfaces. In some embodiments, the system is divided into five layers: application (APP), application framework (FWK), hardware abstraction layer (HAL), driver layer, and hardware layer.
[0089] The application layer can include a series of application packages. In the embodiment of the present application, the application packages may include: a camera application, a gallery application, etc. The camera application can realize the capture and display of images. The gallery application, also known as the album, can realize the storage and access of captured images.
[0090] The application framework layer provides an application programming interface (API) and programming framework for the application layer's applications. The application framework layer includes some predefined functions. In an embodiment of the present application, the application framework layer may include a camera access interface, where the camera access interface may include camera management and camera devices. The camera access interface is used to provide an application programming interface and programming framework for camera applications.
[0091] The hardware abstraction layer is an interface layer located between the application framework layer and the driver layer, providing a virtual hardware platform for the operating system. In the embodiment of the present application, the hardware abstraction layer may include a camera hardware abstraction layer and a camera algorithm library.
[0092] The camera hardware abstraction layer runs a camera algorithm library, which can include the code and data required to implement the photo processing method provided in the embodiments of the present application. For example, the camera algorithm library can execute photo processing processes such as Task 1, Task 2, and Task 3, and can also run a monitoring thread.
[0093] The driver layer is the layer between hardware and software. It includes drivers for various hardware components. These drivers can include camera device drivers, digital signal processor drivers, and image processor drivers.
[0094] The camera device driver is used to drive the camera sensor to capture images and the image signal processor to pre-process the images. The digital signal processor driver is used to drive the digital signal processor to process images.
[0095] The image processing method in the embodiment of the present application is described in detail below in conjunction with the above system structure:
[0096] In response to a user opening a camera application, such as by clicking the camera application icon, the camera application invokes the camera access interface of the application framework layer, initiating the camera application and sending a command to start the camera. The camera hardware abstraction layer sends this command to the camera device driver in the kernel layer. The camera device driver then activates the corresponding camera sensor and uses it to collect image light signals. A camera device in the camera hardware abstraction layer corresponds to a camera sensor in the hardware layer.
[0097] The camera sensor can then transmit the captured image light signal to the image signal processor for preprocessing, and transmit the raw image to the camera hardware abstraction layer via the camera device driver. The camera hardware abstraction layer can send the image to the camera algorithm library. The camera algorithm library stores the program code for implementing the image method provided in the embodiments of the present application. The camera algorithm library can send the image captured by the camera to the camera hardware abstraction layer. The camera hardware abstraction layer can then display it.
[0098] It should be understood that the software architecture provided in the embodiments of the present application is merely an example and does not constitute a limitation on the embodiments of the present application.
[0099] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other. For the same or similar concepts or processes, some embodiments may not be described in detail.
[0100] The photographing process described in the embodiments of the present application may involve the following multiple processing steps, see Figure 4 Description in .
[0101] For example, Figure 4 This is a schematic diagram of a photographing process provided by an embodiment of the present application. Figure 4As shown, the photo processing process may involve three processes, namely process 1: image pre-processing process, process 2: image post-processing process, and process 3: JPEG image generation processing process.
[0102] Regarding process 1: image pre-processing, the image pre-processing process may include: acquiring an original image in response to the user pressing the capture button, and performing a series of image pre-processing on the original image. For example, image pre-processing may include one or more of the following: bad pixel correction, RAW noise reduction, black level correction, optical shading correction / auto white balance, color interpolation, color correction, or gamma correction.
[0103] After process 1, the electronic device may also perform thumbnail processing on the image obtained after image pre-processing to obtain a thumbnail. Figure 4 Not shown.
[0104] Regarding process 2: image post-processing, the image post-processing process includes: a process using multiple image processing algorithms. The image post-processing process can include one or more of the following algorithmic processing processes: artificial intelligence (AI) RAW processing (algorithm 1, including starting AI RAW and ending AI RAW), beauty processing (algorithm 2, including starting beauty and ending beauty), or blur processing (algorithm 3, including starting blur and ending blur), etc. Among them, AIRAW can be understood as an AI algorithm for processing images.
[0105] In possible implementations, the image post-processing process may also include one or more of the following: portrait recognition, skin beautification, or filter processing, etc. Figure 4 Not shown.
[0106] Regarding process 3: JPEG image generation processing process, the JPEG image generation processing process is used to generate a photographic image in JPEG format based on the image after image post-processing.
[0107] Understandable, Figure 4 The photo processing process described in the foregoing is only an example and does not constitute a limitation on the embodiments of the present application.
[0108] For example, Figure 5 This is a schematic diagram of module interaction of a photographing method provided in an embodiment of the present application. Figure 5 In the corresponding embodiment, the scheduling process of executing Task 1 is illustrated by taking the process of photographing as an example, and the illustration does not constitute a limitation on the embodiment of the present application. Task 1 can be any process in the process of photographing, such as Task 1 can be Figure 4Any process described in, or any algorithm in the process, is not limited in the embodiments of the present application.
[0109] The electronic device may include: a camera, a camera algorithm library, and a camera device driver. The camera algorithm library may run thread 1 and a monitoring thread. Thread 1 may be the thread that runs task 1, and the monitoring thread may be understood as a thread used to monitor timeouts of tasks in the photo-taking process.
[0110] It is understood that Task 1 can also run in a single thread, or Task 1 can also run in multiple threads. When Task 1 runs in a process containing multiple threads, this solution can implement timeout monitoring during the photo processing process at the process granularity. For example, when the electronic device detects that the runtime of a process exceeds a set threshold, it can execute at least one of the following methods: increasing the CPU frequency, increasing the DDR frequency, increasing the GPU frequency, or increasing the process priority to speed up the processing of Task 1.
[0111] like Figure 5 As shown, the photographing method may include the following steps:
[0112] S501: In response to a photo-taking operation, the camera algorithm library obtains a photo-taking instruction from a camera application.
[0113] The photo taking operation can be used by users to Figure 1 The triggering operation of the photo button 103 in the interface shown in b may also be a voice operation or a gesture operation, etc. For example, in response to the photo operation, the camera application may send the photo instruction to the camera algorithm library along the camera access interface.
[0114] S502: In response to a photo-taking instruction, the camera algorithm library creates thread 1 and a monitoring thread.
[0115] It is understood that the camera algorithm library can create thread 1 and the monitoring thread at the same time, or can also create thread 1 and the monitoring thread in sequence, and this is not limited in the embodiments of the present application. For example, in response to a photo instruction, when task 1 is the first image processing task in the photo processing process, the camera algorithm library can create thread 1 or the monitoring thread at the same time. Alternatively, in response to a photo instruction, the camera algorithm library can first create the monitoring thread, and then create the monitoring thread when task 1 is about to be executed.
[0116] In a possible implementation, in response to a photo command, the camera algorithm library can call an interface to switch the CPU frequency from frequency 0 to frequency 1, where frequency 1 is greater than frequency 0. It is understood that the camera algorithm library can increase the CPU computing power of the entire photo processing process by increasing the CPU frequency, thereby reducing the time consumption of the photo processing process.
[0117] S503: The camera device driver obtains a photo taking instruction from the camera algorithm library.
[0118] S504 : The camera device driver acquires image 1 .
[0119] For example, the camera device driver can obtain an original image based on the camera sensor and perform image pre-processing on the original image to obtain image 1. The original image can be an unprocessed image, such as an image in RAW format. The specific process involved in image pre-processing can be found in Figure 4 The description in , will not be repeated here.
[0120] S505 , the camera algorithm library obtains image 1 from the camera device driver.
[0121] It is understandable that after S505, the electronic device can process image 1 into a thumbnail based on the steps shown in S506-S508, and the electronic device can also perform the image processing process corresponding to task 1 on image 1 based on the steps shown in S509-S517. The order of the above two processes is not limited in the embodiment of the present application.
[0122] S506 : The camera algorithm library processes the image 1 into a thumbnail.
[0123] For example, the camera algorithm library can process image 1 into a thumbnail through thumbnail processing methods such as sampling or neural networks, which is not limited in this embodiment of the present application.
[0124] S507: The camera application obtains a thumbnail from the camera algorithm library.
[0125] For example, the camera access interface can obtain a thumbnail from the camera algorithm library, and then the camera can obtain the thumbnail from the camera access interface.
[0126] S508: The camera application calls the display to display thumbnails.
[0127] For example, a camera app can display thumbnails in Figure 1 The lower left corner of the interface shown in b.
[0128] S509 , under parameter 1 , thread 1 executes the image processing process in task 1 on image 1 .
[0129] Parameter 1 stores resource configuration parameters for scheduling. For example, parameter 1 may include one or more of the following: information indicating that thread 1 is bound to the first CPU core, information indicating that the CPU frequency is frequency 1, information indicating that the double data rate (DDR) is set to frequency 2, information indicating that the GPU frequency is frequency 3, or information indicating that the priority of thread 1 is priority 1.
[0130] It is understandable that the electronic device sets the watchdogpointbegin flag before Task 1 and sets the watchdogpointend flag after Task 1. Specifically, the electronic device can execute the steps shown in S510 based on the watchdogpointbegin flag to notify the monitoring thread to start executing Task 1; the electronic device can also notify the monitoring thread to end Task 1 based on the watchdogpointend flag.
[0131] S510: The monitoring thread obtains a message from thread 1 indicating the start of task 1.
[0132] The message for instructing the start of task 1 may also be understood as a message for instructing the start of thread 1.
[0133] The message indicating the start of task 1 may include: the time information of the start of task 1 (or thread 1), the identifier of thread 1, and the like.
[0134] S511. Monitoring thread 1 records dot information 1 and starts timer 1.
[0135] The dot information 1 may include: the time information of the start of task 1 (or thread 1), the identifier of thread 1, etc.
[0136] For example, in response to the message indicating the start of task 1 in S510, the monitoring thread may save the dot information 1 in the monitoring map. The monitoring thread starts timer 1, which may correspond to thread 1 and may be set with a duration of 1.
[0137] S512. The monitoring thread uses timer 1 to determine whether task 1 has timed out.
[0138] The monitoring thread uses timer 1 to determine whether task 1 has timed out. This can be understood as the monitoring thread using timer 1 to determine whether thread 1 has timed out.
[0139] For example, when the monitoring thread does not receive an end message from thread 1 within duration 1, the monitoring thread determines that the running time of thread 1 exceeds duration 1 (e.g., the running time of thread 1 is greater than duration 1), and then executes the step shown in S514. Alternatively, when the monitoring thread receives an end message from thread 1 within the duration, the monitoring thread determines that the running time of thread 1 does not exceed duration 1 (the running time of thread 1 is less than or equal to duration 1), and then executes the step shown in S513. The end message is used to indicate the end of task 1 (or thread 1).
[0140] S513. The monitoring thread deletes the RBI information 1.
[0141] For example, the monitoring thread deletes point information 1 from the monitoring map.
[0142] S514. The monitoring thread sets the system resource to parameter 2.
[0143] Parameter 2 can be pre-set in the cache of the monitoring thread, and parameter 2 stores resource configuration parameters for scheduling. For example, parameter 2 may include one or more of the following: information for binding thread 1 to the second CPU core, information for indicating that the CPU frequency is set to frequency 4, information for setting the DDR frequency to frequency 5, information for setting the GPU frequency to frequency 6, or information for setting the priority of thread 1 to priority 2, etc. It is understood that the resource configuration parameters set in parameter 2 are only used as an example and do not constitute a limitation on the embodiments of the present application.
[0144] Parameters 1 and 2 may satisfy one or more of the following conditions: the computing capability of the second CPU core is greater than that of the first CPU core, frequency 4 is greater than or equal to frequency 1, frequency 5 is greater than or equal to frequency 2, frequency 6 is greater than or equal to frequency 3, or priority 2 is greater than or equal to priority 1. For example, when the first CPU core is a small core, the second CPU core may be a medium core, a large core, or an extra-large core; when the first CPU core is a medium core, the second CPU core may be a large core or an extra-large core, and so on.
[0145] In a possible implementation, the electronic device may also allocate different levels of system resources to thread 1 based on the timeout of task 1. For example, when the processing of task 1 exceeds 5% of duration 1, resource configuration parameters at level 1 may be obtained; when the processing of task 1 exceeds 10% of duration 1, resource configuration parameters at level 2 may be obtained, enabling more flexible scheduling. Specifically, the priority of thread 1 at level 2 may be higher than the priority of thread 1 at level 1, and / or the CPU frequency at level 2 may be higher than the CPU frequency at level 1, and / or the GPU frequency at level 2 may be higher than the GPU frequency at level 1, and / or the DDR frequency at level 2 may be higher than the DDR frequency at level 1, etc.
[0146] It is understandable that after S514 , the electronic device may continue to perform the unfinished image processing process in Task 1 based on Parameter 2 based on the steps shown in S515 - S517 .
[0147] S515 , under parameter 2, thread 1 continues to execute the unfinished image processing process in task 1 on image 1 to obtain image 2.
[0148] For example, when task 1 is blur processing, image 1 may be an image with a clear foreground and a clear background, and image 2 may be an image with a clear foreground and a blurred background.
[0149] S516 . When task 1 is completed, the monitoring thread obtains a message from thread 1 indicating the end of task 1 .
[0150] The message for indicating the completion of task 1 may also be understood as a message for indicating the completion of thread 1.
[0151] S517. The monitoring thread deletes the RBI information 1 and sets the system resource to parameter 1.
[0152] For example, the monitoring thread may store parameter 1 before S514 and restore the configuration of parameter 1 in S517. When the monitoring thread determines that there is no dot information in the monitoring map, the monitoring thread may go into hibernation.
[0153] It is understood that after S517, when the photo processing process includes other tasks besides Task 1, the camera algorithm library can create a new thread, wake up the monitoring thread, and perform timeout monitoring for other tasks based on the new thread and the monitoring thread. The specific timeout monitoring process is similar to that described in S509-S517 and will not be repeated here.
[0154] It can be understood that this application can implement thread-granularity timeout monitoring during the photo processing process, reducing interface freezes caused by any task taking too long.
[0155] S518: In response to the user clicking on the thumbnail, the camera algorithm library obtains a photographed image corresponding to the thumbnail from the camera application.
[0156] S519 . The camera application obtains image 1 from the camera algorithm library.
[0157] In a possible implementation, the camera algorithm library can also send other images besides image 1 to the camera application, which is not limited in the embodiments of the present application.
[0158] S520 : The camera application calls the display to display image 1 .
[0159] S521. The camera algorithm library generates a photographic image after completing all photographic processing processes for the photographic image, and sends the photographic image to the camera application.
[0160] For example, the camera algorithm library can continue other processes in the photographing process for image 2 and generate a photographed image after completing all photographing processes for the photographed image. The camera algorithm library sends the photographed image to the camera application via the camera access interface.
[0161] In a possible implementation, the camera algorithm library can switch the CPU frequency from frequency 1 to frequency 0 after generating a photo image. It is understandable that the camera algorithm library can restore the CPU frequency after the photo processing process is completed to avoid power consumption caused by the CPU frequency being too high.
[0162] S522: The camera application calls the display to display the photographed image.
[0163] For example, the photographed image can be Figure 1 The image displayed in the interface shown in c.
[0164] Based on this, an embodiment of the present application provides a photo-taking method, which can realize timeout monitoring of at least one thread in the photo-taking process. For example, when it is monitored that the running time of a certain thread exceeds a preset time threshold, the thread is scheduled so that the thread can continue to run under high CPU computing power, so as to reduce the time consumption of the thread in the photo-taking process and alleviate the interface lag caused by the long photo-taking process.
[0165] Combine Figure 5 The description in the above explains the CPU computing power in the photo taking method. Figure 6 A schematic diagram of a CPU computing power provided in an embodiment of the present application. CPU computing power refers to the number of operations a CPU can perform per second and is usually used to measure computer performance.
[0166] It is understood that, generally, the electronic device can increase the CPU frequency in response to the photo-taking operation to ensure that the entire photo-taking process is in a high-frequency state. Furthermore, the electronic device can also restore the CPU frequency when the photo-taking process ends.
[0167] like Figure 6 As shown in a in FIG, the electronic device displays a preview screen. In response to the photo-taking operation, the electronic device can increase the CPU frequency (or simply increase the frequency) so that the CPU computing power of the entire photo-taking process is CPU computing power 1. The duration of the photo-taking process is duration 6.
[0168] Understandably, when the CPU frequency increases, the electronic components within the CPU will work more frequently, generating heat. Constrained by this heat, the CPU's computing power cannot be fully utilized, resulting in the chip's inability to maximize its capabilities when the frequency increase is truly needed. In this scenario, the entire photo processing process still takes a long time, resulting in noticeable lag when displaying the photo.
[0169] like Figure 6As shown in b in the figure, the electronic device displays a preview screen. The electronic device can increase the CPU frequency in response to a photo-taking operation. Upon detecting a target task (e.g., Task 1), the watchdog mechanism is activated. When the target task's runtime exceeds a set threshold, scheduling strategies such as frequency increase, priority increase, and core binding are implemented to reduce the time taken to process the photo.
[0170] like Figure 6 As shown in b, the CPU computing power used in executing the scheduling policy is CPU computing power 2. The duration of the photo processing process is duration 7. Computing power 2 is greater than computing power 1, and duration 7 is less than duration 6. CPU computing power 2 is closer to the maximum CPU computing power.
[0171] It can be understood that the photographing method provided in the embodiment of the present application can execute scheduling strategies such as frequency increase, priority increase, and core binding when the watchdog mechanism detects that the running time of a photographing processing process exceeds a set threshold, so as to reduce the time consumption of the photographing processing process.
[0172] Compared to Figure 6 Using the method described in section a, the present embodiment can achieve dynamic and on-demand scheduling of the photo processing process without wasting heat power. Furthermore, since the watchdog mechanism already exists in the camera application, it does not require a separate design, and this solution does not incur any additional performance overhead.
[0173] exist Figure 4-Figure 6 Based on the corresponding embodiments, Figure 7 This is a flow chart of a photographing method provided in an embodiment of the present application. Figure 7 As shown, the photo processing process may include: Task 1, Task 2 and Task 3, Task 1, Task 2 and Task 3 can all be Figure 4 Any process described in, or any algorithm within, a process. Task 2 may follow Task 1, Task 3 may follow Task 2, Task 1 is different from Task 2, Task 2 is different from Task 3, and Task 1 is different from Task 3.
[0174] It can be understood that Task 1, Task 2 and Task 3 can be used to generally refer to part of the process in the photo processing process, and this is not limited in the embodiments of the present application.
[0175] like Figure 7 As shown, the photographing method may include the following steps:
[0176] S701: The electronic device receives an operation to start taking a photo.
[0177] S702: In response to the operation of starting to take a photo, the electronic device starts a supervisor mechanism.
[0178] Starting the supervisor mechanism can be understood as creating a monitoring thread (for example, creating a watchdog monitorthread), so that the monitoring thread can monitor the timeout status of some tasks in the whole process of photo processing.
[0179] S703: The electronic device starts executing task 1.
[0180] S704: The electronic device determines whether task 1 has timed out.
[0181] For example, the electronic device may execute the step shown in S705 when it is determined that the task 1 has timed out; or the electronic device may execute the step shown in S706 when it is determined that the task 1 has not timed out.
[0182] It is understandable that the process of the electronic device determining whether any task has timed out can be referred to the description in S512 and will not be repeated here.
[0183] S705: The electronic device uses the unified scheduling interface to set system resources.
[0184] The unified scheduling interface can pre-configure different resource configuration parameters to achieve different levels of resource configuration. The content of resource configuration parameters can be found in Figure 4 The description of parameter 2 is omitted here.
[0185] It is understandable that when the electronic device completes Task 1 based on the scheduling policy, the resource configuration parameters corresponding to Task 1 can be restored.
[0186] S706: The electronic device starts executing task 2.
[0187] S707: The electronic device determines whether task 2 has timed out.
[0188] For example, the electronic device may execute the step shown in S705 when it is determined that the task 2 has timed out; or the electronic device may execute the step shown in S708 when it is determined that the task 2 has not timed out.
[0189] S708. The electronic device starts executing Task 3.
[0190] S709: The electronic device determines whether task 3 has timed out.
[0191] For example, the electronic device may execute the step shown in S705 when it is determined that the task 3 has timed out; or the electronic device may execute the step shown in S710 when it is determined that the task 3 has not timed out.
[0192] S710: The electronic device receives an operation to end photographing.
[0193] Based on this, when the electronic device detects based on the watchdog mechanism that the running time of any task in the photo processing process exceeds the set threshold, it can execute scheduling strategies such as frequency increase, priority increase, and core binding to reduce the time consumption of the photo processing process.
[0194] Combined with the above Figure 4-Figure 7 The description in , the watchdog mechanism used in the embodiment of the present application is introduced below. This introduction is only used as an example and does not constitute a limitation on the embodiment of the present application.
[0195] For example, Figure 8 A schematic diagram of the structure of a watchdog mechanism provided in an embodiment of the present application.
[0196] like Figure 8 As shown, the electronic device can pre-set marks for processes that require timeout monitoring, that is, a supervisor start mark can be set at the starting position of process 1, and a supervisor end mark can be set at the end position of process 1.
[0197] The supervisor mechanism framework can include one or more of the following: an external interface, a callback function, a supervisory management module, or a monitoring thread. External interfaces can include a supervisor start interface and a supervisor end interface. The supervisory management module can include functions such as map monitoring, timeout monitoring, and thread control.
[0198] In the monitoring map function, the electronic device can record and delete the dot information.
[0199] In the timeout monitoring function, the electronic device can implement timeout monitoring for any task, as well as polling monitoring.
[0200] In the thread control function, the electronic device can manage the thread pool in the watchdog mechanism.
[0201] The callback function can record timeouts. For example, the recorded information may include one or more of the following: the time when the task timed out, the thread executing the task, system resource information in the case of timeout, etc. The callback function can also report the recorded information to the cloud.
[0202] exist Figure 4-Figure 8 Based on the corresponding embodiments, Figure 9 This is a flow chart of a photographing method provided in an embodiment of the present application. Figure 9 As shown, the photographing method may include the following steps:
[0203] S901: In response to an operation of opening a camera application, display a first interface.
[0204] The first interface can be Figure 1 The interface shown in b.
[0205] S902: At a first moment, in response to an operation on a photo button, a first thread is created.
[0206] At a first moment, the first thread is bound to the first CPU core, and the CPU is at a first frequency.
[0207] The first thread may be thread 1 described in the embodiment of the present application.
[0208] S903: When the runtime of the first thread is greater than a first threshold, bind the first thread to the second CPU core.
[0209] The second moment is later than the first moment, the computing capability of the second CPU core is stronger than the computing capability of the first CPU core, and at the second moment, the CPU is at a second frequency, which is greater than the first frequency.
[0210] The first threshold can be Figure 5 The duration 1 described in the embodiment of the present application may be 1, the first CPU core may be a small core, and the second CPU core may be a large core. The first thread may be thread 1 described in the embodiment of the present application.
[0211] In this way, the electronic device can schedule the first thread by detecting the timeout of the first thread in the photo processing process, so that the first thread can continue to run under a high CPU frequency and a CPU core with high computing power, so as to increase the running time of the first thread in the photo processing process, thereby alleviating the lag phenomenon in the electronic device displaying the photo image.
[0212] It should be noted that the module names involved in the embodiments of the present application can be defined as other names as long as the functions of each module can be achieved, and there is no specific restriction on the names of the modules.
[0213] 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 the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0214] The photographing method of the embodiment of the present application has been described above. The following describes the apparatus for performing the above method provided in the embodiment of the present application. Those skilled in the art will appreciate that the method and apparatus can be combined and referenced with each other, and the relevant apparatus provided in the embodiment of the present application can perform the steps in the above-mentioned list sorting method.
[0215] like Figure 10 As shown, Figure 10 This is a structural schematic diagram of a photographing device provided in an embodiment of the present application. The photographing device can be the electronic device in the embodiment of the present application, or it can be a chip or chip system in the electronic device.
[0216] like Figure 10 As shown, the photographing device 1000 can be used in a communication device, circuit, hardware component, or chip, and includes a display unit 1001 and a processing unit 1002. The display unit 1001 is used to support the photographing device 1000 in performing display steps; the processing unit 1002 is used to support the photographing device 1000 in performing information processing steps.
[0217] In a possible implementation, the photographing device 1000 may further include a communication unit 1003 , and the communication unit 1003 is configured to support the photographing device 1000 in executing steps such as receiving or sending messages.
[0218] The photographing devices described in the embodiments of the present application may include Figure 10 The units described in the corresponding embodiments.
[0219] Specifically, the processing unit 1002 and the display unit 1001 may be integrated together, and the processing unit 1002 and the display unit 1001 may communicate with each other.
[0220] In a possible implementation, the photographing device 1000 may further include a storage unit 1004. The storage unit 1004 may include one or more memories, and the memory may be a device in one or more devices or circuits for storing programs or data.
[0221] The storage unit 1004 can exist independently and be connected to the processing unit 1002 via a communication bus. The storage unit 1004 can also be integrated with the processing unit 1002.
[0222] Taking the example of a camera device 1000 being a chip or chip system of an electronic device in an embodiment of the present application, the storage unit 1004 can store computer-executable instructions for the electronic device method, so that the processing unit 1002 executes the electronic device method in the above embodiment. The storage unit 1004 can be a register, a cache, or a random access memory (RAM), etc. The storage unit 1004 can be integrated with the processing unit 1002. The storage unit 1004 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions. The storage unit 1004 can be independent of the processing unit 1002.
[0223] In one possible implementation, the camera device 1000 may further include a communication unit 1003. The communication unit 1003 is used to support interaction between the camera device 1000 and other devices. For example, when the camera device 1000 is an electronic device, the communication unit 1003 may be a communication interface or interface circuit. When the camera device 1000 is a chip or chip system within the electronic device, the communication unit 1003 may be a communication interface. For example, the communication interface may be an input / output interface, pin, or circuit.
[0224] The device of this embodiment can be used to execute the steps executed in the above method embodiment. Its implementation principles and technical effects are similar and will not be described in detail here.
[0225] Figure 11 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application.
[0226] The electronic device includes a processor 1101, a communication circuit 1104 and at least one communication interface ( Figure 11 The communication interface 1103 is used as an example for explanation).
[0227] The processor 1101 may be a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0228] Communications link 1104 may include circuitry that transmits information between the aforementioned components.
[0229] The communication interface 1103 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.
[0230] Possibly, the electronic device may further include a memory 1102 .
[0231] The memory 1102 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may be independent and connected to the processor via a communication line 1104. The memory may also be integrated with the processor.
[0232] The memory 1102 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 1101. The processor 1101 is used to execute the computer-executable instructions stored in the memory 1102, thereby implementing the method provided by the embodiment of the present application.
[0233] Possibly, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not specifically limit this.
[0234] In a specific implementation, as an embodiment, the processor 1101 may include one or more CPUs, such as Figure 11 CPU0 and CPU1 in.
[0235] In a specific implementation, as an embodiment, the electronic device may include multiple processors, such as Figure 11 1 and 1105. Each of these processors can be a single-CPU processor or a multi-CPU processor. A processor herein can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0236] The photographing method provided in the embodiment of the present application can be applied to electronic devices with communication functions. The electronic devices include terminal devices. The specific device form of the terminal device can refer to the above-mentioned relevant description and will not be repeated here.
[0237] An embodiment of the present application provides a terminal device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.
[0238] The present embodiment provides a chip. The chip includes a processor configured to invoke a computer program stored in a memory to execute the technical solution of the above embodiment. The implementation principles and technical effects are similar to those of the above-mentioned related embodiments and will not be further described here.
[0239] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned method is implemented. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0240] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage or other magnetic storage devices, or any other medium intended to carry or store the desired program code in the form of instructions or data structures and accessible by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave) is used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and optical disc as used herein include optical disc, laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks generally reproduce data magnetically, while optical discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0241] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.
[0242] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0243] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. A photographing method, characterized in that: Applied to an electronic device, the electronic device includes a central processing unit (CPU), the CPU includes a first CPU core and a second CPU core, and the method includes: In response to an operation of opening a camera application, a first interface is displayed, wherein the first interface includes: a preview screen and a photo button; At a first moment, in response to an operation on the camera button, a first thread is created, wherein at the first moment, the first thread is bound to the first CPU core, and the CPU is at a first frequency; At a second moment, when the runtime of the first thread is greater than a first threshold, the first thread is bound to the second CPU core, wherein the second moment is later than the first moment, the computing capability of the second CPU core is stronger than the computing capability of the first CPU core, and at the second moment, the CPU is at a second frequency, which is greater than the first frequency.
2. The method according to claim 1, characterized in that At the first moment, the electronic device meets one or more of the following conditions: a graphics processor (GPU) of the electronic device is at a third frequency, a double data rate (DDR) of the electronic device is at a fourth frequency, or the first thread is at a first priority; At the second moment, the electronic device satisfies one or more of the following conditions: the GPU is at a fifth frequency, the DDR is at a sixth frequency, or the first thread is at a second priority; The fifth frequency is greater than the third frequency, the sixth frequency is greater than the fourth frequency, and the second priority is higher than the first priority.
3. The method according to claim 1 or 2, characterized in that The method further comprises: A second thread is created, wherein the second thread is bound to the first CPU core, the CPU is at the first frequency, and during the running of the second thread, the running time of the second thread is less than or equal to the first threshold.
4. The method according to claim 3, characterized in that Before creating the second thread, the method further includes: When the first thread finishes running, the first thread is bound to the first CPU core, and the CPU is at the first frequency.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Create a third thread; After the first thread is created, in response to receiving a first message from the first thread, the third thread starts a first timer, the first threshold is set in the first timer, and the first message is used to instruct the first thread to start running; The step of binding the first thread to the second CPU core when the runtime of the first thread is greater than a first threshold includes: binding the first thread to the second CPU core when the third thread does not receive a second message from the first thread within the first threshold, wherein the second message is used to instruct the first thread to terminate execution.
6. The method according to claim 5, characterized in that After receiving the first message from the first thread in response, the method further includes: the third thread recording first information, wherein the first information includes: an identifier of the first thread and a time when the first thread starts running; After binding the first thread to the second CPU core, the method further includes: deleting the first information when the third thread receives the second message.
7. The method according to claim 5 or 6, characterized in that The third thread is a monitoring thread monitorthread.
8. The method according to any one of claims 3 to 7, characterized in that: The first thread is: a thread for performing artificial intelligence raw data processing on an image, or a thread for performing blurring processing on an image, or a thread for performing image pre-processing on an image.
9. The method according to any one of claims 1 to 8, characterized in that After responding to the operation on the photo-taking button, the method further includes: Acquire a first image based on a camera; performing image processing on the first image by the first thread to obtain a photographed image; In response to an operation of opening the photographed image, the photographed image is displayed.
10. The method according to claim 9, characterized in that Before creating the first thread, the method further includes: setting the CPU frequency to the first frequency, and before responding to the operation of the photo button, the CPU is at a third frequency, the third frequency being lower than the first frequency; After obtaining the photographed image, the method further includes: setting the CPU frequency to the third frequency.
11. An electronic device, characterized in that: The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, and is configured to store computer program codes, where the computer program codes include computer instructions. The one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 10.
12. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 10.
14. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Thread migration method and device, storage medium and electronic equipment
CN111831414A
Migrating threads between asymmetric cores in a multiple core processor
US20140026146A1