Display screen brightness adjusting method, electronic equipment and storage medium
By calculating and adjusting the target ambient brightness of the current frame by utilizing the ambient brightness detected by the previous frame and the preset brightness interval and calibration coefficient in the electronic device, the problem of inaccurate ambient brightness detection by the camera is solved, and the problem of inaccurate ambient brightness is realized. Stable adjustment of display brightness and improvement of user experience.
Patent Information
- Application Number
- CN202410427040.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-09
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-04-09
AI Technical Summary
The accuracy of existing electronic devices in detecting ambient light brightness through cameras is low, resulting in unstable display brightness adjustment and affecting user experience.
By obtaining the ambient light brightness detected in the previous frame, calculating the target ambient light brightness of the current frame, using the correspondence between the preset brightness interval and the calibration coefficient, determining the target calibration coefficient, and then adjusting the display screen brightness to ensure that The brightness adjustment is within the appropriate range to improve the accuracy of ambient light brightness.
It realizes stable adjustment of display brightness, reduces brightness changes, improves user experience, and ensures a good viewing experience under different lighting conditions.
Smart Images

Figure CN119252210A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic equipment, and in particular to a method for adjusting the brightness of a display screen, an electronic device, and a storage medium. Background Art
[0002] At present, the display screens of many electronic devices such as smartphones, tablets, desktop computers, wearable devices, etc. all have the function of automatic brightness adjustment. The automatic brightness adjustment function can automatically adjust the brightness of the display screen according to the ambient light brightness to adapt to the light intensity in different environments, thereby improving the user experience and reducing the power consumption of electronic devices.
[0003] In the related art, in order to reduce the cost of electronic devices, a camera (e.g., a front camera) in the electronic device is used instead of an ambient light detection device, that is, the camera in the electronic device is used to detect the ambient light brightness. Then, based on the detected ambient light brightness, the display brightness of the electronic device is adjusted.
[0004] However, the accuracy of detecting the ambient light brightness through the camera is low, resulting in a large change in the brightness of the electronic device's display screen when the display screen brightness of the electronic device is adjusted, affecting the user experience. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method for adjusting the brightness of a display screen, an electronic device, and a storage medium to improve the accuracy of detecting the brightness of ambient light, so that the brightness of the display screen of the electronic device changes less when the brightness of the display screen of the electronic device is adjusted, thereby improving the user experience. The specific technical solution is as follows:
[0006] In a first aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a method for adjusting the brightness of a display screen, the method being applied to an electronic device, the method comprising:
[0007] Acquire the ambient light brightness detected by the target camera of the electronic device in the previous frame to obtain a first ambient light brightness;
[0008] Calculate the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data acquired by the target camera in the current frame;
[0009] Based on the brightness of the second ambient light, determining the brightness range of the current frame to obtain a target brightness range;
[0010] In the correspondence between the preset brightness intervals and the calibration coefficients, the calibration coefficient corresponding to the target brightness interval is determined to obtain the target calibration coefficient; wherein the plurality of brightness intervals in the correspondence are arranged in order from low to high according to the brightness included;
[0011] Calculating the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data;
[0012] The display screen brightness of the electronic device is adjusted based on the target ambient light brightness of the current frame.
[0013] As can be seen from the above, the technical solution provided by this embodiment determines the target brightness interval of the current frame based on the first brightness interval to which the ambient light brightness detected in the previous frame belongs. The target brightness interval of the current frame and the brightness interval to which the ambient light brightness detected in the previous frame belongs do not cross the brightness interval. Furthermore, the target ambient light brightness of the current frame is determined based on the target brightness interval, so that the target ambient light brightness can be located in the target brightness interval, thereby improving the accuracy of the determined target ambient light brightness. Furthermore, when the display brightness is adjusted based on the target ambient light brightness, the display brightness of the electronic device will not be adjusted across the brightness interval, so that when the display brightness of the electronic device is adjusted, the display brightness changes less, thereby improving the user experience.
[0014] In one embodiment of the present application, before calculating the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data acquired by the target camera in the current frame, the method further includes:
[0015] Determining whether to switch parameter settings of the target camera from a brightness interval preceding the first brightness interval to the first brightness interval;
[0016] The calculating the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data collected by the target camera in the current frame includes:
[0017] When the parameter setting of the target camera is not switched from a brightness interval preceding the first brightness interval to the first brightness interval, determining the calibration coefficient corresponding to the brightness interval preceding the first brightness interval in the correspondence relationship between preset brightness intervals and calibration coefficients to obtain a first calibration coefficient;
[0018] The second ambient light brightness is calculated based on the first calibration coefficient and the target image data acquired by the target camera in the current frame.
[0019] As can be seen from the above, in the technical solution of this embodiment, the first brightness interval to which the first ambient light brightness detected by the target camera in the previous frame belongs is determined, and when the parameter setting of the target camera is not switched from the previous brightness interval of the first brightness interval to the first brightness interval, the second ambient light brightness used to estimate the target brightness interval of the current frame is determined in combination with the previous brightness interval of the first brightness interval. The target brightness interval determined based on the second ambient light brightness will not always be a higher brightness interval, which can avoid the problem that the display brightness is adjusted to a higher brightness interval (such as after an ultra-high brightness interval) and cannot be reduced to a lower brightness interval, thereby improving the user experience. In addition, the target brightness interval and the first brightness interval will not cross a brightness interval, which can avoid adjusting the display brightness across a brightness interval, so that the user visually perceives a smaller change in the display brightness, that is, the display brightness can be adjusted without the user noticing, thereby improving the user experience.
[0020] In one embodiment of the present application, determining the brightness range of the current frame based on the brightness of the second ambient light to obtain a target brightness range includes:
[0021] Determining whether the brightness of the second ambient light is within a brightness interval preceding the first brightness interval;
[0022] When the brightness of the second ambient light is in a brightness interval preceding the first brightness interval, determining the brightness interval preceding the first brightness interval as the brightness interval of the current frame, and obtaining a target brightness interval;
[0023] When the brightness of the second ambient light is not within a brightness interval preceding the first brightness interval, determining whether the brightness of the second ambient light is within the first brightness interval;
[0024] When the brightness of the second ambient light is within the first brightness range, the first brightness range is determined to be the brightness range of the current frame, and a target brightness range is obtained.
[0025] As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness used to estimate the target brightness interval of the current frame is determined in combination with the previous brightness interval of the first brightness interval. Based on the second ambient light brightness, the target brightness interval is determined to be the previous brightness interval of the first brightness interval, or the first brightness interval, so that the target brightness interval will not always be a higher brightness interval, which can avoid the problem that the brightness cannot be reduced to a lower brightness interval after being adjusted to a higher brightness interval (such as after an ultra-high brightness interval), thereby improving the user experience. In addition, the target brightness interval and the first brightness interval will not cross the brightness interval, which can avoid adjusting the brightness of the display screen of the electronic device across the brightness interval, so that the user visually perceives a smaller change in the brightness of the display screen, that is, the display screen brightness can be adjusted without the user's perception, thereby improving the user experience.
[0026] In one embodiment of the present application, after determining whether the brightness of the second ambient light is within the first brightness range, the method further includes:
[0027] When the brightness of the second ambient light is not within the first brightness range, determining the calibration coefficient corresponding to the first brightness range in a preset correspondence relationship between the brightness range and the calibration coefficient, and obtaining a second calibration coefficient;
[0028] Calculating a third ambient light brightness based on the second calibration coefficient and the target image data;
[0029] Determining whether the brightness of the third ambient light is within the first brightness range;
[0030] When the brightness of the third ambient light is within the first brightness range, determining the first brightness range as the brightness range of the current frame, and obtaining a target brightness range;
[0031] When the brightness of the third ambient light is not within the first brightness interval, determining whether the brightness of the third ambient light is within a brightness interval subsequent to the first brightness interval;
[0032] When the brightness of the third ambient light is in a brightness interval subsequent to the first brightness interval, the brightness interval subsequent to the first brightness interval is determined as the brightness interval of the current frame, and a target brightness interval is obtained.
[0033] As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness used to estimate the target brightness interval of the current frame is determined in combination with the previous brightness interval of the first brightness interval. When the second ambient light brightness is not located in the previous brightness interval of the first brightness interval, nor in the first brightness interval, the third ambient light brightness is determined based on the calibration coefficient corresponding to the first brightness interval, and the target brightness interval is determined to be the first brightness interval or the next brightness interval of the first brightness interval based on the third ambient light brightness. This can avoid the problem that the brightness cannot be reduced to a lower brightness interval after being adjusted to a higher brightness interval (such as after an ultra-high brightness interval), thereby improving the user experience. In addition, the target brightness interval and the first brightness interval will not cross the brightness interval, so that the brightness of the display screen of the electronic device can be adjusted across the brightness interval, so that the user visually perceives a smaller change in the brightness of the display screen, that is, the display screen brightness can be adjusted without the user's perception, thereby improving the user experience.
[0034] In one embodiment of the present application, before determining whether to switch the parameter setting of the target camera from a brightness interval before the first brightness interval to the first brightness interval, the method further includes:
[0035] Determine whether there is a brightness interval before the first brightness interval;
[0036] The determining whether to switch the parameter setting of the target camera from a brightness interval before the first brightness interval to the first brightness interval includes:
[0037] When there is a brightness interval preceding the first brightness interval, it is determined whether to switch the parameter setting of the target camera from the brightness interval preceding the first brightness interval to the first brightness interval.
[0038] In one embodiment of the present application, after determining whether there is a brightness interval before the first brightness interval, the method further includes:
[0039] When there is no previous brightness interval of the first brightness interval, in the corresponding relationship between the preset brightness interval and the calibration coefficient, the calibration coefficient corresponding to the first brightness interval is determined to obtain the second calibration coefficient, and the step of calculating the third ambient light brightness based on the second calibration coefficient and the target image data is performed.
[0040] In one embodiment of the present application, after determining whether the brightness of the third ambient light is in a brightness interval subsequent to the first brightness interval, the method further includes:
[0041] When the brightness of the third ambient light is not in a brightness interval subsequent to the first brightness interval, determining whether the brightness of the third ambient light is lower than a lower limit value of a brightness interval preceding the first brightness interval;
[0042] When the brightness of the third ambient light is lower than the lower limit value of a brightness interval preceding the first brightness interval, the brightness interval preceding the first brightness interval is determined to be the brightness interval of the current frame, and the target brightness interval is obtained.
[0043] As can be seen from the above, the technical solution of this embodiment is that the third ambient light brightness is neither in the first brightness interval nor in the brightness interval after the first brightness interval. When the third ambient light brightness is lower than the lower limit of the previous brightness interval of the first brightness interval, it indicates that the third ambient light brightness interval is located in the brightness interval before the previous brightness interval of the first brightness interval, and the previous brightness interval of the first brightness interval is determined as the target brightness interval of the current frame, which can avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, thereby avoiding adjusting the display brightness across the brightness interval, thereby improving the user experience.
[0044] In one embodiment of the present application, after determining whether the brightness of the third ambient light is lower than a lower limit value of a brightness interval preceding the first brightness interval, the method further includes:
[0045] When the brightness of the third ambient light is not lower than the lower limit value of a brightness interval before the first brightness interval, determining whether the brightness of the third ambient light is higher than the upper limit value of a brightness interval after the first brightness interval;
[0046] When the brightness of the third ambient light is higher than the upper limit value of a brightness interval subsequent to the first brightness interval, the brightness interval subsequent to the first brightness interval is determined as the brightness interval of the current frame, and a target brightness interval is obtained.
[0047] As can be seen from the above, the technical solution of this embodiment is that the third ambient light brightness is neither in the first brightness interval nor in the brightness interval after the first brightness interval. When the third ambient light brightness is higher than the upper limit value of the brightness interval after the first brightness interval, it indicates that the third ambient light brightness interval is located in the brightness interval after the brightness interval after the first brightness interval, and the brightness interval after the first brightness interval is determined as the target brightness interval of the current frame, which can avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, thereby avoiding adjusting the display brightness across the brightness interval, and improving the user experience.
[0048] In one embodiment of the present application, the calculating of the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data acquired by the target camera in the current frame includes:
[0049] When switching the parameter setting of the target camera from a brightness interval preceding the first brightness interval to the first brightness interval, determining the calibration coefficient corresponding to the first brightness interval in a preset correspondence relationship between the brightness interval and the calibration coefficient, and obtaining a second calibration coefficient;
[0050] The second ambient light brightness is calculated based on the second calibration coefficient and the target image data acquired by the target camera in the current frame.
[0051] As can be seen from the above, in the technical solution of this embodiment, the first brightness interval to which the first ambient light brightness detected by the target camera in the previous frame belongs is determined, and when the parameter setting of the target camera is switched from the previous brightness interval of the first brightness interval to the first brightness interval, the second ambient light brightness used to estimate the target brightness interval of the current frame is directly determined based on the first brightness interval. Subsequently, the target brightness interval is determined based on the second ambient light brightness, and the target brightness interval and the first brightness interval will not cross the brightness interval, which can avoid adjusting the display brightness across the brightness interval, so that the user visually perceives a smaller change in the display brightness, that is, the user can adjust the display brightness without perception, thereby improving the user experience.
[0052] In one embodiment of the present application, determining the brightness range of the current frame based on the brightness of the second ambient light to obtain a target brightness range includes:
[0053] Determining whether the brightness of the second ambient light is within a brightness interval preceding the first brightness interval;
[0054] When the brightness of the second ambient light is in a brightness interval preceding the first brightness interval, determining the brightness interval preceding the first brightness interval as the brightness interval of the current frame, and obtaining a target brightness interval;
[0055] When the brightness of the second ambient light is not within a brightness interval preceding the first brightness interval, determining whether the brightness of the second ambient light is within the first brightness interval;
[0056] When the brightness of the second ambient light is within the first brightness range, determining the first brightness range as the brightness range of the current frame, and obtaining a target brightness range;
[0057] When the brightness of the second ambient light is not within the first brightness interval, determining whether the brightness of the second ambient light is within a brightness interval subsequent to the first brightness interval;
[0058] When the brightness of the second ambient light is in a brightness interval subsequent to the first brightness interval, the brightness interval subsequent to the first brightness interval is determined as the brightness interval of the current frame, and a target brightness interval is obtained.
[0059] As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness used to estimate the target brightness interval of the current frame is directly determined based on the first brightness interval. Based on the second ambient light brightness, it is determined in turn whether the target brightness interval is the brightness interval before the first brightness interval, the first brightness interval, or the brightness interval after the first brightness interval, so that the target brightness interval and the first brightness interval do not cross the brightness interval, and the adjustment of the display screen brightness across the brightness interval can be avoided, so that the user visually perceives a smaller change in the display screen brightness, that is, the user can adjust the display screen brightness without perception, thereby improving the user experience.
[0060] In one embodiment of the present application, the step of calculating the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data includes:
[0061] The target ambient light brightness of the current frame is calculated based on the target calibration coefficient, the target image data and a preset formula; wherein the preset formula is:
[0062] Lux=A×R+B
[0063] Lux represents the target ambient light brightness; A represents a target calibration coefficient; B represents another target calibration coefficient; and R represents the target image data.
[0064] In a second aspect, an embodiment of the present application further provides an electronic device, including:
[0065] one or more processors and memory;
[0066] The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the above-mentioned display screen brightness adjustment method.
[0067] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, including a computer program, which, when executed on an electronic device, enables the electronic device to execute the above-mentioned display screen brightness adjustment method.
[0068] In a fourth aspect, an embodiment of the present application further provides a computer program product, which includes executable instructions. When the executable instructions are executed on an electronic device, the electronic device executes the above-mentioned display screen brightness adjustment method.
[0069] In a fifth aspect, an embodiment of the present application further provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device inputs data into the chip system, and executes the above-mentioned display screen brightness adjustment method to process the data and output the processing results.
[0070] The beneficial effects of the solutions provided by the embodiments in the second, third, fourth and fifth aspects can refer to the beneficial effects of the solutions provided by the embodiments in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments 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 labor.
[0072] Figure 1 A structural diagram of an electronic device provided in an embodiment of the present application;
[0073] Figure 2 A software structure block diagram of an electronic device provided in an embodiment of the present application;
[0074] Figure 3 A first ambient light brightness comparison diagram provided in an embodiment of the present application;
[0075] Figure 4 A flowchart of a first method for adjusting display screen brightness provided in an embodiment of the present application;
[0076] Figure 5 A flowchart of a second method for adjusting display screen brightness provided in an embodiment of the present application;
[0077] Figure 6 A schematic diagram of a first brightness range provided in an embodiment of the present application;
[0078] Figure 7 A flowchart of a third method for adjusting display screen brightness provided in an embodiment of the present application;
[0079] Figure 8 A schematic diagram of a second brightness range provided in an embodiment of the present application;
[0080] Fig. 9 A flowchart of a fourth method for adjusting display screen brightness provided in an embodiment of the present application;
[0081] Fig.10 A flowchart of a fifth method for adjusting display screen brightness provided in an embodiment of the present application;
[0082] Fig.11 A flowchart of a sixth method for adjusting display screen brightness provided in an embodiment of the present application;
[0083] Fig.12 A flowchart of a seventh method for adjusting display screen brightness provided in an embodiment of the present application;
[0084] Fig.13 A flowchart of a method for turning off the screen and disabling the ambient light detection function of a front camera provided in an embodiment of the present application;
[0085] Fig.14 A flowchart of another method for turning off the screen and disabling the ambient light detection function of the front camera provided in an embodiment of the present application;
[0086] Fig.15 A flowchart of a first method for managing an ambient light detection function provided in an embodiment of the present application;
[0087] Fig.16 A flowchart of a second method for managing an ambient light detection function provided in an embodiment of the present application;
[0088] Fig.17 A flowchart of a third method for managing an ambient light detection function provided in an embodiment of the present application;
[0089] Fig.18 A flowchart of a fourth method for managing an ambient light detection function provided in an embodiment of the present application;
[0090] Fig.19 A flowchart of a fifth method for managing an ambient light detection function provided in an embodiment of the present application;
[0091] Fig. 20 A flowchart of a sixth method for managing an ambient light detection function provided in an embodiment of the present application;
[0092] Fig.21 A performance optimization logic block diagram of an electronic device provided in an embodiment of the present application;
[0093] Fig. 22 A flowchart of a method for determining ambient light brightness provided in an embodiment of the present application;
[0094] Fig.23 A second ambient light brightness comparison diagram provided in an embodiment of the present application;
[0095] Fig.24 A third ambient light brightness comparison diagram provided in an embodiment of the present application;
[0096] Fig.25 A structural diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0097] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0098] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first instruction and the second instruction are to distinguish different user instructions, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0099] It should be noted that, in this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0100] The display screen brightness adjustment method provided in the embodiment of the present application is applied to electronic devices. The electronic devices may be mobile phones, tablet computers, personal computers (PCs), car computers, personal digital assistants (PDAs), smart watches, netbooks, wearable devices, augmented reality (AR) devices, virtual reality (VR) devices, robots, smart TVs, and other electronic devices equipped with cameras and display screens.
[0101] For example, Figure 1 The schematic diagram of the structure of the electronic device 100 is shown. The electronic device 100 may include a processor 110, an internal memory 121, a camera 193, a display screen 194, etc. The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0102] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. When the processor 110 needs to use the instruction or data again, it may be directly called from the memory, avoiding repeated access, reducing the waiting time of the processor 110, and thus improving the efficiency of the system.
[0103] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input / Output (GPIO) interface, a Subscriber Identity Module (SIM interface), and / or a Universal Serial Bus (USB) interface, etc.
[0104] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0105] The electronic device 100 can realize the display function through a GPU, a display screen 194, and an application processor. Among them, the GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information. The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0106] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor. Among them, ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193. Camera 193 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to ISP for conversion into a digital image signal. ISP outputs the digital image signal to DSP for processing. The DSP converts the digital image signal into an image signal in a standard format such as RGB, YUV, etc. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0107] In some embodiments, the electronic device 100 may further include an external memory interface 120, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, 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, a motor 191, an indicator 192, and a user identification module card interface 195. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, a bone conduction sensor 180M, etc.
[0108] 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 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.
[0109] The USB interface 130 is an interface that complies with USB standard specifications, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100; it can also be used to transmit data between the electronic device 100 and peripheral devices; it can also be used to connect headphones to play audio through the headphones; it can also be used to connect other electronic devices, such as AR devices, etc.
[0110] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0111] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0112] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
[0113] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0114] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (Low Noise Amplifier, LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0115] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.) applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0116] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include Global System for Mobile communications (GSM), General Packet Radio Dervice (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM and / or IR technology, etc. The GNSS may include a Global Positioning System (GPS), a Global Navigation Satellite System (GLONASS), a Beidou Navigation Satellite System (BDS), a Quasi-Zenith Satellite System (QZSS) and / or a Satellite Based Augmentation System (SBAS).
[0117] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D and the application processor.
[0118] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. In addition, the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above-mentioned embodiments, or a combination of multiple interface connection methods.
[0119] The electronic device 100 is installed with a software system, which can run on the processor 110. The software system can be an Android system, a Windows system, an IOS system, a Hongmeng system, etc. The architecture adopted by the software system can be a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100. See Figure 2 The Android system can be divided into four layers, from top to bottom: application layer, framework layer (Framework, FWK), hardware abstraction layer (HAL) and kernel layer.
[0120] The application layer may include a series of applications, such as camera, calendar, map, WLAN, music, short message, gallery, call, ambient light detection, face unlocking, etc., which are used to interact directly with users. These applications can be system built-in applications or non-system level applications. And these applications can have icons and application interfaces, or have application interfaces without icons, or have neither icons nor application interfaces.
[0121] The framework layer includes some predefined functions, which can provide application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application programming interfaces provided by the framework layer may include interfaces related to camera services, interfaces related to sensor services, and interfaces related to other services. Interfaces related to different services can be defined as different service modules. For example, interfaces related to sensor services can be defined as sensor service modules, interfaces related to camera services can be defined as camera service modules, and interfaces related to other services can be defined as other service modules (not shown in the figure), etc. Among them, the sensor service module may include sub-modules such as sensor management (SensorManager) and sensor service (SensorService). SensorManager is used to adjust the brightness of the display screen of the electronic device according to the detected ambient light brightness. SensorService is used to implement communication between related applications that need to call sensors in the application layer and Sensor HAL.
[0122] In some embodiments, the sensor service module may be a separate process, and the SensorManager and SensorService may be two threads in the process.
[0123] The camera service module includes submodules such as ICameraService and CameraService. CameraService can be used to implement communication between applications that need to call cameras in the application layer (for example, camera applications, face unlocking applications, ambient light detection applications, etc.) and Camera HAL. In some embodiments, the camera service module can be used as an independent process, and ICameraService and CameraService can be two threads in the process. The electronic device is provided with multiple cameras, multiple cameras cannot be enabled at the same time, and different functions of the same camera cannot be enabled at the same time. When the front camera is used instead of the ambient light detection device, in order to solve the enabling priority problem of different functions of multiple cameras, the embodiment of the present application modifies the CameraService in the camera service module, and adds the judgment logic of the enabling priority of different functions of the camera, so that when two or more camera functions need to be enabled at the same time, one can be enabled according to the judgment logic.
[0124] The hardware abstraction layer is located between the framework layer and the kernel layer, and its purpose is to abstract the hardware. The hardware abstraction layer hides the hardware interface details of a specific platform and provides a virtual hardware platform for the software system, making it hardware-independent and portable on multiple platforms. According to the functions implemented, the hardware abstraction layer can be further refined into a camera-related hardware abstraction layer (i.e., the Camera HAL described in subsequent embodiments), a sensor-related hardware abstraction layer (i.e., the Sensor HAL described in subsequent embodiments), etc. The camera-related hardware abstraction layer can be defined as a camera control module, and the sensor-related hardware abstraction layer can be defined as a sensor control module.
[0125] In some embodiments, the camera control module can be used as an independent process, and the sensor control module can also be used as an independent process. In order to realize the ambient light detection function of the front camera, the embodiment of the present application modifies the sensor control module (Sensor HAL). Specifically, an ambient light service control submodule (i.e., the CameraLightManager described in the subsequent embodiments) is added to the sensor control module. The ambient light service control submodule provides multiple interfaces, including an activation (Active) interface, a deactivation (DeActive) interface, etc. Among them, the Active interface is used to turn on the ambient light detection function of the front camera. The DeActive interface is used to turn off the ambient light detection function of the front camera.
[0126] The embodiment of the present application also modifies the camera control module (Camera HAL). Specifically, a camera function customization submodule (i.e., CamxLightCustom described in subsequent embodiments) is added to the camera control module, and the existing functional submodules in the camera control module (e.g., Camera Hardware Interface-Camera Development Kit (CHI-CDK), CAMX, etc.) are modified. Among them, the camera function customization submodule is used to obtain the ambient light brightness detected by the front camera when the front camera is used as an ambient light detection device, and send the ambient light brightness detected by the front camera to the sensor control module, so that the sensor control module reports the ambient light brightness to the sensor service module, thereby adjusting the display brightness of the electronic device. CHI-CDK is a customizable code implementation set. Based on the original code implementation set of CHI-CDK, the embodiment of the present application adds AIDL (Android Interface Definition Language) service initialization-related code, so that different processes in the electronic device (such as Sensor HAL and Camera HAL) can communicate with each other. Among them, AIDL is used to define the interface between the client and the server of the Android system based on Binder communication. Binder is a cross-process communication mechanism of the Android system, which allows communication between different processes and even across devices. CAMX is a set of code implementations of a general functional interface. Based on the original set of code implementations in CAMX, the embodiment of the present application modifies the first function (i.e., the Open Camera function) and adds a logical branch that can skip configuring image output resources for the front camera. Therefore, when the front camera is used as an ambient light detection device, the process of configuring image output resources for the front camera can be skipped, thereby reducing the power consumption of the front camera and improving the performance of the electronic device.
[0127] The kernel layer is the layer between hardware and software. The kernel layer may include display drivers, camera drivers, audio drivers, sensor drivers, etc., through which the display screen, front / rear cameras, audio players, sensors, etc. can be driven.
[0128] The following introduces the application scenarios of the display screen brightness adjustment method provided in the embodiments of the present application.
[0129] In modern life, electronic devices such as smart phones, tablet computers, and laptops have become indispensable items in people's lives. In order to meet the needs of users in different lighting scenarios, electronic devices provide an automatic brightness adjustment function. After the electronic device screen is turned on, the built-in ambient light detection device can detect the ambient light brightness, and then adjust the brightness of the electronic device's display screen based on the ambient light brightness detected by the ambient light detection device, so that users have a good viewing experience under different lighting conditions.
[0130] Although the above method can adjust the brightness of the display screen, it requires an additional ambient light detection device, which increases the cost of the electronic device. Considering that current electronic devices are equipped with cameras, and most cameras have a light source detection function, when a camera that supports normal mode (i.e., photo mode) is used as an ambient light detection device, the power consumption of the camera that supports normal mode is high, which reduces the performance of the electronic device. With the development of technology, cameras can support multiple modes, including normal mode, ambient light sensor mode (ALS) mode, ultra low power consumption (ULP) mode, etc., which makes it possible to use cameras as ambient light detection devices.
[0131] In view of this, a method is provided for replacing an ambient light detection device with a target camera to detect ambient light brightness, and then adjusting the brightness of a display screen based on the ambient light brightness detected by the target camera. The target camera has an ambient light detection function and an image acquisition function, and can be a front camera of an electronic device or a rear camera of an electronic device. Considering that the display screen is arranged on the upper surface of the electronic device, the front camera is also arranged on the upper surface of the electronic device, and is located on the same side as the display screen, and the ambient light brightness on different sides of the electronic device is different to a certain extent, in order to make the adjusted display screen brightness more in line with the current environment, this application is explained by taking the target camera as a front camera as an example.
[0132] Under different ambient light brightness, different calculation formulas are set, and the calculation formulas include the calibration coefficients in the subsequent embodiments, and the calculation formulas are used to calculate the corresponding ambient light brightness. If the same calculation formula is used for different ambient light brightnesses, the calculated ambient light brightness will be inaccurate. Accordingly, when the ambient light is detected by the target camera, the brightness range to which the raw image data (Raw data) collected by the target camera belongs is determined, and the calculation formula corresponding to the brightness range to which the Raw data belongs is used to calculate the ambient light brightness.
[0133] However, if there are overlapping areas in the brightness ranges belonging to different Raw data, an inappropriate calculation formula may be selected when calculating the ambient light brightness, resulting in low accuracy in the determined ambient light brightness, which in turn causes non-linear adjustment of the display brightness. For example, the display brightness of an electronic device is directly adjusted from a lower brightness to a higher brightness, causing the user to visually perceive a large change in the display brightness, affecting the user experience.
[0134] For example, see Table 1, which is an ambient light brightness comparison table of an embodiment of the present application.
[0135] Table 1
[0136] Raw data 0 234 277 777.1 1287 Index 1 -105.13 77.0858 110.5699 500 500 Index2 -502.55 500 683.7856 2825.614 5000 Index3 -552.5 0 4987.45 5000 5000
[0137] Raw data is the original image data. The light signal collected by the target camera is converted into an electrical signal to obtain the digital signal of each pixel. Based on the digital signal of each pixel, the output Raw data is obtained. Index1, Index2 and Index3 correspond to different brightness ranges, for example, Index1 corresponds to the low brightness range, Index2 corresponds to the medium brightness range, and Index3 corresponds to the high brightness range. The data corresponding to Index1, Index2 and Index3 is the ambient light brightness obtained for the same Raw data using the calculation formula corresponding to the corresponding brightness range, where the unit of ambient light brightness is lux.
[0138] See also Figure 3 , Figure 3 The following is a comparison chart of ambient light brightness based on Table 1. The line with the origin is the correspondence between the Raw data and the ambient light brightness obtained using the calculation formula corresponding to the low brightness range. The line with triangles is the correspondence between the Raw data and the ambient light brightness obtained using the calculation formula corresponding to the medium brightness range. The line with squares is the correspondence between the Raw data and the ambient light brightness obtained using the calculation formula corresponding to the high brightness range.
[0139] Based on the above Table 1 and the above Figure 3 It can be seen that for the same Raw data, using different calculation formulas, the calculated ambient light brightness is quite different. For example, when the Raw data is 777.1, the ambient light brightness obtained by using the calculation formula corresponding to the low brightness range is 500, while the ambient light brightness obtained by using the calculation formula corresponding to the medium brightness range is 2825.614, which is a large difference.
[0140] In order to solve the above problems, the method of an embodiment of the present application is used to adjust the brightness of the display screen of an electronic device. The electronic device determines the target brightness interval of the current frame based on the first brightness interval to which the ambient light brightness detected in the previous frame belongs. The target brightness interval of the current frame and the first brightness interval to which the ambient light brightness detected in the previous frame belongs do not cross the brightness interval. Furthermore, the target ambient light brightness of the current frame is determined based on the target brightness interval, so that the target ambient light brightness can be located in the target brightness interval, thereby improving the accuracy of the determined target ambient light brightness. Furthermore, when the display screen brightness is adjusted based on the target ambient light brightness, the display screen brightness of the electronic device will not be adjusted across the brightness interval. This can ensure that when the display screen brightness of the electronic device is adjusted, the change in the display screen brightness is small, thereby improving the user experience.
[0141] Next, the method for adjusting the brightness of a display screen provided in an embodiment of the present application is described in detail through a specific embodiment. In an embodiment of the present application, see Figure 4 , Figure 4 A flowchart of a method for adjusting display screen brightness provided in an embodiment of the present application, the method is applied to an electronic device, and the method may include the following steps:
[0142] S401: Acquire the ambient light brightness detected by a target camera of the electronic device in a previous frame to obtain a first ambient light brightness.
[0143] S402: Calculate the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data collected by the target camera in the current frame.
[0144] S403: Determine a brightness range of the current frame based on the second ambient light brightness to obtain a target brightness range.
[0145] S404: Determine the calibration coefficient corresponding to the target brightness range in the correspondence between the preset brightness ranges and the calibration coefficients, and obtain the target calibration coefficient.
[0146] The multiple brightness intervals in the above correspondence are arranged in order from low to high brightness.
[0147] S405: Calculate the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data.
[0148] S406: Adjust the display brightness of the electronic device based on the target ambient light brightness of the current frame.
[0149] As can be seen from the above, the technical solution of this embodiment determines the target brightness interval of the current frame based on the first brightness interval to which the ambient light brightness detected in the previous frame belongs. The target brightness interval of the current frame and the brightness interval to which the ambient light brightness detected in the previous frame belongs will not cross the brightness interval. Furthermore, the target ambient light brightness of the current frame is determined based on the target brightness interval, so that the target ambient light brightness can be located in the target brightness interval, thereby improving the accuracy of the determined target ambient light brightness. Furthermore, when the display brightness is adjusted based on the target ambient light brightness, the display brightness of the electronic device will not be adjusted across the brightness interval, so that when the display brightness of the electronic device is adjusted, the display brightness changes less, thereby improving the user experience.
[0150] With respect to step S401 , the target camera may be a front camera of the electronic device.
[0151] After the electronic device turns on the screen, the ambient light detection function is started, the electronic device powers on the front camera, and turns on the ambient light detection function of the front camera. The screen of the electronic device can be turned on for the first time when the device is turned on, or it can be a non-first time after the device is turned on. If the electronic device is in the off state, the electronic device can be turned on by long pressing the power button to light up the display. If the electronic device is in the on state, the display of the electronic device can be lit by touching the power button, touching the display using a preset gesture (such as double-clicking, etc.), lifting the electronic device, and so on. After the electronic device turns on the screen, the front camera is powered on. The front camera can be powered on based on the screen of the electronic device to initialize the front camera, thereby turning on the front camera to detect the ambient light brightness.
[0152] When the electronic device is on, the target camera detects the ambient light brightness in real time and adjusts the display brightness in real time. Accordingly, the electronic device obtains the ambient light brightness detected in the previous frame to obtain the first ambient light brightness. The ambient light brightness detected in the previous frame is calculated based on the Raw data collected by the target camera in the previous frame.
[0153] For step S402, multiple brightness intervals are pre-set, and the multiple brightness intervals are arranged in order from low to high according to the brightness included. In one implementation, the brightness intervals include: a low brightness interval, a medium brightness interval, and a high brightness interval. For example, the low brightness interval is [0, 500], the medium brightness interval is [500, 5000], and the high brightness interval is [5000, 10000000].
[0154] For example, the following is a Hyper Text Markup Language (HTML) file for setting multiple brightness intervals.
[0155]
[0156]
[0157] In another implementation, the brightness range includes: low brightness, medium brightness, high brightness and ultra-high brightness. For example, the low brightness range is [0, 500], the medium brightness range is [500, 5000], the high brightness range is [5000, 10000000], and the ultra-high brightness range is [10000000, 20000000].
[0158] After acquiring the first ambient light brightness, the electronic device determines the brightness interval to which the first ambient light brightness belongs (referred to as the first brightness interval), and then calculates the second ambient light brightness based on the first brightness interval and the target image data collected by the target camera in the current frame. The second ambient light brightness is the reference ambient light brightness used to determine the target ambient light brightness of the current frame. The target image data is the Raw data collected by the target camera in the current frame.
[0159] In some embodiments, Figure 4 Based on Figure 5 Before step S402, the method may further include the following:
[0160] S407: Determine whether to switch the parameter setting of the target camera from the brightness interval before the first brightness interval to the first brightness interval.
[0161] Accordingly, step S402 may include the following steps:
[0162] S4021: When the parameter setting of the target camera is not switched from the brightness interval before the first brightness interval to the first brightness interval, the calibration coefficient corresponding to the brightness interval before the first brightness interval is determined in the correspondence between the preset brightness intervals and the calibration coefficients to obtain the first calibration coefficient.
[0163] S4022: Calculate the second ambient light brightness based on the first calibration coefficient and the target image data collected by the target camera in the current frame.
[0164] Different brightness ranges may correspond to different types of parameter settings of the target camera. The parameter settings may include parameters such as the gain of the target camera.
[0165] For example, in the HTML file for setting brightness ranges, the low brightness range corresponds to one type of parameter setting, and the medium brightness range and high brightness range correspond to another type of parameter setting. Among them, the parameter setting corresponding to the low brightness range is: <settingtype> LOW_LUX_SWITCH< / settingtype> The parameters for the medium brightness range and high brightness range are set as follows: <settingtype> HIGH_LUX_SWITCH< / settingtype> .
[0166] The electronic device may obtain the setting type (SettingType) of the parameter setting of the target camera corresponding to the first brightness interval, and the SettingType of the parameter setting of the target camera corresponding to the brightness interval before the first brightness interval. If the SettingType of the parameter setting of the target camera corresponding to the first brightness interval is different from the SettingType of the parameter setting of the target camera corresponding to the brightness interval before the first brightness interval, it can be determined that the parameter setting of the target camera is switched from the brightness interval before the first brightness interval to the first brightness interval. If the SettingType of the parameter setting of the target camera corresponding to the first brightness interval is the same as the SettingType of the parameter setting of the target camera corresponding to the brightness interval before the first brightness interval, it can be determined that the parameter setting of the target camera is not switched from the brightness interval before the first brightness interval to the first brightness interval.
[0167] For example, see Figure 6 The brightness ranges of the ambient light brightness are in the following order from low to high: low brightness range, medium brightness range, high brightness range and ultra-high brightness range. The parameter corresponding to the low brightness range is set to Setting 1, and the parameter corresponding to the medium brightness range, high brightness range and ultra-high brightness range is set to Setting 2.
[0168] The last state (LastState) indicates the first brightness interval to which the first ambient light brightness of the previous frame belongs. Figure 6 The first brightness interval is a high brightness interval, the previous brightness interval of the first brightness interval is a medium brightness interval, and the parameter setting of the target camera is not switched from the previous brightness interval of the first brightness interval to the first brightness interval.
[0169] Different brightness intervals may correspond to different types of parameter settings for the target camera. The sensitivity of the target camera is different for different types of parameter settings, and the detected ambient light may also be greatly different. If the parameter setting of the target camera is not switched from the brightness interval before the first brightness interval to the first brightness interval, the electronic device can calculate the second ambient light brightness in combination with the previous brightness interval.
[0170] Correspondingly, the electronic device determines the calibration coefficient (i.e., the first calibration coefficient) corresponding to the previous brightness interval of the first brightness interval in the correspondence between the preset brightness interval and the calibration coefficient. The calibration coefficient is the calibration coefficient in the calculation formula for calculating the ambient light brightness. Furthermore, based on the first calibration coefficient and the target image data collected by the target camera in the current frame, the second ambient light brightness is calculated. The method for calculating the ambient light brightness based on the calibration coefficient and the image data can refer to the relevant introduction of the subsequent embodiments.
[0171] The corresponding relationship includes calibration coefficients corresponding to different brightness intervals. For example, in the HTML file for setting the brightness interval, the calibration parameters corresponding to the low brightness interval include: the quadratic Coefficient is 0.0, the linear Coefficient is 0.7787, and the constant Term is -105.13. The calibration parameters corresponding to the medium brightness interval include: the quadratic Coefficient is 0.0, the linear Coefficient is 4.2828, and the constant Term is -502.55. The calibration parameters corresponding to the high brightness interval include: the quadratic Coefficient is 0.0, the linear Coefficient is 20, and the constant Term is -552.55.
[0172] For example, for Figure 6 In an embodiment, the first brightness interval is a high brightness interval, and the previous brightness interval of the first brightness interval is a medium brightness interval. The parameter setting of the target camera is not switched from the previous brightness interval of the first brightness interval to the first brightness interval. The first calibration coefficient corresponding to the previous brightness interval of the first brightness interval includes: quadraticCoefficient is 0.0, linearCoefficient is 4.2828, and constantTerm is -502.55.
[0173] As can be seen from the above, in the technical solution of this embodiment, the first brightness interval to which the first ambient light brightness detected by the target camera in the previous frame belongs is determined, and when the parameter setting of the target camera is not switched from the previous brightness interval of the first brightness interval to the first brightness interval, the second ambient light brightness used to estimate the target brightness interval of the current frame is determined in combination with the previous brightness interval of the first brightness interval. The target brightness interval determined based on the second ambient light brightness will not always be a higher brightness interval, which can avoid the problem that the display brightness is adjusted to a higher brightness interval (such as after an ultra-high brightness interval) and cannot be reduced to a lower brightness interval, thereby improving the user experience. In addition, the target brightness interval and the first brightness interval will not cross the brightness interval, which can avoid adjusting the display brightness across the brightness interval, so that the user visually perceives a smaller change in the display brightness, that is, the user can adjust the display brightness without perception, thereby improving the user experience.
[0174] In some embodiments, Figure 5 Based on Figure 7 , step S402 may include the following steps:
[0175] S4023: When switching the parameter setting of the target camera from a brightness interval before the first brightness interval to the first brightness interval, determine the calibration coefficient corresponding to the first brightness interval in the correspondence between the preset brightness intervals and the calibration coefficients to obtain a second calibration coefficient.
[0176] S4024: Calculate the second ambient light brightness based on the second calibration coefficient and the target image data collected by the target camera in the current frame.
[0177] For example, see Figure 8 The brightness ranges of the ambient light brightness are in the following order from low to high: low brightness range, medium brightness range, high brightness range and ultra-high brightness range. The parameter corresponding to the low brightness range is set to Setting1, and the parameter corresponding to the medium brightness range, high brightness range and ultra-high brightness range is set to Setting2.
[0178] The last state (LastState) indicates the first brightness interval to which the first ambient light brightness of the previous frame belongs. Figure 8 The first brightness interval is a medium brightness interval, the previous brightness interval of the first brightness interval is a low brightness interval, and the parameter setting of the target camera is switched from the previous brightness interval of the first brightness interval to the first brightness interval.
[0179] Different brightness intervals may correspond to different types of parameter settings for the target camera. The sensitivity of the target camera is different for different types of parameter settings, and the detected ambient light may also be greatly different. If the parameter setting of the target camera is switched from the previous brightness interval of the first brightness interval to the first brightness interval, and the previous brightness interval of the first brightness interval is significantly different from the ambient light detected in the first brightness interval, the electronic device does not need to calculate the second ambient light brightness in combination with the previous brightness interval of the first brightness interval.
[0180] Accordingly, the electronic device determines the calibration coefficient (i.e., the second calibration coefficient) corresponding to the first brightness interval in the correspondence between the preset brightness interval and the calibration coefficient, and further calculates the second ambient light brightness based on the second calibration coefficient and the target image data collected by the target camera in the current frame.
[0181] For example, for Figure 8 In an embodiment, the first brightness interval is a medium brightness interval, and the first calibration coefficient corresponding to the first brightness interval includes: quadraticCoefficient is 0.0, linearCoefficient is 4.2828, and constantTerm is -502.55.
[0182] As can be seen from the above, in the technical solution of this embodiment, the first brightness interval to which the first ambient light brightness detected by the target camera in the previous frame belongs is determined, and when the parameter setting of the target camera is switched from the previous brightness interval of the first brightness interval to the first brightness interval, the second ambient light brightness used to estimate the target brightness interval of the current frame is directly determined based on the first brightness interval. Subsequently, the target brightness interval is determined based on the second ambient light brightness, and the target brightness interval and the first brightness interval will not cross the brightness interval, which can avoid adjusting the display brightness across the brightness interval, so that the user visually perceives a smaller change in the display brightness, that is, the user can adjust the display brightness without perception, thereby improving the user experience.
[0183] With respect to step S403 , the target brightness interval is the brightness interval to which the ambient light brightness of the current frame belongs.
[0184] In some embodiments, when the parameter setting of the target camera is not switched, Figure 5 Based on Fig. 9 , step S403 may include the following steps:
[0185] S4031: Determine whether the brightness of the second ambient light is in a brightness interval before the first brightness interval.
[0186] S4032: When the brightness of the second ambient light is in a brightness interval before the first brightness interval, determine the brightness interval before the first brightness interval as the brightness interval of the current frame, and obtain a target brightness interval.
[0187] S4033: When the brightness of the second ambient light is not in a brightness interval before the first brightness interval, determine whether the brightness of the second ambient light is in the first brightness interval.
[0188] S4034: When the brightness of the second ambient light is within the first brightness range, determine the first brightness range as the brightness range of the current frame, and obtain a target brightness range.
[0189] After calculating the second ambient light brightness, in order to avoid the problem that the display brightness cannot be reduced to a lower brightness range after being adjusted to a higher brightness range (such as an ultra-high brightness range), it is first determined whether the second ambient light brightness is in the previous brightness range of the first brightness range. When the second ambient light brightness is in the previous brightness range of the first brightness range, the previous brightness range of the first brightness range is determined as the target brightness range of the current frame.
[0190] When the second ambient light brightness is not in the previous brightness interval of the first brightness interval, continue to determine whether the second ambient light brightness is in the first brightness interval. When the second ambient light brightness is in the first brightness interval, determine the first brightness interval as the target brightness interval of the current frame.
[0191] For example, Figure 6 In the embodiment of the present invention, Lux judgment value 1 is the second ambient light brightness calculated using the first calibration coefficient corresponding to the medium brightness interval (i.e., the brightness interval before the first brightness interval). The electronic device uses Lux judgment value 1 to decide whether the target brightness interval of the current frame is the medium brightness interval or the high brightness interval. That is, when Lux judgment value 1 is in the medium brightness interval, the target brightness interval of the current frame is determined to be the medium brightness interval, and when Lux judgment value 1 is in the high brightness interval, the target brightness interval of the current frame is determined to be the high brightness interval.
[0192] As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness used to estimate the target brightness interval of the current frame is determined in combination with the previous brightness interval of the first brightness interval. Based on the second ambient light brightness, the target brightness interval is determined to be the previous brightness interval of the first brightness interval, or the first brightness interval, so that the target brightness interval will not always be a higher brightness interval, which can avoid the problem that the brightness cannot be reduced to a lower brightness interval after being adjusted to a higher brightness interval (such as after an ultra-high brightness interval), thereby improving the user experience. In addition, the target brightness interval and the first brightness interval will not cross the brightness interval, which can avoid adjusting the brightness of the display screen of the electronic device across the brightness interval, so that the user visually perceives a smaller change in the brightness of the display screen, that is, the display screen brightness can be adjusted without the user's perception, thereby improving the user experience.
[0193] In some embodiments, when the second ambient light brightness is not within the first brightness interval, that is, the second ambient light brightness is neither within the previous brightness interval of the first brightness interval nor within the first brightness interval, the electronic device determines the second calibration coefficient corresponding to the first brightness interval in the correspondence between the preset brightness intervals and the calibration coefficients, and calculates the third ambient light brightness based on the second calibration coefficient and the target image data.
[0194] Furthermore, in order to avoid the problem that the display brightness cannot be reduced to a lower brightness range after being adjusted to a higher brightness range (such as an ultra-high brightness range), the electronic device first determines whether the third ambient light brightness is within the first brightness range. When the third ambient light brightness is within the first brightness range, the first brightness range is determined to be the target brightness range of the current frame. When the third ambient light brightness is not within the first brightness range, it is further determined whether the third ambient light brightness is within the next brightness range of the first brightness range. When the third ambient light brightness is within the next brightness range of the first brightness range, the next brightness range of the first brightness range is determined to be the target brightness range of the current frame.
[0195] For example, Figure 6In an embodiment, when the Lux judgment value 1 is neither in the medium brightness interval nor in the high brightness interval, a second calibration coefficient corresponding to the high brightness interval is determined, and a third ambient light brightness is calculated based on the second calibration coefficient and the target image data. Figure 6 The Lux judgment value 2 in is the third ambient light brightness calculated using the second calibration coefficient corresponding to the high brightness interval (first brightness interval). The electronic device uses the Lux judgment value 2 to decide whether the target brightness interval of the current frame is a high brightness interval or an ultra-high brightness interval. That is, when the Lux judgment value 2 is in the high brightness interval, the target brightness interval of the current frame is determined to be the high brightness interval, and when the Lux judgment value 2 is in the ultra-high brightness interval, the target brightness interval of the current frame is determined to be the ultra-high brightness interval.
[0196] As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness used to estimate the target brightness interval of the current frame is determined in combination with the previous brightness interval of the first brightness interval. When the second ambient light brightness is not located in the previous brightness interval of the first brightness interval, nor in the first brightness interval, the third ambient light brightness is determined based on the calibration coefficient corresponding to the first brightness interval, and the target brightness interval is determined to be the first brightness interval or the next brightness interval of the first brightness interval based on the third ambient light brightness. This can avoid the problem that the brightness cannot be reduced to a lower brightness interval after being adjusted to a higher brightness interval (such as after an ultra-high brightness interval), thereby improving the user experience. In addition, the target brightness interval and the first brightness interval will not cross the brightness interval, so that the brightness of the display screen of the electronic device can be adjusted across the brightness interval, so that the user visually perceives a smaller change in the brightness of the display screen, that is, the display screen brightness can be adjusted without the user's perception, thereby improving the user experience.
[0197] In some embodiments, when the third ambient light brightness is not located in the brightness interval after the first brightness interval, that is, the third ambient light brightness is neither located in the first brightness interval nor in the brightness interval after the first brightness interval. The third ambient light brightness interval may be located in the brightness interval before the brightness interval before the first brightness interval, or may be located in the brightness interval after the brightness interval after the first brightness interval.
[0198] Correspondingly, the electronic device determines whether the brightness of the third ambient light is lower than the lower limit value of the previous brightness interval of the first brightness interval. When the brightness of the third ambient light is lower than the lower limit value of the previous brightness interval of the first brightness interval, it indicates that the third ambient light brightness interval is located in the brightness interval before the previous brightness interval of the first brightness interval. In order to avoid the determined target brightness interval and the first brightness interval spanning the brightness interval, and thus avoid adjusting the brightness of the display screen across the brightness interval, the previous brightness interval of the first brightness interval is determined as the target brightness interval of the current frame.
[0199] For example, Figure 6In an embodiment, when the Lux judgment value 1 is neither in the medium brightness interval nor in the high brightness interval, and the Lux judgment value 2 is neither in the high brightness interval nor in the ultra-high brightness interval, it is determined whether the Lux judgment value 2 is lower than the lower limit of the medium brightness interval.
[0200] If the Lux judgment value 2 is lower than the lower limit of the middle brightness interval, it indicates that the Lux judgment value 2 is located in the brightness interval before the middle brightness interval (such as the low brightness interval). If the brightness interval before the middle brightness interval is determined as the target brightness interval, it will cause the determined target brightness interval to cross the brightness interval with the first brightness interval, and then cause the brightness of the display screen to be adjusted across the brightness interval. In order to avoid the above problem, the middle brightness interval is determined as the target brightness interval.
[0201] As can be seen from the above, the technical solution of this embodiment is that the third ambient light brightness is neither in the first brightness interval nor in the brightness interval after the first brightness interval. When the third ambient light brightness is lower than the lower limit of the previous brightness interval of the first brightness interval, it indicates that the third ambient light brightness interval is located in the brightness interval before the previous brightness interval of the first brightness interval, and the previous brightness interval of the first brightness interval is determined as the target brightness interval of the current frame, which can avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, thereby avoiding adjusting the display brightness across the brightness interval, thereby improving the user experience.
[0202] In some embodiments, when the brightness of the third ambient light is not lower than the lower limit value of the previous brightness interval of the first brightness interval, that is, the brightness of the third ambient light is neither in the first brightness interval, nor in the brightness interval after the first brightness interval, nor in the brightness interval before the previous brightness interval of the first brightness interval, then the brightness of the third ambient light may be in the brightness interval after the brightness interval after the first brightness interval.
[0203] Correspondingly, the electronic device determines whether the brightness of the third ambient light is higher than the upper limit value of the brightness interval after the first brightness interval. When the brightness of the third ambient light is higher than the upper limit value of the brightness interval after the first brightness interval, it indicates that the brightness interval of the third ambient light is located in the brightness interval after the brightness interval after the first brightness interval. In order to avoid the determined target brightness interval and the first brightness interval spanning the brightness interval, and thus avoid adjusting the brightness of the display screen across the brightness interval, the brightness interval after the first brightness interval is determined to be the brightness interval of the current frame, and the target brightness interval is obtained.
[0204] For example, Figure 6In the embodiment, when Lux judgment value 1 is neither in the medium brightness interval nor in the high brightness interval, and Lux judgment value 2 is neither in the high brightness interval nor in the ultra-high brightness interval, and Lux judgment value 2 is not lower than the lower limit value of the medium brightness interval, it is determined whether Lux judgment value 2 is higher than the upper limit value of the ultra-high brightness interval.
[0205] If the Lux judgment value 2 is higher than the upper limit value of the ultra-high brightness interval, it indicates that the Lux judgment value 2 is located in the brightness interval after the ultra-high brightness interval. If the brightness interval after the ultra-high brightness interval is determined to be the target brightness interval, it will cause the determined target brightness interval to cross the brightness interval with the first brightness interval, and then cause the brightness of the display screen to be adjusted across the brightness interval. In order to avoid the above problem, the ultra-high brightness interval is determined to be the target brightness interval.
[0206] As can be seen from the above, the technical solution of this embodiment is that the third ambient light brightness is neither in the first brightness interval nor in the brightness interval after the first brightness interval. When the third ambient light brightness is higher than the upper limit value of the brightness interval after the first brightness interval, it indicates that the third ambient light brightness interval is located in the brightness interval after the brightness interval after the first brightness interval, and the brightness interval after the first brightness interval is determined as the target brightness interval of the current frame, which can avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, thereby avoiding adjusting the display brightness across the brightness interval, and improving the user experience.
[0207] In some embodiments, before step S407, the method may further include the following steps: determining whether there is a brightness interval before the first brightness interval. If there is a brightness interval before the first brightness interval, determining whether to switch the parameter setting of the target camera from the brightness interval before the first brightness interval to the first brightness interval.
[0208] After determining the first brightness interval to which the first ambient light brightness of the previous frame belongs, the electronic device determines whether there is a brightness interval before the first brightness interval, and if there is a brightness interval before the first brightness interval, continues to determine whether to switch the parameter setting of the target camera from the brightness interval before the first brightness interval to the first brightness interval. Subsequently, based on whether the parameter setting of the target camera is switched from the brightness interval before the first brightness interval to the first brightness interval, it is determined whether to determine the target brightness interval of the current frame in combination with the brightness interval before the first brightness interval.
[0209] In some embodiments, after determining whether there is a previous brightness interval of the first brightness interval, the method may further include the following steps: when there is no previous brightness interval of the first brightness interval, in the correspondence between the preset brightness interval and the calibration coefficient, determine the calibration coefficient corresponding to the first brightness interval, obtain the second calibration coefficient, and execute the step of calculating the third ambient light brightness based on the second calibration coefficient and the target image data.
[0210] After determining whether there is a previous brightness interval of the first brightness interval, if there is no previous brightness interval of the first brightness interval, it is impossible to determine the target brightness interval of the current frame in combination with the previous brightness interval of the first brightness interval. The electronic device directly determines the second calibration coefficient corresponding to the first brightness interval in the correspondence between the preset brightness interval and the calibration coefficient, and calculates the third ambient light brightness based on the second calibration coefficient and the target image data. Subsequently, the target brightness interval is directly determined based on the third ambient light brightness. For the specific method of determining the target brightness interval based on the third ambient light brightness, refer to the relevant introduction of the aforementioned embodiment.
[0211] In some embodiments, when the parameter settings of the target camera are switched, see Fig.10 , step S403 may include the following steps:
[0212] S4035: Determine whether the brightness of the second ambient light is in a brightness interval before the first brightness interval.
[0213] S4036: When the brightness of the second ambient light is in a brightness interval before the first brightness interval, determine the brightness interval before the first brightness interval as the brightness interval of the current frame, and obtain the target brightness interval.
[0214] S4037: When the brightness of the second ambient light is not in a brightness interval before the first brightness interval, determine whether the brightness of the second ambient light is in the first brightness interval.
[0215] S4038: When the brightness of the second ambient light is within the first brightness range, determine the first brightness range as the brightness range of the current frame, and obtain a target brightness range.
[0216] S4039: When the brightness of the second ambient light is not within the first brightness interval, determine whether the brightness of the second ambient light is within a brightness interval subsequent to the first brightness interval.
[0217] S4040: When the brightness of the second ambient light is in a brightness interval subsequent to the first brightness interval, determine the brightness interval subsequent to the first brightness interval as the brightness interval of the current frame, and obtain a target brightness interval.
[0218] After calculating the second ambient light brightness, in order to avoid the problem that the display brightness cannot be reduced to a lower brightness range after being adjusted to a higher brightness range (such as an ultra-high brightness range), it is first determined whether the second ambient light brightness is in the previous brightness range of the first brightness range. When the second ambient light brightness is in the previous brightness range of the first brightness range, the previous brightness range of the first brightness range is determined as the target brightness range of the current frame.
[0219] When the second ambient light brightness is not in the previous brightness interval of the first brightness interval, the second ambient light brightness may be in the first brightness interval or a brightness interval after the first brightness interval, and then continue to determine whether the second ambient light brightness is in the first brightness interval. When the second ambient light brightness is in the first brightness interval, determine the first brightness interval as the target brightness interval of the current frame.
[0220] When the second ambient light brightness is not in the first brightness interval, the second ambient light brightness may be in a brightness interval after the first brightness interval, and it is further determined whether the second ambient light brightness is in a brightness interval after the first brightness interval. When the second ambient light brightness is in a brightness interval after the first brightness interval, the brightness interval after the first brightness interval is determined as the target brightness interval of the current frame.
[0221] For example, Figure 8 In an embodiment, the Lux judgment value is the second ambient light brightness calculated using the second calibration coefficient corresponding to the medium brightness interval (i.e., the first brightness interval). The electronic device uses the Lux judgment value to decide whether the target brightness interval of the current frame is a low brightness interval, a medium brightness interval, or a high brightness interval. That is, when the Lux judgment value is in the low brightness interval, the target brightness interval of the current frame is determined to be the low brightness interval, when the Lux judgment value is in the medium brightness interval, the target brightness interval of the current frame is determined to be the medium brightness interval, and when the Lux judgment value is in the high brightness interval, the target brightness interval of the current frame is determined to be the high brightness interval.
[0222] As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness used to estimate the target brightness interval of the current frame is directly determined based on the first brightness interval. Based on the second ambient light brightness, it is determined in turn whether the target brightness interval is the brightness interval before the first brightness interval, the first brightness interval, or the brightness interval after the first brightness interval, so that the target brightness interval and the first brightness interval do not cross the brightness interval, and the adjustment of the display screen brightness across the brightness interval can be avoided, so that the user visually perceives a smaller change in the display screen brightness, that is, the user can adjust the display screen brightness without perception, thereby improving the user experience.
[0223] In some embodiments, when the parameter setting of the target camera is switched, the second ambient light brightness is calculated based on the second calibration coefficient corresponding to the first brightness range and the target image data.
[0224] When the second ambient light brightness is neither in the previous brightness interval of the first brightness interval, nor in the first brightness interval, nor in the next brightness interval of the first brightness interval, the second ambient light brightness interval may be in the brightness interval before the previous brightness interval of the first brightness interval, or may be in the brightness interval after the next brightness interval of the first brightness interval.
[0225] The electronic device determines whether the brightness of the second ambient light is lower than the lower limit value of the previous brightness interval of the first brightness interval. When the brightness of the second ambient light is lower than the lower limit value of the previous brightness interval of the first brightness interval, it indicates that the second ambient light brightness interval is located in the brightness interval before the previous brightness interval of the first brightness interval. In order to avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, and thus avoid adjusting the brightness of the display screen across the brightness interval, the previous brightness interval of the first brightness interval is determined as the target brightness interval of the current frame.
[0226] When the brightness of the second ambient light is not lower than the lower limit value of the previous brightness interval of the first brightness interval, that is, the brightness of the second ambient light is not located in the previous brightness interval of the first brightness interval, nor in the first brightness interval, nor in the next brightness interval of the first brightness interval, nor in the brightness interval before the previous brightness interval of the first brightness interval, then the brightness of the second ambient light may be located in the brightness interval after the next brightness interval of the first brightness interval.
[0227] The electronic device determines whether the brightness of the second ambient light is higher than the upper limit value of the brightness interval after the first brightness interval. When the brightness of the second ambient light is higher than the upper limit value of the brightness interval after the first brightness interval, it indicates that the brightness interval of the second ambient light is located in the brightness interval after the brightness interval after the first brightness interval. In order to avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, and thus avoid adjusting the brightness of the display screen across the brightness interval, the brightness interval after the first brightness interval is determined to be the brightness interval of the current frame, and the target brightness interval is obtained.
[0228] As can be seen from the above, the technical solution of this embodiment, when the parameter setting of the target camera is switched, when the second ambient light brightness is neither in the previous brightness interval of the first brightness interval, nor in the first brightness interval, nor in the next brightness interval of the first brightness interval, when it is determined that the second ambient light brightness is in the brightness interval before the previous brightness interval of the first brightness interval, the previous brightness interval of the first brightness interval is determined as the target brightness interval. When it is determined that the second ambient light brightness is in the brightness interval after the next brightness interval of the first brightness interval, the next brightness interval of the first brightness interval is determined as the target brightness interval, which can avoid the determined target brightness interval and the first brightness interval from crossing the brightness interval, thereby avoiding adjusting the display brightness across the brightness interval, thereby improving the user experience.
[0229] For step S404 and step S405, after determining the target brightness range, the electronic device determines the target calibration coefficient corresponding to the target brightness range in the corresponding relationship between the brightness range and the calibration coefficient, and then determines the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data.
[0230] In some embodiments, step S405 may include the following steps: based on the target calibration coefficient, the target image data and a preset formula, calculating the target ambient light brightness of the current frame. The preset formula is:
[0231] Lux=A×R+B (1)
[0232] Lux represents the target ambient light brightness; A represents a target calibration coefficient; B represents another target calibration coefficient; and R represents the target image data.
[0233] For example, if the target brightness interval is a low brightness interval, then one of the target calibration coefficients A in the above formula (1) is linearCoefficient (i.e., 0.7787), and the other target calibration coefficient B is constantTerm (i.e., -105.13). If the target brightness interval is a medium brightness interval, then A in the above formula (1) is 4.2828, and B is -502.55. If the target brightness interval is a medium brightness interval, then A in the above formula (1) is 20, and B is -552.55.
[0234] With respect to step S405, after determining the target ambient light brightness, the electronic device adjusts the brightness of the display screen of the electronic device based on the target ambient light brightness of the current frame. For example, the electronic device can use the target ambient light brightness as the adjusted display screen brightness. Alternatively, the default brightness of the display screen of the electronic device can be obtained, and the default brightness can be adjusted based on the target ambient light brightness to obtain the adjusted display screen brightness.
[0235] In some embodiments, for the above Figure 2 For the electronic device of the software system shown, the camera service module can control the opening and closing of the front camera by issuing instructions to the camera control module, and the sensor service module can control the opening and closing of the ambient light detection device by issuing instructions to the sensor control module. When the front camera is used instead of the ambient light detection device, the opening and closing of the front camera needs to be controlled by the instructions issued by the sensor service module. Since the sensor control module cannot pass the instructions issued by the sensor service module to the front camera, and the camera control module can pass the instructions issued by the camera service module to the front camera, in order to realize the front camera replacing the ambient light detection device, it is necessary to establish a control path between the sensor control module and the camera service module, so as to realize the control of the front camera with the help of the camera service module. The sensor control module of the HAL layer of the embodiment of the present application can be used as an independent process, and the camera service module of the FWK layer can also be used as an independent process. Therefore, when establishing the control path between the sensor control module of the HAL layer and the camera service module of the FWK layer, it can be established based on the Hardware Interface Definition Language (HIDL) service. Among them, HIDL is used to define the interface between the HAL layer and the FWK layer of the Android system based on Binder communication.
[0236] After opening the control path between the sensor control module and the camera service module, it is also necessary to establish a data path between the sensor control module and the camera control module, so that after turning on the ambient light detection function of the front camera, the camera control module can transmit the ambient light brightness detected by the front camera to the sensor control module, and then the sensor control module sends it to the sensor service module, thereby realizing the adjustment of the display brightness.
[0237] For the process of establishing the data path between the sensor control module and the camera control module, see Fig.11 The present application embodiment provides a method for adjusting the brightness of a display screen, which can be performed by Figure 2 The electronic device 100 of the software system shown in the figure executes the method flow provided by the embodiment of the present application, including:
[0238] S1101: Based on the electronic device being turned on, the camera control module initializes the AIDL service.
[0239] In an embodiment of the present application, the camera control module (i.e., Camera HAL) can be an independent process, which can be defined as a camera control process, and the submodules included in the camera control module (such as CHI-CDK, CAMX, CamxLightCustom, etc.) can be different threads in the camera control process. AIDL service initialization can be the process of pulling up the AIDL service. By initializing the AIDL service, communication between the client and the server based on the AIDL service can be achieved. AIDL service initialization can be performed in the camera control module, specifically, it can be performed in the CHI-CDK of the camera control module. The AIDL service can be initialized during the startup of the electronic device, or it can be initialized after the startup when the client and the server based on the AIDL service need to communicate. The embodiment of the present application does not limit the timing of AIDL service initialization. The process of AIDL service initialization can correspond to Fig.12 Step ① in Fig.12 When the electronic device is turned on, the AIDL service in the CHI-CDK of the Camera HAL is initialized, which can be to pull up the AIDL service.
[0240] In some embodiments, the AIDL service initialization process can be implemented using the following code:
[0241] CamLightAidlImpl::GetInstance()->Init(…).
[0242] S1102: The sensor service module sends a brightness monitoring instruction to the sensor control module.
[0243] In the embodiment of the present application, the sensor service module (i.e., SensorService) can be used as an independent process, which can be defined as the sensor service process, and the submodules (such as SensorManager, SensorService, etc.) included in the sensor service module can be threads in the sensor service process. The sensor control module (i.e., Sensor HAL) can also be used as an independent process, which can be defined as the sensor control process, and the submodules (such as CameraLightManager, etc.) included in the sensor control module can be threads in the sensor control process.
[0244] After the electronic device is turned on, the ambient light detection application in the application layer sends a screen-lighting message to the sensor service module. The screen-lighting message may include the package name of the ambient light detection application. The screen-lighting message is used to instruct the sensor service module to adjust the brightness of the electronic device display screen. After receiving the screen-lighting message, the sensor service module sends a brightness monitoring instruction to the sensor control module. The brightness monitoring instruction is used to instruct the sensor control module to obtain the ambient light brightness. The brightness monitoring instruction can be in the form of a callback function, so that after the sensor control module obtains the ambient light brightness, it can return the obtained ambient light brightness to the sensor service module.
[0245] In some embodiments, the sensor service module sending the brightness monitoring instruction to the sensor control module may be: the sensor service process sending the brightness monitoring instruction to the sensor control process. Fig.12 Specifically, the sensor service module sends the brightness monitoring instruction to the sensor control module. The SensorManager in the FWK layer generates a brightness monitoring instruction based on the screen-on message sent by the ambient light detection application in the application layer, and sends the brightness monitoring instruction to the Sensor HAL in the HAL layer through the SensorService.
[0246] S1103: After receiving the brightness monitoring instruction, the sensor control module calls the first interface based on the AIDL service and registers the data callback function in the camera control module.
[0247] After receiving the brightness monitoring instruction, the sensor control module calls the first interface based on the AIDL service and registers the data callback function in the camera control module. It can be based on the brightness monitoring instruction, the sensor control module calls the first interface and registers the data callback function in the camera control module. It can also be in response to the brightness monitoring instruction, the sensor control module calls the first interface and registers the data callback function in the camera control module.
[0248] In the computer field, AIDL service is used to achieve communication between different processes. For two processes based on AIDL service communication, one process is used to generate data and can be used as an AIDL server; the other process is used to issue control instructions and receive data, and can be used as an AIDL client. In an embodiment of the present application, when the front camera is used instead of the ambient light detection device, the camera control module (Camera HAL) is used to provide ambient light brightness and can be used as an independent process. Therefore, it can be regarded as an AIDL server (referred to as the server in subsequent embodiments); the sensor control module (SensorHAL) is used to receive ambient light brightness, and therefore, it can be regarded as an AIDL client (referred to as the client in subsequent embodiments).
[0249] Among them, the first interface can be an Active interface. The Active interface is used to turn on the ambient light detection function of the front camera. After the sensor control module calls the Active interface to turn on the ambient light detection function of the front camera, the sensor control module can call the Active interface to register a data callback function in the camera control module. Through the data callback function, the camera control module can send the ambient light brightness detected by the front camera to the sensor control module, thereby opening up the data path between the camera control module and the sensor control module, making it possible for the front camera to replace the ambient light device.
[0250] In the embodiment of the present application, the sensor control module calls the Active interface. Before registering the data callback function in the camera control module, the Active interface needs to be declared first. Since the Active interface belongs to the AIDL interface, its declaration usually contains two parameters. One can be the client's process ID (Process Identifier, PID), that is, the process ID of the sensor control module (Sensor HAL) as the client; the other can be the client's callback object (CallBack), that is, the object in the sensor control module used to receive the ambient light brightness. In some embodiments, the callback object corresponds to Fig.12 ReportLuxStatus (report lux status) in.
[0251] Among them, the following code can be used when declaring the Active interface:
[0252]
[0253] Furthermore, based on the declaration content of the Active interface, the sensor control module and the camera control module can respectively register callback interfaces on the local side. When the callback interface registration in the sensor control module and the camera control module is completed, the registration of the data callback function in the camera control module is completed.
[0254] In some embodiments, the sensor control module may register a callback interface in CamLightManager, and the camera control module may register a callback interface in CamxLightCustom.
[0255] Among them, the following code can be used when registering the callback interface in the sensor control module:
[0256] CamLightManager::RegisterLuxCb(){
[0257] mCamLightService->RegisterLuxCallback(callingPid,mLuxCallback);
[0258] }
[0259] The following code can be used when registering the callback interface in the camera control module:
[0260] void CamxLightCustom::RegisterLightLuxStatusCb(Callback callback)
[0261] In some embodiments, the sensor control module calls the first interface based on the AIDL service, and the step of registering the data callback function in the camera control module may correspond to Fig.12 Steps ② and ③ specifically include: after the Sensor HAL receives the brightness monitoring instruction, it calls the Active interface in CamLightManager, registers the callback interface in CamLightManager based on the declaration content of the Active interface, and registers the callback interface in CamxLightCustom. When the callback interface registration in CamLightManager and CamxLightCustom is completed, the registration of the data callback function is completed.
[0262] In some embodiments, the data callback function can not only return the ambient light brightness detected by the front camera to the sensor control module when the ambient light detection function of the front camera is enabled; it can also send a notification message to the sensor control module to enable the ambient light detection function of the front camera when the ambient light detection function of the front camera fails to be enabled or is turned off, causing the camera that has failed to enable the ambient light detection function or is turned off to be turned off.
[0263] In some embodiments, due to the limitation of the photosensitivity of the front camera itself, there is a certain error between the ambient light brightness detected by the front camera and the ambient light brightness in the actual environment. In order to improve the accuracy of display brightness adjustment, the camera control module in the embodiment of the present application can also register a data calibration interface function in the callback interface when registering the callback interface. The data calibration function is used to provide a calibration coefficient between the ambient light brightness detected by the front camera and the ambient light brightness in the actual environment. When the ambient light brightness of the front camera is returned based on the callback interface, the ambient light brightness detected by the front camera can be calibrated. The data calibration function can be LuxValueConvert().
[0264] In some embodiments, the electronic device may experience a sudden process crash during operation, and the server and client involved in AIDL may also crash. In the embodiment of the present application, in order to monitor the crash of the camera control module (server) and the sensor control module (client) in a timely manner, the sensor control module and the camera control module can also register death monitoring objects on the local side respectively.
[0265] In one implementation, the camera control module may register a first death monitoring object on the local side when registering the callback interface. By registering the first death monitoring object, the camera control module may be monitored for crashes in the screen-on and screen-off scenarios. The sensor control module may register a second death monitoring object on the local side when registering the callback interface. By registering the second death monitoring object, the sensor control module may be monitored for crashes in the screen-on and screen-off scenarios.
[0266] In some embodiments, it may correspond to Fig.16 Step ① in the process, that is, the first registration and binding of the death notification, specifically includes: when the Sensor HAL registers the callback interface in CamLightManager, it can register the second death monitoring object in CamLightManager, so that when the crash event of the Sensor HAL is monitored, a death notification message is generated to notify the Camera HAL; when the Camera HAL registers the callback interface in CamxLightCustom, it can register the first death monitoring object in CamxLightCustom, so that when the crash event of the Camera HAL is monitored, a death notification message is generated to notify the Sensor HAL.
[0267] In some embodiments, for electronic devices, the front camera on some electronic devices may support the ambient light detection function, and the front camera on some electronic devices may not support the ambient light detection function. In order to avoid executing the enabling operation on the front camera that does not support the ambient light detection function and reduce the resource consumption of the electronic device, the sensor control module may obtain the value on the preset identification position before calling the first interface to turn on the ambient light detection function of the front camera, specifically before executing step S1103, such as when the electronic device is turned on, or when a brightness monitoring instruction is received, and then based on the value on the preset identification position, determine whether the front camera of the electronic device supports the ambient light detection function. If the front camera supports the ambient light detection function, the first interface is called to turn on the ambient light detection function of the front camera. If the front camera does not support the ambient light detection function, the first interface is no longer called. Among them, the preset identification position can be is_ambient_light (ambient light), which is used to indicate whether the front camera supports the ambient light detection function, and the value on the preset identification position can be true (correct) or false (wrong). When the value on the preset flag is true, it can be determined that the front camera supports the ambient light detection function; when the value on the preset flag is false, it can be determined that the front camera does not support the ambient light detection function.
[0268] It should be noted that when the electronic device is not turned off, the data callback function registered in this step can be directly used when the front camera is subsequently called to detect the ambient light brightness without re-registration; when the electronic device is turned off, the data callback function registered in this step will be destroyed, and when the electronic device is turned on again, the above steps S1101 to S1103 need to be executed to register the data callback function.
[0269] S1104: The sensor control module calls the second interface based on the HIDL service and sends a first instruction to the camera service module.
[0270] Generally, cameras include two types: front cameras and rear cameras, and the number of front cameras and rear cameras is at least one respectively. Moreover, the front camera and the rear camera have multiple functions respectively, including at least one of a photo taking function, a face unlocking function, an ambient light detection function, and the like. In order to distinguish different types of cameras and different functions of cameras of the same type, the embodiment of the present application abstracts multiple logical cameras according to the type and function of the camera, and each logical camera corresponds to an identifier. For example, according to the photo taking function of the front camera, a logical camera A can be abstracted, and according to the ambient light detection function of the front camera, a logical camera B can be abstracted. The logical camera A and the logical camera B can correspond to the same front camera or to different front cameras. For the photo taking function of the logical camera A, i.e., the front camera, the identifier set is Camera ID=1, and for the ambient light detection function of the logical camera B, i.e., the front camera, the identifier set is Camera ID=4.
[0271] In the embodiment of the present application, the sensor control module can call the first interface to generate the first instruction, and then the second interface sends the first instruction to the camera service module. The second interface belongs to the interface of the HIDL service, which can be Fig.12 The camera service module can be an independent process, and the independent process can be defined as a camera service process. The first instruction can be an Open Camera instruction. The first instruction can include a first identifier, and the first identifier corresponds to the ambient light detection function of the front camera, which can be Camera ID=4. The first instruction can also include a first package name, and the first package name is the package name of the ambient light detection application.
[0272] In some embodiments, the sensor service module calls the second interface to send the first instruction to the camera service module, which may correspond to Fig.12 Step ④ specifically includes: calling the Active interface of CamLightManager in the Sensor HAL, generating a first instruction, and sending the first instruction to the ICameraService in the FWK layer through the libcamera2ndk_vendor interface based on the HIDL service.
[0273] S1105: After receiving the first instruction, the camera service module calls the first function in the camera control module, and executes the first function according to the first identifier to control the camera driver to power on the front camera, initialize the camera register and create a reading thread for the ambient light brightness.
[0274] S1106: The camera driver powers on the front camera, initializes the camera registers, and creates a thread for reading the ambient light brightness.
[0275] In some embodiments, the operations of powering on the front camera, initializing the camera register, etc. in this step may be a specific process of turning on the front camera, or may be a process of powering on and initializing the front camera.
[0276] Among them, the first function is used to turn on any function of any camera in the electronic device, and the first function can be an Open Camera function. After receiving the first instruction, the camera service module can call the first function in the camera control module and execute the first function according to the first identifier. According to the first identifier, it can be determined that the ambient light detection function of the front camera needs to be turned on. At this time, the front camera will replace the ambient light detection device. When the front camera replaces the ambient light detection device, the front camera needs to detect the ambient light brightness without collecting images. In order to reduce the power consumption of the front camera, the camera service module executes the necessary processes in the first function to turn on the ambient light detection function of the front camera according to the first identifier, such as applying for the chip support library (CSL) resource cache (buffer), powering on the front camera, initializing the camera register and creating a reading thread for the ambient light brightness, etc., and jumps out of the processes that are not related to turning on the ambient light detection function of the front camera, such as the process of configuring the image output resources. By executing the first function, a corresponding control instruction can be generated, and the control instruction is sent to the camera driver, so as to control the camera driver to apply for CSL resource cache for the front camera, power on the front camera, initialize the camera register, create a reading thread, etc. Among them, the created reading thread is used to read and calculate the ambient light brightness detected by the front camera. In some embodiments, the reading thread can be an asynchronous reading thread. In some embodiments, the reading thread can periodically read the ambient light brightness detected by the front camera. Based on the initialization of the camera register, the period of the front camera detecting the ambient light brightness, the frequency of the front camera detecting the ambient light brightness, etc. can be written into the front register, so as to control the operation of the front camera.
[0277] In some embodiments, this step may correspond to Fig.12⑤ in the method specifically includes: when receiving the first instruction, calling the Open Camera function in CAMX of Camera HAL through CameraService and executing the Open Camera function, sending a control instruction to the camera driver through the interface of CamxLightCustom, so that the camera driver applies for CSL resource cache for the ambient light detection function of the front camera, powers on the front camera, initializes the camera register, creates an asynchronous reading thread, etc. Then, the camera sensor (Camera Sensor) of the hardware layer (Driver) starts working.
[0278] When the method of the embodiment of the present application is adopted, when the front camera is used instead of the ambient light detection device, image output resources will not be configured for the front camera, and the front camera will not capture images, thereby reducing the resource consumption of the front camera and improving the performance of the electronic device.
[0279] S1107: The camera control module obtains the target ambient light brightness output by the front camera, and sends the target ambient light brightness to the sensor control module through a data callback function.
[0280] The target ambient light brightness is the target ambient light brightness of the current frame determined based on the ambient light brightness detected by the front camera (which may be referred to as the fourth ambient light brightness) according to the method provided in the embodiment of the present application. The fourth ambient light brightness is the Raw data collected by the front camera in the aforementioned embodiment.
[0281] In a possible implementation, the camera driver can periodically read the fourth ambient light brightness through a reading thread, and send the read fourth ambient light brightness to the camera control module, so that the camera control module can obtain the fourth ambient light brightness output by the front camera, and the reading cycle can be 200ms. The camera driver can also periodically read the fourth ambient light brightness detected by the front camera through a reading thread, and store the read fourth ambient light brightness in a cache. The camera control module can periodically read the fourth ambient light brightness stored in the cache of the camera driver, thereby obtaining the fourth ambient light brightness output by the front camera. In some embodiments, the reading cycle of the camera driver and the reading cycle of the camera control module can be the same or different.
[0282] In some embodiments, the camera control module may send the target ambient light brightness to the sensor control module through a pre-registered data callback function. Specifically, the camera control module may fill the target ambient light brightness into the pre-registered data callback function, and send the target ambient light brightness to the sensor control module through the data callback function.
[0283] Combined with the different contents of the target ambient light brightness, the camera control module sends the target ambient light brightness to the sensor control module through a pre-registered data callback function, which includes the following methods:
[0284] In the first method, the camera control module fills the target ambient light brightness output by the front camera into the data callback function, and sends the target ambient light brightness to the sensor control module through the data callback function.
[0285] In the second method, the camera control module fills the fourth ambient light brightness detected by the front camera and the target ambient light brightness obtained after calibration into the data callback function, and sends the fourth ambient light brightness detected by the front camera and the target ambient light brightness to the sensor control module through the data callback function.
[0286] In the third method, the camera control module fills the fourth ambient light brightness detected by the front camera, the target ambient light brightness obtained after calibration, and the status parameters of the front camera into the data callback function, and through the data callback function, the fourth ambient light brightness detected by the front camera, the second ambient light brightness and the status parameters are sent to the sensor control module.
[0287] For the third method, the form of the filled data callback function can be:
[0288] pCamxLightCustom->mStatusCb(static_cast <float>(luxValue),luxValueFinal,status);
[0289] Among them, luxValue is the fourth ambient light brightness detected by the front camera, luxValueFinal is the target ambient light brightness, that is, the ambient light brightness output by the front camera, and status is the status parameter of the front camera.
[0290] In some embodiments, three specific implementation methods are listed here, and only one of the methods can be selected to return the target ambient light brightness, or multiple methods can be selected to return the target ambient light brightness. The same method or different methods can be used each time the target ambient light brightness is returned. For example, the first implementation method can be used to return the target ambient light brightness for the first time, the second implementation method can be used to return the target ambient light brightness for the second time, the third implementation method can be used to return the target ambient light brightness for the third time, and so on; the target ambient light brightness can also be returned once in multiple methods each time, and then the target ambient light brightness returned in multiple methods can be merged.
[0291] S1108: The sensor control module sends the target ambient light brightness to the sensor service module.
[0292] In some embodiments, the ReportLuxStatus object in the sensor control module may receive the target ambient light brightness sent by the camera control module, and then send the target ambient light brightness to the sensor service module.
[0293] In one implementation, when the sensor service module sends a brightness monitoring instruction to the sensor control module, a callback function is registered in the sensor control module, and the sensor control module can send the target ambient light brightness to the sensor service module through the callback function. In some embodiments, the sensor control module can fill the target ambient light brightness into the callback function, and send the target ambient light brightness to the sensor control module through the callback function.
[0294] In another implementation, the sensor service module may periodically read the target ambient light brightness of the sensor control module.
[0295] For the processing logic of the sensor control module for the target ambient light brightness, please refer to the following code:
[0296] ::ndk::ScopedAStatus ReportLuxStatus(const LuxStatus&out_data){
[0297] / / Client data processing logic
[0298] }
[0299] In some embodiments, steps S1107 to S1108 may correspond to Fig.12 ⑤ and ⑥ specifically include: CamxLightCustom of Camera HAL obtains the target ambient light brightness output by the front camera, and returns the target ambient light brightness to the ReportLuxStatus object in CamLightManager of Sensor HAL through the pre-registered data callback function. The ReportLuxStatus object reports the target ambient light brightness to SensorManager through SensorService.
[0300] S1109: The sensor service module adjusts the brightness of the display screen of the electronic device based on the target ambient light brightness.
[0301] In one implementation, adjusting the brightness of the display screen may be setting the brightness of the display screen. Specifically, the sensor service module may determine the brightness of the display screen based on the target ambient light brightness, and then set the brightness of the display screen to the determined brightness; the sensor service module may also determine the brightness of the display screen based on the historical ambient light brightness and the target ambient light brightness, and then set the brightness of the display screen to the determined brightness.
[0302] In another implementation, adjusting the brightness of the display screen may be to adjust the initial brightness based on the initial brightness of the display screen. The initial brightness may be a brightness value pre-set by a technician. Specifically, the sensor service module may determine the brightness of the display screen based on the target ambient light brightness, and then adjust the brightness of the display screen from the initial brightness to the determined brightness; the sensor service module may also determine the brightness of the display screen based on the historical ambient light brightness and the target ambient light brightness, and then adjust the brightness of the display screen from the initial brightness to the determined brightness. In some embodiments, when adjusting the brightness of the display screen from the initial brightness to the determined brightness, it may be adjusted gradually to avoid excessive brightness changes affecting the user experience.
[0303] In some embodiments, when adjusting the brightness of the display screen, the sensor service may generate a brightness adjustment instruction, and then send the brightness adjustment instruction to the sensor control module. The sensor control module sends the brightness adjustment instruction to the display screen driver, so that the display screen driver executes the brightness adjustment instruction to adjust the brightness of the display screen.
[0304] The above description uses the example of the electronic device turning on the screen for the first time when the device is turned on. When the electronic device turns on the screen for a non-first time, the electronic device may not execute the initialization process of the AIDL service in step S1101 and the registration process of the data callback function in step S1103, but execute other steps.
[0305] See also Fig.13 The embodiment of the present application provides a method for turning off the screen and turning off the ambient light detection function of the front camera. When the screen of the electronic device is turned off, the method can turn off the ambient light detection function of the front camera to reduce the power consumption of the electronic device. Figure 2 The electronic device 100 of the software system shown in the figure performs the embodiment of the present application as an example, and the method can be used with Fig.11 The display brightness adjustment process shown is independent and has no timing relationship. Fig.11 Executed at any time after step S1105 in step S1106. Fig.13 , the method flow provided in the embodiment of the present application includes:
[0306] S1301: After the screen of the electronic device is turned off, the sensor control module calls the third interface based on the AIDL service, and then calls the second interface to send a second instruction to the camera service module.
[0307] In some embodiments, based on the screen turning off of the electronic device, the sensor service module can receive a screen turning off message of the electronic device. After receiving the screen turning off message, the sensor service module can send a stop brightness monitoring instruction to the sensor control module. After receiving the stop brightness monitoring instruction, the sensor control module can call the third interface, generate a second instruction, and then call the second interface to send the second instruction to the camera service module. Among them, the third interface can be a DeActive interface, which is used to turn off the ambient light detection function of the front camera. The second instruction can be a CloseCamera (turn off the camera) instruction, including a first identifier, a first package name, etc.
[0308] In some embodiments, this step may correspond to Fig.14 ①②③④ in it specifically include: SensorManager receives the screen-off message of the electronic device, generates a stop brightness monitoring instruction, and calls SensorService to send the stop brightness monitoring instruction to Sensor HAL, Sensor HAL calls the DeActive interface of CameraLightManager, generates a Close Camera instruction, and the Close Camera instruction includes Camera ID=4 and the package name of the ambient light detection application, and then calls libcamera2ndk_vendor to send the Close Camera instruction to the CameraService of the FWK layer.
[0309] S1302: After receiving the second instruction, the camera service module calls the second function in the camera control module, and executes the second function according to the first identifier to control the camera driver to close the reading thread and power off the front camera.
[0310] S1303: The camera driver closes the reading thread and powers off the front camera.
[0311] After receiving the second instruction, the camera service module calls the second function in the camera control module and executes the second function according to the first identifier. By executing the second function, a corresponding shutdown instruction can be generated and the generated shutdown instruction is sent to the camera driver. Based on the shutdown instruction, the camera driver shuts down the reading thread, stops reading the ambient light brightness, and powers off the front camera, and then releases the CSL resource cache applied for the front camera. Furthermore, after the camera driver shuts down the reading thread, the camera control process will stop sending the target ambient light brightness to the sensor control module through the data callback function.
[0312] The logic code for turning off the ambient light detection function of the front camera can be:
[0313] CloseCamLightSensor(const struct camera3_device*pCamera3Device,bool&isCamLightId)(Close Camera light id encapsulation function)
[0314] In some embodiments, this step may correspond to Fig.14 ⑤ specifically includes: based on the Close Camera instruction, CameraService calls the Close Camera function in CAMX of Camera HAL, and by executing the CloseCamera function, controls the camera driver to close the asynchronous reading thread, stops reading the ambient light brightness, powers off the front camera, and releases the CSL resource cache applied for the front camera. In turn, the camera sensor (Camera Sensor) of the hardware layer (Driver) stops working.
[0315] Usually, electronic devices are equipped with a front camera and a rear camera. The front camera supports an image output mode and an ambient light detection mode. The image output mode corresponds to the photo function, face unlocking function, etc. of the front camera. In the image output mode, the front camera needs to collect images to meet the user's usage needs. Unlike the image output mode, in the ambient light detection mode, the display brightness is adjusted based on the ambient light brightness output by the front camera to improve the user's usage needs, and the user demand is lower than that in the image output mode. In actual application, the front camera and the rear camera cannot be enabled at the same time, and the image output mode and the ambient light detection mode of the front camera cannot be enabled at the same time. In order to solve the problem of enabling priority of the camera, the embodiment of the present application sets a corresponding identifier for each camera in the electronic device, each identifier corresponds to a logical function of the camera, and sets the conflict judgment logic of the camera identifier, and configures different priorities for different package names, so that the priority of different identifiers can be determined based on the package name priority.
[0316] Specifically, the process of configuring a corresponding identifier for a camera in an electronic device may include: during the power-on process of the electronic device, the camera control module interacts with the camera driver to obtain the type and function of the camera in the electronic device, and then abstracts multiple logical cameras based on the type and function of the camera, and sets a corresponding identifier for each logical camera. For example, the identifier set for the photo function of the front camera is CameraID=1; the identifier set for the ambient light detection function of the front camera is CameraID=4.
[0317] The above is the process of setting the flag for the ambient light detection function of the front camera, which can be seen in the following code:
[0318]
[0319]
[0320] To ensure normal use by the user, the embodiment of the present application can configure the lowest priority for the package name of the ambient light detection application, so that when the user wants to open the camera application to take a photo, the user can be provided with a photo service. To facilitate subsequent applications, the camera control module can store the set camera identifier and the priority of different package names. Furthermore, the camera control module can send the set camera identifier and the priority of different package names to the camera service module for storage, so that the camera service module can manage the enabling priority of the camera.
[0321] In the embodiment of the present application, the management logic of the camera enabling priority of the camera service module can be: receiving a target instruction, the target instruction includes a target identifier and a target package name. After receiving the target instruction, the camera service module queries the camera list, and the camera list is used to store the identifier corresponding to the currently enabled camera. When the camera list is empty, it can be determined that there is no enabling conflict for the camera, and then based on the target instruction, the function of the camera corresponding to the target identifier is turned on; when the camera list is not empty, it can be determined that there is an enabling conflict for the camera, that is, there is currently an enabled camera, and then based on the target package name and the package name of the currently enabled camera, the priority of the target identifier and the identifier corresponding to the currently enabled camera can be determined. When the priority of the target identifier is lower than the priority of the currently enabled camera, the function of the camera corresponding to the target identifier is no longer turned on; when the priority of the target identifier is higher than the priority of the currently enabled camera, the currently enabled camera is turned off, and then the function of the camera corresponding to the target identifier is turned on.
[0322] The above judgment logic can be seen in the following code:
[0323]
[0324] Among them, ACameraManager_openCamera is the interface function of Open Camera, and buff is PackageName.
[0325] Based on the above judgment logic, Fig.11 Before executing step S1105, the camera service module can query the camera list, and when the camera list is empty, execute step S1105.
[0326] In the embodiment of the present application, for the client (sensor control module) and server (camera control module) based on AIDL service, the server exception may include two scenarios, one is the server process crash when the screen-on ambient light detection function is enabled, and the other is the server process crash when the screen-off ambient light detection function is not enabled; the client exception is mainly the client crash when the screen-on ambient light detection function is enabled. For these three scenarios, monitoring can be performed based on the first death monitoring object and the second death monitoring object pre-registered in step S1101, which will be introduced below.
[0327] After the ambient light detection function of the front camera is turned on by executing the above steps S1101 to S1105, in the process of adjusting the brightness of the display screen based on steps S1107 to S1109, when the camera control module does not respond and the target ambient light brightness output by the front camera cannot be sent to the sensor control module, in view of the abnormal situation of the server side during the process of adjusting the brightness of the display screen of the electronic device, the embodiment of the present application provides a management method for the ambient light detection function, so as to have Figure 2 The electronic device 100 with the software structure shown in FIG. 1 executes the embodiment of the present application as an example. Fig.15 The method may be performed after step S1105. The method flow provided in the embodiment of the present application includes:
[0328] S1501: During the process of adjusting the brightness of the display screen of the electronic device, when the camera control module is detected to be non-responsive through the first death monitoring object, the camera control module sends a first death notification message to the sensor control module.
[0329] In some embodiments, this step may correspond to Fig.16 Step ② in the embodiment specifically includes: during the process of adjusting the brightness of the display screen of the electronic device, the first death monitoring object (i.e., Death Notifier) monitors the Camera HAL in real time, and when it is monitored that the Camera HAL cannot send the target ambient light brightness output by the front camera to the sensor control module and to the Sensor HAL, the Camera HAL can call the data callback function (i.e., DeathRecpCallback) to send the first death notification message to the SensorHAL. The data callback function can be the data callback function registered in step S1101.
[0330] S1502: The sensor control module determines whether the AIDL service is started.
[0331] S1503: When it is determined that the AIDL service is pulled up, the sensor control module executes a call to the first interface, then calls the second interface, and sends a first instruction to the camera service module to enable the ambient light detection function of the front camera.
[0332] Since the camera service module cannot return the target ambient light brightness output by the front camera at this time, it is necessary to re-register the data callback function to ensure that the data path between the camera control module and the sensor control module can transmit data. Enabling the ambient light detection function of the front camera includes: the camera service module calls the first function in the camera control module, executes the first function according to the first identifier, controls the camera driver to apply for the CSL resource cache for ambient light detection for the front camera, powers on the front camera, initializes the camera register, and creates an asynchronous read thread.
[0333] In some embodiments, this step may correspond to Fig.16 Steps ②-⑥ in the process specifically include: when receiving the first death notification message, the Sensor HAL determines whether the AIDL service is started. When the AIDL service is started, the Active interface is called to register the data callback function, and then the libcamera2ndk_vendor interface is called to send the first instruction to the CameraService. The first instruction includes CameraID=4 and the package name of the ambient light detection application. After receiving the first instruction, the CameraService calls the OpenCamera function in the Camera HAL, executes the OpenCamera function according to CameraID=4, and then controls the camera driver to apply for the CLS resource cache for CameraID=4, and powers on the front camera, initializes the camera register, and creates an asynchronous reading thread. Then, the CameraSensor of the Driver starts working. When the target ambient light brightness output by the front camera is read, the Camera HAL fills the target ambient light brightness into the data callback function, sends the target ambient light brightness to the Sensor HAL through the data callback function, and the Sensor HAL reports it to the SensorService.
[0334] In another embodiment of the present application, when the AIDL service is not started, it is necessary to wait for a preset period of time and then determine again whether the AIDL service is started.
[0335] After the screen of the electronic device is turned off, after executing the above steps S1301 to S1303, if the ambient light detection function of the front camera cannot be turned off normally, the server does not respond after the screen of the electronic device is turned off. The embodiment of the present application provides a management method for the ambient light detection function, which has Figure 2 The electronic device 100 with the software structure shown in FIG. 1 executes the embodiment of the present application as an example. Fig.17 The method may be performed after step S1303. The method flow provided by the embodiment of the present application includes:
[0336] S1701: After the screen of the electronic device is turned off, when the first death monitoring object monitors that the camera control module does not respond, the camera control module sends a second death notification message to the sensor control module.
[0337] In some embodiments, this step corresponds to Fig.18 Step ① in the figure, i.e., the first registration and binding of the death notification, specifically includes: after the screen of the electronic device is turned off, the first death monitoring object (i.e., Death Notifier) monitors that the Camera HAL crashes and cannot normally turn off the ambient light detection function of the front camera. The data callback function (i.e., Death RecpCallback) can be called to send a second death notification message to the Sensor HAL.
[0338] S1702: After receiving the second death notification message, the sensor control module determines whether the screen of the electronic device is turned off.
[0339] S1703: When it is determined that the screen of the electronic device is turned off, the sensor control module calls the first interface to send an initialization instruction to the camera control module.
[0340] S1704: After receiving the initialization instruction, the camera control module initializes the front camera and the data callback function.
[0341] In some embodiments, this step corresponds to Fig.18 Steps ② and ③ in the method specifically include: after receiving the second death notification message, the Sensor HAL may call the Active interface to initialize the camera registers and data callback functions in the Camera HAL.
[0342] In this scenario, since the display screen is off, there is no need to adjust the ambient light brightness, and the sensor control module no longer enables the front camera, which means that the CameraSensor in the Driver stops working.
[0343] After the ambient light detection function of the front camera is enabled by executing the above steps S1101 to S1105, in the process of adjusting the brightness of the display screen based on steps S1107 to S1109, when the sensor control module cannot turn on the ambient light detection function of the front camera, the embodiment of the present application provides a management method for the ambient light detection function in view of the fact that the server does not respond during the process of adjusting the brightness of the display screen of the electronic device. Figure 2 The electronic device with the software structure shown in the figure performs the embodiment of the present application as an example, see Fig.19 , the method flow provided in the embodiment of the present application includes:
[0344] S1901: After the screen of the electronic device is turned on, when the sensor control module is detected to be non-responsive through the second death monitoring object, the sensor control module sends a third death notification message to the camera control module.
[0345] In some embodiments, this step corresponds to Fig. 20 Step ① in the method specifically includes: after the screen of the electronic device is turned on, the second death monitoring object monitors the Sensor HAL in real time, and when a crash event of the Sensor HAL is monitored, the data callback function is called to send a third death notification message to the Camera HAL.
[0346] S1902: After receiving the third death notification message, the camera control module closes the reading thread and destroys the data callback function.
[0347] In some embodiments, this step corresponds to Fig. 20 Step ② in the method specifically includes: after receiving the third death notification message, the Camera HAL controls the camera driver to close the asynchronous reading thread, stop reading the ambient light brightness, and destroy the data callback function. That is, it stops reading the ambient light brightness from the CameraSensor in the Driver.
[0348] S1903: The sensor control module calls the third interface based on the AIDL service, and then calls the second interface to send a second instruction to the camera service module.
[0349] In some embodiments, this step corresponds to Fig. 20 Steps ③ and ④ specifically include: Sensor HAL calls the DeActive interface, and then calls the libcamera2ndk_vendor interface to send a second instruction to CameraService, where the second instruction includes CameraID=4 and the package name of the ambient light detection application.
[0350] S1904: After receiving the second instruction, the camera service module calls the second function in the camera control module, and executes the second function according to the first identifier to control the camera driver to close the reading thread and power off the front camera.
[0351] In some embodiments, this step corresponds to Fig. 20 Step ⑤ in the method specifically includes: after receiving the second instruction, CameraService calls Camera HAL to control the camera driver to release the CSL resources applied for the function of CameraID=4, and power off the front camera. Then, the CameraSensor in the Driver stops working.
[0352] S1905: After the sensor control module is restarted, the first interface is called to register a data callback function in the camera control module, and the second interface is called to send a first instruction to the camera service module to enable the ambient light detection function of the front camera.
[0353] In some embodiments, this step corresponds to Fig. 20 Step ⑥ specifically includes: Sensor HAL calls the Active interface, and then calls the libcamera2ndk_vendor interface to send a first instruction to CameraService, where the first instruction includes CameraID=4 and the package name of the ambient light detection application to enable the ambient light detection function of the front camera.
[0354] Generally, the camera software process is more complex than the physical ambient light software process, and consumes more power. Meeting the performance requirements cannot meet the power consumption requirements, and meeting the power consumption requirements cannot meet the performance requirements. To this end, the embodiment of the present application will also optimize the display brightness adjustment method in the above embodiment, so as to ensure that the first frame data can be reported in a timely and effective manner under the premise of reducing the function. Fig.21 ,This method mainly involves the following three aspects in terms of reducing power consumption and optimizing performance:
[0355] First, streamline the process of OpenCamera function in CAMX
[0356] With respect to the first aspect, the embodiment of the present application customizes the process of the original Open Camera function, adds a branch for jumping out of the image output distribution flow, and when calling CameraService to call the Open Camera function in the Camera HAL, when the original Open Camera function supports turning on the ambient light detection function of the front camera, the encapsulation function OpenCamLightSensor is called to skip the image output distribution flow, thereby saving resource consumption when the front camera is used as an ambient light detection device and improving the performance of the electronic device.
[0357] For the simplified execution process of OpenCamera function, Fig.11 The adjustment process of the display brightness during the startup process shown is used as an example for explanation. Since the embodiment of the present application needs to turn on the ambient light detection function of the front camera, if the front camera does not support turning on the ambient light detection function of the front camera, it is impossible to enable the ambient light detection function of the front camera by calling the first function. Therefore, after calling the first function, the first sub-function in the first function will also be called to determine whether the front camera supports the ambient light detection function. If the front camera supports the ambient light detection function, the second sub-function in the first function will be called to control the camera driver to power on the front camera, initialize the camera registers and create an asynchronous read thread, so that the CameraSensor in the Driver starts working. By executing this streamlined OpenCamera function, the image output and streaming process can be skipped, the opening time of the ambient light detection function can be shortened, and the performance of the electronic device can be improved.
[0358] Among them, the ambient light detection judgment function can be IsSupportCamLightSensor() (support camera brightness sensor), and the ambient light detection sensor function can be OpenCamLightSensor() (open camera brightness sensor).
[0359] The above logic code for determining whether the front camera supports ambient light detection is: static int open(const struct
[0360]
[0361] Of course, if the front camera does not support ambient light detection, you can interact with the camera driver in the kernel layer to control the camera driver to apply for CSL resource cache for the ambient light detection function of the front camera, power on the front camera, initialize the camera registers, and allocate streams for the front camera, so that the front camera can output images.
[0362] Second, set a higher priority for the reading thread
[0363] Considering that multiple threads may be executed simultaneously in the camera driver, in order to ensure the timely reporting of ambient light brightness, a higher priority can be set for the asynchronous thread, so that the execution of the reading thread can be prioritized when resources are limited.
[0364] Third, adaptive switching frequency
[0365] Electronic devices have strict requirements for the first frame data of ambient light brightness (the one frame data mentioned here is not the image frame), and generally require reporting within 300ms. There are no strict requirements for the second frame data and subsequent frames, and the reporting time of the first frame data depends on the frame rate of the front camera. When the frequency of the front camera is set to a lower frequency to reduce power consumption, the data may not be reported within 300 milliseconds because it takes time to detect the ambient light brightness. In order to ensure that the first frame data can be reported in time, an embodiment of the present application provides an adaptive frequency switching method, which records the target number and writes the target number into the camera register. The target number can be the number of times the camera control module of the electronic device reads the ambient light brightness from the front camera after the screen is turned on this time, or it can be the number of times the camera control module of the electronic device reads the ambient light brightness from the front camera after the screen is turned on for the last time. After the electronic device turns off the screen, the target number recorded in the camera register will be cleared. After the front camera is powered on, the camera control module obtains the target number of times from the camera register. When the target number of times is 0, the camera control module writes the first frequency into the camera register, that is, writes it before the second reading, and controls the front camera to detect the ambient light brightness according to the first frequency; when the target number of times is greater than 0, the camera control module writes the second frequency into the camera register, and controls the front camera to detect the ambient light brightness according to the second frequency, and the first frequency is greater than the second frequency. Among them, the frequency at which the front camera detects the ambient light brightness can be determined based on a preset frame rate. For example, the first frequency corresponds to the first preset frame rate, and the second frequency corresponds to the second preset frame rate. The first preset frame rate is higher than the second preset frame rate. The first preset frame rate can be 30fps, and the second preset frame rate can be 5fps or 3fps.
[0366] The optimization method may be performed after step S1105 and before step S1107. By adaptively adjusting the frequency of the front camera collecting the ambient light brightness, not only the first frame data is ensured to be reported in time, but also the power consumption of the electronic device is reduced.
[0367] See also Fig. 22 , Fig. 22 A flowchart of a method for determining ambient light brightness provided in an embodiment of the present application, the method being applied to an electronic device. First, Index takes CurrentIndex-1 and obtains the current brightness. The current brightness is the ambient light brightness of the previous frame, and the current brightness interval is the brightness interval to which the ambient light brightness of the previous frame belongs (i.e., the first brightness interval). Index represents the brightness interval. The current brightness interval is denoted as c, and Index takes CurrentIndex-1, that is, the brightness interval before the current brightness interval is determined, denoted as c-1.
[0368] Then, when Index is equal to CurrentIndex-1, it is determined whether the Type of Index is not equal to that of Index+1. Since Index is CurrentIndex-1, at this time, Index is c-1, and Index+1 is c-1+1 (i.e., c), that is, it is determined whether the Setting Type of the current brightness interval is not equal to that of the previous brightness interval.
[0369] If Index is equal to CurrentIndex-1, and the Type of Index is not equal to that of Index+1, that is, the Setting Type of the current brightness interval is different from that of the previous brightness interval. In other words, the Type of the previous level (previous brightness interval c-1) is different from that of the current level (current brightness interval c), then this loop is exited, and the current lux is calculated without using the previous coefficient. That is, the calibration coefficient corresponding to the previous brightness interval is used to determine the second ambient light brightness.
[0370] Then, Index takes Index+1. Since Index takes Index-1 (i.e., c-1) before, Index+1 is now c, that is, the calibration coefficient corresponding to the current brightness interval (i.e., c) is used to determine the brightness of the second ambient light. And it is determined whether the brightness of the second ambient light is in the previous brightness interval or in the current brightness interval. If the brightness of the second ambient light is in the previous brightness interval, the previous brightness interval is determined to be the target brightness interval. If the brightness of the second ambient light is in the current brightness interval, the current brightness interval is determined to be the target brightness interval.
[0371] Then, Index takes Index+1. Since Index takes Index+1 (i.e., c) before, Index+1 is now c+1, and it is determined whether the brightness of the second ambient light is in the brightness interval after the current brightness interval (i.e., c+1). If the brightness of the second ambient light is in the latter brightness interval, the latter brightness interval is determined to be the target brightness interval.
[0372] Fig. 22 In the above code, Index++ means that the first Index is Index+1 (i.e. c), and the second Index is Index+1 (i.e. c+1).
[0373] If Index is equal to CurrentIndex-1, and the Type of Index is equal to that of Index+1, that is, the Setting Type of the current brightness interval is the same as that of the previous brightness interval. Determine whether Index is equal to current and whether there is a previous brightness interval. In other words, determine whether the value of Index is c and whether there is a previous brightness interval of the current brightness interval.
[0374] If the value of Index is c, and there is a brightness interval before the current brightness interval (i.e., c-1), when the current brightness is in the previous range (Index-1), CurrentIndex=Index-1 is given, and the loop is exited. That is, when there is a previous brightness interval, the calibration coefficient corresponding to the previous brightness interval is used to calculate the second ambient light brightness. If the second ambient light brightness is in the previous brightness interval, the previous brightness interval is determined to be the target brightness interval.
[0375] If the value of Index is c, and there is no previous brightness interval (i.e., c-1) of the current brightness interval, it is determined whether the current brightness is within the range of Index or Index+1, and the corresponding value is assigned to CurrentIndex. That is, when there is no previous brightness interval, the third ambient light brightness is calculated using the calibration coefficient corresponding to the current brightness interval. If the third ambient light brightness is within the current brightness interval, the current brightness interval is determined to be the target brightness interval. If the third ambient light brightness is within the next brightness interval, the next brightness interval is determined to be the target brightness interval.
[0376] Furthermore, based on the target calibration coefficient corresponding to the target brightness interval and the target image data collected in the current frame, the target ambient light brightness of the current frame is calculated.
[0377] The following combination Fig.23 and Fig.24 ,right Fig. 22 The effect of the provided ambient light brightness determination method is described. Among them, the broken line with the origin is the corresponding relationship between the measured lux detected by the physical device and the simulated positioning lux. The broken line with triangles is the corresponding relationship between the measured lux detected by the Default (non-implementation) parameter and the simulated positioning lux. The broken line with squares is the corresponding relationship between the measured lux detected by the low / medium / high three-stage parameters and the simulated positioning lux.
[0378] The measured lux detected by the physical device is the ambient light brightness detected by the ambient light detection device. The measured lux detected by the Default parameter is the ambient light brightness determined in accordance with the prior art. The measured lux detected by the low / medium / high parameters is the ambient light brightness determined in accordance with the prior art. Fig. 22 Provides methods to determine the ambient light intensity.
[0379] according to Fig.23 and Fig.24 Can get, Fig. 22 The ambient light brightness determination method provided by the invention is closer to the ambient light brightness detected by the physical device and closer to the simulated ambient light brightness, and has a high accuracy. Fig. 22 The provided method determines the ambient light brightness and adjusts the display screen brightness of the electronic device, which can improve the accuracy of adjusting the display screen brightness of the electronic device and improve the user experience.
[0380] In a specific implementation, the present application also provides an electronic device, which includes 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 includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform some or all of the steps in the above method embodiments.
[0381] The present application also provides a computer-readable storage medium, including a computer program, which, when executed on an electronic device, enables the electronic device to perform some or all of the steps in the above method embodiment. The above storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0382] In a specific implementation, an embodiment of the present application further provides a computer program product, which includes executable instructions. When the executable instructions are executed on an electronic device, the electronic device executes part or all of the steps in the above method embodiment.
[0383] like Fig.25 As shown, the present application also provides a chip system, which is applied to electronic devices. The chip system includes one or more processors 2501. The processor 2501 is used to call computer instructions so that the electronic device inputs the data to be processed into the chip system. The chip system processes the data based on the display screen brightness adjustment method provided in the embodiment of the present application and outputs the processing result.
[0384] In a possible implementation, the chip system also includes input and output interfaces for inputting and outputting data.
[0385] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.
[0386] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0387] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0388] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software or any combination thereof. The disclosed embodiments can also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which can be read and executed by one or more processors. For example, instructions can be distributed over a network or through other computer-readable media. Therefore, machine-readable media can include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to, floppy disks, optical disks, optical disks, compact disc read-only memories (Compact Disc Read Only Memory, CD-ROMs), magneto-optical disks, read-only memories, random access memories, erasable programmable read-only memories (Erasable Programmable Read Only Memory, EPROM), electrically erasable programmable read-only memories (Electrically Erasable Programmable Read Only Memory, EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable memories for transmitting information (e.g., carrier waves, infrared signal digital signals, etc.) using the Internet in electrical, optical, acoustic or other forms of propagation signals. Accordingly, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).
[0389] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings of the specification. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0390] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0391] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0392] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.< / float>
Claims
1. A method for adjusting the brightness of a display screen, characterized in that: The method is applied to an electronic device, and the method comprises: Acquire the ambient light brightness detected by the target camera of the electronic device in the previous frame to obtain a first ambient light brightness; Calculate the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data acquired by the target camera in the current frame; Based on the brightness of the second ambient light, determining the brightness range of the current frame to obtain a target brightness range; In the correspondence between the preset brightness intervals and the calibration coefficients, the calibration coefficient corresponding to the target brightness interval is determined to obtain the target calibration coefficient; wherein the plurality of brightness intervals in the correspondence are arranged in order from low to high according to the brightness included; Calculating the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data; The display screen brightness of the electronic device is adjusted based on the target ambient light brightness of the current frame.
2. The method according to claim 1, characterized in that Before calculating the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data acquired by the target camera in the current frame, the method further includes: Determining whether to switch parameter settings of the target camera from a brightness interval preceding the first brightness interval to the first brightness interval; The calculating the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data collected by the target camera in the current frame includes: When the parameter setting of the target camera is not switched from a brightness interval preceding the first brightness interval to the first brightness interval, determining the calibration coefficient corresponding to the brightness interval preceding the first brightness interval in the correspondence relationship between preset brightness intervals and calibration coefficients to obtain a first calibration coefficient; The second ambient light brightness is calculated based on the first calibration coefficient and the target image data acquired by the target camera in the current frame.
3. The method according to claim 2, characterized in that The determining the brightness range of the current frame based on the brightness of the second ambient light to obtain a target brightness range includes: Determining whether the brightness of the second ambient light is within a brightness interval preceding the first brightness interval; When the brightness of the second ambient light is in a brightness interval preceding the first brightness interval, determining the brightness interval preceding the first brightness interval as the brightness interval of the current frame, and obtaining a target brightness interval; When the brightness of the second ambient light is not within a brightness interval preceding the first brightness interval, determining whether the brightness of the second ambient light is within the first brightness interval; When the brightness of the second ambient light is within the first brightness range, the first brightness range is determined to be the brightness range of the current frame, and a target brightness range is obtained.
4. The method according to claim 3, characterized in that After determining whether the brightness of the second ambient light is within the first brightness range, the method further includes: When the brightness of the second ambient light is not within the first brightness range, determining the calibration coefficient corresponding to the first brightness range in a preset correspondence relationship between the brightness range and the calibration coefficient, and obtaining a second calibration coefficient; Calculating a third ambient light brightness based on the second calibration coefficient and the target image data; Determining whether the brightness of the third ambient light is within the first brightness range; When the brightness of the third ambient light is within the first brightness range, determining the first brightness range as the brightness range of the current frame, and obtaining a target brightness range; When the brightness of the third ambient light is not within the first brightness interval, determining whether the brightness of the third ambient light is within a brightness interval subsequent to the first brightness interval; When the brightness of the third ambient light is in a brightness interval subsequent to the first brightness interval, the brightness interval subsequent to the first brightness interval is determined as the brightness interval of the current frame, and a target brightness interval is obtained.
5. The method according to claim 4, characterized in that Before determining whether to switch the parameter setting of the target camera from a brightness interval before the first brightness interval to the first brightness interval, the method further includes: Determine whether there is a brightness interval before the first brightness interval; The determining whether to switch the parameter setting of the target camera from a brightness interval before the first brightness interval to the first brightness interval includes: When there is a brightness interval preceding the first brightness interval, it is determined whether to switch the parameter setting of the target camera from the brightness interval preceding the first brightness interval to the first brightness interval.
6. The method according to claim 5, characterized in that After determining whether there is a brightness interval before the first brightness interval, the method further includes: When there is no previous brightness interval of the first brightness interval, in the corresponding relationship between the preset brightness interval and the calibration coefficient, the calibration coefficient corresponding to the first brightness interval is determined to obtain the second calibration coefficient, and the step of calculating the third ambient light brightness based on the second calibration coefficient and the target image data is performed.
7. The method according to claim 4, characterized in that After determining whether the brightness of the third ambient light is in a brightness interval subsequent to the first brightness interval, the method further includes: When the brightness of the third ambient light is not in a brightness interval subsequent to the first brightness interval, determining whether the brightness of the third ambient light is lower than a lower limit value of a brightness interval preceding the first brightness interval; When the brightness of the third ambient light is lower than the lower limit value of a brightness interval preceding the first brightness interval, the brightness interval preceding the first brightness interval is determined to be the brightness interval of the current frame, and the target brightness interval is obtained.
8. The method according to claim 7, characterized in that After determining whether the brightness of the third ambient light is lower than a lower limit value of a brightness interval preceding the first brightness interval, the method further includes: When the brightness of the third ambient light is not lower than the lower limit value of a brightness interval before the first brightness interval, determining whether the brightness of the third ambient light is higher than the upper limit value of a brightness interval after the first brightness interval; When the brightness of the third ambient light is higher than the upper limit value of a brightness interval subsequent to the first brightness interval, the brightness interval subsequent to the first brightness interval is determined as the brightness interval of the current frame, and a target brightness interval is obtained.
9. The method according to claim 2, characterized in that: The calculating the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and the target image data collected by the target camera in the current frame includes: When switching the parameter setting of the target camera from a brightness interval preceding the first brightness interval to the first brightness interval, determining the calibration coefficient corresponding to the first brightness interval in a preset correspondence relationship between the brightness interval and the calibration coefficient, and obtaining a second calibration coefficient; The second ambient light brightness is calculated based on the second calibration coefficient and the target image data acquired by the target camera in the current frame.
10. The method according to claim 9, characterized in that The determining the brightness range of the current frame based on the brightness of the second ambient light to obtain a target brightness range includes: Determining whether the brightness of the second ambient light is within a brightness interval preceding the first brightness interval; When the brightness of the second ambient light is in a brightness interval preceding the first brightness interval, determining the brightness interval preceding the first brightness interval as the brightness interval of the current frame, and obtaining a target brightness interval; When the brightness of the second ambient light is not within a brightness interval preceding the first brightness interval, determining whether the brightness of the second ambient light is within the first brightness interval; When the brightness of the second ambient light is within the first brightness range, determining the first brightness range as the brightness range of the current frame, and obtaining a target brightness range; When the brightness of the second ambient light is not within the first brightness interval, determining whether the brightness of the second ambient light is within a brightness interval subsequent to the first brightness interval; When the brightness of the second ambient light is in a brightness interval subsequent to the first brightness interval, the brightness interval subsequent to the first brightness interval is determined as the brightness interval of the current frame, and a target brightness interval is obtained.
11. The method according to claim 1, characterized in that: The step of calculating the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data includes: The target ambient light brightness of the current frame is calculated based on the target calibration coefficient, the target image data and a preset formula; wherein the preset formula is: Lux=A×R+B Lux represents the target ambient light brightness; A represents a target calibration coefficient; B represents another target calibration coefficient; and R represents the target image data.
12. An electronic device, characterized in that: include: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and 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 11.
13. A computer-readable storage medium, characterized in that: The invention comprises a computer program, which, when being executed on an electronic device, enables the electronic device to execute the method according to any one of claims 1 to 11.
14. A computer program product, characterized in that The computer program product comprises executable instructions, and when the executable instructions are executed on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 11.
15. 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 processor is used to call computer instructions so that the electronic device inputs data into the chip system, and executes the method described in any one of claims 1-11 to process the data and then output the processing result.
Citation Information
Patent Citations
Interface adjustment method, device and terminal
CN103856823A
Screen brightness adjusting method, device, storage medium, and electronic device
CN109272917A
Organic lighting emitting diode display device anddriving method thereof
KR100812000B1
Display brightness adjustment
US20060092182A1
Ambient light sensing technique
US20120050307A1
