WO2020108061A1 - 视频处理方法、装置、电子设备以及存储介质 - Google Patents

视频处理方法、装置、电子设备以及存储介质 Download PDF

Info

Publication number
WO2020108061A1
WO2020108061A1 PCT/CN2019/107933 CN2019107933W WO2020108061A1 WO 2020108061 A1 WO2020108061 A1 WO 2020108061A1 CN 2019107933 W CN2019107933 W CN 2019107933W WO 2020108061 A1 WO2020108061 A1 WO 2020108061A1
Authority
WO
WIPO (PCT)
Prior art keywords
power consumption
threshold
resource file
electronic device
video resource
Prior art date
Application number
PCT/CN2019/107933
Other languages
English (en)
French (fr)
Inventor
杨海
胡杰
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to EP19889477.6A priority Critical patent/EP3872603A4/en
Publication of WO2020108061A1 publication Critical patent/WO2020108061A1/zh
Priority to US17/331,571 priority patent/US20210287631A1/en

Links

Images

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G5/00Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators
    • G09G5/36Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators characterised by the display of a graphic pattern, e.g. using an all-points-addressable [APA] memory
    • G09G5/363Graphics controllers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3206Monitoring of events, devices or parameters that trigger a change in power modality
    • G06F1/3215Monitoring of peripheral devices
    • G06F1/3218Monitoring of peripheral devices of display devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/325Power saving in peripheral device
    • G06F1/3265Power saving in display device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output
    • G06F3/165Management of the audio stream, e.g. setting of volume, audio stream path
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G5/00Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators
    • G09G5/003Details of a display terminal, the details relating to the control arrangement of the display terminal and to the interfaces thereto
    • G09G5/006Details of the interface to the display terminal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/436Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation using parallelised computational arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/426Internal components of the client ; Characteristics thereof
    • H04N21/42653Internal components of the client ; Characteristics thereof for processing graphics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44012Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving rendering scenes according to scene graphs, e.g. MPEG-4 scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44209Monitoring of downstream path of the transmission network originating from a server, e.g. bandwidth variations of a wireless network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/4424Monitoring of the internal components or processes of the client device, e.g. CPU or memory load, processing speed, timer, counter or percentage of the hard disk space used
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • H04N21/4436Power management, e.g. shutting down unused components of the receiver
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2203/00Indexing scheme relating to G06F3/00 - G06F3/048
    • G06F2203/041Indexing scheme relating to G06F3/041 - G06F3/045
    • G06F2203/04104Multi-touch detection in digitiser, i.e. details about the simultaneous detection of a plurality of touching locations, e.g. multiple fingers or pen and finger
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G2320/00Control of display operating conditions
    • G09G2320/06Adjustment of display parameters
    • G09G2320/0626Adjustment of display parameters for control of overall brightness
    • G09G2320/064Adjustment of display parameters for control of overall brightness by time modulation of the brightness of the illumination source
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G2320/00Control of display operating conditions
    • G09G2320/06Adjustment of display parameters
    • G09G2320/0626Adjustment of display parameters for control of overall brightness
    • G09G2320/0646Modulation of illumination source brightness and image signal correlated to each other
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the technical field of electronic equipment, and more specifically, to a video processing method, device, electronic equipment, and storage medium.
  • the present application proposes a video processing method, device, electronic device, and storage medium to solve the above problems.
  • an embodiment of the present application provides a video processing method, which is applied to an electronic device.
  • the electronic device includes a central processor and a graphics processor.
  • the method includes: when the electronic device plays a video resource file, Detect the power consumption of the electronic device; determine whether the power consumption is higher than the power consumption threshold; when the power consumption is higher than the power consumption threshold, control the graphics processor to decode the video resource file and Render.
  • an embodiment of the present application provides a video processing apparatus, which is applied to an electronic device.
  • the electronic device includes a central processor and a graphics processor.
  • the apparatus includes: a detection module, configured to play when the electronic device Video resource files, detecting the power consumption of the electronic device; a judging module, used to judge whether the power consumption is higher than a power consumption threshold; a processing module, used when the power consumption is higher than the power consumption threshold, Controlling the graphics processor to decode and render the video resource file.
  • embodiments of the present application provide an electronic device, including a central processing unit and a graphics processor; a memory; one or more application programs, wherein the one or more application programs are stored in the memory And is configured to be executed by the central processor, and the one or more programs are configured to perform the above method.
  • an embodiment of the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the above method.
  • FIG. 1 shows a schematic flowchart of video playback provided by an embodiment of the present application
  • FIG. 2 shows a schematic flowchart of a video processing method provided by an embodiment of the present application
  • FIG. 3 shows a schematic flowchart of a video processing method provided by another embodiment of the present application.
  • FIG. 4 shows a schematic flowchart of a video processing method provided by another embodiment of the present application.
  • FIG. 5 shows a schematic flowchart of a video processing method provided by another embodiment of the present application.
  • FIG. 6 shows a schematic flowchart of a video processing method provided by yet another embodiment of the present application.
  • step S530 of the video processing method shown in FIG. 6 of the present application shows a schematic flowchart of step S530 of the video processing method shown in FIG. 6 of the present application
  • FIG. 8 shows a block diagram of a video processing device provided by an embodiment of the present application.
  • FIG. 9 shows a block diagram of an electronic device for performing a video processing method according to an embodiment of the present application.
  • FIG. 10 shows a storage unit for storing or carrying program codes for implementing a video processing method according to an embodiment of the present application.
  • FIG. 1 shows a video playback process.
  • the next job is to analyze the audio and video data.
  • General video files are composed of video stream and audio stream. Different video formats have different audio and video packaging formats.
  • the process of synthesizing audio and video streams into files is called muxer, while the process of separating audio and video streams from media files is called demuxer.
  • muxer the process of synthesizing audio and video streams into files
  • demuxer the process of separating audio and video streams from media files.
  • the decoded video frame can be directly rendered, and the audio frame can be sent to the buffer of the audio output device for playback.
  • video rendering The timestamp of the audio playback needs to be synchronized.
  • video decoding may include hard decoding and soft decoding.
  • hardware decoding a part of the video data that is originally handed over to the Central Processing Unit (CPU) for processing is handed over to the graphics processor (Graphics Processing Unit, GPU) To do it, and the parallel computing capability of the GPU is much higher than that of the CPU, which can greatly reduce the load on the CPU. After the CPU occupancy rate is low, you can run some other programs at the same time.
  • the processor such as i5 2320, or any quad-core processor of AMD, it can perform both hard decoding and soft decoding.
  • the multimedia framework obtains the video file to be played by the client through the API interface with the client, and hands it to the video codec (Video Decode), where the Media Framework is in the Android
  • the multimedia framework, MediaPlayer, MediaPlayerService and Stagefrightplayer constitute the basic framework of Android multimedia.
  • the multimedia framework part adopts the C/S structure, MediaPlayer as the client terminal of the C/S structure, MediaPlayerService and Stagefrightplayer as the server terminal of the C/S structure, which bears the responsibility of playing multimedia files.
  • the server side completes the client’s request and Respond.
  • Video Decode is a super decoder that integrates the most commonly used audio and video decoding and playback to decode video data.
  • soft decoding that is, let the CPU decode the video through software.
  • Hard decoding means that the video decoding task can be completed independently through a dedicated daughter card device without resorting to the CPU.
  • the decoded video data will be sent to the layer transfer module (SurfaceFlinger), and SurfaceFlinger will render and synthesize the decoded video data on the display screen.
  • SurfaceFlinger is an independent Service, which receives all Window’s Surface as input, calculates the position of each Surface in the final composite image according to ZOrder, transparency, size, position and other parameters, and then hands it to HWComposer or OpenGL to generate the final The display buffer is then displayed on a specific display device.
  • the CPU decodes the video data to SurfaceFlinger for rendering and synthesis
  • hard decoding is decoded by the GPU and then rendered and synthesized by SurfaceFlinger.
  • the SurfaceFlinger will call the GPU to render and synthesize the image and display it on the display.
  • the CPU obtains the video resource file sent by the client, decodes the video resource file to obtain the decoded video data, and then sends the video data to the GPU.
  • the rendering After the GPU rendering is completed, the rendering The result is put into the frame buffer, and then the video controller will read the data of the frame buffer line by line according to the HSync signal and pass it to the display after digital-to-analog conversion.
  • the CPU when it obtains the video resource file, it can choose to use the CPU to decode the video file to be played, and then send the decoded data to the SurfaceFlinger for rendering and synthesis after display, or the CPU can send the video resource file to GPU, after the image processing circuit of the GPU decodes the video resource file, it is sent to SurfaceFlinger for rendering and display after synthesis.
  • the CPU rendering mode is generally adopted by default, but because the CPU still needs to process a large number of other operations, the use of the CPU for video rendering will inadvertently waste unnecessary resources of electronic devices.
  • the GPU rendering mode is adopted by default, although GPU processing of images can alleviate the load pressure of the CPU, GPU processing will occupy a lot of memory, which makes it unreasonable to choose an image processor or a central processor to process video files.
  • the inventor discovered after long-term research and proposed the video processing method, device, electronic device, and storage medium provided by the embodiments of the present application.
  • the device decodes and renders the video resource file to reduce the power consumption of the central processing unit and improve the playback effect of the video resource file.
  • the specific video processing method will be described in detail in subsequent embodiments.
  • FIG. 2 shows a schematic flowchart of a video processing method provided by an embodiment of the present application.
  • the video processing method is used to control the graphics processor to decode and render the video resource file when the power consumption of the electronic device is higher than the power consumption threshold to reduce the power consumption of the central processor and improve the playback effect of the video resource file .
  • the video processing method is applied to the video processing device 200 shown in FIG. 8 and the electronic device 100 (FIG. 9) equipped with the video processing device 200.
  • FIG. 9 shows a schematic flowchart of a video processing method provided by an embodiment of the present application.
  • the video processing method is used to control the graphics processor to decode and render the video resource file when the power consumption of the electronic device is higher than the power consumption threshold to reduce the power consumption of the central processor and improve the playback effect of the video resource file .
  • the video processing method is applied to the video processing device 200 shown in FIG. 8 and the electronic device 100 (FIG. 9) equipped with the video processing device 200.
  • FIG. 9 shows a
  • the electronic device applied in this embodiment may be a smartphone or a tablet Computers, wearable electronic devices, in-vehicle devices, gateways, etc. are not specifically limited here.
  • the video processing method may specifically include the following steps:
  • Step S110 When the electronic device plays a video resource file, detect the power consumption of the electronic device.
  • the video resource files played by the electronic device may include video resource files played in the foreground of the electronic device, video resource files played in the background of the electronic device, and video resource files switched between the foreground and background of the electronic device , Not specifically limited here.
  • the video resource file played in the foreground refers to the video resource file that can usually interact with the user and can be displayed in the foreground, and it will be suspended when it is not visible;
  • the video resource file played in the background refers to the very limited interaction with the user In addition to the configuration period, the other time of its lifetime is hidden;
  • the video resource files that switch between the foreground and background of the electronic device refer to the video resource files that can be randomly switched between the foreground and the background.
  • the video resource file played by the electronic device is a video resource file played at the foreground of the electronic device.
  • the video resource file may be a local resource file or a network resource file, which is not limited herein. Specifically, if the video resource file is a local resource file, the video resource file can be downloaded from the server in advance by the electronic device and stored locally, and when the video resource file is played, the electronic device can directly read from the local And play, for example, can be directly read and played from the memory of the electronic device.
  • the video resource file is a network resource file
  • the video resource file can be obtained and played online by the electronic device from the server, where the electronic device can obtain the video resource file online from the server through the wireless network
  • the video resource file can also be obtained online from the server through the data network, which is not limited herein, where the data network may include a 2G network, a 3G network, a 4G network, or a 5G network.
  • the electronic device may be installed with a video playback application, and the application icon corresponding to the video playback application is displayed on the desktop of the electronic device.
  • the electronic device can run the video playback application in response, and obtain the video resource file from the server through the network and play it; as another way, the electronic device can be installed with a browser and based on user operation Enter the video playback interface through the webpage of the browser, and obtain the video resource file from the server under the video playback interface and play it.
  • the power consumption of the electronic device may be detected, where the power consumption of the electronic device is the difference between input power and output power, that is, power loss.
  • the power consumption of electronic equipment includes CPU power consumption, GPU power consumption, etc.
  • CPU power consumption can be understood as thermal design (Thermal Design Power, TDP) power consumption, which reflects the central processor heat
  • TDP Thermal Design Power
  • the release index means that when the central processor reaches the maximum load, the heat released is in watts (W).
  • W watts
  • TDP is an indicator that reflects the heat release of the processor. It is the cooling system of electronic equipment that must be capable The maximum heat dissipation limit.
  • TDP is the thermal effect of CPU current and other heat generated when the CPU is working.
  • TDP power consumption is usually used as an important reference index for heat dissipation/consumption design such as motherboard design, heat dissipation system design, and heat dissipation design of electronic equipment.
  • TDP needs to be used as the minimum index/basic index for heat dissipation capacity design.
  • Step S120 Determine whether the power consumption is higher than the power consumption threshold.
  • the electronic device is provided with a power consumption threshold, which is used as a basis for determining the power consumption of the electronic device.
  • the power consumption threshold may be stored locally by the electronic device in advance, or may be set during judgment, which is not limited herein.
  • the power consumption threshold may be automatically configured by the electronic device, may be manually set by the user, or may be transmitted to the electronic device after the server is configured, which is not limited herein. As a way, after acquiring the power consumption of the electronic device, the power consumption is compared with a power consumption threshold to determine whether the power consumption is higher than the power consumption threshold.
  • Step S130 When the power consumption is higher than the power consumption threshold, control the graphics processor to decode and render the video resource file.
  • the GPU can be controlled to decode and render the video resource file, so as to reduce the working frequency of the CPU, and ensure the normal playback of the video resource file and the normal operation of the electronic device.
  • the GPU decodes the video resource file, thereby obtaining multi-frame image data corresponding to the video resource file, that is, video frame data.
  • the CPU calls the playback module to parse the video resource file, so as to obtain the video stream and audio stream corresponding to the video resource file.
  • the playback module can be the MediaExtractor module in the Android system, or it can be the FFmpeg module.
  • the FFmpeg module is an open source cross-platform video and audio streaming framework. It belongs to free software and uses the LGPL or GPL license (depending on the choice of Components). It provides a complete solution for recording, converting, and streaming audio and video, and it contains a rich audio/video codec library, libavcodec.
  • the CPU sends the video stream to the GPU.
  • the GPU decodes the video stream
  • the multi-frame image data corresponding to the video stream is obtained, and then the multi-frame image data is synthesized.
  • the synthesis method may be set in advance Synthesizing in the frame buffer, that is, rendering and synthesizing the multi-frame image data through on-screen rendering, or synthesizing the multi-frame image data through off-screen rendering.
  • an off-screen rendering buffer is set in the GPU in advance.
  • the GPU will call the rendering client module to render and synthesize the multi-frame image data to be rendered and send it to the display screen for display.
  • the rendering The client module can be an OpenGL module.
  • the final position of the OpenGL rendering module is in the frame buffer.
  • Frame buffer is a series of two-dimensional pixel storage array, including color buffer, depth buffer, template buffer and accumulation buffer.
  • OpenGL uses the frame buffer provided by the window system.
  • OpenGL's GL_ARB_framebuffer_object extension provides a way to create additional frame buffer objects (Frame Buffer Object, FBO). Using the frame buffer object, OpenGL can redirect the frame buffer originally drawn to the window to the FBO.
  • FBO Frame Buffer Object
  • the off-screen rendering buffer may be a storage space corresponding to the GPU, that is, the off-screen rendering buffer itself has no space for storing images, but after mapping with a storage space in the graphics processor, the image is actually stored in In a storage space in the graphics processor corresponding to the off-screen rendering buffer.
  • the multi-frame image data can be stored in the off-screen rendering buffer, that is, the multi-frame image data can be found in the off-screen rendering buffer.
  • the multi-frame image data can be rendered in the off-screen rendering buffer.
  • the multi-frame buffer data can be subjected to display enhancement processing, for example, Image parameter optimization of multi-frame image data in the off-screen rendering buffer, wherein the image parameter optimization includes at least one of exposure enhancement, denoising, edge sharpening, contrast increase, or saturation increase.
  • the video resource file displayed by the electronic device is the decoded image content.
  • the decoded image content is RGBA format data
  • the RGBA format data needs to be converted to the HSV format, specifically , Obtain the histogram of the image content, count the histogram to obtain the parameters for converting the RGBA format data to the HSV format, and then convert the RGBA format data to the HSV format according to the parameters.
  • the exposure enhancement is used to increase the brightness of the image.
  • the histogram of the image can be used to increase the brightness value of the area where the brightness value is passed.
  • the brightness of the image can be increased by nonlinear superposition.
  • T and I are images with values of [0,1]. The algorithm can iterate multiple times if the effect is not good.
  • denoising the image content is used to remove the noise of the image.
  • the image is often degraded due to the interference and influence of various noises during the generation and transmission of the image, which has a subsequent effect on the processing of the image and image vision. Will have an adverse effect.
  • noise such as: electrical noise, mechanical noise, channel noise and other noise. Therefore, in order to suppress noise, improve image quality, and facilitate higher-level processing, it is necessary to perform denoising preprocessing on the image. From the perspective of the probability distribution of noise, it can be divided into Gaussian noise, Rayleigh noise, gamma noise, exponential noise and uniform noise.
  • the image can be denoised by a Gaussian filter, where the Gaussian filter is a linear filter that can effectively suppress noise and smooth the image. Its operating principle is similar to the average filter, and the average value of the pixels in the filter window is taken as the output.
  • the coefficient of the window template is different from the mean filter.
  • the template coefficient of the mean filter is the same as 1.
  • the template coefficient of the Gaussian filter decreases as the distance from the center of the template increases. Therefore, the Gaussian filter is less blurry than the mean filter.
  • a 5 ⁇ 5 Gaussian filter window is generated, and the center position of the template is used as the coordinate origin for sampling. Bring the coordinates of each position of the template into the Gaussian function, and the value obtained is the coefficient of the template. Then convolving the Gaussian filter window with the image can denoise the image.
  • the edge sharpening is used to make the blurred image clearer.
  • image sharpening There are generally two methods for image sharpening: one is the differential method, and the other is the high-pass filtering method.
  • contrast stretching is a method of image enhancement, and also belongs to the grayscale conversion operation. Through grayscale transformation, the grayscale value is stretched to the entire range of 0-255, then its contrast is obviously greatly enhanced. You can use the following formula to map the gray value of a pixel to a larger gray space:
  • I(x,y) [(I(x,y)-Imin)/(Imax-Imin)](MAX-MIN)+MIN;
  • Imin and Imax are the minimum gray value and maximum gray value of the original image
  • MIN and MAX are the minimum and maximum gray values of the gray space to be stretched.
  • the multi-frame image data can be sent to the frame buffer corresponding to the screen, where the frame buffer corresponds to the screen and is used to store data that needs to be displayed on the screen, for example Framebuffer
  • Framebuffer is a driver interface that appears in the kernel of the operating system.
  • Linux works in protected mode, so user-mode processes cannot use the interrupt call provided in the BIOS of the graphics card to directly write data and display it on the screen, as Linux does.
  • This device is used by the user process to directly write data and display it on the screen.
  • the Framebuffer mechanism imitates the function of the graphics card, and can directly operate the video memory through the reading and writing of the Framebuffer.
  • the Framebuffer can be regarded as an image of the display memory, and after it is mapped into the process address space, it can be directly read and written, and the written data can be displayed on the screen.
  • the frame buffer can be regarded as a space for storing data.
  • the CPU or GPU puts the data to be displayed into the frame buffer, and the Framebuffer itself does not have any ability to calculate data.
  • the video controller reads the Framebuffer according to the screen refresh frequency. The data inside is displayed on the screen.
  • Multi-frame image data is read from the frame buffer and displayed on the screen. Specifically, after storing the multi-frame image data in the frame buffer, after the graphics processor detects that the frame buffer has written data, the optimized multi-frame image data is read from the frame buffer, and the Displayed on the screen.
  • the GPU reads frame-by-frame image data from the frame buffer frame by frame according to the refresh rate of the screen, and displays it on the screen after rendering and synthesis processing.
  • the power consumption of the electronic device is detected to determine whether the power consumption is higher than the power consumption threshold, and when the power consumption is higher than the power consumption threshold ,
  • the graphics processor is controlled to decode and render the video resource file, so that when the power consumption of the electronic device is higher than the power consumption threshold, the graphics processor is controlled to decode and render the video resource file to reduce the central processor’s Power consumption, improve the playback effect of video resource files.
  • FIG. 3 is a schematic flowchart of a video processing method according to another embodiment of the present application. The following describes the process shown in FIG. 3 in detail.
  • the video processing method may specifically include the following steps:
  • Step S210 When the electronic device plays a video resource file, detect the power consumption of the electronic device.
  • Step S220 Determine whether the power consumption is higher than a power consumption threshold.
  • steps S210-S220 please refer to steps S110-S120, which will not be repeated here.
  • Step S230 When the power consumption is higher than the power consumption threshold, detect whether the central processor decodes and renders the video resource file.
  • the electronic device can decode and render the video resource file through the CPU, and can also decode and render the video resource file through the GPU. Therefore, in this embodiment, when the judgment result indicates that the power consumption of the electronic device is higher than the power When the threshold is consumed, you can detect the subject that decodes and renders the video resource file, that is, whether the CPU decodes and renders the video resource file, or whether the GPU decodes and renders the video resource file, or whether the CPU and GPU Simultaneously decode and render the video resource file. When the CPU and GPU decode and render the video resource file at the same time, then the CPU and the GPU can simultaneously process different video frames of the video resource file.
  • Step S240 When the central processor decodes and renders the video resource file, switch to the graphics processor to decode and render the video resource file.
  • the graphics processor may be switched to decode and render the video resource file.
  • the CPU when the video resource file is initially decoded and rendered by the CPU, the CPU may be prohibited from continuing to decode and render the remaining video resource file to be played, and switch to the GPU to decode and render the video resource file to be played;
  • the video resource file is initially decoded and rendered simultaneously by the CPU and the GPU, the video frames decoded and rendered by the CPU in the remaining video resource files to be played are switched to be decoded and rendered by the GPU, thereby reducing CPU Working frequency effect.
  • a video processing method when an electronic device plays a video resource file, the power consumption of the electronic device is detected to determine whether the power consumption is higher than the power consumption threshold, and when the power consumption is higher than the power consumption threshold To detect whether the central processor decodes and renders the video resource file, and when the central processor decodes and renders the video resource file, switch to the graphics processor to decode and render the video resource file.
  • the graphics processor decodes and renders the video resource file In order to reduce the power consumption of the central processor and improve the playback effect of video resource files.
  • FIG. 4 is a schematic flowchart of a video processing method according to another embodiment of the present application.
  • the electronic device further includes a screen, and the flow shown in FIG. 4 will be described in detail below.
  • the video processing method may specifically include the following steps:
  • Step S310 When the electronic device plays a video resource file, detect the brightness of the screen.
  • the electronic device includes a screen, wherein the displayable area of the screen can be used to display text, pictures, icons, or videos.
  • the screen is used to display video resource files.
  • more and more electronic devices can also set the screen as a touch screen. In the case of setting the touch screen, when the user detects that the user is dragging, clicking, double-clicking, sliding, etc. on the touch screen During the control operation, the electronic device can respond to the user's touch operation.
  • the screen of the electronic device will be lit when displaying the video resource file, and when the brightness of the screen of the electronic device is too high, it will cause excessive power consumption of the electronic device. Therefore, it can be determined by To determine whether the brightness of the screen of the electronic device is too high to determine whether the power consumption of the electronic device is too large, as a way, when it is determined that the electronic device plays a video resource file, the brightness of the screen of the electronic device can be detected, Optionally, the brightness of the screen of the electronic device can be detected by a brightness detection module or a brightness detection application built in the electronic device, which will not be repeated here.
  • Step S320 Determine whether the brightness is higher than a brightness threshold.
  • the electronic device is provided with a brightness threshold, which is used as a basis for judging the brightness of the screen of the electronic device.
  • the brightness threshold may be stored locally by the electronic device in advance, or may be set during judgment, which is not limited herein.
  • the brightness threshold may be automatically set by the electronic device, may be manually set by the user, or may be transmitted to the electronic device after the server configuration is completed, which is not limited herein. As a way, after acquiring the brightness threshold of the electronic device, the brightness of the screen of the electronic device is compared with the brightness threshold to determine whether the brightness of the screen is higher than the brightness threshold.
  • Step S330 When the brightness is higher than the brightness threshold, it is determined that the power consumption is higher than the power consumption threshold.
  • the power consumption caused by characterizing the brightness of the screen is lower, and therefore, it can be determined that the power consumption of the electronic device is not higher than the Power consumption threshold.
  • the judgment result indicates that the brightness of the screen is higher than the brightness threshold, the power consumption due to the brightness of the screen is too high. Therefore, it can be determined that the power consumption of the electronic device is higher than the power consumption threshold.
  • Step S340 output prompt information and monitor input information.
  • the electronic device may output prompt information, wherein the prompt information may be
  • the format output can be output in the form of graphics or text, and can also be output in the form of transmission to other electronic devices, which is not limited herein.
  • the output prompt information can be used to prompt the user corresponding to the electronic device that the screen of the electronic device is too bright or the power consumption of the electronic device is too large, so that the user can respond based on the prompt information.
  • the prompt information can also include a selection Information
  • the selection information may include "whether to reduce the power consumption of the electronic device” or “whether to reduce the brightness of the screen of the electronic device” or the like, so that the user triggers a selection operation based on the selection information.
  • the input information based on the prompt information can be monitored.
  • text information, voice information, and selection operations input by the user based on the prompt information may be monitored, which is not limited herein.
  • the electronic device monitors the selection operation acting on the multiple selection controls corresponding to the multiple selection information, and receives the selection operation when the selection operation triggered by the user is monitored,
  • the selection operation may be a touch operation, and the touch operation may include at least single-finger click, multi-finger click, single-finger long press, multi-finger long press, heavy pressure, multiple clicks, and sliding operations.
  • Step S350 When input information indicating that the brightness of the screen is kept unchanged or no input information is heard within the duration threshold, the graphics processor is controlled to decode and render the video resource file.
  • the user may choose to input information to indicate whether the electronic device reduces the brightness of the screen, or may choose not to input information, that is, the electronic device may or may not receive the input information To enter information. Therefore, as a way, the electronic device may set a time threshold, and similarly, the time threshold may be stored locally by the electronic device in advance, or may be set during detection. In addition, the time threshold may be automatically configured by the electronic device 3. It can be set manually by the user, or can be transmitted to the electronic device after the server is configured. It is not limited here.
  • the GPU can be automatically controlled to decode and render the video resource file, so that the electronic device can maintain the current brightness of the screen, reduce the operating frequency of the CPU, and improve the playback effect of the video resource file.
  • the input information input by the user is monitored, and the input information is used to indicate that the current brightness of the screen remains unchanged, it means that the user expects to continue watching the video resource file under the brightness of the screen, so the automatic control of the The GPU decodes and renders the video resource file to automatically realize that the electronic device maintains the current brightness of the screen, reduces the CPU working frequency, and improves the playback effect of the video resource file.
  • a video processing method when an electronic device plays a video resource file, the brightness of the screen is detected to determine whether the brightness is higher than the brightness threshold, and when the brightness is higher than the brightness threshold, it is determined that the power consumption is high Based on the power consumption threshold, output prompt information and monitor input information.
  • the graphics processor is controlled to decode and decode the video resource file. Render.
  • the graphics processor controls the video resource file. Perform decoding and rendering to improve adaptability and user performance.
  • FIG. 5 is a schematic flowchart of a video processing method according to another embodiment of the present application. The process shown in FIG. 5 will be described in detail below.
  • the video processing method may specifically include the following steps:
  • Step S410 When the electronic device plays a video resource file, detect the volume of the electronic device.
  • the video resource file includes both the image resource file and the audio resource file
  • the electronic device can output the audio resource file through the speaker, microphone, or headset, etc., where
  • the volume of the electronic device can be detected.
  • the volume of the electronic device can be detected through a volume detection module or a volume detection application built in the electronic device.
  • Step S420 determine whether the volume is higher than the volume threshold.
  • the electronic device may be provided with a volume threshold, which is used as a basis for judging the volume of the electronic device.
  • the volume threshold may be stored locally by the electronic device in advance, or may be set during judgment, which is not limited herein.
  • the volume threshold may be set automatically by the electronic device, may be manually set by the user, or may be transmitted to the electronic device after configuration by the server, which is not limited herein. As a way, after acquiring the volume threshold of the electronic device, the volume of the electronic device is compared with the volume threshold to determine whether the volume of the electronic device is higher than the volume threshold.
  • Step S430 When the volume is higher than the volume threshold, it is determined that the power consumption is higher than the power consumption threshold.
  • the power consumption caused by characterizing the volume of the electronic device is low, and therefore, it can be determined that the power consumption of the electronic device is not high The power consumption threshold. Conversely, when the judgment result indicates that the volume of the electronic device is higher than the volume threshold, the power consumption caused by characterizing the volume of the electronic device is higher. Therefore, it can be determined that the power consumption of the electronic device is higher than the power consumption threshold.
  • Step S440 Control the graphics processor to decode and render the video resource file.
  • step S350 when it is determined that the volume of the electronic device is higher than the volume threshold, it can output prompt information and monitor input information, and when it is monitored that the volume of the electronic device is maintained or the input information is not monitored within the duration threshold, Control the graphics processor to decode and render the video resource file.
  • the graphics processor to decode and render the video resource file.
  • a video processing method when an electronic device plays a video resource file, the volume of the electronic device is detected to determine whether the volume is higher than a volume threshold, and when the volume is higher than the volume threshold, the power consumption is determined Above the power consumption threshold, the graphics processor is controlled to decode and render the video resource file.
  • this embodiment also determines that the power consumption is higher than the power consumption threshold when the volume of the electronic device is higher than the volume threshold, and then decodes and renders the video resource file through the graphics processor to improve display effect.
  • FIG. 6 is a schematic flowchart of a video processing method according to yet another embodiment of the present application. The process shown in FIG. 6 will be described in detail below.
  • the video processing method may specifically include the following steps:
  • Step S510 When the electronic device plays a video resource file, detect the power consumption of the electronic device.
  • Step S520 Determine whether the power consumption is higher than the power consumption threshold.
  • steps S510-S520 please refer to steps S110-S120, which will not be repeated here.
  • Step S530 When the power consumption is higher than the power consumption threshold, determine a rendering parameter corresponding to the power consumption.
  • the electronic device may store multiple power consumptions and multiple rendering parameters, and store the correspondence between multiple power consumptions and multiple rendering parameters, where the correspondence may include one power consumption corresponding to one rendering parameter or Multiple rendering parameters may also include one rendering parameter corresponding to one or more power consumptions, which is not limited herein.
  • the correspondence between power consumption and rendering parameters can be preset by the user and stored in the electronic device, can be automatically set by the electronic device and stored in advance, or can be pre-set by the server and sent to the electronic device. This is not limited.
  • the rendering effect or optimization effect of each of the plurality of rendering parameters on the video resource file may be different, that is, through each of the plurality of rendering parameters Processing the same video resource file can achieve different rendering effects.
  • FIG. 7 is a schematic flowchart of step S530 of the video processing method shown in FIG. 6 of the present application.
  • the process shown in FIG. 7 will be described in detail below.
  • the method may specifically include the following steps:
  • Step S531 When the power consumption is higher than the power consumption threshold, determine whether the power consumption is higher than a set threshold, where the set threshold is greater than the power consumption threshold.
  • the electronic device may be provided with a set threshold value, wherein the set threshold value is higher than the power consumption threshold value, and similarly, the set threshold value may be stored locally by the electronic device in advance, or may be performed during judgment Settings.
  • the set threshold can be automatically configured by the electronic device, can be manually set by the user, or can be transmitted to the electronic device after the server is configured, which is not limited herein. Therefore, in this embodiment, when it is determined that the power consumption of the electronic device is higher than the power consumption threshold, the power consumption of the electronic device can be continuously compared with the set threshold to determine whether the power consumption of the electronic device is higher than Set the threshold.
  • Step S532 When the power consumption is not higher than the set threshold, determine a first rendering parameter corresponding to the power consumption.
  • Step S533 When the power consumption is higher than the set threshold, determine a second rendering parameter corresponding to the power consumption, wherein the picture optimization quality corresponding to the first rendering parameter is better than the second rendering Picture optimization quality corresponding to the parameter.
  • the rendering parameters may include a first rendering parameter and a second rendering parameter, and the picture optimization quality corresponding to the first rendering parameter is better than the picture optimization quality corresponding to the second rendering parameter.
  • the electronic device can select different rendering parameters to render the video resource file according to different power consumption to achieve different rendering effects.
  • the rendering parameters corresponding to the power consumption of the electronic device can be selected according to the interval, specifically, when the power consumption is not higher than the set threshold, that is, when the power consumption is located in the power
  • the power consumption threshold is between the set threshold, it can be determined that the power consumption corresponds to the first rendering parameter; when the power consumption is higher than the set power consumption, it can be determined that the power consumption corresponds to the second rendering parameter, that is, when the When the power consumption of the electronic device is greater, the optimization quality of the corresponding video resource file is lower to achieve the effect of reducing power consumption.
  • the optimization information of the corresponding video resource file The better, to improve the playback effect of video resource files.
  • Step S540 Control the graphics processor to render the video resource file based on the rendering parameters.
  • the graphics processor may be controlled to render the video resource file based on the rendering parameter. Understandably, the graphics controller may decode the video resource file to obtain multiple video frames, and then render the multiple video frames based on the rendering parameters.
  • Step S550 When the power consumption is not higher than the power consumption threshold, control the central processor or the graphics processor to decode and render the video resource file.
  • the decoding and rendering of the video resource file by the CPU will not cause excessive power consumption of the electronic device, that is, the decoding and rendering of the video resource file by the CPU It will not affect the playback of video resource files, so you can control the CPU or GPU to decode and render the video resource files.
  • the CPU decode and render the video resource file can use on-screen rendering, or can use off-screen rendering to decode and synthesize the multi-frame image data obtained after decoding the CPU and display it on the screen, which is not limited here.
  • the power consumption of the electronic device is detected to determine whether the power consumption is higher than the power consumption threshold, and when the power consumption is higher than the power consumption threshold , Determine the rendering parameter corresponding to the power consumption, control the graphics processor to render the video resource file based on the rendering parameter, and when the power consumption is not higher than the power consumption threshold, control the central processor or graphics processor to the video resource file Decode and render.
  • the video resource file is rendered by the rendering parameters of the power consumption video, and the power consumption is not higher than the power consumption At the threshold, control the central processor or graphics processor to decode and render the video resource file to improve the rationality of rendering.
  • FIG. 8 shows a block diagram of a video processing apparatus 200 provided by an embodiment of the present application.
  • the video processing apparatus 200 is applied to the above-mentioned electronic equipment.
  • the electronic equipment includes a central processing unit and a graphics processor.
  • the block diagram shown in FIG. 8 will be described below.
  • the video processing apparatus 200 includes: a detection module 210 and a judgment module 220 And the processing module 230, in which:
  • the detection module 210 is configured to detect the power consumption of the electronic device when the electronic device plays a video resource file. Further, the electronic device further includes a screen, and the detection module 210 includes: a brightness detection sub-module and a volume detection sub-module, wherein: a brightness detection sub-module and a volume detection sub-module, wherein:
  • the brightness detection sub-module is used to detect the brightness of the screen.
  • the volume detection sub-module is used to detect the volume of the electronic device.
  • the determining module 220 is configured to determine whether the power consumption is higher than a power consumption threshold. Further, the judgment module 220 includes: a brightness judgment sub-module, a brightness determination sub-module, a volume determination sub-module, and a volume determination sub-module, wherein:
  • the brightness judgment sub-module is used to judge whether the brightness is higher than a brightness threshold.
  • the brightness determination submodule is configured to determine that the power consumption is higher than the power consumption threshold when the brightness is higher than the brightness threshold.
  • the volume judgment submodule is used to judge whether the volume is higher than a volume threshold.
  • the volume determination sub-module is configured to determine that the power consumption is higher than the power consumption threshold when the volume is higher than the volume threshold.
  • the processing module 230 is configured to control the graphics processor to decode and render the video resource file when the power consumption is higher than the power consumption threshold. Further, the processing module 230 includes: a detection submodule, a switching submodule, a monitoring submodule, a first control submodule, a rendering parameter determination submodule, and a second control submodule, wherein:
  • the detection submodule is configured to detect whether the central processing unit decodes and renders the video resource file when the power consumption is higher than the power consumption threshold.
  • the switching submodule is configured to switch to the graphics processor to decode and render the video resource file when the central processor decodes and renders the video resource file.
  • the monitoring submodule is configured to output prompt information and monitor input information when the brightness is higher than the brightness threshold.
  • the first control submodule is configured to control the graphics processor to decode and decode the video resource file when input information indicating that the brightness of the screen remains unchanged or input information is not heard within the duration threshold Render.
  • the rendering parameter determination submodule is configured to determine a rendering parameter corresponding to the power consumption when the power consumption is higher than the power consumption threshold. Further, the rendering parameter determination sub-module includes: a determination unit, a first determination unit, and a second determination unit, wherein:
  • the determining unit is configured to determine whether the power consumption is higher than a set threshold when the power consumption is higher than the power consumption threshold, wherein the set threshold is greater than the power consumption threshold.
  • the first determining unit is configured to determine a first rendering parameter corresponding to the power consumption when the power consumption is not higher than the set threshold.
  • a second determining unit configured to determine a second rendering parameter corresponding to the power consumption when the power consumption is higher than the set threshold, wherein the picture optimization quality corresponding to the first rendering parameter is better than all Picture optimization quality corresponding to the second rendering parameter.
  • the second control submodule is configured to control the graphics processor to render the video resource file based on the rendering parameters.
  • the video processing device 200 further includes: a control module, wherein:
  • the control module is configured to control the central processor or the graphics processor to decode and render the video resource file when the power consumption is not higher than the power consumption threshold.
  • the coupling between the modules may be electrical, mechanical, or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above integrated modules may be implemented in the form of hardware or software function modules.
  • FIG. 9 shows a structural block diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may be an electronic device capable of running an application program, such as a smart phone, a tablet computer, an e-book.
  • the electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, a screen 130, a codec 140, and one or more application programs, where one or more application programs may be stored in the memory In 120 and configured to be executed by one or more processors 110, one or more programs are configured to perform the method as described in the foregoing method embodiments.
  • the processor 110 may include one or more processing cores.
  • the processor 110 connects various parts of the entire electronic device 100 by using various interfaces and lines, executes or executes instructions, programs, code sets or instruction sets stored in the memory 120, and calls data stored in the memory 120 to execute Various functions and processing data of the electronic device 100.
  • the processor 110 may use at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA programmable logic array
  • the processor 110 may integrate one or a combination of one of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), and a modem.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • modem modem
  • CPU mainly deals with operating system, user interface and application program, etc.
  • GPU is used for rendering and rendering of display content
  • modem is used for handling wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 110, and may be implemented by a communication chip alone.
  • the processor 110 may include one or a combination of one of a central processor 111 (Central Processing Unit, CPU), an image processor 112 (Graphics Processing Unit, GPU), and a modem.
  • CPU Central Processing Unit
  • image processor 112 Graphics Processing Unit
  • modem is used to handle wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 110, and may be implemented by a communication chip alone.
  • the memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets.
  • the memory 120 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , Instructions for implementing the following method embodiments.
  • the storage data area may also store data created by the terminal 100 in use (such as a phone book, audio and video data, and chat history data).
  • the codec 140 can be used to encode or decode video data, and then transmit the decoded video data to the screen 130 for display, where the codec 140 can be a GPU, a dedicated DSP, FPGA, or ASIG chip Wait.
  • FIG. 10 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer readable medium 300 stores program codes, and the program codes can be called by a processor to execute the method described in the above method embodiments.
  • the computer-readable storage medium 300 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 300 has a storage space for the program code 310 that performs any of the method steps described above. These program codes can be read from or written into one or more computer program products.
  • the program code 310 may be compressed in an appropriate form, for example.
  • the video processing method, apparatus, electronic device and storage medium provided by the embodiments of the present application, when the electronic device plays a video resource file, detect the power consumption of the electronic device to determine whether the power consumption is higher than the power consumption Threshold, when the power consumption is higher than the power consumption threshold, the graphics processor is controlled to decode and render the video resource file, so that when the power consumption of the electronic device is higher than the power consumption threshold, the graphics processor is controlled to the video resource
  • the file is decoded and rendered to reduce the power consumption of the central processor and improve the playback effect of the video resource file.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Human Computer Interaction (AREA)
  • Computer Hardware Design (AREA)
  • Computer Graphics (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

本申请实施例公开了一种视频处理方法、装置、电子设备以及存储介质,涉及电子设备技术领域。该方法应用于电子设备,电子设备包括中央处理器和图形处理器,所述方法包括:当该电子设备播放视频资源文件时,检测该电子设备的功耗,判断该功耗是否高于功耗阈值,当该功耗高于该功耗阈值时,控制该图形处理器对视频资源文件进行解码和渲染。本申请实施例提供的视频处理方法、装置、电子设备以及存储介质通过在电子设备的功耗高于功耗阈值时,控制图形处理器对视频资源文件进行解码和渲染,以降低中央处理器的功耗,提升视频资源文件的播放效果。

Description

视频处理方法、装置、电子设备以及存储介质
相关申请的交叉引用
本申请要求于2018年11月27日提交的申请号为CN201811427995.4的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及电子设备技术领域,更具体地,涉及一种视频处理方法、装置、电子设备以及存储介质。
背景技术
随着科学技术的发展,电子设备已经成为人们日常生活中最常用的电子产品之一。并且,用户经常会通过电子设备玩游戏、看视频等。
发明内容
鉴于上述问题,本申请提出了一种视频处理方法、装置、电子设备以及存储介质,以解决上述问题。
第一方面,本申请实施例提供了一种视频处理方法,应用于电子设备,所述电子设备包括中央处理器和图形处理器,所述方法包括:当所述电子设备播放视频资源文件时,检测所述电子设备的功耗;判断所述功耗是否高于功耗阈值;当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
第二方面,本申请实施例提供了一种视频处理装置,应用于电子设备,所述电子设备包括中央处理器和图形处理器,所述装置包括:检测模块,用于当所述电子设备播放视频资源文件时,检测所述电子设备的功耗;判断模块,用于判断所述功耗是否高于功耗阈值;处理模块,用于当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
第三方面,本申请实施例提供了一种电子设备,包括存中央处理器和图形处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述中央处理器执行,所述一个或多个程序配置用于执行上述方法。
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1示出了本申请实施例提供的视频播放的流程示意图;
图2示出了本申请一个实施例提供的视频处理方法的流程示意图;
图3示出了本申请又一个实施例提供的视频处理方法的流程示意图;
图4示出了本申请再一个实施例提供的视频处理方法的流程示意图;
图5示出了本申请另一个实施例提供的视频处理方法的流程示意图;
图6示出了本申请又再一个实施例提供的视频处理方法的流程示意图;
图7示出了本申请的图6所示的视频处理方法的步骤S530的流程示意图;
图8示出了本申请实施例提供的视频处理装置的模块框图;
图9示出了本申请实施例用于执行根据本申请实施例的视频处理方法的电子设备的框图;
图10示出了本申请实施例的用于保存或者携带实现根据本申请实施例的视频处理方法的程序代码的存储单元。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
请参阅图1,图1示出了视频播放的流程。具体地,操作系统在获取到待播放的数据的时候,接下来的工作就是解析音视频数据。一般的视频文件都由视频流和音频流两部分组成,不同的视频格式音视频的封装格式不一样。将音频流和视频流合成文件的过程称为muxer,反之从媒体文件中分离音频流和视频流的过程称为demuxer。播放视频文件就需要从文件流中分离出音频流和视频流,分别对其进行解码,解码后的视频帧可以直接渲染,音频帧可以送到音频输出设备的缓冲区进行播放,当然,视频渲染和音频播放的时间戳需要控制同步。
具体地,视频解码可以包括硬解码和软解码,硬件解码是将原来全部交由中央处理器(Central Processing Unit,CPU)来处理的视频数据的一部分交由图形处理器(Graphics Processing Unit,GPU)来做,而GPU的并行运算能力要远远高于CPU,这样可以大大的降低对CPU的负载,CPU的占用率较低了之后就可以同时运行一些其他的程序了,当然,对于较好的处理器来说,比如i5 2320,或者AMD任何一款四核心处理器来说,既可以进行硬解码,也可以进行软解码。
具体地,如图1所示,多媒体框架(Media Framework)通过与客户端的API接口获取客户端待播放的视频文件,并交由视频编解码器(Video Decode),其中,Media Framework为Android系统中多媒体框架,MediaPlayer、MediaPlayerService和Stagefrightplayer三个部分构成了Android多媒体的基本框架。多媒体框架部分采用了C/S的结构,MediaPlayer作为C/S结构的Client端,MediaPlayerService和Stagefrightplayer作为C/S结构Server端,承担着播放多媒体文件的责任,通过Stagefrightplayer,Server端完成Client端的请求并做出响应。Video Decode是一款集成了最常用的音频和视频解码与播放的超级解码器,用于将视频数据解码。
其中,软解码,即通过软件让CPU来对视频进行解码处理。而硬解码,指不借助于CPU,而通过专用的子卡设备来独立完成视频解码任务。
不论是硬解码还是软解码,在将视频数据解码之后,会将解码后的视频数据发送至图层传递模块(SurfaceFlinger),由SurfaceFlinger将解码后的视频数据渲染和合成之后,在显示屏上显示。其中,SurfaceFlinger是一个独立的Service,它接收所有Window的Surface作为输入,根据ZOrder、透明度、大小、位置等参数,计算出每个Surface在最终合成图像中的位置,然后交由HWComposer或OpenGL生成最终的显示Buffer,然后显示到特定的显示设备上。
如图1所示,软解码中,CPU将视频数据解码之后交给SurfaceFlinger渲染和合成,而硬解码由GPU解码之后,交由SurfaceFlinger渲染和合成。而SurfaceFlinger会调用GPU实现图像的渲染和合成,并在显示屏上显示。
作为一种实施方式,在图像渲染的过程中,CPU获取客户端发送的视频资源文件,对视频资源文件解码之后获取解码之后的视频数据,再将视频数据发送至GPU,GPU渲染完成后将渲染结果放入帧缓冲区,随后视频控制器会按照HSync信号逐行读取帧缓冲区的数据,经过数模转换传递给显示器显示。
具体地,CPU在获取到视频资源文件的时候,可以选择使用CPU将待播放视频文件解码,然后将解码后的数据发送至SurfaceFlinger渲染和合成之后显示,也可以是,CPU将视频资源文件发送至GPU,由GPU的图像处理电路对视频资源文件解码之后,发送至SurfaceFlinger渲染和合成之后显示。目前普遍默认采用的是CPU渲染模式,但是由于CPU还需要处理大量其他的操作,因此,将CPU用于视频渲染,会无形中给电子设备的资源造成没必要的浪费。而如果默认采用GPU渲染模式,虽然GPU处理图像能够减缓CPU的负载压力,但是,GPU处理会占用大量内存,导致现在对选择图像处理器还是中央处理器 处理视频文件不够合理。
针对上述问题,发明人经过长期的研究发现,并提出了本申请实施例提供的视频处理方法、装置、电子设备以及存储介质,通过在电子设备的功耗高于功耗阈值时,控制图形处理器对视频资源文件进行解码和渲染,以降低中央处理器的功耗,提升视频资源文件的播放效果。其中,具体的视频处理方法在后续的实施例中进行详细的说明。
实施例
请参阅图2,图2示出了本申请一个实施例提供的视频处理方法的流程示意图。所述视频处理方法用于通过在电子设备的功耗高于功耗阈值时,控制图形处理器对视频资源文件进行解码和渲染,以降低中央处理器的功耗,提升视频资源文件的播放效果。在具体的实施例中,所述视频处理方法应用于如图8所示的视频处理装置200以及配置有所述视频处理装置200的电子设备100(图9)。下面将以电子设备为例,说明本实施例的具体流程,其中,该电子设备包括图形处理器和中央处理器,当然,可以理解的,本实施例所应用的电子设备可以为智能手机、平板电脑、穿戴式电子设备、车载设备、网关等,在此不做具体的限定。下面将针对图2所示的流程进行详细的阐述,所述视频处理方法具体可以包括以下步骤:
步骤S110:当所述电子设备播放视频资源文件时,检测所述电子设备的功耗。
在本实施例中,电子设备播放的视频资源文件可以包括在电子设备的前台播放的视频资源文件、在电子设备的后台播放的视频资源文件以及在电子设备的前台和后台切换播放的视频资源文件,在此不做具体的限定。其中,前台播放的视频资源文件是指通常可以和用户进行交互,能在前台显示的视频资源文件,当它不可见时就会被挂起;后台播放的视频资源文件是指和用户交互非常有限,除了配置期间,其生存期的其他时间都是隐藏的;在电子设备的前台和后台切换播放的视频资源文件是指可以在前台以及后台之间随意切换的视频资源文件。可选的,在本实施例中,所述电子设备播放的视频资源文件为在所述电子设备的前台播放的视频资源文件。
其中,该视频资源文件可以为本地资源文件,也可以为网络资源文件,在此不做限定。具体地,若所述视频资源文件为本地资源文件,那么,该视频资源文件可以由电子设备预先从服务器下载并存储在本地,在播放所述视频资源文件时,电子设备可以直接从本地读取并播放,例如,可以直接从电子设备的内存的读取并播放。作为另一种方式,若所述视频资源文件为网络资源文件,那么,该视频资源文件可以由电子设备从服务器在线获取并播放,其中,电子设备可以通过无线网络从服务器在线获取视频资源文件,也可以通过数据网络从服务器在线获取视频资源文件,在此不做限定,其中,数据网络可以包括2G网络、3G网络、4G网络或5G网络。
另外,当视频资源文件为网络资源文件时,电子设备可以安装有视频播放类应用程序,并在电子设备的桌面显示该视频播放类应用程序对应的应用程序图标,当检测到用户针对该应用程序图标的触控操作时,电子设备可以作为响应运行该视频播放类应用程序,并通过网络从服务器获取视频资源文件并播放;作为另一种方式,电子设备可以安装有浏览器,并基于用户操作通过该浏览器的网页进入视频播放界面,并在该视频播放界面下从服务器获取视频资源文件并播放。
在本实施例中,当确定电子设备播放视频资源文件时,可以对电子设备的功耗进行检测,其中,电子设备的功耗为输入功率和输出功率的差额,即功率的损耗。通常,电子设备的功耗包括CPU功耗、GPU功耗等,其中,以CPU功耗为例,CPU功耗可以理解为热设计(Thermal Design Power,TDP)功耗,是反映中央处理器热量释放的指标,含义是当中央处理器达到负荷最大的时候,释放出的热量,单位为瓦(W),进一步地,TDP是反映处理器热量释放的指标,是电子设备的冷却系统必须有能力驱散的最大热量限度,另外,TDP是CPU电流热效应以及CPU工作时产生的其他热量,TDP功耗通常作为电子设备的主板设计、散热系统设计、散热设计等散热/降耗设计的重要参考指标,TDP越大,表明CPU在工作时会产生的热量越大,对于散热系统来说,就需要将TDP作为散热能力设计的最低指标/基本指标。作为一种 方式,可以通过电子设备已安装的功耗测试类的应用程序对电子设备的功耗进行检测,从而可以获取所述电子设备的功耗,在此不再赘述。
步骤S120:判断所述功耗是否高于功耗阈值。
在本实施例中,电子设备设置有功耗阈值,该功耗阈值用于作为电子设备的功耗的判断依据。其中,可以理解的,该功耗阈值可以由电子设备预先存储在本地,也可以在判断时再进行设置,在此不做限定。另外,该功耗阈值可以由电子设备自动配置、可以由用户手动设置、也可以由服务器配置完成后再传输至电子设备,在此不做限定。作为一种方式,在获取所述电子设备的功耗后,将该功耗与功耗阈值进行比较,以判断该功耗是否高于该功耗阈值。
步骤S130:当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
其中,当判断结果表征电子设备的功耗高于功耗阈值时,表征如果继续通过电子设备的CPU对视频播放资源进行处理,会影响视频资源文件的播放效果,例如,会出现卡顿、闪屏的问题,因此,作为一种方式,可以控制GPU对视频资源文件进行解码和渲染,以降低CPU的工作频率,保证视频资源文件的正常播放和电子设备的正常运行。作为一种方式,GPU将所述视频资源文件解码,从而可以获得视频资源文件对应的多帧图像数据,即视频帧数据。具体地,CPU调用播放模块将视频资源文件进行解析,从而获取该视频资源文件对应的视频流和音频流。其中,播放模块可以是安卓系统内的MediaExtractor模块,也可以是FFmpeg模块,其中,FFmpeg模块是一个开源的跨平台的视频和音频流框架,属于自由软件,采用LGPL或GPL许可证(依据选择的组件)。它提供了录制、转换以及流化音视频的完整解决方案,并且它包含了丰富的音频/视频编解码库libavcodec。
然后,CPU将视频流发送至GPU,GPU将视频流解码之后,获取到该视频流对应的多帧图像数据,然后,对该多帧图像数据合成,具体地,合成方式可以是在预先设置的帧缓冲区内合成,即通过在屏渲染的方式对多帧图像数据渲染合成,也可以是通过离屏渲染的方式对多帧图像数据渲染合成。
作为一种实施方式,预先在GPU内设置一个离屏渲染缓冲区,具体地,GPU会调用渲染客户端模块对待渲染的多帧图像数据渲染合成之后发送至显示屏上显示,具体地,该渲染客户端模块可以是OpenGL模块。OpenGL渲染模块的最终位置是在帧缓冲区中。帧缓冲区是一系列二维的像素存储数组,包括了颜色缓冲区、深度缓冲区、模板缓冲区以及累积缓冲区。默认情况下OpenGL使用的是窗口系统提供的帧缓冲区。
OpenGL的GL_ARB_framebuffer_object这个扩展提供了一种方式来创建额外的帧缓冲区对象(Frame Buffer Object,FBO)。使用帧缓冲区对象,OpenGL可以将原先绘制到窗口提供的帧缓冲区重定向到FBO之中。
则通过FBO在帧缓冲区之外再设置一个缓冲区,即离屏渲染缓冲区。然后,将所获取的多帧图像数据存储至离屏渲染缓冲区。具体地,离屏渲染缓冲区可以是对应GPU的一个存储空间,即离屏渲染缓冲区本身没有用于存储图像的空间,而是与图形处理器内的一个存储空间映射之后,图像实际存储在离屏渲染缓冲区对应的图形处理器内的一个存储空间内。
将多帧图像数据与离屏渲染缓冲区绑定的方式,就能够将多帧图像数据存储至离屏渲染缓冲区,即在离屏渲染缓冲区能够查找到多帧图像数据。
则在将多帧图像数据存储至离屏渲染缓冲区之后,可以在离屏渲染缓冲区对多帧图像数据进行渲染,具体地,可以对多帧缓冲数据做显示增强处理,例如,对所述离屏渲染缓冲区内的多帧图像数据的图像参数优化,其中,所述图像参数优化包括曝光度增强、去噪、边缘锐化、对比度增加或饱和度增加的至少一种。
具体地,电子设备显示的视频资源文件为经过解码后的图像内容,由于经过解码之后的图像内容为RGBA格式的数据,为了对图像内容优化,需要将RGBA格式的数据转换为HSV格式,具体地,获取图像内容的直方图,对直方图统计从而获取将RGBA格式的数据转换为HSV格式的参数,在根据该参数将RGBA格式的数据转换为HSV格式。
其中,曝光度增强,用于提高图像的亮度,则可以通过图像的直方图,将亮度值交底的区域增加亮度值,另外,也可以是通过非线性叠加,增加图像亮度,具体地,I表示要处理的较暗图像,T表示处理后的比较亮的图像,则曝光度增强的方式为T(x)=I(x)+(1-I(x))*I(x)。其中,T和I都是[0,1]取值的图像。如果一次效果不好算法可以多次迭代。
其中,对图像内容去噪用于去除图像的噪声,具体地,图像在生成和传输过程中常常因受到各种噪声的干扰和影响而是图像降质,这对后续图像的处理和图像视觉效应将产生不利影响。噪声种类很多,比如:电噪声,机械噪声,信道噪声和其他噪声。因此,为了抑制噪声,改善图像质量,便于更高层次的处理,必须对图像进行去噪预处理。从噪声的概率分布情况来看,可分为高斯噪声、瑞利噪声、伽马噪声、指数噪声和均匀噪声。
具体地,可以通过高斯滤波器对图像去噪,其中,高斯滤波器是一种线性滤波器,能够有效的抑制噪声,平滑图像。其作用原理和均值滤波器类似,都是取滤波器窗口内的像素的均值作为输出。其窗口模板的系数和均值滤波器不同,均值滤波器的模板系数都是相同的为1;而高斯滤波器的模板系数,则随着距离模板中心的增大而系数减小。所以,高斯滤波器相比于均值滤波器对图像模糊程度较小。
例如,产生一个5×5的高斯滤波窗口,以模板的中心位置为坐标原点进行取样。将模板各个位置的坐标带入高斯函数,得到的值就是模板的系数。再将该高斯滤波窗口与图像卷积就能够对图像去噪。
其中,边缘锐化用于使模糊的图像变得更加清晰起来。图像锐化一般有两种方法:一种是微分法,另外一种是高通滤波法。
其中,对比度增加用于增强图像的画质,使得图像内的颜色更加鲜明,具体地,对比度拉伸是图像增强的一种方法,也属于灰度变换操作。通过灰度变换,将灰度值拉伸到整个0-255的区间,那么其对比度显然是大幅增强的。可以用如下的公式来将某个像素的灰度值映射到更大的灰度空间:
I(x,y)=[(I(x,y)-Imin)/(Imax-Imin)](MAX-MIN)+MIN;
其中Imin,Imax是原始图像的最小灰度值和最大灰度值,MIN和MAX是要拉伸到的灰度空间的灰度最小值和最大值。
然后,在完成多帧图像数据的渲染后,可以将多帧图像数据发送至所述屏幕对应的帧缓冲区,其中,帧缓冲区对应于屏幕,用于存放需要在屏幕上显示的数据,例如Framebuffer,Framebuffer是出现在操作系统内核当中的一种驱动程序接口。以安卓系统为例,Linux是工作在保护模式下,所以用户态进程是无法像DOS系统那样,使用显卡BIOS里提供的中断调用来实现直接将数据写入并在屏幕上显示,Linux抽象出Framebuffer这个设备来供用户进程实现直接将数据写入并在屏幕上显示。Framebuffer机制模仿显卡的功能,可以通过Framebuffer的读写直接对显存进行操作。具体地,可以将Framebuffer看成是显示内存的一个映像,将其映射到进程地址空间之后,就可以直接进行读写操作,而写入的数据可以在屏幕上显示。
则帧缓冲区可以看作是一个存放数据的空间,CPU或者GPU将要显示的数据放入该帧缓冲区,而Framebuffer本身不具备任何运算数据的能力,由视频控制器按照屏幕刷新频率读取Framebuffer内的数据在屏幕上显示。
由所述帧缓冲区内读取多帧图像数据,并在所述屏幕上显示。具体地,将多帧图像数据存入帧缓冲区内之后,图形处理器检测到帧缓冲区内写入数据之后,就由所述帧缓冲区内读取优化后的多帧图像数据,并在所述屏幕上显示。
作为一种实施方式,GPU会根据屏幕的刷新频率由所述帧缓冲区内逐帧读取多帧图像数据,并经渲染合成处理后在所述屏幕上显示。
本申请一个实施例提供的视频处理方法,当该电子设备播放视频资源文件时,检测该电子设备的功耗,判断该功耗是否高于功耗阈值,当该功耗高于该功耗阈值时,控制该图形处理器对视频资源文件进行解码和渲染,从而通过在电子设备的功耗高于功耗阈值时,控制图 形处理器对视频资源文件进行解码和渲染,以降低中央处理器的功耗,提升视频资源文件的播放效果。
请参阅图3,图3示出了本申请又一个实施例提供的视频处理方法的流程示意图。下面将针对图3所示的流程进行详细的阐述,所述视频处理方法具体可以包括以下步骤:
步骤S210:当所述电子设备播放视频资源文件时,检测所述电子设备的功耗。
步骤S220:判断所述功耗是否高于功耗阈值。
其中,步骤S210-步骤S220的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S230:当所述功耗高于所述功耗阈值时,检测所述中央处理器是否对所述视频资源文件进行解码和渲染。
其中,电子设备可以通过CPU对视频资源文件进行解码和渲染,也可以通过GPU对视频资源文件进行解码和渲染,因此,在本实施例中,当判断结果表征该电子设备的功耗高于功耗阈值时,可以检测对视频资源文件进行解码和渲染的主体,即检测CPU是否对视频资源文件进行解码和渲染,或者检测GPU是否对视频资源文件进行解码和渲染,亦或检测CPU和GPU是否同时对视频资源文件进行解码和渲染,其中,当CPU和GPU同时对视频资源文件进行解码和渲染时,那么,CPU和GPU可以同时对视频资源文件的不同视频帧进行处理。
步骤S240:当所述中央处理器对所述视频资源文件进行解码和渲染时,切换至所述图形处理器对所述视频资源文件进行解码和渲染。
其中,当检测到CPU对视频资源文件进行解码和渲染,或者检测到CPU和GPU同时对视频资源文件进行解码和渲染时,表征CPU参与了视频资源文件的解码和渲染。因此,为了降低CPU的工作频率,以及保证视频资源文件的解码和渲染效果,可以切换至所述图形处理器对视频资源文件进行解码和渲染。具体地,当所述视频资源文件初始由CPU进行解码和渲染时,可以禁止CPU继续对剩余的待播放视频资源文件进行解码和渲染,而切换至GPU对待播放视频资源文件进行解码和渲染;当所述视频资源文件初始由CPU和GPU同时进行解码和渲染时,则将剩余的待播放视频资源文件中由所述CPU进行解码和渲染的视频帧切换为由GPU解码和渲染,从而达到降低CPU工作频率的效果。
本申请又一个实施例提供的视频处理方法,当电子设备播放视频资源文件时,检测该电子设备的功耗,判断该功耗是否高于功耗阈值,当该功耗高于功耗阈值时,检测该中央处理器是否对视频资源文件进行解码和渲染,当该中央处理器对视频资源文件进行解码和渲染时,切换至图形处理器对视频资源文件进行解码和渲染。相较于图2所示的视频处理方法,本实施例在功耗高于功耗阈值且中央处理器对视频资源文件进行解码和渲染时,再通过图形处理器对视频资源文件进行解码和渲染,以降低中央处理器的功耗,提升视频资源文件的播放效果。
请参阅图4,图4示出了本申请再一个实施例提供的视频处理方法的流程示意图。其中,该电子设备还包括屏幕,下面将针对图4所示的流程进行详细的阐述,所述视频处理方法具体可以包括以下步骤:
步骤S310:当所述电子设备播放视频资源文件时,检测所述屏幕的亮度。
作为一种方式,电子设备包括屏幕,其中,该屏幕的可显示区域可以用于显示文本、图片、图标或者视频等内容,于本实施例中,所述屏幕用于显示视频资源文件。而伴随着触控技术的发展,越来越多的电子设备所设置的屏幕也可以为触摸屏,在设置触摸屏的情况下,当检测到用户在触摸屏上进行拖曳、单击、双击、滑动等触控操作时,该电子设备可以对用户的触控操作进行响应。
在本实施例中,电子设备的屏幕在显示视频资源文件时会被点亮,并且当所述电子设备的屏幕的亮度过高时,会造成电子设备过大的功耗,因此,可以通过判断电子设备的屏幕的亮度是否过高的方式来判断电子设备的功耗是否过大,作为一种方式,当确定所述电子设备播放视频资源文件时,可以对电子设备的屏幕的亮度进行检测,可选的,可以通过电子设备内置的亮度检测模块或亮度检测类应用程序对电子设备的屏幕的亮度进行检测,在此不再赘 述。
步骤S320:判断所述亮度是否高于亮度阈值。
其中,电子设备设置有亮度阈值,该亮度阈值用于作为电子设备的屏幕的亮度的判断依据。其中,可以理解的,该亮度阈值可以由电子设备预先存储在本地,也可以在判断时再进行设置,在此不做限定。另外,该亮度阈值可以由电子设备自动设置、可以由用户手动设置、也可以由服务器配置完成后再传输至电子设备,在此不做限定。作为一种方式,在获取所述电子设备的亮度阈值后,将该电子设备的屏幕的亮度与该亮度阈值进行比较,以判断该屏幕的亮度是否高于该亮度阈值。
步骤S330:当所述亮度高于所述亮度阈值时,确定所述功耗高于所述功耗阈值。
在本实施例中,当判断结果表征该屏幕的亮度不高于该亮度阈值时,表征该屏幕的亮度所带来的功耗较低,因此,可以确定该电子设备的功耗不高于该功耗阈值。相反的,当判断结果表征该屏幕的亮度高于该亮度阈值时,表征该屏幕的亮度所带来的功耗过高,因此,可以确定该电子设备的功耗高于功耗阈值。
步骤S340:输出提示信息并监听输入信息。
作为一种方式,当确定所述电子设备的屏幕的亮度高于亮度阈值,即确定电子设备的功耗高于功耗阈值时,电子设备可以输出提示信息,其中,该提示信息可以以语音的形式输出、可以以图文的形式输出、也可以以传输到其他电子设备的形式输出,在此不做限定。另外,输出的提示信息可以用于提示电子设备对应的用户该电子设备的屏幕过亮或电子设备的功耗过大,以便用户基于该提示信息做出响应,当然,该提示信息还可以包括选择信息,例如,该选择信息可以包括“是否调低电子设备的功耗”或“是否调低电子设备的屏幕的亮度”等,以便用户基于该选择信息触发选择操作。
进一步地,电子设备发出提示信息之后,可以对基于该提示信息的输入信息进行监听。具体地,可以对用户基于该提示信息的输入的文字信息、语音信息以及选择操作进行监听,在此不做限定。作为一种方式,以监听选择操作为例,电子设备对作用于多个选择信息对应的多个选择控件上的选择操作进行监听,并且在监听到用户触发的选择操作时,接收该选择操作,其中,该选择操作可以为触控操作,该触控操作至少可以包括单指点击、多指点击、单指长按、多指长按、重压、多次点击、滑动操作等。
步骤S350:当监听到指示保持所述屏幕的亮度不变的输入信息或在时长阈值内没有监听到输入信息时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
其中,用户基于该提示信息,可以选择进行信息的输入以指示电子设备是否降低屏幕的亮度,也可以选择不进行信息的输入,也就是说,电子设备可能接收到输入信息,也可能不会接收到输入信息。因此,作为一种方式,电子设备可以设置有时长阈值,同样的,该时长阈值可以由电子设备预先存储在本地,也可以在检测时再进行设置,另外,该时长阈值可以由电子设备自动配置、可以由用户手动设置、也可以由服务器配置完成后再传输至电子设备,在此不做限定,进一步地,若在所述时长阈值内没有监听到输入信息时,表征用户期望电子设备保持屏幕当前的亮度,因此,可以自动控制该GPU对视频资源文件进行解码和渲染,以实现电子设备保持屏幕当前的亮度的同时,降低CPU的工作频率,提升视频资源文件的播放效果。
同样,若监听到用户输入的输入信息,且该输入信息用于指示保持屏幕当前的亮度不变时,表征用户期望继续在该屏幕亮度的情况下观看该视频资源文件,因此,可以自动控制该GPU对视频资源文件进行解码和渲染,以自动实现电子设备保持屏幕当前的亮度的同时,降低CPU的工作频率,提升视频资源文件的播放效果。
本申请再一个实施例提供的视频处理方法,当电子设备播放视频资源文件时,检测该屏幕的亮度,判断该亮度是否高于亮度阈值,当该亮度高于亮度阈值时,确定该功耗高于功耗阈值,输出提示信息并监听输入信息,当监听到指示保持屏幕的亮度不变的输入信息或在时长阈值内没有监听到输入信息时,控制图形处理器对该视频资源文件进行解码和渲染。相较 于图2所示的视频处理方法,本实施例在屏幕的亮度高于亮度阈值时确定功耗高于功耗阈值并输出提示信息,并根据用户的选择控制图形处理器对视频资源文件进行解码和渲染,提升适应性和用户体现。
请参阅图5,图5示出了本申请另一个实施例提供的视频处理方法的流程示意图。下面将针对图5所示的流程进行详细的阐述,所述视频处理方法具体可以包括以下步骤:
步骤S410:当所述电子设备播放视频资源文件时,检测所述电子设备的音量。
作为一种方式,由于视频资源文件同时包括图像资源文件和音频资源文件,因此,当电子设备的屏幕显示图像资源文件时,电子设备可以通过扬声器、麦克风或耳机等输出音频资源文件,其中,当所述电子设备输出的音量过大时,会造成电子设备过大的功耗,因此,可以通过判断电子设备的音量是否过大的方式来判断电子设备的功耗是否过大,作为一种方式,当确定电子设备播放视频资源文件时,可以对电子设备的音量进行检测,可选的,可以通过电子设备内置的音量检测模块或音量检测类应用程序对电子设备的音量进行检测。
步骤S420:判断所述音量是否高于音量阈值。
其中,电子设备可以设置有音量阈值,该音量阈值用于作为电子设备的音量的判断依据。其中,可以理解的,该音量阈值可以由电子设备预先存储在本地,也可以在判断时再进行设置,在此不做限定。另外,该音量阈值可以由电子设备自动设置、可以由用户手动设置、也可以由服务器配置完成后再传输至电子设备,在此不做限定。作为一种方式,在获取所述电子设备的音量阈值后,将该电子设备的音量与该音量阈值进行比较,以判断该电子设备的音量是否高于该音量阈值。
步骤S430:当所述音量高于所述音量阈值时,确定所述功耗高于所述功耗阈值。
在本实施例中,当判断结果表征该电子设备的音量不高于该音量阈值时,表征该电子设备的音量所带来的功耗较低,因此,可以确定该电子设备的功耗不高于该功耗阈值。相反的,当判断结果表征该电子设备的音量高于音量阈值时,表征该电子设备的音量所带来的功耗较高,因此,可以确定该电子设备的功耗高于功耗阈值。
步骤S440:控制所述图形处理器对所述视频资源文件进行解码和渲染。
同样的,当确定该电子设备的音量高于音量阈值时,可以输出提示信息和监听输入信息,并在监听到支持保持该电子设备的音量不变或在时长阈值内没有监听到输入信息时,控制该图形处理器对视频资源文件进行解码和渲染。其中,具体实现方式请参阅步骤S350,在此不再赘述。
本申请另一个实施例提供的视频处理方法,当电子设备播放视频资源文件时,检测该电子设备的音量,判断该音量是否高于音量阈值,当该音量高于音量阈值时,确定该功耗高于功耗阈值,控制图形处理器对视频资源文件进行解码和渲染。相较于图2所示的视频处理方法,本实施例还在电子设备的音量高于音量阈值时确定功耗高于功耗阈值,再通过图形处理器对视频资源文件进行解码和渲染,提升显示效果。
请参阅图6,图6示出了本申请又再一个实施例提供的视频处理方法的流程示意图。下面将针对图6所示的流程进行详细的阐述,所述视频处理方法具体可以包括以下步骤:
步骤S510:当所述电子设备播放视频资源文件时,检测所述电子设备的功耗。
步骤S520:判断所述功耗是否高于功耗阈值。
其中,步骤S510-步骤S520的具体描述请参阅步骤S110-步骤S120,在此不再赘述。
步骤S530:当所述功耗高于所述功耗阈值时,确定与所述功耗对应的渲染参数。
其中,电子设备可以存储有多个功耗和多个渲染参数,以及存储有多个功耗和多个渲染参数之间的对应关系,其中,该对应关系可以包括一个功耗对应一个渲染参数或多个渲染参数,也可以包括一个渲染参数对应一个或多个功耗,在此不做限定。其中,功耗和渲染参数之间的对应关系可以由用户预先设定后存储在电子设备、可以由电子设备预先自动设定后存储、也可以由服务器预先设定完成后发送至电子设备,在此不做限定。其中,在本实施例中,所述多个渲染参数中的每个渲染参数对视频资源文件的渲染效果或优化效果可以不同,也就 是说,通过所述多个渲染参数中的每个渲染参数对同一视频资源文件进行处理,所达到的渲染效果可以不同。
请参阅图7,图7示出了本申请的图6所示的视频处理方法的步骤S530的流程示意图。下面将针对图7所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S531:当所述功耗高于所述功耗阈值时,判断所述功耗是否高于设定阈值,其中,所述设定阈值大于所述功耗阈值。
作为一种方式,电子设备可以设置有设定阈值,其中,该设定阈值高于该功耗阈值,同样的,该设定阈值可以由电子设备预先存储在本地,也可以在判断时再进行设置,另外,该设定阈值可以由电子设备自动配置、可以由用户手动设置、也可以由服务器配置完成后再传输至电子设备,在此不做限定。因此,在本实施例中,当确定该电子设备的功耗高于该功耗阈值时,可继续将电子设备的功耗与设定阈值进行比较,以判断该电子设备的功耗是否高于设定阈值。
步骤S532:当所述功耗不高于所述设定阈值时,确定与所述功耗对应的第一渲染参数。
步骤S533:当所述功耗高于所述设定阈值时,确定与所述功耗对应的第二渲染参数,其中,所述第一渲染参数对应的画面优化质量优于所述第二渲染参数对应的画面优化质量。
其中,渲染参数可以包括第一渲染参数和第二渲染参数,且第一渲染参数对应的画面优化质量优于该第二渲染参数对应的画面优化质量。作为一种方式,电子设备根据不同的功耗可以选择不同的渲染参数对视频资源文件进行渲染,以达到不同的渲染效果,在本实施例中,当所述电子设备的功耗高于功耗阈值时,可以根据电子设备的功耗所在的区间,选择与其对应的渲染参数,具体地,当所述功耗不高于设定阈值时,也就是说,当所述功耗位于所述功耗阈值和设定阈值之间时,可以确定该功耗对应第一渲染参数;当该功耗高于设定功耗时,可以确定该功耗对应第二渲染参数,也就是时,当所述电子设备的功耗越大时,其对应的视频资源文件的优化质量越差,以达到减少功耗的效果,当所述电子设备的功耗越小时,其对应的视频资源文件的优化资料越好,以达到提升视频资源文件的播放效果。
步骤S540:控制所述图形处理器基于所述渲染参数对所述视频资源文件进行渲染。
进一步地,在确定该功耗对应的渲染参数后,可以控制该图形处理器基于该渲染参数对该视频资源文件进行渲染处理。可以理解的,该图形控制器可以对视频资源文件进行解码得到多个视频帧后,再基于该渲染参数对多个视频帧进行渲染处理。
步骤S550:当所述功耗不高于所述功耗阈值时,控制所述中央处理器或所述图形处理器对所述视频资源文件进行解码和渲染。
相反的,当确定该功耗不高于该功耗阈值时,表征通过CPU对视频资源文件进行解码和渲染不会造成电子设备过大的功耗,即通过CPU对视频资源文件进行解码和渲染也不会影响视频资源文件的播放,因此,可以控制CPU或GPU对视频资源文件进行解码和渲染。其中,让CPU来对视频资源文件进行解码和渲染可以采用在屏渲染,也可以采用离屏渲染对CPU解码之后得到的多帧图像数据渲染合成之后在屏幕上显示,在此不做限定。
本申请又再一个实施例提供的视频处理方法,当电子设备播放视频资源文件时,检测该电子设备的功耗,判断该功耗是否高于功耗阈值,当该功耗高于功耗阈值时,确定该功耗对应的渲染参数,控制图形处理器基于该渲染参数对视频资源文件进行渲染,当该功耗不高于功耗阈值时,控制中央处理器或图形处理器对视频资源文件进行解码和渲染。相较于图2所示的视频处理方法,本实施例还在功耗高于功耗阈值时,通过与功耗视频的渲染参数对视频资源文件进行渲染,并且在功耗不高于功耗阈值时,控制中央处理器或图形处理器对视频资源文件进行解码和渲染,提升渲染的合理性。
请参阅图8,图8示出了本申请实施例提供的视频处理装置200的模块框图。该视频处理装置200应用于上述电子设备,该电子设备包括中央处理器和图形处理器,下面将针对图8所示的框图进行阐述,所述视频处理装置200包括:检测模块210、判断模块220以及处理模块230,其中:
检测模块210,用于当所述电子设备播放视频资源文件时,检测所述电子设备的功耗。进一步地,所述电子设备还包括屏幕,所述检测模块210包括:亮度检测子模块和音量检测子模块,其中:亮度检测子模块和音量检测子模块,其中:
亮度检测子模块,用于检测所述屏幕的亮度。
音量检测子模块,用于检测所述电子设备的音量。
判断模块220,用于判断所述功耗是否高于功耗阈值。进一步地,所述判断模块220包括:亮度判断子模块、亮度确定子模块、音量判断子模块以及音量确定子模块,其中:
亮度判断子模块,用于判断所述亮度是否高于亮度阈值。
亮度确定子模块,用于当所述亮度高于所述亮度阈值时,确定所述功耗高于所述功耗阈值。
音量判断子模块,用于判断所述音量是否高于音量阈值。
音量确定子模块,用于当所述音量高于所述音量阈值时,确定所述功耗高于所述功耗阈值。
处理模块230,用于当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染。进一步地,所述处理模块230包括:检测子模块、切换子模块、监听子模块、第一控制子模块、渲染参数确定子模块以及第二控制子模块,其中:
检测子模块,用于当所述功耗高于所述功耗阈值时,检测所述中央处理器是否对所述视频资源文件进行解码和渲染。
切换子模块,用于当所述中央处理器对所述视频资源文件进行解码和渲染时,切换至所述图形处理器对所述视频资源文件进行解码和渲染。
监听子模块,用于当所述亮度高于所述亮度阈值时,输出提示信息并监听输入信息。
第一控制子模块,用于当监听到指示保持所述屏幕的亮度不变的输入信息或在时长阈值内没有监听到输入信息时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
渲染参数确定子模块,用于当所述功耗高于所述功耗阈值时,确定与所述功耗对应的渲染参数。进一步地,所述渲染参数确定子模块,包括:判断单元、第一确定单元以及第二确定单元,其中:
判断单元,用于当所述功耗高于所述功耗阈值时,判断所述功耗是否高于设定阈值,其中,所述设定阈值大于所述功耗阈值。
第一确定单元,用于当所述功耗不高于所述设定阈值时,确定与所述功耗对应的第一渲染参数。
第二确定单元,用于当所述功耗高于所述设定阈值时,确定与所述功耗对应的第二渲染参数,其中,所述第一渲染参数对应的画面优化质量优于所述第二渲染参数对应的画面优化质量。
第二控制子模块,用于控制所述图形处理器基于所述渲染参数对所述视频资源文件进行渲染。
进一步地,所述视频处理装置200还包括:控制模块,其中:
控制模块,用于当所述功耗不高于所述功耗阈值时,控制所述中央处理器或所述图形处理器对所述视频资源文件进行解码和渲染。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
请参阅图9,其示出了本申请实施例提供的一种电子设备100的结构框图。该电子设备 100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备100可以包括一个或多个如下部件:处理器110、存储器120、屏幕130、编解码器140以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
其中,处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图形处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。
具体地,处理器110可以包括中央处理器111(Central Processing Unit,CPU)、图像处理器112(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和客户端等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
所述编解码器140可以用于对视频数据进行编码或解码,然后将解码后的视频数据传输到屏幕130进行显示,其中,该编解码器140可以为GPU、专用的DSP、FPGA、ASIG芯片等。
请参阅图10,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质300中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质300可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质300包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质300具有执行上述方法中的任何方法步骤的程序代码310的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码310可以例如以适当形式进行压缩。
综上所述,本申请实施例提供的视频处理方法、装置、电子设备以及存储介质,当该电子设备播放视频资源文件时,检测该电子设备的功耗,判断该功耗是否高于功耗阈值,当该功耗高于该功耗阈值时,控制该图形处理器对视频资源文件进行解码和渲染,从而通过在电子设备的功耗高于功耗阈值时,控制图形处理器对视频资源文件进行解码和渲染,以降低中央处理器的功耗,提升视频资源文件的播放效果。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换; 而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种视频处理方法,其特征在于,应用于电子设备,所述电子设备包括中央处理器和图形处理器,所述方法包括:
    当所述电子设备播放视频资源文件时,检测所述电子设备的功耗;
    判断所述功耗是否高于功耗阈值;
    当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
  2. 根据权利要求1所述的方法,其特征在于,所述当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染,包括:
    当所述功耗高于所述功耗阈值时,检测所述中央处理器是否对所述视频资源文件进行解码和渲染;
    当所述中央处理器对所述视频资源文件进行解码和渲染时,切换至所述图形处理器对所述视频资源文件进行解码和渲染。
  3. 根据权利要求2所述的方法,其特征在于,所述当所述中央处理器对所述视频资源文件进行解码和渲染时,切换至所述图形处理器对所述视频资源文件进行解码和渲染,包括:
    当所述中央处理器和所述图形处理器同时对所述视频资源文件进行解码和渲染时,切换至所述图形处理器对所述视频资源文件进行解码和渲染。
  4. 根据权利要求3所述的方法,其特征在于,所述当所述中央处理器和所述图形处理器同时对所述视频资源文件进行解码和渲染时,切换至所述图形处理器对所述视频资源文件进行解码和渲染,包括:
    当所述中央处理器和所述图形处理器同时对所述视频资源文件进行解码和渲染时,获取所述视频资源文件中的剩余视频资源文件;
    通过所述图形处理器对所述剩余视频资源文件进行解码和渲染。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述电子设备还包括屏幕,所述检测所述电子设备的功耗,包括:
    检测所述屏幕的亮度;
    所述判断所述功耗是否高于功耗阈值,包括:
    判断所述亮度是否高于亮度阈值;
    当所述亮度高于所述亮度阈值时,确定所述功耗高于所述功耗阈值。
  6. 根据权利要求5所述的方法,其特征在于,所述当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染,包括:
    当所述亮度高于所述亮度阈值时,输出提示信息并监听输入信息;
    当监听到指示保持所述屏幕的亮度不变的输入信息或在时长阈值内没有监听到输入信息时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
  7. 根据权利要求6所述的方法,其特征在于,所述当所述亮度高于所述亮度阈值时,输出提示信息并监听输入信息,包括:
    当所述亮度高于所述亮度阈值时,通过语音和/或图文输出所述提示信息并监听所述输入信息。
  8. 根据权利要求6所述的方法,其特征在于,所述当所述亮度高于所述亮度阈值时,输出提示信息并监听输入信息,包括:
    当所述亮度高于所述亮度阈值时,输出选择信息并监听基于所述选择信息触发的选择操作。
  9. 根据权利要求8所述的方法,其特征在于,所述选择操作包括单指点击操作、多指点击操作、单指长按操作、多指长按操作、重压操作、多次点击操作以及滑动操作中的至 少一种。
  10. 根据权利要求5-9任一项所述的方法,其特征在于,所述方法还包括:
    当所述亮度不高于所述亮度阈值时,确定所述功耗不高于所述功耗阈值。
  11. 根据权利要求1-4任一项所述的方法,其特征在于,所述检测所述中央处理器的功耗,还包括:
    检测所述电子设备的音量;
    所述判断所述功耗是否高于功耗阈值,包括:
    判断所述音量是否高于音量阈值;
    当所述音量高于所述音量阈值时,确定所述功耗高于所述功耗阈值。
  12. 根据权利要求11所述的方法,其特征在于,所述当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染,包括:
    当所述音量高于所述音量阈值时,输出提示信息并监听输入信息;
    当监听到指示保持所述电子设备的音量不变的输入信息或在时长阈值内没有监听到输入信息时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
  13. 根据权利要求1-12任一项所述的方法,其特征在于,所述当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染,包括:
    当所述功耗高于所述功耗阈值时,确定与所述功耗对应的渲染参数;
    控制所述图形处理器基于所述渲染参数对所述视频资源文件进行渲染。
  14. 根据权利要求13所述的方法,其特征在于,所述当所述功耗高于所述功耗阈值时,确定与所述功耗对应的渲染参数,包括:
    当所述功耗高于所述功耗阈值时,判断所述功耗是否高于设定阈值,其中,所述设定阈值大于所述功耗阈值;
    当所述功耗不高于所述设定阈值时,确定与所述功耗对应的第一渲染参数;
    当所述功耗高于所述设定阈值时,确定与所述功耗对应的第二渲染参数,其中,所述第一渲染参数对应的画面优化质量优于所述第二渲染参数对应的画面优化质量。
  15. 根据权利要求13或14所述的方法,其特征在于,所述当所述功耗高于所述功耗阈值时,确定与所述功耗对应的渲染参数,包括:
    当所述功耗高于所述功耗阈值时,基于预先存储的多个功耗和多个渲染参数之间的对应关系确定与所述功耗对应的渲染参数。
  16. 根据权利要求13-15任一项所述的方法,其特征在于,所述控制所述图形处理器基于所述渲染参数对所述视频资源文件进行渲染,包括:
    控制所述图形处理器对所述视频资源文件进行解码,获得多个视频帧;
    基于所述渲染参数对所述多个视频帧进行渲染。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述方法还包括:
    当所述功耗不高于所述功耗阈值时,控制所述中央处理器或所述图形处理器对所述视频资源文件进行解码和渲染。
  18. 一种视频处理装置,其特征在于,应用于电子设备,所述电子设备包括中央处理器和图形处理器,所述装置包括:
    检测模块,用于当所述电子设备播放视频资源文件时,检测所述电子设备的功耗;
    判断模块,用于判断所述功耗是否高于功耗阈值;
    处理模块,用于当所述功耗高于所述功耗阈值时,控制所述图形处理器对所述视频资源文件进行解码和渲染。
  19. 一种电子设备,其特征在于,包括:
    中央处理器和图形处理器;
    存储器;
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置 为由所述中央处理器执行,所述一个或多个程序配置用于执行如权利要求1-17任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-17任一项所述的方法。
PCT/CN2019/107933 2018-11-27 2019-09-25 视频处理方法、装置、电子设备以及存储介质 WO2020108061A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP19889477.6A EP3872603A4 (en) 2019-09-25 Video processing method and apparatus, electronic device and storage medium
US17/331,571 US20210287631A1 (en) 2018-11-27 2021-05-26 Video Processing Method, Electronic Device and Storage Medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811427995.4 2018-11-27
CN201811427995.4A CN109379627B (zh) 2018-11-27 2018-11-27 视频处理方法、装置、电子设备以及存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/331,571 Continuation US20210287631A1 (en) 2018-11-27 2021-05-26 Video Processing Method, Electronic Device and Storage Medium

Publications (1)

Publication Number Publication Date
WO2020108061A1 true WO2020108061A1 (zh) 2020-06-04

Family

ID=65383185

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/107933 WO2020108061A1 (zh) 2018-11-27 2019-09-25 视频处理方法、装置、电子设备以及存储介质

Country Status (3)

Country Link
US (1) US20210287631A1 (zh)
CN (1) CN109379627B (zh)
WO (1) WO2020108061A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112672405A (zh) * 2020-12-15 2021-04-16 Oppo广东移动通信有限公司 功耗计算方法、装置、存储介质、电子设备以及服务器

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109379627B (zh) * 2018-11-27 2020-12-04 Oppo广东移动通信有限公司 视频处理方法、装置、电子设备以及存储介质
CN111754607A (zh) * 2019-03-27 2020-10-09 北京小米移动软件有限公司 图片处理方法及装置、电子设备、计算机可读存储介质
CN110362188B (zh) * 2019-07-17 2020-08-25 Oppo广东移动通信有限公司 图片处理方法、装置、移动终端以及存储介质
CN110362186B (zh) * 2019-07-17 2021-02-02 Oppo广东移动通信有限公司 图层处理方法、装置、电子设备及计算机可读介质
CN110413245A (zh) * 2019-07-17 2019-11-05 Oppo广东移动通信有限公司 图像合成方法、装置、电子设备及存储介质
CN110377257B (zh) * 2019-07-17 2022-04-19 Oppo广东移动通信有限公司 图层合成方法、装置、电子设备及存储介质
CN110442389B (zh) * 2019-08-07 2024-01-09 北京技德系统技术有限公司 一种多桌面环境共享使用gpu的方法
CN114520868B (zh) * 2020-11-20 2023-05-12 华为技术有限公司 视频处理方法、装置及存储介质
CN113075993B (zh) * 2021-04-09 2024-02-13 杭州华橙软件技术有限公司 视频显示方法、装置和存储介质及电子设备
US11838884B1 (en) * 2021-05-03 2023-12-05 Samsara Inc. Low power mode for cloud-connected on-vehicle gateway device
CN114327722A (zh) * 2021-12-28 2022-04-12 武汉噢易云计算股份有限公司 移动终端性能优化方法、装置、设备及可读存储介质
CN115391124B (zh) * 2022-10-27 2023-03-21 瀚博半导体(上海)有限公司 一种面向图形芯片功耗测试的方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140192207A1 (en) * 2013-01-07 2014-07-10 Jinsong Ji Method and apparatus to measure video characteristics locally or remotely
CN106200872A (zh) * 2016-06-30 2016-12-07 维沃移动通信有限公司 一种终端及其功耗的管理方法
CN107680029A (zh) * 2017-08-31 2018-02-09 深圳天珑无线科技有限公司 图像处理方法、电子设备及具有存储功能的装置
CN108021219A (zh) * 2016-11-03 2018-05-11 华为技术有限公司 电子设备控制方法、装置及电子设备
CN109379627A (zh) * 2018-11-27 2019-02-22 Oppo广东移动通信有限公司 视频处理方法、装置、电子设备以及存储介质

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6657634B1 (en) * 1999-02-25 2003-12-02 Ati International Srl Dynamic graphics and/or video memory power reducing circuit and method
JP4450853B2 (ja) * 2004-09-16 2010-04-14 エヌヴィディア コーポレイション 負荷分散
US7633505B1 (en) * 2004-11-17 2009-12-15 Nvidia Corporation Apparatus, system, and method for joint processing in graphics processing units
US20060114254A1 (en) * 2004-11-26 2006-06-01 Tim Day Volume rendering apparatus and method
US8233527B2 (en) * 2007-05-11 2012-07-31 Advanced Micro Devices, Inc. Software video transcoder with GPU acceleration
US9652016B2 (en) * 2011-04-27 2017-05-16 Nvidia Corporation Techniques for degrading rendering quality to increase operating time of a computing platform
US10223997B2 (en) * 2011-12-07 2019-03-05 Ubitus Inc. System and method of leveraging GPU resources to increase performance of an interact-able content browsing service
CN102945199B (zh) * 2012-10-24 2015-06-17 深圳市杰和科技发展有限公司 显卡工作状态智能侦测系统及方法
US9798371B2 (en) * 2013-06-05 2017-10-24 Samsung Electronics Co., Ltd Electronic device and content display method thereof
WO2017107112A1 (zh) * 2015-12-23 2017-06-29 华为技术有限公司 一种调整显示屏显示界面的方法、用户界面、装置、电子设备及存储介质
CN106230038A (zh) * 2016-07-26 2016-12-14 努比亚技术有限公司 一种充电方法及终端
CN106303007A (zh) * 2016-08-08 2017-01-04 乐视控股(北京)有限公司 视频播放方法、播放装置及播放终端
CN107797643A (zh) * 2017-09-04 2018-03-13 努比亚技术有限公司 降低终端运行功耗的方法、终端及计算机可读存储介质
CN108063971A (zh) * 2017-12-25 2018-05-22 暴风集团股份有限公司 多媒体播放装置和方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140192207A1 (en) * 2013-01-07 2014-07-10 Jinsong Ji Method and apparatus to measure video characteristics locally or remotely
CN106200872A (zh) * 2016-06-30 2016-12-07 维沃移动通信有限公司 一种终端及其功耗的管理方法
CN108021219A (zh) * 2016-11-03 2018-05-11 华为技术有限公司 电子设备控制方法、装置及电子设备
CN107680029A (zh) * 2017-08-31 2018-02-09 深圳天珑无线科技有限公司 图像处理方法、电子设备及具有存储功能的装置
CN109379627A (zh) * 2018-11-27 2019-02-22 Oppo广东移动通信有限公司 视频处理方法、装置、电子设备以及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112672405A (zh) * 2020-12-15 2021-04-16 Oppo广东移动通信有限公司 功耗计算方法、装置、存储介质、电子设备以及服务器
CN112672405B (zh) * 2020-12-15 2023-12-08 Oppo广东移动通信有限公司 功耗计算方法、装置、存储介质、电子设备以及服务器

Also Published As

Publication number Publication date
US20210287631A1 (en) 2021-09-16
EP3872603A1 (en) 2021-09-01
CN109379627A (zh) 2019-02-22
CN109379627B (zh) 2020-12-04

Similar Documents

Publication Publication Date Title
WO2020108061A1 (zh) 视频处理方法、装置、电子设备以及存储介质
US11706484B2 (en) Video processing method, electronic device and computer-readable medium
CN109218802B (zh) 视频处理方法、装置、电子设备及计算机可读介质
CN109379625B (zh) 视频处理方法、装置、电子设备和计算机可读介质
WO2020107989A1 (zh) 视频处理方法、装置、电子设备以及存储介质
US11418832B2 (en) Video processing method, electronic device and computer-readable storage medium
WO2020108018A1 (zh) 游戏场景处理方法、装置、电子设备以及存储介质
US20210168441A1 (en) Video-Processing Method, Electronic Device, and Computer-Readable Storage Medium
CN109242802B (zh) 图像处理方法、装置、电子设备及计算机可读介质
US20210281718A1 (en) Video Processing Method, Electronic Device and Storage Medium
WO2020062924A1 (zh) 视频增强控制方法、装置、电子设备及存储介质
CN109587546B (zh) 视频处理方法、装置、电子设备和计算机可读介质
WO2020108092A1 (zh) 视频处理方法、装置、电子设备及存储介质
CN109120988B (zh) 解码方法、装置、电子设备以及存储介质
CN109587558B (zh) 视频处理方法、装置、电子设备以及存储介质
WO2020108010A1 (zh) 视频处理方法、装置、电子设备以及存储介质
US11153525B2 (en) Method and device for video enhancement, and electronic device using the same
US11562772B2 (en) Video processing method, electronic device, and storage medium
WO2020108060A1 (zh) 视频处理方法、装置、电子设备以及存储介质
CN109587555B (zh) 视频处理方法、装置、电子设备及存储介质
CN109587561B (zh) 视频处理方法、装置、电子设备及存储介质
CN109688462B (zh) 降低设备功耗的方法、装置、电子设备及存储介质
WO2020038071A1 (zh) 视频增强控制方法、装置、电子设备及存储介质
WO2020107992A1 (zh) 视频处理方法、装置、电子设备及存储介质
CN109167946B (zh) 视频处理方法、装置、电子设备以及存储介质

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: 19889477

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019889477

Country of ref document: EP

Effective date: 20210526

NENP Non-entry into the national phase

Ref country code: DE