The present application relates to the technical field of mobile smart terminals, and more particularly, to a method for adjusting brightness, an apparatus for adjusting brightness, an electronic device, and a storage medium.
With the development of science and technology, mobile smart terminals such as smart phones, tablets and other devices are widely applied in and provide convenience for people's lives. When the user uses an application on the terminal in different environments, it may be necessary to adjust display brightness of the application. For example, when the user uses the application on the terminal in a weak ambient light, it will be harmful to the user's eyesight if the display brightness of the application is not lowered at this time.
In the convention methods for adjusting display brightness, pulse width modulation is widely used to adjust light, and brightness is adjusted through fast flickering. When using the pulse width modulation light-adjusting technology to adjust the display brightness, the brightness adjustment depends on a lighting-blanking alternation of the screen. When the screen is lighted, instead of continuously emitting light, the screen is constantly lighted and blanked. When the lighting-blanking alternation is fast enough, the naked eyes would feel that the terminal is always on. In the process of lighting and blanking the screen, if the blanked state of the screen lasts longer, the naked eyes would feel lower brightness of the screen, and if the lighted state of the screen lasts longer and the blanked time is correspondingly shortened, the screen becomes brighter.
However, the conventional methods for adjusting the brightness by lighting and blanking the screen requires the cooperation of the hardware devices in the display device to be continuously lighted and blanked, which greatly shortens the service life of the hardware devices and seriously affects the service life of the entire display device.
Based on this, it is necessary to provide a method for adjusting display brightness, an apparatus for adjusting display brightness, an electronic device and a storage medium, in which the brightness is not adjusted by lighting and blanking the screen, so as to prolong the service life of the display device.
A method for adjusting display brightness includes: obtaining a target brightness value and a color value of each pixel in loaded pixel data to be displayed; adjusting the color value of each pixel, based on the target brightness value, to obtain the adjusted color value; and performing error diffusion processing on the adjusted color value to obtain an error-diffusion processed color value, and displaying the loaded pixel data to be displayed by using the error-diffusion processed color value.
In an embodiment, said performing the error diffusion processing on the adjusted color value to obtain the error-diffusion processed color value includes: obtaining the adjusted color value of the pixel and coordinate values of the pixel; processing the coordinate values of the pixel based on a triangular noise algorithm to generate a quantization error corresponding to the pixel; and superimposing the quantization error on the adjusted color value of the pixel to obtain the error-diffusion processed color value of the pixel.
In an embodiment, said adjusting the color value of each pixel, based on the target brightness value, to obtain the adjusted color value includes: converting the color value of each pixel from a red, green and blue color space to a hue, saturation and brightness color space; multiplying a brightness component in a color space-converted color value of each pixel by the target brightness value to obtain a brightness-adjusted color value of each pixel; and converting the brightness-adjusted color value of each pixel from the hue, saturation and brightness color space to the red, green and blue color space to obtain a brightness-adjusted color value of each pixel in the red, green and blue color space.
In an embodiment, said obtaining the color value of each pixel in the loaded pixel data to be displayed includes: when the loaded pixel data to be displayed comprises pixel data corresponding to an image, dividing the image into a plurality of image blocks, and obtaining a color value of each pixel in each of the plurality of image blocks respectively.
In an embodiment, prior to said obtaining the color value of each pixel in the loaded pixel data to be displayed, the method further includes: when pixel data that is to be displayed and is drawn by two or more mobile terminal applications is received, performing synthesis processing on the pixel data that is to be displayed and is drawn by each of the two or more mobile terminal applications to obtain synthesized pixel data. Said obtaining the color value of each pixel in the loaded pixel data to be displayed includes: obtaining a color value of each pixel in the synthesized pixel data.
An apparatus for adjusting display brightness includes: a color value obtaining module configured to obtain a target brightness value and a color value of each pixel in loaded pixel data to be displayed; a color adjustment module configured to adjust the color value of each pixel, based on the target brightness value, to obtain the adjusted color value; and an error processing module configured to perform error diffusion processing on the adjusted color value to obtain an error-diffusion processed color value, and display the loaded pixel data to be displayed by using the error-diffusion processed color value.
An electronic device includes a memory and a processor. The memory has a computer program stored thereon. The processor executes the computer program to implement the following actions: obtaining a target brightness value and a color value of each pixel in loaded pixel data to be displayed; adjusting the color value of each pixel, based on the target brightness value, to obtain the adjusted color value; and performing error diffusion processing on the adjusted color value to obtain an error-diffusion processed color value, and displaying the loaded pixel data to be displayed by using the error-diffusion processed color value.
Provided is a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the following actions are implemented: obtaining a target brightness value and a color value of each pixel in loaded pixel data to be displayed; adjusting the color value of each pixel, based on the target brightness value, to obtain the adjusted color value; and performing error diffusion processing on the adjusted color value to obtain an error-diffusion processed color value, and displaying the loaded pixel data to be displayed by using the error-diffusion processed color value.
In order to explain the purpose, technical solutions and advantages of the present disclosure, the present disclosure will be described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure, but not to limit the present disclosure.
In another application scenario, as illustrated in
In an embodiment, as illustrated in
At block 202: a target brightness value and a color value of each pixel in loaded pixel data to be displayed are obtained.
The user can input the target brightness value through a control corresponding to a brightness setting item on the mobile terminal. For example, when the user needs to reduce the display brightness, the user can input the target brightness value to be reduced through the setting item control. The loaded pixel data to be displayed refers to pixel data to be displayed that is loaded by a mobile terminal application, and specifically, the pixel data may include a plurality of different pixels each corresponding to a different color value, for obtaining the color value of each pixel.
At block 204: the color value of each pixel is adjusted based on the target brightness value to obtain the adjusted color value.
For example, the user needs to reduce the display brightness, and the target brightness value of 0.1 is obtained. In this case, the color value of each pixel is multiplied by 0.1 to adjust the color value of each pixel. As an example, if the color value of a certain pixel is (255, 154, 151), the color value of the pixel is adjusted by using the target brightness value of 0.1 to obtain the color value (25.5, 15.4, 15.1), and the adjusted color value (26, 15, 15) is obtained in accordance with the rounding principle.
At block 206: error diffusion processing is performed on the adjusted color value to obtain an error-diffusion processed color value, and the loaded pixel data to be displayed is displayed by using the error-diffusion processed color value.
As mentioned above, before the color value of the pixel is adjusted, there is a difference between the color components 154 and 151. After the color value of the pixel is adjusted, the two color components are both 15 and have no difference therebetween, which is inconsistent with the actual situation. The loss of color accuracy results in indistinct color distinction, resulting in problems such as color bands and color blocks. Therefore, it is necessary to perform the error diffusion processing on the adjusted color value to avoid the occurrence of color bands and color blocks.
In the above-mentioned method for adjusting display brightness, the target brightness value and the color value of each pixel in the loaded pixel data to be displayed are obtained, and based on the target brightness value, the color value of each pixel is adjusted, such that the brightness can be adjusted without lighting and blanking the screen, i.e., the brightness can be adjusted independently of hardware. Further, the error diffusion processing is performed on the adjusted color value to obtain the error-diffusion processed color value, and the loaded pixel data to be displayed is displayed by using the error-diffusion processed color value, so as to avoid the problems of color bands and color blocks caused by adjusting the color value. Such a brightness adjustment method does not need to control the screen to be lighted and blanked continuously, and the service life of the hardware devices can be ensured independently of hardware, thereby prolonging the service life of the entire display device.
In an embodiment, as illustrated in
In an embodiment, said adjusting the color value of each pixel based on the target brightness value, to obtain the adjusted color value includes: splitting the color value of each pixel into corresponding red, green and blue color components; multiplying each of the red, green and blue color components of each pixel by the target brightness value, to obtain brightness-adjusted red, green and blue color components; and recombining the brightness-adjusted red, green and blue color components to obtain a brightness-adjusted color value. For example, the color value of a certain pixel is 0xCCCCCC, and the corresponding red, green, and blue color components are 0xCC, 0xCC, and 0xCC, respectively. These three color components are each multiplied by the target brightness value set by the user, for example, 0.5, to obtain the brightness-transformed color components 0x66, 0x66, and 0x66. The color components 0x66, 0x66, and 0x66 are recombined to obtain the brightness-transformed color value 0x666666. In this way, without requiring the terminal to support the alpha channel, the brightness can be changed by means of a translucent mask.
In an embodiment, said adjusting the color value of each pixel based on the target brightness value, to obtain the adjusted color value includes: converting the color value of each pixel from a red, green and blue color space to a hue, saturation and brightness color space; multiplying a brightness component in a color space-converted color value of each pixel by the target brightness value to obtain a brightness-adjusted color value of each pixel; and converting the brightness-adjusted color value of each pixel from the hue, saturation and brightness color space to the red, green and blue color space, to obtain a brightness-adjusted color value of each pixel in the red, green and blue color space. By performing the color space conversion and adjusting the brightness by directly adjusting the brightness components in the color value, the brightness adjustment effect is better.
In an embodiment, said obtaining the color value of each pixel in the loaded pixel data to be displayed includes: when the loaded pixel data to be displayed includes pixel data corresponding to an image, dividing the image into a plurality of image blocks, and obtaining the color value of each pixel in each of the plurality of image blocks respectively. By dividing the initial image to be displayed into the plurality of image blocks, and employing the method for adjusting display brightness on each image block, these image blocks can be processed in parallel, thereby enhancing the real-time processing capability.
In an embodiment, prior to said obtaining the color value of each pixel in the loaded pixel data to be displayed, the method further includes: in response to receiving pixel data to be displayed that is drawn by two or more mobile terminal applications, performing synthesis processing on the pixel data to be displayed that is drawn by each of the two or more mobile terminal applications, to obtain synthesized pixel data. In addition, said obtaining the color value of each pixel in the loaded pixel data to be displayed includes: obtaining the color value of each pixel in the synthesized pixel data. Specifically, the pixel data to be displayed of a plurality of mobile terminal applications can be synthesized into a piece of pixel data by Open Graphics Library (OpenGL), and the color value of each pixel in the synthesized pixel data can be obtained. The color value of each pixel is adjusted based on the target brightness value to obtain the adjusted color value, the error diffusion processing is performed on the adjusted color value, to obtain the error-diffusion processed color value, and the error-diffusion processed color value is sent to Framebuffer (Framebuffer is to drive a video display device from a memory buffer containing complete frame data through a video output device) for display.
It should be understood that, although the actions in blocks are shown in a certain sequence indicated by the arrows in the flowcharts of
In an embodiment, as illustrated in
In an embodiment, the error processing module includes: a coordinate value obtaining unit configured to obtain the adjusted color value of the pixel and coordinate values of the pixel; a quantization error generation unit configured to process the coordinate values of the pixel based on a triangular noise algorithm, to generate a quantization error corresponding to the pixel; and a superimposing unit configured to superimpose the quantization error on the adjusted color value of the pixel, to obtain the error-diffusion processed color value.
In an embodiment, the color adjustment module includes: a splitting unit configured to split the color value of each pixel into corresponding red, green and blue color components; a brightness adjustment unit configured to multiply each of the red, green and blue color components of each pixel by the target brightness value, to obtain brightness-adjusted red, green and blue color components; and a combining unit configured to recombine the brightness-adjusted red, green and blue color components to obtain a brightness-adjusted color value.
In an embodiment, the color adjustment module includes: a first color space conversion unit configured to convert the color value of each pixel from a red, green and blue color space to a hue, saturation and brightness color space; a brightness adjustment unit configured to multiply a brightness component in a color space-converted color value of each pixel by the target brightness value, to obtain a brightness-adjusted color value of each pixel; and a second color space conversion unit configured to convert the brightness-adjusted color value of each pixel from the hue, saturation and brightness color space to the red, green and blue color space to obtain a brightness-adjusted color value of each pixel in the red, green and blue color space.
In an embodiment, the color value obtaining module is further configured to, when the loaded pixel data to be displayed includes pixel data corresponding to an image: divide the image into a plurality of image blocks, and obtain the color value of each pixel in each of the plurality of image blocks respectively.
In an embodiment, the apparatus for adjusting display brightness further includes a synthesis module configured to, in response to receiving pixel data to be displayed that is drawn by two or more mobile terminal applications, perform synthesis processing on the pixel data to be displayed that is drawn by each of the two or more mobile terminal applications, to obtain synthesized pixel data; and the color value obtaining module is further configured to obtain the color value of each pixel in the synthesized pixel data.
For the specific limitations of the apparatus for adjusting display brightness, reference may be made to the limitations of the method for adjusting display brightness as described above, which will not be repeated herein. Each module in the above-mentioned apparatus for adjusting display brightness can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be integrated in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
In an embodiment, an electronic device is provided.
Those skilled in the art can understand that the structure illustrated in
In an embodiment, an electronic device is provided. The electronic device includes a memory and a processor. The memory has a computer program stored thereon, and when the processor executes the computer program, the following actions are implemented: obtaining a target brightness value, and a color value of each pixel in loaded pixel data to be displayed; adjusting the color value of each pixel based on the target brightness value, to obtain the adjusted color value; performing error diffusion processing on the adjusted color value to obtain an error-diffusion processed color value; and displaying the loaded pixel data to be displayed by using the error-diffusion processed color value.
In an embodiment, an electronic device is provided. The electronic device includes a memory and a processor. The memory has a computer program stored thereon, and when the processor executes the computer program, the following actions are implemented: obtaining the adjusted color value of the pixel and coordinate values of the pixel; processing the coordinate values of the pixel based on a triangular noise algorithm to generate a quantization error corresponding to the pixel; and superimposing the quantization error on the adjusted color value of the pixel to obtain the error-diffusion processed color value of the pixel.
In an embodiment, an electronic device is provided. The electronic device includes a memory and a processor. The memory has a computer program stored thereon, and when the processor executes the computer program, the following actions are implemented: splitting the color value of each pixel into corresponding red, green and blue color components; multiplying each of the red, green and blue color components of each pixel by the target brightness value, to obtain brightness-adjusted red, green and blue color components; and recombining the brightness-adjusted red, green and blue color components to obtain a brightness-adjusted color value.
In an embodiment, an electronic device is provided. The electronic device includes a memory and a processor. The memory has a computer program stored thereon, and when the processor executes the computer program, the following actions are implemented: converting the color value of each pixel from a red, green and blue color space to a hue, saturation and brightness color space; multiplying a brightness component in a color space-converted color value of each pixel by the target brightness value to obtain a brightness-adjusted color value of each pixel; and converting the brightness-adjusted color value of each pixel from the hue, saturation and brightness color space to the red, green and blue color space to obtain a brightness-adjusted color value of each pixel in the red, green and blue color space.
In an embodiment, an electronic device is provided. The electronic device includes a memory and a processor. The memory has a computer program stored thereon, and when the processor executes the computer program, the following actions are implemented: when the loaded pixel data to be displayed includes pixel data corresponding to an image, dividing the image into a plurality of image blocks, and obtaining a color value of each pixel in each of the plurality of image blocks respectively.
In an embodiment, an electronic device is provided. The electronic device includes a memory and a processor. The memory has a computer program stored thereon, and when the processor executes the computer program, the following actions are implemented: in response to receiving pixel data to be displayed that is drawn by two or more mobile terminal applications, performing synthesis processing on the pixel data to be displayed that is drawn by each of the two or more mobile terminal applications, to obtain synthesized pixel data; and obtaining the color value of each pixel in the synthesized pixel data.
In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the following actions are implemented: obtaining a target brightness value, and a color value of each pixel in loaded pixel data to be displayed; adjusting the color value of each pixel based on the target brightness value, to obtain the adjusted color value; and performing error diffusion processing on the adjusted color value to obtain an error-diffusion processed color value, and displaying the loaded pixel data to be displayed by using the error-diffusion processed color value.
In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the following actions are implemented: obtaining the adjusted color value of the pixel and coordinate values of the pixel; processing the coordinate values of the pixel based on a triangular noise algorithm, to generate a quantization error corresponding to the pixel; and superimposing the quantization error on the adjusted color value of the pixel to obtain the error-diffusion processed color value of the pixel.
In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the following actions are implemented: splitting the color value of each pixel into corresponding red, green and blue color components; multiplying each of the red, green and blue color components of each pixel by the target brightness value, to obtain brightness-adjusted red, green and blue color components; and recombining the brightness-adjusted red, green and blue color components to obtain a brightness-adjusted color value.
In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the following actions are implemented: converting the color value of each pixel from a red, green and blue color space to a hue, saturation and brightness color space; multiplying a brightness component in a color space-converted color value of each pixel by the target brightness value, to obtain a brightness-adjusted color value of each pixel; and converting the brightness-adjusted color value of each pixel from the hue, saturation and brightness color space to the red, green and blue color space to obtain a brightness-adjusted color value of each pixel in the red, green and blue color space.
In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the following actions are implemented: when the loaded pixel data to be displayed includes pixel data corresponding to an image, dividing the image into a plurality of image blocks, and obtaining a color value of each pixel in each of the plurality of image blocks respectively.
In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the following actions are implemented: in response to receiving pixel data to be displayed that is drawn by two or more mobile terminal applications, performing synthesis processing on the pixel data to be displayed that is drawn by each of the two or more mobile terminal applications, to obtain synthesized pixel data; and obtaining a color value of each pixel in the synthesized pixel data.
Those of ordinary skill in the art can understand that all or some of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it may include the processes of the above-mentioned method embodiments. Any reference to a memory, a storage, a database or other medium used in the various embodiments provided in the present disclosure may include a non-volatile and/or volatile memory. The non-volatile memory may include a read only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may include a random-access memory (RAM) or an external cache memory. For the purpose of illustration and not for limitation, an RAM is available in various forms such as a static RAM (SRAM), a dynamic RAM (DRAM), a synchronous DRAM (SDRAM), a double data rate SDRAM (DDRSDRAM), an enhanced SDRAM (ESDRAM), a Synchlink DRAM (SLDRAM), a memory bus (Rambus) direct RAM (RDRAM), a direct memory bus dynamic RAM (DRDRAM), and a memory bus dynamic RAM (RDRAM), etc.
The technical features of the above embodiments can be combined arbitrarily. For the concise description, all possible combinations of the technical features in the above embodiments are not individually described. However, the combination of these technical features shall be considered to fall within the range described in this specification, unless contradiction occurs.
The above-mentioned embodiments are merely several representative embodiments of the present disclosure, and the specific and detailed descriptions thereof should not be construed as limitations on the scope of the present disclosure. It should be noted that, for those skilled in the art, without departing from the concept of the present disclosure, several modifications and improvements can be made, which all belong to the protection scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be defined by the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
201911181515.5 | Nov 2019 | CN | national |
This application is a continuation of International Application No. PCT/CN2020/121192, filed on Oct. 15, 2020, which claims priority to Chinese Patent Application No. 201911181515.5, filed on Nov. 27, 2019. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2020/121192 | Oct 2020 | US |
Child | 17826824 | US |