CN119252210B - Display screen brightness adjusting method, electronic equipment and storage medium - Google Patents
Display screen brightness adjusting method, electronic equipment and storage mediumInfo
- Publication number
- CN119252210B CN119252210B CN202410427040.8A CN202410427040A CN119252210B CN 119252210 B CN119252210 B CN 119252210B CN 202410427040 A CN202410427040 A CN 202410427040A CN 119252210 B CN119252210 B CN 119252210B
- Authority
- CN
- China
- Prior art keywords
- brightness
- interval
- ambient light
- brightness interval
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G5/00—Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators
- G09G5/10—Intensity circuits
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G3/00—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
- G09G3/03—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes specially adapted for displays having non-planar surfaces, e.g. curved displays
- G09G3/035—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes specially adapted for displays having non-planar surfaces, e.g. curved displays for flexible display surfaces
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G3/00—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
- G09G3/20—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters
- G09G3/22—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources
- G09G3/30—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels
- G09G3/32—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED]
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G3/00—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
- G09G3/20—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters
- G09G3/22—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources
- G09G3/30—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels
- G09G3/32—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED]
- G09G3/3208—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED] organic, e.g. using organic light-emitting diodes [OLED]
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G3/00—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
- G09G3/20—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters
- G09G3/22—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources
- G09G3/30—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels
- G09G3/32—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED]
- G09G3/3208—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED] organic, e.g. using organic light-emitting diodes [OLED]
- G09G3/3225—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED] organic, e.g. using organic light-emitting diodes [OLED] using an active matrix
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G3/00—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
- G09G3/20—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters
- G09G3/34—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters by control of light from an independent source
- G09G3/36—Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters by control of light from an independent source using liquid crystals
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G2320/00—Control of display operating conditions
- G09G2320/06—Adjustment of display parameters
- G09G2320/0626—Adjustment of display parameters for control of overall brightness
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Chemical & Material Sciences (AREA)
- Crystallography & Structural Chemistry (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
本申请实施例提供了一种显示屏亮度的调节方法、电子设备及存储介质,涉及电子设备技术领域,方法包括:获取电子设备的目标摄像头在前一帧检测的第一环境光亮度。基于第一环境光亮度所属的第一亮度区间,以及目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。基于第二环境光亮度,确定当前帧的目标亮度区间。在预设的亮度区间与校准系数的对应关系中,确定目标亮度区间对应的校准系数,得到目标校准系数;对应关系中的多个亮度区间按照包含的亮度从低至高的顺序排列。基于目标校准系数和目标图像数据,计算当前帧的目标环境光亮度。基于当前帧的目标环境光亮度,调节电子设备的显示屏亮度。如此,可以提高用户体验。
An embodiment of the present application provides a method for adjusting the brightness of a display screen, an electronic device, and a storage medium, and relates to the technical field of electronic devices. The method includes: obtaining the first ambient light brightness detected by the target camera of the electronic device in the previous frame. 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, the second ambient light brightness is calculated. Based on the second ambient light brightness, the target brightness interval of the current frame is determined. In the correspondence between the preset brightness interval and the calibration coefficient, the calibration coefficient corresponding to the target brightness interval is determined to obtain the target calibration coefficient; the multiple brightness intervals in the correspondence are arranged in order from low to high according to the brightness included. Based on the target calibration coefficient and the target image data, the target ambient light brightness of the current frame is calculated. Based on the target ambient light brightness of the current frame, the brightness of the display screen of the electronic device is adjusted. In this way, the user experience can be improved.
Description
技术领域Technical Field
本申请涉及电子设备技术领域,特别涉及一种显示屏亮度的调节方法、电子设备及存储介质。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
目前,智能手机、平板电脑、台式电脑、可穿戴设备等诸多电子设备的显示屏均具有自动调节亮度功能。自动调节亮度功能可根据环境光亮度,自动调节显示屏亮度,以适应不同环境下的光线强度,从而提高用户的使用体验,降低电子设备的电力消耗。Currently, the displays of many electronic devices, including smartphones, tablets, desktop computers, and wearable devices, all feature automatic brightness adjustment. This feature automatically adjusts the display brightness based on ambient light levels to adapt to different light intensity environments, thereby improving the user experience and reducing the power consumption of electronic devices.
相关技术中,为了降低电子设备的成本,使用电子设备中的摄像头(例如,前置摄像头)代替环境光检测器件,也就是使用电子设备中的摄像头检测环境光亮度。进而基于检测的环境光亮度,调节电子设备的显示屏亮度。In related art, in order to reduce the cost of electronic devices, a camera (e.g., a front-facing camera) in the electronic device is used instead of an ambient light detection device. In other words, the camera in the electronic device is used to detect the ambient light brightness. The brightness of the electronic device's display screen is then adjusted based on the detected ambient light brightness.
然而,通过摄像头检测环境光亮度的准确性较低,导致对电子设备的显示屏亮度调整时,电子设备的显示屏亮度变化较大,影响用户体验。However, the accuracy of detecting the ambient light brightness through the camera is low, resulting in large changes in the brightness of the electronic device's display screen when the brightness is adjusted, affecting the user experience.
发明内容Summary of the Invention
本申请实施例的目的在于提供一种显示屏亮度的调节方法、电子设备及存储介质,以提高检测环境光亮度的准确性,可以使得对电子设备的显示屏亮度调整时电子设备的显示屏亮度变化较小,提高用户体验。具体技术方案如下:The purpose of the embodiments of the present application is to provide a method for adjusting display brightness, an electronic device, and a storage medium to improve the accuracy of detecting ambient light brightness, thereby minimizing changes in the brightness of the electronic device's display when adjusting the brightness, and improving the user experience. The specific technical solution is as follows:
第一方面,为了达到上述目的,本申请实施例提供了一种显示屏亮度的调节方法,所述方法应用于电子设备,所述方法包括:In a first aspect, to achieve the above-mentioned objectives, embodiments of the present application provide a method for adjusting the brightness of a display screen, the method being applied to an electronic device, the method comprising:
获取所述电子设备的目标摄像头在前一帧检测的环境光亮度,得到第一环境光亮度;Acquire the ambient light brightness detected by the target camera of the electronic device in a previous frame to obtain a first ambient light brightness;
基于所述第一环境光亮度所属的第一亮度区间,以及所述目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度;Calculating a second ambient light brightness based on a first brightness interval to which the first ambient light brightness belongs and target image data captured by the target camera in a current frame;
基于所述第二环境光亮度,确定所述当前帧的亮度区间,得到目标亮度区间;Determining a brightness range of the current frame based on the second ambient light brightness to obtain a target brightness range;
在预设的亮度区间与校准系数的对应关系中,确定所述目标亮度区间对应的校准系数,得到目标校准系数;其中,所述对应关系中的多个亮度区间按照包含的亮度从低至高的顺序排列;In a preset correspondence between brightness intervals and calibration coefficients, determining the calibration coefficient corresponding to the target brightness interval 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;
基于所述当前帧的目标环境光亮度,调节所述电子设备的显示屏亮度。Adjust the brightness of the display screen of the electronic device based on the target ambient light brightness of the current frame.
由以上可见,本实施例提供的技术方案,基于在前一帧检测到的环境光亮度所属的第一亮度区间,确定当前帧的目标亮度区间,当前帧的目标亮度区间与前一帧检测到的环境光亮度所属的亮度区间之间不会跨亮度区间,进而,基于目标亮度区间确定当前帧的目标环境光亮度,可以使得目标环境光亮度位于目标亮度区间,提高确定出的目标环境光亮度的准确性,进而在基于目标环境光亮度对显示屏亮度进行调整时,不会跨亮度区间调整电子设备的显示屏亮度,可以实现使得调节电子设备的显示屏亮度时,显示屏亮度的变化较小,提高用户体验。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 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. This can ensure that when the display brightness of the electronic device is adjusted, the change in display brightness is small, thereby improving the user experience.
本申请的一个实施例中,在所述基于所述第一环境光亮度所属的第一亮度区间,以及所述目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度之前,所述方法还包括: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 captured 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 a calibration coefficient corresponding to a brightness interval preceding the first brightness interval in a preset correspondence between 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 captured by the target camera in the current frame.
由以上可见,本实施例的技术方案中,确定目标摄像头在前一帧检测到的第一环境光亮度所属的第一亮度区间,在从第一亮度区间的前一个亮度区间至第一亮度区间未切换目标摄像头的参数设置时,结合第一亮度区间的前一个亮度区间,确定用于估计当前帧的目标亮度区间的第二环境光亮度。基于第二环境光亮度确定出的目标亮度区间不会一直为较高的亮度区间,可以避免显示屏亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,提高用户体验。并且目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验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 for estimating 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 cannot be reduced to a lower brightness interval after being adjusted to a higher brightness interval (such as 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 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.
本申请的一个实施例中,所述基于所述第二环境光亮度,确定所述当前帧的亮度区间,得到目标亮度区间,包括:In one embodiment of the present application, determining the brightness range of the current frame based on the second ambient light brightness to obtain the 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 to obtain 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.
由以上可见,本实施例的技术方案中,结合第一亮度区间的前一个亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。基于第二环境光亮度确定目标亮度区间为第一亮度区间的前一个亮度区间,还是第一亮度区间,使得目标亮度区间不会一直为较高的亮度区间,可以避免亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,提高用户体验。并且目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整电子设备的显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness for estimating 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 electronic device's display across the brightness interval, so that the user's visual perception of the display brightness change is small, that is, the user can adjust the display brightness without perception, thereby improving the user experience.
本申请的一个实施例中,在所述判断所述第二环境光亮度是否位于所述第一亮度区间之后,所述方法还包括: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:
在所述第二环境光亮度不位于所述第一亮度区间时,在预设的亮度区间与校准系数的对应关系中,确定所述第一亮度区间对应的校准系数,得到第二校准系数;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 between brightness ranges and calibration coefficients to obtain 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 to obtain a target brightness range;
在所述第三环境光亮度不位于所述第一亮度区间时,判断所述第三环境光亮度是否位于所述第一亮度区间的后一个亮度区间;When the brightness of the third ambient light is not within the first brightness range, determining whether the brightness of the third ambient light is within a brightness range subsequent to the first brightness range;
在所述第三环境光亮度位于所述第一亮度区间的后一个亮度区间时,确定所述第一亮度区间的后一个亮度区间为当前帧的亮度区间,得到目标亮度区间。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 to be the brightness interval of the current frame, and a target brightness interval is obtained.
由以上可见,本实施例的技术方案中,结合第一亮度区间的前一个亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。在第二环境光亮度不位于第一亮度区间的前一个亮度区间,也不位于第一亮度区间时,基于第一亮度区间对应的校准系数确定第三环境光亮度,并基于第三环境光亮度确定目标亮度区间为第一亮度区间,还是第一亮度区间的后一个亮度区间,可以避免亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,提高用户体验。并且目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整电子设备的显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness for estimating 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 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, which can avoid adjusting the brightness of the electronic device's display screen across the brightness interval, so that the user's visual perception of the display screen brightness change is small, that is, the user can adjust the display screen brightness without perception, thereby improving the user experience.
本申请的一个实施例中,在所述判断从所述第一亮度区间的前一个亮度区间至所述第一亮度区间,是否切换所述目标摄像头的参数设置之前,所述方法还包括:In one embodiment of the present application, before determining whether to switch the parameter setting of the target camera from a brightness interval preceding the first brightness interval to the first brightness interval, the method further includes:
判断是否存在所述第一亮度区间的前一个亮度区间;Determining 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 preceding 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.
本申请的一个实施例中,在所述判断是否存在所述第一亮度区间的前一个亮度区间之后,所述方法还包括:In one embodiment of the present application, after determining whether there is a brightness interval preceding the first brightness interval, the method further includes:
在不存在所述第一亮度区间的前一个亮度区间时,在预设的亮度区间与校准系数的对应关系中,确定所述第一亮度区间对应的校准系数,得到第二校准系数,并执行所述基于所述第二校准系数和所述目标图像数据,计算第三环境光亮度的步骤。When there is no brightness interval before the first brightness interval, in the correspondence between the preset brightness intervals and the calibration coefficients, 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.
本申请的一个实施例中,在所述判断所述第三环境光亮度是否位于所述第一亮度区间的后一个亮度区间之后,所述方法还包括: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:
在所述第三环境光亮度不位于所述第一亮度区间的后一个亮度区间时,判断所述第三环境光亮度是否低于所述第一亮度区间的前一个亮度区间的下限值;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 a target brightness interval is obtained.
由以上可见,本实施例的技术方案,在第三环境光亮度既不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间。在第三环境光亮度低于第一亮度区间的前一个亮度区间的下限值时,表明第三环境光亮度区间位于第一亮度区间的前一个亮度区间之前的亮度区间,确定第一亮度区间的前一个亮度区间为当前帧的目标亮度区间,可以避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,提高用户体验。As can be seen from the above, the technical solution of this embodiment is that when the third ambient light brightness is neither in the first brightness range nor in the brightness range after the first brightness range. When the third ambient light brightness is lower than the lower limit of the brightness range before the first brightness range, it indicates that the third ambient light brightness range is in the brightness range before the brightness range before the first brightness range. The brightness range before the first brightness range is determined as the target brightness range of the current frame. This can avoid the target brightness range and the first brightness range from overlapping brightness ranges, thereby avoiding adjusting the display brightness across brightness ranges, thereby improving the user experience.
本申请的一个实施例中,在所述判断所述第三环境光亮度是否低于所述第一亮度区间的前一个亮度区间的下限值之后,所述方法还包括: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:
在所述第三环境光亮度不低于所述第一亮度区间的前一个亮度区间的下限值时,判断所述第三环境光亮度是否高于所述第一亮度区间的后一个亮度区间的上限值;When the brightness of the third ambient light is not lower than the lower limit value of a brightness interval preceding the first brightness interval, determining whether the brightness of the third ambient light is higher than the upper limit value of a brightness interval following the first brightness interval;
在所述第三环境光亮度高于所述第一亮度区间的后一个亮度区间的上限值时,确定所述第一亮度区间的后一个亮度区间为当前帧的亮度区间,得到目标亮度区间。When the brightness of the third ambient light is higher than the upper limit of a brightness interval following the first brightness interval, the brightness interval following the first brightness interval is determined to be the brightness interval of the current frame, and a target brightness interval is obtained.
由以上可见,本实施例的技术方案,在第三环境光亮度既不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间。在第三环境光亮度高于第一亮度区间的后一个亮度区间的上限值时,表明第三环境光亮度区间位于第一亮度区间的后一个亮度区间之后的亮度区间,确定第一亮度区间的后一个亮度区间为当前帧的目标亮度区间,可以避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,提高用户体验。As can be seen from the above, the technical solution of this embodiment is that when the third ambient light brightness is neither in the first brightness range nor in the brightness range following the first brightness range. When the third ambient light brightness is higher than the upper limit of the brightness range following the first brightness range, it indicates that the third ambient light brightness range is in the brightness range following the brightness range following the first brightness range. The brightness range following the first brightness range is determined as the target brightness range of the current frame. This can avoid the determined target brightness range and the first brightness range from intersecting brightness ranges, thereby avoiding adjusting the display brightness across brightness ranges, thereby improving the user experience.
本申请的一个实施例中,所述基于所述第一环境光亮度所属的第一亮度区间,以及所述目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度,包括: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 captured 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 between brightness intervals and calibration coefficients to obtain a second calibration coefficient;
基于所述第二校准系数和所述目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。The second ambient light brightness is calculated based on the second calibration coefficient and the target image data captured by the target camera in the current frame.
由以上可见,本实施例的技术方案中,确定目标摄像头在前一帧检测到的第一环境光亮度所属的第一亮度区间,在从第一亮度区间的前一个亮度区间前一个亮度区间至第一亮度区间切换了目标摄像头的参数设置时,直接基于第一亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。后续,基于第二环境光亮度确定目标亮度区间,目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。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. When the parameter setting of the target camera is switched from the brightness interval before 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. The target brightness interval and the first brightness interval do not cross brightness intervals, which can avoid adjusting the display brightness across brightness intervals. As a result, the user's visual perception of the display brightness is relatively small, that is, the display brightness can be adjusted without the user's perception, thereby improving the user experience.
本申请的一个实施例中,所述基于所述第二环境光亮度,确定所述当前帧的亮度区间,得到目标亮度区间,包括:In one embodiment of the present application, determining the brightness range of the current frame based on the second ambient light brightness to obtain the 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 to obtain 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 to obtain a target brightness range;
在所述第二环境光亮度不位于所述第一亮度区间时,判断所述第二环境光亮度是否位于所述第一亮度区间的后一个亮度区间;When the brightness of the second ambient light is not within the first brightness range, determining whether the brightness of the second ambient light is within a brightness range subsequent to the first brightness range;
在所述第二环境光亮度位于所述第一亮度区间的后一个亮度区间时,确定所述第一亮度区间的后一个亮度区间为当前帧的亮度区间,得到目标亮度区间。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 to be the brightness interval of the current frame, and a target brightness interval is obtained.
由以上可见,本实施例的技术方案中,直接基于第一亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。基于第二环境光亮度,依次判断目标亮度区间为第一亮度区间的前一个亮度区间,还是第一亮度区间,还是第一亮度区间的后一个亮度区间,使得目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。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 range of the current frame is determined directly based on the first brightness range. Based on the second ambient light brightness, the target brightness range is sequentially determined to be the brightness range before the first brightness range, the first brightness range, or the brightness range after the first brightness range. This ensures that the target brightness range and the first brightness range do not cross brightness ranges, thus avoiding adjusting the display brightness across brightness ranges. As a result, the user's visual perception of the display brightness is minimal, that is, the display brightness can be adjusted without the user noticing, improving the user experience.
本申请的一个实施例中,所述基于所述目标校准系数和所述目标图像数据,计算所述当前帧的目标环境光亮度,包括:In one embodiment of the present application, 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+BLux=A×R+B
Lux表示所述目标环境光亮度;A表示一个目标校准系数;B表示另一个目标校准系数;R表示所述目标图像数据。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.
第二方面,本申请实施例还提供了一种电子设备,包括:In a second aspect, an embodiment of the present application further provides an electronic device, including:
一个或多个处理器和存储器;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 code, where the computer program code includes computer instructions. The one or more processors call the computer instructions to enable the electronic device to execute the above-mentioned display screen brightness adjustment method.
第三方面,本申请实施例还提供了一种计算机可读存储介质,包括计算机程序,当所述计算机程序在电子设备上运行时,使得所述电子设备执行上述显示屏亮度调节方法。In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, comprising a computer program, which, when executed on an electronic device, enables the electronic device to execute the above-mentioned display screen brightness adjustment method.
第四方面,本申请实施例还提供了一种计算机程序产品,所述计算机程序产品包含可执行指令,当所述可执行指令在电子设备上执行时,使得电子设备执行上述显示屏亮度调节方法。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.
第五方面,本申请实施例还提供了一种芯片系统,所述芯片系统应用于电子设备,所述芯片系统包括一个或多个处理器,所述处理器用于调用计算机指令以使得所述电子设备将数据输入芯片系统,并执行上述显示屏亮度调节方法对数据进行处理后输出处理结果。In a fifth aspect, an embodiment of the present application further provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, which are used to call computer instructions so that the electronic device inputs data into the chip system, and executes the above-mentioned display brightness adjustment method to process the data and output the processing results.
上述第二方面、第三方面、第四方面以及第五方面中各实施例所提供方案的有益效果可参见上述第一方面中各实施例所提供方案的有益效果。The beneficial effects of the solutions provided by the embodiments in the second, third, fourth and fifth aspects can be referred to the beneficial effects of the solutions provided by the embodiments in the first aspect.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. 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 any creative work.
图1为本申请实施例提供的一种电子设备的结构图;FIG1 is a structural diagram of an electronic device provided in an embodiment of the present application;
图2为本申请实施例提供的一种电子设备的软件结构框图;FIG2 is a software structure block diagram of an electronic device provided in an embodiment of the present application;
图3为本申请实施例提供的第一种环境光亮度对比图;FIG3 is a first ambient light brightness comparison diagram provided in an embodiment of the present application;
图4为本申请实施例提供的第一种显示屏亮度的调节方法的流程图;FIG4 is a flow chart of a first method for adjusting display screen brightness provided in an embodiment of the present application;
图5为本申请实施例提供的第二种显示屏亮度的调节方法的流程图;FIG5 is a flow chart of a second method for adjusting display screen brightness provided in an embodiment of the present application;
图6为本申请实施例提供的第一种亮度区间的示意图;FIG6 is a schematic diagram of a first brightness range provided in an embodiment of the present application;
图7为本申请实施例提供的第三种显示屏亮度的调节方法的流程图;FIG7 is a flow chart of a third method for adjusting display screen brightness provided in an embodiment of the present application;
图8为本申请实施例提供的第二种亮度区间的示意图;FIG8 is a schematic diagram of a second brightness range provided in an embodiment of the present application;
图9为本申请实施例提供的第四种显示屏亮度的调节方法的流程图;FIG9 is a flowchart of a fourth method for adjusting display screen brightness provided in an embodiment of the present application;
图10为本申请实施例提供的第五种显示屏亮度的调节方法的流程图;FIG10 is a flowchart of a fifth method for adjusting display screen brightness provided in an embodiment of the present application;
图11为本申请实施例提供的第六种显示屏亮度的调节方法的流程图;FIG11 is a flowchart of a sixth method for adjusting display screen brightness provided in an embodiment of the present application;
图12为本申请实施例提供的第七种显示屏亮度的调节方法的流程图;FIG12 is a flow chart of a seventh method for adjusting display screen brightness provided in an embodiment of the present application;
图13为本申请实施例提供的一种灭屏关闭前置摄像头环境光检测功能的方法的流程图;FIG13 is a flow chart of a method for turning off the screen and disabling the ambient light detection function of the front camera provided by an embodiment of the present application;
图14为本申请实施例提供的另一种灭屏关闭前置摄像头环境光检测功能的方法的流程图;FIG14 is a flowchart of another method for turning off the screen and disabling the ambient light detection function of the front camera provided by an embodiment of the present application;
图15为本申请实施例提供的第一种环境光检测功能的管理方法的流程图;FIG15 is a flowchart of a first method for managing an ambient light detection function provided by an embodiment of the present application;
图16为本申请实施例提供的第二种环境光检测功能的管理方法的流程图;FIG16 is a flowchart of a second method for managing an ambient light detection function provided by an embodiment of the present application;
图17为本申请实施例提供的第三种环境光检测功能的管理方法的流程图;FIG17 is a flowchart of a third method for managing an ambient light detection function provided by an embodiment of the present application;
图18为本申请实施例提供的第四种环境光检测功能的管理方法的流程图;FIG18 is a flowchart of a fourth method for managing an ambient light detection function provided in an embodiment of the present application;
图19为本申请实施例提供的第五种环境光检测功能的管理方法的流程图;FIG19 is a flowchart of a fifth method for managing an ambient light detection function provided in an embodiment of the present application;
图20为本申请实施例提供的第六种环境光检测功能的管理方法的流程图;FIG20 is a flowchart of a sixth method for managing an ambient light detection function provided in an embodiment of the present application;
图21为本申请实施例提供的一种电子设备的性能优化逻辑框图;FIG21 is a logic block diagram of performance optimization of an electronic device provided by an embodiment of the present application;
图22为本申请实施例提供的一种环境光亮度确定方法的流程图;FIG22 is a flow chart of a method for determining ambient light brightness provided in an embodiment of the present application;
图23为本申请实施例提供的第二种环境光亮度对比图;FIG23 is a second ambient light brightness comparison diagram provided in an embodiment of the present application;
图24为本申请实施例提供的第三种环境光亮度对比图;FIG24 is a third ambient light brightness comparison diagram provided in an embodiment of the present application;
图25为本申请实施例提供的一种芯片系统的结构图。Figure 25 is a structural diagram of a chip system provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。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.
为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。例如,第一指令和第二指令是为了区分不同的用户指令,并不对其先后顺序进行限定。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。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, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first instruction and the second instruction are intended to distinguish different user instructions and do not limit their order. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
需要说明的是,本申请中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。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 in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.
本申请实施例提供的显示屏亮度的调节方法应用于电子设备。上述电子设备可以是手机、平板电脑、个人电脑(Personal Computer,PC)、车载电脑、个人数字助理(PersonalDigital Assistant,PDA)、智能手表、上网本、可穿戴设备、增强现实技术(AugmentedReality,AR)设备、虚拟现实(Virtual Reality,VR)设备、机器人、智能电视等配备摄像头和显示屏的电子设备。The display brightness adjustment method provided in the embodiments 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 displays.
示例性的,图1示出了电子设备100的结构示意图。电子设备100可以包括处理器110、内部存储器121、摄像头193、显示屏194等。处理器110可以包括一个或多个处理单元,例如,处理器110可以包括应用处理器(Application Processor,AP)、调制解调处理器、图形处理器(Graphics Processing Unit,GPU)、图像信号处理器(Image Signal Processor,ISP)、控制器、视频编解码器、数字信号处理器(Digital Signal Processor,DSP)、基带处理器、和/或神经网络处理器(Neural-network Processing Unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。For example, FIG1 shows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an internal memory 121, a camera 193, a display screen 194, and the like. 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). Different processing units may be independent devices or integrated into one or more processors.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。当处理器110需要再次使用该指令或数据,可从该存储器中直接调用,避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. When processor 110 needs to use the same instruction or data again, it can directly access the memory, avoiding repeated accesses and reducing processor 110 latency, thereby improving system efficiency.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(Inter-Integrated Circuit,I2C)接口、集成电路内置音频(Inter-Integrated CircuitSound,I2S)接口、脉冲编码调制(Pulse Code Modulation,PCM)接口、通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口、移动产业处理器接口(Mobile Industry Processor Interface,MIPI)、通用输入输出(General-PurposeInput/Output,GPIO)接口、用户标识模块(Subscriber Identity Module,SIM接口)、和/或通用串行总线(Universal Serial Bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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.
内部存储器121可以用于存储计算机可执行程序代码,该可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据、电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、通用闪存存储器(Universal Flash Storage,UFS)等。处理器110通过运行存储在内部存储器121的指令和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can 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 can 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.
电子设备100可以通过GPU、显示屏194以及应用处理器等实现显示功能。其中,GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。显示屏194用于显示图像、视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)、有源矩阵有机发光二极体或主动矩阵有机发光二极体(Active-Matrix OrganicLight Emitting Diode,AMOLED)、柔性发光二极管(Flex Light-Emitting Diode,FLED)、Miniled、MicroLed,Micro-oLed、量子点发光二极管(Quantum Dot Light EmittingDiodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The electronic device 100 can implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing that 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 that 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 be 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), a mini-LED, a micro-LED, a micro-o-LED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
电子设备100可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。其中,ISP用于处理摄像头193反馈的数据。例如,拍照时打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点、亮度、肤色进行算法优化。ISP还可以对拍摄场景的曝光、色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(Charge Coupled Device,CCD)或互补金属氧化物半导体(Complementary Metal-Oxide-Semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB、YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The electronic device 100 can implement a shooting function through an ISP, camera 193, a video codec, a GPU, a display 194, and an application processor. The ISP is used to process data fed back by the camera 193. For example, when the shutter is opened to take a photo, light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and transformed into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be installed in the camera 193. The camera 193 is used to capture still images or videos. An object is projected onto the photosensitive element through the lens, which 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, which is then passed to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the 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 one or N cameras 193 , where N is a positive integer greater than one.
在一些实施例中,电子设备100还可以包括外部存储器接口120、通用串行总线(Universal Serial Bus,USB)接口130、充电管理模块140、电源管理模块141、电池142、天线1、天线2、移动通信模块150、无线通信模块160、音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D、传感器模块180、按键190、马达191、指示器192以及用户标识模块卡接口195。其中,传感器模块180可以包括压力传感器180A、陀螺仪传感器180B、气压传感器180C、磁传感器180D、加速度传感器180E、距离传感器180F、接近光传感器180G、指纹传感器180H、温度传感器180J、触摸传感器180K、骨传导传感器180M等。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. 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, and the like.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如,将音乐、视频等文件保存在外部存储卡中。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 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored on the external memory card.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口、Micro USB接口、USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电;也可以用于电子设备100与外围设备之间传输数据;也可以用于连接耳机,通过耳机播放音频;还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with USB standards and specifications, and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100; can also be used to transfer data between the electronic device 100 and peripheral devices; can also be used to connect headphones to play audio through the headphones; and can also be used to connect other electronic devices, such as AR devices.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.
电源管理模块141用于连接电池142、充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110、内部存储器121、显示屏194、摄像头193、无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。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 provides power to the processor 110, the internal memory 121, the display 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 count, and battery health status (leakage, impedance). 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.
电子设备100的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调处理器以及基带处理器等实现。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.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如,可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。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 antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器、开关、功率放大器、低噪声放大器(Low Noise Amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波、放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。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 (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and perform filtering, amplification, and other processing on 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.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(WirelessLocal Area Networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi网络)、蓝牙(Bluetooth,BT)、全球导航卫星系统(Global Navigation Satellite System,GNSS)、调频(Frequency Modulation,FM)、近距离无线通信技术(Near Field Communication,NFC)、红外技术(Infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless communication solutions applied to the electronic device 100, 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 (NFC), infrared technology (IR), etc. 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, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(Global System for Mobile communications,GSM)、通用分组无线服务(General Packet Radio Dervice,GPRS)、码分多址接入(CodeDivision Multiple Access,CDMA)、宽带码分多址(Wideband Code Division MultipleAccess,WCDMA)、时分码分多址(Time-Division Code Division Multiple Access,TD-SCDMA)、长期演进(Long Term Evolution,LTE)、BT、GNSS、WLAN、NFC、FM和/或IR技术等。所述GNSS可以包括全球卫星定位系统(Global Positioning System,GPS)、全球导航卫星系统(Global Navigation Satellite System,GLONASS)、北斗卫星导航系统(BeidouNavigation Satellite System,BDS)、准天顶卫星系统(Quasi-Zenith SatelliteSystem,QZSS)和/或星基增强系统(Satellite Based Augmentation Systems,SBAS)。In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with a network and other devices via wireless communication technologies. The wireless communication technologies may include Global System for Mobile communications (GSM), General Packet Radio Service (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).
电子设备100可以通过音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件、软件或软件和硬件的组合实现。另外,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It will be understood that the structure illustrated in the embodiments 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 can be implemented in hardware, software, or a combination of software and hardware. In addition, the interface connection relationship between the modules illustrated in the embodiments of the present application is merely 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 from those in the above embodiments, or a combination of multiple interface connection methods.
电子设备100中安装有软件系统,该软件系统可以运行在处理器110上。该软件系统可以为Android系统、Windows系统、IOS系统、鸿蒙系统等,软件系统所采用的架构可以为分层架构、事件驱动架构、微核架构、微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。参见图2,Android系统可以分为四层,从上至下分别为应用程序层、框架层(Framework,FWK)、硬件抽象层(HardwareAbstraction Layer,HAL)以及内核层。A software system is installed in the electronic device 100, and the software system can run on the processor 110. The software system can be an Android system, a Windows system, an IOS system, a Hongmeng system, etc., and the architecture adopted by the software system can be a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice 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. Referring to Figure 2, the Android system can be divided into four layers, from top to bottom, respectively, the application layer, the framework layer (Framework, FWK), the hardware abstraction layer (HAL) and the kernel layer.
其中,应用程序层可以包括一系列应用程序,例如,相机、日历、地图、WLAN、音乐、短信息、图库、通话、环境光检测、人脸解锁等应用,用于与用户直接进行交互。这些应用可以是系统内置的应用,也可以是非系统级的应用。且这些应用可以具有图标和应用界面,也可以不具有图标而具有应用界面,还可以不具有图标和应用界面。The application layer can include a range of applications, such as camera, calendar, map, WLAN, music, short message, gallery, call, ambient light detection, face unlock, etc., for direct interaction with the user. These applications can be built-in system applications or non-system applications. These applications can have icons and application interfaces, or they can have application interfaces without icons, or they can have neither icons nor application interfaces.
框架层包括一些预先定义的函数,可为应用程序层的应用提供应用编程接口(Application Programming Interface,API)和编程框架。框架层提供的应用编程接口可以包括相机服务相关的接口、传感器服务相关的接口,以及其他服务相关的接口。不同服务相关的接口可以定义为不同的服务模块,例如,传感器服务相关的接口可以定义为传感器服务模块、相机服务相关的接口可以定义为相机服务模块、其他服务相关的接口可以定义为其他服务模块(图中并未示出)等。其中,传感器服务模块可以包括传感器管理(SensorManager)、传感器服务(SensorService)等子模块。SensorManager用于根据检测的环境光亮度,调节电子设备的显示屏亮度。SensorService用于实现应用程序层中需要调用传感器的相关应用与Sensor HAL间的通信。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.
在一些实施例中,传感器服务模块可以作为一个独立的进程,SensorManager和SensorService可以是该进程中的两个线程。In some embodiments, the sensor service module may be an independent process, and the SensorManager and SensorService may be two threads in the process.
相机服务模块包括I相机服务(ICameraService)、相机服务(CameraService)等子模块。CameraService可用于实现应用程序层中需要调用摄像头的应用(例如,相机应用、人脸解锁应用、环境光检测应用等)与Camera HAL间的通信。在一些实施例中,相机服务模块可以作为一个独立的进程,ICameraService和CameraService可以是该进程中的两个线程。电子设备设置有包括多个摄像头,多个摄像头无法同时使能,且同一摄像头的不同功能间也无法同时使能。在将前置摄像头替代环境光检测器件使用时,为解决多个摄像头不同功能的使能优先级问题,本申请实施例对相机服务模块中的CameraService进行了修改,增加了摄像头的不同功能的使能优先级的判断逻辑,从而在两种及两种以上摄像头功能需要同时使能时,能够根据该判断逻辑择一进行使能。The camera service module includes sub-modules such as ICameraService and CameraService. CameraService can be used to implement communication between applications in the application layer that need to call the camera (for example, camera applications, face unlocking applications, ambient light detection applications, etc.) and Camera HAL. In some embodiments, the camera service module can be an independent process, and ICameraService and CameraService can be two threads in the process. The electronic device is provided with multiple cameras, and 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.
硬件抽象层位于框架层和内核层之间,其目的在于将硬件抽象化。硬件抽象层隐藏了特定平台的硬件接口细节,为软件系统提供虚拟硬件平台,使其具有硬件无关性,可在多种平台上进行移植。根据所实现的功能,硬件抽象层可以进一步细化为相机相关的硬件抽象层(即后续实施例中所述的Camera HAL)、传感器相关的硬件抽象层(即后续实施例所述的Sensor HAL)等。相机相关的硬件抽象层可以定义为相机控制模块,传感器相关的硬件抽象层可以定义为传感器控制模块。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. Depending on 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.
在一些实施例中,相机控制模块可以作为一个独立的进程,传感器控制模块也可以作为一个独立的进程。为实现前置摄像头的环境光检测功能,本申请实施例对传感器控制模块(Sensor HAL)进行了修改。具体来说,在传感器控制模块中增加了环境光业务控制子模块(即后续实施例中所述的CameraLightManager),该环境光业务控制子模块提供了多个接口,包括激活(Active)接口、去激活(DeActive)接口等。其中,Active接口用于打开前置摄像头的环境光检测功能。DeActive接口用于关闭前置摄像头的环境光检测功能。In some embodiments, the camera control module can be an independent process, and the sensor control module can also be 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 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.
本申请实施例还对相机控制模块(Camera HAL)进行了修改。具体来说,在相机控制模块中增加了相机功能定制子模块(即后续实施例中所述的CamxLightCustom),并对相机控制模块中已有的功能子模块(例如,相机硬件接口-相机开发包(Camera HardwareInterface-Camera Development Kit,CHI-CDK)、CAMX等)进行修改。其中,相机功能定制子模块用于在前置摄像头作为环境光检测器件使用时,获取前置摄像头检测的环境光亮度,并将前置摄像头检测的环境光亮度发送给传感器控制模块,以便于传感器控制模块将环境光亮度上报给传感器服务模块,从而调节电子设备的显示屏亮度。CHI-CDK为可定制化的代码实现集合,本申请实施例在CHI-CDK原有的代码实现集合基础上,增加了AIDL(AndroidInterface Definition Language,安卓接口定义语言)服务初始化相关的代码,使得电子设备内的不同进程(例如Sensor HAL和Camera HAL)之间可进行通信。其中,AIDL用于定义Android系统基于回形针(Binder)通信的客户端与服务端之间的接口。Binder是Android系统的一种跨进程通信机制,它允许不同进程间进行通信,甚至可以跨设备进行通信。CAMX为通用功能性接口的代码实现集合,本申请实施例在CAMX中原有的代码实现集合基础上,对其中的第一函数(即打开相机(Open Camera)函数)进行修改,增加了可以跳过为前置摄像头配置出图资源的逻辑分支,从而在将前置摄像头作为环境光检测器件使用时,可以跳过为前置摄像头配置出图资源的流程,降低前置摄像头的功耗,提升电子设备的性能。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 (for example, 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 brightness of the display screen 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 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 code implementation set of a general functional interface. Based on the original code implementation set 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 the output resources for the front camera. Therefore, when the front camera is used as an ambient light detection device, the process of configuring the 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.
内核层是硬件和软件之间的层。内核层可以包括显示驱动、摄像头驱动、音频驱动、传感器驱动等,通过这些驱动可以驱动显示屏、前/后置摄像头、音频播放器、传感器等。The kernel layer is the layer between hardware and software. The kernel layer may include display drivers, camera drivers, audio drivers, sensor drivers, etc. These drivers can drive the display screen, front/rear cameras, audio players, sensors, etc.
以下对本申请实施例提供的显示屏亮度调节方法的应用场景进行介绍。The following describes the application scenarios of the display screen brightness adjustment method provided in the embodiments of the present application.
在现代生活中,智能手机、平板电脑、笔记本电脑等电子设备已成为人们生活中必不可少的物品,为满足用户在不同光线场景下的使用需求,电子设备提供了自动调节亮度功能。电子设备亮屏后,可以通过内置的环境光检测器件,检测环境光亮度,进而基于环境光检测器件检测的环境光亮度,调节电子设备的显示屏亮度,从而在不同的照明条件下使用户具有良好的观看体验。In modern life, electronic devices such as smartphones, tablets, and laptops have become indispensable. To meet user needs in varying lighting scenarios, these devices offer automatic brightness adjustment. When the screen is on, the device uses a built-in ambient light sensor to detect the ambient light level. Based on this, the device adjusts the display brightness, ensuring a pleasant viewing experience in varying lighting conditions.
上述方式虽然能够调节显示屏亮度,但是需要额外配置一个环境光检测器件,增加了电子设备的成本。考虑到目前电子设备都配置有摄像头,而摄像头大都具有光源检测功能,当将支持普通模式(即拍照模式)的摄像头作为环境光检测器件使用时,支持普通模式的摄像头功耗较高,降低了电子设备的性能。随着科技的发展,摄像头可以支持多种模式,包括普通模式、环境光传感器(Ambient Light Sensor mode,ALS)模式、超低功耗(Ultra Low Power,ULP)模式等,这使得摄像头作为环境光检测器件使用成为可能。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 all equipped with cameras, and most cameras have light source detection functions, 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 (ALS) mode, ultra low power (ULP) mode, etc., which makes it possible to use cameras as ambient light detection devices.
鉴于此,将目标摄像头替代环境光检测器件检测环境光亮度,进而基于目标摄像头检测的环境光亮度,调节显示屏亮度的方法。该目标摄像头具有环境光检测功能和图像采集功能,可以为电子设备的前置摄像头,也可以电子设备的后置摄像头。考虑到显示屏设置于电子设备的上表面,前置摄像头也设置电子设备的上表面,与显示屏位于同一侧,而电子设备不同侧的环境光亮度是有一定的差异的,为使调节后的显示屏亮度更符合当前环境,本申请以目标摄像头为前置摄像头为例进行说明。In view of this, a method is proposed in which a target camera replaces an ambient light detection device to detect ambient light brightness, and then adjusts 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 set on the upper surface of the electronic device, the front camera is also set 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 takes the target camera as the front camera as an example for explanation.
在不同的环境光亮度下,设置不同的计算公式,计算公式包含后续实施例中的校准系数,计算公式用于计算对应的环境光亮度。如果针对不同的环境光亮度使用相同的计算公式,会导致计算出的环境光亮度不准确。相应的,在通过目标摄像头检测环境光亮时,确定目标摄像头采集的原始图像数据(Raw data)所属的亮度范围,并使用的Raw data所属的亮度范围对应的计算公式,计算环境光亮度。Different calculation formulas are set for different ambient light brightnesses. The calculation formulas include the calibration coefficients described in subsequent embodiments and 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 detecting the ambient light through the target camera, the brightness range of the raw image data (Raw data) collected by the target camera is determined, and the calculation formula corresponding to the brightness range of the Raw data is used to calculate the ambient light brightness.
然而,不同的Raw data所属的亮度范围存在重叠区域,则在计算环境光亮度时,可能会选择不合适的计算公式,导致确定的环境光亮度的准确性较低,进而导致显示屏亮度的调整不线性,例如,将电子设备的显示屏亮度从较低的亮度直接调整为较高的亮度,使得用户在视觉上感受到显示屏亮度变化较大,影响用户体验。However, if the brightness ranges of different Raw data overlap, an inappropriate formula may be selected when calculating the ambient light brightness, resulting in low accuracy in the determined ambient light brightness and, in turn, non-linear adjustment of the display brightness. For example, directly adjusting the display brightness of an electronic device from a lower brightness to a higher brightness causes the user to visually perceive a large change in the display brightness, affecting the user experience.
示例性的,参见表1,表1为本申请实施例一种环境光亮度对比表。For example, see Table 1, which is an ambient light brightness comparison table of an embodiment of the present application.
表1Table 1
Raw data为原始图像数据。目标摄像头采集的光信号转换为电信号,得到各个像素点的数字信号,基于各个像素点的数字信号,得到输出的Raw data。Index1、Index2和Index3分别对应不同的亮度区间,例如,Index1对应低亮度区间、Index2对应中亮度区间,Index3对应高亮度区间。Index1、Index2和Index3对应的数据为针对同一个Raw data,使用对应亮度区间对应的计算公式得到的环境光亮度,其中环境光亮度的单位为勒克斯(lux)。Raw data is the original image data. The light signal captured by the target camera is converted into an electrical signal, resulting in a digital signal for each pixel. Based on these digital signals, the output raw data is generated. Index1, Index2, and Index3 correspond to different brightness ranges. For example, Index1 corresponds to the low brightness range, Index2 to the medium brightness range, and Index3 to the high brightness range. The data corresponding to Index1, Index2, and Index3 is the ambient light brightness calculated for the same raw data using the calculation formula corresponding to the brightness range. The unit of ambient light brightness is lux.
参见图3,图3为基于表1得到的环境光亮度对比图。带原点的折线为Raw data与使用低亮度区间对应的计算公式得到的环境光亮度的对应关系。带三角形的折线为Raw data与使用中亮度区间对应的计算公式得到的环境光亮度的对应关系。带正方形的折线为Rawdata与使用高亮度区间对应的计算公式得到的环境光亮度的对应关系。See Figure 3, which shows a comparison chart of ambient light brightness based on Table 1. The line with the origin represents the relationship between the raw data and the ambient light brightness calculated using the formula corresponding to the low brightness range. The line with triangles represents the relationship between the raw data and the ambient light brightness calculated using the formula corresponding to the medium brightness range. The line with squares represents the relationship between the raw data and the ambient light brightness calculated using the formula corresponding to the high brightness range.
基于上述表1和上述图3可以得到,针对同一Raw data,使用不同的计算公式,计算得到的环境光亮度差别较大。例如,Raw data为777.1时,使用低亮度区间对应的计算公式得到的环境光亮度为500,而使用中亮度区间对应的计算公式得到的环境光亮度为2825.614,差异较大。Based on Table 1 and Figure 3, we can see that using different calculation formulas for the same raw data can result in significantly different ambient light brightness. For example, when the raw data is 777.1, the ambient light brightness calculated using the formula corresponding to the low brightness range is 500, while the ambient light brightness calculated using the formula corresponding to the medium brightness range is 2825.614, a significant difference.
为了解决上述问题,采用本申请实施例的方法调节电子设备的显示屏亮度,电子设备基于在前一帧检测到的环境光亮度所属的第一亮度区间,确定当前帧的目标亮度区间,当前帧的目标亮度区间与前一帧检测到的环境光亮度所属的第一亮度区间之间不会跨亮度区间,进而,基于目标亮度区间确定当前帧的目标环境光亮度,可以使得目标环境光亮度位于目标亮度区间,提高确定出的目标环境光亮度的准确性,进而在基于目标环境光亮度对显示屏亮度进行调整时,不会跨亮度区间调整电子设备的显示屏亮度,可以实现使得调节电子设备的显示屏亮度时,显示屏亮度的变化较小,提高用户体验。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.
接下来,通过具体实施例对本申请实施例提供的显示屏亮度的调节方法进行详细说明。本申请的一个实施例中,参见图4,图4为本申请实施例提供的一种显示屏亮度的调节方法的流程图,该方法应用于电子设备,该方法可以包括以下步骤:Next, the method for adjusting the brightness of a display screen provided by an embodiment of the present application is described in detail through a specific embodiment. In one embodiment of the present application, refer to Figure 4, which is a flow chart of a method for adjusting the brightness of a display screen provided by an embodiment of the present application. The method is applied to an electronic device and may include the following steps:
S401:获取电子设备的目标摄像头在前一帧检测的环境光亮度,得到第一环境光亮度。S401: Acquire the ambient light brightness detected by a target camera of an electronic device in a previous frame to obtain a first ambient light brightness.
S402:基于第一环境光亮度所属的第一亮度区间,以及目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。S402: Calculate the second ambient light brightness based on the first brightness interval to which the first ambient light brightness belongs and target image data captured by the target camera in the current frame.
S403:基于第二环境光亮度,确定当前帧的亮度区间,得到目标亮度区间。S403: Determine a brightness range of the current frame based on the second ambient light brightness to obtain a target brightness range.
S404:在预设的亮度区间与校准系数的对应关系中,确定目标亮度区间对应的校准系数,得到目标校准系数。S404: Determine the calibration coefficient corresponding to the target brightness range in the correspondence between the preset brightness ranges and the calibration coefficients to obtain the target calibration coefficient.
其中,上述对应关系中的多个亮度区间按照包含的亮度从低至高的顺序排列。The multiple brightness intervals in the above correspondence are arranged in order from low to high brightness.
S405:基于目标校准系数和目标图像数据,计算当前帧的目标环境光亮度。S405: Calculate the target ambient light brightness of the current frame based on the target calibration coefficient and the target image data.
S406:基于当前帧的目标环境光亮度,调节电子设备的显示屏亮度。S406: Adjusting the brightness of the display screen of the electronic device based on the target ambient light brightness of the current frame.
由以上可见,本实施例的技术方案,基于在前一帧检测到的环境光亮度所属的第一亮度区间,确定当前帧的目标亮度区间,当前帧的目标亮度区间与前一帧检测到的环境光亮度所属的亮度区间之间不会跨亮度区间,进而,基于目标亮度区间确定当前帧的目标环境光亮度,可以使得目标环境光亮度位于目标亮度区间,提高确定出的目标环境光亮度的准确性,进而在基于目标环境光亮度对显示屏亮度进行调整时,不会跨亮度区间调整电子设备的显示屏亮度,可以实现使得调节电子设备的显示屏亮度时,显示屏亮度的变化较小,提高用户体验。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, which can make the target ambient light brightness fall within 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, which can achieve that when the display brightness of the electronic device is adjusted, the display brightness changes less, thereby improving the user experience.
针对步骤S401,目标摄像头可以为电子设备的前置摄像头。With respect to step S401 , the target camera may be a front camera of the electronic device.
电子设备亮屏后,启动环境光检测功能,电子设备将前置摄像头上电,打开前置摄像头的环境光检测功能。其中,电子设备亮屏可以是开机首次亮屏,也可以是开机后的非首次亮屏。如果电子设备处于关机状态,可通过长按电源键,将电子设备开机,从而将显示屏点亮。如果电子设备处于开机状态,可通过触控电源键、采用预设手势(例如双击等)触控显示屏、抬起电子设备等方式,将电子设备的显示屏点亮。电子设备亮屏后,将前置摄像头上电,可以为基于电子设备亮屏,将前置摄像头上电,以对前置摄像头进行初始化,从而打开前置摄像头检测环境光亮度。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 with a preset gesture (such as double-clicking, etc.), lifting the electronic device, etc. 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.
在电子设备亮屏的状态下,通过目标摄像头实时检测环境光亮度,并实时的对显示屏亮度进行调整。相应的,电子设备获取前一帧检测到的环境光亮度,得到第一环境光亮度。前一帧检测到的环境光亮度也就是基于目标摄像头前一帧采集的Raw data计算得到的。When the electronic device's screen 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 a first ambient light brightness. The ambient light brightness detected in the previous frame is calculated based on the raw data captured by the target camera in the previous frame.
针对步骤S402,预先设置了多个亮度区间,多个亮度区间按照包含的亮度从低至高的顺序排列。一种实现方式中,亮度区间包括:低亮度区间、中亮度区间和高亮度区间。例如,低亮度区间为[0,500],中亮度区间为[500,5000],高亮度区间为[5000,10000000]。For step S402, multiple brightness intervals are pre-set and arranged in ascending order of the brightness they contain. 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].
示例性,以下为设置多个亮度区间的超文本标记语言(Hyper Text MarkupLanguage,HTML)文件。For example, the following is a Hyper Text Markup Language (HTML) file for setting multiple brightness intervals.
另一种实现方式中,亮度区间包括:低亮、中亮、高亮和超高亮。例如,低亮度区间为[0,500],中亮度区间为[500,5000],高亮度区间为[5000,10000000],超高亮度区间为[10000000,20000000]。In another implementation, the brightness ranges include 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].
在获取到第一环境光亮度之后,电子设备确定第一环境光亮度所属的亮度区间(称为第一亮度区间),进而,基于第一亮度区间,以及目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。第二环境光亮度为用于确定当前帧的目标环境光亮度的参考环境光亮度。目标图像数据为目标摄像头当前帧采集的Raw data数据。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). Furthermore, based on the first brightness interval and the target image data captured by the target camera in the current frame, the electronic device calculates the second ambient light brightness. 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 captured by the target camera in the current frame.
在一些实施例中,在图4的基础上,参见图5,在步骤S402之前,该方法还可以包括以下:In some embodiments, based on FIG. 4 , referring to FIG. 5 , before step S402 , the method may further include the following:
S407:判断从第一亮度区间的前一个亮度区间至第一亮度区间,是否切换目标摄像头的参数设置。S407: Determine whether the parameter setting of the target camera is switched from the brightness interval before the first brightness interval to the first brightness interval.
相应的,步骤S402可以包括以下步骤:Accordingly, step S402 may include the following steps:
S4021:在从第一亮度区间的前一个亮度区间至第一亮度区间,未切换目标摄像头的参数设置时,在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间的前一个亮度区间对应的校准系数,得到第一校准系数。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.
S4022:基于第一校准系数和目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。S4022: Calculate the second ambient light brightness based on the first calibration coefficient and the target image data captured by the target camera in the current frame.
不同的亮度区间可能对应目标摄像头不同类型的参数设置。参数设置可以包括目标摄像头的增益等参数。Different brightness ranges may correspond to different types of parameter settings for the target camera. The parameter settings may include parameters such as the gain of the target camera.
例如,上述设置亮度区间的HTML文件中,低亮度区间对应一种类型的参数设置,中亮度区间和高亮度区间对应另一种类型的参数设置。其中,低亮度区间对应类型的参数设置为:<settingType>LOW_LUX_SWITCH</settingType>。中亮度区间和高亮度区间对应类型的参数设置为:<settingType>HIGH_LUX_SWITCH</settingType>。For example, in the HTML file for setting brightness ranges, the low brightness range corresponds to one type of parameter setting, while the medium and high brightness ranges correspond to another type of parameter setting. The parameter setting for the low brightness range is: <settingType>LOW_LUX_SWITCH</settingType>. The parameter setting for the medium and high brightness ranges is: <settingType>HIGH_LUX_SWITCH</settingType>.
电子设备可以获取第一亮度区间对应的目标摄像头的参数设置的设置类型(SettingType),以及第一亮度区间的前一个亮度区间对应的目标摄像头的参数设置的SettingType。如果第一亮度区间对应的目标摄像头的参数设置的SettingType与第一亮度区间的前一个亮度区间对应的目标摄像头的参数设置的SettingType不同,则可以确定从第一亮度区间的前一个亮度区间至第一亮度区间切换了目标摄像头的参数设置。如果第一亮度区间对应的目标摄像头的参数设置的SettingType与第一亮度区间的前一个亮度区间对应的目标摄像头的参数设置的SettingType相同,则可以确定从第一亮度区间的前一个亮度区间至第一亮度区间未切换目标摄像头的参数设置。The electronic device can 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.
示例性的,参见图6,环境光亮度的各个亮度区间按照从低至高的顺序依次为:低亮度区间、中亮度区间、高亮度区间和超高亮度区间。其中,低亮度区间对应类型的参数设置为Setting(设置)1,中亮度区间、高亮度区间和超高亮度区间对应类型的参数设置为Setting2。For example, referring to Figure 6, the ambient light brightness ranges are, in ascending order, 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 parameters corresponding to the medium brightness range, high brightness range, and ultra-high brightness range are set to Setting 2.
上一次状态(LastState)表示前一帧的第一环境光亮度所属的第一亮度区间。图6中第一亮度区间为高亮度区间,第一亮度区间的前一个亮度区间为中亮度区间,从第一亮度区间的前一个亮度区间至第一亮度区间未切换目标摄像头的参数设置。The last state (LastState) indicates the first brightness interval to which the first ambient light brightness of the previous frame belongs. In Figure 6, the first brightness interval is a high brightness interval, the brightness interval before the first brightness interval is a medium brightness interval, and the parameter settings of the target camera are not changed from the brightness interval before the first brightness interval to the first brightness interval.
不同的亮度区间可能对应目标摄像头不同类型的参数设置,不同类型的参数设置时目标摄像头的灵敏度不同,检测到的环境光也会存在较大的差异,如果从第一亮度区间的前一个亮度区间至第一亮度区间未切换目标摄像头的参数设置,电子设备可以结合前一个亮度区间,计算第二环境光亮度。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 quite different. If the parameter settings of the target camera are not switched from the brightness interval before the first brightness interval to the first brightness interval, the electronic device may calculate the second ambient light brightness in combination with the previous brightness interval.
相应的,电子设备在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间的前一个亮度区间对应的校准系数(即第一校准系数)。校准系数为计算环境光亮度的计算公式中的校准系数。进而,基于第一校准系数和目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。基于校准系数和图像数据计算环境光亮度的方式可以参考后续实施例的相关介绍。Accordingly, the electronic device determines the calibration coefficient (i.e., the first calibration coefficient) corresponding to the brightness interval before the first brightness interval in the correspondence between the preset brightness intervals and the calibration coefficients. 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 captured by the target camera in the current frame, the second ambient light brightness is calculated. The method of calculating the ambient light brightness based on the calibration coefficient and image data can be referred to the relevant description of the subsequent embodiments.
对应关系中包括不同的亮度区间对应的校准系数。例如,上述设置亮度区间的HTML文件中,低亮度区间对应的校准参数包括:二次系数(quadraticCoefficient)为0.0,线性系数(linearCoefficient)为0.7787,以及常数项(constantTerm)为-105.13。中亮度区间对应的校准参数包括:quadraticCoefficient为0.0,linearCoefficient为4.2828,以及constantTerm为-502.55。高亮度区间对应的校准参数包括:quadraticCoefficient为0.0,linearCoefficient为20,以及constantTerm为-552.55。The corresponding relationship includes calibration coefficients corresponding to different brightness ranges. For example, in the HTML file for setting brightness ranges mentioned above, the calibration parameters corresponding to the low brightness range include: quadraticCoefficient is 0.0, linearCoefficient is 0.7787, and constantTerm is -105.13. The calibration parameters corresponding to the medium brightness range include: quadraticCoefficient is 0.0, linearCoefficient is 4.2828, and constantTerm is -502.55. The calibration parameters corresponding to the high brightness range include: quadraticCoefficient is 0.0, linearCoefficient is 20, and constantTerm is -552.55.
例如,针对图6的实施例,第一亮度区间为高亮度区间,第一亮度区间的前一个亮度区间为中亮度区间。从第一亮度区间的前一个亮度区间至第一亮度区间未切换目标摄像头的参数设置。第一亮度区间的前一个亮度区间对应的第一校准系数包括:quadraticCoefficient为0.0,linearCoefficient为4.2828,以及constantTerm为-502.55。For example, in the embodiment of FIG6 , the first brightness interval is a high brightness interval, and the brightness interval preceding the first brightness interval is a medium brightness interval. The parameter settings of the target camera are not switched from the brightness interval preceding the first brightness interval to the first brightness interval. The first calibration coefficients corresponding to the brightness interval preceding the first brightness interval include a quadraticCoefficient of 0.0, a linearCoefficient of 4.2828, and a constantTerm of -502.55.
由以上可见,本实施例的技术方案中,确定目标摄像头在前一帧检测到的第一环境光亮度所属的第一亮度区间,在从第一亮度区间的前一个亮度区间至第一亮度区间未切换目标摄像头的参数设置时,结合第一亮度区间的前一个亮度区间,确定用于估计当前帧的目标亮度区间的第二环境光亮度。基于第二环境光亮度确定出的目标亮度区间不会一直为较高的亮度区间,可以避免显示屏亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,提高用户体验。并且目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。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 for estimating 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 cannot be reduced to a lower brightness interval after being adjusted to a higher brightness interval (such as 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 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.
在一些实施例中,在图5的基础上,参见图7,在步骤S402可以包括以下步骤:In some embodiments, based on FIG. 5 , referring to FIG. 7 , step S402 may include the following steps:
S4023:在从第一亮度区间的前一个亮度区间至第一亮度区间,切换目标摄像头的参数设置时,在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间对应的校准系数,得到第二校准系数。S4023: When switching the parameter setting of the target camera from the 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.
S4024:基于第二校准系数和目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。S4024: Calculate the second ambient light brightness based on the second calibration coefficient and the target image data captured by the target camera in the current frame.
示例性的,参见图8,环境光亮度的各个亮度区间按照从低至高的顺序依次为:低亮度区间、中亮度区间、高亮度区间和超高亮度区间。其中,低亮度区间对应类型的参数设置为Setting1,中亮度区间、高亮度区间和超高亮度区间对应类型的参数设置为Setting2。For example, as shown in Figure 8, the ambient light brightness ranges are, in ascending order, 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 parameters corresponding to the medium brightness range, high brightness range, and ultra-high brightness range are set to Setting 2.
上一次状态(LastState)表示前一帧的第一环境光亮度所属的第一亮度区间。图8中第一亮度区间为中亮度区间,第一亮度区间的前一个亮度区间为低亮度区间,从第一亮度区间的前一个亮度区间至第一亮度区间切换了目标摄像头的参数设置。The last state (LastState) indicates the first brightness interval to which the first ambient light brightness of the previous frame belongs. In Figure 8, the first brightness interval is a medium brightness interval, and the brightness interval before the first brightness interval is a low brightness interval. The parameter settings of the target camera are switched from the brightness interval before the first brightness interval to the first brightness interval.
不同的亮度区间可能对应目标摄像头不同类型的参数设置,不同类型的参数设置时目标摄像头的灵敏度不同,检测到的环境光也会存在较大的差异,如果从第一亮度区间的前一个亮度区间至第一亮度区间切换了目标摄像头的参数设置,第一亮度区间的前一个亮度区间与第一亮度区间检测到的环境光差异较大,则电子设备无需结合第一亮度区间的前一个亮度区间计算第二环境光亮度。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 quite different. If the parameter setting of the target camera is switched from the brightness interval before the first brightness interval to the first brightness interval, and the ambient light detected between the brightness interval before the first brightness interval and the first brightness interval is quite different, the electronic device does not need to calculate the second ambient light brightness in combination with the brightness interval before the first brightness interval.
相应的,电子设备在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间对应的校准系数(即第二校准系数)。进而,基于第二校准系数和目标摄像头在当前帧采集的目标图像数据,计算第二环境光亮度。Accordingly, the electronic device determines the calibration coefficient (i.e., the second calibration coefficient) corresponding to the first brightness interval in the preset correspondence between the 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 captured by the target camera in the current frame.
例如,针对图8的实施例,第一亮度区间为中亮度区间,第一亮度区间对应的第一校准系数包括:quadraticCoefficient为0.0,linearCoefficient为4.2828,以及constantTerm为-502.55。For example, in the embodiment of FIG. 8 , the first brightness interval is a medium brightness interval, and the first calibration coefficients corresponding to the first brightness interval include: quadraticCoefficient is 0.0, linearCoefficient is 4.2828, and constantTerm is -502.55.
由以上可见,本实施例的技术方案中,确定目标摄像头在前一帧检测到的第一环境光亮度所属的第一亮度区间,在从第一亮度区间的前一个亮度区间前一个亮度区间至第一亮度区间切换了目标摄像头的参数设置时,直接基于第一亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。后续,基于第二环境光亮度确定目标亮度区间,目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。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. When the parameter setting of the target camera is switched from the brightness interval before 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. The target brightness interval and the first brightness interval do not cross brightness intervals, which can avoid adjusting the display brightness across brightness intervals. As a result, the user's visual perception of the display brightness is relatively small, that is, the display brightness can be adjusted without the user's perception, thereby improving the user experience.
针对步骤S403,目标亮度区间为当前帧的环境光亮度所属的亮度区间。For step S403 , the target brightness range is the brightness range to which the ambient light brightness of the current frame belongs.
在一些实施例中,在未切换目标摄像头的参数设置时,在图5的基础上,参见图9,步骤S403可以包括以下步骤:In some embodiments, when the parameter settings of the target camera are not switched, based on FIG5 , referring to FIG9 , step S403 may include the following steps:
S4031:判断第二环境光亮度是否位于第一亮度区间的前一个亮度区间。S4031: Determine whether the brightness of the second ambient light is in a brightness interval before the first brightness interval.
S4032:在第二环境光亮度位于第一亮度区间的前一个亮度区间时,确定第一亮度区间的前一个亮度区间为当前帧的亮度区间,得到目标亮度区间。S4032: When the brightness of the second ambient light is in a brightness interval preceding the first brightness interval, determine the brightness interval preceding the first brightness interval as the brightness interval of the current frame, and obtain a target brightness interval.
S4033:在第二环境光亮度不位于第一亮度区间的前一个亮度区间时,判断第二环境光亮度是否位于第一亮度区间。S4033: When the brightness of the second ambient light is not in a brightness interval preceding the first brightness interval, determine whether the brightness of the second ambient light is in the first brightness interval.
S4034:在第二环境光亮度位于第一亮度区间时,确定第一亮度区间为当前帧的亮度区间,得到目标亮度区间。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.
在计算得到第二环境光亮度后,为了避免显示屏亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,先判断第二环境光亮度是否位于第一亮度区间的前一个亮度区间。在第二环境光亮度位于第一亮度区间的前一个亮度区间时,确定第一亮度区间的前一个亮度区间为当前帧的目标亮度区间。After calculating the second ambient light brightness, to avoid the problem of the display brightness being unable to be lowered to a lower brightness range after being adjusted to a higher brightness range (such as the ultra-high brightness range), a determination is first made as to whether the second ambient light brightness is within the brightness range preceding the first brightness range. If the second ambient light brightness is within the brightness range preceding the first brightness range, the brightness range preceding the first brightness range is determined as the target brightness range for the current frame.
在第二环境光亮度不位于第一亮度区间的前一个亮度区间时,继续判断第二环境光亮度是否位于第一亮度区间。在第二环境光亮度位于第一亮度区间时,确定第一亮度区间为当前帧的目标亮度区间。When the second ambient light brightness is not in the brightness interval before the first brightness interval, it is further determined whether the second ambient light brightness is in the first brightness interval. When the second ambient light brightness is in the first brightness interval, the first brightness interval is determined as the target brightness interval of the current frame.
示例性的,针对图6的实施例,Lux判断值1为使用中亮度区间(即第一亮度区间的前一个亮度区间)对应的第一校准系数计算得到的第二环境光亮度。电子设备使用Lux判断值1,决策当前帧的目标亮度区间是中亮度区间或者高亮度区间。也就是在Lux判断值1位于中亮度区间时,确定当前帧的目标亮度区间为中亮度区间,在Lux判断值1位于高亮度区间时,确定当前帧的目标亮度区间为高亮度区间。For example, in the embodiment of FIG6 , 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 determine 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; 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.
由以上可见,本实施例的技术方案中,结合第一亮度区间的前一个亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。基于第二环境光亮度确定目标亮度区间为第一亮度区间的前一个亮度区间,还是第一亮度区间,使得目标亮度区间不会一直为较高的亮度区间,可以避免亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,提高用户体验。并且目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整电子设备的显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness for estimating 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 electronic device's display across the brightness interval, so that the user's visual perception of the display brightness change is small, that is, the user can adjust the display brightness without perception, thereby improving the user experience.
在一些实施例中,在第二环境光亮度不位于第一亮度区间时,也就是第二环境光亮度既不位于第一亮度区间的前一个亮度区间,也不位于第一亮度区间。电子设备在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间对应的第二校准系数,并基于第二校准系数和目标图像数据,计算第三环境光亮度。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 brightness interval immediately preceding 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 a preset correspondence between brightness intervals and calibration coefficients, and calculates the third ambient light brightness based on the second calibration coefficient and the target image data.
进而,为了避免显示屏亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,电子设备先判断第三环境光亮度是否位于第一亮度区间。在第三环境光亮度位于第一亮度区间时,确定第一亮度区间为当前帧的目标亮度区间。在第三环境光亮度不位于第一亮度区间时,继续判断第三环境光亮度是否位于第一亮度区间的后一个亮度区间。在第三环境光亮度位于第一亮度区间的后一个亮度区间时,确定第一亮度区间的后一个亮度区间为当前帧的目标亮度区间。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, the electronic device continues to determine whether the third ambient light brightness is within the brightness range after the first brightness range. When the third ambient light brightness is within the brightness range after the first brightness range, the brightness range after the first brightness range is determined to be the target brightness range of the current frame.
示例性的,针对图6的实施例,在Lux判断值1既不位于中亮度区间,也不位于高亮度区间时,确定高亮度区间对应的第二校准系数,并基于第二校准系数和目标图像数据计算第三环境光亮度。图6中的Lux判断值2为使用高亮度区间(第一亮度区间)对应的第二校准系数计算得到的第三环境光亮度。电子设备使用Lux判断值2,决策当前帧的目标亮度区间是高亮度区间或者超高亮度区间。也就是在Lux判断值2位于高亮度区间时,确定当前帧的目标亮度区间为高亮度区间,在Lux判断值2位于超高亮度区间时,确定当前帧的目标亮度区间为超高亮度区间。Exemplarily, for the embodiment of Figure 6, when the Lux judgment value 1 is neither in the medium brightness interval nor in the high brightness interval, the second calibration coefficient corresponding to the high brightness interval is determined, and the third ambient light brightness is calculated based on the second calibration coefficient and the target image data. The Lux judgment value 2 in Figure 6 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.
由以上可见,本实施例的技术方案中,结合第一亮度区间的前一个亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。在第二环境光亮度不位于第一亮度区间的前一个亮度区间,也不位于第一亮度区间时,基于第一亮度区间对应的校准系数确定第三环境光亮度,并基于第三环境光亮度确定目标亮度区间为第一亮度区间,还是第一亮度区间的后一个亮度区间,可以避免亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,提高用户体验。并且目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整电子设备的显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。As can be seen from the above, in the technical solution of this embodiment, the second ambient light brightness for estimating 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 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, which can avoid adjusting the brightness of the electronic device's display screen across the brightness interval, so that the user's visual perception of the display screen brightness change is small, that is, the user can adjust the display screen brightness without perception, thereby improving the user experience.
在一些实施例中,在第三环境光亮度不位于第一亮度区间的后一个亮度区间时,也就是第三环境光亮度既不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间。第三环境光亮度区间可能位于第一亮度区间的前一个亮度区间之前的亮度区间,也可能位于第一亮度区间的后一个亮度区间之后的亮度区间。In some embodiments, when the third ambient light brightness is not in the brightness interval following the first brightness interval, that is, the third ambient light brightness is neither in the first brightness interval nor in the brightness interval following the first brightness interval, the third ambient light brightness interval may be in the brightness interval before the brightness interval preceding the first brightness interval, or may be in the brightness interval after the brightness interval following the first brightness interval.
相应的,电子设备判断第三环境光亮度是否低于第一亮度区间的前一个亮度区间的下限值,在第三环境光亮度低于第一亮度区间的前一个亮度区间的下限值时,表明第三环境光亮度区间位于第一亮度区间的前一个亮度区间之前的亮度区间,为了避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,则确定第一亮度区间的前一个亮度区间为当前帧的目标亮度区间。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 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.
示例性的,针对图6的实施例,在Lux判断值1既不位于中亮度区间,也不位于高亮度区间,且Lux判断值2不位于高亮度区间,也不位于超高亮度区间时,判断Lux判断值2是否低于中亮度区间的下限值。For example, for the embodiment of FIG6 , when the Lux judgment value 1 is neither in the medium brightness range nor in the high brightness range, and the Lux judgment value 2 is neither in the high brightness range nor in the ultra-high brightness range, it is determined whether the Lux judgment value 2 is lower than the lower limit of the medium brightness range.
如果Lux判断值2低于中亮度区间的下限值,表明Lux判断值2位于中亮度区间之前的亮度区间(如低亮度区间),如果确定中亮度区间之前的亮度区间为目标亮度区间,会导致确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而导致跨亮度区间调整显示屏亮度,为了避免上述问题,则确定中亮度区间为目标亮度区间。If the Lux judgment value 2 is lower than the lower limit of the medium brightness interval, it indicates that the Lux judgment value 2 is located in the brightness interval before the medium brightness interval (such as the low brightness interval). If the brightness interval before the medium brightness interval is determined to be the target brightness interval, it will cause the determined target brightness interval and the first brightness interval to cross the 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 medium brightness interval is determined to be the target brightness interval.
由以上可见,本实施例的技术方案,在第三环境光亮度既不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间。在第三环境光亮度低于第一亮度区间的前一个亮度区间的下限值时,表明第三环境光亮度区间位于第一亮度区间的前一个亮度区间之前的亮度区间,确定第一亮度区间的前一个亮度区间为当前帧的目标亮度区间,可以避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,提高用户体验。As can be seen from the above, the technical solution of this embodiment is that when the third ambient light brightness is neither in the first brightness range nor in the brightness range after the first brightness range. When the third ambient light brightness is lower than the lower limit of the brightness range before the first brightness range, it indicates that the third ambient light brightness range is in the brightness range before the brightness range before the first brightness range. The brightness range before the first brightness range is determined as the target brightness range of the current frame. This can avoid the target brightness range and the first brightness range from overlapping brightness ranges, thereby avoiding adjusting the display brightness across brightness ranges, thereby improving the user experience.
在一些实施例中,在第三环境光亮度不低于第一亮度区间的前一个亮度区间的下限值时,也就是第三环境光亮度既不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间,也不位于第一亮度区间的前一个亮度区间之前的亮度区间,则第三环境光亮度可能位于第一亮度区间的后一个亮度区间之后的亮度区间。In some embodiments, when the brightness of the third ambient light is not lower than the lower limit value of the brightness interval before 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 brightness interval before 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.
相应的,电子设备判断第三环境光亮度是否高于第一亮度区间的后一个亮度区间的上限值,在第三环境光亮度高于第一亮度区间的后一个亮度区间的上限值时,表明第三环境光亮度区间位于第一亮度区间的后一个亮度区间之后的亮度区间,为了避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,确定第一亮度区间的后一个亮度区间为当前帧的亮度区间,得到目标亮度区间。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 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.
示例性的,针对图6的实施例,在Lux判断值1既不位于中亮度区间,也不位于高亮度区间,且Lux判断值2不位于高亮度区间,也不位于超高亮度区间,Lux判断值2也不低于中亮度区间的下限值时,判断Lux判断值2是否高于超高亮度区间的上限值。For example, for the embodiment of Figure 6, when the Lux judgment value 1 is neither in the medium brightness range nor in the high brightness range, and the Lux judgment value 2 is neither in the high brightness range nor in the ultra-high brightness range, and the Lux judgment value 2 is not lower than the lower limit of the medium brightness range, it is determined whether the Lux judgment value 2 is higher than the upper limit of the ultra-high brightness range.
如果Lux判断值2高于超高亮度区间的上限值,表明Lux判断值2位于超高亮度区间之后的亮度区间,如果确定超高亮度区间之后的亮度区间为目标亮度区间,会导致确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而导致跨亮度区间调整显示屏亮度,为了避免上述问题,则确定超高亮度区间为目标亮度区间。If the Lux judgment value 2 is higher than the upper limit 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 and the first brightness interval to cross the 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.
由以上可见,本实施例的技术方案,在第三环境光亮度既不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间。在第三环境光亮度高于第一亮度区间的后一个亮度区间的上限值时,表明第三环境光亮度区间位于第一亮度区间的后一个亮度区间之后的亮度区间,确定第一亮度区间的后一个亮度区间为当前帧的目标亮度区间,可以避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,提高用户体验。As can be seen from the above, the technical solution of this embodiment is that when the third ambient light brightness is neither in the first brightness range nor in the brightness range following the first brightness range. When the third ambient light brightness is higher than the upper limit of the brightness range following the first brightness range, it indicates that the third ambient light brightness range is in the brightness range following the brightness range following the first brightness range. The brightness range following the first brightness range is determined as the target brightness range of the current frame. This can avoid the determined target brightness range and the first brightness range from intersecting brightness ranges, thereby avoiding adjusting the display brightness across brightness ranges, thereby improving the user experience.
在一些实施例中,在步骤S407之前,该方法还可以包括以下步骤:判断是否存在第一亮度区间的前一个亮度区间。在存在第一亮度区间的前一个亮度区间时,判断从第一亮度区间的前一个亮度区间至第一亮度区间,是否切换目标摄像头的参数设置。In some embodiments, before step S407, the method may further include the following steps: determining whether there is a brightness interval preceding the first brightness interval. If there is a brightness interval preceding the first brightness interval, determining whether to switch parameter settings of the target camera from the brightness interval preceding the first brightness interval to the first brightness interval.
在确定出前一帧的第一环境光亮度所属的第一亮度区间后,电子设备判断是否存在第一亮度区间的前一个亮度区间,在存在第一亮度区间的前一个亮度区间时,继续判断从第一亮度区间的前一个亮度区间至第一亮度区间,是否切换目标摄像头的参数设置。后续,根据从第一亮度区间的前一个亮度区间至第一亮度区间,是否切换目标摄像头的参数设置,确定是否结合第一亮度区间的前一个亮度区间确定当前帧的目标亮度区间。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 preceding the first brightness interval. If there is a brightness interval preceding the first brightness interval, the electronic device further determines whether to switch parameter settings of the target camera from the brightness interval preceding the first brightness interval to the first brightness interval. Subsequently, based on whether the parameter settings of the target camera are switched from the brightness interval preceding the first brightness interval to the first brightness interval, the electronic device determines whether to determine the target brightness interval for the current frame in combination with the brightness interval preceding the first brightness interval.
在一些实施例中,在判断是否存在第一亮度区间的前一个亮度区间之后,该方法还可以包括以下步骤:在不存在第一亮度区间的前一个亮度区间时,在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间对应的校准系数,得到第二校准系数,并执行基于第二校准系数和目标图像数据,计算第三环境光亮度的步骤。In some embodiments, after determining whether there is a brightness interval before the first brightness interval, the method may further include the following steps: when there is no brightness interval before the first brightness interval, determining the calibration coefficient corresponding to the first brightness interval in the correspondence between the preset brightness interval and the calibration coefficient, obtaining the second calibration coefficient, and executing the step of calculating the third ambient light brightness based on the second calibration coefficient and the target image data.
在判断是否存在第一亮度区间的前一个亮度区间之后,在不存在第一亮度区间的前一个亮度区间时,也就无法结合第一亮度区间的前一个亮度区间确定当前帧的目标亮度区间,电子设备直接在预设的亮度区间与校准系数的对应关系中,确定第一亮度区间对应的第二校准系数,并基于第二校准系数和目标图像数据计算第三环境光亮度。后续,直接基于第三环境光亮度确定目标亮度区间。基于第三环境光亮度确定目标亮度区间的具体方式,参考前述实施例的相关介绍。After determining whether there is a brightness interval preceding the first brightness interval, if there is no brightness interval preceding the first brightness interval, then the target brightness interval for the current frame cannot be determined by combining the brightness interval preceding the first brightness interval with the brightness interval. The electronic device directly determines the second calibration coefficient corresponding to the first brightness interval within the preset correspondence between brightness intervals and calibration coefficients, and calculates the third ambient light brightness based on the second calibration coefficient and the target image data. Subsequently, the target brightness interval is determined directly 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 description of the aforementioned embodiment.
在一些实施例中,在切换了目标摄像头的参数设置时,参见图10,步骤S403可以包括以下步骤:In some embodiments, when the parameter settings of the target camera are switched, referring to FIG. 10 , step S403 may include the following steps:
S4035:判断第二环境光亮度是否位于第一亮度区间的前一个亮度区间。S4035: Determine whether the brightness of the second ambient light is in a brightness interval before the first brightness interval.
S4036:在第二环境光亮度位于第一亮度区间的前一个亮度区间时,确定第一亮度区间的前一个亮度区间为当前帧的亮度区间,得到目标亮度区间。S4036: When the brightness of the second ambient light is in a brightness interval preceding the first brightness interval, determine the brightness interval preceding the first brightness interval as the brightness interval of the current frame, and obtain a target brightness interval.
S4037:在第二环境光亮度不位于第一亮度区间的前一个亮度区间时,判断第二环境光亮度是否位于第一亮度区间。S4037: When the brightness of the second ambient light is not in a brightness interval preceding the first brightness interval, determine whether the brightness of the second ambient light is in the first brightness interval.
S4038:在第二环境光亮度位于第一亮度区间时,确定第一亮度区间为当前帧的亮度区间,得到目标亮度区间。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.
S4039:在第二环境光亮度不位于第一亮度区间时,判断第二环境光亮度是否位于第一亮度区间的后一个亮度区间。S4039: When the brightness of the second ambient light is not within the first brightness range, determine whether the brightness of the second ambient light is within a brightness range subsequent to the first brightness range.
S4040:在第二环境光亮度位于第一亮度区间的后一个亮度区间时,确定第一亮度区间的后一个亮度区间为当前帧的亮度区间,得到目标亮度区间。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.
在计算得到第二环境光亮度后,为了避免显示屏亮度调整至较高的亮度区间(如超高亮度区间后),无法降低至较低的亮度区间的问题,先判断第二环境光亮度是否位于第一亮度区间的前一个亮度区间。在第二环境光亮度位于第一亮度区间的前一个亮度区间时,确定第一亮度区间的前一个亮度区间为当前帧的目标亮度区间。After calculating the second ambient light brightness, to avoid the problem of the display brightness being unable to be lowered to a lower brightness range after being adjusted to a higher brightness range (such as the ultra-high brightness range), a determination is first made as to whether the second ambient light brightness is within the brightness range preceding the first brightness range. If the second ambient light brightness is within the brightness range preceding the first brightness range, the brightness range preceding the first brightness range is determined as the target brightness range for the current frame.
在第二环境光亮度不位于第一亮度区间的前一个亮度区间时,第二环境光亮度可能位于第一亮度区间或者第一亮度区间的后一个亮度区间,则继续判断第二环境光亮度是否位于第一亮度区间。在第二环境光亮度位于第一亮度区间时,确定第一亮度区间为当前帧的目标亮度区间。If the second ambient light brightness is not within the brightness interval preceding the first brightness interval, but may be within the first brightness interval or a brightness interval following the first brightness interval, then the determination of whether the second ambient light brightness is within the first brightness interval is continued. If the second ambient light brightness is within the first brightness interval, the first brightness interval is determined as the target brightness interval for the current frame.
在第二环境光亮度不位于第一亮度区间时,第二环境光亮度可能位于第一亮度区间的后一个亮度区间,继续判断第二环境光亮度是否位于第一亮度区间的后一个亮度区间。在第二环境光亮度位于第一亮度区间的后一个亮度区间时,确定第一亮度区间的后一个亮度区间为当前帧的目标亮度区间。If the second ambient light brightness is not within the first brightness range, the second ambient light brightness may be within a brightness range subsequent to the first brightness range, and further determination is made as to whether the second ambient light brightness is within the brightness range subsequent to the first brightness range. If the second ambient light brightness is within the brightness range subsequent to the first brightness range, the brightness range subsequent to the first brightness range is determined as the target brightness range for the current frame.
示例性的,针对图8的实施例,Lux判断值为使用中亮度区间(即第一亮度区间)对应的第二校准系数计算得到的第二环境光亮度。电子设备使用Lux判断值,决策当前帧的目标亮度区间是低亮度区间、中亮度区间或者高亮度区间。也就是在Lux判断值位于低亮度区间时,确定当前帧的目标亮度区间为低亮度区间,在Lux判断值位于中亮度区间时,确定当前帧的目标亮度区间为中亮度区间,在Lux判断值位于高亮度区间时,确定当前帧的目标亮度区间为高亮度区间。Exemplarily, for the embodiment of FIG8 , 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.
由以上可见,本实施例的技术方案中,直接基于第一亮度区间确定用于估计当前帧的目标亮度区间的第二环境光亮度。基于第二环境光亮度,依次判断目标亮度区间为第一亮度区间的前一个亮度区间,还是第一亮度区间,还是第一亮度区间的后一个亮度区间,使得目标亮度区间与第一亮度区间之间不会跨亮度区间,可以避免跨亮度区间调整显示屏亮度,使得用户在视觉上感受到的显示屏亮度变化较小,即实现用户无感知的调整显示屏亮度,提高用户体验。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 range of the current frame is determined directly based on the first brightness range. Based on the second ambient light brightness, the target brightness range is sequentially determined to be the brightness range before the first brightness range, the first brightness range, or the brightness range after the first brightness range. This ensures that the target brightness range and the first brightness range do not cross brightness ranges, thus avoiding adjusting the display brightness across brightness ranges. As a result, the user's visual perception of the display brightness is minimal, that is, the display brightness can be adjusted without the user noticing, improving the user experience.
在一些实施例中,在切换了目标摄像头的参数设置时,第二环境光亮度为基于第一亮度区间对应的第二校准系数和目标图像数据计算得到的。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.
在第二环境光亮度不位于第一亮度区间的前一个亮度区间,也不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间时,第二环境光亮度区间可能位于第一亮度区间的前一个亮度区间之前的亮度区间,也可能位于第一亮度区间的后一个亮度区间之后的亮度区间。When the second ambient light brightness is not located in the brightness interval before the first brightness interval, nor in the first brightness interval, nor in the brightness interval after the first brightness interval, the second 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.
电子设备判断第二环境光亮度是否低于第一亮度区间的前一个亮度区间的下限值,在第二环境光亮度低于第一亮度区间的前一个亮度区间的下限值时,表明第第二环境光亮度区间位于第一亮度区间的前一个亮度区间之前的亮度区间,为了避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,则确定第一亮度区间的前一个亮度区间为当前帧的目标亮度区间。The electronic device determines whether the brightness of the second ambient light is lower than the lower limit value of the brightness interval before the first brightness interval. When the brightness of the second ambient light is lower than the lower limit value of the brightness interval before the first brightness interval, it indicates that the second ambient light brightness interval is located in the brightness interval before the brightness interval before 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 before the first brightness interval is determined to be the target brightness interval of the current frame.
在第二环境光亮度不低于第一亮度区间的前一个亮度区间的下限值时,也就是第二环境光亮度不位于第一亮度区间的前一个亮度区间,也不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间时,也不位于第一亮度区间的前一个亮度区间之前的亮度区间,则第二环境光亮度可能位于第一亮度区间的后一个亮度区间之后的亮度区间。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 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 second ambient light may be located in the brightness interval after the brightness interval after the first brightness interval.
电子设备判断第二环境光亮度是否高于第一亮度区间的后一个亮度区间的上限值,在第二环境光亮度高于第一亮度区间的后一个亮度区间的上限值时,表明第二环境光亮度区间位于第一亮度区间的后一个亮度区间之后的亮度区间,为了避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,确定第一亮度区间的后一个亮度区间为当前帧的亮度区间,得到目标亮度区间。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.
由以上可见,本实施例的技术方案,在切换了目标摄像头的参数设置时,在第二环境光亮度既不位于第一亮度区间的前一个亮度区间,也不位于第一亮度区间,也不位于第一亮度区间的后一个亮度区间时,在确定第二环境光亮度位于第一亮度区间的前一个亮度区间之前的亮度区间时,确定第一亮度区间的前一个亮度区间为目标亮度区间。在确定第二环境光亮度位于第一亮度区间的后一个亮度区间之后的亮度区间,确定第一亮度区间的后一个亮度区间为目标亮度区间,可以避免确定出的目标亮度区间与第一亮度区间之间跨亮度区间,进而避免跨亮度区间调整显示屏亮度,提高用户体验。As can be seen from the above, the technical solution of this embodiment, when the parameter settings of the target camera are switched, when the second ambient light brightness is neither in the brightness interval before the first brightness interval, nor in the first brightness interval, nor in the brightness interval after the first brightness interval, when it is determined that the second ambient light brightness is in the brightness interval before the brightness interval before the brightness interval before the first brightness interval, the brightness interval before the first brightness interval is determined to be the target brightness interval. When it is determined that the second ambient light brightness is in the brightness interval after the brightness interval after the first brightness interval, the brightness interval after the first brightness interval is determined to be 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 brightness intervals, thereby improving the user experience.
针对步骤S404和步骤S405,在确定出目标亮度区间后,电子设备在亮度区间与校准系数的对应关系中,确定目标亮度区间对应的目标校准系数。进而,基于目标校准系数和目标图像数据,确定当前帧的目标环境光亮度。In 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. Then, based on the target calibration coefficient and the target image data, the target ambient light brightness of the current frame is determined.
在一些实施例中,步骤S405可以包括以下步骤:基于目标校准系数、目标图像数据和预设公式,计算当前帧的目标环境光亮度。其中,预设公式为:In some embodiments, step S405 may include the following steps: calculating the target ambient light brightness of the current frame based on the target calibration coefficient, the target image data, and a preset formula. The preset formula is:
Lux=A×R+B (1)Lux=A×R+B (1)
Lux表示目标环境光亮度;A表示一个目标校准系数;B表示另一个目标校准系数;R表示目标图像数据。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.
示例性的,目标亮度区间为低亮度区间,则上述公式(1)中的一个目标校准系数A为linearCoefficient(即0.7787),另一个目标校准系数B为constantTerm(即-105.13)。目标亮度区间为中亮度区间,则上述公式(1)中的A为4.2828,B为-502.55。目标亮度区间为中亮度区间,则上述公式(1)中的A为20,B为-552.55。For example, if the target brightness range is a low brightness range, then one target calibration coefficient 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 range is a medium brightness range, then A in the above formula (1) is 4.2828 and B is -502.55. If the target brightness range is a medium brightness range, then A in the above formula (1) is 20 and B is -552.55.
针对步骤S405,确定出目标环境光亮度后,电子设备基于当前帧的目标环境光亮度,调节电子设备的显示屏亮度。例如,电子设备可以将目标环境光亮度作为调节后的显示屏亮度。或者,也可以获取电子设备的显示屏的默认亮度,并基于目标环境光亮度,对默认亮度进行调节,得到调节后的显示屏亮度。In step S405, after determining the target ambient light brightness, the electronic device adjusts the brightness of the electronic device's display screen based on the target ambient light brightness of the current frame. For example, the electronic device may use the target ambient light brightness as the adjusted display screen brightness. Alternatively, the electronic device may obtain the default brightness of the electronic device's display screen and adjust the default brightness based on the target ambient light brightness to obtain the adjusted display screen brightness.
在一些实施例中,对于具有上述图2所示的软件系统的电子设备来说,相机服务模块通过向相机控制模块下发指令可以控制前置摄像头的打开和关闭,传感器服务模块通过向传感器控制模块下发指令可以控制环境光检测器件的打开和关闭。当将前置摄像头替代环境光检测器件使用时,前置摄像头的打开和关闭则需要由传感器服务模块下发的指令控制。由于传感器控制模块无法将传感器服务模块下发的指令传递给前置摄像头,而相机控制模块可以将相机服务模块下发的指令传递给前置摄像头,为实现前置摄像头替代环境光检测器件,需要建立传感器控制模块与相机服务模块之间的控制通路,从而借助相机服务模块实现对前置摄像头的控制。本申请实施例HAL层的传感器控制模块可以作为一个独立的进程,FWK层的相机服务模块也可以作为一个独立的进程,因此,在建立HAL层的传感器控制模块与FWK层的相机服务模块之间的控制通路时,可基于硬件接口定义语言(HardwareInterface Definition Language,HIDL)服务进行建立。其中,HIDL用于定义安卓系统基于Binder通信的HAL层与FWK层之间的接口。In some embodiments, for an electronic device having the software system shown in FIG. 2 , 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, while 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. In the embodiment of the present application, the sensor control module of the HAL layer can be an independent process, and the camera service module of the FWK layer can also be 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.
在打通传感器控制模块与相机服务模块的控制通路后,还需要建立传感器控制模块和相机控制模块之间的数据通路,从而在打开前置摄像头的环境光检测功能后,相机控制模块可以将前置摄像头检测的环境光亮度传发送给传感器控制模块,再由传感器控制模块发送给传感器服务模块,从而实现对显示屏亮度的调节。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. Therefore, 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.
对于传感器控制模块和相机控制模块之间数据通路的建立过程,参见图11,本申请实施例提供了一种显示屏亮度的调节方法,该方法可由具有图2所示的软件系统的电子设备100执行,本申请实施例提供的方法流程包括:Regarding the process of establishing a data path between the sensor control module and the camera control module, referring to FIG11 , an embodiment of the present application provides a method for adjusting display brightness. The method can be executed by an electronic device 100 having the software system shown in FIG2 . The method flow provided in the embodiment of the present application includes:
S1101:基于电子设备开机,相机控制模块将AIDL服务初始化。S1101: Based on the electronic device being powered on, the camera control module initializes the AIDL service.
在本申请实施例中,相机控制模块(即Camera HAL)可以作为一个独立的进程,该独立进程可以定义为相机控制进程,相机控制模块包括的子模块(比如CHI-CDK、CAMX、CamxLightCustom等)可以是相机控制进程中的不同线程。AIDL服务初始化可以是将AIDL服务拉起的过程。通过将AIDL服务初始化,可以实现基于AIDL服务的客户端和服务端之间的通信。AIDL服务初始化可以在相机控制模块中执行,具体地,可以在相机控制模块的CHI-CDK中执行。AIDL服务可以在电子设备开机过程中进行初始化,也可以在开机后基于AIDL服务的客户端和服务端需要通信时进行初始化,本申请实施例不对AIDL服务初始化的时机进行限定。AIDL服务初始化的过程可以对应图12中的步骤①,参见图12,电子设备开机时,将Camera HAL的CHI-CDK中的AIDL服务初始化,可以是将AIDL服务拉起。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. 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 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 startup when the client and 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 step ① in Figure 12. Referring to Figure 12, when the electronic device is powered on, the AIDL service in the CHI-CDK of the Camera HAL is initialized, which can be to pull up the AIDL service.
在一些实施例中,AIDL服务初始化过程可以采用如下代码实现:In some embodiments, the AIDL service initialization process can be implemented using the following code:
CamLightAidlImpl::GetInstance()->Init(…)。CamLightAidlImpl::GetInstance()->Init(…).
S1102:传感器服务模块向传感器控制模块发送亮度监听指令。S1102: The sensor service module sends a brightness monitoring instruction to the sensor control module.
在本申请实施例中,传感器服务模块(即SensorService)可以作为一个独立的进程,该独立的进程可以定义为传感器服务进程,传感器服务模块包括的子模块(比如SensorManager、SensorService等)可以是该传感器服务进程中的线程。传感器控制模块(即Sensor HAL)也可以作为一个独立的进程,该独立的进程可以定义为传感器控制进程,传感器控制模块包括的子模块(比如CameraLightManager等)可以是该传感器控制进程中的线程。In the embodiments of the present application, the sensor service module (i.e., SensorService) can be an independent process, which can be defined as the sensor service process. The submodules included in the sensor service module (such as SensorManager, SensorService, etc.) can be threads in the sensor service process. The sensor control module (i.e., Sensor HAL) can also be an independent process, which can be defined as the sensor control process. The submodules included in the sensor control module (such as CameraLightManager, etc.) can be threads in the sensor control process.
电子设备开机后,应用程序层中环境光检测应用向传感器服务模块发送亮屏消息,该亮屏消息可以包括环境光检测应用的包名,该亮屏消息用于指示传感器服务模块调节电子设备显示屏亮度。当接收到该亮屏消息后,传感器服务模块向传感器控制模块发送亮度监听指令。该亮度监听指令用于指示传感器控制模块获取环境光亮度。亮度监听指令可以为回调函数形式,从而在传感器控制模块获取到环境光亮度后,能够将获取的环境光亮度返回给传感器服务模块。After the electronic device is powered on, the ambient light detection application in the application layer sends a screen-on message to the sensor service module. This screen-on message may include the package name of the ambient light detection application. This screen-on message is used to instruct the sensor service module to adjust the brightness of the electronic device's display screen. Upon receiving this screen-on message, the sensor service module sends a brightness monitoring instruction to the sensor control module. This 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.
在一些实施例中,传感器服务模块向传感器控制模块发送亮度监听指令可以为:传感器服务进程向传感器控制进程发送亮度监听指令。参见图12,传感器服务模块向传感器控制模块发送亮度监听指令具体可以是,FWK层中的SensorManager基于应用程序层中环境光检测应用发送的亮屏消息,生成亮度监听指令,并通过SensorService将该亮度监听指令发送给HAL层中的Sensor HAL。In some embodiments, the sensor service module sending the brightness monitoring instruction to the sensor control module may be: the sensor service process sends the brightness monitoring instruction to the sensor control process. Referring to Figure 12, the sensor service module sending the brightness monitoring instruction to the sensor control module may be: the SensorManager in the FWK layer generates the 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.
S1103:在接收到亮度监听指令后,传感器控制模块调用基于AIDL服务的第一接口,在相机控制模块中注册数据回调函数。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.
在接收到亮度监听指令后,传感器控制模块调用基于AIDL服务的第一接口,在相机控制模块中注册数据回调函数,可以是基于亮度监听指令,传感器控制模块调用第一接口,在相机控制模块中注册数据回调函数,还可以是响应于亮度监听指令,传感器控制模块调用第一接口,在相机控制模块中注册数据回调函数。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.
在计算机领域,AIDL服务用于实现不同进程之间的通信。对于基于AIDL服务通信的两个进程来说,一个进程用于产生数据,可以作为AIDL服务端;另一个进程用于发出控制指令和接收数据,可以作为AIDL客户端。在本申请实施例中,当将前置摄像头替代环境光检测器件使用时,相机控制模块(Camera HAL)用于提供环境光亮度,且可以作为一个独立进程,因此,可以看作AIDL服务端(后续实施例中简称为服务端);传感器控制模块(SensorHAL)用于接收环境光亮度,因此,可以看作AIDL客户端(后续实施例中简称为客户端)。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 a server in subsequent embodiments); the sensor control module (SensorHAL) is used to receive ambient light brightness and can be regarded as an AIDL client (referred to as a client in subsequent embodiments).
其中,第一接口可以为Active接口。Active接口用于打开前置摄像头的环境光检测功能。当传感器控制模块调用Active接口打开前置摄像头的环境光检测功能后,传感器控制模块可以调用Active接口,在相机控制模块中注册数据回调函数,相机控制模块通过该数据回调函数,可以将前置摄像头检测的环境光亮度发送给传感器控制模块,从而打通了相机控制模块和传感器控制模块之间的数据通路,使得前置摄像头替代环境光器件成为可能。The first interface may be an Active interface. The Active interface is used to enable the ambient light detection function of the front camera. After the sensor control module calls the Active interface to enable the ambient light detection function of the front camera, the sensor control module may call the Active interface to register a data callback function in the camera control module. The camera control module may use the data callback function to 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.
在本申请实施例中,传感器控制模块调用Active接口,在相机控制模块中注册数据回调函数之前,Active接口需要先进行声明。由于Active接口属于AIDL接口,因此,其声明中通常会包含两个参数,一个可以是客户端的进程号(Process Identifier,PID),也即是作为客户端的传感器控制模块(Sensor HAL)对应进程的进程号;另一个可以是客户端的回调对象(CallBack),也即是传感器控制模块中用于接收环境光亮度的对象,在一些实施例中,该回调对象对应图12中的ReportLuxStatus(报告lux状态)。In an 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 is an AIDL interface, its declaration usually contains two parameters: one can be the client's process identifier (PID), that is, the process ID of the process corresponding to 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, this callback object corresponds to ReportLuxStatus (report lux status) in Figure 12.
其中,Active接口的声明时可采用如下代码:The Active interface can be declared using the following code:
进一步地,基于Active接口的声明内容,传感器控制模块和相机控制模块可以分别在本端注册回调接口,当传感器控制模块和相机控制模块中的回调接口注册完成后,即完成相机控制模块中数据回调函数的注册。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 this end. When the callback interface registrations in the sensor control module and the camera control module are completed, the registration of the data callback function in the camera control module is completed.
在一些实施例中,传感器控制模块可以在CamLightManager中注册回调接口,相机控制模块可以在CamxLightCustom中注册回调接口。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.
其中,传感器控制模块中回调接口注册时可采用如下代码:The following code can be used when registering the callback interface in the sensor control module:
CamLightManager::RegisterLuxCb(){CamLightManager::RegisterLuxCb(){
mCamLightService->RegisterLuxCallback(callingPid,mLuxCallback);mCamLightService->RegisterLuxCallback(callingPid,mLuxCallback);
}}
相机控制模块中回调接口注册时可采用如下代码:The following code can be used when registering the callback interface in the camera control module:
void CamxLightCustom::RegisterLightLuxStatusCb(Callback callback)void CamxLightCustom::RegisterLightLuxStatusCb(Callback callback)
在一些实施例中,传感器控制模块调用基于AIDL服务的第一接口,在相机控制模块中注册数据回调函数的步骤可以对应图12中的步骤②和③,具体包括:Sensor HAL接收到亮度监听指令后,调用CamLightManager中的Active接口,基于Active接口的声明内容,在CamLightManager中注册回调接口,并在CamxLightCustom中注册回调接口,当CamLightManager和CamxLightCustom中的回调接口注册完成后,即完成数据回调函数的注册。In some embodiments, the sensor control module calls the first interface based on the AIDL service, and the steps of registering the data callback function in the camera control module can correspond to steps ② and ③ in Figure 12, specifically including: after the Sensor HAL receives the brightness monitoring instruction, it calls the Active interface in CamLightManager, and based on the declaration content of the Active interface, registers the callback interface in CamLightManager, and registers the callback interface in CamxLightCustom. When the callback interfaces in CamLightManager and CamxLightCustom are registered, the registration of the data callback function is completed.
在一些实施例中,数据回调函数不仅可以在前置摄像头的环境光检测功能使能时,将前置摄像头检测的环境光亮度返回给传感器控制模块;还可以在前置摄像头的环境光检测功能使能失败或被关闭,导致环境光检测功能使能失败或被关闭的摄像头关闭后,向传感器控制模块发送通知消息,以使传感器控制模块使能前置摄像头的环境光检测功能。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 after 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 or is turned off to be turned off.
在一些实施例中,受限于前置摄像头本身的感光精度,导致前置摄像头检测的环境光亮度和实际环境中的环境光亮度存在一定的误差,为提高显示屏亮度调节的准确性,本申请实施例中相机控制模块在注册回调接口时,还可以在回调接口中注册数据校准接口函数,该数据校准函数用于提供前置摄像头检测的环境光亮度和实际环境中的环境光亮度的校准系数,可以在基于回调接口返回前置摄像头环境光亮度时,对前置摄像头检测的环境光亮度进行校准,该数据校准函数可以为LuxValueConvert()。In some embodiments, due to the limitations 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().
在一些实施例中,电子设备在运行过程中可能会存在进程突然崩溃的情况,对于AIDL所涉及的服务端和客户端来说,也可能会发生崩溃。在本申请实施例中,为了能够及时监听到相机控制模块(服务端)和传感器控制模块(客户端)的崩溃,传感器控制模块和相机控制模块还可以分别在本端注册死亡监听对象。In some embodiments, electronic devices may experience sudden process crashes during operation, and AIDL servers and clients may also experience crashes. In this embodiment of the present application, in order to promptly monitor the crashes of the camera control module (server) and the sensor control module (client), the sensor control module and the camera control module can also register death monitoring objects on their own ends.
一种实现方式中,相机控制模块可以在注册回调接口时,在本端注册第一死亡监听对象。通过注册该第一死亡监听对象,可以监听到相机控制模块在亮屏场景和灭屏场景下的崩溃。传感器控制模块可以在注册回调接口时,在本端注册第二死监听对象。通过注册该第二死亡监听对象,可以监听到传感器控制模块在亮屏场景和灭屏场景下的崩溃。In one implementation, the camera control module can register a first death monitoring object on the local side when registering a callback interface. By registering this first death monitoring object, the camera control module can be monitored for crashes in both screen-on and screen-off scenarios. The sensor control module can register a second death monitoring object on the local side when registering a callback interface. By registering this second death monitoring object, the sensor control module can be monitored for crashes in both screen-on and screen-off scenarios.
在一些实施例中,可以对应图16中的步骤①,即首次注册绑定死亡通知,具体包括:Sensor HAL在CamLightManager中注册回调接口的过程中,可以在CamLightManager中注册第二死亡监听对象,从而在监听到Sensor HAL的崩溃事件时,生成死亡通知消息,以通知Camera HAL;Camera HAL在CamxLightCustom中注册回调接口的过程中,可以在CamxLightCustom中注册第一死亡监听对象,从而在监听到Camera HAL的崩溃事件时,生成死亡通知消息,以通知Sensor HAL。In some embodiments, it can correspond to step ① in Figure 16, that is, the first registration and binding of the death notification, specifically including: in the process of the Sensor HAL registering the callback interface in CamLightManager, the second death monitoring object can be registered 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; in the process of the Camera HAL registering the callback interface in CamxLightCustom, the first death monitoring object can be registered 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.
在一些实施例中,对于电子设备来说,有的电子设备上的前置摄像头可能支持环境光检测功能,有的电子设备上的前置摄像头可能并不支持环境光检测功能,为避免对不支持环境光检测功能的前置摄像头执行使能操作,降低电子设备的资源消耗,传感器控制模块在调用第一接口打开前置摄像头的环境光检测功能之前,具体可在执行步骤S1103之前,比如在电子设备开机时,或者接收到亮度监听指令时,获取预设标识位上的数值,进而基于该预设标识位上的数值,判断电子设备的前置摄像头是否支持环境光检测功能,当前置摄像头支持环境光检测功能,则调用第一接口打开前置摄像头的环境光检测功能,当前置摄像头不支持环境光检测功能,则不再调用第一接口。其中,预设标识位可以为is_ambient_light(是环境光),用于指示前置摄像头是否支持环境光检测功能,预设标识位上的数值可以为true(正确)或flase(错误)。当预设标识位上的数值为true,则可以确定前置摄像头支持环境光检测功能;当预设标识位上的数值为flase,则可以确定前置摄像头不支持环境光检测功能。In some embodiments, for electronic devices, the front cameras on some electronic devices may support the ambient light detection function, while the front cameras on some electronic devices may not support the ambient light detection function. To avoid enabling the front camera that does not support the ambient light detection function and reduce resource consumption of the electronic device, the sensor control module may obtain the value of the preset flag before calling the first interface to enable 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 determine whether the front camera of the electronic device supports the ambient light detection function based on the value of the preset flag. If the front camera supports the ambient light detection function, the first interface is called to enable 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. The preset flag can be is_ambient_light (is ambient light), which is used to indicate whether the front camera supports the ambient light detection function. The value of the preset flag can be true (correct) or false (false). 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.
需要说明的是,当电子设备未关机,则本步骤中注册的数据回调函数,可在后续调用前置摄像头检测环境光亮度时直接使用,而无需重新注册;当电子设备关机,则本步骤中注册的数据回调函数将被销毁,后续电子设备再次开机时,需要执行上述步骤S1101至S1103注册数据回调函数。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 the need for re-registration; when the electronic device is turned off, the data callback function registered in this step will be destroyed. When the electronic device is subsequently turned on again, the above steps S1101 to S1103 need to be executed to register the data callback function.
S1104:传感器控制模块调用基于HIDL服务的第二接口,向相机服务模块发送第一指令。S1104: The sensor control module calls the second interface based on the HIDL service and sends a first instruction to the camera service module.
通常摄像头包括前置摄像头和后置摄像头两种类型,前置摄像头和后置摄像头的数量分别为至少一个。且,前置摄像头和后置摄像头分别具有多种功能,包括拍照功能、人脸解锁功能、环境光检测功能等中至少一种。为将不同类型的摄像头及同一种类型的摄像头的不同功能区分开来,本申请实施例根据摄像头的类型及其功能,抽象出多个逻辑摄像头,每个逻辑摄像头对应一个标识。例如,根据前置摄像头的拍照功能,可以抽象出逻辑摄像头A,根据前置摄像头的环境光检测功能,可以抽象出逻辑摄像头B,逻辑摄像头A和逻辑摄像头B可以对应同一前置摄像头,也可以对应不同的前置摄像头。为逻辑摄像头A即前置摄像头的拍照功能,设置的标识为Camera ID=1,为逻辑摄像头B即前置摄像头的环境光检测功能,设置的标识为Camera ID=4。Typically, cameras include two types: front cameras and rear cameras, and there are at least one front camera and rear camera respectively. Moreover, the front camera and rear camera each have multiple functions, including at least one of a photo taking function, a face unlocking function, and an ambient light detection function. 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, based on the photo taking function of the front camera, a logical camera A can be abstracted, and based on the ambient light detection function of the front camera, a logical camera B can be abstracted. Logical camera A and logical camera B can correspond to the same front camera or to different front cameras. For the photo taking function of logical camera A, i.e., the front camera, the identifier set is Camera ID=1, and for the ambient light detection function of logical camera B, i.e., the front camera, the identifier set is Camera ID=4.
在本申请实施例中,传感器控制模块可以调用第一接口生成第一指令,然后第二接口将该第一指令发送至相机服务模块。其中,第二接口属于HIDL服务的接口,可以是图12中的里本相机2原生开发工具包_人物(libcamera2ndk_vendor)等。相机服务模块可以作为一个独立的进程,该独立进程可以定义为相机服务进程。第一指令可以是Open Camera指令。该第一指令中可以包括第一标识,该第一标识对应前置摄像头的环境光检测功能,可以为Camera ID=4。该第一指令还可以包括第一包名,该第一包名为环境光检测应用的包名。In an embodiment of the present application, the sensor control module can call the first interface to generate a first instruction, and then the second interface sends the first instruction to the camera service module. Among them, the second interface belongs to the interface of the HIDL service, which can be the libcamera2ndk_vendor in Figure 12, etc. 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 may include a first identifier, which corresponds to the ambient light detection function of the front camera, and can be Camera ID=4. The first instruction may also include a first package name, which is the package name of the ambient light detection application.
在一些实施例中,传感器服务模块调用第二接口向相机服务模块发送第一指令可以对应图12中的步骤④,具体包括:调用Sensor HAL中CamLightManager的Active接口,生成第一指令,并通过基于HIDL服务的libcamera2ndk_vendor接口将该第一指令发送至FWK层中的ICameraService。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 step ④ in Figure 12, specifically including: 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.
S1105:在接收到第一指令后,相机服务模块调用相机控制模块中的第一函数,并根据第一标识,执行第一函数,以控制摄像头驱动将前置摄像头上电、初始化摄像头寄存器及创建环境光亮度的读取线程。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.
S1106:摄像头驱动将前置摄像头上电、初始化摄像头寄存器及创建环境光亮度的读取线程。S1106: The camera driver powers on the front camera, initializes the camera registers, and creates a thread for reading the ambient light brightness.
在一些实施例中,本步骤中对前置摄像头的上电、初始化摄像头寄存器等操作可以是打开前置摄像头的具体过程,或者,可以是对前置摄像头进行上电初始化的过程。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.
其中,第一函数用于打开电子设备内任一摄像头的任一种功能,第一函数可以为Open Camera函数。在接收到第一指令后,相机服务模块可以调用相机控制模块中的第一函数,并根据第一标识,执行第一函数。根据第一标识,可以确定需要打开的前置摄像头的环境光检测功能,此时前置摄像头将替代环境光检测器件使用。在前置摄像头替代环境光检测器件使用时,前置摄像头需要检测环境光亮度,而无需采集图像。为降低前置摄像头的功耗,相机服务模块根据第一标识,执行第一函数中与打开前置摄像头的环境光检测功能必要的流程,比如申请芯片支持库(Chip Support Library,CSL)资源缓存(buffer)、将前置摄像头上电、初始化摄像头寄存器及创建环境光亮度的读取线程等,而跳出与打开前置摄像头的环境光检测功能无关的流程,比如配置出图资源的流程等。通过执行该第一函数可以生成相应的控制指令,该控制指令被下发给摄像头驱动,从而控制摄像头驱动为前置摄像头申请CSL资源缓存、将前置摄像头上电、初始化摄像头寄存器、创建读取线程等。其中,所创建的读取线程用于读取和计算前置摄像头检测的环境光亮度。在一些实施例中,该读取线程可以为异步读取线程。在一些实施例中,该读取线程可以周期性读取前置摄像头检测的环境光亮度。基于对摄像头寄存器的初始化,可以在前置寄存器中写入前置摄像头检测环境光亮度的周期、前置摄像头检测环境光亮度的频率等,从而控制前置摄像头工作。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 registers 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, thereby controlling 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 to control the operation of the front camera.
在一些实施例中,该步骤可以对应图12中的⑤,具体包括:当接收到第一指令,通过CameraService调用Camera HAL的CAMX中的Open Camera函数,并执行该Open Camera函数,通过CamxLightCustom的接口,向摄像头驱动发送控制指令,使得摄像头驱动为前置摄像头的环境光检测功能申请CSL资源缓存、将前置摄像头上电、初始化摄像头寄存器、创建异步读取线程等。进而,使得硬件层(Driver)的相机传感器(Camera Sensor)开始工作。In some embodiments, this step may correspond to step ⑤ in FIG12 , specifically including: upon receiving the first instruction, calling the Open Camera function in CAMX of the Camera HAL through CameraService, executing the Open Camera function, and sending a control instruction to the camera driver through the CamxLightCustom interface, causing the camera driver to apply for a CSL resource cache for the ambient light detection function of the front camera, power on the front camera, initialize the camera registers, create an asynchronous read thread, etc. Consequently, the camera sensor (Camera Sensor) of the hardware layer (Driver) starts operating.
采用本申请实施例的方法,当前置摄像头替代环境光检测器件使用时,不会为前置摄像头配置出图资源,前置摄像头不会采集图像,降低了前置摄像头的资源消耗,提升了电子设备的性能。When the method of the embodiment of the present application is used, when the front camera is used instead of the ambient light detection device, no image output resources will 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.
S1107:相机控制模块获取前置摄像头输出的目标环境光亮度,并通过数据回调函数,将目标环境光亮度发送至传感器控制模块。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 the data callback function.
其中,目标环境光亮度是按照本申请实施例提供的方法,基于前置摄像头检测的环境光亮度(可以称为第四环境光亮度)确定出的当前帧的目标环境光亮度。第四环境光亮度为前述实施例中的前置摄像头采集的Raw data。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 embodiments of the present application. The fourth ambient light brightness is the raw data collected by the front camera in the aforementioned embodiments.
在一种可能的实现方式中,摄像头驱动可以通过读取线程周期性读取第四环境光亮度,并将读取的第四环境光亮度发送至相机控制模块,使得相机控制模块可以获取前置摄像头输出的第四环境光亮度,该读取周期可以为200ms。摄像头驱动还可以通过读取线程周期性读取前置摄像头检测的第四环境光亮度,并将读取的第四环境光亮度存储到缓存中,相机控制模块可以周期性读取摄像头驱动的缓存中存储的第四环境光亮度,从而获取前置摄像头输出的第四环境光亮度。在一些实施例中,摄像头驱动的读取周期与相机控制模块的读取周期可以相同,也可以不同。In one 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. 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 to obtain 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.
在一些实施例中,相机控制模块可以通过预先注册的数据回调函数,将目标环境光亮度发送至传感器控制模块。具体地,相机控制模块可将目标环境光亮度填充到预先注册的数据回调函数中,通过该数据回调函数,将目标环境光亮度发送至传感器控制模块。In some embodiments, the camera control module may send the target ambient light brightness to the sensor control module via 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 via the data callback function.
结合目标环境光亮度的不同内容,相机控制模块通过预先注册的数据回调函数,将目标环境光亮度发送至传感器控制模块,具体包括以下几种方式:Based on 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. Specifically, the following methods are included:
第一种方式、相机控制模块将前置摄像头输出的目标环境光亮度填充到数据回调函数中,通过该数据回调函数,将目标环境光亮度发送至传感器控制模块。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.
第二种方式、相机控制模块将前置摄像头检测的第四环境光亮度和校准后得到的目标环境光亮度填充到数据回调函数中,通过该数据回调函数,将前置摄像头检测的第四环境光亮度和目标环境光亮度发送至传感器控制模块。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.
第三种方式、相机控制模块将前置摄像头检测的第四环境光亮度、校准后得到的目标环境光亮度及前置摄像头的状态参数填充到数据回调函数中,通过该数据回调函数,将前置摄像头检测的第四环境光亮度、第二环境光亮度及状态参数发送至传感器控制模块。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, sends the fourth ambient light brightness detected by the front camera, the second ambient light brightness and status parameters to the sensor control module.
针对第三种方式,填充后的数据回调函数的形式可以为:For the third method, the form of the filled data callback function can be:
pCamxLightCustom->mStatusCb(static_cast<float>(luxValue),luxValueFinal,status);pCamxLightCustom->mStatusCb(static_cast<float>(luxValue),luxValueFinal,status);
其中,luxValue为前置摄像头检测的第四环境光亮度,luxValueFinal为目标环境光亮度,即前置摄像头输出的环境光亮度,status为前置摄像头的状态参数。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.
在一些实施例中,此处列举三种具体的实现方式,可以只选用其中一种方式返回目标环境光亮度,也可以选用多种方式返回目标环境光亮度。每次返回目标环境光亮度时可以采用相同的方式,也采用不同的方式。例如,可以第一次采用第一种实现方式返回目标环境光亮度,第二次采用第二种实现方式返回目标环境光亮度,第三次采用第三种实现方式返回目标环境光亮度,以此类推;也可以每次均采用多种方式返回一次目标环境光亮度,然后将多种方式返回的目标环境光亮度进行融合。In some embodiments, three specific implementation methods are listed here. Only one of the methods can be used to return the target ambient light brightness, or multiple methods can be used to return the target ambient light brightness. The target ambient light brightness can be returned in the same method or in different methods each time. For example, the target ambient light brightness can be returned in the first time using the first implementation method, the second time using the second implementation method, the third time using the third implementation method, and so on. Alternatively, the target ambient light brightness can be returned in multiple methods each time, and then the target ambient light brightness returned in multiple methods can be combined.
S1108:传感器控制模块将目标环境光亮度发送至传感器服务模块。S1108: The sensor control module sends the target ambient light brightness to the sensor service module.
在一些实施例中,传感器控制模块中的ReportLuxStatus对象可以接收相机控制模块发送的目标环境光亮度,进而将该目标环境光亮度发送至传感器服务模块。In some embodiments, the ReportLuxStatus object in the sensor control module can 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.
一种实现方式中,传感器服务模块向传感器控制模块发送亮度监听指令时,会在传感器控制模块中注册回调函数,通过该回调函数,传感器控制模块可以将目标环境光亮度发送至传感器服务模块。在一些实施例中,传感器控制模块可以将目标环境光亮度填充到回调函数中,通过该回调函数,将目标环境光亮度发送至传感器控制模块。In one implementation, when the sensor service module sends a brightness monitoring command to the sensor control module, it registers a callback function in the sensor control module. Through this callback function, the sensor control module can send the target ambient light brightness to the sensor service module. In some embodiments, the sensor control module can fill the target ambient light brightness into the callback function, and through this callback function, send the target ambient light brightness to the sensor control module.
另一种实现方式中,传感器服务模块可以周期性读取传感器控制模块的目标环境光亮度。In another implementation, the sensor service module may periodically read the target ambient light brightness of the sensor control module.
对于传感器控制模块对目标环境光亮度的处理逻辑,可参见下述代码:For the sensor control module's processing logic for the target ambient light brightness, see the following code:
::ndk::ScopedAStatus ReportLuxStatus(const LuxStatus&out_data){::ndk::ScopedAStatus ReportLuxStatus(const LuxStatus&out_data){
//客户端数据处理逻辑//Client data processing logic
}}
在一些实施例中,步骤S1107至步骤S1108可以对应图12中的⑤和⑥,具体包括:Camera HAL的CamxLightCustom获取前置摄像头输出的目标环境光亮度,通过预先注册的数据回调函数,将目标环境光亮度返回给Sensor HAL的CamLightManager中的ReportLuxStatus对象,ReportLuxStatus对象通过SensorService将目标环境光亮度上报给SensorManager。In some embodiments, steps S1107 to S1108 may correspond to ⑤ and ⑥ in FIG12 , specifically including: CamxLightCustom of the 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 the CamLightManager of the Sensor HAL through a pre-registered data callback function. The ReportLuxStatus object reports the target ambient light brightness to the SensorManager through the SensorService.
S1109:传感器服务模块基于目标环境光亮度,调节电子设备的显示屏亮度。S1109: The sensor service module adjusts the brightness of the display screen of the electronic device based on the target ambient light brightness.
一种实现方式中,调节显示屏的亮度可以是设置显示屏的亮度。具体地,传感器服务模块可以基于目标环境光亮度,确定出显示屏的亮度,进而将显示屏的亮度设置为确定的亮度;传感器服务模块还可以基于历史环境光亮度和目标环境光亮度,确定出显示屏的亮度,进而将显示屏的亮度设置为确定的亮度。In one implementation, adjusting the brightness of the display screen may include 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 historical ambient light brightness and the target ambient light brightness, and then set the brightness of the display screen to the determined brightness.
另一种实现方式中,调节显示屏的亮度可以是在显示屏的初始亮度基础上,对初始亮度进行调节。该初始亮度可以是技术人员预先设置的亮度值。具体地,传感器服务模块可以基于目标环境光亮度,确定出显示屏的亮度,然后将显示屏的亮度由初始亮度调节为确定的亮度;传感器服务模块还可以基于历史环境光亮度和目标环境光亮度,确定出显示屏的亮度,然后将显示屏的亮度由初始亮度调节为确定的亮度。在一些实施例中,将显示屏的亮度由初始亮度调节为确定的亮度时,可以逐步调节,避免亮度变化过大影响用户体验。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 that affect the user experience.
在一些实施例中,传感器服务在调节显示屏亮度时,可生成亮度调节指令,进而将该亮度调节指令发送给传感器控制模块,传感器控制模块将亮度调节指令发送给显示屏驱动,使得显示屏驱动执行该亮度调节指令,对显示屏亮度进行调节。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 and adjusts the brightness of the display screen.
上述以电子设备的亮屏为开机首次亮屏为例进行说明,当电子设备的亮屏为非首次亮屏,电子设备可以不执行步骤S1101中的AIDL服务的初始化过程和步骤S1103中数据回调函数的注册过程,而执行其他步骤。The above description uses the example of the electronic device turning on the screen for the first time when the screen 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.
参见图13,本申请实施例提供了一种灭屏关闭前置摄像头环境光检测功能的方法,该方法在电子设备灭屏,可以关闭前置摄像头的环境光检测功能,以降低电子设备的电力消耗。以具有图2所示的软件系统的电子设备100执行本申请实施例为例,该方法可以与图11所示显示屏亮度调节流程是独立的,没有时序关系,也可以在图11中步骤S1105之后的任一时间执行。参见图13,本申请实施例提供的方法流程包括:Referring to Figure 13, an embodiment of the present application provides a method for turning off the ambient light detection function of the front camera when the screen is off. When the screen of the electronic device is off, the ambient light detection function of the front camera can be turned off to reduce the power consumption of the electronic device. Taking the electronic device 100 having the software system shown in Figure 2 as an example of executing the embodiment of the present application, this method can be independent of the display brightness adjustment process shown in Figure 11, without a timing relationship, and can also be executed at any time after step S1105 in Figure 11. Referring to Figure 13, the method flow provided by the embodiment of the present application includes:
S1301:电子设备灭屏后,传感器控制模块调用基于AIDL服务的第三接口,然后调用第二接口,向相机服务模块发送第二指令。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.
在一些实施例中,基于电子设备灭屏,传感器服务模块可以接收到电子设备的灭屏消息,在接收到该灭屏消息后,传感器服务模块可以向传感器控制模块发送停止亮度监听指令。在接收到该停止亮度监听指令,传感器控制模块可以调用第三接口,生成第二指令,然后调用第二接口,向相机服务模块发送第二指令。其中,第三接口可以为DeActive接口,该DeActive接口用于关闭前置摄像头的环境光检测功能。第二指令可以是CloseCamera(关闭相机)指令,包括第一标识、第一包名等。In some embodiments, based on the screen of the electronic device being turned off, the sensor service module can receive a screen-off message from the electronic device. After receiving the screen-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 a third interface to 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.
在一些实施例中,本步骤可以对应图14中的①②③④,具体包括:SensorManager接收到电子设备的灭屏消息,生成停止亮度监听指令,并调用SensorService将停止亮度监听指令发送至Sensor HAL,Sensor HAL调用CameraLightManager的DeActive接口,生成Close Camera指令,该Close Camera指令包括Camera ID=4和环境光检测应用的包名,然后,调用libcamera2ndk_vendor向FWK层的CameraService发送该Close Camera指令。In some embodiments, this step may correspond to ①②③④ in Figure 14, specifically including: the SensorManager receives the screen-off message of the electronic device, generates a stop brightness monitoring instruction, and calls the SensorService to send the stop brightness monitoring instruction to the Sensor HAL, the Sensor HAL calls the DeActive interface of the CameraLightManager to generate a Close Camera instruction, 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.
S1302:在接收到第二指令后,相机服务模块调用相机控制模块中的第二函数,并根据第一标识,执行第二函数,以控制摄像头驱动关闭读取线程,并将前置摄像头下电。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.
S1303:摄像头驱动关闭读取线程,并将前置摄像头下电。S1303: The camera driver closes the reading thread and powers off the front camera.
在接收到第二指令后,相机服务模块调用相机控制模块中的第二函数,并根据第一标识,执行第二函数,通过执行第二函数,可以生成相应的关闭指令,将所生成的关闭指令发送给摄像头驱动,摄像头驱动基于该关闭指令,关闭读取线程,停止读取环境光亮度,并将前置摄像头下电,然后释放为前置摄像头所申请的CSL资源缓存。进一步地,摄像头驱动关闭读取线程后,相机控制进程将停止通过数据回调函数,向传感器控制模块发送目标环境光亮度。After receiving the second instruction, the camera service module calls the second function in the camera control module and executes the second function based on the first identifier. By executing the second function, a corresponding shutdown instruction can be generated and sent to the camera driver. Based on the shutdown instruction, the camera driver shuts down the reading thread, stops reading the ambient light brightness, powers down the front camera, and releases the CSL resource cache requested for the front camera. Furthermore, after the camera driver shuts down the reading thread, the camera control process stops sending the target ambient light brightness to the sensor control module through the data callback function.
上述关闭前置摄像头的环境光检测功能的逻辑代码可以为:The logic code for disabling the ambient light detection function of the front camera can be:
CloseCamLightSensor(const struct camera3_device*pCamera3Device,bool&isCamLightId)(关闭Camera light id封装函数)CloseCamLightSensor(const struct camera3_device*pCamera3Device,bool&isCamLightId) (Close Camera light id encapsulation function)
在一些实施例中,本步骤可以对应图14中的⑤,具体包括:基于Close Camera指令,CameraService调用Camera HAL的CAMX中的Close Camera函数,通过执行该CloseCamera函数,控制摄像头驱动关闭异步读取线程,停止读取环境光亮度,将前置摄像头下电,释放为前置摄像头所申请的CSL资源缓存。进而,使得硬件层(Driver)的相机传感器(Camera Sensor)停止工作。In some embodiments, this step may correspond to step 5 in FIG. 14 , specifically including: based on the Close Camera instruction, the CameraService calls the Close Camera function in the CAMX of the Camera HAL. By executing the CloseCamera function, the camera driver is controlled to close the asynchronous reading thread, stop reading the ambient light brightness, power off the front camera, and release the CSL resource cache requested for the front camera. Consequently, the camera sensor (Camera Sensor) at the hardware layer (Driver) stops working.
通常电子设备配置有前置摄像头和后置摄像头。前置摄像头支持出图模式和环境光检测模式。出图模式对应前置摄像头的拍照功能、人脸解锁功能等。在出图模式下,前置摄像头需要采集图像,以满足用户的使用需求。与出图模式不同,环境光检测模式下,基于前置摄像头输出的环境光亮度,调节显示屏亮度是为了改善用户的使用需求,且与出图模式相比,用户需求程度较低。在实际应用时,前置摄像头和后置摄像头无法同时使能,且前置摄像头的出图模式和环境光检测模式也无法同时使能。为解决摄像头的使能优先级问题,本申请实施例为电子设备内的各个摄像头设置对应的标识,每个标识对应摄像头的一种逻辑功能,并设置摄像头的标识的冲突判断逻辑,同时为不同包名配置不同的优先级,从而可以基于包名优先级,确定不同标识的优先级。Usually, electronic devices are equipped with a front camera and a rear camera. The front camera supports image output mode and ambient light detection mode. The image output mode corresponds to the photo taking function, face unlocking function, etc. of the front camera. In the image output mode, the front camera needs to capture 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 in order to improve the user's usage needs, and compared with the image output mode, the user demand is lower. In actual application, the front camera and the rear camera cannot be enabled at the same time, and the image output mode and ambient light detection mode of the front camera cannot be enabled at the same time. In order to solve the problem of camera enabling priority, the embodiment of the present application sets corresponding identifiers 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.
具体地,为电子设备内的摄像头配置对应标识的过程可以包括:在电子设备开机过程中,相机控制模块通过与摄像头驱动进行交互,获取电子设备内摄像头的类型和功能,然后基于摄像头的类型和功能,抽象出多个逻辑摄像头,并为每个逻辑摄像头设置对应的标识。例如,为前置摄像头的拍照功能设置的标识为CameraID=1;为前置摄像头的环境光检测功能设置的标识为CameraID=4。Specifically, the process of configuring a corresponding identifier for a camera in an electronic device may include: during the electronic device's startup process, the camera control module interacts with the camera driver to obtain the type and function of the camera in the electronic device, then abstracts multiple logical cameras based on the camera type and function, and sets a corresponding identifier for each logical camera. For example, the identifier set for the front camera's photo function is CameraID=1; the identifier set for the front camera's ambient light detection function is CameraID=4.
上述为前置摄像头的环境光检测功能设置标识的过程,可参见如下代码:The above is the process of setting the flag for the ambient light detection function of the front camera. Please refer to the following code:
为保证用户的正常使用,本申请实施例可以为环境光检测应用的包名配置最低优先级,从而在用户想要打开相机应用拍照时,能够为用户提供拍照服务。为便于后续应用,相机控制模块可存储所设置的摄像头的标识以及不同包名的优先级。进一步地,相机控制模块可将所设置的摄像头的标识以及不同包名的优先级发送至相机服务模块进行存储,使得相机服务模块能够对摄像头的使能优先级进行管理。To ensure normal user use, 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 photo service can be provided to the user. To facilitate subsequent use, 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.
本申请实施例中相机服务模块对摄像头使能优先级的管理逻辑可以为:接收目标指令,该目标指令包括目标标识和目标包名,在接收到该目标指令后,相机服务模块查询摄像头列表,该摄像头列表用于存储当前使能的摄像头对应的标识,当该摄像头列表为空,则可以确定摄像头不存在使能冲突,进而基于该目标指令,打开目标标识对应的摄像头的功能;当该摄像头列表为非空,则可以确定摄像头存在使能冲突,也即是当前存在正使能的摄像头,进而可以基于目标包名和当前使能的摄像头的包名,确定目标标识与当前使能的摄像头对应标识的优先级,当目标标识的优先级低于当前使能的摄像头的优先级,则不再打开目标标识对应的摄像头的功能;当目标标识的优先级高于当前使能的摄像头的优先级,则关闭当前使能的摄像头,然后打开目标标识对应的摄像头的功能。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, which includes a target identifier and a target package name. After receiving the target instruction, the camera service module queries the camera list, which is used to store the identifiers corresponding to the currently enabled cameras. 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.
上述判断逻辑,可参见如下代码为:The above judgment logic can be seen in the following code:
其中,ACameraManager_openCamera为Open Camera的接口函数,buff为PackageName。Among them, ACameraManager_openCamera is the interface function of Open Camera, and buff is PackageName.
基于上述判断逻辑,图11中步骤S1105在执行之前,相机服务模块可以查询摄像头列表,在摄像头列表为空时,执行步骤S1105。Based on the above judgment logic, before executing step S1105 in FIG. 11 , the camera service module may query the camera list, and execute step S1105 when the camera list is empty.
在本申请实施例中,对于基于AIDL服务的客户端(传感器控制模块)和服务端(相机控制模块)来说,服务端异常可以包括两个场景,一个是亮屏环境光检测功能使能时服务端进程崩溃,另一个是灭屏环境光检测功能不使能时服务端进程崩溃;客户端异常主要为亮屏环境光检测功能使能时客户端崩溃。针对这三种场景,可基于步骤S1101中预先注册的第一死亡监听对象和第二死亡监听对象进行监听,下面将分别进行介绍。In the embodiment of the present application, for the AIDL service-based client (sensor control module) and server (camera control module), server-side exceptions can 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 disabled. Client-side exceptions mainly occur when the screen-on ambient light detection function is enabled. For these three scenarios, monitoring can be performed based on the first and second death monitoring objects pre-registered in step S1101, which will be introduced below.
当通过执行上述步骤S1101至步骤S1105打开前置摄像头的环境光检测功能后,在基于步骤S1107至步骤S1109对显示屏幕的亮度调节过程中,当相机控制模块不响应,无法将前置摄像头输出的目标环境光亮度发送给传感器控制模块,针对在电子设备调节显示屏亮度的过程中服务端的异常的情况,本申请实施例提供了一种环境光检测功能的管理方法,以具有图2所示的软件结构的电子设备100执行本申请实施例为例,参见图15,该方法可在步骤S1105之后执行,本申请实施例提供的方法流程包括:After the ambient light detection function of the front camera is turned on by executing the above steps S1101 to S1105, during the process of adjusting the brightness of the display screen based on steps S1107 to S1109, if 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, an abnormal situation of the server side during the process of adjusting the brightness of the display screen of the electronic device is addressed. The embodiment of the present application provides a method for managing the ambient light detection function. Taking the electronic device 100 having the software structure shown in FIG. 2 as an example, referring to FIG. 15 , the method can be executed after step S1105. The method flow provided by the embodiment of the present application includes:
S1501:在电子设备调节显示屏亮度的过程中,当通过第一死亡监听对象监听到相机控制模块不响应,相机控制模块向传感器控制模块发送第一死亡通知消息。S1501: During the process of adjusting the brightness of a display screen of an electronic device, when the camera control module is detected to be unresponsive through a first death monitoring object, the camera control module sends a first death notification message to the sensor control module.
在一些实施例中,本步骤可以对应图16中的步骤②,具体包括:在电子设备调节显示屏亮度的过程中,第一死亡监听对象(即Death Notifier)对Camera HAL进行实时监听,当监听到Camera HAL无法将前置摄像头输出的目标环境光亮度发送给传感器控制模块发送给Sensor HAL,Camera HAL可以调用数据回调函数(即DeathRecpCallback),向SensorHAL发送第一死亡通知消息。该数据回调函数可以为步骤S1101中注册的数据回调函数。In some embodiments, this step may correspond to step ② in FIG. 16 , specifically including: during the process of adjusting the display brightness of the electronic device, the first death monitoring object (i.e., Death Notifier) monitors the Camera HAL in real time. When it is detected that the Camera HAL is unable to send the target ambient light brightness output by the front camera to the sensor control module and to the Sensor HAL, the Camera HAL may call a data callback function (i.e., DeathRecpCallback) to send a first death notification message to the Sensor HAL. The data callback function may be the data callback function registered in step S1101.
S1502:传感器控制模块判断AIDL服务是否被拉起。S1502: The sensor control module determines whether the AIDL service is started.
S1503:当确定AIDL服务被拉起,传感器控制模块执行调用第一接口,然后调用第二接口,向相机服务模块发送第一指令,以使能前置摄像头的环境光检测功能。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.
由于此时相机服务模块无法返回前置摄像头输出的目标环境光亮度,因而需要重新注册数据回调函数,保证相机控制模块和传感器控制模块之间数据通路能够传输数据。使能前置摄像头的环境光检测功能包括:相机服务模块调用相机控制模块中的第一函数,根据第一标识,执行该第一函数,控制摄像头驱动为前置摄像头申请用于环境光检测CSL资源缓存,将前置摄像头上电,初始化摄像头寄存器,并创建异步读取线程。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 a first function in the camera control module, executes the first function based on a first identifier, controls the camera driver to apply for a CSL resource cache for ambient light detection for the front camera, powers on the front camera, initializes the camera registers, and creates an asynchronous read thread.
在一些实施例中,该步骤可以对应图16中的步骤②-⑥,具体包括:当接收到第一死亡通知消息,Sensor HAL判断AIDL服务是否被拉起,当AIDL服务被拉起,则调用Active接口,注册数据回调函数,然后调用libcamera2ndk_vendor接口向CameraService发送第一指令,该第一指令包括CameraID=4和环境光检测应用的包名,在接收到第一指令后,CameraService调用Camera HAL中的OpenCamera函数,根据CameraID=4执行该OpenCamera函数,进而控制摄像头驱动为CameraID=4申请CLS资源缓存,并将前置摄像头上电,初始化摄像头寄存器,创建异步读取线程。进而,使得Driver的CameraSensor开始工作。当读取到前置摄像头输出的目标环境光亮度,Camera HAL将目标环境光亮度填充到数据回调函数中,通过数据回调函数将目标环境光亮度发送给Sensor HAL,由Sensor HAL上报给SensorService。In some embodiments, this step may correspond to steps ②-⑥ in FIG16 , specifically including: upon receiving the first death notification message, the Sensor HAL determines whether the AIDL service is started. If the AIDL service is started, it calls the Active interface, registers a data callback function, and then calls the libcamera2ndk_vendor interface to send a 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 based on CameraID=4, and then controls the camera driver to apply for a CLS resource cache for CameraID=4, powers on the front camera, initializes the camera registers, and creates an asynchronous read thread. This causes the Driver's CameraSensor to start 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.
在本申请的另一个实施例中,当AIDL服务未被拉起,则需要等待预设时长后再次判断AIDL服务是否被拉起。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.
电子设备灭屏后,通过执行上述步骤S1301至步骤S1303后,如果前置摄像头的环境光检测功能无法正常关闭,针对电子设备灭屏后服务端不响应的情况,本申请实施例提供了一种环境光检测功能的管理方法,以具有图2所示的软件结构的电子设备100执行本申请实施例为例,参见图17,该方法可在步骤S1303之后执行,本申请实施例提供的方法流程包括:After the electronic device turns off the screen, after executing the above steps S1301 to S1303, if the ambient light detection function of the front camera cannot be turned off normally, the embodiment of the present application provides a management method for the ambient light detection function for the situation where the server does not respond after the electronic device turns off the screen. Taking the electronic device 100 having the software structure shown in Figure 2 as an example to execute the embodiment of the present application, see Figure 17. The method can be executed after step S1303. The method process provided by the embodiment of the present application includes:
S1701:电子设备灭屏后,当通过第一死亡监听对象监听到相机控制模块不响应,相机控制模块向传感器控制模块发送第二死亡通知消息。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.
在一些实施例中,该步骤对应图18中的步骤①,即首次注册绑定死亡通知,具体包括:电子设备灭屏后,第一死亡监听对象(即Death Notifier)监听到Camera HAL崩溃,无法正常关闭前置摄像头的环境光检测功能,可以调用数据回调函数(即Death RecpCallback),向Sensor HAL发送第二死亡通知消息。In some embodiments, this step corresponds to step ① in Figure 18, that is, the first registration and binding of the death notification, specifically including: after the electronic device screen 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. It can call the data callback function (i.e., Death RecpCallback) to send a second death notification message to the Sensor HAL.
S1702:在接收到第二死亡通知消息后,传感器控制模块判断电子设备是否灭屏。S1702: After receiving the second death notification message, the sensor control module determines whether the screen of the electronic device is off.
S1703:当确定电子设备灭屏,传感器控制模块调用第一接口,向相机控制模块发送初始化指令。S1703: When it is determined that the screen of the electronic device is off, the sensor control module calls the first interface and sends an initialization instruction to the camera control module.
S1704:在接收到初始化指令后,相机控制模块对前置摄像头和数据回调函数进行初始化。S1704: After receiving the initialization instruction, the camera control module initializes the front camera and the data callback function.
在一些实施例中,该步骤对应图18中的步骤②和③,具体包括:接收到第二死亡通知消息后,Sensor HAL可以调用Active接口,将Camera HAL中摄像头寄存器和数据回调函数进行初始化。In some embodiments, this step corresponds to steps ② and ③ in FIG18 , specifically including: 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.
该种场景下,由于显示屏已经熄灭,无需调节环境光亮度,此时传感器控制模块不再使能前置摄像头。也就是使得Driver中的CameraSensor停止工作。In this scenario, since the display is off and there is no need to adjust the ambient light brightness, the sensor control module no longer enables the front camera, which means that the CameraSensor in the Driver stops working.
当通过执行上述步骤S1101至步骤S1105前置摄像头的环境光检测功能使能后,在基于步骤S1107至步骤S1109对显示屏亮度调节过程中,当传感器控制模块无法打开前置摄像头的环境光检测功能,针对在电子设备调节显示屏亮度的过程中服务端不响应的情况,本申请实施例提供了一种环境光检测功能的管理方法,以具有图2所示的软件结构的电子设备执行本申请实施例为例,参见图19,本申请实施例提供的方法流程包括:After the ambient light detection function of the front camera is enabled by executing steps S1101 to S1105 above, during the process of adjusting the brightness of the display screen based on steps S1107 to S1109, when the sensor control module is unable to enable the ambient light detection function of the front camera, and the server does not respond during the process of adjusting the brightness of the display screen of the electronic device, the embodiment of the present application provides a method for managing the ambient light detection function. Taking the electronic device having the software structure shown in FIG. 2 as an example, referring to FIG. 19 , the method flow provided by the embodiment of the present application includes:
S1901:电子设备亮屏后,当通过第二死亡监听对象监听到传感器控制模块不响应,传感器控制模块向相机控制模块发送第三死亡通知消息。S1901: After the screen of the electronic device is turned on, when the second death monitoring object monitors that the sensor control module does not respond, the sensor control module sends a third death notification message to the camera control module.
在一些实施例中,该步骤对应图20中的步骤①,具体包括:电子设备亮屏后,第二死亡监听对象对Sensor HAL进行实时监听,当监听到Sensor HAL的崩溃事件,调用数据回调函数,向Camera HAL发送第三死亡通知消息。In some embodiments, this step corresponds to step ① in Figure 20, specifically including: 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.
S1902:在接收到第三死亡通知消息后,相机控制模块将读取线程关闭,并将数据回调函数销毁。S1902: After receiving the third death notification message, the camera control module closes the reading thread and destroys the data callback function.
在一些实施例中,该步骤对应图20中的步骤②,具体包括:在接收到第三死亡通知消息后,Camera HAL控制摄像头驱动关闭异步读取线程,停止读取环境光亮度,并将数据回调函数销毁。也就是停止从Driver中的CameraSensor读取环境光亮度。In some embodiments, this step corresponds to step ② in FIG. 20 , specifically including: upon receiving the third death notification message, the Camera HAL controls the camera driver to shut down the asynchronous read thread, stop reading ambient light brightness, and destroy the data callback function. In other words, it stops reading ambient light brightness from the CameraSensor in the Driver.
S1903:传感器控制模块调用基于AIDL服务的第三接口,然后调用第二接口,向相机服务模块发送第二指令。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.
在一些实施例中,该步骤对应图20中的步骤③和④,具体包括:Sensor HAL调用DeActive接口,然后调用libcamera2ndk_vendor接口向CameraService发送第二指令,该第二指令包括CameraID=4和环境光检测应用的包名。In some embodiments, this step corresponds to steps ③ and ④ in Figure 20, specifically including: the Sensor HAL calls the DeActive interface, and then calls the libcamera2ndk_vendor interface to send a second instruction to the CameraService, where the second instruction includes CameraID=4 and the package name of the ambient light detection application.
S1904:在接收到第二指令后,相机服务模块调用相机控制模块中的第二函数,并根据第一标识,执行第二函数,以控制摄像头驱动关闭读取线程,并将前置摄像头下电。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.
在一些实施例中,该步骤对应图20中的步骤⑤,具体包括:在接收到第二指令后,CameraService调用Camera HAL,控制摄像头驱动释放为CameraID=4的功能申请的CSL资源,并将前置摄像头的下电。进而使得Driver中的CameraSensor停止工作。In some embodiments, this step corresponds to step ⑤ in FIG. 20 , specifically including: after receiving the second instruction, the CameraService calls the Camera HAL to control the camera driver to release the CSL resources requested for the function with CameraID=4 and power off the front camera, thereby stopping the CameraSensor in the Driver.
S1905:传感器控制模块重启后,调用第一接口,在相机控制模块中注册数据回调函数,并调用第二接口,向相机服务模块发送第一指令,以使能前置摄像头的环境光检测功能。S1905: After the sensor control module restarts, it calls the first interface to register the data callback function in the camera control module, and calls the second interface to send a first instruction to the camera service module to enable the ambient light detection function of the front camera.
在一些实施例中,该步骤对应图20中的步骤⑥,具体包括:Sensor HAL调用Active接口,然后调用libcamera2ndk_vendor接口向CameraService发送第一指令,该第一指令包括CameraID=4和环境光检测应用的包名,以使能前置摄像头的环境光检测功能。In some embodiments, this step corresponds to step ⑥ in Figure 20, specifically including: the Sensor HAL calls the Active interface, and then calls the libcamera2ndk_vendor interface to send a first instruction to the 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.
通常,相机软件流程相对实体环境光软件流程更加复杂,且功耗上消耗更大,满足性能要求不能满足功耗要求,满足功耗要求又不能满足性能要求。为此,本申请实施例还将对上述实施例中显示屏亮度的调节方法进行优化,从而在降低功能的前提下,保证第一帧数据能够及时有效地上报。结合图21,该方法在降功耗优化性能方面,主要涉及以下三方面: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 functions. In conjunction with Figure 21, this method mainly involves the following three aspects in terms of reducing power consumption and optimizing performance:
第一方面,精简CAMX中OpenCamera函数的流程First, streamline the process of OpenCamera function in CAMX
针对第一方面,本申请实施例对原有的Open Camera函数的流程进行定制化处理,增加了跳出出图配流的分支,在调用CameraService调用Camera HAL中的Open Camera函数时,当原有的Open Camera函数支持打开前置摄像头的环境光检测功能时,则调用封装函数OpenCamLightSensor跳过出图配流流程,节省了前置摄像头作为环境光检测器件使用时资源的消耗,提升了电子设备的性能。Regarding 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 and 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 and distribution flow process, saving resource consumption when the front camera is used as an ambient light detection device and improving the performance of the electronic device.
对于精简的OpenCamera函数的执行过程,以上述图11所示的开机过程中显示屏亮度的调节过程为例进行说明。由于本申请实施例需要打开前置摄像头的环境光检测功能,当前置摄像头不支持打开前置摄像头的环境光检测功能,则无法通过调用第一函数将前置摄像头的环境光检测功能使能,因此,在调用第一函数后,还将调用第一函数中的第一子函数,判断前置摄像头是否支持环境光检测功能,当前置摄像头支持环境光检测功能,再调用第一函数中的第二子函数,进而控制摄像头驱动将前置摄像头上电、初始化摄像头寄存器及创建异步读取线程,使得Driver中的CameraSensor开始工作。通过执行该精简的OpenCamera函数,可以跳过出图配流流程,缩短环境光检测功能的打开时长,提升电子设备的性能。The execution process of the simplified OpenCamera function is described by taking the process of adjusting the brightness of the display screen during the startup process shown in Figure 11 as an example. 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 reading thread, so that the CameraSensor in the Driver starts working. By executing this simplified 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.
其中,环境光检测判断函数可以为IsSupportCamLightSensor()(支持相机亮度传感器),环境光检测传感器函数可以为OpenCamLightSensor()(打开相机亮度传感器)。The ambient light detection judgment function may be IsSupportCamLightSensor() (supporting the camera brightness sensor), and the ambient light detection sensor function may be OpenCamLightSensor() (opening the camera brightness sensor).
上述判断前置摄像头是否支持环境光检测的逻辑的代码为:static int open(const structThe code for the logic of judging whether the front camera supports ambient light detection is: static int open(const struct
当然,当前置摄像头不支持环境光检测,则可以通过与内核层中的摄像头驱动进行交互,控制摄像头驱动为前置摄像头的环境光检测功能申请CSL资源缓存,将前置摄像头上电、初始化摄像头寄存器及为前置摄像头配流,使得前置摄像头可以出图。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.
第二方面,为读取线程设置较高的优先级Second, set a higher priority for the reading thread
考虑到摄像头驱动内同时可能会执行多个线程,为保证环境光亮度的及时上报,可为异步线程设置较高的优先级,从而在资源有限的情况下,能够优先保证读取线程的执行。Considering that multiple threads may be executed simultaneously in the camera driver, in order to ensure 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.
第三方面,自适应切换频率Third, adaptive switching frequency
电子设备对环境光亮度的第一帧数据(这里说的一帧数据并非图像帧)要求比较严苛,一般要求300ms以内需要上报,对应第二帧数据及以后帧的数据没有严苛要求,而第一帧数据的上报时长取决于前置摄像头的帧率。当为降低功耗,将前置摄像头的频率设置为较低的频率,由于检测环境光亮度需要时间,则在300毫秒内可能无法上报数据。为保证首帧数据能够及时上报,本申请实施例提供了一种自适应的频率切换方法,该方法会记录目标次数,并将该目标次数写入到摄像头寄存器中。该目标次数可以为电子设备本次亮屏后相机控制模块从前置摄像头读取环境光亮度的次数,也可以为电子设备最近一次亮屏后相机控制模块从前置摄像头读取环境光亮度的次数。电子设备灭屏后,摄像头寄存器中所记录的目标次数将随之清零。前置摄像头上电后,相机控制模块从摄像头寄存器中获取目标次数,当目标次数为0次,相机控制模块将第一频率写入摄像头寄存器中,也就是在第二次读取前写入,并控制前置摄像头按照第一频率检测环境光亮度;当目标次数大于0次,相机控制模块将第二频率写入摄像头寄存器中,并控制前置摄像头按照第二频率检测环境光亮度,第一频率大于第二频率。其中,前置摄像头检测环境光亮度的频率可以基于预设帧率确定。例如,第一频率对应第一预设帧率,第二频率对应第二预设帧率。第一预设帧率高于第二预设帧率,第一预设帧率可以为30fps,第二预设帧率可以为5fps或者3fps。Electronic devices have relatively strict requirements for the first frame data of ambient light brightness (the one frame data here is not the image frame), and generally require it to be reported 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, it may not be possible to report data 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 read, 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, where the first frequency is greater than the second frequency. 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.
该优化方法可在步骤S1105之后、S1107之前执行。通过对前置摄像头采集环境光亮度的频率进行自适应调节,不仅保证了首帧数据及时上报,而且降低了电子设备的功耗。This optimization method can be executed after step S1105 and before step S1107. By adaptively adjusting the frequency at which the front camera collects ambient light brightness, not only is the first frame data reported in a timely manner, but the power consumption of the electronic device is also reduced.
参见图22,图22为本申请实施例提供的一种环境光亮度确定方法的流程图,该方法应用于电子设备。首先,Index取CurrentIndex-1,并获取当前亮度。当前亮度为前一帧环境光亮度,当前亮度区间为前一帧的环境光亮度所属的亮度区间(即第一亮度区间)。Index表示亮度区间。记当前的亮度区间为c,Index取CurrentIndex-1也就是确定当前亮度区间的前一个亮度区间,记为c-1。See Figure 22, which is a flow chart of a method for determining ambient light brightness provided in an embodiment of the present application, which is applied to electronic devices. 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. Let the current brightness interval be c, and Index takes CurrentIndex-1, that is, to determine the brightness interval before the current brightness interval, which is recorded as c-1.
然后,在Index等于CurrentIndex-1时,判断Index与Index+1的Type是否不相等于。由于Index取CurrentIndex-1,此时,Index为c-1,Index+1也就是c-1+1(即c),也就是判断当前亮度区间与前一个亮度区间的Setting Type是否不相等于。Then, when Index equals CurrentIndex - 1, determine whether the Type of Index and Index+1 are not equal. Since Index is CurrentIndex - 1, at this point, Index is c-1, and Index+1 is c-1+1 (i.e., c). This means that the Setting Type of the current brightness interval is not equal to that of the previous brightness interval.
如果Index等于CurrentIndex-1,且Index与Index+1的Type不相等于,即当前亮度区间与前一个亮度区间的Setting Type不相同。也就是前一档(前一个亮度区间c-1)的Type与当前一档(即当前亮度区间c)不一样,则跳出这次循环,不用上一次的系数算当前lux,即使用前一个亮度区间对应的校准系数,确定第二环境光亮度。If Index equals CurrentIndex-1, and the Types of Index and Index+1 are not equal, the current brightness range and the previous brightness range have different Setting Types. In other words, the Type of the previous range (previous brightness range c-1) is different from the current range (current brightness range c), then the loop is exited and the current lux is calculated without using the previous coefficient. Instead, the calibration coefficient corresponding to the previous brightness range is used to determine the second ambient light brightness.
进而,Index取Index+1,由于之前Index取Index-1(即c-1),则此时Index+1为c,也就是使用当前亮度区间(即c)对应的校准系数,确定第二环境光亮度。并判断第二环境光亮度是否位于前一个亮度区间,还是位于当前亮度区间。如果第二环境光亮度位于前一个亮度区间,确定前一个亮度区间为目标亮度区间。如果第二环境光亮度位于当前亮度区间,确定当前亮度区间为目标亮度区间。Then, the index is set to Index+1. Since the previous index was Index-1 (i.e., c-1), Index+1 is now c. This means that the calibration coefficient corresponding to the current brightness range (i.e., c) is used to determine the brightness of the second ambient light. A determination is then made as to whether the second ambient light brightness is within the previous brightness range or the current brightness range. If the second ambient light brightness is within the previous brightness range, the previous brightness range is determined to be the target brightness range. If the second ambient light brightness is within the current brightness range, the current brightness range is determined to be the target brightness range.
进而,Index取Index+1,由于之前Index取Index+1(即c),则此时Index+1为c+1,并判断第二环境光亮度是否位于当前亮度区间的后一个亮度区间(即c+1)。如果第二环境光亮度位于后一个亮度区间,确定后一个亮度区间为目标亮度区间。Next, the index is set to Index+1. Since the previous index was Index+1 (i.e., c), Index+1 is now c+1. A determination is then made as to whether the second ambient light brightness is within the brightness interval following the current brightness interval (i.e., c+1). If the second ambient light brightness is within the following brightness interval, the following brightness interval is determined to be the target brightness interval.
图22中,Index++是指第一次Index取Index+1(即c),以及第二次Index取Index+1(即c+1)。In FIG22 , Index++ means that the first time the Index is taken, the Index+1 (ie, c) is obtained, and the second time the Index is taken, the Index+1 (ie, c+1) is obtained.
如果Index等于CurrentIndex-1,且Index与Index+1的Type相等于,即当前亮度区间与前一个亮度区间的Setting Type相同。判断Index是否等于current(当前),以及是否有前一档。也就是判断Index的取值是否为c,以及是否存在当前亮度区间的前一亮度区间。If Index equals CurrentIndex-1, and the Types of Index and Index+1 are the same, the current brightness range and the previous brightness range have the same Setting Type. Check whether Index equals current and whether there is a previous range. In other words, check whether Index is c and whether there is a brightness range previous to the current brightness range.
如果Index的取值为c,且存在当前亮度区间的前一个亮度区间(即c-1)时,在当前亮度在前一档(Index-1)范围就给CurrentIndex=Index-1,并跳出循环。也就是存在前一个亮度区间时,使用前一个亮度区间对应的校准系数计算第二环境光亮度,如果第二环境光亮度位于前一个亮度区间,确定前一个亮度区间为目标亮度区间。If the value of Index is c and there is a brightness interval before the current brightness interval (i.e., c-1), if the current brightness is within the previous range (Index-1), CurrentIndex = Index-1 and the loop is exited. In other words, if 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 within the previous brightness interval, the previous brightness interval is determined to be the target brightness interval.
如果Index的取值为c,且不存在当前亮度区间的前一个亮度区间(即c-1)时,则判断当前亮度是在Index的范围,还是Index+1的范围,并给CurrentIndex赋相对应的值。也就是不存在前一个亮度区间时,使用当前亮度区间对应的校准系数计算第三环境光亮度,如果第三环境光亮度位于当前亮度区间,确定当前亮度区间为目标亮度区间。如果第三环境光亮度位于后一个亮度区间,确定后一个亮度区间为目标亮度区间。If the value of Index is c and there is no brightness interval before the current brightness interval (i.e., c-1), then the current brightness is determined to be within the range of Index or Index+1, and the corresponding value is assigned to CurrentIndex. In other words, if there is no previous brightness interval, the calibration coefficient corresponding to the current brightness interval is used to calculate the third ambient light brightness. 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.
进而,基于目标亮度区间对应的目标校准系数和当前帧采集的目标图像数据,计算当前帧的目标环境光亮度。Furthermore, the target ambient light brightness of the current frame is calculated based on the target calibration coefficient corresponding to the target brightness interval and the target image data collected in the current frame.
以下结合图23和图24,对图22提供的环境光亮度确定方法的效果进行说明。其中,带原点的折线为实体器件检测到的实测lux与模拟的定位lux的对应关系。带三角形的折线为Default(不履行)参数检测到的实测lux与模拟的定位lux的对应关系。带正方形的折线为低/中/高三段参数检测到的实测lux与模拟的定位lux的对应关系。The following describes the effects of the ambient light brightness determination method provided in Figure 22, in conjunction with Figures 23 and 24. The broken line with the origin represents the correspondence between the measured lux detected by the physical device and the simulated positioning lux. The broken line with triangles represents the correspondence between the measured lux detected using the Default (non-implemented) parameter and the simulated positioning lux. The broken lines with squares represent the correspondence between the measured lux detected using the Low, Medium, and High parameter settings and the simulated positioning lux.
其中,实体器件检测到的实测lux为环境光检测器件检测到的环境光亮度。Default参数检测到的实测lux为按照现有技术的方式确定出的环境光亮度。低/中/高三段参数检测到的实测lux为按照图22提供的方法确定环境光亮度。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 according to the existing method. The measured lux detected by the low/medium/high parameters is the ambient light brightness determined according to the method provided in Figure 22.
根据图23和图24可以得到,图22提供的环境光亮度确定方法,检测到的环境光亮度更接近实体器件检测的环境光亮度,且更接近模拟的环境光亮度,准确性较高。后续,基于按照图22提供的方法确定的环境光亮度,调节电子设备的显示屏亮度,可以提高对电子设备的显示屏亮度调节的准确性,提高用户体验。As shown in Figures 23 and 24, the ambient light brightness determination method provided in Figure 22 detects ambient light brightness that is closer to the ambient light brightness detected by the physical device and closer to the simulated ambient light brightness, resulting in higher accuracy. Subsequently, adjusting the brightness of the electronic device's display based on the ambient light brightness determined using the method provided in Figure 22 can improve the accuracy of the display brightness adjustment and enhance the user experience.
具体实现中,本申请还提供一种电子设备,该电子设备包括一个或多个处理器和存储器;存储器与一个或多个处理器耦合,存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器调用计算机指令以使得电子设备执行上述方法实施例中的部分或全部步骤。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 execute some or all of the steps in the above method embodiment.
本申请还提供一种计算机可读存储介质,包括计算机程序,当计算机程序在电子设备上运行时,使得电子设备执行上述方法实施例中的部分或全部步骤。上述的存储介质可为磁碟、光盘、只读存储器(Read-Only Memory,ROM)或随机存储器(Random AccessMemory,RAM)等。The present application also provides a computer-readable storage medium including a computer program. When the computer program is executed on an electronic device, the electronic device executes some or all of the steps in the above method embodiments. The above storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
具体实现中,本申请实施例还提供了一种计算机程序产品,上述计算机程序产品包含可执行指令,当可执行指令在电子设备上执行时,使得电子设备执行上述方法实施例中的部分或全部步骤。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 some or all of the steps in the above method embodiment.
如图25所示,本申请还提供了一种芯片系统,该芯片系统应用于电子设备,芯片系统包括一个或多个处理器2501,处理器2501用于调用计算机指令以使得电子设备将待处理的数据输入芯片系统,芯片系统基于本申请实施例提供的显示屏亮度调节方法对数据进行处理后输出处理结果。As shown in Figure 25, 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 brightness adjustment method provided in the embodiment of the present application and outputs the processing results.
在一种可能的实现方式中,芯片系统还包括输入和输出接口,用于输入和输出数据。In one possible implementation, the chip system further includes input and output interfaces for inputting and outputting data.
本申请公开的机制的各实施例可以被实现在硬件、软件、固件或这些实现方法的组合中。本申请的实施例可实现为在可编程系统上执行的计算机程序或程序代码,该可编程系统包括至少一个处理器、存储系统(包括易失性和非易失性存储器和/或存储元件)、至少一个输入设备以及至少一个输出设备。The various embodiments of the mechanisms disclosed in this 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.
可将程序代码应用于输入指令,以执行本申请描述的各功能并生成输出信息。可以按已知方式将输出信息应用于一个或多个输出设备。为了本申请的目的,处理系统包括具有诸如例如数字信号处理器(Digital Signal Processor,DSP)、微控制器、专用集成电路(Application Specific Integrated Circuit,ASIC)或微处理器之类的处理器的任何系统。Program code can be applied to input instructions to perform the functions described herein 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.
程序代码可以用高级程序化语言或面向对象的编程语言来实现,以便与处理系统通信。在需要时,也可用汇编语言或机器语言来实现程序代码。事实上,本申请中描述的机制不限于任何特定编程语言的范围。在任一情形下,该语言可以是编译语言或解释语言。Program code can be implemented with a high-level programming language or an object-oriented programming language to communicate with the processing system. Where necessary, program code can also be implemented in assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any particular programming language. In either case, the language can be a compiled language or an interpreted language.
在一些情况下,所公开的实施例可以以硬件、固件、软件或其任何组合来实现。所公开的实施例还可以被实现为由一个或多个暂时或非暂时性机器可读(例如,计算机可读)存储介质承载或存储在其上的指令,其可以由一个或多个处理器读取和执行。例如,指令可以通过网络或通过其他计算机可读介质分发。因此,机器可读介质可以包括用于以机器(例如,计算机)可读的形式存储或传输信息的任何机制,包括但不限于,软盘、光盘、光碟、光盘只读存储器(Compact Disc Read Only Memory,CD-ROMs)、磁光盘、只读存储器、随机存储器、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read Only Memory,EEPROM)、磁卡或光卡、闪存、或用于利用因特网以电、光、声或其他形式的传播信号来传输信息(例如,载波、红外信号数字信号等)的有形的机器可读存储器。因此,机器可读介质包括适合于以机器(例如,计算机)可读的形式存储或传输电子指令或信息的任何类型的机器可读介质。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 by 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 includes 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).
在附图中,可以以特定布置和/或顺序示出一些结构或方法特征。然而,应该理解,可能不需要这样的特定布置和/或排序。而是,在一些实施例中,这些特征可以以不同于说明书附图中所示的方式和/或顺序来布置。另外,在特定图中包括结构或方法特征并不意味着暗示在所有实施例中都需要这样的特征,并且在一些实施例中,可以不包括这些特征或者可以与其他特征组合。In the accompanying drawings, some structural or method features may be shown in a particular arrangement and/or order. However, it should be understood that such a particular arrangement and/or order may not be required. Rather, in some embodiments, these features may be arranged in a manner and/or order different from that shown in the accompanying drawings. In addition, the inclusion of a structural or method feature in a particular figure does not imply that such a feature is required in all embodiments, and in some embodiments, such features may not be included or may be combined with other features.
需要说明的是,本申请各设备实施例中提到的各单元/模块都是逻辑单元/模块,在物理上,一个逻辑单元/模块可以是一个物理单元/模块,也可以是一个物理单元/模块的一部分,还可以以多个物理单元/模块的组合实现,这些逻辑单元/模块本身的物理实现方式并不是最重要的,这些逻辑单元/模块所实现的功能的组合才是解决本申请所提出的技术问题的关键。此外,为了突出本申请的创新部分,本申请上述各设备实施例并没有将与解决本申请所提出的技术问题关系不太密切的单元/模块引入,这并不表明上述设备实施例并不存在其它的单元/模块。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 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 raised by this application. In addition, in order to highlight the innovative part of this application, the above-mentioned device embodiments of this application do not introduce units/modules that are not closely related to solving the technical problems raised by this application. This does not mean that other units/modules do not exist in the above-mentioned device embodiments.
需要说明的是,在本专利的示例和说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are used only 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 that includes 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, an element defined by the sentence "including a" does not exclude the presence of other identical elements in the process, method, article or device that includes the element.
虽然通过参照本申请的某些优选实施例,已经对本申请进行了图示和描述,但本领域的普通技术人员应该明白,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。Although the present application has been shown and described with reference to certain preferred embodiments thereof, it will be understood by 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 application.
Claims (15)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410427040.8A CN119252210B (en) | 2024-04-09 | 2024-04-09 | Display screen brightness adjusting method, electronic equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410427040.8A CN119252210B (en) | 2024-04-09 | 2024-04-09 | Display screen brightness adjusting method, electronic equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN119252210A CN119252210A (en) | 2025-01-03 |
| CN119252210B true CN119252210B (en) | 2025-08-15 |
Family
ID=94023504
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410427040.8A Active CN119252210B (en) | 2024-04-09 | 2024-04-09 | Display screen brightness adjusting method, electronic equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119252210B (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103856823A (en) * | 2012-12-06 | 2014-06-11 | 腾讯科技(深圳)有限公司 | Interface adjustment method, device and terminal |
| CN109272917A (en) * | 2018-10-25 | 2019-01-25 | Oppo广东移动通信有限公司 | Screen brightness adjustment method, device, storage medium and electronic device |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060092182A1 (en) * | 2004-11-04 | 2006-05-04 | Intel Corporation | Display brightness adjustment |
| KR100812000B1 (en) * | 2006-11-02 | 2008-03-10 | 삼성에스디아이 주식회사 | Organic light emitting display device and driving method thereof |
| US8860653B2 (en) * | 2010-09-01 | 2014-10-14 | Apple Inc. | Ambient light sensing technique |
-
2024
- 2024-04-09 CN CN202410427040.8A patent/CN119252210B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103856823A (en) * | 2012-12-06 | 2014-06-11 | 腾讯科技(深圳)有限公司 | Interface adjustment method, device and terminal |
| CN109272917A (en) * | 2018-10-25 | 2019-01-25 | Oppo广东移动通信有限公司 | Screen brightness adjustment method, device, storage medium and electronic device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN119252210A (en) | 2025-01-03 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP4280056A1 (en) | Method for application performing drawing operation, and electronic device | |
| CN113961157B (en) | Display interaction system, display method and equipment | |
| CN112527476B (en) | Resource scheduling method and electronic equipment | |
| JP2023506936A (en) | MULTI-SCREEN COOPERATION METHOD AND SYSTEM AND ELECTRONIC DEVICE | |
| WO2022127632A1 (en) | Resource management and control method, and device | |
| CN116074634B (en) | Exposure parameter determination method and device | |
| CN117130773B (en) | Resource allocation method, device and equipment | |
| CN110413383B (en) | Event processing method, device, terminal and storage medium | |
| US12333288B2 (en) | Application installation method and electronic device | |
| CN116483734B (en) | Pile inserting method and system based on compiler and related electronic equipment | |
| EP4390677A1 (en) | Animation effect display method and electronic device | |
| CN116467221A (en) | Pile inserting method and system based on interpreter and related electronic equipment | |
| WO2023193720A9 (en) | Control method and central control equipment | |
| CN117707243B (en) | Temperature control method of electronic equipment | |
| CN119252210B (en) | Display screen brightness adjusting method, electronic equipment and storage medium | |
| WO2025001352A1 (en) | Method for sharing input device, and electronic device and storage medium | |
| CN116048629B (en) | System service switching method and control device, electronic device and storage medium | |
| CN116048955B (en) | A testing method and electronic equipment | |
| CN114489469B (en) | A data reading method, electronic device and storage medium | |
| CN118450251B (en) | Camera enabling priority management method, electronic equipment and storage medium | |
| WO2025129684A1 (en) | Method for adjusting brightness of display screen, electronic device, storage medium, and program product | |
| CN117995137B (en) | Method for adjusting color temperature of display screen, electronic equipment and related medium | |
| CN117221713B (en) | Parameter loading method and electronic device | |
| US20240422020A1 (en) | Device collaboration method | |
| EP4507397A1 (en) | Method and system for controlling power consumption of device, and electronic device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information |
Country or region after: China Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040 Applicant after: Honor Terminal Co.,Ltd. Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong Applicant before: Honor Device Co.,Ltd. Country or region before: China |
|
| GR01 | Patent grant | ||
| GR01 | Patent grant |