CN116052567B - Method for adjusting ambient light gain, electronic device and readable storage medium - Google Patents

Method for adjusting ambient light gain, electronic device and readable storage medium Download PDF

Info

Publication number
CN116052567B
CN116052567B CN202210605315.3A CN202210605315A CN116052567B CN 116052567 B CN116052567 B CN 116052567B CN 202210605315 A CN202210605315 A CN 202210605315A CN 116052567 B CN116052567 B CN 116052567B
Authority
CN
China
Prior art keywords
value
gain
ambient light
gain value
sampling value
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
Application number
CN202210605315.3A
Other languages
Chinese (zh)
Other versions
CN116052567A (en
Inventor
张文礼
王浩
王思文
朱英杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210605315.3A priority Critical patent/CN116052567B/en
Publication of CN116052567A publication Critical patent/CN116052567A/en
Application granted granted Critical
Publication of CN116052567B publication Critical patent/CN116052567B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G3/00Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
    • G09G3/20Control 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
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G3/00Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
    • G09G3/20Control 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/22Control 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/30Control 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/32Control 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]
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G3/00Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
    • G09G3/20Control 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/22Control 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/30Control 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/32Control 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/3208Control 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]
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G3/00Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
    • G09G3/20Control 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/34Control 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/36Control 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
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G2360/00Aspects of the architecture of display systems
    • G09G2360/14Detecting light within display terminals, e.g. using a single or a plurality of photosensors
    • G09G2360/144Detecting light within display terminals, e.g. using a single or a plurality of photosensors the light being ambient light
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

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)
  • Telephone Function (AREA)

Abstract

The application provides a method for adjusting ambient light gain, electronic equipment and a readable storage medium, which belong to the technical field of electronic equipment, and the method is applied to the electronic equipment and comprises the following steps: converting the ambient light intensity value into a sampling value corresponding to the equipment capacity, and determining a first gain value and a first preset sampling value corresponding to the sampling value; when the sampling value is determined to be larger than a second preset sampling value, performing degradation operation on the first gain value, wherein in the degradation operation, the number of steps of degradation is obtained by operation based on the first preset sampling value; the second preset sampling value is used for representing the upper limit of the measuring range of the sampling value, which is possessed by the electronic equipment, and the second preset sampling value is larger than or equal to the first preset sampling value; and determining a second gain value based on the result of the degradation operation, wherein the second gain value is used for acquiring the ambient light intensity value. The jump level adjustment of the gain value can be realized, the adjustment speed of the gain of the ambient light is improved, the screen brightness change can not be perceived by a user as much as possible, and the user experience is improved.

Description

Method for adjusting ambient light gain, electronic device and readable storage medium
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method for adjusting an ambient light gain, an electronic device, and a readable storage medium.
Background
For ambient light sensors (Ambient Light Sensor, ALS), when a large abrupt change in the intensity of light is encountered, the ALS device needs to adjust the gain value in order to be able to integrate the intensity value of the ambient light more accurately and report the corresponding value of the ambient light. During the gain value adjustment, since the ALS device cannot accurately measure the intensity of ambient light, the lux value of the light intensity is not reported and cannot be used to support screen adjustment of brightness. The amount of time it takes to adjust the gain value is important for the ALS device to respond to abrupt changes in the intensity of the ambient light. If the time for adjusting the gain value is too long, the change of the external environment light is shown for a period of time, and the adjustment of the screen brightness is obviously delayed from the change of the external light, so that the user experience is greatly reduced.
Disclosure of Invention
In view of the above, the present invention provides a method for adjusting gain of ambient light, an electronic device, and a computer readable storage medium, which are used for improving speed of adjusting gain corresponding to ambient light, making a user feel as less as possible of changes in screen brightness lag, and improving user experience.
Some embodiments of the present application provide a method for adjusting gain of ambient light. The application is described in terms of several aspects, embodiments and advantages of which can be referenced to one another.
In a first aspect, the present application provides a method for adjusting gain of ambient light, applied to an electronic device, the method comprising: acquiring an ambient light intensity value of the surrounding environment within a preset time; converting the ambient light intensity value into a sampling value corresponding to the equipment capacity, and determining a first gain value and a first preset sampling value corresponding to the sampling value, wherein the first preset sampling value represents the upper limit of the numerical count of the characteristic ambient light intensity value in a preset time range; when the sampling value is determined to be larger than a second preset sampling value, carrying out degradation operation on the first gain value, wherein in the degradation operation, the number of steps of degradation is obtained based on operation until the sampling value is lower than the first preset sampling value; the second preset sampling value is used for representing the upper limit of the measuring range of the sampling value, which is possessed by the electronic equipment, and the second preset sampling value is larger than or equal to the first preset sampling value; and determining a second gain value based on the result of the degradation operation, wherein the second gain value is used for acquiring the ambient light intensity value.
According to the method provided by the embodiment of the application, on the basis of shortening the integration time, the speed of adjusting the gain of the ambient light is improved by adjusting the gain value in a jump level mode, so that the speed of adjusting the brightness of the screen is improved, and the user experience is improved.
As an embodiment of the first aspect of the present application, when the sampling value corresponding to the ambient light intensity value obtained based on the second gain value is out of the preset range, the second gain value is used as the first gain value, and the degradation operation is performed in a recycling manner until the sampling value corresponding to the obtained ambient light intensity value is not required to be adjusted, and in an environment where the ambient light is extremely strong, the ambient light gain can be adjusted by multiple times of degradation operation, so that the gain adjustment speed is improved, and the screen brightness adjustment speed is improved.
As an embodiment of the first aspect of the present application, the first preset sample value is obtained based on a maximum integrated sample value characterizing the sampling accuracy that can be obtained within a preset time.
As an embodiment of the first aspect of the present application, when it is determined that the sampling value is greater than the second preset sampling value, performing a degradation operation on the first gain value includes: and when the sampling value is determined to be larger than the second preset sampling value and the first gain value is not the minimum value, performing degradation operation on the first gain value.
As an embodiment of the first aspect of the present application, when it is determined that the sampling value is greater than the second preset sampling value and the first gain value is the minimum value, the first gain value is not adjusted.
As an embodiment of the first aspect of the application, the electronic device determines that the first gain value is not to be adjusted when the sample value is smaller than the second preset sample value.
As an embodiment of the first aspect of the application, the method further comprises: and when the sampling value is determined to be greater than or equal to a third preset sampling value, not adjusting the first gain value, wherein the third preset sampling value is smaller than the first preset sampling value, and the third preset sampling value is used for representing the lower limit of the digital count of the characterization environment light intensity value in the integration period.
As an embodiment of the first aspect of the present application, when the electronic device determines that the sampling value is smaller than the third preset sampling value and the first gain value is the maximum value, the first gain value is not adjusted.
As an embodiment of the first aspect of the present application, when the electronic device determines that the sampling value is smaller than the third preset sampling value and the first gain value is not the maximum value, performing an increase operation on the first gain value; in the growing operation, the growing progression is obtained by operation based on a third preset sampling value; and determining a third gain value based on the result of the growth operation, wherein the third gain value is used for acquiring the ambient light intensity value until the acquired ambient light intensity value is within a preset range.
As an embodiment of the first aspect of the present application, when the electronic device determines that the sampling value is smaller than the third preset sampling value and the electronic device determines that the electronic device is in a state of proximity to the nearby object, the electronic device does not perform the increase operation on the first gain value. Therefore, the calculation and adjustment of the gain value can be eliminated for extreme scenes, such as the scene of answering a call, so that a user cannot perceive screen change, the user experience is improved, and meanwhile, the system overhead is reduced.
As an embodiment of the first aspect of the present application, the electronic device determining that the proximity object is in a proximity state includes: the electronic device acquires reflected light from a nearby object; and judging that the electronic equipment approaches to the nearby object based on the reflected light, and determining that the electronic equipment is in an approaching state with the nearby object when the distance between the electronic equipment and the nearby object reaches a preset distance. The condition for triggering the electronic device to obtain the reflected light from the accessory object may be (including but not limited to, that other application scenarios where the registered proximity light exists are also effective) that there is a phone access to the electronic device, and after the user answers the phone, triggering the proximity light sensor of the electronic device to emit light, such as infrared, and obtaining the reflected light, so as to identify the distance between the mobile phone and the user (the nearby object). Typically, the distance refers to the distance that most of the ambient light rays are blocked by the user relative to the electronic device when a call is placed.
In a second aspect, the present application also provides an electronic device, including:
the acquisition module is used for acquiring the ambient light intensity value of the surrounding environment within preset time;
the conversion module is used for converting the ambient light intensity value into a sampling value corresponding to the equipment capacity and determining a first gain value and a first preset sampling value corresponding to the sampling value;
the processing module is used for carrying out degradation operation on the first gain value when the sampling value is determined to be larger than the second preset sampling value, wherein in the degradation operation, the number of the reduced stages is obtained by carrying out operation on the basis of the first preset sampling value; the second preset sampling value is used for representing the upper limit of the measuring range of the sampling value, which is possessed by the electronic equipment, and the second preset sampling value is larger than or equal to the first preset sampling value;
the processing module is used for determining a second gain value based on the result of the degradation operation, wherein the second gain value is used for acquiring the ambient light intensity value.
According to the electronic device provided by the embodiment of the application, on the basis of shortening the integration time, the time consumption of gain adjustment of the electronic equipment is reduced by adjusting the gain value in a jump level mode, so that the speed of screen brightness adjustment is improved, and the user experience is improved.
As an embodiment of the second aspect, the processing module is configured to, when the sampling value corresponding to the ambient light intensity value obtained based on the second gain value is outside the preset range, make the second gain value be used as the first gain value, and perform the degradation operation in a recycling manner until the obtained sampling value corresponding to the ambient light intensity value does not need to be adjusted. Through multiple degradation operations, the gain of the ambient light can be adjusted through multiple jump stages, and the gain adjustment speed is improved, so that the screen brightness adjustment speed is improved.
As an embodiment of the second aspect, the first preset sample value is obtained based on a maximum integrated sample value that can be obtained within a preset time.
As an embodiment of the second aspect, when the processing module determines that the sampling value is greater than the second preset sampling value and the first gain value is not the minimum value, performing a degradation simulation operation on the first gain value.
As an embodiment of the second aspect, when the processing module determines that the sampling value is greater than the second preset sampling value and the first gain value is the minimum value, the first gain value is not adjusted.
As an embodiment of the second aspect, the processing module determines that the first gain value is not adjusted when the sampling value is smaller than a second preset sampling value.
As an embodiment of the second aspect, when the processing module determines that the sampling value is greater than or equal to a third preset sampling value, the first gain value is not adjusted, and the third preset sampling value is smaller than the first preset sampling value, where the third sampling value is used to represent a lower limit of a measuring range of the electronic device capable of measuring the sampling value, and may also represent a lower limit of available accuracy of the sampling value.
As an embodiment of the second aspect, when the processing module determines that the sampling value is smaller than the third preset sampling value and the first gain value is the maximum value, the first gain value is not adjusted.
As an embodiment of the second aspect, when the processing module determines that the sampling value is smaller than the third preset sampling value and the first gain value is not the maximum value, performing a growth simulation operation on the first gain value; in the growing operation, the growing progression is obtained by operation based on a third preset sampling value; and determining a third gain value based on the result of the growth operation, wherein the third gain value is used for acquiring the ambient light intensity value until the sampling value corresponding to the acquired ambient light intensity value is not regulated.
As an embodiment of the second aspect, when the electronic device determines that the sampling value is smaller than the third preset sampling value and the electronic device determines that the electronic device is in a state of proximity to a nearby object, the growth adjustment operation is not performed on the first gain value.
As an embodiment of the second aspect, an acquisition module for acquiring reflected light from a nearby object;
the processing module is used for judging that the electronic device approaches to a nearby object based on the reflected light, and determining that the electronic device is in an approaching state with the nearby object when the distance between the electronic device and the nearby object reaches a preset distance.
In a third aspect, the present application also discloses an electronic device, including:
the ambient light sensor is used for acquiring the ambient light intensity value of the surrounding environment within preset time;
The analog-to-digital converter is used for converting the ambient light intensity value into a sampling value corresponding to the equipment capacity;
a memory for storing instructions for execution by one or more processors of the device,
and a processor configured to execute the instructions to cause the electronic device to perform the method of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which, when executed by an electronic device, causes the electronic device to perform the method of the embodiment of the first aspect.
In a fifth aspect, the present application discloses a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the embodiments of the first aspect described above.
Drawings
FIG. 1 is a scene diagram showing a change in screen brightness of a mobile phone after an external ambient light is dimmed;
FIG. 2 is a schematic diagram of an electronic device according to an embodiment of the present application;
FIG. 3 is a block diagram of the software architecture of an electronic device according to one embodiment of the application;
FIG. 4 is a flow chart of a method for adjusting gain of reduced ambient light according to an embodiment of the application;
FIG. 5 is a flow chart of a method for adjusting gain of increased ambient light according to another embodiment of the present application;
FIG. 6 is a diagram of a scenario in which a user makes a call according to one embodiment of the present application;
FIG. 7 is a flow chart of a process of approaching and distancing states in accordance with an embodiment of the present application;
FIG. 8 is a flowchart of an overall framework for adjusting gain values according to one embodiment of the present application;
FIG. 9 is a flowchart of adjusting gain values of sampling channels according to another embodiment of the present application;
fig. 10 is a block diagram of a system-on-chip according to some embodiments of the application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
In order to facilitate understanding of the technical solutions of the present application, the terms mentioned in the present application are explained first.
Ambient light intensity value, in the present context, refers to the sum of the light energy of ambient light radiation acquired by an electronic device over a period of time by a hardware device, such as an ambient light sensor.
The sampling value refers to digital counting when the electronic equipment converts the environmental light intensity value acquired in a certain time into a digital signal, the sampling value can accurately represent the environmental light intensity value in the equipment capacity range, and the sampling value cannot accurately represent the environmental light intensity value outside the equipment capacity range.
The maximum integral sampling value refers to the maximum ambient light intensity value which should be obtained by the electronic device in the preset time, and the numerical count corresponding to the maximum ambient light intensity value is the maximum integral sampling value. For example, the number count corresponding to the ambient light intensity value obtained in time per unit integration period, e.g., 2.779ms, is 2047.
The first preset sampling value is a preset value obtained based on the maximum integral sampling value and is smaller than the maximum integral sampling value. The first preset sample value represents an upper limit of a numerical count for more precisely characterizing the ambient light intensity value over a preset time range. For example, in the actual sampling process, when the sampling value falls between 0.25 and 0.85 times of the maximum integration sampling value, the sampling value is more accurate, that is, the ideal sampling value, and thus, the first preset sampling value can be set to be 0.85 times of the maximum integration sampling value.
The maximum range refers to the maximum digital count corresponding to the ambient light intensity value that the electronic device can measure, for example, the output of the ADC converter is 16 bits, and the maximum range is 65535. The output capability 16bit is an exemplary illustration of the present application, and in some embodiments may be 20bit or greater or lesser, and the corresponding maximum range may be greater or lesser depending on the capabilities of the converter, and is not intended to be limiting.
The second preset sampling value is obtained based on the maximum range and is smaller than the maximum range, and the second preset sampling value represents the upper limit of numerical counting for representing the ambient light intensity value more accurately in the maximum range. For example, after the actual ambient light intensity value is converted into the sampling value of the digital count, when the sampling value falls between 0.25 and 0.85 times of the maximum range, the interval represents a sampling interval with good calculation accuracy, that is, the sampling value is more accurate, and the gain value corresponding to the sampling value is an ideal value at this time, so that the gain value can be not adjusted. Thus, the second preset sample value may be set to 0.85 times the maximum range.
The third preset sampling value is obtained based on the maximum integral sampling value, is smaller than the second preset sampling value, and represents the lower limit of digital counting for representing the ambient light intensity value more accurately in the integral period. For example, the third preset sample value may be set to 0.25 times the maximum integrated sample value. The application sets the lower limit value as 0.25 of the maximum integration sampling value in the integration period to be used as the lower limit to ensure the lower limit of the precision of the sampling value. The interval of different devices may be different, and the present application is described by using, as the threshold, 0.85 times of the maximum range and 0.25 times of the maximum integration sampling value in the integration period, which are not limiting to the present application.
In order to facilitate understanding of the technical scheme of the present application, the technical problems to be solved by the present application are first described below.
Fig. 1 is a scene diagram of a mobile phone according to an embodiment of the present application, in which screen brightness changes after external ambient light changes from weak. The scene is that the mobile phone is converted into an environment with stronger ambient light intensity in the environment with weaker ambient light intensity, and at the moment, the brightness of the mobile phone is changed from dark to bright along with the change of the ambient light intensity. In general, in order to make a user feel no dark-to-bright process, a reasonable gain value needs to be obtained quickly, so that the mobile phone obtains an ambient light intensity value based on the reasonable gain value to adjust the brightness of the screen. The conventional algorithm for adjusting the gain value is to shorten the integration period (corresponding to a preset time) of the ambient light sensor. The ambient light sensor samples ambient light with fixed intensity from the outside, and the obtained sampling value is unchanged. That is, the magnitude of the sampling value of the channel to which the ambient light intensity value is acquired is related not only to the magnitude of the gain value but also to the magnitude of the integration time. Therefore, by shortening the integration period, a sampling value corresponding to a relatively small ambient light intensity value is obtained in a shorter time, whether the gain value needs to be continuously adjusted is tested, and when the gain value exceeds a reasonable range, the gain value is adjusted in a mode of adjusting the gain value step by step, so that the ambient light intensity value obtained by the ambient light sensor based on the adjusted gain value is in a reasonable range, and a reasonable ambient light intensity value is obtained quickly. This way, the time required for each stepwise adjustment of gain can be shortened as much as possible, thereby improving the speed of adjusting the gain value.
The above manner of adjusting the gain value, although effective in most user scenarios, still presents a risk of a user experience in which the screen is first dark and then bright after the bright screen is still present in a scenario in which the light intensity is greatly suddenly changed. For example, in a typical scenario of answering and making a call under strong light, when a user makes a call, most of the light is blocked when the mobile phone approaches the face, the ambient light intensity is relatively weak (very dark), and this causes the gain value to be adjusted to the maximum value. Subsequently, when the user removes the handset away from the face, the intensity of the ambient light increases (brightness is high) relative to when the user approaches the face, resulting in the gain value then again adjusting to a minimum value. For another example, when the user walks from the inside of the building to the outside of the building with the mobile phone, the gain value can be adjusted from the maximum value to the minimum value due to the change of the light under the scene that the change of the ambient light intensity is large, such as the change of the ambient light intensity from weak to strong. Although in the present way the integration time of the ambient light sensor can be reduced to a very short one. However, the gain value needs to be adjusted from the maximum value to the minimum value, so that the total times are too many when the gain value is adjusted step by step, and the time actually consumed by actually adjusting the gain value each time is also limited by time consumption such as bus operation time consumption, system scheduling time consumption and the like, so that the total time for adjusting the gain value is increased, the time for accurately reporting the ambient light intensity value is further increased, and the user experience that the screen is dark before bright still can be caused. In addition, the electronic device finishes integrating from the start of setting the register to the ambient light sensor (the time for acquiring the ambient light intensity value is finished), triggers the time for the first interruption to come, and consumes longer interruption time than the theoretical integration time, so that the total time consumed in the scene of continuously reducing the gain value can also risk overlong.
Based on the problems, the application discloses a method for adjusting the gain of the ambient light, which can improve the speed of adjusting the gain of the ambient light by adjusting the gain value in a jump stage manner on the basis of shortening the integration time.
The following describes a technical scheme of the method for adjusting the gain of the ambient light.
In order to facilitate understanding of the technical solution of the present application, the relationship among the ambient light intensity value, the sampling value and the gain value mentioned in the present application is first described below. The relational expression of the three can be similar to that under the condition that the ambient light intensity value is unchanged, the sampling value corresponding to the gain value A is X, when the gain A is changed to the gain value B, the sampling value is theoretically changed to Y=X×B/A, and similarly, in order to ensure that the sampling value is in a reasonable interval, when the ambient light intensity value is enhanced, the gain value needs to be reduced, and when the ambient light intensity value is reduced, the gain value needs to be increased. For example, in order to enable the sampling value to be within a reasonable range, in the process of changing the ambient light intensity from weak to strong, the mobile phone obtains a sampling value in an environment with strong ambient light intensity more than that in an environment with weak ambient light intensity within equal integration time. In general, in an environment with weak ambient light, the mobile phone adaptively adjusts a reasonable gain value (corresponding to the first gain value), so that the brightness of the mobile phone screen can correspond to the current ambient light intensity in the environment with weak ambient light. However, when the ambient light intensity is changed from weak to strong, based on the relation between the three, the mobile phone needs to reduce the gain value, and according to a step-by-step reduction adjustment mode, until the sampling value corresponding to the obtained ambient light intensity value is in a reasonable range, the adjusted gain value is determined, the mobile phone obtains a reasonable sampling value based on the adjusted gain value, at this time, the sampling value can accurately represent the ambient light intensity value, the mobile phone can calculate a new gain value (a second gain value) based on the step number, and then adjust the screen brightness based on the ambient light intensity value obtained by the new gain value. In addition, since the value of the sampling value is related to the capability of the hardware of the electronic device, when the converted digital count exceeds the capability of the hardware of the electronic device, the sampling value takes the maximum value that the hardware can bear. For example, the output of an analog-to-digital converter (Analog to Digital Converter, ADC) is 16 bits (device capability), so that when the ambient light intensity value is converted to a digital count, its corresponding digital count of the maximum range can only take on values from 0 to 65535. Thus, the sample values in the present application include both cases. In one case, when the sampled value converted based on the ambient light intensity value is smaller than 65535, the sampled value may be output according to the actual value, so that the ambient light intensity value may be accurately represented. In another case, when the digital count (sampling value) obtained after conversion based on the ambient light intensity value is larger than the saturation value 65535, the sampling value can only be cut off to 65535 due to the range limitation of the ADC converter, and the actual count is larger than the sampling value at this time. That is, when the sampled value is equal to 65535, the sampled value at this time is not indicative of the actual ambient light intensity value. Therefore, under the condition that the ambient light intensity value is larger, the sampling value corresponding to the ambient light intensity value may be far larger than the corresponding 65535, and in the operation process of adjusting the gain value, the gain value needs to be adjusted step by step until the sampling value corresponding to the ambient light intensity value obtained by the adjusted gain value can represent the actually obtained ambient light intensity value, or within a preset reasonable range, the mobile phone can accurately adjust the brightness corresponding to the current ambient light intensity value based on the sampling value.
Referring to the above-described scene shown in fig. 1, in these scenes in which the ambient light changes relatively greatly, in order to be able to quickly obtain the ambient light intensity value within a reasonable range, it is necessary to calculate the adjustment gain value as soon as possible. Therefore, in the application, after the mobile phone acquires the ambient light intensity value of the surrounding environment within the preset time, the ambient light intensity value is converted into the sampling value corresponding to the equipment capacity, and the first gain value and the first preset sampling value corresponding to the sampling value are determined. When the mobile phone determines that the sampling value is greater than the second preset sampling value, performing degradation simulation operation on the first gain value, and taking the first preset sampling value as a sampling value measurement standard until the gain value (second gain value) obtained after degradation is oppositeThe corresponding sample value is smaller than the first preset sample value. For example, the first gain value may be 2 n N is reduced by 1, which means that the gain value is reduced by 1 level, and the corresponding sampling value is reduced by half. And performing step-by-step calculation by the same way until the sampling value is smaller than the first preset sampling value, and determining the reduction level of the gain value. The mobile phone obtains a second gain value after the number of steps corresponding to the decrease of the first gain value, for example, the first gain value is 2 n When the number of the steps is 2, the second gain value is 2 n-2 . At this time, the ambient light intensity value obtained by the mobile phone based on the second gain value is within a reasonable preset range, for example, smaller than the first preset sampling value and larger than the lower limit of the measurable range. Compared with gradual reduction, the level number scheme of the application takes the first preset sampling value smaller than the second preset sampling value as a degradation standard, and the gain value calculated based on the first preset sampling value can be reduced by more than 1 level at a time, so that the mobile phone does not need to reduce the gain value step by step in the process of actually adjusting the gain value, but adjusts the gain value at a speed larger than 1, and can calculate a reasonable gain value more quickly. Thereby increasing the speed of adjusting the gain value, i.e. increasing the speed of adjusting the gain of the ambient light. Further, the adjustment speed of the brightness of the mobile phone screen is improved, so that the time for a user to perceive the change of the brightness of the mobile phone screen is reduced as much as possible, and the user experience is improved.
It should be noted that, for the specific conversion formula among the ambient light intensity value, the gain value and the sampling value, reference may be made to the formulas in the prior art, and the present application will not be described in detail.
In the above embodiments, the mobile phone is used as the electronic device. In some embodiments of the application, the electronic device may also be a desktop computer, tablet computer, notebook computer, ultra mobile personal computer, personal digital assistant (personal digital assistant, PDA), or wearable electronic device, such as a watch, bracelet, or the like. The application is not limited in this regard.
The method for adjusting the gain of ambient light according to the embodiment of the present application is described below with reference to a specific structure of an electronic device.
Referring to fig. 2, fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) connector 130, a charge 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, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It should be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The processor 110 may generate operation control signals according to the instruction operation code and the timing signals to complete instruction fetching and instruction execution control.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, when the processor 210 determines that the external ambient light intensity changes (interruption of the ambient light), the method for adjusting the ambient light gain provided by the embodiment of the present application is operated, so that a reasonable gain value can be obtained quickly, the ambient light gain speed is improved, the gain value adjustment time is reduced as much as possible, and the screen brightness adjustment speed is improved, so as to improve the user experience.
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. 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, and the like. The display 194 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro led, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
In some embodiments, the processor 110 is connected to a backlight driver for controlling the display 194, and after the processor 110 obtains a gain value that meets the condition, the backlight of the display is adjusted based on the ambient light intensity value obtained by the gain value, and the backlight driver controls the backlight brightness of the display 194 to change, so as to adjust the brightness of the display (screen).
The internal memory 121 may be used to store computer executable program code including instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., data collected by sensors, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like. The processor 110 performs various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, so as to realize anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
In some embodiments, the angular velocity data obtained by the gyro sensor 180B may be transmitted to the processor 110, where the processor determines the motion gesture of the electronic device through judgment, and the processor 110 determines whether the user picks up the mobile phone to answer the phone based on the motion gesture data and combines the data of other sensors.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications. And can also be applied to judgment in answering a call, etc.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, the electronic device 100 may range using the distance sensor 180F to achieve quick focus.
In some embodiments, the distance sensor 180F may measure the distance between the mobile phone and the accessory object to determine whether the electronic device is near the object or far from the object.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it may be determined that there is an object in the vicinity of the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there is no object in the vicinity of the electronic device 100. The electronic device 100 may detect that the user is holding the electronic device 100 in close proximity to the ear using the proximity light sensor 180G so that the phone may not adjust the ambient light gain while answering the phone scene.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is approaching a nearby object or is moving away from a nearby object.
In some embodiments, ambient light sensor 180L is configured to obtain an ambient light intensity value to cause processor 110 to skip adjusting the ambient light gain based on the ambient light intensity value to thereby increase the speed of the ambient light gain.
The software system of the electronic device 100 may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. In the embodiment of the application, taking an Android system with a layered architecture as an example, a software structure of the electronic device 100 is illustrated.
Fig. 3 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun row (Android run) and system libraries, and a kernel layer, respectively.
The application layer may include a series of application packages.
As shown in fig. 3, the application package may include applications for cameras, gallery, calendar, phone calls, maps, navigation, WLAN, bluetooth, music, video, short messages, etc.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 3, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is used to provide the communication functions of the electronic device 100. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
Android run time includes a core library and virtual machines. Android run time is responsible for scheduling and management of the Android system.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface manager (surface manager), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), etc.
The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
The following describes the method for adjusting the gain of the ambient light according to the embodiment of the present application in detail with reference to the specific drawings.
In the following embodiments, the method is applied to a mobile phone (as an example of an electronic device) as an example, and the specific structure of the mobile phone may refer to the hardware structure of fig. 2 and the software structure of fig. 3.
The method for adjusting the ambient light gain mainly comprises two conditions of reducing the ambient light gain value and increasing the ambient light gain value. The following describes two methods for adjusting the gain value of the ambient light with reference to the accompanying drawings.
Referring to fig. 4, fig. 4 is a flowchart illustrating an adjustment method for reducing gain of ambient light according to an embodiment of the application. The method can be executed by the mobile phone, and when the mobile phone detects that the external environment light intensity is changed from weak to strong, the mobile phone can be triggered to execute the method. As shown in fig. 4, the flowchart includes S401 to S411.
S401, acquiring an ambient light intensity value of the surrounding environment within a preset time.
Wherein the ambient light intensity value may be obtained by an ambient light sensor. The preset time refers to an integration period of the ambient light sensor to the ambient light intensity value. Under the condition of the same ambient light intensity, the longer the integration period is, the larger the sampling value corresponding to the acquired ambient light intensity value is. Therefore, in the case of abrupt change of the ambient light intensity, the sampling value corresponding to the obtained ambient light intensity value can be reduced by shortening the integration period, so that the speed of heuristically adjusting the gain value every time is improved.
S402, converting the ambient light intensity value into a sampling value. For example, the ambient light intensity value may be converted to a digital count, i.e., a sample value, by an ADC converter. The size of the sample value is related to the device capabilities.
In the embodiment of the application, taking the output capacity of the analog-to-digital converter as an example, the maximum range of the sampling value corresponding to the output capacity is 65535. When the sampling value corresponding to the ambient light intensity value is less than or equal to 65535, the sampling value can be output according to the actual value, and the ambient light intensity value can be accurately represented. When the value of the ambient light intensity is larger than 65535, the value of the ADC converter is only 65535 due to the range limitation, and the actual count is larger than the value of the ambient light intensity, which cannot represent the actual ambient light intensity. In some embodiments, the maximum range may be different for different devices, such as a mobile phone, or a tablet, and 65535 is illustrated as the maximum range, and the numerical size is not limited.
S403, determining a gain value (corresponding to the first gain value) corresponding to the sampling value and a first preset sampling value. The first gain value refers to a gain value corresponding to the mobile phone when the mobile phone obtains the current sampling value.
In one embodiment of the application, the first preset sample value may be determined based on an integration period (preset time) of the acquired sample value. For example, one integration period is 2.779ms, and the maximum integration sample value that can be obtained is 2047. Considering that the accuracy of the sample value is higher between 0.25 and 0.85 of the measurement range, the first preset sample value may be set to 0.85 times the maximum integrated sample value, for example, 0.85 times 2047, thereby improving the accuracy of the sample value. In the following embodiment, the first preset sample value is taken as an example of 0.85 times the maximum integral sample value. In other embodiments of the present application, different multiples may be used, such as 0.9 times, 0.95 times, etc., of the maximum integral sample value, and the present application is not limited in this regard.
In some embodiments of the present application, when determining the first gain value, the mobile phone needs to determine that each channel, for example, four RGBC channels, share one gain value, or that each channel or multiple channels corresponds to one gain value, which is not limited herein. If each channel corresponds to one gain value, the gain value (first gain value) corresponding to each channel is recorded respectively, and when the processor receives the ambient light interrupt request, the gain value of each channel is adjusted respectively.
S404, judging whether the sampling value is larger than 0.85 times of the maximum integral sampling value (corresponding to the first preset sampling value).
If not, the handset performs S408.
If yes, the mobile phone executes S405.
In S405, it is determined whether the sampling value is less than or equal to 0.85 times the maximum measurement range (corresponding to the second preset sampling value), and the delta gain value is equal to 0. Wherein, 0.85 times of the maximum range is used for representing the upper limit value for ensuring the precision of the sampling value, and the precision of the sampling value calculated based on the preset sampling value is higher. The delta gain value is used to indicate that the gain value is the difference between before and after the gain value adjustment operation. When the delta gain value is equal to 0, the first operation on the gain value is indicated, and the operation is not degraded yet. When the delta gain value is not 0, the gain value degradation operation is indicated to be carried out, and the operation is not carried out for the first time, so that in the subsequent operation, the condition can only be continuously not met or can only be continuously false, and the stage of gain value degradation is calculated by taking 0.85 times of the maximum integral sampling value as a threshold. And performing cyclic operation until the sampling value is less than or equal to 0.85 times of the maximum integral sampling value. Or when the gain value is minimum, the loop operation is exited to obtain the final stage number needing degradation.
In the embodiment of the present application, the maximum range refers to the output capability of the converter, for example, the output of the ADC converter is 16 bits, and the maximum range is 65535. The second preset sample value is 65535 x 0.85. In some embodiments, the second preset sampling value may also be other multiples of the maximum range, and the specific multiple value may be determined according to the processing capability of the electronic device, which is not limited herein.
If the sampled value is equal to or less than 0.85 times the maximum range and the delta gain value is equal to 0, then S408 is performed.
When the mobile phone determines that the sampling value is greater than 0.85 times of the maximum range and the delta gain value is equal to 0, indicating the first degradation operation, S406 is executed.
When the sampling value is equal to or less than 0.85 times the maximum range, but the delta gain value is not equal to 0, since the condition that the delta gain value is equal to 0 is not satisfied, that is, at least the second degradation operation, it indicates that there is degradation, only S406 can be executed.
S406, judging whether the current gain value is minimum. Wherein, in some embodiments, the gain value is 2 n The value range of n is 0 to n, n is a natural number equal to or greater than 1, and n=9 is taken as an example in the embodiment of the present application. When n=0, i.e. the gain value is 1, it may be indicated that the current gain value is the minimum value. When n=9, the gain value is 2 9 The gain value is indicated to be the maximum value. If the current n=0 indicates that the gain value is already the minimum value and cannot be reduced any more, S408 is performed.
If the current gain value is not the minimum value, performing a degradation simulation operation on the current gain value, and executing S407.
S407, gradually reducing the gain value, halving the sampling value and setting a degradation mark. The degradation flag is set for distinguishing from when degradation processing occurs to facilitate determining whether adjustment of the gain value is required in subsequent decisions.
In an embodiment of the present application, 2 is used as the gain value n For example, when the gain value decreases by 1 level, n is reduced by 1, the optical system is based on the three components: when the ambient light intensity value is unchanged, the sampling value corresponding to the gain value a is X, and when the gain a is changed to the gain value B, the sampling value is calculated by changing the theory to y=x×b/a, and the corresponding sampling value is reduced by half. For example, if the first gain value decreases by 1 level if the sample value is 65535, the sample value decreases to 35767. The mobile phone then compares the down-sampled value with 0.85 times of the maximum integrated sampled value, i.e. executing S408.
Subsequently, returning to execution S404, a determination is continued as to whether the halved sample value is greater than 0.85 times the maximum integrated sample value.
And when the sampling value is greater than 0.85 times of the maximum integral sampling value, the mobile phone returns to execute S405-S407, the first gain value after degradation is continuously degraded, the sampling value is continuously halved, the sampling value after halving again is continuously compared with 0.85 times of the maximum integral sampling value, the loop operation of S404-S407 is formed, and the loop operation is exited until the sampling value after halving is less than or equal to 0.85 times of the maximum integral sampling value, so that the number of the reduced steps is determined.
At S408, it is determined whether the degradation flag is set. Whether degradation of the gain value is required is determined by whether it is set. This step is used to distinguish that when the first execution of S404 satisfies that the sampling value is equal to or less than 0.85 times the maximum integration sampling value, no adjustment of the gain value is required, and no degradation flag is generated, i.e. no degradation is required. I.e., S409 is performed, it is determined that the gain value does not need to be adjusted. After S404 is executed more than or equal to 2 times, if the sampling value is halved multiple times and then is less than or equal to the maximum integral sampling value, a degradation flag is present, and if degradation is considered necessary, S410 is executed.
S410, determining a new gain value (second gain value) based on the current gain value and the reduction level. For example, the current gain value is 2 3 The number of required reduction steps is 2, and the new gain value is 2 1 In the actual operation process of the mobile phone entering the ambient light, the second gain value 2 can be directly used 1 The environment light intensity value is directly debugged by using the new gain value of which the gain value is reduced by two stages, and compared with the adjusting mode of reducing the gain value step by step, the jump stage adjustment of the gain value is realized.
S411, re-sampling based on the new gain value, re-judging whether to adjust the gain value or not, and reporting the obtained ambient light intensity value to a screen for dimming until the gain value does not need to be adjusted any more. I.e. the repetition of the above S401-S410 is performed again until the obtained sampling value corresponding to the ambient light intensity value no longer needs to be adjusted.
That is, in the operation process (theoretical operation), since the sampling value maximum value is limited by the upper range limit. Whereas the actual sampled value may be much greater than the upper value. Therefore, it is possible that the second gain value resulting in the theoretical operation is still unreasonable during the actual adjustment, i.e. the sample value obtained based on the second gain value is larger than the upper limit of the preset range, e.g. larger than 0.85 times the maximum range. At this time, the second gain value is used as the first gain value, and the above steps S401 to S410 are repeated until the gain value does not need to be adjusted, and the screen brightness is adjusted. Through multiple degradation operations, skip stage can be realized each time, and the overall speed of gain adjustment is improved, so that the speed of screen brightness adjustment is improved.
In the application, the 0.85 times of the maximum integral sampling value (corresponding to the first preset sampling value) is used as a reference to calculate the reduction level of the gain value, when the 0.85 times of the maximum integral sampling value is far smaller than the 0.85 times of the maximum range (corresponding to the second preset sampling value), the first gain value possibly needs to be reduced by more levels. And further, an accurate ambient light intensity value can be obtained rapidly and accurately, so that the mobile phone can adjust the brightness of the screen rapidly, the user can not perceive the change of the brightness of the screen as much as possible, and the user experience is improved.
Referring to fig. 5, fig. 5 is a flowchart illustrating a method for adjusting gain of increased ambient light according to an embodiment of the present application. The method can be executed by the mobile phone, and when the mobile phone detects that the intensity of the external environment is weakened by the intensity, the mobile phone can be triggered to execute the method. As shown in fig. 5, the flowchart includes S501-S510.
S501, acquiring an ambient light intensity value of the surrounding environment within a preset time. This step corresponds to S401, and reference is specifically made to the description of S401 above.
S502, converting the ambient light intensity value into a sampling value. This step corresponds to S402, and reference is made to the description of S402.
S503, determining a gain value (corresponding to the first gain value) corresponding to the sampling value and a third preset sampling value. The first gain value corresponds to the first gain value in S403, which is not described in detail here.
The third preset sampling value may be 0.25 times of the maximum integral sampling value, which is used to represent a lower limit value for ensuring the accuracy of the sampling value, that is, when the sampling value corresponding to the ambient light intensity value is between the third preset sampling value and the second preset sampling value, the accuracy of the sampling value is high, that is, the gain value corresponding to the sampling value is reasonable, and no adjustment is needed.
S504, judging whether the sampling value is smaller than 0.25 times of the maximum integral sampling value.
If not, the mobile phone executes S507.
If yes, the mobile phone executes S505, determines whether the current gain value is already maximum, if yes, does not need to perform an increase simulation operation on the gain value, and executes S507, if the increase flag is set. If not, the current gain value is not adjusted. If the current gain value is not the maximum value, performing a growth simulation operation on the current gain value, and executing S506.
In S506, the gain value is incremented step by step and the sample value is incremented by a multiple, setting the increment flag. For example, the sampled value is multiplied by 2, as opposed to the degraded gain value n It shows that when the gain value is 1 level per liter, i.e., n is added with 1, the optical system based on the three above-mentioned steps: when the ambient light intensity value is unchanged, the sampling value corresponding to the gain value a is X, and when the gain a is changed to the gain value B, the sampling value is calculated by changing the theory to y=x×b/a, and the corresponding sampling value is doubled. After calculating the analog increment sampling value, the handset returns to S504. And comparing the increased sampling value with 0.25 times of the maximum integration sampling value to form a cyclic operation of S504-S506, and exiting the cyclic operation until the sampling value is greater than 0.25 times of the maximum integration sampling value to obtain an increase level, and executing S507.
S507, judging whether the growth flag is set.
If the increment flag is not set, it may be that the sampling value is 0.25 times or more of the maximum integral sampling value when S504 is executed for the first time, and therefore, no increment operation is executed, no increment flag will be present, so it may be determined that no increment skip operation is executed, S508 is executed, and it is determined that adjustment of the gain value is not required. Alternatively, when S505 is executed for the first time, the gain value is already the maximum, and there is no adjustment space, and there is no increase flag at this time, so when S507, it can be determined that there is no increase flag, S508 is executed, and it is determined that there is no need to adjust the gain value.
If it is determined that the increment flag is set, indicating that S506 has been executed, an increment operation is performed on the gain value, and S509 is executed.
S509, a new gain value (third gain value) is determined based on the current gain value and the number of growth stages. For example, the current gain value is 2 3 The number of required increases is 3, then the second gain value is 2 6 In the actual operation process of the mobile phone entering the ambient light intensity value, the gain value 2 can be directly used 6 A jump-level increase of the gain value is achieved.
S510, acquiring an ambient light intensity value based on the new gain value, and adjusting the screen brightness. I.e. resampling, and re-judging whether the gain value is to be adjusted or not until the gain value is not required to be adjusted, and reporting the obtained ambient light intensity value to a screen for dimming. I.e. the repetition of S501-S509 described above is performed again. Through multiple growth operations, jump level can be realized each time, and the overall speed of gain adjustment is improved, so that the speed of screen brightness adjustment is improved.
In an embodiment of the present application, special scenes may also need to be excluded in order to avoid unnecessary adjustments in some scenes.
Referring to fig. 6, fig. 6 shows a scenario in which a user makes a call. As shown in fig. 6, in the scenario where the user makes a call, when the user makes a call, the mobile phone approaches the ear (approach state), and at this time, part of the ambient light is blocked due to the approach of the mobile phone to the face, so that the intensity of the ambient light becomes weak, and the gain value is adjusted to a higher value or even the maximum value. When the phone is hung, the mobile phone is far away from the face (far away state), the ambient light intensity is strong, the gain value is adjusted to be very low until the minimum, and in a scene with large variation difference of the ambient light intensity before and after the process, even if the jump level is adopted to reduce or increase the gain value, the user still can feel the user experience of being dark before bright. And considering that such a special scene adjustment screen is unnecessary, in one embodiment of the present application, it is also necessary to judge scenes of the approaching state and the distant state in which the gain value may not be adjusted.
Referring to fig. 7, fig. 7 shows a process flow diagram of the approaching state and the separating state. The approaching state and the distant state are two opposite states, for example, taking a distance between the mobile phone and the object as an example, when the distance between the mobile phone and the object is 2cm or less (a preset distance), the approaching state is considered, and when the distance between the mobile phone and the object is more than 2cm, the distant state is considered.
In the embodiment of the present application, the condition for triggering the processing procedure may be that the processing procedure is executed in the process of determining that the mobile phone approaches the object, specifically, the data detected by the distance sensor, the proximity light sensor, etc. is used to determine that the mobile phone approaches the object, and trigger to execute the following process, as shown in fig. 7, where the processing procedure may be executed by the mobile phone, including S701-S712.
S701, a process of proximity status determination is started.
In one embodiment of the application, the trigger condition may be that the ambient light sensor detects that the intensity of the ambient light is weakened by a strong intensity. Or in the scene of receiving the call, the mobile phone judges that the user receives the call, acquires the reflected light from the nearby object through the proximity light sensor, judges that the mobile phone approaches to the user (nearby object), and the like. Triggering the mobile phone to start the judging process of the approaching state. In some embodiments, the mobile phone may also be triggered to perform S701 in conjunction with other sensors, for example, the mobile phone may be triggered to perform S701 in conjunction with data detected by a speed sensor, a gyroscope, or the like.
In some embodiments, the mobile phone further needs to determine whether the relevant value used to determine the proximity status is a legal value, i.e. S702 is executed, if not, the mobile phone allows the gain value to be adjusted. If the value is legal, S703 is executed. The method for determining the legal value may refer to the prior art method, and will not be described in detail herein.
S703, whether the gain value is a growth operation.
In one embodiment of the application, the mobile phone has performed the adjustment of the gain value during the approach of the object (or the object approaches the mobile phone), i.e. before the approach state is determined, because it is not already the approach state. The mobile phone can also judge whether the mobile phone is approaching to the object or is far away from the object according to whether the gain value is in an increasing adjustment or a decreasing adjustment. For example, when the gain value increases, it indicates that the mobile phone approaches to the object, and then, in combination with the reflected light of the object acquired by the sensor, it determines whether the mobile phone is already in an approach state, that is, triggers execution of S704. If the gain value decreases, it indicates that the mobile phone is away from the object, and it is not necessary to further determine whether the mobile phone is in a close state, at this time, the mobile phone executes S711, and allows adjustment of the gain value. I.e. the gain value is adjusted in a conventional manner. S704, judging whether the state is in a close state. For example, whether the proximity state is the one may be determined further based on the object reflected light.
In the embodiment of the application, the reflected light may be infrared reflected light, the mobile phone sends infrared light outwards, after the infrared light is reflected by the object, part or all of the reflected light is obtained by the mobile phone, for example, the reflected light is obtained by the proximity light sensor of the mobile phone, the mobile phone judges whether the object is nearby according to the obtained reflected light, and parameters such as the time for emitting the infrared reflected light and receiving the reflected light judge the distance between the mobile phone and the object. If the distance reaches the preset distance of 2cm, judging that the state is close, otherwise, judging that the state is far away.
When the proximity state is determined, the mobile phone executes S705 and S712, backs up the time stamp corresponding to the proximity state, and determines not to adjust the gain value.
In one embodiment of the present application, the determination of the proximity state may be performed by combining the reflected light of the object acquired by the proximity light sensor, specifically, when the reflected light is detected by the mobile phone, it may be determined that there is an object near the mobile phone, and the distance between the mobile phone and the object may be determined according to parameters such as the time of emitting the infrared light and the time of acquiring the reflected light. When the distance reaches a preset distance, for example, 2cm, it is judged that the mobile phone is in a close state, and the mobile phone performs S705. The approach state may correspond to a scene of answering a call, the mobile phone is far close to the face in the answering process, the ambient light is weakened from strong, but gain values are not increased, so that unnecessary overhead of the system is reduced.
When the mobile phone judges that the mobile phone does not belong to the approaching state, the mobile phone is considered to be the away state, and at this time, the mobile phone is triggered to execute S706.
S706, the backup is away from the state timestamp.
S707, judging that the difference value between the approaching state timestamp and the separating state timestamp is larger than the set time. It should be noted that, the ambient light interruption is a periodic time, and in one period, when the proximity state is detected, the proximity state timestamp is recorded, and when the proximity state is changed to the distant state later, the proximity state timestamp is not updated. If the approach state is determined to be in the previous cycle in the second cycle, the approach state timestamp is naturally updated to the latest (as the current determination). If the current state is the distant state, the current time stamp is used as the latest distant state time stamp, and the updated previous approach state time stamp is compared with the distant state time stamp in a difference way, so that the number of distant periods from the last approach to the current distant can be calculated.
If the difference is greater than the set time, for example, the difference is greater than 150ms, and the mobile phone can consider the approaching timestamp as invalid because the approaching timestamp is too long, S709 is executed, the approaching timestamp is cleared, S711 is executed, and it is determined that the gain value is allowed to be adjusted. For a specific adjustment process of the gain value, reference may be made to the method of decreasing the gain value in fig. 4 and the method of increasing the gain value in fig. 5. Not described in detail herein.
If the difference is less than the set time, e.g., the difference is less than 150ms, indicating that the approach state has just entered the distant state, then S712 is performed, where it is determined that no adjustment of the gain value is required. Therefore, scenes which are caused by approaching and keeping away from events and are not necessary to adjust the gain value are eliminated, the problem of poor user experience caused by extremely adjusting the gain value is solved, and the user experience is further improved.
In some embodiments, after the mobile phone determines that the difference is smaller than the set time, the mobile phone may further determine, according to the increase condition of the gain value, a situation that may occur in a process of moving away from the object, that is, execute S708.
S708, it is determined whether the previous time is the increase adjustment gain value.
If the gain adjustment value is increased, it is highly likely that the gain adjustment value is triggered during the away state. And performs S710 to restore the gain value before the increase. The reason for this step is that the previous time the gain value was increased, indicating that the cell phone has just changed from the near state to the far state during the period in which the gain value was adjusted by the last ambient light interruption. The increase gain value also appears this time, which indicates that the increase gain value is successfully suppressed from the far state to the near state, and the action of the gain value is triggered again from the near state to the far state. Further, by determining that the last actual gain value is the gain value of the increment, it is explained that the gain value of the increment is successfully suppressed in the approaching process, but at least one gain value of the increment is generated before the approaching process, so that the action of increasing the gain value is not performed at this time, and the gain value of the increment in the process from the far to the approaching process is restored to the original value. If the adjustment gain value is not increased, the handset performs S712 to determine that the adjustment gain value is not needed.
According to the judging method of the approaching and distant state, the scene with the gain value adjusted under the extreme scene and the strong light can be eliminated, the gain value is not adjusted for the scene, and the uncomfortable experience of the screen from dark to bright can be avoided when a user perceives the scene, so that the user experience is improved.
In some embodiments, the adjustment process of the ambient light gain may further include other processing flows besides the steps of fig. 4, 5 and 7, and particularly refer to the processes shown in fig. 8 and 9.
Referring to fig. 8, fig. 8 shows an overall frame flow diagram for adjusting gain values. The process is performed by the processor of the handset, including steps S801-S811.
S801, it is determined that an ambient light interruption is coming.
The environment light interruption request is that after the environment light sensor of the mobile phone determines that the environment light intensity changes, the environment light interruption is determined to arrive, and the state of the gain value of each channel is confirmed.
S802, confirming and recording the gain value state of each channel.
Specifically, the gain value corresponding to each channel in each channel can be confirmed, and whether the gain value of each channel is to be adjusted or not is determined according to the change of the current ambient light intensity value.
S803, judging whether the gain value needs to be adjusted. Specific implementation may refer to the determination process of fig. 4, 5 and 7, and will not be described in detail herein.
In S803, if adjustment is required, S804 is executed to adjust the flag position of the gain value, and determine whether the current state of the mobile phone is in calibration or prediction.
If yes in S804, S806 is executed to process the adjustment gain value flag bit and back up the delta gain value, which is the adjustment size of the adjustment gain value. Execution returns to S801.
If no in S804, S805 is executed, a register is set, and the corresponding maximum integration sampling value is set. The setting register is used for setting an integration time length register, shortening the integration period and adjusting the corresponding maximum integration sampling value.
In S803, if the gain value does not need to be adjusted. The handset performs S807.
S807, it is determined whether there is an adjustment gain value before.
If so, S808 is performed, the flag bit of the adjustment gain value is cleared.
If not, execution of S811 ends the interrupt processing procedure.
S809, judging whether the calibration or the prediction is in progress. If not in calibration or prediction, S810 is performed, the normal sampling period is resumed, the set maximum integrated sampling value is resumed, S811 is performed, and the interrupt processing ends.
The steps not mentioned in the above process may refer to the execution process in the prior art, and will not be described in detail here.
In some embodiments, if all channels, e.g., red (R), green (G), blue (B), clear (C), share one gain value, it is only necessary to confirm whether the shared gain value needs to be adjusted up or down. And uniformly using the same gain value for all channels before and after adjustment to obtain a corresponding environment light intensity value. If each channel corresponds to a gain value, the mobile phone needs to confirm the state of the gain value corresponding to each channel before performing the gain value increasing or decreasing adjustment, and refer to fig. 9 specifically.
Referring to fig. 9, fig. 9 shows a flow chart of the adjustment of the gain value status of each channel by the mobile phone. The process is performed by the processor of the handset, including steps S901-S910.
S901, a confirmation flow is started.
S902, it is determined whether the maximum integrated sampling value is greater than the maximum range, for example 65535.
If yes, execution S903 sets the maximum integral sample value to 65535. At S904 is performed.
S904, judging whether the gain value adjustment conditions of all channels are confirmed to be finished. For example, the gain value corresponding to the R channel is an unsuitable value, and at this time, adjustment is required. The gain value corresponding to the G channel is a suitable value and no adjustment is required.
If not, the channel that is not completed needs to be confirmed. S905 is performed to determine whether the adjustment gain value needs to be reduced. If yes, the process returns to S904. If not, then S906 is performed, confirming that the gain value is being increased or not being adjusted. After confirmation, the process returns to S904 until all channel confirmation is completed. The process of increasing the adjustment gain value or decreasing the adjustment gain value may refer to the method described in fig. 4 and fig. 5 in the above embodiments, and will not be described in detail here. If so, S907 is performed to determine whether the gain value needs to be adjusted. The determination process may refer to the methods described in fig. 4 and 5 in the above embodiments, and will not be described in detail herein.
If adjustment is required, S908 is performed to determine whether the scene allows adjustment of the gain value. This process may refer to the approach and distancing state confirmation method of the method shown in fig. 7, which is not described herein.
If no adjustment is required, then S910 is performed, it is determined that the gain value is not to be adjusted, and the process of adjusting the gain value is not performed.
If the gain value is required to be adjusted, the gain value is adjusted according to the adjusted gain value and the corresponding delta gain value.
And determining the channel to be finally adjusted and the size of the gain value to be adjusted of each channel through the channel gain value state adjustment process. The steps not mentioned in this adjustment process are referred to in the prior art adjustment process and will not be described in detail here.
The application also provides an electronic device, comprising:
the acquisition module is used for acquiring the ambient light intensity value of the surrounding environment within preset time;
the conversion module is used for converting the ambient light intensity value into a sampling value corresponding to the equipment capacity and determining a first gain value and a first preset sampling value corresponding to the sampling value;
the processing module is used for carrying out degradation operation on the first gain value when the sampling value is determined to be larger than the second preset sampling value, wherein in the degradation operation, the number of the reduced stages is obtained by carrying out operation on the basis of the first preset sampling value; the second preset sampling value is used for representing the upper limit of the measuring range of the sampling value, which is possessed by the electronic equipment, and the second preset sampling value is larger than or equal to the first preset sampling value;
the processing module is used for determining a second gain value based on the result of the degradation operation, wherein the second gain value is used for acquiring the ambient light intensity value.
In one embodiment of the present application, the processing module is configured to, when the ambient light intensity value obtained based on the second gain value is outside the preset range, take the second gain value as the first gain value, and implement the degradation operation in a recycling manner until the sampling value corresponding to the obtained ambient light intensity value no longer needs to be adjusted.
In one embodiment of the application, the first preset sample value is derived based on a maximum integrated sample value that can be obtained within a preset time.
In one embodiment of the present application, when the processing module determines that the sampling value is greater than the second preset sampling value and the first gain value is not the minimum value, the degradation operation is performed on the first gain value.
In one embodiment of the present application, when the processing module determines that the sampling value is greater than the second preset sampling value and the first gain value is the minimum value, the first gain value is not adjusted.
In one embodiment of the application, the processing module determines that the first gain value is not to be adjusted when the sample value is less than a second preset sample value.
And when the processing module determines that the sampling value is larger than a third preset sampling value, the first gain value is not adjusted, the third preset sampling value is smaller than the first preset sampling value, and the third preset sampling value is used for representing the lower limit of the maximum integration sampling value of the electronic equipment.
And when the processing module determines that the sampling value is smaller than the third preset sampling value and the first gain value is the maximum value, the first gain value is not adjusted.
When the processing module determines that the sampling value is smaller than the third preset sampling value and the first gain value is not the maximum value, performing an increase operation on the first gain value; in the growing operation, the reduced level is obtained by operation based on a third preset sampling value; and determining a third gain value based on the degradation operation result, wherein the third gain value is used for acquiring the ambient light intensity value until the sampling value corresponding to the acquired ambient light intensity value is not required to be adjusted.
In one embodiment of the present application, when the electronic device determines that the sampling value is smaller than the third preset sampling value and the electronic device determines that the electronic device is in a state of proximity to a nearby object, the electronic device does not perform the growth adjustment operation on the first gain value.
In one embodiment of the application, the acquisition module is further configured to acquire reflected light from a nearby object;
the processing module is used for judging that the electronic device approaches to a nearby object based on the reflected light, and determining that the electronic device is in an approaching state with the nearby object when the distance between the electronic device and the nearby object reaches a first preset distance.
The components and the workflow of the electronic device according to the embodiments of the present application are described in detail in the above embodiments, and reference may be made to the methods of fig. 4, 5 and 7 in the above embodiments, which are not described herein.
The present application also provides an electronic device including:
the ambient light sensor is used for acquiring the ambient light intensity value of the surrounding environment within preset time;
the analog-to-digital converter is used for converting the ambient light intensity value into a sampling value corresponding to the equipment capacity;
a memory for storing instructions for execution by one or more processors of the device, and
a processor for performing the method explained in connection with fig. 4, 5 and 7 in the above embodiments.
The present application also provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the method explained in fig. 4, 5 and 7 in the above embodiments.
The application also provides a computer program product comprising instructions which, when run on an electronic device, cause a processor to perform the method explained in the above embodiments with reference to fig. 4, 5 and 7.
Referring now to fig. 10, shown is a block diagram of a SoC (System on Chip) 1300 in accordance with an embodiment of the present application. In fig. 10, similar components have the same reference numerals. In addition, the dashed box is an optional feature of a more advanced SoC. In fig. 10, soC1300 includes: an interconnect unit 1350 coupled to the application processor 1310; a system agent unit 1380; a bus controller unit 1390; an integrated memory controller unit 1340; a set or one or more coprocessors 1320 which may include integrated graphics logic, an image processor, an audio processor, and a video processor; a static random access memory (Static Random Access Memory, SRAM) unit 1330; a Direct Memory Access (DMA) unit 1360. In one embodiment, coprocessor 1320 includes a special-purpose processor, such as, for example, a network or communication processor, compression engine, GPGPU, a high-throughput MIC processor, embedded processor, or the like.
One or more computer-readable media for storing data and/or instructions may be included in Static Random Access Memory (SRAM) unit 1330. The computer-readable storage medium may have stored therein instructions, and in particular, temporary and permanent copies of the instructions. The instructions may include: the execution of at least one unit in the processor causes the Soc1300 to perform the method according to the above embodiment, and the method explained with reference to fig. 4, fig. 5 and fig. 7 of the above embodiment may be specifically referred to, and will not be described herein.
Embodiments of the disclosed mechanisms may be implemented in hardware, software, firmware, or a combination of these implementations. Embodiments of the application may be implemented as a computer program or program code that is executed on a programmable system comprising 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.
Program code may be applied to input instructions to perform the functions described herein and generate output information. The output information may 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 (Digital Signal Processor, DSP), microcontroller, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or microprocessor.
The program code may be implemented in a high level procedural or object oriented programming language to communicate with a processing system. Program code may also be implemented in assembly or machine language, if desired. Indeed, the mechanisms described in the present application are not limited in scope by any particular programming language. In either case, the language may be a compiled or interpreted language.
In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried by or stored on one or more transitory or non-transitory machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer readable media. Thus, a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including, but not limited to, floppy diskettes, optical disks, compact disk Read-Only memories (Compact Disc Read Only Memory, CD-ROMs), magneto-optical disks, read-Only memories (ROMs), random Access Memories (RAMs), erasable programmable Read-Only memories (Erasable Programmable Read Only Memory, EPROMs), electrically erasable programmable Read-Only memories (Electrically Erasable Programmable Read Only Memory, EEPROMs), magnetic or optical cards, flash Memory, or tangible machine-readable Memory for transmitting information (e.g., carrier waves, infrared signal digital signals, etc.) in an electrical, optical, acoustical or other form of propagated signal using the internet. Thus, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
In the drawings, some structural or methodological features may be shown in a particular arrangement and/or order. However, it should be understood that such a particular arrangement and/or ordering may not be required. Rather, in some embodiments, these features may be arranged in a different manner and/or order than shown in the drawings of the specification. Additionally, the inclusion of structural or methodological features in a particular figure is not meant to imply that such features are required in all embodiments, and in some embodiments, may not be included or may be combined with other features.
It should be noted that, in the embodiments of the present application, each unit/module mentioned in each device is a logic unit/module, and in physical terms, one logic unit/module may be one physical unit/module, or may be a part of one physical unit/module, or may be implemented by a combination of multiple physical units/modules, where the physical implementation manner of the logic unit/module itself is not the most important, and the combination of functions implemented by the logic unit/module is only a key for solving the technical problem posed by the present application. Furthermore, in order to highlight the innovative part of the present application, the above-described device embodiments of the present application do not introduce units/modules that are less closely related to solving the technical problems posed by the present application, which does not indicate that the above-described device embodiments do not have other units/modules.
It should be noted that in the examples and descriptions of this patent, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
While the 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 (13)

1. A method for adjusting gain of ambient light, the method comprising:
acquiring an ambient light intensity value of the surrounding environment within a preset time;
converting the ambient light intensity value into a sampling value corresponding to equipment capacity, and determining a first gain value and a first preset sampling value corresponding to the sampling value, wherein the first preset sampling value represents the upper limit of numerical count representing the ambient light intensity value in a preset time range;
when the sampling value is determined to be larger than a second preset sampling value, performing degradation operation on the first gain value, wherein in the degradation operation, the number of steps of degradation is obtained based on operation until the sampling value is lower than the first preset sampling value; the second preset sampling value is used for representing the upper limit of the measuring range of the sampling value which can be measured by the electronic equipment, and the second preset sampling value is larger than or equal to the first preset sampling value;
and determining a second gain value based on a result of the degradation operation, wherein the second gain value is used for acquiring the ambient light intensity value.
2. The method according to claim 1, wherein in case the sampled value corresponding to the ambient light intensity value obtained based on the second gain value is outside a preset range, the electronic device causes the second gain value as the first gain value to be recycled for performing the degradation operation until the obtained sampled value corresponding to the ambient light intensity value no longer needs to be adjusted.
3. The method according to claim 1, wherein the first preset sample value is derived based on a maximum integrated sample value characterizing a sampling accuracy obtainable within the preset time.
4. The method of claim 1, wherein performing a degradation operation on the first gain value when the sample value is determined to be greater than a second preset sample value comprises:
and when the sampling value is determined to be larger than a second preset sampling value and the first gain value is not the minimum value, performing degradation operation on the first gain value.
5. The method of claim 4, wherein the first gain value is not adjusted when the sample value is determined to be greater than a second preset sample value and the first gain value is a minimum value.
6. The method of claim 1, wherein the step of determining the position of the substrate comprises,
and when the sampling value is smaller than the second preset sampling value, the electronic equipment determines that the first gain value is not adjusted.
7. The method as recited in claim 1, further comprising:
and when the sampling value is determined to be more than or equal to a third preset sampling value, not adjusting the first gain value, wherein the third preset sampling value is smaller than the first preset sampling value, and the third preset sampling value is used for representing the lower limit of the digital count representing the ambient light intensity value in the integration period.
8. The method of claim 7, wherein the step of determining the position of the probe is performed,
and when the electronic equipment determines that the sampling value is smaller than the third preset sampling value and the first gain value is the maximum value, the first gain value is not adjusted.
9. The method of claim 7, wherein the step of determining the position of the probe is performed,
when the electronic equipment determines that the sampling value is smaller than the third preset sampling value and the first gain value is not the maximum value, performing an increase operation on the first gain value;
in the growing operation, the growing progression is obtained by operation based on the third preset sampling value;
and determining a third gain value based on the result of the growth operation, wherein the third gain value is used for acquiring the ambient light intensity value until the sampling value corresponding to the acquired ambient light intensity value is not required to be adjusted.
10. The method of claim 9, wherein the step of determining the position of the substrate comprises,
and when the electronic equipment determines that the sampling value is smaller than the third preset sampling value and the electronic equipment determines that the electronic equipment is in a close state with a nearby object, the first gain value is not subjected to growth operation.
11. The method of claim 10, wherein the electronic device determining that the proximity object is in proximity comprises:
The electronic device acquiring reflected light from nearby objects;
and judging that the electronic equipment approaches to the nearby object based on the reflected light, and determining that the electronic equipment is in an approaching state with the nearby object if the distance between the electronic equipment and the nearby object reaches a preset distance.
12. An electronic device, comprising:
the ambient light sensor is used for acquiring the ambient light intensity value of the surrounding environment within preset time;
the analog-to-digital converter is used for converting the ambient light intensity value into a sampling value corresponding to the equipment capacity;
a memory for storing instructions for execution by one or more processors of the device,
a processor for executing the instructions to cause the electronic device to perform the method of any one of claims 1-11.
13. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when run by an electronic device, causes the electronic device to perform the method of any one of claims 1-11.
CN202210605315.3A 2022-05-30 2022-05-30 Method for adjusting ambient light gain, electronic device and readable storage medium Active CN116052567B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210605315.3A CN116052567B (en) 2022-05-30 2022-05-30 Method for adjusting ambient light gain, electronic device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210605315.3A CN116052567B (en) 2022-05-30 2022-05-30 Method for adjusting ambient light gain, electronic device and readable storage medium

Publications (2)

Publication Number Publication Date
CN116052567A CN116052567A (en) 2023-05-02
CN116052567B true CN116052567B (en) 2023-09-26

Family

ID=86127786

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210605315.3A Active CN116052567B (en) 2022-05-30 2022-05-30 Method for adjusting ambient light gain, electronic device and readable storage medium

Country Status (1)

Country Link
CN (1) CN116052567B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968962A (en) * 2012-11-21 2013-03-13 广东欧珀移动通信有限公司 Backlight adjustment method and device
CN104103245A (en) * 2013-04-02 2014-10-15 联咏科技股份有限公司 Display apparatus, data gain regulating circuit and data gain regulating method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE112010004379T5 (en) * 2009-11-13 2012-11-29 Steven Donald Edelson Surveillance and camera system and procedures
US9778727B2 (en) * 2015-09-09 2017-10-03 Apple Inc. Ambient light sensors with auto gain switching capabilities
WO2018057937A1 (en) * 2016-09-22 2018-03-29 Apple Inc. Systems and methods for determining physiological signals using ambient light

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968962A (en) * 2012-11-21 2013-03-13 广东欧珀移动通信有限公司 Backlight adjustment method and device
CN104103245A (en) * 2013-04-02 2014-10-15 联咏科技股份有限公司 Display apparatus, data gain regulating circuit and data gain regulating method

Also Published As

Publication number Publication date
CN116052567A (en) 2023-05-02

Similar Documents

Publication Publication Date Title
CN109814766B (en) Application display method and electronic equipment
WO2021052016A1 (en) Body posture detection method and electronic device
CN113596242B (en) Sensor adjustment method and device, electronic equipment and storage medium
CN113132526B (en) Page drawing method and related device
CN114089933A (en) Display parameter adjusting method, electronic device, chip and readable storage medium
CN113938602B (en) Image processing method, electronic device, chip and readable storage medium
WO2022267783A1 (en) Method for determining recommended scene, and electronic device
CN116048933A (en) Fluency detection method
WO2021180095A1 (en) Method and apparatus for obtaining pose
CN117234398B (en) Screen brightness adjusting method and electronic equipment
WO2022100141A1 (en) Plug-in management method, system and apparatus
CN117079596B (en) Screen brightness adjusting method, terminal equipment and storage medium
CN114548141A (en) Method and device for generating waveform file, electronic equipment and readable storage medium
CN116052567B (en) Method for adjusting ambient light gain, electronic device and readable storage medium
CN115032640B (en) Gesture recognition method and terminal equipment
CN116709023B (en) Video processing method and device
CN114816311B (en) Screen movement method and device
CN116688494B (en) Method and electronic device for generating game prediction frame
WO2024083009A1 (en) Interface generation method and electronic device
CN116880792B (en) Data calling method of bottom device and electronic equipment
CN116400974B (en) Method for entering long standby mode, electronic device and readable storage medium
CN116935504A (en) Card punching method, electronic device and computer readable storage medium
CN117857915A (en) Photographing method, photographing device and electronic equipment
CN116152584A (en) Image processing method, device and storage medium
CN117806745A (en) Interface generation method and electronic equipment

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
GR01 Patent grant
GR01 Patent grant