Rendering processing method and electronic device
By introducing texture level offset parameters and AI super-resolution algorithms into the texture sampling function of electronic devices, the problem of blurred images caused by low texture levels is solved and high-quality graphics rendering effects are achieved.
Patent Information
- Application Number
- CN202310835649.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2043-07-07
AI Technical Summary
During the graphics rendering process of existing electronic devices, the low texture level results in low picture resolution, blur and distortion problems, making it difficult to meet high-quality picture display requirements.
By introducing the texture level offset parameter in the texture sampling function, the level of the texture pattern is dynamically adjusted, and combined with the AI super-resolution algorithm, the picture resolution and picture quality are improved.
It realizes dynamic adjustment of texture levels according to scene requirements, improves picture resolution and quality, reduces GPU load, and reduces picture distortion problems.
Smart Images

Figure CN117689796B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to terminal technology, and more particularly to a rendering processing method and an electronic device. Background Art
[0002] With the advancement of terminal technology, various electronic devices have emerged. Electronic devices have gradually become a necessity for people's daily life and work. People use electronic devices to play games, watch videos, or make video calls. In these activities, electronic devices need to perform corresponding graphics rendering to display the corresponding pictures. How to display the pictures clearly is an urgent problem that technicians in this field need to solve. Summary of the invention
[0003] The embodiments of the present application provide a rendering processing method and an electronic device, which can increase the resolution of a displayed image and improve the image quality.
[0004] In a first aspect, an embodiment of the present application provides a rendering processing method, the method comprising:
[0005] Start the target application;
[0006] Calling a first texture function to sample a texture pattern through a first fragment shader of the target application, and obtaining a color corresponding to a first texture coordinate in the texture pattern; the first texture function includes a first parameter, a second parameter, and a third parameter, the first parameter is used to call the texture pattern, the second parameter is used to indicate the first texture coordinate, and the third parameter is used to indicate a texture level offset value, and the texture level offset value is used to determine a texture level of the texture pattern;
[0007] The screen of the target application is rendered based on the acquired color.
[0008] Compared with the existing solution, the above solution adds a third parameter in the texture function to indicate the texture level offset value of the sampled texture pattern, so as to adaptively adjust the texture level of the sampled texture pattern. Then, a quality-matched picture can be rendered according to the corresponding scene requirements, thereby improving the user experience.
[0009] In a possible implementation, the third parameter is a uniform variable; the method further includes: assigning the texture level offset value to the third parameter by uniform parameter transfer.
[0010] The above solution assigns values to texture level offset parameters through uniform parameter transfer, which is simple to implement.
[0011] In a possible implementation, assigning the texture level offset value to the third parameter by uniform parameter transfer includes: assigning the texture level offset value in the configuration file to the third parameter by uniform parameter transfer.
[0012] In the above solution, the texture level offset value comes from the configuration file, so the texture level offset value can be modified by modifying the value of the configuration file to achieve the purpose of adaptively adjusting the texture level offset value.
[0013] In a possible implementation, the method further includes: in response to starting the target application, deleting a binary file of the second fragment shader cached by the target application;
[0014] During the loading process of the target application, the source program of the second fragment shader is modified to obtain the source program of the first fragment shader.
[0015] In the above solution, the original shader file is first deleted, and then the shader is modified during the application loading process to obtain a new shader. The new shader can call the texture function including the three parameters. Then, the texture level of the sampled texture pattern can be adaptively adjusted. Then, a quality-matched picture can be rendered according to the corresponding scene requirements to improve the user experience.
[0016] In a possible implementation, modifying the source program of the second fragment shader includes: adding the third parameter to a second texture function included in the source program of the second fragment shader to obtain the first texture function; the second texture function includes the first parameter and the second parameter.
[0017] In the above solution, the third parameter can be added to the texture function of the original shader to obtain the first texture function, which is simple and convenient to implement.
[0018] In a possible implementation, modifying the source program of the second fragment shader includes: adding a declaration of the third parameter in the source program of the second fragment shader.
[0019] In the above solution, a declaration of a texture level offset parameter, ie, the above third parameter, is added to the shader so that the electronic device can recognize the third parameter.
[0020] In a possible implementation, after modifying the source program of the second fragment shader to obtain the source program of the first fragment shader, the method further includes: compiling the source program of the first fragment shader to obtain a binary file of the first fragment shader; and saving the binary file of the first fragment shader.
[0021] In the above scheme, after the shader is modified, the modified shader is recompiled to obtain a new shader binary file and saved so that it can be directly called next time to save resources.
[0022] In a possible implementation, calling a first texture function to sample a texture pattern through a first fragment shader of the target application includes: calling a binary file of the first fragment shader to run the first fragment shader to call the first texture function to sample the texture pattern.
[0023] In the above scheme, the shader can be run by calling the binary file of the recompiled shader to perform pattern sampling and rendering.
[0024] In one possible implementation, in response to starting the target application, deleting the binary file of the second fragment shader cached by the target application, includes: in response to starting the target application, checking whether there is a modification mark; the modification mark is used to identify that the first fragment shader is modified; if the modification mark does not exist, deleting the binary file of the second fragment shader cached by the target application.
[0025] In the above scheme, before deleting the shader file, check whether the shader has been modified. If it has not been modified, delete the original file and modify it later to reduce resource consumption of repeated modifications.
[0026] In one possible implementation, the first fragment shader of the target application calls the first texture function to sample the texture pattern, including: when the size of the color buffer indicates that the picture is rendered in a reduced resolution rendering manner, the first fragment shader of the target application calls the first texture function to sample the texture pattern.
[0027] In the above scheme, the modified shader is used to render the picture in the scenario of reduced resolution rendering to improve the image quality of the reduced resolution rendering.
[0028] In a possible implementation, the texture level offset value is less than zero, and after rendering the screen of the target application based on the acquired color, the method further includes: performing AI super-resolution rendering on the obtained rendered screen through an artificial intelligence AI super-resolution algorithm; and displaying the AI super-resolution rendered screen.
[0029] In the above scheme, the offset value is set to be less than zero during the down-resolution rendering process to obtain a down-resolution rendering picture with better resolution, which is then input into the AI super-resolution algorithm for AI super-resolution rendering, and a better quality AI super-resolution result can be obtained, thereby presenting a picture with better resolution.
[0030] In one possible implementation, the first fragment shader of the target application calls the first texture function to sample the texture pattern, including: when the size of the color buffer indicates that the screen is rendered without using reduced resolution rendering, assigning zero to the third parameter, and calling the first texture function to sample the texture pattern through the first fragment shader of the target application.
[0031] In the above scheme, in the scenario where the resolution is not reduced, the third parameter is assigned a value of zero, and then the modified shader is used to render the screen. This reflects the selectivity of the rendering method in the implementation scheme of the present application, that is, different rendering parameters can be flexibly selected according to the scene, thereby meeting the rendering requirements of various scenes.
[0032] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code includes a computer instruction, and the one or more processors call the computer instruction to enable the electronic device to perform the following operations:
[0033] Start the target application;
[0034] Calling a first texture function to sample a texture pattern through a first fragment shader of the target application, and obtaining a color corresponding to a first texture coordinate in the texture pattern; the first texture function includes a first parameter, a second parameter, and a third parameter, the first parameter is used to call the texture pattern, the second parameter is used to indicate the first texture coordinate, and the third parameter is used to indicate a texture level offset value, and the texture level offset value is used to determine a texture level of the texture pattern;
[0035] The screen of the target application is rendered based on the acquired color.
[0036] In a possible implementation, the third parameter is a uniform variable; the one or more processors call the computer instruction to cause the electronic device to further perform the following operation: assigning the texture level offset value to the third parameter by uniform parameter transfer.
[0037] In a possible implementation, the one or more processors call the computer instruction to enable the electronic device to specifically perform the following operations: assigning the texture level offset value in the configuration file to the third parameter through a uniform parameter transfer method.
[0038] In a possible implementation, the one or more processors call the computer instruction to cause the electronic device to further perform the following operations: in response to starting the target application, deleting a binary file of the second fragment shader cached by the target application;
[0039] During the loading process of the target application, the source program of the second fragment shader is modified to obtain the source program of the first fragment shader.
[0040] In one possible implementation, the one or more processors call the computer instructions to cause the electronic device to specifically perform the following operations: adding the third parameter to the second texture function included in the source program of the second fragment shader to obtain the first texture function; the second texture function includes the first parameter and the second parameter.
[0041] In a possible implementation, the one or more processors call the computer instruction to enable the electronic device to specifically perform the following operation: adding a declaration of the third parameter in a source program of the second fragment shader.
[0042] In a possible implementation, the one or more processors call the computer instructions to enable the electronic device to further perform the following operations: compile the source program of the first fragment shader to obtain a binary file of the first fragment shader; and save the binary file of the first fragment shader.
[0043] In a possible implementation, the one or more processors call the computer instruction to enable the electronic device to specifically perform the following operations: call the binary file of the first fragment shader to run the first fragment shader, so as to call the first texture function to sample the texture pattern.
[0044] In one possible implementation, the one or more processors call the computer instructions to cause the electronic device to specifically perform the following operations: in response to the start of the target application, check whether there is a modification mark; the modification mark is used to identify that the first fragment shader has been modified; if the modification mark does not exist, delete the binary file of the second fragment shader cached by the target application.
[0045] In one possible implementation, the one or more processors call the computer instructions to cause the electronic device to specifically perform the following operations: when the size of the color buffer indicates that the image is rendered using reduced resolution rendering, calling the first texture function through the first fragment shader of the target application to sample the texture pattern.
[0046] In one possible implementation, the one or more processors call the computer instructions so that the electronic device further performs the following operations: performing AI super-resolution rendering on the obtained rendering picture through an artificial intelligence AI super-resolution algorithm; and displaying the AI super-resolution rendered picture.
[0047] In one possible implementation, the one or more processors call the computer instructions to cause the electronic device to specifically perform the following operations: when the size of the color buffer indicates that the image is not rendered using reduced resolution rendering, zero is assigned to the third parameter, and the first texture function is called through the first fragment shader of the target application to sample the texture pattern.
[0048] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a touch screen, a camera, one or more processors and one or more memories; the one or more processors are coupled to the touch screen, the camera, and the one or more memories, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the method described in the first aspect or any possible implementation method of the first aspect.
[0049] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation method of the first aspect.
[0050] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0051] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0052] The second to sixth aspects are used to cooperate with the method of implementing any one of the first aspect and its possible implementation methods, and therefore have corresponding beneficial effects to the first aspect and its possible implementation methods, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1A A schematic diagram of a multi-level progressive texture provided in an embodiment of the present application;
[0054] Figure 1B A schematic diagram of texture coordinates provided in an embodiment of the present application;
[0055] Figure 2 A schematic diagram of rendering steps provided in an embodiment of the present application;
[0056] Figure 3A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0057] Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0058] Figure 5 and Figure 6 A schematic diagram of the method flow provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The technical solution in the embodiment of the present application will be described below in conjunction with the accompanying drawings. In the description of the embodiment of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiment of the present application, "multiple" means two or more than two.
[0060] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0061] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0062] Only the part relevant to the present application but not all content is shown in the accompanying drawings.Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods described as flow charts.Although flow charts describe various operations (or steps) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously.In addition, the order of various operations can be rearranged.Described processing can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings.Described processing can correspond to method, function, procedure, subroutine, subprogram etc.
[0063] First, the technical terms involved in the embodiments of the present application are introduced.
[0064] 1. Texture.
[0065] Texture in computer graphics includes both the texture of the surface of an object in the usual sense, that is, the grooves that make the surface of an object appear uneven, and the colored patterns on the smooth surface of an object, which we usually call patterns. For patterns, it means drawing colored patterns or designs on the surface of an object, and the surface of the object after the texture is generated remains smooth. For grooves, in fact, it is also necessary to draw colored patterns or designs on the surface, while requiring visually giving people a sense of unevenness. Uneven patterns are generally irregular. In computer graphics, the generation methods of these two types of textures are exactly the same, which is why they are collectively called textures in computer graphics.
[0066] 2. Texture coordinates.
[0067] In order to map the texture to the triangles used to construct the object, it is necessary to specify which part of the texture pattern each vertex of the triangle corresponds to. In this way, each vertex will be associated with a texture coordinate, which is used to indicate where the fragment color is collected from the texture pattern. The collected color is the color of the vertex.
[0068] Taking 2D texture as an example, the 2D texture coordinates can be expressed as (x, y). The value range of x and y is between 0 and 1. Figure 1A , the texture coordinates start at (0,0), which is the lower left corner of the texture image, and end at (1,1), which is the upper right corner of the texture image.
[0069] 3. Multi-level mipmap texture.
[0070] Mipmap concept: In the process of graphics rendering, in order to efficiently obtain the color of a certain area of the texture corresponding to a certain pixel, a typical and commonly used solution is to use a method of using space for time to generate a series of levels of texture images from a piece of texture. In the rendering process, according to parameters such as the relative position of the object and the camera in the scene, the texture pattern sample corresponding to the texture level is selected to obtain the color of the specified texture coordinates. That is, the distance between the object and the camera is different, and different levels of textures can be used for rendering. For example, when the distance between the two is far, a larger texture (that is, a lower-level texture) is used. Although the resolution is not high, it will not be noticed by the user. Then the rendering of the textures of all objects in the space is completed efficiently and with high quality.
[0071] The above series of texture levels include, for example, 0, 1, 2, 3, ..., Q, or Q+1 levels, where Q is an integer greater than 1. The width of the texture image of the next level is one Nth of the width of the texture image of the previous level, and the height of the texture image of the next level is one Nth of the height of the texture image of the previous level. N may be an integer greater than or equal to 2. For ease of understanding, taking N=2 as an example, it can be exemplified by referring to Figure 1B .exist Figure 1B In the example, Q+1=4, i.e. 4 levels, is taken. It can be seen that the width and height of the texture image of level 1 are both half of the texture image of level 0, the width and height of the texture image of level 2 are both half of the texture image of level 1, and the width and height of the texture image of level 3 are both half of the texture image of level 2. It can be understood that the width and height of the texture image here refer to the width and height of the pixel matrix of the texture image.
[0072] In the above texture levels, the lower the level, the higher the precision, and the higher the resolution of the image rendered. Conversely, the higher the level, the lower the precision, and the lower the resolution of the image rendered.
[0073] 4. Creation and use of textures.
[0074] Taking the OpenGL or OpenGL for embedded systems (OpenGL ES) as an example, if you want to use a texture, you first need to create and bind a texture object. For example, you can create and bind a texture object using the following computer program:
[0075] "unsigned int texture;
[0076] glGenTexture(1,&texture);
[0077] glBindTexture(GL_TEXTURE_2D,texture);".
[0078] Among them, the glGenTexture function is used to create a texture object, and the glBindTexture function is used to bind the texture object. The first parameter of the glBindTexture function specifies the texture format to be bound, which can be specified as 2D texture or 3D texture, and the second parameter is our texture object. The embodiment of this application mainly introduces 2D texture as an example, and the 3D texture is similar and will not be repeated.
[0079] Before using the texture, we need to load the prepared texture image file into our application. For example, we can use the image loading library stb_image to achieve this.
[0080] After loading successfully, you can create a 2D texture through the glTexImage2D function. The glTexImage2D function can be expressed as glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizeiwidth, GLsizei height, GLint border, GLenum format, GLenum type, const void*pixels).
[0081] The parameters of the glTexImage2D function are as follows:
[0082] The first parameter GLenum target specifies the texture target. In the glTexImage2D function, this value is GL_TEXTURE_2D.
[0083] The second parameter GLint level is used to specify the level of the multi-level asymmetric texture.
[0084] The third parameter GLenum internalformat indicates the format in which the texture is stored. For example, the texture can be stored as RGB values.
[0085] The fourth parameter GLsizei width and the fifth parameter GLsizei height set the width and height of the final texture. They are stored when the texture image is loaded above, so the corresponding values can be used.
[0086] The sixth parameter, GLint border, is set to 0.
[0087] The seventh parameter GLenum format and the eighth parameter GLenum type define the format and data type of the source texture image.
[0088] The last parameter const void*pixels specifies the pointer to the image data in memory, which is used to point to the specific image pixel data.
[0089] After defining and creating the texture, you can call the corresponding texture in the fragment shader for rendering and display.
[0090] For example, in the fragment shader, you can declare a texture sampler (such as sampler2D) to access the created texture. Specifically, you can use the texture(parameter 1, parameter 2) function to sample the color of the texture. The first parameter of the texture function, parameter 1, is the texture sampler, which can be used to call the texture created previously by the glTexImage2D function. The second parameter, parameter 2, is the corresponding texture coordinates. The texture function will use the texture parameters set by the previous glTexImage2D function to sample the corresponding color value. The output of this fragment shader is the color at the texture coordinates of the texture.
[0091] When electronic devices provide users with interface displays for services such as games, video playback or video calls, low screen resolution may occur. After in-depth analysis, it was found that in order to save unnecessary rendering and reduce performance waste, electronic devices use texture patterns with lower texture levels (also called maps) for rendering. Texture patterns with lower texture levels have low screen resolution, which causes distortion and blurriness in the screen. For ease of understanding, the following application scenario of game rendering is further introduced as an example.
[0092] For example, see Figure 2 . Figure 2exemplarily shows some steps included in the process of rendering the game screen to presenting it on the screen. Specifically, in the process of rendering the game screen, processing steps such as sampling texture patterns, down-resolution rendering, and artificial intelligence (AI) super-resolution rendering may be included. After AI super-resolution rendering, the corresponding screen can be presented on the screen. Exemplarily, the electronic device can sample the texture pattern for rendering. Then, rendering is performed based on the sampled texture pattern. Generally, in order to save unnecessary rendering to reduce performance waste, when the object in the screen is far away from the observer (camera), the texture pattern with a lower texture level is sampled for rendering. The resolution of the picture obtained by rendering based on the texture pattern with a lower texture level is low, so it can also be called down-resolution rendering. This down-resolution rendering method can reduce the rendering load of the graphics processing unit (GPU) to achieve the purpose of reducing the processing burden of the GPU. However, the resolution of the picture obtained in this way is low, and the picture has the problem of distortion. Since the picture quality obtained by the previous down-resolution rendering is poor, even if the AI super-resolution algorithm is used later to further render the low-resolution picture (i.e., AI super-resolution rendering) to improve the resolution of the picture, the obtained picture still has a certain distortion. Especially for distant objects and objects such as the ground, there is still serious distortion after AI super-resolution rendering.
[0093] In order to improve the quality of the picture presented on the upper screen so as to display the picture clearly, an embodiment of the present application provides a rendering processing method and an electronic device that implements the rendering processing method.
[0094] The following is an exemplary introduction to the electronic device provided by the embodiment of the present application. The electronic device involved in the embodiment of the present application may include a handheld device (e.g., a mobile phone, a tablet computer, a PDA, etc.), a vehicle-mounted device (e.g., a car, an electric car, an airplane, a ship, etc.), a wearable device (e.g., a smart watch (e.g., iWatch, etc.), a smart bracelet, a pedometer, etc.), an intelligent robot, a workshop equipment, and various forms of user equipment (UE), a mobile station (MS), or a terminal device (Terminal Equipment) that can display a user interface, etc. Optionally, the electronic device generally supports a variety of applications, such as a camera application, a word processing application, a telephone application, an email application, an instant messaging application, a photo management application, a web browsing application, a digital music player application, and / or a digital video player application, etc. It can be understood that the introduction here is only an example, and the embodiment of the present application does not limit the specific form and implementation of the electronic device.
[0095] For example, see Figure 3, which shows a schematic diagram of the hardware structure of the electronic device 100.
[0096] The following is a detailed description of the embodiment using the electronic device 100 as an example. It should be understood that the electronic device 100 may have more than Figure 3 More or fewer components may be shown, two or more components may be combined, or there may be a different configuration of components. Figure 3 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0097] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0098] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0099] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0100] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0101] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0102] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0103] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0104] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0105] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0106] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0107] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0108] The SIM card interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.
[0109] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0110] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0111] The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.
[0112] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
[0113] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0114] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0115] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0116] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0117] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0118] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0119] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0120] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0121] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0122] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0123] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0124] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0125] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0126] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0127] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0128] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, applications required for at least one function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as face information template data, fingerprint information template, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0129] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0130] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0131] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0132] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0133] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0134] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0135] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0136] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0137] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0138] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0139] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0140] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0141] 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 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0142] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0143] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0144] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0145] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0146] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0147] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0148] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, synthesis requests, missed calls, notifications, etc.
[0149] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
[0150] In the embodiment of the present application, the electronic device 100 can execute the rendering processing method provided in the embodiment of the present application through the processor 110.
[0151] based on Figure 3The hardware structure diagram of the electronic device 100 of the embodiment of the present application is shown in FIG. 1 , and the software structure block diagram of the electronic device 100 of the embodiment of the present application is introduced below. Figure 4 shown.
[0152] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0153] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0154] The application layer can include a series of application packages.
[0155] like Figure 4 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, and short message.
[0156] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0157] like Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager, etc.
[0158] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0159] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0160] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0161] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0162] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0163] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0164] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0165] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0166] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0167] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0168] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0169] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0170] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0171] A 2D graphics engine is a drawing engine for 2D drawings.
[0172] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0173] The following is an exemplary description of the workflow of the electronic device 100 software and hardware. When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into an original input event (including touch coordinates, timestamp of the touch operation, and other information). The original input event is stored in the kernel layer. The application framework layer obtains the original input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation and the control corresponding to the single-click operation is an icon control of a game application, the game application calls the interface of the application framework layer to start the game application.
[0174] The following is an exemplary description of the rendering processing method provided in the embodiment of the present application. The method can be applied to the electronic device described above. Figure 5 The rendering processing method provided in the embodiment of the present application includes but is not limited to the following steps.
[0175] 501. Start the target application.
[0176] Exemplarily, the target application can be any application that needs to render a display screen, such as a game application, a video playback application, or a communication chat application, etc., and the present application embodiment does not limit this. The target application can be an APP, a mini-program, or a web application, etc., and the present application embodiment does not limit the implementation form of the specific application.
[0177] For example, the electronic device may start the target application in response to a user's touch or click operation on an icon, entry link, or entry control of the target application. Or the target application may be started in response to a user's voice start command to the target application. The specific method of starting the target application is not limited in the embodiments of the present application.
[0178] 502. Check whether the modification mark exists.
[0179] Exemplarily, in response to the start of the target application, the electronic device can check whether there is a modification mark locally. Whether the modification mark is used to identify whether the shader of the target application is modified. That is, whether the computer program code of the shader of the target application is modified. If the modification mark exists, it indicates that the shader has been modified. If the modification mark does not exist, it indicates that the shader has not been modified.
[0180] In a possible implementation, the modification mark can be, for example, a modification mark file or a specific preset mark, etc. Exemplarily, in the embodiment of the present application, the shader is modified to modify the level offset value of the sampled texture pattern, so the modification mark file can also be called a bias-flag file. The content in the modification mark file can be empty, or can be other preset information, which is not limited in the embodiment of the present application.
[0181] In a possible implementation, the electronic device may pre-allocate a storage space for storing the modification mark. Then, in response to the start-up operation of the target application, the electronic device may query whether the modification mark exists in the pre-allocated storage space. Exemplarily, the pre-allocated storage space may be found through a preset storage path.
[0182] 503. If the modification flag does not exist, delete the cached shader binary file.
[0183] Exemplarily, if the electronic device detects that the modification mark does not exist, it indicates that the shader of the target application has not been modified. Then, the electronic device can delete the cached shader binary file of the target application. Exemplarily, the cached shader binary file of the target application is the native binary shader file that comes with the target application. Exemplarily, some or all of the fragment shader binary files in the target application can be deleted, which is determined according to the actual application requirements, and the embodiments of the present application do not limit this. The following mainly takes a fragment shader as an example, and the other fragment shaders are the same, so they will not be repeated.
[0184] For example, if the electronic device renders the screen of the target application through OpenGL or OpenGL ES, the shader binary file of the target application can be deleted through the DeleteGameBinaryFiles() function. It is understood that this is only an example and does not constitute a limitation on the embodiments of the present application.
[0185] 504. Create modification mark.
[0186] Exemplarily, if the electronic device detects that the modification mark does not exist, then a modification mark may be created, such as by creating a modification mark file or generating a preset identifier, etc. The modification mark is then saved in the pre-allocated storage space.
[0187] It is understandable that the present embodiment of the application does not limit the order of the above two operations of creating the modification mark and deleting the cached shader binary file. Alternatively, the above operation of creating the modification mark can be performed after the following steps 505, 506 or 507, and the present embodiment of the application does not limit this.
[0188] Due to the existence of the modification mark, the electronic device does not need to perform the above steps 503 and 504 and the following steps 505 and 506 every time the target application is started. Instead, these steps can be performed when the target application is started for the first time, thereby saving computing resources.
[0189] 505. Define the texture level offset parameter in the form of a global variable and assign a value.
[0190] Exemplarily, after deleting the cached shader binary file, a texture level offset parameter may be defined in the form of a global variable. For example, the texture level offset parameter may be defined in the form of a uniform variable. Then, a preset configuration file is parsed to obtain a set texture level offset value, and the texture level offset value is assigned to the texture level offset parameter. Exemplarily, the texture level offset value may be modified by modifying the value of the configuration file.
[0191] In another possible implementation, the texture level offset value may be fixed and stored in a preset storage space. Then, the fixed texture level offset value may be obtained from the preset storage space and assigned to the texture level offset parameter.
[0192] 506. During the target application loading process, a texture level offset parameter is added to the texture function of the shader, and the modified shader is recompiled to obtain a new shader binary file.
[0193] For example, since the cached shader binary file was deleted before, the source program of the shader will be reloaded and compiled during the target application loading process. In the process of loading the shader source program, a texture level offset parameter can be added to the texture function of the shader source program. And a declaration of the texture level offset parameter is added to the shader source program. In the subsequent introduction, the shader before compilation refers to the shader source program, and the shader after compilation refers to the shader binary file.
[0194] Exemplarily, the addition of texture level offset parameters and their declarations can be achieved by matching regular expressions. Specifically, the main function of the shader can be matched by a defined regular expression, and then the declaration of the texture level offset parameters can be added in front of the main function by using a regular replacement function. In addition, the texture function of the shader can be matched by another defined regular expression, and then the texture level offset parameters can be added to the texture function by using a regular replacement function. For ease of understanding, the following is an example in the form of pseudo code.
[0195] Exemplarily, the pseudo code for adding a texture level offset parameter declaration in a shader by regular expression matching may be as follows:
[0196] "Defines the variable name for the texture level offset parameter in the shader;
[0197] Assign the texture level offset parameter declaration defined in the form of a uniform variable to a parameter;
[0198] Use regular expressions to match the main function of the shader;
[0199] Use the regular replacement function to add the declaration of the texture level offset parameter in the main function;".
[0200] For ease of understanding, the following further illustrates an example of program code for adding a texture level offset parameter declaration in a shader by regular expression matching:
[0201] "MIPMAP_LOD_BIAS_NAME = g_setlodbias"; / / Define the variable name of the texture level bias parameter in the shader
[0202] replaceStr = "uniform mediump float" + MIPMAP_LOD_BIAS_NAME; / / Assign the texture level offset parameter declaration defined in the form of a uniform variable to a parameter
[0203] mainFunPattern = ("(void[]*main[]*\\([]*\\))"); / / Use regular expression to match "void main" in the main function of the shader
[0204] auto result1 = regex_replace(*string, mainFunPattern, replaceStr); / / Use the regular replacement function to add the declaration of the texture level offset parameter in the main function.
[0205] Specifically, in the example of the above program code, "uniform mediump float"+IPMAP_LOD_BIAS_NA ME" represents the string of texture level offset parameter declaration. After being assigned to replaceStr, replaceStr can represent the string of texture level offset parameter declaration. The above "(void[]*main[]*\\([]*\\))" is a regular expression used to match "void main" in the main function; after being assigned to mainFunPattern, mainFunPattern can represent the regular expression used to match the main function "void main". In the above "result1=regex_replace(*string,mainFunPattern,replaceStr r)", string represents the shader source program to be replaced. Combined with the two parameters of mainFunPattern and replaceStr mentioned above, it is possible to add a line to the position of void main and add the declaration of texture level offset parameter in the newly added line. Then, result1 represents the modified shader source program returned after adding the declaration.
[0206] For example, in a possible implementation, it is also possible to determine whether the declaration of the texture level offset parameter is successfully added by the following program code:
[0207] "if regex_search(result1,std::regex(replaceStr))
[0208] return true
[0209] else
[0210] return false".
[0211] It can be seen that through the above program code example, the declaration of the texture level offset parameter can be added to the front of the main function of the shader.
[0212] Adding a declaration of the texture level offset parameter defined in the form of a uniform variable before the main function in the shader can expose the texture level offset parameter to the openGL or openGLES interface through the uniform parameter passing method in the subsequent rendering process to modify the value of the texture level offset parameter.
[0213] For example, the variable name of the texture level offset parameter defined above can be used to add the texture level offset parameter in the texture function of the shader. Then, the pseudo code for adding the texture level offset parameter in the texture function of the shader by regular expression matching can be as follows:
[0214] “Use regular expressions to match the texture function of the shader;
[0215] Use the regular replacement function to add a texture level offset parameter to the texture function;".
[0216] For ease of understanding, an example of program code for adding a texture level offset parameter in a shader by regular expression matching is further shown below:
[0217] "std::regex texPattern("(texture[]*\\([]*[\\w]*[]*,[]*[\\w.]*[]*)(\\))")"; / / Use regular expression to match the texture function of the shader
[0218] sprintf_s(replaceStr,128,"$1,%s$2",MIPMAP_LOD_BIAS_NAME); / / Output the texture level offset parameter (i.e. MIPMAP_LOD_BIAS_NAME) to a string (i.e. output to replaceStr) in a certain format and store it in the buffer;
[0219] result2 = regex_replace(result1, texPattern, replaceStr); / / Use the regular replacement function to add the texture level offset parameter in the texture function.
[0220] Specifically, in the example of the above program code, the above "(texture[]*\\([]*[\\w]*[]*,[]*[\\w.]*[]*)(\\))" is a regular expression used to match the texture function, which can be represented by texPattern. Through "sprintf_s(replaceStr,128,"$1,%s$2",MIPMAP_LOD_BIAS_NAME)", replaceStr can represent the texture level offset parameter MIP MAP_LOD_BIAS_NAME. In the above "result2=regex_replace(result1,texPattern,replaceStr)", result1 is the modified shader source program returned after the above-mentioned addition of the declaration, that is, the shader source program is the program to be further modified. Combined with the aforementioned two parameters texPattern and replaceStr, it is possible to add the texture level offset parameter to the texture function of the shader source program. Then, result2 represents the shader source program returned after the addition of the texture level offset parameter and its declaration.
[0221] Through the above sequence code example, it is possible to add the texture level offset parameter to the shader texture function.
[0222] For ease of understanding, partial pseudo code examples of the shader before and after modification are shown below.
[0223] The following is a pseudo code example of some of the shader programs before modification:
[0224]
[0225] The following is a pseudo code example of the modified shader:
[0226]
[0227] Comparing some of the program pseudocodes of the shader before and after the modification, it can be seen that the modified shader adds a texture level offset parameter declaration before the main function, such as adding "uniform mediump float g_setlodbias". In addition, the texture function of the shader before the modification includes two parameters: parameter 1 and parameter 2. For the introduction of these two parameters, please refer to the corresponding description in the aforementioned terminology introduction, which will not be repeated here. The texture function of the modified shader includes three parameters: parameter 1, parameter 2 and parameter 3. Compared with the texture function before the modification, a new parameter 3 is added. Parameter 3 is the above-mentioned texture level offset parameter. Parameter 3 can be, for example, the above-mentioned g_setlodbias parameter.
[0228] It is understandable that the above program codes and parameter names are only examples and do not constitute a limitation on the embodiments of the present application. In the specific implementation process, the writing of the program code can be changed or the parameter name can be modified to realize the above functions, and the embodiments of the present application do not limit this.
[0229] After the addition of the texture level offset parameter and its declaration is completed, a new shader program code can be obtained. Then, the new shader program code is recompiled to obtain a new shader binary file. The new shader binary file is cached.
[0230] 507. After the new shader binary file is obtained, or if the modification mark is found to exist in step 502, the picture is rendered based on the new shader binary file.
[0231] Exemplarily, after obtaining the new shader binary file, the color of the corresponding texture coordinates can be sampled and output based on the new shader binary file for rendering the picture. Alternatively, if the above step 502 checks that the modification mark exists, it indicates that the shader has been modified, the target application is not started for the first time, and the currently cached shader is the new shader binary file. Therefore, the color of the corresponding texture coordinates can be sampled and output based on the new shader binary file for rendering the picture. Specifically, the new shader binary file can be called to run the new shader to call the modified texture function to sample the corresponding texture pattern, and then sample and output the color of the corresponding texture coordinates for rendering the picture.
[0232] In the process of sampling and outputting the color of the corresponding texture coordinates based on the new shader binary file, the set texture level offset value can be assigned to the texture level offset parameter in the texture function of the new shader by passing a uniform parameter.
[0233] For example, the set texture level offset value can be assigned to the texture level offset parameter in the texture function of the new shader through the glUniform1f() function. Exemplarily, the location information of the name of the global variable texture level offset parameter can be returned through the glGetUniformLocation() function (the location information can be a vector, for example). Then, glUniform1f() can find the texture level offset parameter of the texture function in the shader based on the location information and assign it to the texture level offset parameter. For ease of understanding, an example of program code is shown as follows:
[0234] "biasLocation = glGetUniformLocation (parameter A, parameter B);
[0235] glUniform1f(parameter C, parameter D);".
[0236] Among them, parameter A in the glGetUniformLocation function specifies the program object to be queried. Parameter B in the glGetUniformLoc ation function indicates the name of the variable to be queried. If the texture level offset parameter of the texture function in the shader is to be queried, then the name of the variable to be queried indicated by parameter B may be the above-mentioned MIPMAP_LOD_BIAS_NAME. biasLocation is the location information returned by the glGetUniformLocation function. In the glUniform1f function, parameter C indicates the location of the changed variable, that is, parameter C = biasLocation. Parameter D indicates the new value used by the variable, that is, the new value of the texture level offset parameter. Combined with the previous step 505, the texture level offset value set in the configuration file has been assigned to the texture level offset parameter. Therefore, the value of parameter D is the texture level offset value set in the configuration file. That is, the glUniform1f function assigns the texture level offset value set in the configuration file to the texture level offset parameter in the texture function of the new shader.
[0237] After the texture level offset value set in the configuration file is assigned to the texture level offset parameter in the texture function of the new shader, the texture level of the sampled texture pattern can be calculated based on the texture level offset value. Exemplarily, based on the previous introduction to the creation and use of texture terms, the level of the multi-level asymptotic texture is specified by the GLint level parameter in the glTexImage2D function. Then, the texture level of the texture pattern used for sampling can be obtained by adding the specified level to the texture level offset value set previously. Assume that the texture level of the texture pattern used for sampling is represented by level_final, the set texture level offset value is represented by bias, and the level of the multi-level asymptotic texture specified in the glTexImage2D function is represented by level_base. Then, level_final = level_base + bias.
[0238] The texture level of the sampled texture pattern calculated above can be used to color and render the picture based on the texture pattern corresponding to the texture level sampling.
[0239] In one possible implementation, the value of the texture level offset parameter in the texture function of the above-mentioned shader is configured through a configuration file. Therefore, the value of the texture level offset parameter can be modified by modifying the configuration file, thereby meeting the needs of different application scenarios and expanding the applicable scenarios of this solution.
[0240] In another possible implementation, different texture level offset parameter values may be used for rendering different objects, thereby optimizing the resolution of each object in the picture in a finer granularity to further improve the resolution of the picture.
[0241] In the above scheme, the texture level offset parameter is introduced by modifying the shader, and a specific texture level offset value is set through a configuration file and assigned to the texture level offset parameter, so as to achieve the purpose of appropriately adjusting the texture level of the sampled texture pattern. Then, a picture with matching quality can be rendered according to the corresponding scene requirements. Exemplarily, the value of the above texture level offset parameter can be positive or negative. If a negative value is taken, it means that when selecting the texture level, a low-level texture is offset, that is, a texture with higher texture precision is taken, and the quality of the rendered picture is improved. If a positive value is taken, it means that when selecting the texture level, a high-level texture is offset, that is, a texture with lower texture precision is taken, and the quality of the rendered picture is reduced.
[0242] In a possible implementation, see for example Figure 6The rendering processing method provided in the embodiment of the present application may further include step 506A. That is, after obtaining a new shader binary file in step 506, or after checking the existence of the modification mark in step 502, it may be determined whether the current rendering is a reduced resolution rendering.
[0243] Exemplarily, the size of the color buffer (colorAttachment) can be used to determine whether it is a reduced resolution rendering. The color buffer is used to store the color data of the rendered screen. If it is a reduced resolution rendering, then the size of the color buffer is small. Therefore, the size of the color buffer can be obtained, and the size of the color buffer can be compared with a preset threshold. If the size of the color buffer is smaller than the threshold, it can be determined that it is a reduced resolution rendering. Conversely, if the size of the color buffer is larger than the threshold, it can be determined that it is not a reduced resolution rendering.
[0244] If the resolution is reduced, the electronic device can perform the operation of step 507, and the value of the texture level offset parameter is a negative value. Figure 6 The operation of 508 in the above step is to first set the value of the texture level offset parameter in the texture function to 0, and then render the image based on the new shader binary file. For example, the process of assigning the texture level offset value set in the configuration file to the texture level offset parameter in the texture function of the new shader through the glUniform1f function can be referred to to achieve the assignment of 0 to the texture level offset parameter in the texture function. This will not be repeated here.
[0245] In the above scheme, in the application scenario of reduced resolution rendering, the texture level offset parameter can be introduced by modifying the shader, and a texture level offset value less than 0 is assigned to the texture level offset parameter to select a low-level texture pattern, that is, to select a texture image with higher precision. Then a better quality picture is rendered to achieve a more detailed rendering effect. In addition, in the application scenario that is not reduced resolution rendering, the level of the sampled texture pattern can no longer be adjusted, and the default texture level or the texture level specified by the above glTexImage2D function can be used to sample the texture pattern. Then a high-definition picture is rendered for display.
[0246] In a possible implementation, after the electronic device modifies the shader in the target application by regular replacement, the modified shader program code can be packaged and sent to other electronic devices for use, so that other electronic devices do not need to perform shader modification operations, saving computing resources.
[0247] In one possible implementation, the above-mentioned picture rendered based on the new shader binary file can be used as input for AI super-resolution rendering. A higher resolution rendering picture can be obtained through the AI super-resolution algorithm. In this scheme, if the texture level offset value less than 0 is assigned to the texture level offset parameter, it is used to select a low-level and high-precision texture pattern, thereby rendering a better quality picture. And using this better quality picture as input for AI super-resolution rendering, the resolution of the rendered picture can be further improved. And it greatly reduces picture distortion, improves the rendering accuracy of object details in the AI super-resolution results, and effectively improves the effect of AI super-resolution rendering.
[0248] In summary, the embodiment of the present application provides a solution for adjusting the texture level of the sampled texture pattern by software, which can be implemented using OpenGL or the relevant interface of OpenGLES. Although Qualcomm has integrated a button for modifying the relevant rendering precision offset in its control panel (Control panel), no relevant interface is open to the outside. Specifically, the GL_TEXTURE_LOD_BIAS parameter is provided in OpenGL, which can be set through the glTexParameterf interface. In addition, in OpenGL ES, the GL_TEXTURE_LOD_BIAS parameter is not in the standard, but exists as an extension, and its extension parameter name corresponds to GL_TEXTURE_LOD_BIAS_EXT. The interfaces of these two parameters are implemented by each hardware manufacturer, but currently Qualcomm or MediaTek (MTK) and other manufacturers have no implementation to support this interface. Even if the subsequent Qualcomm or MTK platform implements an interface similar to glTexParameterf in OpenGL through hardware, when the texture level needs to be modified when rendering an image on the mobile terminal, the hardware can be directly called to modify the texture level. However, the implementation process of its implementation scheme is completely different from that of this scheme.
[0249] An embodiment of the present application also provides an electronic device, which includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the above embodiment.
[0250] An embodiment of the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method described in the above embodiment.
[0251] The embodiments of the present application also provide a computer program product including instructions. When the computer program product is executed on an electronic device, the electronic device executes the method described in the above embodiments.
[0252] An embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on an electronic device, enable the electronic device to execute the method described in the above embodiment.
[0253] It can be understood that the various embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0254] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.
[0255] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0256] In short, the above is only an embodiment of the technical solution of this application, and is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of this application shall be included in the protection scope of this application.
Claims
1. A rendering processing method, characterized in that: The method comprises: Start the target application; A first texture function is called through a first fragment shader of the target application to sample a texture pattern, and a color corresponding to a first texture coordinate in the texture pattern is obtained; the first texture function includes a first parameter, a second parameter and a third parameter, the first parameter is used to call the texture pattern, the second parameter is used to indicate the first texture coordinate, and the third parameter is used to indicate a texture level offset value, and the texture level offset value is used to determine a texture level of the texture pattern; the texture level of the texture pattern is obtained by adding the texture level specified in the glTexImage2D function to the texture level offset value; the texture level offset value is a negative value; The screen of the target application is rendered based on the acquired color.
2. The method according to claim 1, characterized in that The third parameter is a uniform variable; the method further includes: assigning the texture level offset value to the third parameter by uniform parameter transfer.
3. The method according to claim 2, characterized in that The assigning the texture level offset value to the third parameter by uniform parameter transfer includes: The texture level offset value in the configuration file is assigned to the third parameter by uniform parameter transfer.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In response to starting the target application, deleting a binary file of a second fragment shader cached by the target application; During the loading process of the target application, a source program of the second fragment shader is modified to obtain a source program of the first fragment shader.
5. The method according to claim 4, characterized in that The modifying the source program of the second fragment shader comprises: The third parameter is added to a second texture function included in a source program of the second fragment shader to obtain the first texture function; the second texture function includes the first parameter and the second parameter.
6. The method according to claim 4, characterized in that The modifying the source program of the second fragment shader comprises: A declaration of the third parameter is added in the source program of the second fragment shader.
7. The method according to claim 4, characterized in that After modifying the source program of the second fragment shader and obtaining the source program of the first fragment shader, the method further includes: Compile a source program of the first fragment shader to obtain a binary file of the first fragment shader; Save the first fragment shader binary file.
8. The method according to claim 7, characterized in that The step of calling a first texture function to sample a texture pattern through a first fragment shader of the target application includes: The binary file calling the first fragment shader runs the first fragment shader to call the first texture function to sample the texture pattern.
9. The method according to claim 4, characterized in that In response to starting the target application, deleting the binary file of the second fragment shader cached by the target application includes: In response to starting the target application, checking whether there is a modification mark, wherein the modification mark is used to identify that the first fragment shader is modified; If the modification flag does not exist, deleting the binary file of the second fragment shader cached by the target application.
10. The method according to any one of claims 1 to 3, characterized in that: The step of calling a first texture function to sample a texture pattern through a first fragment shader of the target application includes: When the size of the color buffer indicates that the picture is rendered in a reduced-resolution rendering manner, a first texture function is called by a first fragment shader of the target application to sample a texture pattern.
11. The method according to claim 10, characterized in that The texture level offset value is less than zero, and after rendering the screen of the target application based on the acquired color, the method further includes: The obtained rendering images are AI super-resolution rendered through the artificial intelligence AI super-resolution algorithm; The image after AI super-resolution rendering is displayed.
12. An electronic device, characterized in that: include: A touch screen, one or more processors, and one or more memories; the one or more processors are coupled to the touch screen and the one or more memories; the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in any one of claims 1-11.
13. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-11.
14. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 11.
15. A computer program product comprising instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 11.
