WO2025112925A1 - Screen mirroring method, electronic device, storage medium, and program product - Google Patents
Screen mirroring method, electronic device, storage medium, and program product Download PDFInfo
- Publication number
- WO2025112925A1 WO2025112925A1 PCT/CN2024/123814 CN2024123814W WO2025112925A1 WO 2025112925 A1 WO2025112925 A1 WO 2025112925A1 CN 2024123814 W CN2024123814 W CN 2024123814W WO 2025112925 A1 WO2025112925 A1 WO 2025112925A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- bit rate
- rate adjustment
- application
- projected
- content
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/436—Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
- H04N21/4363—Adapting the video stream to a specific local network, e.g. a Bluetooth® network
Definitions
- the present application relates to the field of screen projection technology, and specifically to a screen projection method, electronic device, storage medium and program product.
- the mirroring screen projection function can be used to transmit the content on the mobile phone screen to the large-screen TV for playback through a wireless connection.
- screen projection requires encoding and transmitting a large amount of video stream data, which consumes a lot of power and can easily cause the phone to heat up during the projection process.
- the existing technology monitors the temperature of the mobile phone. If the temperature of the mobile phone is too high during the projection process, the bit rate of the mobile phone projection is reduced to reduce power consumption. However, this will reduce the clarity or smoothness of the projection, thereby reducing the user experience.
- the present application provides a screen projection method, electronic device, storage medium and program product, which can dynamically adjust the bit rate of the projection video without affecting the user's subjective experience as much as possible, so as to improve the user experience.
- a screen projection method including: obtaining a first application type weight, the first application type weight being the application type weight corresponding to the current foreground application; determining whether to perform bit rate adjustment according to a bit rate adjustment parameter, the bit rate adjustment parameter including the first application type weight, and if so, encoding and wirelessly projecting the content to be projected based on a target bit rate, the target bit rate being lower than the original bit rate of the content to be projected; if not, encoding and wirelessly projecting the content to be projected based on the original bit rate.
- the current foreground application corresponds to the scene of the content to be projected. If it is in a relatively stable scene, that is, the continuity of the image is relatively good and the probability of application switching is relatively low, then the weight of the application type corresponding to this application is relatively high; if it is in a scene with a high degree of complexity, then the weight of the application type corresponding to this application is relatively high, because the higher the bit rate, the more complex the scene, and the higher the bit rate, the smaller the impact of reducing the bit rate on the user, that is, the greater the power consumption benefit of bit rate adjustment, so the weight of the application type corresponding to this application is relatively high. According to the higher application type weight, it is easier to determine to adjust the bit rate.
- encoding and wireless projection based on the reduced bit rate can reduce power consumption on the one hand, and have less impact on user perception on the other hand.
- reducing the bit rate has a greater impact on user perception, so it is easier to determine not to adjust the bit rate, that is, to encode and wirelessly project the content to be projected based on the original bit rate.
- the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold value before adjusting the bit rate, but dynamically adjusts the bit rate based on the foreground application type, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of equipment abnormalities due to heat.
- the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
- determining whether to perform rate adjustment according to the rate adjustment parameter includes: if the weight of the first application type is greater than the preset weight, determining to perform rate adjustment; if the weight of the first application type is not greater than the preset weight, determining not to perform rate adjustment.
- the bitrate adjustment parameter also includes the frequency at which the current foreground application switches from the background to the foreground within a preset period of time.
- the frequency at which the current foreground application switches from the background to the foreground within the preset period of time is continuous, and the switching frequency can reflect the next scene. Therefore, dynamically adjusting the projection bitrate in combination with the switching frequency can further improve the user experience.
- determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the frequency.
- the bitrate adjustment parameter further includes a second application type weight, which is an application type weight corresponding to a target application that is switched to a foreground application during a preset period of time, and the target application is an application other than the current foreground application.
- the use can also reflect the scene of the projection screen to a certain extent. Therefore, the projection bit rate can be dynamically adjusted in combination with the weight of the second application type to further improve the user experience.
- determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the above-mentioned frequency.
- encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining a target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected being lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. This can reduce the bit rate while minimizing the adverse impact on user experience.
- the probability of the user switching the foreground application in the next period of time can be predicted. If the probability of the user switching the foreground application next is high, it is more inclined not to adjust the bit rate, because after switching the foreground application, if the bit rate of the foreground application switched to is reduced, it will have a great impact on the user's subjective feelings, which will easily reduce the user experience; if the probability of the user switching the foreground application next is small, it is more inclined to adjust the bit rate, because the bit rate reduction in a stable scenario has a small impact on the user's perception, and the bit rate reduction is not easy to reduce the user experience.
- Dynamic bit rate adjustment is implemented according to the switching frequency of the foreground application, which can improve the user experience while reducing power consumption.
- the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold before adjusting the bit rate, but implements dynamic adjustment of the bit rate based on the switching frequency of the foreground application, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities of the device due to heat.
- determining whether to perform rate adjustment according to the frequency of the current foreground application switching from the background to the foreground within a preset period includes: determining whether to perform rate adjustment according to the frequency of the current foreground application switching from the background to the foreground within the preset period and the second application type weight, the second application type weight being the application type weight corresponding to the target application switched to the foreground application within the preset period, the target application being an application other than the current foreground application. Determining whether to perform rate adjustment in combination with the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
- the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
- determining whether to perform rate adjustment based on the frequency of the current foreground application switching from the background to the foreground within a preset period of time and the weight of the second application type includes: determining a rate adjustment index based on the frequency of the current foreground application switching from the background to the foreground within a preset period of time and the weight of the second application type, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, then determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, then determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the above-mentioned frequency.
- the necessity of rate adjustment represented by the rate adjustment index meeting the adjustment condition may mean that the rate adjustment index belongs to the first range, and the necessity of rate adjustment represented by the rate adjustment index not meeting the adjustment condition may mean that the rate adjustment index belongs
- encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining a target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected being lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. This can reduce the bit rate while minimizing the adverse impact on user experience.
- an embodiment of the present application provides a screen projection method, including: obtaining projected content; determining a predicted bit rate of the content to be projected; determining a target bit rate of the content to be projected based on the predicted bit rate of the content to be projected and a perceived coding distortion curve, wherein the target bit rate of the content to be projected is less than the predicted bit rate; encoding and wirelessly projecting the content to be projected based on the target bit rate.
- the embodiment of the present application can dynamically adjust the bit rate of the screen projection video without affecting the user's subjective experience as much as possible, thereby improving the user experience while reducing power consumption.
- the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold before adjusting the bit rate, but dynamically adjusts the bit rate based on the projected content, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities caused by heat in the device.
- determining the predicted bit rate of the content to be projected includes determining the predicted bit rate of the content to be projected according to the picture complexity of the projected content.
- the ordinate of the perceptual coding distortion curve is the image distortion rate perceived by the human eye
- the abscissa of the perceptual coding distortion curve is the bit rate
- the perceptual coding distortion curve has multiple steps, the width of the steps in the multiple steps is positively correlated with the bit rate, and the height of the steps in the multiple steps is negatively correlated with the bit rate
- determining the target bit rate of the content to be projected according to the predicted bit rate of the content to be projected and the perceptual coding distortion curve includes: determining the step corresponding to the predicted bit rate of the content to be projected in the perceptual coding distortion curve; determining the bit rate on the left side of the predicted bit rate in the corresponding step as the target bit rate of the content to be projected.
- the width of the steps in the multiple steps is positively correlated with the bit rate, that is, under the condition of the same image quality, the higher the complexity of the image in the temporal and spatial domains, the stronger the visual masking effect. Therefore, if the predicted bit rate is large, the bit rate that is reduced by a large amount based on the predicted bit rate can be used as the target bit rate, and it can still be ensured that the human eye cannot perceive the distortion caused by the bit rate reduction.
- the height of the steps is negatively correlated with the bit rate, that is, under the same image quality, the higher the complexity of the image in the temporal and spatial domains, the smaller the impact on human eye perception caused by reducing the bit rate. Dynamically adjusting the bit rate based on the above perceptual coding distortion curve can further improve the user experience.
- determining the predicted bit rate of the content to be projected based on the picture complexity of the projected content includes: determining the target picture complexity of the content to be projected based on the picture complexity of the projected content; determining the predicted bit rate of the content to be projected based on the target picture complexity of the content to be projected.
- the bit rate of the content to be projected can be determined based on the correlation between the picture complexity and the bit rate.
- determining the target screen complexity of the content to be projected according to the screen complexity of the projected content includes: calculating the target screen complexity of the content to be projected according to the following formula: C N+1 is the target screen complexity of the content to be projected, N is the number of frames of the multi-frame projected content, i is the sequence number of the frame in the multi-frame projected content, the value of i is positively correlated with the time series of the multi-frame projected content, W i is the complexity weight coefficient of the i-th frame in the multi-frame projected content, and C i is the screen complexity of the i-th frame in the multi-frame projected content; Wi is positively correlated with i.
- L i is the encoding length corresponding to the projected content of the i-th frame
- QP i is the encoding parameter corresponding to the projected content of the i-th frame.
- determining the predicted bit rate of the content to be projected according to the target screen complexity of the content to be projected includes: calculating the encoding length corresponding to the content to be projected according to the following formula; L N+1 is the encoding length corresponding to the content to be projected, QP N+1 is the encoding parameter corresponding to the content to be projected, qpi is the weight coefficient of the encoding parameter of the i-th frame in the multi-frame projected content, qpi is positively correlated with i , and CN +1 is the target picture complexity of the content to be projected.
- the method further includes: obtaining a first application type weight, the first application type weight being the application type weight corresponding to the current foreground application; determining whether to perform rate adjustment according to a rate adjustment parameter, the rate adjustment parameter including the first application type weight, and if so, executing a process of encoding and wirelessly projecting the content to be projected based on the target rate, and if not, encoding and wirelessly projecting the content to be projected based on the original rate.
- a higher application type weight it is easier to determine to perform rate adjustment.
- encoding and wirelessly projecting based on a dynamically reduced rate can reduce power consumption on the one hand, and have less impact on user perception on the other.
- the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
- determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, and if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, and if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, and the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type.
- the weight of the first application type is positively correlated with the power consumption benefit of reducing the rate in the scenario, and the user experience can be improved by dynamically adjusting the projection bit rate based on the application type.
- the necessity of rate adjustment represented by the rate adjustment index meeting the adjustment condition may mean that the rate adjustment index belongs to the first range, and the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition.
- the condition may be that the bit rate adjustment indicator belongs to the second range.
- the bit rate adjustment parameter also includes the frequency of the current foreground application switching from the background to the foreground within a preset period of time. Determining whether to perform bit rate adjustment in combination with the switching frequency of the foreground application can further improve the user experience.
- the bitrate adjustment parameter further includes a second application type weight, which is an application type weight corresponding to a target application that is switched to a foreground application during a preset period of time, and the target application is an application other than the current foreground application. Determining whether to perform bitrate adjustment in combination with the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
- determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the switching frequency.
- encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining the target resolution of the content to be projected based on the target bit rate of the content to be projected, the target resolution of the content to be projected being lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution.
- the quality of a single pixel is kept unchanged, and the target resolution is determined by reducing the resolution to achieve bit rate adjustment. This method of reducing the bit rate has a small reduction in the quality of the picture displayed by the target device for projection.
- an electronic device comprising: a processor and a memory, wherein the memory is used to store at least one instruction, and when the instruction is loaded and executed by the processor, the electronic device executes the above method.
- a computer-readable storage medium comprising a program or an instruction.
- the program or the instruction runs on a computer, the above method is executed.
- a computer program product includes executable instructions.
- the executable instructions When the executable instructions are executed on a computer, the computer executes the above method.
- FIG1 is a schematic diagram of three screen projection scenarios involved in an embodiment of the present application.
- FIG2 is a schematic diagram of a structure of an electronic device involved in an embodiment of the present application.
- FIG3 is a software structure block diagram of an electronic device in an embodiment of the present application.
- FIG4 is a schematic diagram of a flow chart of a screen projection method in an embodiment of the present application.
- FIG5 is a schematic diagram of a perceptual coding distortion curve in an embodiment of the present application.
- FIG6 is a schematic diagram of a flow chart of another screen projection method in an embodiment of the present application.
- FIG7 is a schematic diagram showing the change of resolution at different stages under three different comparative examples
- FIG8 is a schematic diagram of a resolution coding relationship in an embodiment of the present application.
- FIG9 is a schematic diagram of a temperature rise curve comparing the embodiment of the present application with other methods.
- FIG10 is a schematic diagram of a flow chart of another screen projection method in an embodiment of the present application.
- FIG. 11 is a flow chart of another screen projection method in an embodiment of the present application.
- the embodiments of the present application involve wireless screen projection scenarios, as shown in Figure 1, such as mobile phone screen projection to computer, mobile phone screen projection to TV or mobile phone screen projection to tablet, etc.
- the screen projection here can be mirror screen projection.
- the wireless screen projection scenario involves two electronic devices: the screen projection source device and the screen projection target device.
- FIG. 2 shows a schematic structural diagram of the electronic device 100 .
- the electronic device 100 may include a processor 110 , an external memory interface 120 , an internal memory 121 , a wireless communication module 160 , a display screen 194 , an antenna 1 , and the like.
- the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100.
- the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently.
- the components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
- the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processing unit (neural-network processing unit, NPU), etc.
- different processing units may be independent devices or integrated in one or more processors.
- the processor 110 may be used for functions such as encoding and decoding of audio and video streams.
- the controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
- the processor 110 may also be provided with a memory for storing instructions and data.
- 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.
- the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the wireless communication module 160, the modem processor and the baseband processor.
- the wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), etc. 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 1, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
- the wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 1.
- the wireless communication module 160 includes, for example, a Bluetooth chip.
- 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.
- 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, quantum dot light-emitting diodes (QLED), etc.
- the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
- the electronic device 100 may set a touch sensor on the display screen 194, and the touch sensor and the display screen 194 form a touch screen, also known as a "touch screen".
- the touch sensor is used to detect a touch operation on or near it.
- the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
- the display screen 194 can provide visual information related to the touch operation.
- the touch sensor may also be disposed on the surface of the electronic device 100 , which is different from the location of the display screen 194 .
- the internal memory 121 can be used to store computer executable program codes, which include instructions.
- the internal memory 121 may include a program storage area and a data storage area.
- the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.
- the data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc.
- 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.
- the processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
- 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 Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.
- FIG. 3 is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
- 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.
- 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.
- the application layer can include a series of application packages.
- the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
- the application framework layer provides application programming interface (API) and programming framework for the applications in the application layer.
- API application programming interface
- the application framework layer includes some predefined functions.
- the application framework layer may include a window manager, a content provider, a view system, a resource manager, and the like.
- the resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
- Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system.
- 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.
- 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.
- the system library can 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.
- functional modules such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
- the surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
- 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.
- the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
- a 2D graphics engine is a drawing engine for 2D drawings.
- the kernel layer is the layer between hardware and software.
- the kernel layer contains at least display driver, Bluetooth driver, audio driver, and sensor driver.
- the electronic devices involved in the embodiments of the present application may be smart TVs, mobile phones, tablet computers, personal computers (PCs), personal digital assistants (PDAs), smart watches, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, drone devices, smart cars, smart speakers, robots, smart glasses, and the like.
- PCs personal computers
- PDAs personal digital assistants
- AR augmented reality
- VR virtual reality
- vehicle-mounted devices drone devices, smart cars, smart speakers, robots, smart glasses, and the like.
- the above-mentioned electronic device can be a screen projection source device or a screen projection target device in a wireless screen projection scenario.
- the present application embodiment provides a screen projection method, which is applied to a screen projection source device.
- the screen projection method includes:
- Step 101 performing wireless screen projection
- a wireless connection is established between the screen projection source device and the screen projection target device.
- the projection source device will capture its own display screen, which is the projection content, and encode the projection content, and then send the encoded projection content to the projection target device via a wireless connection.
- the projection target device After receiving the projection content, the projection target device will decode and play the projection content, thus realizing wireless projection.
- the projection source device can encode and wirelessly project the projection content based on the original bit rate.
- Step 102 Obtain the projected content
- the screen projection source device can obtain the screen projection content in the recent period of time, for example, obtain the screen projection content in the last minute.
- Step 103 Determine the predicted bit rate of the content to be projected according to the picture complexity of the projected content
- the projected content is a frame-by-frame image.
- the corresponding complexity can be determined based on any frame image.
- the frame images are continuous, and there is a strong correlation between adjacent or close-in-time frame images.
- the image content is usually similar, so the complexity between images is also relatively close, and usually no mutations occur. Therefore, the bit rate of the content to be projected can be predicted based on the image complexity of the most recently projected content, that is, the predicted bit rate of the content to be projected can be determined.
- determining the predicted bit rate of the content to be projected based on the picture complexity of the projected content is only one implementation method.
- the predicted bit rate of the content to be projected can also be determined by other methods.
- the predicted bit rate of the content to be projected can be determined by the actual bit rate of the projected content.
- the average actual bit rate of the projected content over a period of time is calculated and used as the predicted bit rate of the content to be projected.
- Step 104 determining a target bit rate of the content to be projected according to the predicted bit rate of the content to be projected and the perceptual coding distortion curve, wherein the target bit rate of the content to be projected is less than the predicted bit rate;
- the perceptual coding distortion curve is a curve or mapping relationship pre-set according to the relationship between the image distortion rate and the image bit rate perceived by the human eye.
- the relationship between the statistical coding distortion curve and the perceptual coding distortion curve is illustrated.
- the statistical coding distortion curve refers to the corresponding relationship curve between the image distortion rate and the bit rate in theory. It can be seen that from the perspective of the computer, the correlation between the image distortion rate and the bit rate is expressed as a continuous curve; the perceptual coding distortion curve refers to the corresponding relationship curve between the image distortion rate and the bit rate perceived by the human eye.
- the correlation between the image distortion rate and the bit rate perceived by the human eye is expressed as a discount, that is, the distortion rate perceived by the human eye will be perceived by the human eye only after the distortion of the bit rate accumulates to a certain threshold.
- the perceptual coding distortion curve has multiple steps, and the image bit rate change corresponding to each step will not correspond to the change of the image distortion rate. Only the bit rate change between different steps will cause a sudden change in the image distortion rate.
- step 103 the position of the predicted bit rate of the content to be projected in the perceptual coding distortion curve is determined.
- A is located at the bottom step of the perceptual coding distortion curve. Since all bit rates on this step correspond to the same image distortion rate perceived by the human eye, the bit rate on the left side of A on the step can be set as the target bit rate of the content to be projected. For example, A' is set as the target bit rate of the content to be projected. The smaller the target bit rate A' is, the better the effect of reducing power consumption is.
- the target bit rate A' cannot be equal to or less than the bit rate s1 corresponding to the rising edge on the left side of the step, because on the same platform, the image distortion rate perceived by the human eye remains unchanged, that is, the user will not perceive the distortion caused by the bit rate reduction. Therefore, s1 ⁇ A' ⁇ A, the closer A' is to the bit rate s1 corresponding to the rising edge on the left side of the step, the better the effect of reducing the bit rate is. Assuming that the predicted bit rate of the content to be projected is B in FIG5, and the bit rate corresponding to the rising edge on the left side of the step is s2, the bit rate B' between s2 and B can be set as the target bit rate of the content to be projected.
- Step 105 Encode and wirelessly project the content to be projected based on the target bit rate.
- the target bit rate is less than the predicted bit rate, that is, the bit rate of the content to be projected is reduced.
- the wireless transmission image bit rate is lower, that is, the amount of data transmitted is lower, thereby reducing power consumption.
- the bit rate reduction since the reduction in the target bit rate is determined based on the perceptual coding distortion curve, the bit rate reduction has little impact on human eye perception.
- step 102 may be performed again, that is, in the process of wireless screen projection, steps 102 to 105 are periodically performed.
- the 1st to Nth frames are encoded and wirelessly projected at a default bit rate
- the predicted bit rate of the N+1th frame to be projected is determined based on the complexity of the screen of the projected content of the 1st to Nth frames
- the target bit rate of the N+1th frame is determined according to the predicted bit rate of the N+1th frame
- step 105 the N+1th frame is encoded and wirelessly projected according to the target bit rate.
- the predicted bit rate of the N+2th frame to be projected is determined based on the picture complexity of the projected content from the 2nd to the N+1st frames, and the target bit rate of the N+2th frame is determined, and the N+2th frame is encoded and wirelessly projected according to the target bit rate; and so on, the predicted bit rate of the N+3th frame to be projected is determined based on the picture complexity of the projected content from the 3rd to the N+3rd frames, and the target bit rate of the N+3th frame is determined, and the N+3th frame is encoded and wirelessly projected according to the target bit rate. In this way, the bit rate can be dynamically adjusted based on the projected content during the wireless projection process.
- the screen projection method in the embodiment of the present application obtains the predicted bit rate of the content to be projected based on the projected content, and determines the target bit rate after reducing the bit rate according to the predicted bit rate and the perceived coding distortion curve, and encodes and wirelessly projects the content to be projected based on the target bit rate.
- the predicted bit rate and the perceptual coding distortion curve determine the reduced target bit rate. Therefore, the reduced target bit rate has a lower impact on user perception and reduces power consumption.
- the embodiment of the present application can dynamically adjust the bit rate of the screen projection video without affecting the user's subjective experience as much as possible, thereby improving the user experience while reducing power consumption.
- the ordinate of the perceptual coding distortion curve is the image distortion rate perceived by the human eye
- the abscissa of the perceptual coding distortion curve is the bit rate
- the perceptual coding distortion curve has multiple steps.
- the bit rate that is reduced by a large amount based on the predicted bit rate can be used as the target bit rate, and it can still be ensured that the human eye cannot perceive the distortion caused by the bit rate reduction.
- the height of the steps in the multiple steps is negatively correlated with the bit rate, that is, under the condition of the same image quality, the higher the complexity of the image in the time and space domains, the smaller the impact on human eye perception caused by reducing the bit rate. For example, if the screen projection content is a video, the video and film content are more complex.
- the following is an explanation of a method for determining the bit rate on the left side of the predicted bit rate in the corresponding step as the target bit rate of the content to be projected.
- a positive number less than 1 is set as the target bit rate adjustment coefficient, such as 0.8.
- the predicted bit rate of the content to be projected is directly multiplied by the coefficient 0.8 as the target bit rate.
- the above step 103, determining the predicted bit rate of the content to be projected according to the picture complexity of the projected content includes: step 1031 and step 1032.
- Step 1032 determining the predicted bit rate of the content to be projected according to the target picture complexity of the content to be projected.
- the bit rate of the content to be projected can be determined based on the correlation between the picture complexity and the bit rate. This bit rate is called the predicted bit rate in the embodiment of the present application.
- the above step 1031, determining the target screen complexity of the content to be projected according to the screen complexity of the projected content includes: calculating the target screen complexity of the content to be projected according to the following formula: C N+1 is the target screen complexity of the content to be projected, N is the number of frames of the multi-frame projected content, i is the sequence number of the frame in the multi-frame projected content, the value of i is positively correlated with the time series of the multi-frame projected content, W i is the complexity weight coefficient of the i-th frame in the multi-frame projected content, and C i is the screen complexity of the i-th frame in the multi-frame projected content; Wi is positively correlated with i.
- multiple frames of projected content can be selected from the most recent projected content, and the target screen complexity of the content to be projected is determined based on the screen complexity of the selected multiple frames of projected content.
- the screen complexity of the content to be projected can be determined based on the multiple frames of projected content adjacent to the content to be projected.
- the larger the complexity weight coefficient is set so as to improve the prediction accuracy of the screen complexity of the content to be projected.
- one frame may be selected every one second from the 360 frames of screen projection in the last minute, and 60 frames of the selected frames may be used as the multi-frame screen projection content in step 1031 .
- Li is the encoding length corresponding to the projected content of the i-th frame
- QPi is the encoding parameter corresponding to the projected content of the i-th frame
- QPi is usually a natural number between 0 and 51. The larger the value, the lower the image quality.
- the values corresponding to different frames may be different, but QPi is a known parameter.
- the image complexity of the projected content can be determined by the color distribution of the projected content, and the color distribution may be related to image parameters such as the variance or standard deviation of RGB pixels.
- the image complexity of the projected content is determined by the formula based on Ci as an example.
- the method further includes: step 106, obtaining a first application type weight, the first application type weight being the application type weight corresponding to the current foreground application; step 107, determining whether to perform rate adjustment based on a rate adjustment parameter, the rate adjustment parameter including the first application type weight, if yes, executing step 105, encoding and wirelessly projecting the content to be projected based on the target rate, if no, executing step 108, encoding and wirelessly projecting the content to be projected based on the original rate.
- step 106 may be executed again to determine whether to perform rate adjustment in the next cycle, that is, to implement periodic dynamic rate adjustment.
- step 106 may be executed again to determine whether to perform rate adjustment in the next cycle, that is, to implement periodic dynamic rate adjustment.
- the first application type weight is used to indicate that the current foreground application has the value of bit rate adjustment. The greater the weight, the greater the possibility of determining bit rate adjustment in step 107.
- the current foreground application corresponds to the scene of the content to be projected. If it is in a relatively stable scene, that is, the continuity of the image is relatively good, and the probability of application switching is relatively low, then the application type weight corresponding to this application is relatively high; if it is in a scene with a higher degree of complexity, the first application type weight corresponding to this application is relatively high, because the higher the bit rate, the more complex the scene.
- the higher the bit rate the smaller the impact of reducing the bit rate on the user, that is, the greater the power consumption benefit of bit rate adjustment, so the first application type weight corresponding to this application is relatively high. According to the higher weight of the first application type, it is easier to determine to adjust the bit rate in step 107.
- encoding and wireless projection based on the dynamically reduced bit rate can reduce power consumption on the one hand, and have less impact on user perception on the other hand.
- steps 102 to 105 are executed, that is, the target bit rate is determined after it is determined to adjust the bit rate.
- the embodiment of the present application does not limit the order between steps 102 to 104 and step 107. That is to say, in other possible implementations, the target bit rate can also be determined before determining whether to adjust the bit rate or during the process of determining the bit rate adjustment. As for whether to perform encoding and wireless screen projection based on the target bit rate, it needs to be triggered according to the result determined in step 107.
- the bit rate is related to the resolution, and the bit rate is related to the quality of each pixel, and the bit rate is approximately equal to the resolution ⁇ the quality of each pixel. Therefore, for the adjustment of the bit rate, the resolution can be kept unchanged and the amount of data for each pixel can be reduced, that is, the quality of each pixel can be reduced.
- step 105 includes determining the target quality of each pixel corresponding to the content to be projected based on the target bit rate of the content to be projected, the target quality of each pixel is less than the original quality of each corresponding pixel, the resolution is kept unchanged, and the content to be projected is encoded and wirelessly projected based on the target quality of each pixel and the unchanged resolution. It can be understood that in other possible methods, the quality of each pixel and the resolution can be reduced at the same time, and the content to be projected is encoded and wirelessly projected based on the reduced quality of each pixel and the reduced resolution.
- the above-mentioned step 105 encoding and wirelessly projecting the content to be projected based on the target bit rate, includes: determining the target resolution of the content to be projected based on the target bit rate of the content to be projected, the target resolution of the content to be projected is lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution.
- the resolution of the picture captured by the screen projection source device is relatively high, while when the screen projection target device displays it, the received data will be downsampled and then displayed, so the resolution displayed by the screen projection target device is relatively low.
- the size of the rectangle in Figure 7 represents the resolution, and the larger the rectangle, the higher the resolution.
- Comparative Example 1 the resolution of the picture captured by the screen projection source device is relatively high, and it is encoded, transmitted, and decoded without changing the resolution, but the resolution of the picture displayed by the screen projection target device is relatively low; in Comparative Example 2, the resolution of encoding, transmission, and decoding is lower than the resolution of the captured picture, but the resolution of the picture displayed by the screen projection target device is even lower; in Comparative Example 3, the resolution of encoding, transmission, and decoding is the same as the resolution displayed by the screen projection target device. In this way, for encoding, The power consumption during transmission and decoding is the lowest, but the display effect is the same as the other two comparison ratios.
- the quality of a single pixel is kept unchanged, and the target resolution is determined by reducing the resolution to achieve bit rate adjustment.
- This method of reducing the bit rate has a small reduction in the quality of the picture displayed by the target device. Due to the limitation of encoding, under different encoding parameters QP, the encoding ratio and the resolution ratio have a corresponding relationship, as shown in Table 1 and Figure 8.
- Table 1 is a table of the correspondence between resolution and bit rate
- FIG. 8 is a schematic diagram of the relationship between resolution and bit rate corresponding to Table 1, wherein both bit rate and resolution are expressed as a ratio in percentage form.
- Table 1 and FIG. 8 also illustrate the correspondence between two reference ratios and bit rate ratios, wherein the unilateral ratio refers to the unilateral ratio of pixels, and the correspondence between the pixel area ratio and the bit rate ratio can be equivalently understood as the relationship between the ideal resolution and bit rate, but due to the limitation of encoding, the correspondence between the actual resolution ratio and the bit rate is related to the encoding parameter QP.
- the resolution ratio and bit rate ratio relationship under different encoding parameters QP can be pre-stored in the projection source device.
- the ratio of the reduced target bit rate to the original bit rate that is, the reduced bit rate ratio
- the resolution ratio corresponding to the reduced bit rate ratio can be determined.
- the corresponding target resolution can be determined, and then the content to be projected can be encoded and wirelessly projected based on the target resolution.
- Table 2 shows the temperature test data of electronic devices under three scenarios.
- Figure 9 shows the temperature rise curves of electronic devices under three scenarios corresponding to Table 2. It can be seen that the temperature rises faster in the wireless screen projection scenario than in the local video playback scenario, and the wireless screen projection method of the embodiment of the present application has a slower temperature rise than the wireless screen projection method that does not change the bit rate. In other words, the embodiment of the present application can improve the temperature rise of the screen projection source device caused by screen projection and prolong the temperature rise time.
- the embodiment of the present application further provides a screen projection method, including:
- Step 201 Obtain a first application type weight, where the first application type weight is an application type weight corresponding to the current foreground application;
- Step 202 determine whether to perform bit rate adjustment based on the bit rate adjustment parameters, the bit rate adjustment parameters include the first application type weight. If yes, execute step 203: encode and wirelessly project the content to be projected based on the target bit rate, and the target bit rate is lower than the original bit rate of the content to be projected. If no, execute step 204: encode and wirelessly project the content to be projected based on the original bit rate.
- the executor of the screen projection method can be a screen projection source device
- step 201 can be the same as step 106 in the above embodiment
- step 202 can be the same as step 107
- step 204 can be the same as step 108
- step 203 can be similar to step 105, with the difference that step 203 does not limit the method for determining the target bit rate, and can apply the target bit rate determination method in the above embodiment, or other possible target bit rate determination methods, as long as the target bit rate is lower than the original bit rate.
- the current foreground application corresponds to the scene of the content to be projected. If it is in a relatively stable scene, that is, the continuity of the image is relatively good, and the probability of application switching is relatively low, then the weight of the application type corresponding to this application is relatively high; if it is in a scene with a higher degree of complexity, then the weight of the application type corresponding to this application is relatively high, because the higher the bit rate, the more complex the scene, and the higher the bit rate, the smaller the impact of reducing the bit rate on the user, that is to say, the greater the power consumption benefit of bit rate adjustment, so the weight of the application type corresponding to this application is relatively high.
- bit rate it is easier to determine to adjust the bit rate.
- encoding and wireless projection based on the reduced bit rate can reduce power consumption on the one hand, and have less impact on user perception on the other hand.
- reducing the bit rate has a greater impact on user perception, so it is easier to determine not to adjust the bit rate, that is, to encode and wirelessly project the content to be projected based on the original bit rate.
- the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold value before adjusting the bit rate, but dynamically adjusts the bit rate based on the foreground application type, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of equipment abnormalities due to heat.
- step 107 or step 202 determining whether to perform rate adjustment according to the rate adjustment parameter includes: if the weight of the first application type is greater than the preset weight, determining to perform rate adjustment, and if the weight of the first application type is not greater than the preset weight, determining not to perform rate adjustment. That is, in step 107 or 202, it can be directly determined whether to perform rate adjustment according to the weight of the first application type.
- the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications; the above step 107 or step 202, determining whether to perform bit rate adjustment according to the bit rate adjustment parameter includes: determining a bit rate adjustment index according to the first application type weight, if the necessity of bit rate adjustment represented by the bit rate adjustment index meets the adjustment condition, then determining to perform bit rate adjustment, if the necessity of bit rate adjustment represented by the bit rate adjustment index does not meet the adjustment condition, then determining not to perform bit rate adjustment, the necessity of bit rate adjustment represented by the bit rate adjustment index is positively correlated with the first application type weight.
- the first application type weight is positively correlated with the power consumption benefit of bit rate reduction in the scenario, and the user experience can be improved by dynamically adjusting the projection bit rate based on the application type.
- the rate adjustment index is correlated with the weight of the first application type, for example, the two may be positively correlated.
- the rate adjustment index is greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index satisfies the adjustment condition, then it is determined to perform rate adjustment; if the rate adjustment index is not greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, then it is determined not to perform rate adjustment; the rate adjustment index may be negatively correlated with the weight of the first application type.
- the necessity of rate adjustment represented by the rate adjustment index is not greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, then it is determined to perform rate adjustment; if the rate adjustment index is greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, then it is determined not to perform rate adjustment.
- the frame rate is usually high and highly complex images are prone to appear.
- the frame rate is usually stable at 30, 60 or 120fps, and the front and back correlation of images is relatively large.
- the original power consumption of this type of application when used as the foreground for screen projection is relatively large, and the power consumption benefit of reducing the bit rate is obvious.
- the application type weight corresponding to the video or game application can be set to 1, that is, it has the highest priority in determining whether to adjust the bit rate; for other applications besides videos and games, since the probability of highly complex images appearing is low, a lower application type weight can be set. For other applications, further divisions can be made. For example, a music application will dynamically display lyrics when playing a song, and the frame rate is usually stable at 30 or 60fps. The image complexity is relatively small compared to games or videos, and the bit rate can be reduced.
- the power consumption benefit is medium and relatively stable, so the application type weight corresponding to the music application can be set to 0.5, that is, it has medium priority in determining whether to adjust the bit rate; and for other applications other than music applications, it refers to applications other than video applications, game applications and music applications, such as instant messaging applications or memo applications, etc. Take instant messaging applications as an example.
- the window is static, its frame rate is usually less than 5fps, and the screen projection bit rate is low.
- the instantaneous frame rate may quickly rise to 60 or 120fps.
- the response speed of bit rate reduction is not easy to match the frame rate and bit rate change speed of the application, which is easy to affect the user's subjective feeling due to bit rate reduction.
- the lowest application type weight is set, for example, the application type weight corresponding to other applications other than music applications can be set to 0.
- the first application type weight is positively correlated with the power consumption benefit of bit rate reduction in the scene.
- the bit rate adjustment parameter also includes the frequency of the current foreground application switching from the background to the foreground within a preset time period, that is, in step 107 or 202, it can be determined whether to perform bit rate adjustment based on the first application type weight and the frequency of the current foreground application switching from the background to the foreground within the preset time period.
- the preset time period is a recent period of time, such as the last 1 minute.
- the frequency of the current foreground application switching from the background to the foreground within the preset period of time can represent the user's historical operation behavior, and user operations are usually continuous and relevant. For example, some users are accustomed to switching to instant messaging applications to reply to messages while watching videos, while some users rarely switch applications while watching videos. Therefore, based on the user's historical operation behavior, the probability of the user switching the foreground application in the next period of time can be predicted.
- the probability of the user switching the foreground application next is high, it is more inclined not to adjust the bit rate, because after switching the foreground application, if the bit rate of the foreground application switched to is reduced, it will have a great impact on the user's subjective feelings, which is easy to reduce the user experience; if the probability of the user switching the foreground application next is small, it is more inclined to adjust the bit rate, because the bit rate reduction in a stable scenario has less impact on the user's perception, and the bit rate reduction is not easy to reduce the user experience.
- step 204 is executed for the next 10 minutes without reducing the bit rate, and then step 202 is executed again to determine whether to adjust the bit rate in the next cycle, that is, to achieve periodic dynamic bit rate adjustment;
- step 203 is executed for the next 10 minutes to reduce the bit rate and perform screen projection, and then step 202 is executed again to determine whether to adjust the bit rate in the next cycle, that is, to achieve periodic dynamic bit rate adjustment. Determining whether to adjust the bit rate in combination with the switching frequency of the foreground application can further improve the user experience.
- the bit rate adjustment parameter also includes a second application type weight, where the second application type weight is an application type weight corresponding to a target application that is switched to a foreground application during a preset period of time, and the target application is an application other than the current foreground application.
- the user frequently switches to the instant messaging application to reply to messages while watching videos in the recent period it means that in the next period of time, the user has a greater probability of switching to the instant messaging application to reply to messages while watching videos.
- the instant messaging application and the video application are different in application type, the impact of reducing the bit rate on the user experience is also different. Therefore, the necessity of bit rate adjustment is not only related to the switching frequency, but also to the application type weight corresponding to the target application.
- the corresponding application type weight is large, so it is more inclined to adjust the bit rate; if the target application that the user has switched to in the recent period is, for example, an instant messaging application, the corresponding application type weight is small, so it is more inclined not to adjust the bit rate. Determining whether to adjust the bit rate in combination with the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
- determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the first application type weight and the frequency of the current foreground application switching from the background to the foreground within a preset time period; if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the first application type weight, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the above-mentioned frequency.
- step 107 or 202 determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the first application type weight and the second application type weight, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the first application type weight, and the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the second application type weight.
- step 107 or 202 determining whether to perform bit rate adjustment according to the bit rate adjustment parameter includes: determining the bit rate according to the second application type weight and the frequency of the current foreground application switching from the background to the foreground within a preset period of time Adjustment indicator: if the necessity of rate adjustment represented by the rate adjustment indicator meets the adjustment condition, it is determined to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment indicator does not meet the adjustment condition, it is determined not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment indicator is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment indicator is negatively correlated with the frequency.
- step 107 or 202 determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the first application type weight, the second application type weight, and the frequency of the current foreground application switching from the background to the foreground in a preset period of time; if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, it is determined to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, it is determined not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the first application type weight, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the second application type weight, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the frequency.
- bitrate adjustment index can be set to be positively correlated with the first application type weight and the second application type weight.
- the greater the weight of the application type that has been switched to the foreground application the greater the probability that the bitrate of the next screen projection scene will be higher, and therefore the more inclined to perform bitrate adjustment.
- the higher the switching frequency the lower the stability of the next screen projection scene, and therefore the more inclined not to perform bitrate adjustment. Determining whether to perform bitrate adjustment based on the switching frequency of the foreground application, the application type of the target application switched to, and the application type of the current foreground application can further improve the user experience.
- a ⁇ f/W app2 may be used to indicate an estimated probability of switching to an application type for which bit rate adjustment should not be performed in the next period of time.
- the second scenario is similar to the first scenario, the only difference is that the current for
- f and W app2 can be set to non-zero preset values. Determining the bit rate adjustment index based on this formula can more accurately achieve dynamic adjustment of the bit rate.
- the above step 203, encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining the target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected is lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution.
- the bit rate can be reduced while minimizing the adverse impact on the user experience.
- the embodiment of the present application further provides a screen projection method, including:
- Step 301 determine whether to adjust the bit rate based on the frequency of the current foreground application switching from the background to the foreground within a preset time period. If so, execute step 302, encode and wirelessly project the content to be projected based on the target bit rate, and the target bit rate is lower than the original bit rate of the content to be projected. If it is determined to be no in step 301, execute step 303, encode and wirelessly project the content to be projected based on the original bit rate.
- the executor of the screen projection method can be a screen projection source device
- step 301 can be the same as the above step 107
- step 303 can be the same as the above step 108
- step 302 is similar to the above step 105.
- step 303 does not limit the method for determining the target bit rate.
- the target bit rate determination method in the above embodiment can be applied, and other possible target bit rate determination methods can also be applied, as long as the target bit rate is lower than the original bit rate.
- the screen projection method of the embodiment of the present application can predict the probability of the user switching the foreground application in the next period of time based on the user's historical operation behavior. If the probability of the user switching the foreground application next time is high, it is more inclined not to adjust the bit rate, because after switching the foreground application, if the bit rate of the foreground application switched to is reduced, it will have a great impact on the user's subjective feelings, which is easy to reduce the user experience; if the probability of the user switching the foreground application next time is low, it is more inclined to adjust the bit rate, because the bit rate reduction in a stable scenario has a relatively small impact on the user's perception. Small, the bit rate reduction is not easy to reduce the user experience.
- Dynamic bit rate adjustment can be implemented according to the switching frequency of the foreground application to improve the user experience while reducing power consumption.
- the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to the threshold before adjusting the bit rate, but dynamically adjusts the bit rate based on the switching frequency of the foreground application, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities caused by heat in the device.
- the above step 301, determining whether to adjust the bit rate based on the frequency of the current foreground application switching from the background to the foreground within a preset time period includes: determining whether to adjust the bit rate based on the frequency of the current foreground application switching from the background to the foreground within a preset time period and the second application type weight, the second application type weight being the application type weight corresponding to the target application that is switched to the foreground application within the preset time period, the target application being an application other than the current foreground application.
- the target application that the user has switched to in the recent period is a video application
- its corresponding application type weight is relatively large, and therefore it is more inclined to adjust the bit rate
- the target application that the user has switched to in the recent period is, for example, an instant messaging application
- the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
- determining whether to perform rate adjustment based on the frequency of the current foreground application switching from the background to the foreground within a preset time period and the weight of the second application type includes: determining a rate adjustment index based on the frequency of the current foreground application switching from the background to the foreground within a preset time period and the weight of the second application type; if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the frequency.
- the above step 303, encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining the target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected is lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution.
- the bit rate can be reduced while minimizing the adverse impact on the user experience.
- the embodiment of the present application also provides an electronic device, including: a processor and a memory, the memory is used to store at least one instruction, and when the instruction is loaded and executed by the processor, the electronic device executes the method of any of the above embodiments.
- the specific process and principle of the method are the same as those of the above embodiment, and will not be repeated here.
- the electronic device can be specifically the electronic device shown in Figure 2.
- the electronic devices involved in this application may be smart TVs, mobile phones, tablet computers, personal computers (PCs), personal digital assistants (PDAs), smart watches, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, drone equipment, smart cars, smart speakers, robots, smart glasses, and any other products.
- PCs personal computers
- PDAs personal digital assistants
- AR augmented reality
- VR virtual reality
- An embodiment of the present application further provides a computer-readable storage medium, including a program or an instruction.
- a program or an instruction runs on a computer, the method in any of the above embodiments is executed.
- the embodiments of the present application also provide a computer program product, which includes executable instructions.
- the executable instructions When executed on a computer, the computer executes the method in any of the above embodiments.
- the computer program product includes one or more computer instructions.
- 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.
- 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 integrated.
- 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.
- “at least one” refers to one or more, and “plurality” refers to two or more.
- “And/or” describes the association relationship of associated objects, indicating that three relationships may exist.
- a and/or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural.
- the character “/” generally indicates that the previous and subsequent associated objects are in an "or” relationship.
- “At least one of the following” and similar expressions refer to any combination of these items, including any combination of single or plural items.
- At least one of a, b and c can be represented by: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Transforming Electric Information Into Light Information (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
Description
本申请要求于2023年11月30日提交中国国家知识产权局、申请号为202311654618.5、申请名称为“投屏方法、电子设备、存储介质和程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on November 30, 2023, with application number 202311654618.5 and application name “Screen projection method, electronic device, storage medium and program product”, the entire contents of which are incorporated by reference in this application.
本申请涉及投屏技术领域,具体涉及一种投屏方法、电子设备、存储介质和程序产品。The present application relates to the field of screen projection technology, and specifically to a screen projection method, electronic device, storage medium and program product.
随着电子设备之间交互功能的增加,越来越多的用户使用投屏功能。例如,在用户使用手机播放视频时,可以通过镜像投屏的功能,通过无线连接的方式将手机屏幕上的内容传输至大屏电视上播放。但是,对于手机来说,投屏需要对大量的视频流数据进行编码和传输,功耗较大,投屏过程中容易导致手机发热的问题。为了解决投屏导致的发热问题,现有技术会监测手机温度,在投屏过程中如果手机温度过高,则降低手机投屏的码率,以降低功耗,但是,这样就会降低投屏的清晰度或者流畅性,从而降低用户体验。With the increase of interactive functions between electronic devices, more and more users are using the screen projection function. For example, when a user uses a mobile phone to play a video, the mirroring screen projection function can be used to transmit the content on the mobile phone screen to the large-screen TV for playback through a wireless connection. However, for mobile phones, screen projection requires encoding and transmitting a large amount of video stream data, which consumes a lot of power and can easily cause the phone to heat up during the projection process. In order to solve the heating problem caused by screen projection, the existing technology monitors the temperature of the mobile phone. If the temperature of the mobile phone is too high during the projection process, the bit rate of the mobile phone projection is reduced to reduce power consumption. However, this will reduce the clarity or smoothness of the projection, thereby reducing the user experience.
发明内容Summary of the invention
有鉴于此,本申请提供一种投屏方法、电子设备、存储介质和程序产品,可以在尽量不影响用户主观体验的前提下动态调整投屏视频的码率,以提高用户体验。In view of this, the present application provides a screen projection method, electronic device, storage medium and program product, which can dynamically adjust the bit rate of the projection video without affecting the user's subjective experience as much as possible, so as to improve the user experience.
第一方面,提供一种投屏方法,包括:获取第一应用类型权重,第一应用类型权重为当前的前台应用对应的应用类型权重;根据码率调节参数确定是否进行码率调节,码率调节参数包括第一应用类型权重,若是,则基于目标码率对待投屏内容进行编码和无线投屏,目标码率低于待投屏内容的原始码率,若否,则基于原始码率对待投屏内容进行编码和无线投屏。In a first aspect, a screen projection method is provided, including: obtaining a first application type weight, the first application type weight being the application type weight corresponding to the current foreground application; determining whether to perform bit rate adjustment according to a bit rate adjustment parameter, the bit rate adjustment parameter including the first application type weight, and if so, encoding and wirelessly projecting the content to be projected based on a target bit rate, the target bit rate being lower than the original bit rate of the content to be projected; if not, encoding and wirelessly projecting the content to be projected based on the original bit rate.
当前的前台应用对应待投屏内容的场景,如果在比较稳定的场景,即图像的连续性比较好,且出现应用切换的概率相对较低,则这种应用对应的应用类型权重比较高;如果在复杂程度较高的场景,则这种应用对应的应用类型权重比较高,因为码率越高,则说明场景越复杂,码率越高,则降低码率对于用户的影响越小,也就是说进行码率调节的功耗收益越大,因此这种应用对应的应用类型权重比较高。根据较高的应用类型权重,更容易确定进行码率调节,这种场景下,基于降低后的码率进行编码和无线投屏,一方面可以降低功耗,另一方面对于用户的感知影响较小。而对于某些应用类型,可能存在不稳定或者复杂度较低的场景,在这些场景下降低码率对于用户的感知影响较大,因此更容易确定不进行码率调节,即基于原始码率对待投屏内容进行编码和无线投屏。另外,本申请实施例中的投屏方法并不需要等到温度上升至阈值之后再对码率进行调节,而是基于前台应用类型实现对码率的动态调节,可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间,降低设备由于发热而导致异常的概率。The current foreground application corresponds to the scene of the content to be projected. If it is in a relatively stable scene, that is, the continuity of the image is relatively good and the probability of application switching is relatively low, then the weight of the application type corresponding to this application is relatively high; if it is in a scene with a high degree of complexity, then the weight of the application type corresponding to this application is relatively high, because the higher the bit rate, the more complex the scene, and the higher the bit rate, the smaller the impact of reducing the bit rate on the user, that is, the greater the power consumption benefit of bit rate adjustment, so the weight of the application type corresponding to this application is relatively high. According to the higher application type weight, it is easier to determine to adjust the bit rate. In this scenario, encoding and wireless projection based on the reduced bit rate can reduce power consumption on the one hand, and have less impact on user perception on the other hand. For some application types, there may be unstable or less complex scenes. In these scenarios, reducing the bit rate has a greater impact on user perception, so it is easier to determine not to adjust the bit rate, that is, to encode and wirelessly project the content to be projected based on the original bit rate. In addition, the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold value before adjusting the bit rate, but dynamically adjusts the bit rate based on the foreground application type, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of equipment abnormalities due to heat.
在一种可能的实施方式中,视频或游戏应用对应的应用类型权重>其他应用对应的应用类型权重。In a possible implementation, the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:若第一应用类型权重大于预设权重,则确定进行码率调节,若第一应用类型权重不大于预设权重,则确定不进行码率调节。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: if the weight of the first application type is greater than the preset weight, determining to perform rate adjustment; if the weight of the first application type is not greater than the preset weight, determining not to perform rate adjustment.
在一种可能的实施方式中,码率调节参数还包括当前的前台应用在预设时段内从后台切换至前台的频率。当前的前台应用在预设时段内从后台切换至前台的频率具有连续性,该切换频率可以反映接下来的场景,因此结合切换频率对投屏码率进行动态调节,可以进一步提高用户体验。In a possible implementation, the bitrate adjustment parameter also includes the frequency at which the current foreground application switches from the background to the foreground within a preset period of time. The frequency at which the current foreground application switches from the background to the foreground within the preset period of time is continuous, and the switching frequency can reflect the next scene. Therefore, dynamically adjusting the projection bitrate in combination with the switching frequency can further improve the user experience.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据码率调节参数确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若所率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关,码率调节指标所表征的码率调节必要性与频率负相关。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the frequency.
在一种可能的实施方式中,码率调节参数还包括第二应用类型权重,第二应用类型权重为在预设时段被切换为前台应用的目标应用对应的应用类型权重,目标应用为当前的前台应用之外的应用。目标应 用也可以一定程度反映投屏画面的场景,因此结合第二应用类型权重对投屏码率进行动态调节,可以进一步提高用户体验。In a possible implementation, the bitrate adjustment parameter further includes a second application type weight, which is an application type weight corresponding to a target application that is switched to a foreground application during a preset period of time, and the target application is an application other than the current foreground application. The use can also reflect the scene of the projection screen to a certain extent. Therefore, the projection bit rate can be dynamically adjusted in combination with the weight of the second application type to further improve the user experience.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据码率调节参数确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关,码率调节指标所表征的码率调节必要性与上述频率负相关。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the above-mentioned frequency.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据以下公式确定码率调节指标k:k=Wapp1 2/(a×f/Wapp2),若k大于阈值,则确定进行码率调节,若k不大于阈值,则确定不进行码率调节,Wapp1为第一应用类型权重,f为当前的前台应用在预设时段内从后台切换至前台的频率,Wapp2为第二应用类型权重,a为常数。基于该公式确定码率调节指标,可以更加准确地实现对编码的动态调节。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index k according to the following formula: k = W app1 2 /(a×f/W app2 ), if k is greater than a threshold, it is determined to perform rate adjustment, if k is not greater than the threshold, it is determined not to perform rate adjustment, W app1 is the weight of the first application type, f is the frequency of the current foreground application switching from the background to the foreground within a preset period, W app2 is the weight of the second application type, and a is a constant. Determining the rate adjustment index based on this formula can more accurately achieve dynamic adjustment of encoding.
在一种可能的实施方式中,基于目标码率对待投屏内容进行编码和无线投屏包括:基于目标码率确定待投屏内容的目标分辨率,待投屏内容的目标分辨率低于待投屏内容的原始分辨率;基于目标分辨率对待投屏内容进行编码和无线投屏。可以在降低码率的同时尽量减小对用户体验的不良影响。In a possible implementation, encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining a target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected being lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. This can reduce the bit rate while minimizing the adverse impact on user experience.
第二方面,提供一种投屏方法,包括:根据当前的前台应用在预设时段内从后台切换至前台的频率确定是否进行码率调节,若是,则基于目标码率对待投屏内容进行编码和无线投屏,目标码率低于待投屏内容的原始码率,若否,则基于原始码率对待投屏内容进行编码和无线投屏。In a second aspect, a screen projection method is provided, including: determining whether to perform bit rate adjustment based on the frequency of the current foreground application switching from the background to the foreground within a preset time period; if so, encoding and wirelessly projecting the content to be projected based on a target bit rate, wherein the target bit rate is lower than the original bit rate of the content to be projected; if not, encoding and wirelessly projecting the content to be projected based on the original bit rate.
根据用户的历史操作行为,可以预测接下来一段时间中,用户切换前台应用的概率。如果接下来用户切换前台应用的概率大,则更倾向于不进行码率调节,因为切换前台应用后,如果切换至的前台应用的码率降低对用户的主观感受影响大,则容易降低用户体验;如果接下来用户切换前台应用的概率小,则更倾向于进行码率调节,因为稳定的场景下码率降低对用户的感知影响较小,码率降低不容易降低用户体验。根据前台应用的切换频率实现动态码率调节,可以在降低功耗的同时提高用户体验。另外,本申请实施例中的投屏方法并不需要等到温度上升至阈值之后再对码率进行调节,而是基于前台应用的切换频率实现对码率的动态调节,可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间,降低设备由于发热而导致异常的概率。According to the user's historical operation behavior, the probability of the user switching the foreground application in the next period of time can be predicted. If the probability of the user switching the foreground application next is high, it is more inclined not to adjust the bit rate, because after switching the foreground application, if the bit rate of the foreground application switched to is reduced, it will have a great impact on the user's subjective feelings, which will easily reduce the user experience; if the probability of the user switching the foreground application next is small, it is more inclined to adjust the bit rate, because the bit rate reduction in a stable scenario has a small impact on the user's perception, and the bit rate reduction is not easy to reduce the user experience. Dynamic bit rate adjustment is implemented according to the switching frequency of the foreground application, which can improve the user experience while reducing power consumption. In addition, the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold before adjusting the bit rate, but implements dynamic adjustment of the bit rate based on the switching frequency of the foreground application, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities of the device due to heat.
在一种可能的实施方式中,根据当前的前台应用在预设时段内从后台切换至前台的频率确定是否进行码率调节包括:根据当前的前台应用在预设时段内从后台切换至前台的频率及第二应用类型权重确定是否进行码率调节,第二应用类型权重为在预设时段被切换为前台应用的目标应用对应的应用类型权重,目标应用为当前的前台应用之外的应用。结合前台应用的切换频率和切换至的目标应用的应用类型确定是否进行码率调节,可以进一步提高用户体验。In a possible implementation, determining whether to perform rate adjustment according to the frequency of the current foreground application switching from the background to the foreground within a preset period includes: determining whether to perform rate adjustment according to the frequency of the current foreground application switching from the background to the foreground within the preset period and the second application type weight, the second application type weight being the application type weight corresponding to the target application switched to the foreground application within the preset period, the target application being an application other than the current foreground application. Determining whether to perform rate adjustment in combination with the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
在一种可能的实施方式中,视频或游戏应用对应的应用类型权重>其他应用对应的应用类型权重。In a possible implementation, the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
在一种可能的实施方式中,根据当前的前台应用在预设时段内从后台切换至前台的频率和第二应用类型权重确定是否进行码率调节包括:根据当前的前台应用在预设时段内从后台切换至前台的频率和第二应用类型权重确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关,码率调节指标所表征的码率调节必要性与上述频率负相关。码率调节指标所表征的码率调节必要性满足调节条件可以是指码率调节指标属于第一范围,码率调节指标所表征的码率调节必要性不满足调节条件可以是指码率调节指标属于第二范围。In a possible implementation, determining whether to perform rate adjustment based on the frequency of the current foreground application switching from the background to the foreground within a preset period of time and the weight of the second application type includes: determining a rate adjustment index based on the frequency of the current foreground application switching from the background to the foreground within a preset period of time and the weight of the second application type, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, then determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, then determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the above-mentioned frequency. The necessity of rate adjustment represented by the rate adjustment index meeting the adjustment condition may mean that the rate adjustment index belongs to the first range, and the necessity of rate adjustment represented by the rate adjustment index not meeting the adjustment condition may mean that the rate adjustment index belongs to the second range.
在一种可能的实施方式中,基于目标码率对待投屏内容进行编码和无线投屏包括:基于目标码率确定待投屏内容的目标分辨率,待投屏内容的目标分辨率低于待投屏内容的原始分辨率;基于目标分辨率对待投屏内容进行编码和无线投屏。可以在降低码率的同时尽量减小对用户体验的不良影响。In a possible implementation, encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining a target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected being lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. This can reduce the bit rate while minimizing the adverse impact on user experience.
第三方面,本申请实施例提供一种投屏方法,包括:获取已投屏内容;确定待投屏内容的预测码率;根据待投屏内容的预测码率和感知编码失真曲线确定待投屏内容的目标码率,待投屏内容的目标码率小于预测码率;基于目标码率对待投屏内容进行编码和无线投屏。In a third aspect, an embodiment of the present application provides a screen projection method, including: obtaining projected content; determining a predicted bit rate of the content to be projected; determining a target bit rate of the content to be projected based on the predicted bit rate of the content to be projected and a perceived coding distortion curve, wherein the target bit rate of the content to be projected is less than the predicted bit rate; encoding and wirelessly projecting the content to be projected based on the target bit rate.
确定待投屏内容的预测码率,并根据预测码率和感知编码失真曲线确定降低码率后的目标码率,基于目标码率对待投屏内容进行编码和无线投屏,由于基于预测码率和感知编码失真曲线确定降低后的目 标码率,因此,降低后的目标码率对用户感知的影响较低,同时实现了降低功耗,也就是说,本申请实施例可以在尽量不影响用户主观体验的前提下动态调整投屏视频的码率,在降低功耗的同时提高了用户体验。另外,本申请实施例中的投屏方法并不需要等到温度上升至阈值之后再对码率进行调节,而是基于已投屏内容实现对码率的动态调节,可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间,降低设备由于发热而导致异常的概率。Determine the predicted bit rate of the content to be projected, and determine the target bit rate after reducing the bit rate according to the predicted bit rate and the perceptual coding distortion curve, encode the content to be projected and wirelessly project the screen based on the target bit rate, because the target bit rate after reducing the bit rate is determined based on the predicted bit rate and the perceptual coding distortion curve. The target bit rate is set as the target bit rate. Therefore, the impact of the reduced target bit rate on user perception is relatively low, and power consumption is reduced at the same time. That is to say, the embodiment of the present application can dynamically adjust the bit rate of the screen projection video without affecting the user's subjective experience as much as possible, thereby improving the user experience while reducing power consumption. In addition, the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold before adjusting the bit rate, but dynamically adjusts the bit rate based on the projected content, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities caused by heat in the device.
在一种可能的实施方式中,确定待投屏内容的预测码率包括根据已投屏内容的画面复杂程度确定待投屏内容的预测码率。In a possible implementation, determining the predicted bit rate of the content to be projected includes determining the predicted bit rate of the content to be projected according to the picture complexity of the projected content.
在一种可能的实施方式中,感知编码失真曲线的纵坐标为人眼感知的图像失真率,感知编码失真曲线的横坐标为码率,感知编码失真曲线具有多个台阶,多个台阶中台阶的宽度与码率正相关,多个台阶中台阶的高度与码率负相关;根据待投屏内容的预测码率和感知编码失真曲线确定待投屏内容的目标码率包括:确定待投屏内容的预测码率在感知编码失真曲线中对应的台阶;将对应的台阶中位于预测码率左侧的码率确定为待投屏内容的目标码率。多个台阶中台阶的宽度与码率正相关,即在相同图像质量的情况下,图像时域空域的复杂度越高,视觉掩蔽效应越强,所以说,如果预测码率较大,则可以基于预测码率下调较多的码率作为目标码率,仍可以保证人眼感知不到码率降低带来的失真。多个台阶中台阶的高度与码率负相关,即在相同图像质量的情况下,图像时域空域的复杂度越高,通过降码率的方式造成的对人眼感知的影响越小。基于上述的感知编码失真曲线来动态调节码率,可以进一步提高用户体验。In a possible implementation, the ordinate of the perceptual coding distortion curve is the image distortion rate perceived by the human eye, the abscissa of the perceptual coding distortion curve is the bit rate, the perceptual coding distortion curve has multiple steps, the width of the steps in the multiple steps is positively correlated with the bit rate, and the height of the steps in the multiple steps is negatively correlated with the bit rate; determining the target bit rate of the content to be projected according to the predicted bit rate of the content to be projected and the perceptual coding distortion curve includes: determining the step corresponding to the predicted bit rate of the content to be projected in the perceptual coding distortion curve; determining the bit rate on the left side of the predicted bit rate in the corresponding step as the target bit rate of the content to be projected. The width of the steps in the multiple steps is positively correlated with the bit rate, that is, under the condition of the same image quality, the higher the complexity of the image in the temporal and spatial domains, the stronger the visual masking effect. Therefore, if the predicted bit rate is large, the bit rate that is reduced by a large amount based on the predicted bit rate can be used as the target bit rate, and it can still be ensured that the human eye cannot perceive the distortion caused by the bit rate reduction. The height of the steps is negatively correlated with the bit rate, that is, under the same image quality, the higher the complexity of the image in the temporal and spatial domains, the smaller the impact on human eye perception caused by reducing the bit rate. Dynamically adjusting the bit rate based on the above perceptual coding distortion curve can further improve the user experience.
在一种可能的实施方式中,根据已投屏内容的画面复杂程度确定待投屏内容的预测码率包括:根据已投屏内容的画面复杂程度确定待投屏内容的目标画面复杂程度;根据待投屏内容的目标画面复杂程度确定待投屏内容的预测码率。在相同图像质量的前提下,图像的复杂程度与图像所需的码率之间正相关。在得到待投屏内容的画面复杂程度后,根据画面复杂程度和码率的相关性,即可以确定待投屏内容的码率。In one possible implementation, determining the predicted bit rate of the content to be projected based on the picture complexity of the projected content includes: determining the target picture complexity of the content to be projected based on the picture complexity of the projected content; determining the predicted bit rate of the content to be projected based on the target picture complexity of the content to be projected. Under the premise of the same image quality, there is a positive correlation between the complexity of the image and the bit rate required for the image. After obtaining the picture complexity of the content to be projected, the bit rate of the content to be projected can be determined based on the correlation between the picture complexity and the bit rate.
在一种可能的实施方式中,根据已投屏内容的画面复杂程度确定待投屏内容的目标画面复杂程度包括:根据以下公式计算待投屏内容的目标画面复杂程度:CN+1为待投屏内容的目标画面复杂程度,N为多帧已投屏内容的帧数量,i为多帧已投屏内容中帧的序号,i的取值与多帧已投屏内容的时间序列正相关,Wi为多帧已投屏内容中第i帧的复杂程度权重系数,Ci为多帧已投屏内容中第i帧的画面复杂程度;Wi与i正相关。In a possible implementation, determining the target screen complexity of the content to be projected according to the screen complexity of the projected content includes: calculating the target screen complexity of the content to be projected according to the following formula: C N+1 is the target screen complexity of the content to be projected, N is the number of frames of the multi-frame projected content, i is the sequence number of the frame in the multi-frame projected content, the value of i is positively correlated with the time series of the multi-frame projected content, W i is the complexity weight coefficient of the i-th frame in the multi-frame projected content, and C i is the screen complexity of the i-th frame in the multi-frame projected content; Wi is positively correlated with i.
在一种可能的实施方式中,Li为第i帧已投屏内容对应的编码长度,QPi为第i帧已投屏内容对应的编码参数。In one possible implementation, L i is the encoding length corresponding to the projected content of the i-th frame, and QP i is the encoding parameter corresponding to the projected content of the i-th frame.
在一种可能的实施方式中,根据待投屏内容的目标画面复杂程度确定待投屏内容的预测码率包括:根据以下公式计算待投屏内容对应的编码长度;LN+1为待投屏内容对应的编码长度,QPN+1为待投屏内容对应的编码参数,qpi为多帧已投屏内容中第i帧的编码参数的权重系数,qpi与i正相关,CN+1为待投屏内容的目标画面复杂程度;根据以下公式计算待投屏内容的预测码率:预测码率=LN+1×帧率。In a possible implementation, determining the predicted bit rate of the content to be projected according to the target screen complexity of the content to be projected includes: calculating the encoding length corresponding to the content to be projected according to the following formula; L N+1 is the encoding length corresponding to the content to be projected, QP N+1 is the encoding parameter corresponding to the content to be projected, qpi is the weight coefficient of the encoding parameter of the i-th frame in the multi-frame projected content, qpi is positively correlated with i , and CN +1 is the target picture complexity of the content to be projected. The predicted bit rate of the content to be projected is calculated according to the following formula: predicted bit rate = LN +1 × frame rate.
在一种可能的实施方式中,上述方法还包括:获取第一应用类型权重,第一应用类型权重为当前的前台应用对应的应用类型权重;根据码率调节参数确定是否进行码率调节,码率调节参数包括第一应用类型权重,若是,则执行基于目标码率对待投屏内容进行编码和无线投屏的过程,若否,则基于原始码率对待投屏内容进行编码和无线投屏。根据较高的应用类型权重,更容易确定进行码率调节,这种场景下,基于动态降低后的码率进行编码和无线投屏,一方面可以降低功耗,另一方面对于用户的感知影响较小。而对于某些应用类型,可能存在不稳定或者复杂度较低的场景,在这些场景下降低码率对于用户的感知影响较大,因此更容易确定不进行码率调节,即基于原始码率对待投屏内容进行编码和无线投屏。In a possible implementation, the method further includes: obtaining a first application type weight, the first application type weight being the application type weight corresponding to the current foreground application; determining whether to perform rate adjustment according to a rate adjustment parameter, the rate adjustment parameter including the first application type weight, and if so, executing a process of encoding and wirelessly projecting the content to be projected based on the target rate, and if not, encoding and wirelessly projecting the content to be projected based on the original rate. According to a higher application type weight, it is easier to determine to perform rate adjustment. In this scenario, encoding and wirelessly projecting based on a dynamically reduced rate can reduce power consumption on the one hand, and have less impact on user perception on the other. For some application types, there may be unstable or less complex scenarios. In these scenarios, reducing the rate has a greater impact on user perception, so it is easier to determine not to perform rate adjustment, that is, encoding and wirelessly projecting the content to be projected based on the original rate.
在一种可能的实施方式中,视频或游戏应用对应的应用类型权重>其他应用对应的应用类型权重。In a possible implementation, the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据码率调节参数确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关。第一应用类型权重与场景下进行码率降低的功耗收益正相关,通过基于应用类型对投屏码率的动态调节,可以提高用户体验。码率调节指标所表征的码率调节必要性满足调节条件可以是指码率调节指标属于第一范围,码率调节指标所表征的码率调节必要性不满足调节 条件可以是指码率调节指标属于第二范围。In one possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, and if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, and if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, and the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type. The weight of the first application type is positively correlated with the power consumption benefit of reducing the rate in the scenario, and the user experience can be improved by dynamically adjusting the projection bit rate based on the application type. The necessity of rate adjustment represented by the rate adjustment index meeting the adjustment condition may mean that the rate adjustment index belongs to the first range, and the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition. The condition may be that the bit rate adjustment indicator belongs to the second range.
在一种可能的实施方式中,码率调节参数还包括当前的前台应用在预设时段内从后台切换至前台的频率。结合前台应用的切换频率确定是否进行码率调节,可以进一步提高用户体验。In a possible implementation, the bit rate adjustment parameter also includes the frequency of the current foreground application switching from the background to the foreground within a preset period of time. Determining whether to perform bit rate adjustment in combination with the switching frequency of the foreground application can further improve the user experience.
在一种可能的实施方式中,码率调节参数还包括第二应用类型权重,第二应用类型权重为在预设时段被切换为前台应用的目标应用对应的应用类型权重,目标应用为当前的前台应用之外的应用。结合前台应用的切换频率和切换至的目标应用的应用类型确定是否进行码率调节,可以进一步提高用户体验。In a possible implementation, the bitrate adjustment parameter further includes a second application type weight, which is an application type weight corresponding to a target application that is switched to a foreground application during a preset period of time, and the target application is an application other than the current foreground application. Determining whether to perform bitrate adjustment in combination with the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据码率调节参数确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关,码率调节指标所表征的码率调节必要性与切换频率负相关。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the rate adjustment parameter, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the first application type, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the switching frequency.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据以下公式确定码率调节指标k:k=Wapp1 2/(a×f/Wapp2),若k大于阈值,则确定进行码率调节,若k不大于阈值,则确定不进行码率调节,Wapp1为第一应用类型权重,f为当前的前台应用在预设时段内从后台切换至前台的频率,Wapp2为第二应用类型权重,a为常数。基于该公式确定码率调节指标,可以更加准确地实现对码率的动态调节。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index k according to the following formula: k = W app1 2 /(a×f/W app2 ), if k is greater than a threshold, it is determined to perform rate adjustment, if k is not greater than the threshold, it is determined not to perform rate adjustment, W app1 is the weight of the first application type, f is the frequency of the current foreground application switching from the background to the foreground within a preset period, W app2 is the weight of the second application type, and a is a constant. Determining the rate adjustment index based on this formula can more accurately achieve dynamic adjustment of the rate.
在一种可能的实施方式中,基于目标码率对待投屏内容进行编码和无线投屏包括:基于待投屏内容的目标码率确定待投屏内容的目标分辨率,待投屏内容的目标分辨率低于待投屏内容的原始分辨率;基于目标分辨率对待投屏内容进行编码和无线投屏。保持单像素点质量不变,通过降低分辨率的方式确定目标分辨率,以此来实现码率调节,这种降低码率的方式,对于投屏目标设备所显示的画面质量的降低较小。In a possible implementation, encoding and wirelessly projecting the content to be projected based on the target bit rate includes: determining the target resolution of the content to be projected based on the target bit rate of the content to be projected, the target resolution of the content to be projected being lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. The quality of a single pixel is kept unchanged, and the target resolution is determined by reducing the resolution to achieve bit rate adjustment. This method of reducing the bit rate has a small reduction in the quality of the picture displayed by the target device for projection.
第四方面,提供一种电子设备,包括:处理器和存储器,存储器用于存储至少一条指令,指令由处理器加载并执行时,使得电子设备执行上述的方法。In a fourth aspect, an electronic device is provided, comprising: a processor and a memory, wherein the memory is used to store at least one instruction, and when the instruction is loaded and executed by the processor, the electronic device executes the above method.
第五方面,提供一种计算机可读存储介质,包括程序或指令,当程序或指令在计算机上运行时,上述的方法被执行。In a fifth aspect, a computer-readable storage medium is provided, comprising a program or an instruction. When the program or the instruction runs on a computer, the above method is executed.
第六方面,提供一种计算机程序产品,计算机程序产品包含可执行指令,当可执行指令在计算机上执行时,使得计算机执行上述的方法。According to a sixth aspect, a computer program product is provided. The computer program product includes executable instructions. When the executable instructions are executed on a computer, the computer executes the above method.
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
图1为本申请实施例所涉及的三种投屏场景示意图;FIG1 is a schematic diagram of three screen projection scenarios involved in an embodiment of the present application;
图2为本申请实施例所涉及的一种电子设备的机构示意图;FIG2 is a schematic diagram of a structure of an electronic device involved in an embodiment of the present application;
图3为本申请实施例中电子设备的一种软件结构框图;FIG3 is a software structure block diagram of an electronic device in an embodiment of the present application;
图4为本申请实施例中一种投屏方法的流程示意图;FIG4 is a schematic diagram of a flow chart of a screen projection method in an embodiment of the present application;
图5为本申请实施例中一种感知编码失真曲线的示意图;FIG5 is a schematic diagram of a perceptual coding distortion curve in an embodiment of the present application;
图6为本申请实施例中另一种投屏方法的流程示意图;FIG6 is a schematic diagram of a flow chart of another screen projection method in an embodiment of the present application;
图7为三种不同对比例下分辨率在不同阶段的变化示意图;FIG7 is a schematic diagram showing the change of resolution at different stages under three different comparative examples;
图8为本申请实施例中一种分辨率编码关系示意图;FIG8 is a schematic diagram of a resolution coding relationship in an embodiment of the present application;
图9为本申请实施例与其他方法对比的温升曲线示意图;FIG9 is a schematic diagram of a temperature rise curve comparing the embodiment of the present application with other methods;
图10为本申请实施例中另一种投屏方法的流程示意图;FIG10 is a schematic diagram of a flow chart of another screen projection method in an embodiment of the present application;
图11为本申请实施例中另一种投屏方法的流程示意图。FIG. 11 is a flow chart of another screen projection method in an embodiment of the present application.
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实 施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,甲和/或乙,可以表示:单独存在甲,同时存在甲和乙,单独存在乙这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" used in this article 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 represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character "/" in this article generally indicates that the associated objects before and after are in an "or" relationship.
首先对本申请实施例涉及的应用场景进行说明,本申请实施例涉及无线投屏场景,如图1所示,例如手机向电脑投屏、手机向电视投屏或手机向平板投屏等,这里的投屏可以为镜像投屏。无线投屏场景涉及投屏源设备和投屏目标设备两种电子设备。First, the application scenarios involved in the embodiments of the present application are described. The embodiments of the present application involve wireless screen projection scenarios, as shown in Figure 1, such as mobile phone screen projection to computer, mobile phone screen projection to TV or mobile phone screen projection to tablet, etc. The screen projection here can be mirror screen projection. The wireless screen projection scenario involves two electronic devices: the screen projection source device and the screen projection target device.
图2示出了电子设备100的结构示意图。FIG. 2 shows a schematic structural diagram of the electronic device 100 .
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,无线通信模块160,显示屏194、天线1等。The electronic device 100 may include a processor 110 , an external memory interface 120 , an internal memory 121 , a wireless communication module 160 , a display screen 194 , an antenna 1 , and the like.
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。处理器110可以用于音视频流的编解码等功能。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors. The processor 110 may be used for functions such as encoding and decoding of audio and video streams.
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。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.
电子设备100的无线通信功能可以通过天线1,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the wireless communication module 160, the modem processor and the baseband processor.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线1接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线1转为电磁波辐射出去。无线通信模块160例如包括蓝牙芯片。The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), etc. 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 1, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 1. The wireless communication module 160 includes, for example, a Bluetooth chip.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。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.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。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, quantum dot light-emitting diodes (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.
在一些实施例中,电子设备100可以将触摸传感器设置于显示屏194,由触摸传感器与显示屏194组成触摸屏,也称“触控屏”。触摸传感器用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉 输出。在另一些实施例中,触摸传感器也可以设置于电子设备100的表面,与显示屏194所处的位置不同。In some embodiments, the electronic device 100 may set a touch sensor on the display screen 194, and the touch sensor and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. The display screen 194 can provide visual information related to the touch operation. In some other embodiments, the touch sensor may also be disposed on the surface of the electronic device 100 , which is different from the location of the display screen 194 .
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。The internal memory 121 can be used to store computer executable program codes, which include instructions. 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, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。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. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.
图3是本申请实施例的电子设备100的软件结构框图。FIG. 3 is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。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.
应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.
如图3所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in FIG. 3 , the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
如图3所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,资源管理器等。As shown in FIG. 3 , the application framework layer may include a window manager, a content provider, a view system, a resource manager, and the like.
窗口管理器用于管理窗口程序。内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。The window manager is used to manage window programs. The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。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. The display interface can be composed of one or more views.
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。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.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。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.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library can 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.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。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.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
2D图形引擎是2D绘图的绘图引擎。A 2D graphics engine is a drawing engine for 2D drawings.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,蓝牙驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, Bluetooth driver, audio driver, and sensor driver.
本申请实施例所涉及的电子设备可能为智能电视、手机、平板电脑、个人计算机(personal computer,PC)、个人数字助理(personal digital assistant,PDA)、智能手表、可穿戴电子设备、增强现实技术(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、车载设备、无人机设备、智能汽车、智能音响、机器人、智能眼镜等等任意产品。The electronic devices involved in the embodiments of the present application may be smart TVs, mobile phones, tablet computers, personal computers (PCs), personal digital assistants (PDAs), smart watches, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, drone devices, smart cars, smart speakers, robots, smart glasses, and the like.
上述电子设备可以为无线投屏场景中的投屏源设备或投屏目标设备。The above-mentioned electronic device can be a screen projection source device or a screen projection target device in a wireless screen projection scenario.
本申请实施例提供一种投屏方法,应用于投屏源设备,如图4所示,该投屏方法包括:The present application embodiment provides a screen projection method, which is applied to a screen projection source device. As shown in FIG4 , the screen projection method includes:
步骤101、进行无线投屏;Step 101, performing wireless screen projection;
在进行无线投屏之前,投屏源设备与投屏目标设备之间建立无线连接,在进行无线投屏的过程中, 投屏源设备会捕获自身的显示画面,该显示画面也就是投屏内容,并对投屏内容进行编码,然后通过无线连接将编码后的投屏内容发送至投屏目标设备,投屏目标设备接收到投屏内容后会对该投屏内容进行解码并播放,即实现了无线投屏,在投屏的开始阶段,投屏源设备可以基于原始的码率对投屏内容进行编码和无线投屏。Before wireless screen projection, a wireless connection is established between the screen projection source device and the screen projection target device. The projection source device will capture its own display screen, which is the projection content, and encode the projection content, and then send the encoded projection content to the projection target device via a wireless connection. After receiving the projection content, the projection target device will decode and play the projection content, thus realizing wireless projection. At the beginning of projection, the projection source device can encode and wirelessly project the projection content based on the original bit rate.
步骤102、获取已投屏内容;Step 102: Obtain the projected content;
在投屏过程中,投屏源设备可以获取最近一段时间的已投屏内容,例如获取最近1分钟的已投屏内容。During the screen projection process, the screen projection source device can obtain the screen projection content in the recent period of time, for example, obtain the screen projection content in the last minute.
步骤103、根据已投屏内容的画面复杂程度确定待投屏内容的预测码率;Step 103: Determine the predicted bit rate of the content to be projected according to the picture complexity of the projected content;
已投屏内容是一帧一帧的图像,基于任意一帧图像可以确定其对应的复杂程度,在视频中,帧画面是连续的,相邻或时间接近的帧图像之间具有强相关性,图像内容通常比较相似,因此图像之间的复杂程度也比较接近,通常不会发生突变,因此,可以基于最近已投屏内容的图像复杂程度预测待投屏内容的码率,即确定待投屏内容的预测码率。The projected content is a frame-by-frame image. The corresponding complexity can be determined based on any frame image. In the video, the frame images are continuous, and there is a strong correlation between adjacent or close-in-time frame images. The image content is usually similar, so the complexity between images is also relatively close, and usually no mutations occur. Therefore, the bit rate of the content to be projected can be predicted based on the image complexity of the most recently projected content, that is, the predicted bit rate of the content to be projected can be determined.
可以理解地,根据已投屏内容的画面复杂程度只是确定待投屏内容的预测码率的一种实现方式,在其他可能的实现方式中,也可以通过其他方式来确定待投屏内容的预测码率,例如,可以通过已投屏内容的实际码率来确定待投屏内容的预测码率,例如统计一段时间中已投屏内容的实际码率的平均值,将其作为待投屏内容的预测码率。It can be understood that determining the predicted bit rate of the content to be projected based on the picture complexity of the projected content is only one implementation method. In other possible implementation methods, the predicted bit rate of the content to be projected can also be determined by other methods. For example, the predicted bit rate of the content to be projected can be determined by the actual bit rate of the projected content. For example, the average actual bit rate of the projected content over a period of time is calculated and used as the predicted bit rate of the content to be projected.
步骤104、根据待投屏内容的预测码率和感知编码失真曲线确定待投屏内容的目标码率,待投屏内容的目标码率小于预测码率;Step 104: determining a target bit rate of the content to be projected according to the predicted bit rate of the content to be projected and the perceptual coding distortion curve, wherein the target bit rate of the content to be projected is less than the predicted bit rate;
其中,感知编码失真曲线是根据人眼感知的图像失真率和图像码率之间关系预先设置的曲线或者说是映射关系。例如,如图5所示,其中示意了统计编码失真曲线和感知编码失真曲线之间的关系,统计编码失真曲线是指理论上图像失真率和码率之间的对应关系曲线,可见在计算机的角度,图像失真率与码率的相关性表现为连续的曲线;感知编码失真曲线是指人眼感知的图像失真率和码率之间的对应关系曲线,对于人眼的感知,受到视觉掩蔽效应的影响,人眼感知的图像失真率与码率的相关性表现为折现,也就是说,人眼感知的失真率在码率的失真累计到一定阈值后才会被人眼感知到。也就是说,感知编码失真曲线具有多个台阶,每个台阶对应的图像码率变化不会对应图像失真率的变化,只有在不同台阶之间的码率变化会导致图像失真率的突变。在步骤103中,确定待投屏内容的预测码率在感知编码失真曲线中的位置,假设待投屏内容的预测码率为图5中的A,A位于感知编码失真曲线的最下面一个台阶,由于这个台阶上所有的码率都对应相同的人眼感知的图像失真率,因此可以将该台阶上在A左侧的码率设置为待投屏内容的目标码率,例如设置A’为待投屏内容的目标码率,目标码率A’越小则功耗降低的效果越好,但是目标码率A’不能等于或小于该台阶左侧的上升沿对应的码率s1,因为在同一个平台上,人眼感知的图像失真率不变,即用户不会感知到码率降低带来的失真,所以,s1<A’<A,A’越接近该台阶左侧的上升沿对应的码率s1则降低码率的效果越好。假设待投屏内容的预测码率为图5中的B,其所在台阶的左侧上升沿对应的码率为s2,则可以将s2和B之间的码率B’设置为待投屏内容的目标码率。Among them, the perceptual coding distortion curve is a curve or mapping relationship pre-set according to the relationship between the image distortion rate and the image bit rate perceived by the human eye. For example, as shown in Figure 5, the relationship between the statistical coding distortion curve and the perceptual coding distortion curve is illustrated. The statistical coding distortion curve refers to the corresponding relationship curve between the image distortion rate and the bit rate in theory. It can be seen that from the perspective of the computer, the correlation between the image distortion rate and the bit rate is expressed as a continuous curve; the perceptual coding distortion curve refers to the corresponding relationship curve between the image distortion rate and the bit rate perceived by the human eye. For the perception of the human eye, affected by the visual masking effect, the correlation between the image distortion rate and the bit rate perceived by the human eye is expressed as a discount, that is, the distortion rate perceived by the human eye will be perceived by the human eye only after the distortion of the bit rate accumulates to a certain threshold. In other words, the perceptual coding distortion curve has multiple steps, and the image bit rate change corresponding to each step will not correspond to the change of the image distortion rate. Only the bit rate change between different steps will cause a sudden change in the image distortion rate. In step 103, the position of the predicted bit rate of the content to be projected in the perceptual coding distortion curve is determined. Assuming that the predicted bit rate of the content to be projected is A in FIG5, A is located at the bottom step of the perceptual coding distortion curve. Since all bit rates on this step correspond to the same image distortion rate perceived by the human eye, the bit rate on the left side of A on the step can be set as the target bit rate of the content to be projected. For example, A' is set as the target bit rate of the content to be projected. The smaller the target bit rate A' is, the better the effect of reducing power consumption is. However, the target bit rate A' cannot be equal to or less than the bit rate s1 corresponding to the rising edge on the left side of the step, because on the same platform, the image distortion rate perceived by the human eye remains unchanged, that is, the user will not perceive the distortion caused by the bit rate reduction. Therefore, s1<A'<A, the closer A' is to the bit rate s1 corresponding to the rising edge on the left side of the step, the better the effect of reducing the bit rate is. Assuming that the predicted bit rate of the content to be projected is B in FIG5, and the bit rate corresponding to the rising edge on the left side of the step is s2, the bit rate B' between s2 and B can be set as the target bit rate of the content to be projected.
步骤105、基于目标码率对待投屏内容进行编码和无线投屏。Step 105: Encode and wirelessly project the content to be projected based on the target bit rate.
其中,目标码率小于预测码率,也就是说,降低了待投屏内容的码率,这样,在无线投屏过程中,无线传输的图像码率较低,也就是传输的数据量较低,从而降低了功耗,同时,由于目标码率的降低是基于感知编码失真曲线确定的,因此码率降低对人眼感知的影响较小。Among them, the target bit rate is less than the predicted bit rate, that is, the bit rate of the content to be projected is reduced. In this way, during the wireless screen projection process, the wireless transmission image bit rate is lower, that is, the amount of data transmitted is lower, thereby reducing power consumption. At the same time, since the reduction in the target bit rate is determined based on the perceptual coding distortion curve, the bit rate reduction has little impact on human eye perception.
在步骤105之后,可以再次执行步骤102,也就是说,在无线投屏过程中,周期性执行步骤102至105。以一个具体场景为例进行说明,例如,在一次无线投屏过程中,以默认的码率对第1至N帧画面进行编码和无线投屏,然后,在步骤103中,基于第1至N帧已投屏内容的画面复杂程度确定待投屏的第N+1帧画面的预测码率,在步骤104中,根据第N+1帧画面的预测码率确定第N+1帧画面的目标码率,在步骤105中,根据目标码率对第N+1帧画面进行编码和无线投屏;之后基于第2至N+1帧已投屏内容的画面复杂程度确定待投屏的第N+2帧画面的预测码率,并确定第N+2帧画面的目标码率,根据目标码率对第N+2帧画面进行编码和无线投屏;依次类推,之后基于第3至N+3帧已投屏内容的画面复杂程度确定待投屏的第N+3帧画面的预测码率,并确定第N+3帧画面的目标码率,根据目标码率对第N+3帧画面进行编码和无线投屏。这样,就可以在无线投屏过程中,基于投屏内容动态调整码率。After step 105, step 102 may be performed again, that is, in the process of wireless screen projection, steps 102 to 105 are periodically performed. Take a specific scenario as an example for illustration, for example, in a wireless screen projection process, the 1st to Nth frames are encoded and wirelessly projected at a default bit rate, and then, in step 103, the predicted bit rate of the N+1th frame to be projected is determined based on the complexity of the screen of the projected content of the 1st to Nth frames, in step 104, the target bit rate of the N+1th frame is determined according to the predicted bit rate of the N+1th frame, and in step 105, the N+1th frame is encoded and wirelessly projected according to the target bit rate. ; Then, the predicted bit rate of the N+2th frame to be projected is determined based on the picture complexity of the projected content from the 2nd to the N+1st frames, and the target bit rate of the N+2th frame is determined, and the N+2th frame is encoded and wirelessly projected according to the target bit rate; and so on, the predicted bit rate of the N+3th frame to be projected is determined based on the picture complexity of the projected content from the 3rd to the N+3rd frames, and the target bit rate of the N+3th frame is determined, and the N+3th frame is encoded and wirelessly projected according to the target bit rate. In this way, the bit rate can be dynamically adjusted based on the projected content during the wireless projection process.
本申请实施例中的投屏方法,基于已投屏内容得到待投屏内容的预测码率,并根据预测码率和感知编码失真曲线确定降低码率后的目标码率,基于目标码率对待投屏内容进行编码和无线投屏,由于基于 预测码率和感知编码失真曲线确定降低后的目标码率,因此,降低后的目标码率对用户感知的影响较低,同时实现了降低功耗,也就是说,本申请实施例可以在尽量不影响用户主观体验的前提下动态调整投屏视频的码率,在降低功耗的同时提高了用户体验。另外,本申请实施例中的投屏方法并不需要等到温度上升至阈值之后再对码率进行调节,而是基于已投屏内容实现对码率的动态调节,可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间,降低设备由于发热而导致异常的概率。The screen projection method in the embodiment of the present application obtains the predicted bit rate of the content to be projected based on the projected content, and determines the target bit rate after reducing the bit rate according to the predicted bit rate and the perceived coding distortion curve, and encodes and wirelessly projects the content to be projected based on the target bit rate. The predicted bit rate and the perceptual coding distortion curve determine the reduced target bit rate. Therefore, the reduced target bit rate has a lower impact on user perception and reduces power consumption. In other words, the embodiment of the present application can dynamically adjust the bit rate of the screen projection video without affecting the user's subjective experience as much as possible, thereby improving the user experience while reducing power consumption. In addition, the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold before adjusting the bit rate, but dynamically adjusts the bit rate based on the projected content, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities caused by heat in the device.
在一种可能的实施方式中,如图5所示,感知编码失真曲线的纵坐标为人眼感知的图像失真率,感知编码失真曲线的横坐标为码率,感知编码失真曲线具有多个台阶。上述步骤104、根据待投屏内容的预测码率和感知编码失真曲线确定待投屏内容的目标码率包括:确定待投屏内容的预测码率在所述感知编码失真曲线中对应的台阶;将对应的台阶中位于预测码率左侧的码率确定为待投屏内容的目标码率,对应的台阶中位于预测码率左侧的码率并不包括该台阶左侧的上升沿。其中,多个台阶中台阶的宽度与码率正相关,即在相同图像质量的情况下,图像时域空域的复杂度越高,视觉掩蔽效应越强,所以说,如果预测码率较大,则可以基于预测码率下调较多的码率作为目标码率,仍可以保证人眼感知不到码率降低带来的失真。多个台阶中台阶的高度与码率负相关,即在相同图像质量的情况下,图像时域空域的复杂度越高,通过降码率的方式造成的对人眼感知的影响越小。例如,如果投屏内容是视频,视频影视类内容复杂程度较高,这种场景下,即便码率下调的多一些,用户也不容易感知到画面失真;而如果投屏内容是即时通信应用的聊天界面,聊天界面的复杂程度较低,这种场景下,码率的下调所导致的画面失真容易被用户感知到。因此,基于上述的感知编码失真曲线来动态调节码率,可以进一步提高用户体验。In a possible implementation, as shown in FIG5 , the ordinate of the perceptual coding distortion curve is the image distortion rate perceived by the human eye, the abscissa of the perceptual coding distortion curve is the bit rate, and the perceptual coding distortion curve has multiple steps. The above step 104, determining the target bit rate of the content to be projected according to the predicted bit rate of the content to be projected and the perceptual coding distortion curve, includes: determining the step corresponding to the predicted bit rate of the content to be projected in the perceptual coding distortion curve; determining the bit rate on the left side of the predicted bit rate in the corresponding step as the target bit rate of the content to be projected, and the bit rate on the left side of the predicted bit rate in the corresponding step does not include the rising edge on the left side of the step. Among them, the width of the steps in the multiple steps is positively correlated with the bit rate, that is, under the same image quality, the higher the complexity of the image in the temporal and spatial domains, the stronger the visual masking effect. Therefore, if the predicted bit rate is large, the bit rate that is reduced by a large amount based on the predicted bit rate can be used as the target bit rate, and it can still be ensured that the human eye cannot perceive the distortion caused by the bit rate reduction. The height of the steps in the multiple steps is negatively correlated with the bit rate, that is, under the condition of the same image quality, the higher the complexity of the image in the time and space domains, the smaller the impact on human eye perception caused by reducing the bit rate. For example, if the screen projection content is a video, the video and film content are more complex. In this scenario, even if the bit rate is reduced more, the user is not likely to perceive the picture distortion; and if the screen projection content is the chat interface of an instant messaging application, the chat interface is less complex. In this scenario, the picture distortion caused by the reduction in the bit rate is easily perceived by the user. Therefore, dynamically adjusting the bit rate based on the above-mentioned perceptual coding distortion curve can further improve the user experience.
下面以一种具体例子对将对应的台阶中位于预测码率左侧的码率确定为待投屏内容的目标码率的方式进行说明,例如设置一个小于1的正数作为目标码率调节系数,例如0.8,在确定待投屏内容的目标码率时,直接将待投屏内容的预测码率乘以系数0.8作为目标码率。The following is an explanation of a method for determining the bit rate on the left side of the predicted bit rate in the corresponding step as the target bit rate of the content to be projected. For example, a positive number less than 1 is set as the target bit rate adjustment coefficient, such as 0.8. When determining the target bit rate of the content to be projected, the predicted bit rate of the content to be projected is directly multiplied by the coefficient 0.8 as the target bit rate.
在一种可能的实施方式中,上述步骤103、根据已投屏内容的画面复杂程度确定待投屏内容的预测码率包括:步骤1031和步骤1032。步骤1031、根据已投屏内容的画面复杂程度确定待投屏内容的目标画面复杂程度。例如,在最近1分钟的已投屏内容中,每秒获取一帧图像,获取60帧图像,根据这60帧图像的画面复杂程度预测得到待投屏内容的画面复杂程度;又例如,在最近1秒的已投屏内容中,根据画面显示帧率获取每帧图像,假设帧率为60Hz,则获取最近投屏的连续的60帧图像,根据这60帧图像的画面复杂程度预测得到待投屏内容的画面复杂程度。步骤1032、根据待投屏内容的目标画面复杂程度确定待投屏内容的预测码率。在相同图像质量的前提下,图像的复杂程度与图像所需的码率之间正相关。在得到待投屏内容的画面复杂程度后,根据画面复杂程度和码率的相关性,即可以确定待投屏内容的码率,该码率在本申请实施例中称为预测码率。In a possible implementation, the above step 103, determining the predicted bit rate of the content to be projected according to the picture complexity of the projected content, includes: step 1031 and step 1032. Step 1031, determining the target picture complexity of the content to be projected according to the picture complexity of the projected content. For example, in the projected content of the last minute, one frame of image is acquired per second, and 60 frames of image are acquired. The picture complexity of the content to be projected is predicted based on the picture complexity of these 60 frames of image; for another example, in the projected content of the last second, each frame of image is acquired according to the picture display frame rate. Assuming that the frame rate is 60Hz, 60 consecutive frames of images of the most recent projection are acquired, and the picture complexity of the content to be projected is predicted based on the picture complexity of these 60 frames of image. Step 1032, determining the predicted bit rate of the content to be projected according to the target picture complexity of the content to be projected. Under the premise of the same image quality, there is a positive correlation between the complexity of the image and the bit rate required for the image. After obtaining the picture complexity of the content to be projected, the bit rate of the content to be projected can be determined based on the correlation between the picture complexity and the bit rate. This bit rate is called the predicted bit rate in the embodiment of the present application.
在一种可能的实施方式中,上述步骤1031、根据已投屏内容的画面复杂程度确定待投屏内容的目标画面复杂程度包括:根据以下公式计算待投屏内容的目标画面复杂程度:CN+1为待投屏内容的目标画面复杂程度,N为多帧已投屏内容的帧数量,i为多帧已投屏内容中帧的序号,i的取值与多帧已投屏内容的时间序列正相关,Wi为多帧已投屏内容中第i帧的复杂程度权重系数,Ci为多帧已投屏内容中第i帧的画面复杂程度;Wi与i正相关。In a possible implementation, the above step 1031, determining the target screen complexity of the content to be projected according to the screen complexity of the projected content, includes: calculating the target screen complexity of the content to be projected according to the following formula: C N+1 is the target screen complexity of the content to be projected, N is the number of frames of the multi-frame projected content, i is the sequence number of the frame in the multi-frame projected content, the value of i is positively correlated with the time series of the multi-frame projected content, W i is the complexity weight coefficient of the i-th frame in the multi-frame projected content, and C i is the screen complexity of the i-th frame in the multi-frame projected content; Wi is positively correlated with i.
具体地,多帧已投屏内容可以从最近已投屏内容中选择,基于所选择的多帧已投屏内容的画面复杂程度确定待投屏内容的目标画面复杂程度。在一种实施例中,例如,可以将最近1秒中所有的60帧已投屏内容作为步骤1031中所依据的多帧已投屏内容,N=60,i的取值为1、2、3、…、60,i的取值与多帧已投屏内容的时间序列正相关,也就是说,i的取值越大,则对应60帧中的时间越晚,CN+1和CN可以对应相邻的两帧画面。越靠近待投屏内容的帧画面,与待投屏内容的相关性越高,因此,可以基于与待投屏内容相邻的多帧已投屏内容来确定待投屏内容画面复杂程度,另外基于这个原因,在计算公式中,设置i越大的复杂程度权重系数越大,以提高对待投屏内容的画面复杂程度的预测准确性。在另一种实施例中,例如,可以从最近1分钟的360帧已投屏中每隔1秒选1帧,将其中的60帧作为步骤1031中所依据的多帧已投屏内容。Specifically, multiple frames of projected content can be selected from the most recent projected content, and the target screen complexity of the content to be projected is determined based on the screen complexity of the selected multiple frames of projected content. In one embodiment, for example, all 60 frames of projected content in the last second can be used as the multiple frames of projected content in step 1031, N = 60, i is 1, 2, 3, ..., 60, and the value of i is positively correlated with the time series of the multiple frames of projected content, that is, the larger the value of i, the later the time in the corresponding 60 frames, and CN +1 and CN can correspond to two adjacent frames. The closer the frame is to the content to be projected, the higher the correlation with the content to be projected. Therefore, the screen complexity of the content to be projected can be determined based on the multiple frames of projected content adjacent to the content to be projected. In addition, for this reason, in the calculation formula, the larger the complexity weight coefficient is set, so as to improve the prediction accuracy of the screen complexity of the content to be projected. In another embodiment, for example, one frame may be selected every one second from the 360 frames of screen projection in the last minute, and 60 frames of the selected frames may be used as the multi-frame screen projection content in step 1031 .
在一种可能的实施方式中,Li为第i帧已投屏内容对应的编码长度,QPi为第i帧已投屏内容对应的编码参数,QPi通常为0~51中的自然数,数值越大,图像质量越低,不同帧画面对应的数值可能不同,但是QPi为已知的参数。In one possible implementation, Li is the encoding length corresponding to the projected content of the i-th frame, QPi is the encoding parameter corresponding to the projected content of the i-th frame, QPi is usually a natural number between 0 and 51. The larger the value, the lower the image quality. The values corresponding to different frames may be different, but QPi is a known parameter.
另外,除了通过上述公式来确定已投屏内容的画面复杂程度的方式之外,也可以通过其他方式来确 定已投屏内容的画面复杂程度。例如,可以通过已投屏内容的颜色分布来确定画面复杂程度,颜色分布可能与RGB像素的方差或标准差等画面参数相关。在本申请实施例中,均以基于Ci的公式确定已投屏内容的画面复杂程度为例进行说明。In addition, in addition to using the above formula to determine the complexity of the screen content, other methods can also be used to determine the complexity of the screen content. Determine the image complexity of the projected content. For example, the image complexity can be determined by the color distribution of the projected content, and the color distribution may be related to image parameters such as the variance or standard deviation of RGB pixels. In the embodiments of the present application, the image complexity of the projected content is determined by the formula based on Ci as an example.
在一种可能的实施方式中,上述步骤1032、根据待投屏内容的目标画面复杂程度确定待投屏内容的预测码率包括:根据以下公式计算待投屏内容对应的编码长度;LN+1为待投屏内容对应的编码长度,QPN+1为待投屏内容对应的编码参数,qpi为多帧已投屏内容中第i帧的编码参数的权重系数,qpi与i正相关,CN+1为待投屏内容的目标画面复杂程度;根据以下公式计算待投屏内容的预测码率:预测码率=LN+1×帧率,帧率可以为已投屏内容在投屏源设备上的屏幕数据采集频率。In a possible implementation, the above step 1032, determining the predicted bit rate of the content to be projected according to the target screen complexity of the content to be projected, includes: calculating the encoding length corresponding to the content to be projected according to the following formula; L N+1 is the encoding length corresponding to the content to be projected, QP N+1 is the encoding parameter corresponding to the content to be projected, qpi is the weight coefficient of the encoding parameter of the i-th frame in the multi-frame projected content, qpi is positively correlated with i , C N+1 is the target screen complexity of the content to be projected; the predicted bit rate of the content to be projected is calculated according to the following formula: predicted bit rate = L N+1 × frame rate, where the frame rate can be the screen data acquisition frequency of the projected content on the projection source device.
在一种可能的实施方式中,如图6所示,上述方法还包括:步骤106、获取第一应用类型权重,第一应用类型权重为当前的前台应用对应的应用类型权重;步骤107、根据码率调节参数确定是否进行码率调节,码率调节参数包括第一应用类型权重,若是,则执行步骤105、基于目标码率对待投屏内容进行编码和无线投屏的过程,若否,则执行步骤108、基于原始码率对待投屏内容进行编码和无线投屏。在步骤105之后,可以再次执行步骤106,确定下个周期是否进行码率调节,即实现周期性动态码率调节。在步骤108之后,可以再次执行步骤106,确定下个周期是否进行码率调节,即实现周期性动态码率调节。In a possible implementation, as shown in FIG6 , the method further includes: step 106, obtaining a first application type weight, the first application type weight being the application type weight corresponding to the current foreground application; step 107, determining whether to perform rate adjustment based on a rate adjustment parameter, the rate adjustment parameter including the first application type weight, if yes, executing step 105, encoding and wirelessly projecting the content to be projected based on the target rate, if no, executing step 108, encoding and wirelessly projecting the content to be projected based on the original rate. After step 105, step 106 may be executed again to determine whether to perform rate adjustment in the next cycle, that is, to implement periodic dynamic rate adjustment. After step 108, step 106 may be executed again to determine whether to perform rate adjustment in the next cycle, that is, to implement periodic dynamic rate adjustment.
具体地,可以根据当前的前台应用类型来确定是否降低投屏码率。第一应用类型权重用于表示当前的前台应用具有码率调节的价值,权重越大则在步骤107中确定进行码率调节的可能性越大。当前的前台应用对应待投屏内容的场景,如果在比较稳定的场景,即图像的连续性比较好,且出现应用切换的概率相对较低,则这种应用对应的应用类型权重比较高;如果在复杂程度较高的场景,则这种应用对应的第一应用类型权重比较高,因为码率越高,则说明场景越复杂,根据图5所示可知,码率越高,则降低码率对于用户的影响越小,也就是说进行码率调节的功耗收益越大,因此这种应用对应的第一应用类型权重比较高。根据较高的第一应用类型权重,在步骤107中更容易确定进行码率调节,这种场景下,基于动态降低后的码率进行编码和无线投屏,一方面可以降低功耗,另一方面对于用户的感知影响较小。而对于某些应用类型,可能存在不稳定或者复杂度较低的场景,在这些场景下降低码率对于用户的感知影响较大,因此在步骤107中更容易确定不进行码率调节,即在步骤108中基于原始码率对待投屏内容进行编码和无线投屏。Specifically, it can be determined whether to reduce the screen projection bit rate according to the current foreground application type. The first application type weight is used to indicate that the current foreground application has the value of bit rate adjustment. The greater the weight, the greater the possibility of determining bit rate adjustment in step 107. The current foreground application corresponds to the scene of the content to be projected. If it is in a relatively stable scene, that is, the continuity of the image is relatively good, and the probability of application switching is relatively low, then the application type weight corresponding to this application is relatively high; if it is in a scene with a higher degree of complexity, the first application type weight corresponding to this application is relatively high, because the higher the bit rate, the more complex the scene. As shown in Figure 5, the higher the bit rate, the smaller the impact of reducing the bit rate on the user, that is, the greater the power consumption benefit of bit rate adjustment, so the first application type weight corresponding to this application is relatively high. According to the higher weight of the first application type, it is easier to determine to adjust the bit rate in step 107. In this scenario, encoding and wireless projection based on the dynamically reduced bit rate can reduce power consumption on the one hand, and have less impact on user perception on the other hand. For some types of applications, there may be unstable or less complex scenarios. In these scenarios, reducing the bit rate has a greater impact on user perception. Therefore, it is easier to determine not to adjust the bit rate in step 107, that is, to encode and wirelessly project the content to be projected based on the original bit rate in step 108.
需要说明的是,在图6所示的流程中,当在步骤107中确定是,则执行步骤102至步骤105,即在确定进行码率调节之后再确定目标码率,但是,本申请实施例对于步骤102~104与步骤107之间的顺序不做限定,也就是说,在其他可能的实施方式中,也可以在确定是否进行码率调节之前或者在确定码率调节的过程中确定目标码率,而对于是否基于目标码率来进行编码和无线投屏,则需要根据步骤107所确定的结果来触发。It should be noted that in the process shown in Figure 6, when it is determined to be yes in step 107, steps 102 to 105 are executed, that is, the target bit rate is determined after it is determined to adjust the bit rate. However, the embodiment of the present application does not limit the order between steps 102 to 104 and step 107. That is to say, in other possible implementations, the target bit rate can also be determined before determining whether to adjust the bit rate or during the process of determining the bit rate adjustment. As for whether to perform encoding and wireless screen projection based on the target bit rate, it needs to be triggered according to the result determined in step 107.
在一种可能的实施方式中,码率是与分辨率相关,且码率和每个像素点的质量相关,码率约等于分辨率×每个像素点的质量,因此,对于码率的调整,可以通过分辨率不变,降低每个像素点的数据量,即降低每个像素点的质量的视线,也就是说,步骤105包括基于待投屏内容的目标码率确定待投屏内容对应的每个像素的目标质量,每个像素点的目标质量小于对应的每个像素点的原始质量,保持分辨率不变,基于每个像素点的目标质量和不变的分辨率对待投屏内容进行编码和无线投屏。可以理解地,在其他可能的方式中,也可以同时降低每个像素点的质量和以及降低分辨率,基于降低后的每个像素点的质量和降低后的分辨率对待投屏内容进行编码和无线投屏。In one possible implementation, the bit rate is related to the resolution, and the bit rate is related to the quality of each pixel, and the bit rate is approximately equal to the resolution × the quality of each pixel. Therefore, for the adjustment of the bit rate, the resolution can be kept unchanged and the amount of data for each pixel can be reduced, that is, the quality of each pixel can be reduced. In other words, step 105 includes determining the target quality of each pixel corresponding to the content to be projected based on the target bit rate of the content to be projected, the target quality of each pixel is less than the original quality of each corresponding pixel, the resolution is kept unchanged, and the content to be projected is encoded and wirelessly projected based on the target quality of each pixel and the unchanged resolution. It can be understood that in other possible methods, the quality of each pixel and the resolution can be reduced at the same time, and the content to be projected is encoded and wirelessly projected based on the reduced quality of each pixel and the reduced resolution.
在一种可能的实施方式中,上述步骤105、基于目标码率对待投屏内容进行编码和无线投屏包括:基于待投屏内容的目标码率确定待投屏内容的目标分辨率,待投屏内容的目标分辨率低于待投屏内容的原始分辨率;基于目标分辨率对待投屏内容进行编码和无线投屏。In a possible implementation, the above-mentioned step 105, encoding and wirelessly projecting the content to be projected based on the target bit rate, includes: determining the target resolution of the content to be projected based on the target bit rate of the content to be projected, the target resolution of the content to be projected is lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution.
具体地,大部分的投屏场景下,投屏源设备采集到的画面分辨率较高,而作为投屏目标设备显示时会将接收到的数据进行下采样后送显,因此投屏目标设备显示的分辨率较低。例如,如图7所示,图7中矩形的大小表示分辨率,矩形越大则分辨率越高,在对比例1中,投屏源设备采集的画面分辨率较高,不改变分辨率的情况下进行编码、传输和解码,投屏目标设备显示的画面分辨率却比较低;在对比例2中,编码、传输和解码的分辨率比采集画面的分辨率低,但是最终投屏目标设备显示的画面分辨率更低;在对比例3中,编码、传输和解码的分辨率与投屏目标设备显示的分辨率相同,在这种方式中,对于编码、
传输和解码过程中的功耗最低,但是显示效果其他两个对比例相同。所以说,在本申请实施例中,保持单像素点质量不变,通过降低分辨率的方式确定目标分辨率,以此来实现码率调节,这种降低码率的方式,对于投屏目标设备所显示的画面质量的降低较小。由于编码的限制,在不同的编码参数QP下,编码比率和分辨率比率具有对应关系,如表1和图8所示。
Specifically, in most screen projection scenarios, the resolution of the picture captured by the screen projection source device is relatively high, while when the screen projection target device displays it, the received data will be downsampled and then displayed, so the resolution displayed by the screen projection target device is relatively low. For example, as shown in Figure 7, the size of the rectangle in Figure 7 represents the resolution, and the larger the rectangle, the higher the resolution. In Comparative Example 1, the resolution of the picture captured by the screen projection source device is relatively high, and it is encoded, transmitted, and decoded without changing the resolution, but the resolution of the picture displayed by the screen projection target device is relatively low; in Comparative Example 2, the resolution of encoding, transmission, and decoding is lower than the resolution of the captured picture, but the resolution of the picture displayed by the screen projection target device is even lower; in Comparative Example 3, the resolution of encoding, transmission, and decoding is the same as the resolution displayed by the screen projection target device. In this way, for encoding, The power consumption during transmission and decoding is the lowest, but the display effect is the same as the other two comparison ratios. Therefore, in the embodiment of the present application, the quality of a single pixel is kept unchanged, and the target resolution is determined by reducing the resolution to achieve bit rate adjustment. This method of reducing the bit rate has a small reduction in the quality of the picture displayed by the target device. Due to the limitation of encoding, under different encoding parameters QP, the encoding ratio and the resolution ratio have a corresponding relationship, as shown in Table 1 and Figure 8.
表1为分辨率与码率之间的对应关系表,图8为与表1对应的分辨率与码率关系示意图,其中,码率和分辨率均以百分比形式的比率来表示,表1和图8除了示意分辨率比率与码率比率之间的对应关系外,还示意了两种参考比率与码率比率之间的对应关系,其中,单边比率是指像素单边比率,像素面积比与码率比率的对应关系可以等效理解为理想的分辨率与码率之间的关系,但是由于编码的限制,实际的分辨率比率与码率之间的对应关系与编码参数QP相关。不同编码参数QP下的分辨率比率和码率比率关系可以预先存储在投屏源设备中。在基于待投屏内容的目标码率确定待投屏内容的目标分辨率的过程中,可以确定降低后的目标码率相对于原始码率的比率,即降低后的码率比例,根据当前的编码参数QP对应的分辨率比率和码率比率关系,可以确定降低后的码率比例所对应的分辨率比率,根据该分辨率比率即可以确定对应的目标分辨率,然后可以基于该目标分辨率低待投屏内容进行编码和无线投屏。Table 1 is a table of the correspondence between resolution and bit rate, and FIG. 8 is a schematic diagram of the relationship between resolution and bit rate corresponding to Table 1, wherein both bit rate and resolution are expressed as a ratio in percentage form. In addition to illustrating the correspondence between resolution ratio and bit rate ratio, Table 1 and FIG. 8 also illustrate the correspondence between two reference ratios and bit rate ratios, wherein the unilateral ratio refers to the unilateral ratio of pixels, and the correspondence between the pixel area ratio and the bit rate ratio can be equivalently understood as the relationship between the ideal resolution and bit rate, but due to the limitation of encoding, the correspondence between the actual resolution ratio and the bit rate is related to the encoding parameter QP. The resolution ratio and bit rate ratio relationship under different encoding parameters QP can be pre-stored in the projection source device. In the process of determining the target resolution of the content to be projected based on the target bit rate of the content to be projected, the ratio of the reduced target bit rate to the original bit rate, that is, the reduced bit rate ratio, can be determined. According to the resolution ratio and bit rate ratio relationship corresponding to the current encoding parameter QP, the resolution ratio corresponding to the reduced bit rate ratio can be determined. According to the resolution ratio, the corresponding target resolution can be determined, and then the content to be projected can be encoded and wirelessly projected based on the target resolution.
如表2和图9所示。As shown in Table 2 and Figure 9.
表2
Table 2
表2为三种场景下电子设备的温度测试数据,图9为与表2对应的示意了三种场下电子设备的温升曲线,可以看出,无线投屏场景比本地视频播放场景的温度上升更快,而本申请实施例的无线投屏方法,比不改变码率的无线投屏方法的温度上升更慢,也就是说,本申请实施例可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间。Table 2 shows the temperature test data of electronic devices under three scenarios. Figure 9 shows the temperature rise curves of electronic devices under three scenarios corresponding to Table 2. It can be seen that the temperature rises faster in the wireless screen projection scenario than in the local video playback scenario, and the wireless screen projection method of the embodiment of the present application has a slower temperature rise than the wireless screen projection method that does not change the bit rate. In other words, the embodiment of the present application can improve the temperature rise of the screen projection source device caused by screen projection and prolong the temperature rise time.
如图10所示,本申请实施例还提供一种投屏方法,包括:As shown in FIG10 , the embodiment of the present application further provides a screen projection method, including:
步骤201、获取第一应用类型权重,第一应用类型权重为当前的前台应用对应的应用类型权重;Step 201: Obtain a first application type weight, where the first application type weight is an application type weight corresponding to the current foreground application;
步骤202、根据码率调节参数确定是否进行码率调节,码率调节参数包括第一应用类型权重,若是,则执行步骤203、基于目标码率对待投屏内容进行编码和无线投屏,目标码率低于待投屏内容的原始码率,若否,则执行步骤204、基于原始码率对待投屏内容进行编码和无线投屏。Step 202: determine whether to perform bit rate adjustment based on the bit rate adjustment parameters, the bit rate adjustment parameters include the first application type weight. If yes, execute step 203: encode and wirelessly project the content to be projected based on the target bit rate, and the target bit rate is lower than the original bit rate of the content to be projected. If no, execute step 204: encode and wirelessly project the content to be projected based on the original bit rate.
具体地,该投屏方法的执行主体可以为投屏源设备,步骤201可以与上述实施例中的步骤106相同,步骤202可以与上述步骤107相同,步骤204可以与上述步骤108相同,步骤203可以与上述步骤105类似,区别在于,步骤203并不限制目标码率的确定方式,可以应用上述实施例中的目标码率确定方式,也可以应用其他可能的目标码率确定方式,只要目标码率相对于原始码率降低即可。Specifically, the executor of the screen projection method can be a screen projection source device, step 201 can be the same as step 106 in the above embodiment, step 202 can be the same as step 107, step 204 can be the same as step 108, and step 203 can be similar to step 105, with the difference that step 203 does not limit the method for determining the target bit rate, and can apply the target bit rate determination method in the above embodiment, or other possible target bit rate determination methods, as long as the target bit rate is lower than the original bit rate.
本申请实施例的投屏方法中,当前的前台应用对应待投屏内容的场景,如果在比较稳定的场景,即图像的连续性比较好,且出现应用切换的概率相对较低,则这种应用对应的应用类型权重比较高;如果在复杂程度较高的场景,则这种应用对应的应用类型权重比较高,因为码率越高,则说明场景越复杂,码率越高,则降低码率对于用户的影响越小,也就是说进行码率调节的功耗收益越大,因此这种应用对应的应用类型权重比较高。根据较高的应用类型权重,更容易确定进行码率调节,这种场景下,基于降低后的码率进行编码和无线投屏,一方面可以降低功耗,另一方面对于用户的感知影响较小。而对于某些应用类型,可能存在不稳定或者复杂度较低的场景,在这些场景下降低码率对于用户的感知影响较大,因此更容易确定不进行码率调节,即基于原始码率对待投屏内容进行编码和无线投屏。另外,本申请实施例中的投屏方法并不需要等到温度上升至阈值之后再对码率进行调节,而是基于前台应用类型实现对码率的动态调节,可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间,降低设备由于发热而导致异常的概率。In the screen projection method of the embodiment of the present application, the current foreground application corresponds to the scene of the content to be projected. If it is in a relatively stable scene, that is, the continuity of the image is relatively good, and the probability of application switching is relatively low, then the weight of the application type corresponding to this application is relatively high; if it is in a scene with a higher degree of complexity, then the weight of the application type corresponding to this application is relatively high, because the higher the bit rate, the more complex the scene, and the higher the bit rate, the smaller the impact of reducing the bit rate on the user, that is to say, the greater the power consumption benefit of bit rate adjustment, so the weight of the application type corresponding to this application is relatively high. According to the higher application type weight, it is easier to determine to adjust the bit rate. In this scenario, encoding and wireless projection based on the reduced bit rate can reduce power consumption on the one hand, and have less impact on user perception on the other hand. For some application types, there may be unstable or less complex scenes. In these scenarios, reducing the bit rate has a greater impact on user perception, so it is easier to determine not to adjust the bit rate, that is, to encode and wirelessly project the content to be projected based on the original bit rate. In addition, the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to a threshold value before adjusting the bit rate, but dynamically adjusts the bit rate based on the foreground application type, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of equipment abnormalities due to heat.
在一种可能的实施方式中,如图6和图10所示,步骤107或步骤202、根据码率调节参数确定是否进行码率调节包括:若第一应用类型权重大于预设权重,则确定进行码率调节,若第一应用类型权重不大于预设权重,则确定不进行码率调节。也就是说,在步骤107或202中,可以直接根据第一应用类型权重来确定是否进行码率调节。In a possible implementation, as shown in FIG6 and FIG10, step 107 or step 202, determining whether to perform rate adjustment according to the rate adjustment parameter includes: if the weight of the first application type is greater than the preset weight, determining to perform rate adjustment, and if the weight of the first application type is not greater than the preset weight, determining not to perform rate adjustment. That is, in step 107 or 202, it can be directly determined whether to perform rate adjustment according to the weight of the first application type.
在一种可能的实施方式中,如图6和图10所示,视频或游戏应用对应的应用类型权重>其他应用对应的应用类型权重;上述步骤107或步骤202、根据码率调节参数确定是否进行码率调节包括:根据第一应用类型权重确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关。第一应用类型权重与场景下进行码率降低的功耗收益正相关,通过基于应用类型对投屏码率的动态调节,可以提高用户体验。In one possible implementation, as shown in FIG6 and FIG10, the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications; the above step 107 or step 202, determining whether to perform bit rate adjustment according to the bit rate adjustment parameter includes: determining a bit rate adjustment index according to the first application type weight, if the necessity of bit rate adjustment represented by the bit rate adjustment index meets the adjustment condition, then determining to perform bit rate adjustment, if the necessity of bit rate adjustment represented by the bit rate adjustment index does not meet the adjustment condition, then determining not to perform bit rate adjustment, the necessity of bit rate adjustment represented by the bit rate adjustment index is positively correlated with the first application type weight. The first application type weight is positively correlated with the power consumption benefit of bit rate reduction in the scenario, and the user experience can be improved by dynamically adjusting the projection bit rate based on the application type.
具体地,码率调节指标与第一应用类型权重具有相关性,例如两者之间可以呈正相关,这种情况下,码率调节指标大于调节阈值,即码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标不大于调节阈值,即码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节;码率调节指标与第一应用类型权重之间可以负相关,这种情况下,码率调节指标所表征的码率调节必要性不大于调节阈值,即码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标大于调节阈值,即码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节。对于视频应用和游戏应用,通常帧率高且容易出现高复杂度图像,帧率通常稳定在30、60或120fps,图像前后相关性较大,这一类应用作为前台进行投屏时的原始功耗较大,进行码率降低的功耗收益明显,因此可以设置视频或游戏应用对应的应用类型权重为1,即在确定是否进行码率调节过程中具有最高优先级;对于视频和游戏之外的其他应用,由于出现高复杂图像的概率较低,因此可以设置较低的应用类型权重,对于其他应用,还可以进一步进行划分。例如,音乐应用在播放歌曲时会动态显示歌词,帧率通常稳定在30或60fps,图像复杂程度相对于游戏或视频较小,进行码率降低 的功耗收益中等且较为稳定,因此可以设置音乐应用对应的应用类型权重为0.5,即在确定是否进行码率调节过程中具有中等优先级;而对于音乐应用之外的其他应用,是指视频应用、游戏应用和音乐应用之外的应用,例如包括即时通信应用或备忘录应用等,以即时通信应用为例,在静止窗口时,其帧率通常小于5fps,投屏码率较低,而在进行滑动窗口或刷新具有图片或视频界面的其他功能时,瞬间帧率可能会快速上升至60或120fps,进行码率降低的响应速度不容易匹配该应用的帧率和码率的变化速度,容易由于码率降低影响用户的主观感受,且这类应用整体的码率相对较低,进行码率降低的功耗收益不明显,因此设置最低的应用类型权重,例如可以设置音乐应用之外的其他应用对应的应用类型权重为0。第一应用类型权重与场景下进行码率降低的功耗收益正相关,通过基于应用类型对投屏码率的动态调节,可以提高用户体验。Specifically, the rate adjustment index is correlated with the weight of the first application type, for example, the two may be positively correlated. In this case, the rate adjustment index is greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index satisfies the adjustment condition, then it is determined to perform rate adjustment; if the rate adjustment index is not greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, then it is determined not to perform rate adjustment; the rate adjustment index may be negatively correlated with the weight of the first application type. In this case, the necessity of rate adjustment represented by the rate adjustment index is not greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, then it is determined to perform rate adjustment; if the rate adjustment index is greater than the adjustment threshold, that is, the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, then it is determined not to perform rate adjustment. For video applications and game applications, the frame rate is usually high and highly complex images are prone to appear. The frame rate is usually stable at 30, 60 or 120fps, and the front and back correlation of images is relatively large. The original power consumption of this type of application when used as the foreground for screen projection is relatively large, and the power consumption benefit of reducing the bit rate is obvious. Therefore, the application type weight corresponding to the video or game application can be set to 1, that is, it has the highest priority in determining whether to adjust the bit rate; for other applications besides videos and games, since the probability of highly complex images appearing is low, a lower application type weight can be set. For other applications, further divisions can be made. For example, a music application will dynamically display lyrics when playing a song, and the frame rate is usually stable at 30 or 60fps. The image complexity is relatively small compared to games or videos, and the bit rate can be reduced. The power consumption benefit is medium and relatively stable, so the application type weight corresponding to the music application can be set to 0.5, that is, it has medium priority in determining whether to adjust the bit rate; and for other applications other than music applications, it refers to applications other than video applications, game applications and music applications, such as instant messaging applications or memo applications, etc. Take instant messaging applications as an example. When the window is static, its frame rate is usually less than 5fps, and the screen projection bit rate is low. When sliding the window or refreshing other functions with picture or video interfaces, the instantaneous frame rate may quickly rise to 60 or 120fps. The response speed of bit rate reduction is not easy to match the frame rate and bit rate change speed of the application, which is easy to affect the user's subjective feeling due to bit rate reduction. In addition, the overall bit rate of such applications is relatively low, and the power consumption benefit of bit rate reduction is not obvious. Therefore, the lowest application type weight is set, for example, the application type weight corresponding to other applications other than music applications can be set to 0. The first application type weight is positively correlated with the power consumption benefit of bit rate reduction in the scene. By dynamically adjusting the screen projection bit rate based on the application type, the user experience can be improved.
在一种可能的实施方式中,如图6和图10所示,码率调节参数还包括当前的前台应用在预设时段内从后台切换至前台的频率,也就是说,在步骤107或202中可以根据第一应用类型权重和当前的前台应用在预设时段内从后台切换至前台的频率共同来确定是否进行码率调节。In a possible implementation, as shown in Figures 6 and 10, the bit rate adjustment parameter also includes the frequency of the current foreground application switching from the background to the foreground within a preset time period, that is, in step 107 or 202, it can be determined whether to perform bit rate adjustment based on the first application type weight and the frequency of the current foreground application switching from the background to the foreground within the preset time period.
具体的,预设时段为最近的一段时间,例如最近1分钟。当前的前台应用在预设时段内从后台切换至前台的频率可以表征用户的历史操作行为,而用户操作通常具有连续性和相关性,例如部分用户习惯在观看视频时切换到即时通信应用回复消息,而部分用户在观看视频时很少进行应用切换,因此,根据用户的历史操作行为,可以预测接下来一段时间中,用户切换前台应用的概率。如果接下来用户切换前台应用的概率大,则更倾向于不进行码率调节,因为切换前台应用后,如果切换至的前台应用的码率降低对用户的主观感受影响大,则容易降低用户体验;如果接下来用户切换前台应用的概率小,则更倾向于进行码率调节,因为稳定的场景下码率降低对用户的感知影响较小,码率降低不容易降低用户体验。例如,如果最近一分钟内有前台应用切换,则接下来的10分钟执行步骤204,不进行码率降低,之后再次执行步骤202,确定下个周期是否进行码率调节,即实现周期性动态码率调节;如果最近一分钟内没有前台应用切换,则接下来的10分钟执行步骤203,降低码率并进行投屏,之后再次执行步骤202,确定下个周期是否进行码率调节,即实现周期性动态码率调节。结合前台应用的切换频率确定是否进行码率调节,可以进一步提高用户体验。Specifically, the preset time period is a recent period of time, such as the last 1 minute. The frequency of the current foreground application switching from the background to the foreground within the preset period of time can represent the user's historical operation behavior, and user operations are usually continuous and relevant. For example, some users are accustomed to switching to instant messaging applications to reply to messages while watching videos, while some users rarely switch applications while watching videos. Therefore, based on the user's historical operation behavior, the probability of the user switching the foreground application in the next period of time can be predicted. If the probability of the user switching the foreground application next is high, it is more inclined not to adjust the bit rate, because after switching the foreground application, if the bit rate of the foreground application switched to is reduced, it will have a great impact on the user's subjective feelings, which is easy to reduce the user experience; if the probability of the user switching the foreground application next is small, it is more inclined to adjust the bit rate, because the bit rate reduction in a stable scenario has less impact on the user's perception, and the bit rate reduction is not easy to reduce the user experience. For example, if there is a foreground application switch in the last minute, then step 204 is executed for the next 10 minutes without reducing the bit rate, and then step 202 is executed again to determine whether to adjust the bit rate in the next cycle, that is, to achieve periodic dynamic bit rate adjustment; if there is no foreground application switch in the last minute, then step 203 is executed for the next 10 minutes to reduce the bit rate and perform screen projection, and then step 202 is executed again to determine whether to adjust the bit rate in the next cycle, that is, to achieve periodic dynamic bit rate adjustment. Determining whether to adjust the bit rate in combination with the switching frequency of the foreground application can further improve the user experience.
在一种可能的实施方式中,如图6和图10所示,码率调节参数还包括第二应用类型权重,第二应用类型权重为在预设时段被切换为前台应用的目标应用对应的应用类型权重,目标应用为当前的前台应用之外的应用。In a possible implementation, as shown in FIG6 and FIG10, the bit rate adjustment parameter also includes a second application type weight, where the second application type weight is an application type weight corresponding to a target application that is switched to a foreground application during a preset period of time, and the target application is an application other than the current foreground application.
具体地,如果用户在最近一段时间较频繁地在观看视频时切换至及时通信应用回复消息,则说明在接下来的一段时间,用户有较大的概率在观看视频时切换至即时通信应用回复消息,而即时通信应用与视频应用由于应用类型的不同,降低码率对用户感受的影响也存在差异,因此,码率调节的必要性不仅与切换频率相关,码率调节的必要性还与目标应用对应的应用类型权重相关。例如,如果用户在最近一段时间切换至的目标应用为视频应用,其对应的应用类型权重较大,因此更倾向于进行码率调节;如果用户在最近一段时间切换至的目标应用为例如即时通信应用,其对应的应用类型权重较小,因此更倾向于不进行码率调节。结合前台应用的切换频率和切换至的目标应用的应用类型确定是否进行码率调节,可以进一步提高用户体验。Specifically, if the user frequently switches to the instant messaging application to reply to messages while watching videos in the recent period, it means that in the next period of time, the user has a greater probability of switching to the instant messaging application to reply to messages while watching videos. Since the instant messaging application and the video application are different in application type, the impact of reducing the bit rate on the user experience is also different. Therefore, the necessity of bit rate adjustment is not only related to the switching frequency, but also to the application type weight corresponding to the target application. For example, if the target application that the user has switched to in the recent period is a video application, the corresponding application type weight is large, so it is more inclined to adjust the bit rate; if the target application that the user has switched to in the recent period is, for example, an instant messaging application, the corresponding application type weight is small, so it is more inclined not to adjust the bit rate. Determining whether to adjust the bit rate in combination with the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
在一种可能的实施方式中,如图6和图10所示,步骤107或202、根据码率调节参数确定是否进行码率调节包括:根据第一应用类型权重和当前的前台应用在预设时段内从后台切换至前台的频率确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关,码率调节指标所表征的码率调节必要性与上述频率负相关。In a possible implementation, as shown in FIG6 and FIG10, step 107 or 202, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the first application type weight and the frequency of the current foreground application switching from the background to the foreground within a preset time period; if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the first application type weight, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the above-mentioned frequency.
在一种可能的实施方式中,如图6和图10所示,步骤107或202、根据码率调节参数确定是否进行码率调节包括:根据第一应用类型权重和第二应用类型权重确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关。In a possible implementation, as shown in FIG6 and FIG10, step 107 or 202, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the first application type weight and the second application type weight, if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment, if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the first application type weight, and the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the second application type weight.
在一种可能的实施方式中,如图6和图10所示,步骤107或202、根据码率调节参数确定是否进行码率调节包括:根据第二应用类型权重和当前的前台应用在预设时段内从后台切换至前台的频率确定码率 调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关,码率调节指标所表征的码率调节必要性与频率负相关。In a possible implementation, as shown in FIG. 6 and FIG. 10, step 107 or 202, determining whether to perform bit rate adjustment according to the bit rate adjustment parameter includes: determining the bit rate according to the second application type weight and the frequency of the current foreground application switching from the background to the foreground within a preset period of time Adjustment indicator: if the necessity of rate adjustment represented by the rate adjustment indicator meets the adjustment condition, it is determined to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment indicator does not meet the adjustment condition, it is determined not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment indicator is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment indicator is negatively correlated with the frequency.
在一种可能的实施方式中,如图6和图10所示,步骤107或202、根据码率调节参数确定是否进行码率调节包括:根据第一应用类型权重、第二应用类型权重和当前的前台应用在预设时段从后台切换至前台的频率确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第一应用类型权重正相关,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关,码率调节指标所表征的码率调节必要性与频率负相关。In a possible implementation, as shown in FIG6 and FIG10, step 107 or 202, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index according to the first application type weight, the second application type weight, and the frequency of the current foreground application switching from the background to the foreground in a preset period of time; if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, it is determined to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, it is determined not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the first application type weight, the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the second application type weight, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the frequency.
具体地,不论是当前的前台应用还是最近曾切换过的目标应用,都有可能是接下来的投屏内容所对应的应用,两者都能够反映接下来的投屏场景,因此可以设置码率调节指标所表征的码率调节必要性与第一应用类型权重以及第二应用类型权重正相关,也就是说,曾切换为前台应用的应用类型权重越大,则接下来的投屏场景的码率较高的概率越大,因此越倾向于进行码率调节。而切换频率越高,则说明接下来的投屏场景的稳定性越低,因此越倾向于不进行码率调节。结合前台应用的切换频率、切换至的目标应用的应用类型以及当前的前台应用的应用类型确定是否进行码率调节,可以进一步提高用户体验。Specifically, whether it is the current foreground application or the target application that has been switched recently, it may be the application corresponding to the next screen projection content. Both can reflect the next screen projection scene. Therefore, the necessity of bitrate adjustment represented by the bitrate adjustment index can be set to be positively correlated with the first application type weight and the second application type weight. In other words, the greater the weight of the application type that has been switched to the foreground application, the greater the probability that the bitrate of the next screen projection scene will be higher, and therefore the more inclined to perform bitrate adjustment. The higher the switching frequency, the lower the stability of the next screen projection scene, and therefore the more inclined not to perform bitrate adjustment. Determining whether to perform bitrate adjustment based on the switching frequency of the foreground application, the application type of the target application switched to, and the application type of the current foreground application can further improve the user experience.
在一种可能的实施方式中,根据码率调节参数确定是否进行码率调节包括:根据以下公式确定码率调节指标k:k=Wapp1 2/(a×f/Wapp2),若k大于阈值,则确定进行码率调节,若k不大于阈值,则确定不进行码率调节,Wapp1为第一应用类型权重,f为当前的前台应用在预设时段内从后台切换至前台的频率,Wapp2为第二应用类型权重,a为常数。基于该公式确定码率调节指标,可以更加准确地实现对编码的动态调节。In a possible implementation, determining whether to perform rate adjustment according to the rate adjustment parameter includes: determining a rate adjustment index k according to the following formula: k = W app1 2 /(a×f/W app2 ), if k is greater than a threshold, it is determined to perform rate adjustment, if k is not greater than the threshold, it is determined not to perform rate adjustment, W app1 is the weight of the first application type, f is the frequency of the current foreground application switching from the background to the foreground within a preset period, W app2 is the weight of the second application type, and a is a constant. Determining the rate adjustment index based on this formula can more accurately achieve dynamic adjustment of encoding.
具体地,a×f/Wapp2可以用来表示预估在接下来一段时间内,切换至不应进行码率调节的应用类型的概率。假设在第一种场景下,当前的前台应用为游戏应用,其对应的应用类型权重Wapp1=1,用户在最近1分钟切换至音乐应用1次,1分钟1次的切换频率例如设置为f=1,音乐应用即为目标应用,其对应的应用类型权重Wapp2=0.5;假设第二种场景与第一种场景类似,区别仅在于用户在最近1分钟切换至音乐应用5次,1分钟5次的切换频率例如设置为f=5,则相对于第一种场景,第二种场景中切换频率较大,因此码率调节指标k较小,更不容易大于阈值,即更不容易进行码率调节;假设第二种场景与第一种场景类似,区别仅在于当前的前台应用为即时通信应用,其对应的应用类型权重Wapp1=0,码率调节指标k=0,阈值为正数,k必然小于阈值,因此不进行码率调节;假设第二种场景与第一种场景类似,区别仅在于目标应用为即时通信应用,其对应的应用类型权重Wapp2=0,码率调节指标k=0,阈值为正数,k必然小于阈值,因此不进行码率调节。为了保证计算正常进行,如果在预设时段内的没有切换,可以设置f和Wapp2为非0的预设值。基于该公式确定码率调节指标,可以更加准确地实现对码率的动态调节。Specifically, a×f/W app2 may be used to indicate an estimated probability of switching to an application type for which bit rate adjustment should not be performed in the next period of time. Assume that in the first scenario, the current foreground application is a game application, and its corresponding application type weight W app1 =1, the user switches to the music application once in the last minute, and the switching frequency of once in 1 minute is set to f=1, for example, the music application is the target application, and its corresponding application type weight W app2 =0.5; Assume that the second scenario is similar to the first scenario, the only difference is that the user switches to the music application 5 times in the last minute, and the switching frequency of 5 times in 1 minute is set to f=5, for example, then relative to the first scenario, the switching frequency in the second scenario is larger, so the bit rate adjustment index k is smaller, and it is less likely to be greater than the threshold, that is, it is less likely to perform bit rate adjustment; Assume that the second scenario is similar to the first scenario, the only difference is that the current foreground application is an instant messaging application, and its corresponding application type weight W app1 =0, the bit rate adjustment index k=0, the threshold is a positive number, k must be less than the threshold, so no bit rate adjustment is performed; Assume that the second scenario is similar to the first scenario, the only difference is that the target application is an instant messaging application, and its corresponding application type weight W app2 =0, the bit rate adjustment index k=0, the threshold is a positive number, k must be less than the threshold, so the bit rate adjustment is not performed. In order to ensure that the calculation is performed normally, if there is no switching within the preset period, f and W app2 can be set to non-zero preset values. Determining the bit rate adjustment index based on this formula can more accurately achieve dynamic adjustment of the bit rate.
在一种可能的实施方式中,上述步骤203、基于目标码率对待投屏内容进行编码和无线投屏包括:基于目标码率确定待投屏内容的目标分辨率,待投屏内容的目标分辨率低于待投屏内容的原始分辨率;基于目标分辨率对待投屏内容进行编码和无线投屏。可以在降低码率的同时尽量减小对用户体验的不良影响,具体过程和原理与上述实施例中步骤105的相关内容相同,在此不再赘述。In a possible implementation, the above step 203, encoding and wirelessly projecting the content to be projected based on the target bit rate, includes: determining the target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected is lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. The bit rate can be reduced while minimizing the adverse impact on the user experience. The specific process and principle are the same as the relevant content of step 105 in the above embodiment, and will not be repeated here.
如图11所示,本申请实施例还提供一种投屏方法,包括:As shown in FIG11 , the embodiment of the present application further provides a screen projection method, including:
步骤301、根据当前的前台应用在预设时段内从后台切换至前台的频率确定是否进行码率调节,若是,则执行步骤302、基于目标码率对待投屏内容进行编码和无线投屏,目标码率低于待投屏内容的原始码率,若在步骤301中确定为否,则执行步骤303、基于原始码率对待投屏内容进行编码和无线投屏。Step 301, determine whether to adjust the bit rate based on the frequency of the current foreground application switching from the background to the foreground within a preset time period. If so, execute step 302, encode and wirelessly project the content to be projected based on the target bit rate, and the target bit rate is lower than the original bit rate of the content to be projected. If it is determined to be no in step 301, execute step 303, encode and wirelessly project the content to be projected based on the original bit rate.
具体地,该投屏方法的执行主体可以为投屏源设备,步骤301可以与上述步骤107相同,步骤303可以与上述步骤108相同,步骤302与上述步骤105类似,区别在于,步骤303中并不限制目标码率的确定方式,可以应用上述实施例中的目标码率确定方式,也可以应用其他可能的目标码率确定方式,只要目标码率相对于原始码率降低即可。Specifically, the executor of the screen projection method can be a screen projection source device, step 301 can be the same as the above step 107, step 303 can be the same as the above step 108, and step 302 is similar to the above step 105. The difference is that step 303 does not limit the method for determining the target bit rate. The target bit rate determination method in the above embodiment can be applied, and other possible target bit rate determination methods can also be applied, as long as the target bit rate is lower than the original bit rate.
本申请实施例的投屏方法,根据用户的历史操作行为,可以预测接下来一段时间中,用户切换前台应用的概率。如果接下来用户切换前台应用的概率大,则更倾向于不进行码率调节,因为切换前台应用后,如果切换至的前台应用的码率降低对用户的主观感受影响大,则容易降低用户体验;如果接下来用户切换前台应用的概率小,则更倾向于进行码率调节,因为稳定的场景下码率降低对用户的感知影响较 小,码率降低不容易降低用户体验。根据前台应用的切换频率实现动态码率调节,可以在降低功耗的同时提高用户体验。另外,本申请实施例中的投屏方法并不需要等到温度上升至阈值之后再对码率进行调节,而是基于前台应用的切换频率实现对码率的动态调节,可以改善投屏源设备由于投屏而导致的温度上升,延长温度上升的时间,降低设备由于发热而导致异常的概率。The screen projection method of the embodiment of the present application can predict the probability of the user switching the foreground application in the next period of time based on the user's historical operation behavior. If the probability of the user switching the foreground application next time is high, it is more inclined not to adjust the bit rate, because after switching the foreground application, if the bit rate of the foreground application switched to is reduced, it will have a great impact on the user's subjective feelings, which is easy to reduce the user experience; if the probability of the user switching the foreground application next time is low, it is more inclined to adjust the bit rate, because the bit rate reduction in a stable scenario has a relatively small impact on the user's perception. Small, the bit rate reduction is not easy to reduce the user experience. Dynamic bit rate adjustment can be implemented according to the switching frequency of the foreground application to improve the user experience while reducing power consumption. In addition, the screen projection method in the embodiment of the present application does not need to wait until the temperature rises to the threshold before adjusting the bit rate, but dynamically adjusts the bit rate based on the switching frequency of the foreground application, which can improve the temperature rise of the screen projection source device caused by screen projection, prolong the temperature rise time, and reduce the probability of abnormalities caused by heat in the device.
在一种可能的实施方式中,上述步骤301、根据当前的前台应用在预设时段内从后台切换至前台的频率确定是否进行码率调节包括:根据当前的前台应用在预设时段内从后台切换至前台的频率及第二应用类型权重确定是否进行码率调节,第二应用类型权重为在预设时段被切换为前台应用的目标应用对应的应用类型权重,目标应用为当前的前台应用之外的应用。例如,如果用户在最近一段时间切换至的目标应用为视频应用,其对应的应用类型权重较大,因此更倾向于进行码率调节;如果用户在最近一段时间切换至的目标应用为例如即时通信应用,其对应的应用类型权重较小,因此更倾向于不进行码率调节。结合前台应用的切换频率和切换至的目标应用的应用类型确定是否进行码率调节,可以进一步提高用户体验。In a possible implementation, the above step 301, determining whether to adjust the bit rate based on the frequency of the current foreground application switching from the background to the foreground within a preset time period, includes: determining whether to adjust the bit rate based on the frequency of the current foreground application switching from the background to the foreground within a preset time period and the second application type weight, the second application type weight being the application type weight corresponding to the target application that is switched to the foreground application within the preset time period, the target application being an application other than the current foreground application. For example, if the target application that the user has switched to in the recent period is a video application, its corresponding application type weight is relatively large, and therefore it is more inclined to adjust the bit rate; if the target application that the user has switched to in the recent period is, for example, an instant messaging application, its corresponding application type weight is relatively small, and therefore it is more inclined not to adjust the bit rate. Determining whether to adjust the bit rate based on the switching frequency of the foreground application and the application type of the target application switched to can further improve the user experience.
在一种可能的实施方式中,视频或游戏应用对应的应用类型权重>其他应用对应的应用类型权重。In a possible implementation, the application type weight corresponding to the video or game application is greater than the application type weight corresponding to other applications.
在一种可能的实施方式中,根据当前的前台应用在预设时段内从后台切换至前台的频率和第二应用类型权重确定是否进行码率调节包括:根据当前的前台应用在预设时段内从后台切换至前台的频率和第二应用类型权重确定码率调节指标,若码率调节指标所表征的码率调节必要性满足调节条件,则确定进行码率调节,若码率调节指标所表征的码率调节必要性不满足调节条件,则确定不进行码率调节,码率调节指标所表征的码率调节必要性与第二应用类型权重正相关,码率调节指标所表征的码率调节必要性与频率负相关。也就是说,在预设时段内从后台切换至前台的频率越高,则说明待投屏场景的稳定性越差,因此码率调节必要性越低,而切换频率越低,则说明待投屏场景的稳定性越高,因此码率调节必要性越高;目标应用的应用类型权重越高,则说明待投屏场景为高码率的概率越大,即码率调节必要性越高,而目标应用的应用类型权重越低,则说明待投屏场景为高码率的概率越小,即码率调节必要性越低。In a possible implementation, determining whether to perform rate adjustment based on the frequency of the current foreground application switching from the background to the foreground within a preset time period and the weight of the second application type includes: determining a rate adjustment index based on the frequency of the current foreground application switching from the background to the foreground within a preset time period and the weight of the second application type; if the necessity of rate adjustment represented by the rate adjustment index meets the adjustment condition, determining to perform rate adjustment; if the necessity of rate adjustment represented by the rate adjustment index does not meet the adjustment condition, determining not to perform rate adjustment; the necessity of rate adjustment represented by the rate adjustment index is positively correlated with the weight of the second application type, and the necessity of rate adjustment represented by the rate adjustment index is negatively correlated with the frequency. That is to say, the higher the frequency of switching from the background to the foreground within the preset time period, the worse the stability of the screen to be projected, and therefore the lower the necessity for bitrate adjustment; the lower the switching frequency, the higher the stability of the screen to be projected, and therefore the higher the necessity for bitrate adjustment; the higher the application type weight of the target application, the greater the probability that the screen to be projected is a high bitrate, that is, the higher the necessity for bitrate adjustment; the lower the application type weight of the target application, the smaller the probability that the screen to be projected is a high bitrate, that is, the lower the necessity for bitrate adjustment.
在一种可能的实施方式中,上述步骤303、基于目标码率对待投屏内容进行编码和无线投屏包括:基于目标码率确定待投屏内容的目标分辨率,待投屏内容的目标分辨率低于待投屏内容的原始分辨率;基于目标分辨率对待投屏内容进行编码和无线投屏。可以在降低码率的同时尽量减小对用户体验的不良影响,具体过程和原理与上述实施例相同,在此不再赘述。In a possible implementation, the above step 303, encoding and wirelessly projecting the content to be projected based on the target bit rate, includes: determining the target resolution of the content to be projected based on the target bit rate, the target resolution of the content to be projected is lower than the original resolution of the content to be projected; encoding and wirelessly projecting the content to be projected based on the target resolution. The bit rate can be reduced while minimizing the adverse impact on the user experience. The specific process and principle are the same as those in the above embodiment and will not be repeated here.
本申请实施例还提供一种电子设备,包括:处理器和存储器,存储器用于存储至少一条指令,指令由处理器加载并执行时,使得电子设备执行上述任意实施例的方法。该方法的具体过程和原理与上述实施例相同,在此不再赘述。该电子设备具体可以图2所示意的电子设备。The embodiment of the present application also provides an electronic device, including: a processor and a memory, the memory is used to store at least one instruction, and when the instruction is loaded and executed by the processor, the electronic device executes the method of any of the above embodiments. The specific process and principle of the method are the same as those of the above embodiment, and will not be repeated here. The electronic device can be specifically the electronic device shown in Figure 2.
本申请所涉及的电子设备可能为智能电视、手机、平板电脑、个人计算机(personal computer,PC)、个人数字助理(personal digital assistant,PDA)、智能手表、可穿戴电子设备、增强现实技术(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、车载设备、无人机设备、智能汽车、智能音响、机器人、智能眼镜等等任意产品。The electronic devices involved in this application may be smart TVs, mobile phones, tablet computers, personal computers (PCs), personal digital assistants (PDAs), smart watches, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, drone equipment, smart cars, smart speakers, robots, smart glasses, and any other products.
本申请实施例还提供一种计算机可读存储介质,包括程序或指令,当程序或指令在计算机上运行时,上述任意实施例中的方法被执行。An embodiment of the present application further provides a computer-readable storage medium, including a program or an instruction. When the program or the instruction runs on a computer, the method in any of the above embodiments is executed.
本申请实施例还提供一种计算机程序产品,计算机程序产品包含可执行指令,当可执行指令在计算机上执行时,使得计算机执行上述任意实施例中的方法。The embodiments of the present application also provide a computer program product, which includes executable instructions. When the executable instructions are executed on a computer, the computer executes the method in any of the above embodiments.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk)等。 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 integrated. 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.
本申请实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示单独存在A、同时存在A和B、单独存在B的情况。其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项”及其类似表达,是指的这些项中的任意组合,包括单项或复数项的任意组合。例如,a,b和c中的至少一项可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And/or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and/or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character "/" generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple.
以上仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。 The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (15)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311654618.5 | 2023-11-30 | ||
| CN202311654618.5A CN120075524A (en) | 2023-11-30 | 2023-11-30 | Screen projection method, electronic device, storage medium and program product |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025112925A1 true WO2025112925A1 (en) | 2025-06-05 |
Family
ID=95793952
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/123814 Pending WO2025112925A1 (en) | 2023-11-30 | 2024-10-10 | Screen mirroring method, electronic device, storage medium, and program product |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN120075524A (en) |
| WO (1) | WO2025112925A1 (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190014332A1 (en) * | 2017-07-07 | 2019-01-10 | Apple Inc. | Content-aware video coding |
| CN111193927A (en) * | 2018-11-14 | 2020-05-22 | 腾讯科技(深圳)有限公司 | Encoded data processing method, apparatus, computer device and storage medium |
| CN113886060A (en) * | 2021-05-28 | 2022-01-04 | 荣耀终端有限公司 | Method and device for compressing memory |
| CN116257195A (en) * | 2021-12-09 | 2023-06-13 | 北京小米移动软件有限公司 | Screen projection method and device, storage medium and electronic equipment |
-
2023
- 2023-11-30 CN CN202311654618.5A patent/CN120075524A/en active Pending
-
2024
- 2024-10-10 WO PCT/CN2024/123814 patent/WO2025112925A1/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190014332A1 (en) * | 2017-07-07 | 2019-01-10 | Apple Inc. | Content-aware video coding |
| CN111193927A (en) * | 2018-11-14 | 2020-05-22 | 腾讯科技(深圳)有限公司 | Encoded data processing method, apparatus, computer device and storage medium |
| CN113886060A (en) * | 2021-05-28 | 2022-01-04 | 荣耀终端有限公司 | Method and device for compressing memory |
| CN116257195A (en) * | 2021-12-09 | 2023-06-13 | 北京小米移动软件有限公司 | Screen projection method and device, storage medium and electronic equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN120075524A (en) | 2025-05-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11909984B2 (en) | Video encoding and decoding for cloud gaming | |
| US11431942B2 (en) | Frame rate conversion | |
| US10306180B2 (en) | Predictive virtual reality content streaming techniques | |
| CN112235626B (en) | Video rendering method and device, electronic equipment and storage medium | |
| US11694316B2 (en) | Method and apparatus for determining experience quality of VR multimedia | |
| US9589540B2 (en) | Adaptive control of display refresh rate based on video frame rate and power efficiency | |
| US20190333263A1 (en) | Asynchronous time and space warp with determination of region of interest | |
| WO2022110903A1 (en) | Method and system for rendering panoramic video | |
| KR20220124286A (en) | Methods and apparatuses for distribution of application calculations | |
| JP2011523116A (en) | Coordinating power management functions in multimedia devices | |
| CN100520830C (en) | Spatio-temporal generation of motion blur | |
| US20230388556A1 (en) | Banding artifact detector | |
| US20250030932A1 (en) | Systems and methods for providing optimized time scales and accurate presentation time stamps | |
| WO2023235730A1 (en) | Banding artifact detector | |
| CN105719229A (en) | Application-transparent resolution control by way of command stream interception | |
| WO2025112925A1 (en) | Screen mirroring method, electronic device, storage medium, and program product | |
| WO2024148945A1 (en) | Refresh rate adjustment method and electronic device | |
| CN116095250A (en) | Method and device for video cropping | |
| US12315106B2 (en) | Frame sequence quality booster using information in an information repository | |
| US20240048727A1 (en) | Method and system of low latency video coding with interactive applications | |
| CN120475217A (en) | Frame rate control method, device, equipment, storage medium and vehicle | |
| WO2024198633A1 (en) | Video switching method and electronic device | |
| CN118828098A (en) | Bullet screen display method, device, electronic device, storage medium and program product | |
| CN120345021A (en) | Cutoff prediction for histogram data and backlight control | |
| CN120321448A (en) | Screen projection method, screen projection resolution adjustment method, device and electronic equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24896019 Country of ref document: EP Kind code of ref document: A1 |