Method for boosting the effect of an averager
By setting compensation and threshold coefficients, the sensor data difference is dynamically adjusted, which solves the problem of noise interference from the sensor averager and achieves more stable display screen brightness adjustment.
Patent Information
- Application Number
- CN202111279844.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-10-20
- Filing Date
- 2021-10-29
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In existing technologies, the averager of the sensor suffers from significant noise interference during data processing, resulting in unstable output values and failing to effectively improve the accuracy of display screen brightness adjustment.
By setting compensation coefficients and threshold coefficients, the difference between input and output data is calculated, and the data is dynamically adjusted to reduce noise. Combined with simple calculations, the computation time and storage space are reduced, and data processing is implemented using software or hardware circuits.
It effectively reduces noise interference, improves the stability of the averager's output value, enhances the accuracy of display screen brightness adjustment, and reduces computation time and storage requirements.
Smart Images

Figure CN115995222B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present invention relates to an averager, in particular to a method for improving the effect of an averager, which is applicable to an ambient light sensor and a proximity sensor. BACKGROUND
[0002] In different environments, the human eye has different requirements for the screen brightness of the display screen of an electronic product. Therefore, various sensors, such as ambient light sensors (ALS) and proximity sensors (PS) provided with photoelectric components, are widely used in various electronic products, such as mobile phones, to sense values as a basis for automatically adjusting the brightness of the display screen of the electronic device to improve the viewing effect in various environments. The sensor can perform multiple sensing in a time interval to generate multiple sensing values, and then the multiple sensing values can be input into an averager. The averager can calculate the average of the multiple sensing values, and the light sensing value of the ambient light sensor or the proximity sensor represents the average ambient light intensity in this time interval. SUMMARY
[0003] The technical problem to be solved by the present invention is to provide a method for improving the effect of an averager, which is applicable to a sensor. The sensor senses n sensing data and inputs the n sensing data into an averager as n input data of the averager, where n is a suitable integer value. The method for improving the effect of the averager comprises the following steps: (a) setting a compensation coefficient and a threshold coefficient; (b) calculating the difference between the n input data of the averager and the (n-1) output data of the averager; (c) determining whether the absolute value of the difference is greater than the threshold coefficient, if yes, multiplying the value of the n input data currently read by the averager by N times to calculate a tuning value, N being an arbitrary suitable value, and then sequentially performing steps (h) to (k), if no, performing step (d); (d) multiplying the value of the (n-1) output data by N times to calculate a temporary storage value; (e) determining whether the difference is greater than a reference value, if yes, subtracting the compensation coefficient from the temporary storage value to calculate the tuning value, and then sequentially performing steps (h) to (k), if no, performing step (f); (f) determining whether the difference is less than the reference value, if yes, adding the compensation coefficient to the temporary storage value to calculate the tuning value, and then sequentially performing steps (h) to (k), if no, performing step (g); (g) taking the temporary storage value as the tuning value of the n data, and then sequentially performing steps (h) to (k); (h) dividing the tuning value of the n data by N to calculate a first operation value; (i) subtracting the first operation value from the tuning value of the n data to calculate a second operation value; (j) adding the second operation value to the value of the n input data to calculate a third operation value; and (k) dividing the third operation value by N to calculate the output value of the averager.
[0004] In an embodiment, the method for improving the effect of an averager further comprises the following steps: (1) setting the reference value to zero.
[0005] In an embodiment, the method for improving the effect of an averager further comprises the following steps: (m) setting a positive threshold coefficient and a negative threshold coefficient; (n) determining whether the absolute value of the difference is greater than the positive threshold coefficient or less than the negative threshold coefficient, if yes, multiplying the value of the nth input data read by N to calculate the adjusted value, and then sequentially performing steps (h) to (k), if no, performing step (d).
[0006] In an embodiment, the method for improving the effect of an averager further comprises the following steps: (o) setting the value of the positive threshold coefficient equal to the value of the negative threshold coefficient.
[0007] In an embodiment, the method for improving the effect of an averager further comprises the following steps: (p) calculating the variation range of the input data value or the output value; and (q) dynamically adjusting the compensation coefficient according to the variation range of the input data value or the output value.
[0008] In an embodiment, the method for improving the effect of an averager further comprises the following steps: (r) calculating the variation range of the input data value or the output value; and (s) dynamically adjusting the threshold coefficient according to the variation range of the input data value or the output value.
[0009] As described above, the present application provides a method for improving the effect of an averager, which has the following features:
[0010] Inputting multiple pieces of sensing data sensed by a sensor, such as an ambient light sensor or a distance sensor, as multiple pieces of input data into the averager;
[0011] Setting a threshold coefficient and a compensation coefficient to reduce noise in the output value of the noise averager in real time;
[0012] The threshold coefficient and the compensation coefficient can be automatically updated in real time according to the variation range of the input data;
[0013] Only simple operations are required between the current input data and the previous output data, which does not consume too much operation time and occupy too much buffer space;
[0014] The method can be combined with other digital signal processing blocks, such as digital filters and averagers, for processing.
[0015] The function can be developed using software or hardware circuit.
[0016] For a better understanding of the features and technical content of the present application, please refer to the following detailed description of the present application and the drawings. However, the drawings provided are only for reference and illustration, and are not intended to limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 The first step flow chart of the method for improving the effect of an averager according to an embodiment of the present application.
[0018] Figure 2 The second step flow chart of the method for improving the effect of an averager according to an embodiment of the present application.
[0019] Figure 3 The third step flow chart of the method for improving the effect of an averager according to an embodiment of the present application.
[0020] Figure 4 The schematic diagram of the operation architecture of the method for improving the effect of an averager according to an embodiment of the present application.
[0021] Figure 5 The first curve diagram of the output value versus data amount of the averager and the conventional averager according to an embodiment of the present application.
[0022] Figure 6 The second curve diagram of the output value versus data amount of the averager and the original output signal with noise according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following is to illustrate the embodiments of the present application through specific embodiments. Those skilled in the art can understand the advantages and effects of the present application from the disclosure. The present application can be implemented or applied through other different embodiments, and the details in the description can be modified and changed based on different viewpoints and applications without departing from the concept of the present application. In addition, the drawings of the present application are only simple schematic illustrations, and are not intended to depict the actual size. The following embodiments will further illustrate the related technical content of the present application, but the disclosure is not intended to limit the protection scope of the present application. In addition, the term "or" used herein can include any one or a combination of the associated listed items as possible.
[0024] Please refer to Figure 1 and Figure 4 wherein Figure 1 The first step flow chart of the method for improving the effect of an averager according to an embodiment of the present application; Figure 4 The schematic diagram of the operation architecture of the method for improving the effect of an averager according to an embodiment of the present application.
[0025] The method for improving the effect of an averager according to an embodiment of the present application can include as Figure 1The steps S101-S129 shown are applicable to a sensor. The sensor can be, for example, an ambient light sensor, a proximity sensor or other sensor provided with a photoelectric component, but the present application is not limited thereto. The sensor senses n pieces of sensing data as n pieces of input data of the averager, where n is a suitable integer value.
[0026] The steps S101-S129 can be executed using an arithmetic architecture as shown in Figure 4 to calculate the adjustment value, as described below.
[0027] In step S101, a compensation coefficient is set according to actual requirements.
[0028] In step S103, a threshold coefficient is set according to actual requirements. Alternatively, a positive threshold coefficient and a negative threshold coefficient can be set. The value of the positive threshold coefficient can be equal to the value of the negative threshold coefficient, i.e. the absolute value of the negative threshold coefficient is equal to the positive threshold coefficient.
[0029] In step S105, the n-th input data of the averager is read, where n is a suitable integer value.
[0030] In step S107, the difference between the value of the n-th input data of the averager and the value of the (n-1)-th output data of the averager is calculated, as shown in the following formula:
[0031] Df = Din(n) - Dout(n-1),
[0032] where Df represents the difference between the n-th input data of the averager and the (n-1)-th output data of the averager, which can be positive or negative, Din(n) represents the value of the n-th input data of the averager, and Dout(n-1) represents the value of the (n-1)-th output data of the averager.
[0033] i.e. as shown in Figure 4 the value of the data output by the averager after reading the previous input data is obtained in phase P15. Then, in phase P0, the value of the currently read input data of the averager is subtracted from the previous output value of the averager (using a subtractor).
[0034] In step S109, it is determined whether the absolute value of the difference calculated in step S107 is greater than the threshold coefficient set in step S103, as shown in the following formula:
[0035] |Df| > Cth,
[0036] where |Df| represents the absolute value of the difference between the n-th input data of the averager and the (n-1)-th output data of the averager, and Cth represents the threshold coefficient.
[0037] If the absolute value of the difference between the nth input data and the (n-1)th output data is greater than the threshold coefficient, steps S111 and S113 are sequentially executed to calculate a regulating value. After the regulating value is calculated, step S201 is executed. In other words, as shown in Fig. 4, if the difference between the nth input data and the (n-1)th output data is greater than the positive threshold coefficient Cth at stage P1 or less than the negative threshold coefficient -Cth at stage P2, the OR gate output logic value "1" at stage P3 is then sequentially run through time P10 to P14. Figure 4
[0038] On the contrary, if the absolute value of the difference between the nth input data and the (n-1)th output data is not greater than the threshold coefficient, steps S115 and S117 are sequentially executed.
[0039] At step S111, the value of the nth input data currently read by the averager is multiplied by N times to calculate a regulating value at step S113, which is represented by the following equation:
[0040] Reg(n) = N x Din(n),
[0041] where Reg(n) represents the regulating value of the nth data, N represents the number of data pens of the averager, which can be any appropriate value, and Din(n) represents the value of the nth input data of the averager.
[0042] At step S115, the value of the (n-1)th output data is multiplied by N times to calculate a temporary value.
[0043] At step S117, it is determined whether the difference between the nth input data of the averager and the (n-1)th output data of the averager is greater than a reference value, such as zero, which is represented by the following equation:
[0044] Df > 0,
[0045] where Df represents the difference between the nth input data of the averager and the (n-1)th output data of the averager, which can be a positive value or a negative value.
[0046] If the difference between the nth input data of the averager and the (n-1)th output data of the averager is greater than the reference value, such as zero, steps S119 and S121 are sequentially executed. After the regulating value is calculated, step S201 is executed. On the contrary, if the difference between the nth input data of the averager and the (n-1)th output data of the averager is not greater than the reference value, such as zero, step S123 is executed.
[0047] In step S119, the value of the (n-1)th output data in step S115 is multiplied by N times to calculate the temporary value, and then the compensation coefficient is subtracted to calculate an adjustment value in step S121, expressed by the following formula:
[0048] Reg(n) = N × Dout(n-1) - Cc,
[0049] Where Reg(n) represents the adjustment value of the nth data point, N represents the number of data points of the averager, Dout(n-1) represents the value of the (n-1)th output data point, the product of N×Dout(n-1) represents the temporary value, and Cc represents the compensation coefficient.
[0050] like Figure 4 As shown, in stage P4, when it is determined that the difference between the nth input data of the averager calculated in stage P0 and the (n-1)th output data of the averager is greater than zero, in stage P16, the value of the (n-1)th output data obtained in stage P15 is multiplied by N to calculate a temporary value. Then, in stages P6 and P7, a negative compensation coefficient -Cc is added to this temporary value or a positive compensation coefficient Cc is subtracted to output an adjustment value in stage P11.
[0051] In step S123, it is determined whether the difference between the nth input data of the averager and the (n-1)th output data of the averager is less than a reference value, such as zero, expressed by the following formula:
[0052] Df < 0,
[0053] Where Df represents the difference between the nth input data of the averager and the (n-1)th output data of the averager, and this difference may be positive or negative.
[0054] If the difference between the nth input data and the (n-1)th output data of the averager is less than a reference value, such as zero, steps S125 and S127 are executed sequentially to calculate the adjustment value. After calculating the adjustment value, step S201 is executed. Conversely, if the difference is neither greater than nor less than the reference value, such as zero, that is, if the difference between the nth input data and the (n-1)th output data of the averager is equal to the reference value, such as zero, step S129 is executed, followed by step S201.
[0055] In step S125, the value of the (n-1)th output data in step S115 is multiplied by N times to obtain the temporary value, and a compensation coefficient is added to calculate the adjustment value in step S127, as expressed by the following formula:
[0056] Reg(n) = N × Dout(n-1) + Cc,
[0057] Reg(n) = N x Dout(n-1) + Cc, wherein Reg(n) represents the adjustment value of the n th data, N represents the number of data of the averager, Dout(n-1) represents the value of the (n-1) th output data, and the product value of N x Dout(n-1) represents the temporary value.
[0058] As shown in FIG. 5, when it is determined in stage P5 that the difference between the n th input data of the averager calculated in stage P0 and the (n-1) th output data of the averager is less than zero, the value of the (n-1) th output data obtained in stage P15 is multiplied by N in stage P16 to calculate a temporary value, and the temporary value is added with the compensation coefficient Cc in stages P8 and P9 to output an adjustment value in stage P11. Figure 4
[0059] In step S129, the temporary value calculated in step S115 is divided by N to calculate a first operation value.
[0060] Reg(n) = N x Dout(n-1) + Cc, wherein Reg(n) represents the adjustment value of the n th data, N represents the number of data of the averager, Dout(n-1) represents the value of the (n-1) th output data, and the product value of N x Dout(n-1) represents the temporary value.
[0061] Reg(n) = N x Dout(n-1) + Cc, wherein Reg(n) represents the adjustment value of the n th data, N represents the number of data of the averager, Dout(n-1) represents the value of the (n-1) th output data, and the product value of N x Dout(n-1) represents the temporary value.
[0062] Referring to FIG. 6, FIG. 7, and FIG. 8, the method for improving the effect of the averager according to the embodiment of the present application comprises steps S201 to S209 shown in FIG. 6, steps S211 to S219 shown in FIG. 7, and steps S221 to S229 shown in FIG. 8. Figure 2 Figure 4 wherein Figure 2 is a second step flow chart of the method for improving the effect of the averager according to the embodiment of the present application; Figure 4 is a schematic diagram of the operation architecture of the method for improving the effect of the averager according to the embodiment of the present application.
[0063] The method for improving the effect of the averager according to the embodiment of the present application can further comprise steps S201 to S209 shown in FIG. 6, which are applicable to a sensor. The sensor can be, for example, an ambient light sensor, a proximity sensor, or other sensor provided with a photoelectric component, but the present application is not limited thereto. The steps S101 to S129 of the embodiment of the present application can be executed after steps S113, S121, S127, or S129, i.e., after the adjustment value is calculated, using the operation architecture shown in FIG. 5 to calculate the output value of the averager based on the adjustment value. Figure 2 Figure 4 In step S201, the adjustment value of the n th data calculated in step S113, S121, S127, or S129 is divided by N to calculate a first operation value.
[0064] In step S201, the adjustment value of the n th data calculated in step S113, S121, S127, or S129 is divided by N to calculate a first operation value.
[0065] In step S203, the tuning value of the nth data is subtracted from the first operation value calculated in step S201 to calculate a second operation value.
[0066] As shown in FIG. 12B, in stage P123, the tuning value of the nth data in stage P12 is subtracted from the tuning value of the 1 / Nth data in stage P13 by a subtractor or is added to the tuning value of the 1 / Nth data in stage P13 by an adder. Figure 4
[0067] In step S205, the second operation value calculated in step S203 is added to the value of the nth input data to calculate a third operation value. As shown in FIG. 12C, in stage P104, the value calculated in stage P123 is added to the value of the nth input data by an adder, for example. Figure 4
[0068] In step S207, the third operation value calculated in step S205 is divided by N to calculate an output value of the averager in step S209. As shown in FIG. 12D, in stage P14, the value calculated in stage P104 is divided by N to finally calculate the output value of the averager. Figure 4
[0069] The operations performed in steps S201 to S209 can be represented by the following formula:
[0070]
[0071] wherein Davg(n) represents the output value of the averager, N represents the number of data of the averager, Reg(n) represents the tuning value of the nth data, and Din(n) represents the value of the nth input data.
[0072] Please refer to Figure 3 and Figure 4 wherein Figure 3 is a third step flow chart of the method for improving the effect of the averager according to an embodiment of the present application; Figure 4 is a schematic diagram of the operation architecture of the method for improving the effect of the averager according to an embodiment of the present application.
[0073] The method for improving the effect of the averager according to an embodiment of the present application can comprise steps S301 to S305 as shown in FIG. 13A, which are applicable to a sensor. The sensor can be an ambient light sensor, a proximity sensor or other sensor provided with a photoelectric component, but the present application is not limited thereto. Steps S301 to S305 according to an embodiment of the present application can be performed using the operation architecture as shown in FIG. 13B. It should be understood that the order and content of the steps herein can be adjusted or deleted as appropriate. Figure 3 Figure 4
[0074] At step S301, the variation range of the values of the n pieces of input data of the averager is calculated.
[0075] At step S303, the threshold coefficient is dynamically adjusted according to the variation range of the values of the n pieces of input data.
[0076] At step S305, the compensation coefficient is dynamically adjusted according to the variation range of the values of the n pieces of input data.
[0077] Referring to Figure 5 , which is a first curve diagram of the output values of the averager of the embodiment of the present application and a conventional averager versus the data quantity.
[0078] As shown in Figure 5 , in the curve diagram, curve C50 is the curve of the original data, curve C51 is the curve of the output values of the conventional averager versus the data quantity, and it can be seen that the conventional averager needs reaction time to generate the output values and there is a significant difference from the original values. C52 is the curve of the output values of the data quantity calculated by the averager of the present application versus the data quantity, and it can be seen that the output values of the averager of the present application will change with the input signal of large amplitude, and if the input signal has no large amplitude change, there will be good stability effect.
[0079] Referring to Figure 6 , which is a second curve diagram of the output values of the averager of the embodiment of the present application and the original output signal with noise versus the data quantity.
[0080] As shown in Figure 6 , in the curve diagram, curve C60 is the original output signal with noise, curve C61 is the curve of the output values of the averager versus the data quantity when the compensation coefficient is set to 0, and curve C62 is the curve of the output values of the averager versus the data quantity when the compensation coefficient is set to 2. Obviously, when the compensation coefficient is set and the compensation coefficient is not zero, the noise can be obviously suppressed.
[0081] In summary, the present application provides a method for improving the effect of an averager, which has the following features:
[0082] The multiple pieces of sensing data sensed by a sensor, such as an ambient light sensor or a distance sensor, are input into the averager as the multiple pieces of input data;
[0083] The threshold coefficient and the compensation coefficient are set to reduce the noise in the output values of the noise averager in real time;
[0084] The threshold coefficient and the compensation coefficient can be automatically updated in real time according to the variation range of the input data;
[0085] Only simple operation is needed to perform the simple operation of the current read input data and the previous output data, and too much operation time and too much buffer space are not occupied.
[0086] The processing can be combined with other digital signal processing blocks, such as digital filters, averagers, etc.
[0087] The function can be developed using software or hardware circuitry.
[0088] The above disclosed is only the preferred embodiment of the present application, and is not limited to the claims of the present application, so any equivalent technical changes made in the content of the present application specification and drawings are included in the claims of the present application.
Claims
1. A method for enhancing the effect of an averager, suitable for a sensor which senses n number of sensing data inputs to an averager to be read sequentially as n number of inputs by the averager, respectively, where n is a suitable integer value, characterized by, The method for improving the effect of the averager comprises the following steps: (a) setting a compensation coefficient, a positive threshold coefficient and a negative threshold coefficient; (b) calculating the difference between the n-th input data of the averager and the (n-1)-th output data of the averager; (c) judging whether the difference is greater than the positive threshold coefficient or less than the negative threshold coefficient, if yes, multiplying the value of the n-th input data of the averager by N to calculate a tuning value, N being any appropriate value, then sequentially performing steps (h) to (k), if not, performing step (d); (d) multiplying the value of the (n-1)-th output data by N to calculate a temporary value; (e) judging whether the difference is greater than a reference value, if yes, subtracting the compensation coefficient from the temporary value to calculate the tuning value, then sequentially performing steps (h) to (k), if not, performing step (f); (f) judging whether the difference is less than the reference value, if yes, adding the compensation coefficient to the temporary value to calculate the tuning value, then sequentially performing steps (h) to (k), if not, performing step (g); (g) taking the temporary value as the tuning value of the n-th data, then sequentially performing steps (h) to (k); (h) dividing the tuning value of the n-th data by N to calculate a first operation value; (i) subtracting the first operation value from the tuning value of the n-th data to calculate a second operation value; (j) adding the second operation value and the value of the n-th input data to calculate a third operation value; and (k) dividing the third operation value by N to calculate the output value of the averager.
2. The method of boosting the averager effect according to claim 1, characterized in that, The method for improving the effect of the averager further comprises the following step: (l) setting the reference value to zero.
3. The method of boosting the averager effect of claim 1, wherein, The method for improving the effect of the averager further comprises the following step: (m) setting the value of the positive threshold coefficient equal to the value of the negative threshold coefficient.
Citation Information
Patent Citations
Image processing apparatus, image processing method, and storage medium
US20200228678A1
Digital nonuniformity correction for image sensors
US6522355B1