WO2020107970A1 - 视频解码方法、装置、电子设备及存储介质 - Google Patents

视频解码方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2020107970A1
WO2020107970A1 PCT/CN2019/102858 CN2019102858W WO2020107970A1 WO 2020107970 A1 WO2020107970 A1 WO 2020107970A1 CN 2019102858 W CN2019102858 W CN 2019102858W WO 2020107970 A1 WO2020107970 A1 WO 2020107970A1
Authority
WO
WIPO (PCT)
Prior art keywords
video
played
rate
code rate
cpu
Prior art date
Application number
PCT/CN2019/102858
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广东移动通信有限公司
Publication of WO2020107970A1 publication Critical patent/WO2020107970A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/44Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output

Definitions

  • the present application relates to the field of image processing technology, and more specifically, to a video decoding method, device, electronic device, and storage medium.
  • the present application proposes a video decoding method, device, electronic device, and storage medium to improve the above problems.
  • the present application provides a video decoding method, which is applied to an electronic device.
  • the method includes: after detecting that a video is being played, acquiring a bit rate of the played video; detecting whether the bit rate satisfies a target condition ; If it is detected that the code rate satisfies the target condition, use soft decoding to decode the played video.
  • the present application provides a video decoding device, which runs on an electronic device, and the device includes: a bit rate detection unit for acquiring a bit rate of a played video after detecting that it is in a video playback state; The judging unit is used to detect whether the code rate satisfies the target condition; the decoding mode control unit is used to decode the played video by using soft decoding if it is detected that the code rate meets the target condition.
  • the present application provides an electronic device, including one or more processors and a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be The one or more processors execute, and the one or more programs are configured to perform the above method.
  • the present application provides a computer-readable storage medium having program code stored therein, wherein the above method is executed when the program code runs.
  • FIG. 1 shows a schematic diagram of a video processing architecture proposed by an embodiment of the present application.
  • FIG. 2 shows a flowchart of a video decoding method proposed by an embodiment of the present application.
  • FIG. 3 shows a schematic diagram of a switch control of an application program provided by an embodiment of the present application.
  • FIG. 4 shows a schematic diagram of a video playback interface proposed by an embodiment of the present application.
  • FIG. 5 shows a flowchart of a video decoding method proposed by another embodiment of the present application.
  • FIG. 6 shows a flowchart of a video decoding method proposed by still another embodiment of the present application.
  • FIG. 7 shows a structural block diagram of a video enhancement control device proposed by an embodiment of the present application.
  • FIG. 8 shows a structural block diagram of a video enhancement control device according to another embodiment of the present application.
  • FIG. 9 shows a structural block diagram of a video enhancement control device according to another embodiment of the present application.
  • FIG. 10 shows a structural block diagram of an electronic device of the present application for executing a video decoding method according to an embodiment of the present application.
  • FIG. 11 is a storage unit for storing or carrying program codes for implementing a video decoding method according to an embodiment of the present application.
  • the electronic device can run a video playback client, and then use the video playback client to play the video requested from the network, or can run the web browser, and then play the video in the web browser, or electronic The device can play locally stored video files through video playback software.
  • the transmitted video is transmitted on the network or the locally stored video
  • the video when the video is generated, in order to reduce the occupation of storage space and facilitate transmission on the network, the generated video will be compressed.
  • the electronic device when the electronic device obtains the video, it will first obtain the video after compression encoding, then in this case, the electronic device will first decode the video that has been compression encoded.
  • the electronic device can perform video decoding through hard decoding and soft decoding.
  • hard decoding refers to the use of non-CPU for decoding, such as GPU (Graphics Processing Unit), dedicated DSP, FPGA, ASIC chip, etc.
  • the soft decoding refers to the use of CPU for decoding.
  • MediaFramework multimedia framework
  • Video Decode video decoder
  • the decoded video data will be sent to SurfaceFlinger (layer transfer module), and the decoded video data will be rendered and synthesized by SurfaceFlinger and displayed on the screen.
  • SurfaceFlinger is an independent Service, which receives all 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 passes it to HWComposer or OpenGL to generate the final Display Buffer, and then display to a specific display device.
  • the visual enhancement process can be added in the process of hard decoding or soft decoding, so that the video played later has a higher visual effect.
  • the video can be edge-dried, adjusted for exposure, or improved in sharpness based on HQV (hollywood quality video) technology.
  • HQV hollywood quality video
  • there are other ways to enhance the visual experience of the video being played for example, to enhance the colorfulness of the color.
  • the inventor further found that there is still room for improvement in the control method of visually enhancing the video being played.
  • the bit rate of different videos is usually different, and in the process of video decoding, electronic devices usually do not consider the impact of the video bit rate on decoding quality and decoding consumption, so that the video decoding process of electronic devices In the video, regardless of the code rate, the video is processed according to a fixed decoding method. Therefore, a video decoding method, device, electronic device, and storage medium that can improve control convenience and intelligence provided by the present application are proposed.
  • a video decoding method provided in this application is applied to an electronic device, and the method includes:
  • Step S110 When it is detected that the video is playing, the bit rate of the video being played is acquired.
  • the electronic device can identify whether it is currently in the video playback state in various ways.
  • the step of detecting whether the electronic device is in a video playback state includes: detecting whether a set video playback application is running in the electronic device; if it is detected that a set video playback application is running To determine that the electronic device is in the video playback state.
  • the electronic device may establish a list of video playback applications in advance, so as to record the video playback applications in the list.
  • the list can be freely configured by the user of the electronic device, or can be determined according to the usage of a video playback application.
  • multiple applications are displayed on the interface shown in FIG. 3, and the status corresponding to each application.
  • the status corresponding to the application is “off”, it means that the application is removed or not added to the above list.
  • the status corresponding to the application is “on”, then it means The application is added to the above list.
  • the corresponding status is “On”, which means that the "TX Video” application will exist in the aforementioned list.
  • the corresponding status is “Off”
  • the application "AQY Video” will not exist in the aforementioned list.
  • the electronic device can detect the frequency of use of each video playback application. If it is detected that the frequency of use of a video playback application exceeds the set frequency, the video playback application can be added to the aforementioned list and corresponding In the state corresponding to the name of the video playback application in FIG. 3 is configured as “on”.
  • the electronic device can first detect which application is currently running in the foreground, and then further detect whether the application currently running in the foreground is on the list. If it is, then it is determined that it is currently in the video playback state .
  • the electronic device is an Android operating system
  • the name of the application currently running in the foreground can be obtained by executing the getRunningTasks method of ActivityManager.
  • the electronic device can also obtain a list of applications used by the user through the UsageStatsManager, and identify the most recently used applications recorded in the list as the current foreground application.
  • the electronic device may also combine the detection of the return value of the AudioManager class to determine whether there is video playing.
  • the electronic device can first detect the return value of the AudioManager class to determine whether there is audio output. If audio output is detected, then further determine whether the video playback application is running according to the foregoing detection to determine the electronic Whether the device is in the video playback state.
  • the electronic device can also detect whether it is in the video playback state by detecting the touch state of the video playback button. For example, as shown in FIG. 4, a play button 98 is displayed on the video playback interface 99 shown in FIG. 4, and the interface shown in FIG. 4 is in a state where video playback is paused. In this case, after detecting that the playback button 98 is touched, it can be determined that the electronic device is currently in the video playback state.
  • the electronic device can obtain the bit rate of the played video in various ways.
  • the electronic device can obtain the bit rate of the played video by performing image recognition on the picture of the played video.
  • the electronic device may obtain a frame of image from the video being played, and then recognize the image, and then obtain the code rate of the image of the frame, and use the code rate as the code rate of the currently playing video.
  • the video that is usually played can be divided into multiple parts.
  • some online videos usually include an advertisement part and a video content part.
  • the video content part is the part that characterizes the content of the video.
  • TV series-type videos usually include an opening ad in the front part. Then, if the electronic device captures a certain frame of images as part of the opening advertisement, it will cause the obtained image to be irrelevant to the video content part, and the bit rate of the video being played cannot be accurately obtained.
  • the electronic device can directly obtain a frame of image in the middle part of the played video according to the duration of the played video.
  • the middle part is the middle part of the entire video time length. For example, if the entire length of the video being played is 60 minutes, the middle part is the 30th minute.
  • the electronic device can acquire a certain frame of image to detect the bit rate during the process of detecting the playing of the video content part.
  • the electronic device may acquire a certain frame of image in the video content after the specified duration to detect the bit rate. It can be understood that the video's opening ad usually takes 60 seconds to 80 seconds, then the electronic device can use the duration of the opening ad obtained from statistics as the specified duration.
  • the electronic device can also obtain the bit rate selection control. It can be understood that, in the case where the video being played supports multiple levels of code rates, the user can operate the code rate selection control to select the code rate he needs. For example, when the video being played supports ultra-clear, high-definition, and standard-definition, the user can select the video to be played at the ultra-clear bit rate through the code rate selection control. The result of the selection, then the electronic device can determine the bit rate of the currently played video by reading the result of the selection, that is, the bit rate corresponding to the bit rate selection control selected by the user is determined as the bit rate of the currently played video .
  • the bit rate of a certain frame image of the video being played can be directly used as the first bit rate to be compared, and the bit rate can also be obtained and stored locally.
  • the result of characterizing the code rate selected by the user is used as the second to-be-compared code rate, and then the first to-be-compared code rate is compared with the second to-be-compared code rate.
  • the second to-be-compared bit rate is the same, any one of the first to-be-compared bit rate and the second to-be-compared bit rate is used as the bit rate corresponding to the played video.
  • the first to-be-compared code rate and the second to-be-compared code rate are not the same, the first to-be-compared code rate is used as the code rate corresponding to the video being played.
  • Step S120 Detect whether the code rate meets the target condition.
  • Step S130 If it is detected that the code rate satisfies the target condition, the video being played is decoded by soft decoding.
  • Step S140 If it is detected that the code rate does not meet the target condition, the video being played is decoded by hard decoding.
  • a video decoding method provided by the present application obtains the bit rate of a played video after detecting that it is in a video playback state; detects whether the bit rate satisfies a target condition; if it is detected that the bit rate satisfies the target condition, Use soft decoding to decode the video. Therefore, this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Performing video decoding improves the flexibility of determining the decoding method, and also improves the decoding quality during the video decoding process.
  • a video decoding method provided by this application is applied to an electronic device, and the method includes:
  • Step S210 After detecting that the video is playing, the bit rate of the video being played is acquired.
  • Step S220 Detect whether the code rate meets the target condition.
  • the target condition includes: the bit rate of the video is lower than the target value.
  • the target condition includes that the video bit rate is within a set target interval. Whether it is the aforementioned target value or target interval segment, it can be freely configured by the user or automatically configured by the electronic device.
  • Step S230 If it is detected that the code rate satisfies the target condition, obtain the target load rate of the CPU.
  • the CPU load rate usually refers to the sum of the number of tasks currently being processed or waiting to be processed and the task that the CPU can process at the same time at most.
  • the electronic device can directly use the collected CPU load rate as the target load rate.
  • the electronic device can detect that the CPU load rate is 30%, and when the application is detected After program B starts, it may detect that the CPU load rate has reached 40%. Further, if it is detected that application C also starts to run, then it may detect that the CPU load rate has reached 50%.
  • the step of acquiring the target load rate of the CPU if it is detected that the code rate meets the target condition includes: if it is detected that the code rate meets The target condition is to obtain the current CPU load rate; estimate the new CPU load within a specified time period; based on the new CPU load and the current CPU load rate, obtain the target load rate of the CPU.
  • the step of estimating the new CPU load within the specified time period includes estimating the new CPU load within the specified time period based on at least one of the following conditions: the historical CPU load corresponding to the currently running application ; Historical CPU load corresponding to applications that have historically run within the specified duration.
  • the electronic device can make a certain degree of estimation as to when some applications will be started. For example, the electronic device can count the running time of each application, and then calculate the common running time period of an application, and then can infer at what time of the day the application will be started to run, then based on this method can be It is expected in advance that there will be an application launch within a period of time.
  • information update is usually started at the set time, or data is requested from the network at the set time.
  • information update is usually started at the set time, or data is requested from the network at the set time.
  • browser-like applications for some web page data, even when the user operation interface of the browser is not started, it can still run in the background, so that when the user triggers the display of the user operation interface, it can be quickly displayed to the user .
  • browser-like applications update or request network data in the background they will inevitably occupy CPU load and increase the CPU load rate.
  • system program of the electronic device will also start data processing regularly. Although the system program of the electronic device does not have a corresponding user operation interface, it will still be started within a set time period to process the background data of the electronic device. Correspondingly, the system program of the electronic device will also occupy the load of the CPU during the running process and increase the load rate of the CPU.
  • the electronic device can configure a data table to store the running period of the statistically obtained application program or system program. Then, after the electronic device starts to play the video and is in the video playback state, it can detect whether there will be an application program or a system program started within the specified time period, and then estimate the new CPU load within the specified time period.
  • the aforementioned specified duration may be the length of the video being played.
  • the electronic device can obtain the length of the played video, use the obtained length as the specified duration, and then further determine whether there will be an application within the specified duration Or the system program starts, and then estimates the new CPU load within the specified time period, and then determines the highest CPU load during the playback of the video through the estimated new CPU load, and then obtains the highest CPU load rate as the CPU Target load factor.
  • Step S231 If it is detected that the code rate does not meet the target condition, the video being played is decoded by means of hard decoding.
  • Step S240 Determine whether the target load rate of the CPU is lower than the load rate threshold.
  • Step S250 If it is determined that the target load rate of the CPU is lower than the load rate threshold, the video being played is decoded by soft decoding.
  • Step S251 If it is determined that the target load rate of the CPU is not lower than the load rate threshold, the video that is played is decoded using hard decoding.
  • a video decoding method provided by the present application obtains the bit rate of a played video after detecting that it is in a video playback state; detects whether the bit rate meets a target condition; if it is detected that the bit rate satisfies the target condition, It is determined whether the target load rate of the CPU is lower than the load rate threshold, and when it is determined that the target load rate of the CPU is lower than the load rate threshold, the video being played is decoded in a soft decoding manner.
  • this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Performing video decoding improves the flexibility of determining the decoding method, and also improves the decoding quality during the video decoding process.
  • a video decoding method provided in this application is applied to an electronic device, and the method includes:
  • Step S310 After detecting that the video is playing, the bit rate of the played video is obtained.
  • Step S320 Detect whether the code rate meets the target condition.
  • Step S330 If it is detected that the code rate meets the target condition, during the playback of the video, the target load rate of the CPU is periodically obtained.
  • the CPU load rate of the electronic device will be in a dynamically changing situation .
  • the electronic device can detect the current CPU load rate of 40%, and if the system program exits from running, the electronic device can detect the CPU load rate of 30% .
  • the electronic device may periodically acquire the target load rate of the CPU, so as to determine the decoding mode according to the latest acquired target load rate.
  • the length of the timing can be configured by the user or automatically configured by the electronic device.
  • the electronic device may be determined according to the total duration of the played video.
  • the timing may be proportional to the total duration of the video played by the electronic device. For example, if the total duration of the video being played is 100 minutes, then the timing may be 10 minutes, and if the total duration of the video being played is 50 minutes, then the timing may be 5 minutes. Therefore, in this way, the length of the timing can be flexibly determined.
  • Step S331 if it is detected that the code rate does not meet the target condition, the video being played is decoded by hard decoding.
  • Step S340 Determine whether the target load rate of the CPU is lower than the load rate threshold.
  • Step S350 if it is determined that the target load rate of the CPU is lower than the load rate threshold, the video being played is decoded by soft decoding.
  • Step S351 If it is determined that the target load rate of the CPU is not lower than the load rate threshold, use hard decoding to decode the played video.
  • a video decoding method provided by the present application obtains the bit rate of a played video after detecting that it is in a video playback state; detects whether the bit rate satisfies a target condition; It is determined whether the target load rate of the CPU is lower than the load rate threshold, and when it is determined that the target load rate of the CPU is lower than the load rate threshold, the video being played is decoded in a soft decoding manner.
  • this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Performing video decoding improves the flexibility of determining the decoding method, and also improves the decoding quality during the video decoding process.
  • a video decoding device 400 provided by this application runs on an electronic device.
  • the device 400 includes a code rate detection unit 410, a code rate judgment unit 420, and a decoding mode control unit 430.
  • the code rate detection unit 410 is used to obtain the code rate of the played video after detecting that it is in the video playing state;
  • the code rate judging unit 420 is configured to detect whether the code rate meets the target condition.
  • the target condition includes: the bit rate of the video is lower than the target value.
  • the target condition includes that the video bit rate is within a set target interval. Whether it is the aforementioned target value or target interval segment, it can be freely configured by the user or automatically configured by the electronic device.
  • the decoding mode control unit 430 is configured to decode the played video in a soft decoding mode if it is detected that the code rate meets the target condition.
  • the decoding mode control unit 430 is configured to decode the played video in a hard decoding mode if it is detected that the code rate does not satisfy the target condition.
  • a video decoding device obtains the bit rate of a played video after detecting that it is in a video playback state; detects whether the bit rate satisfies a target condition; if it is detected that the bit rate satisfies the target condition, Use soft decoding to decode the video. Therefore, this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Perform video decoding to improve the flexibility of determining the decoding method.
  • a video decoding device 500 provided by the present application runs on an electronic device, and the device 500 includes a code rate detection unit 510, a code rate judgment unit 520, a processor detection unit 530, and a decoding mode control unit 540 .
  • the code rate detection unit 510 is used to obtain the code rate of the video being played when it is detected that it is in the video playing state.
  • the code rate judging unit 520 is configured to detect whether the code rate meets the target condition.
  • the processor detection unit 530 is configured to acquire a target load rate of the CPU if it is detected that the code rate meets the target condition.
  • the processor detection unit 530 is specifically configured to obtain the current CPU load rate if it is detected that the code rate meets the target condition; estimate the new CPU load within a specified time period; based on the new CPU The load and the current CPU load rate to obtain the target load rate of the CPU.
  • the step of estimating the new CPU load within the specified time period includes estimating the new CPU load within the specified time period based on at least one of the following conditions: the historical CPU load corresponding to the currently running application ; Historical CPU load corresponding to applications that have historically run within the specified duration.
  • the decoding mode control unit 540 is configured to decode the played video in a hard decoding mode if it is detected that the code rate does not meet the target condition.
  • the load rate detection unit is used to determine whether the target load rate of the CPU is lower than a load rate threshold.
  • the decoding mode control unit 540 is further configured to decode the played video by using a soft decoding method if it is determined that the target load rate of the CPU is lower than the load rate threshold.
  • the decoding mode control unit 540 is further configured to decode the played video in a hard decoding mode if it is determined that the target load rate of the CPU is not lower than the load rate threshold.
  • a video decoding device obtains the bit rate of a played video after detecting that it is in a video playback state; detects whether the bit rate satisfies a target condition; if it is detected that the bit rate satisfies the target condition, It is determined whether the target load rate of the CPU is lower than the load rate threshold, and when it is determined that the target load rate of the CPU is lower than the load rate threshold, the video being played is decoded in a soft decoding manner.
  • this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Perform video decoding to improve the flexibility of determining the decoding method.
  • a video decoding device 600 provided by the present application runs on an electronic device, and the device 600 includes a code rate detection unit 610, a code rate judgment unit 620, a load rate timing acquisition unit 630, and a decoding mode control unit 640.
  • the code rate detection unit 610 is configured to obtain the code rate of the video being played after it is detected that it is in the video playing state.
  • the code rate judging unit 620 is configured to detect whether the code rate meets the target condition.
  • the load rate timing acquisition unit 630 is configured to periodically acquire the target load rate of the CPU during playback of the video if it is detected that the code rate meets the target condition.
  • the decoding mode control unit 640 is configured to decode the played video in a hard decoding mode if it is detected that the code rate does not meet the target condition.
  • the code rate determining unit 650 is used to determine whether the target load rate of the CPU is lower than the load rate threshold.
  • the decoding mode control unit 640 is further configured to decode the played video using a soft decoding method if it is determined that the target load rate of the CPU is lower than the load rate threshold.
  • the decoding mode control unit 640 is further configured to decode the played video in a hard decoding mode if it is determined that the target load rate of the CPU is not lower than the load rate threshold.
  • a video decoding device obtains the bit rate of a played video after detecting that it is in a video playback state; detects whether the bit rate satisfies a target condition; if it is detected that the bit rate satisfies the target condition, It is determined whether the target load rate of the CPU is lower than the load rate threshold, and when it is determined that the target load rate of the CPU is lower than the load rate threshold, the video being played is decoded in a soft decoding manner.
  • this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Perform video decoding to improve the flexibility of determining the decoding method.
  • 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.
  • a video decoding method, device, electronic device, and storage medium provided by the present application, when detected that the video is playing, acquire the bit rate of the played video; detect whether the bit rate meets the target condition; If it is detected that the code rate satisfies the target condition, the played video is decoded using soft decoding. Therefore, this method realizes that the decoding method can be determined according to the bit rate of the video being played, the bit rate of the played video can be compared with the target condition, and the soft decoding method is adopted when the bit rate meets the target condition Performing video decoding improves the flexibility of determining the decoding method, and also improves the decoding quality during the video decoding process.
  • the electronic device 100 includes one or more (only one shown in the figure) processor 102, memory 104, network module 106, video codec 108, and screen 112 coupled to each other.
  • the memory 104 stores a program that can execute the content in the foregoing embodiment, and the processor 102 can execute the program stored in the memory 104.
  • the processor 102 may include one or more processing cores.
  • the processor 102 connects various parts of the entire electronic device 100 using various interfaces and lines, executes or executes instructions, programs, code sets or instruction sets stored in the memory 104, and calls data stored in the memory 104 to execute Various functions and processing data of the electronic device 100.
  • the processor 102 may adopt at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA) Various hardware forms.
  • the processor 102 may integrate one or a combination of one of a central processing unit (Central Processing Unit, CPU), an image 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 102, and may be implemented by a communication chip alone.
  • the memory 104 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 104 may be used to store instructions, programs, codes, code sets, or instruction sets.
  • the memory 104 may include a storage program area and a storage data area.
  • the memory 104 may store a video decoding device.
  • the video decoding device may be the aforementioned device 400, device 500, or device 600.
  • the storage program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), and instructions for implementing the following method embodiments Wait.
  • 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 network module 106 is used to receive and send electromagnetic waves to realize the mutual conversion of electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, such as a wireless access point.
  • the network module 106 may include various existing circuit elements for performing these functions, for example, an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a subscriber identity module (SIM) card, a memory, etc. .
  • SIM subscriber identity module
  • the network module 106 can communicate with various networks such as the Internet, intranets, and wireless networks or communicate with other devices through the wireless network.
  • the aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network.
  • the video codec 108 can be used to decode the data requested by the network module 106 from the network for transmission to the screen 112 for display.
  • the video codec 108 may be a GPU, a dedicated DSP, FPGA, ASIC chip, or the like.
  • FIG. 11 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer readable medium 800 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 800 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 800 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 800 has a storage space for the program code 810 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 810 may be compressed in an appropriate form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本申请实施例公开了一种视频解码方法、装置、电子设备及存储介质。所述方法包括:当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。本方法从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性,同时也提升了视频解码过程中的解码质量。

Description

视频解码方法、装置、电子设备及存储介质
相关申请的交叉引用
本申请要求于2018年11月27日提交的申请号为CN201811427992.0的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及图像处理技术领域,更具体地,涉及一种视频解码方法、装置、电子设备及存储介质。
背景技术
带屏幕的电子设备应用随着社会的发展,其应用范围不断地扩大。例如,利用屏幕显示图片以及视频等图像。而大部分电子设备的显示质量会因为周围光源的变化,或者是所播放视频的片源质量问题而受到严重影响。
发明内容
鉴于上述问题,本申请提出了一种视频解码方法、装置、电子设备及存储介质,以改善上述问题。
第一方面,本申请提供了一种视频解码方法,应用于电子设备,所述方法包括:当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。
第二方面,本申请提供了一种视频解码装置,运行于电子设备,所述装置包括:码率检测单元,用于当检测到处于视频播放状态以后,获取所播放视频的码率;码率判断单元,用于检测所述码率是否满足目标条件;解码方式控制单元,用于若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。
第三方面,本申请提供了一种电子设备,包括一个或多个处理器以及存储器;一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述的方法。
第四方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图1示出了本申请实施例提出的一种视频处理架构示意图。
图2示出了本申请实施例提出的一种视频解码方法的流程图。
图3示出了本申请实施例提出的应用程序的开关控件示意图。
图4示出了本申请实施例提出的视频播放界面的示意图。
图5示出了本申请另一实施例提出的一种视频解码方法的流程图。
图6示出了本申请再一实施例提出的一种视频解码方法的流程图。
图7示出了本申请实施例提出的一种视频增强控制装置的结构框图。
图8示出了本申请另一实施例提出的一种视频增强控制装置的结构框图。
图9示出了本申请再一实施例提出的一种视频增强控制装置的结构框图。
图10示出了本申请的用于执行根据本申请实施例的视频解码方法的电子设备的结构框图。
图11是本申请实施例的用于保存或者携带实现根据本申请实施例的视频解码方法的程序代码的存储单元。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
随着电子设备的硬件性能的提升,更多的电子设备可以支持进行视频播放。例如,电子设备可以运行视频播放客户端,然后通过该视频播放客户端来对从网络请求的视频进行播放,或者可以通过运行网页浏览器,然后通过在网页浏览器中进行视频播放,再或者电子设备可以通过视频播放软件对本地存储的视频文件进行播放。
而无论对于是在网络上传输播放的视频,还是在本地存储的视频,在视频被生成的时候,为了能够降低对存储空间的占用以及便于在网络上传输,都会对生成的视频进行压缩。那么相应的,电子设备在获取到视频时,先获取的到也会是压缩编码以后的视频,那么在这种情况下,电子设备会先对已经压缩编码的视频进行视频解码。
通常,如图1所示,电子设备可以通过硬解码以及软解码两种方式来进行视频解码。其中,硬解码是指使用非CPU进行解码,如GPU(Graphics Processing Unit)、专用的DSP、FPGA、ASIC芯片等。而软解码是指使用CPU进行解码。
具体地,如图1所示,MediaFramework(多媒体框架)通过与客户端或者网页浏览器的API接口获取待播放的视频文件,并交由Video Decode(视频解码器),其中,Media Framework(多媒体框架)为操作系统中多媒体框架。
不论是硬解码还是软解码,在将视频数据解码之后,会将解码后的视频数 据发送至SurfaceFlinger(图层传递模块),由SurfaceFlinger将解码后的视频数据渲染和合成之后,在屏幕上显示。其中,SurfaceFlinger是一个独立的Service,它接收所有的Surface作为输入,根据ZOrder、透明度、大小、位置等参数,计算出每个Surface在最终合成图像中的位置,然后交由HWComposer或OpenGL生成最终的显示Buffer,然后显示到特定的显示设备上。
而发明人发现无论是在硬解码还是软解码过程中都可以加入视觉增强过程,从而使得后续所播放的视频有更高的视觉效果。例如,可以基于HQV(hollywood quality video)技术对视频进行边缘去燥、调节曝光度或者提升清晰度等。此外,还可以通过其他的方式来提升所播放视频的视觉体验,例如,提升颜色艳丽程度等。
但是,发明人进一步的发现,对于是否对所播放的视频进行视觉增强的控制方式还有待提升。例如,对于不同视频的码率通常会有所区别,而电子设备在进行视频解码的过程中,通常不会考虑视频码率对于解码质量以及解码消耗的影响,使得电子设备在进行视频解码的过程中,不论何种码率的视频均是按照固定的解码方式进行。因此,提出了本申请提供的可以提升控制便利性以及智能化的视频解码方法、装置、电子设备及存储介质。
下面将结合具体实施例对本申请内容进行介绍。
请参阅图2,本申请提供的一种视频解码方法,应用于电子设备,所述方法包括:
步骤S110:当检测到处于视频播放状态以后,获取所播放视频的码率。
在本申请中,电子设备可以通过多种的方式来识别当前是否处于视频播放状态。
作为一种方式,所述检测电子设备是否处于视频播放状态的步骤包括:检测所述电子设备中是否有设定的视频播放应用程序在运行;若检测到有设定的视频播放应用程序在运行,判定所述电子设备处于所述视频播放状态。其中,电子设备可以预先建立一个视频播放应用程序的名单,以便在该名单中记录视频播放应用程序。其中,该名单可以由电子设备的用户自由配置,也可以根据某个视频播放应用程序的使用情况来确定。
例如,如图3所示,在图3所示的界面中显示有多个应用程序,以及每个应用程序对应的状态。可以理解的是,若应用程序对应的状态为图示的“关”,那么表示该应用程序移除或者不加入到上述名单中,若应用程序对应的状态为图示的“开”,那么表示该应用程序加入到上述名单中。例如,对于名称为“TX视频”的应用程序,其对应的状态为“开”,即表示“TX视频”这个应用程序会存在于前述的名单中。而对于名称为“AQY视频”的应用程序,其对应的状态为“关”,那么表示“AQY视频”这个应用程序不会存在于前述的名单中。
再者,电子设备可以检测每个视频播放应用程序的使用频率,若检测到某个视频播放程序的使用频率超过设定的频率,则可以将该视频播放应用程序添加到前述名单中,并对应的将该视频播放应用程序的名称在图3中所对应的状态配置为“开”。
那么在这种情况下,电子设备可以先检测当前在前台运行的应用程序是哪个,然后再进一步的检测当前前台运行的应用程序是否在该名单中,若在,那么就判定当前处于视频播放状态。其中,作为一种方式,若电子设备为Android操作系统,可以通过执行ActivityManager的getRunningTasks方法来获取到当前在前台运行的应用程序的名称。此外,电子设备还可以通过UsageStatsManager来获取用户使用的应用程序的列表,将该列表中记录的最近使用的应用程序识别为当前的前台应用。再者,还可以通过Android自带无障碍功能,监控窗口焦点的变化,拿到焦点窗口对应包名作为当前在前台运行的应用程序。
作为另外一种方式,电子设备还可以结合检测AudioManager类的返回值来确定是否有视频在进行播放。在这种情况下,电子设备可以先检测AudioManager类的返回值来确定是否有音频输出,若在检测到有音频输出的情况下,再进一步的根据前述检测是否有视频播放应用程序运行来确定电子设备是否处于视频播放状态。
再者,作为再一种方式,电子设备还可以通过检测视频播放按键的触控状态来检测是否处于视频播放状态。例如,如图4所示,在图4所示的视频播放界面99中显示有播放按键98,且图4中所示的界面为视频播放暂停的状态。那么在这种情况下,当检测到播放按键98被触控后,即可判定电子设备当前处于视频播放状态。
在本申请中,电子设备有多种方式可以获取到所播放视频的码率。作为一种方式,电子设备可以通过对所播放的视频的画面进行图像识别的方式获取到所播放视频的码率。例如,电子设备可以从所播放的视频中获取一帧图像,然后对该图像进行识别,进而获取到该一帧图像的码率,将该码率作为当前所播放视频的码率。
再者,通常所播放的视频可以分成多个部分。例如,对于一些网络视频通常包括广告部分以及视频内容部分。而其中的视频内容部分为表征视频所要表达的内容的部分。例如,对于一些电视剧类型的视频,电视剧类型的视频通常在前面部分会包括有片头广告。那么如果电子设备在采集某一帧图像时所采集到的为片头广告部分,那么就会造成所获取的图像与视频内容部分无关,进而无法准确获取到所播放视频的码率。
那么作为一种方式,电子设备可以在检测到处于视频播放状态以后,根据所播放视频的时长长度,直接获取所播放视频的中间部分的一帧图像。其中,该中间部分为整个视频时间长度中间的部分。例如,如果所播放视频的整个时间长度为60分钟,那么中间部分为第30分钟的部分。而作为另外一种方式,如果所播放的视频是可以识别片头以及视频内容部分的,那么电子设备可以在检测到播放视频内容部分的过程中获取某一帧图像来检测码率。
而作为再一种方式,电子设备可以在检测到当前所播放的视频已经播放指定时长后,获取该指定时长以后的视频内容中的某一帧图像来检测码率。可以理解的是,视频的片头广告通常会在60秒到80秒,那么电子设备可以根据统计得到的片头广告的时长来作为指定时长。
此外,电子设备除了可以通过直接检测所播放的视频来获取分辨码率外,还可以通过码率选择控件来获取。可以理解的是,在所播放的视频支持多种等级码率的情况下,用户可以操作码率选择控件来选择自己需要的码率。例如,在播放的视频支持超清、高清以及标清的情况下,用户可以通过码率选择控件选择视频以超清的码率进行播放,那么在用户选择了超清以后,电子设备可以在本地存储该选择的结果,那么电子设备可以通过读取该选择的结果,来确定当前所播放视频的码率,即将与用户所选择的码率选择控件对应的码率确定为当前所播放视频的码率。
作为一种方式,可以在获取所播放的视频的码率的过程中,既直接通过检测所播放的视频的某一帧图像的码率来作为第一待对比码率,而也获取存储在本地的表征用户所选择的码率的结果来作为第二待对比码率,进而将该第一待对比码率与第二待对比码率进行比对,在比对第一待对比码率和第二待对比码率相同的情况下,将第一待对比码率和第二待对比码率中的任意一个作为所播放视频对应的码率。而在第一待对比码率和第二待对比码率不相同的情况下,将第一待对比码率作为所播放视频对应的码率。
步骤S120:检测所述码率是否满足目标条件。
步骤S130:若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。
步骤S140:若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
本申请提供的一种视频解码方法,当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性,同时也提升了视频解码过程中的解码质量。
请参阅图5,本申请提供的一种视频解码方法,应用于电子设备,所述方法包括:
步骤S210:当检测到处于视频播放状态以后,获取所播放视频的码率。
步骤S220:检测所述码率是否满足目标条件。
作为一种方式,所述目标条件包括:视频的码率低于目标值。而作为另外一种方式,所述目标条件包括视频的码率在设定目标区间段内。而不论是前述的目标值还是目标区间段,都可以由用户自由配置,也可以由电子设备自动的配置。
步骤S230:若检测到所述码率满足所述目标条件,获取CPU的目标负载率。
其中,需要说明的是,CPU的负载率通常指当前正在处理或者等待处理的任务数量的和与CPU最多能够同时处理的任务比。作为一种方式,电子设备可以直接将采集到的CPU的负载率作为目标负载率。
可以理解的是,电子设备中通常安装有多种应用程序,而不同的应用程序会对应有不同的任务需要处理,那么因为电子设备中的应用程序可能会在不同的时刻开始运行,那么电子设备的CPU的负载率会处于一个动态变化的情况。例如,在电子设备安装有应用程序A、应用程序B以及应用程序C的情况下,若当前只有应用程序A在运行,那么电子设备可以检测到CPU的负载率为30%,而当检测到应用程序B开始启动以后,可能就会检测到CPU的负载率已经到了40%,进一步的,若检测到应用程序C也开始运行,那么就可能检测到CPU的负载率已经到了50%。那么作为一种避免CPU负载率突然上升造成卡顿的实施方式,所述若检测到所述码率满足所述目标条件,获取CPU的目标负载率的步骤包括:若检测到所述码率满足所述目标条件,获取当前CPU的负载率;预估指定时长内新增CPU负载;基于所述新增CPU负载以及所述当前CPU的负载率,得到CPU的目标负载率。
作为一种方式,所述预估指定时长内新增CPU负载的步骤包括基于以下条件中的至少一种条件预估指定时长内新增CPU负载:当前正在运行的应用程序所对应的历史CPU负载;在所述指定时长内历史运行过的应用程序对应的历史CPU负载。
可以理解的是,虽然电子设备中的各个应用程序所占用的CPU负载是不同的,但是对于一些应用程序会在何种时刻启动,电子设备是可以进行一定程度的预估的。例如,电子设备可以对各个应用程序的运行时间进行统计,然后统计得到某个应用程序的常用运行时间段,进而可以推断在每天的哪个时刻该应用程序会被启动运行,那么基于该方式就可以提前预计到在一个时间段内,会不会有应用程序启动。
可以理解的是,对于一些应用程序通常会在设定时刻开始进行信息更新或者,在设定时刻向网络请求数据。例如,对于浏览器类的应用程序,对于一些网页数据,即使在浏览器的用户操作界面没有启动的情况下,依然可以在后台运行,以便当用户触发显示用户操作界面以后可以快速的展示给用户。而可以理解的是,当浏览器类的应用程序在后台进行更新或者请求网络数据的过程中,必然会占用CPU的负载,提升CPU的负载率。
此外,除了应用程序外,电子设备的系统程序也会定时启动进行数据处理。电子设备的系统程序虽然没有对应的用户操作界面,但是依然会在设定时间段启动以处理电子设备的后台数据。相应的,电子设备的系统程序在运行的过程中也会占用CPU的负载,提升CPU的负载率。
那么作为一种方式,电子设备可以配置一个数据表以存储统计得到的应用程序或者系统程序的运行周期。那么在电子设备开始播放视频,处于视频播放状态以后,可以检测在指定时长内是否会有应用程序或者系统程序启动,进而预估指定时长内新增的CPU负载。
其中,可选的,前述的指定时长可以为所播放视频的长度。在这种情况下,电子设备在检测到处于视频播放状态以后,可以获取到所播放视频的长度,将获取的该长度作为指定时长,然后再进一步的判断在该指定时长内否会有应用程序或者系统程序启动,进而预估指定时长内新增的CPU负载,然 后通过预估的新增的CPU负载来确定在该视频的播放过程中最高CPU负载,进而获取到最高CPU负载率作为CPU的目标负载率。
步骤S231:若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
步骤S240:判断所述CPU的目标负载率是否低于负载率阈值。
步骤S250:若判定所述CPU的目标负载率低于所述负载率阈值,采用软解码的方式对所播放的视频进行解码。
步骤S251:若判定所述CPU的目标负载率不低于所述负载率阈值,采用硬解码的方式对所播放的视频进行解码。
本申请提供的一种视频解码方法,当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,就判断所述CPU的目标负载率是否低于负载率阈值,在判定所述CPU的目标负载率低于所述负载率阈值的情况下,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性,同时也提升了视频解码过程中的解码质量。
请参阅图6,本申请提供的一种视频解码方法,应用于电子设备,所述方法包括:
步骤S310:当检测到处于视频播放状态以后,获取所播放视频的码率。
步骤S320:检测所述码率是否满足目标条件。
步骤S330:若检测到所述码率满足所述目标条件,在所述视频的播放过程中,定时获取所述CPU的目标负载率。
可以理解的是,不同的应用程序会对应有不同的任务需要处理,那么因为电子设备中的应用程序可能会在不同的时刻开始运行,那么电子设备的CPU的负载率会处于一个动态变化的情况。例如,若当前有应用程序A以及系统程序A在运行,那么电子设备可以检测到当前的CPU负载率为40%,而若当系统程序退出运行以后,电子设备可以检测到CPU负载率为30%。那么作为一种方式,电子设备可以定时获取所述CPU的目标负载率,以便根据最新获取到的目标负载率来确定解码方式。其中,该定时的长度可以由用户配置,也可以由电子设备自动配置。
例如,电子设备可以根据所播放视频的总的时长来确定。可选的,该定时可以与电子设备所播放视频的总的时长成正比。比如,若所播放视频的总的时长为100分钟,那么该定时可以为10分钟,而若所播放视频的总的时长为50分钟,那么该定时可以为5分钟。从而通过该种方式,可以灵活的确定定时的长度。
步骤S331:若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
步骤S340:判断所述CPU的目标负载率是否低于负载率阈值。
步骤S350:若判定所述CPU的目标负载率低于所述负载率阈值,采用 软解码的方式对所播放的视频进行解码。
步骤S351:若判定所述CPU的目标负载率不低于所述负载率阈值,采用硬解码的方式对所播放的视频进行解码。
本申请提供的一种视频解码方法,当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,就判断所述CPU的目标负载率是否低于负载率阈值,在判定所述CPU的目标负载率低于所述负载率阈值的情况下,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性,同时也提升了视频解码过程中的解码质量。
请参阅图7,本申请提供的一种视频解码装置400,运行于电子设备,所述装置400包括:码率检测单元410、码率判断单元420以及解码方式控制单元430。
码率检测单元410,用于当检测到处于视频播放状态以后,获取所播放视频的码率;
码率判断单元420,用于检测所述码率是否满足目标条件。
作为一种方式,所述目标条件包括:视频的码率低于目标值。而作为另外一种方式,所述目标条件包括视频的码率在设定目标区间段内。而不论是前述的目标值还是目标区间段,都可以由用户自由配置,也可以由电子设备自动的配置。
解码方式控制单元430,用于若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。
解码方式控制单元430,用于若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
本申请提供的一种视频解码装置,当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性。
请参阅图8,本申请提供的一种视频解码装置500,运行于电子设备,所述装置500包括:码率检测单元510、码率判断单元520、处理器检测单元530以及解码方式控制单元540。
码率检测单元510,用于当检测到处于视频播放状态以后,获取所播放视频的码率。
码率判断单元520,用于检测所述码率是否满足目标条件。
处理器检测单元530,用于若检测到所述码率满足所述目标条件,获取CPU的目标负载率。
作为一种方式,处理器检测单元530,具体用于若检测到所述码率满足 所述目标条件,获取当前CPU的负载率;预估指定时长内新增CPU负载;基于所述新增CPU负载以及所述当前CPU的负载率,得到CPU的目标负载率。
作为一种方式,所述预估指定时长内新增CPU负载的步骤包括基于以下条件中的至少一种条件预估指定时长内新增CPU负载:当前正在运行的应用程序所对应的历史CPU负载;在所述指定时长内历史运行过的应用程序对应的历史CPU负载。
解码方式控制单元540,用于若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
负载率检测单元,用于判断所述CPU的目标负载率是否低于负载率阈值。
解码方式控制单元540,还用于若判定所述CPU的目标负载率低于所述负载率阈值,采用软解码的方式对所播放的视频进行解码。
解码方式控制单元540,还用于若判定所述CPU的目标负载率不低于所述负载率阈值,采用硬解码的方式对所播放的视频进行解码。
本申请提供的一种视频解码装置,当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,就判断所述CPU的目标负载率是否低于负载率阈值,在判定所述CPU的目标负载率低于所述负载率阈值的情况下,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性。
请参阅图9,本申请提供的一种视频解码装置600,运行于电子设备,所述装置600包括:码率检测单元610、码率判断单元620、负载率定时获取单元630以及解码方式控制单元640。
码率检测单元610,用于当检测到处于视频播放状态以后,获取所播放视频的码率。
码率判断单元620,用于检测所述码率是否满足目标条件。
负载率定时获取单元630,用于若检测到所述码率满足所述目标条件,在所述视频的播放过程中,定时获取所述CPU的目标负载率。
解码方式控制单元640,用于若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
码率判断单元650,用于判断所述CPU的目标负载率是否低于负载率阈值。
解码方式控制单元640,还用于若判定所述CPU的目标负载率低于所述负载率阈值,采用软解码的方式对所播放的视频进行解码。
解码方式控制单元640,还用于若判定所述CPU的目标负载率不低于所述负载率阈值,采用硬解码的方式对所播放的视频进行解码。
本申请提供的一种视频解码装置,当检测到处于视频播放状态以后,获 取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,就判断所述CPU的目标负载率是否低于负载率阈值,在判定所述CPU的目标负载率低于所述负载率阈值的情况下,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性。
需要说明的是,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性。另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
需要说明的是,本申请中具体如何根据音频编码类型对音频数据进行编码是可以采用现有的技术,本申请就不再细述。
综上所述,本申请提供的一种视频解码方法、装置、电子设备及存储介质,当检测到处于视频播放状态以后,获取所播放视频的码率;检测所述码率是否满足目标条件;若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。从而通过本方法实现了可以根据所播放的视频的码率来确定解码方式,可以将所播放视频的码率与目标条件进行比对,而在码率满足目标条件的情况下采用软解码的方式进行视频解码,从而提升了解码方式确定的灵活性,同时也提升了视频解码过程中的解码质量。
下面将结合图10对本申请提供的一种电子设备进行说明。
请参阅图10,基于上述的视频解码方法、装置,本申请实施例还提供的另一种可以执行前述视频解码方法的电子设备100。电子设备100包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104、网络模块106、视频编解码器108以及屏幕112。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理器102可以执行该存储器104中存储的程序。
其中,处理器102可以包括一个或者多个处理核。处理器102利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器102可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通 过一块通信芯片进行实现。
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器104可用于存储指令、程序、代码、代码集或指令集。存储器104可包括存储程序区和存储数据区,例如,存储器104中可以存储有视频解码装置。该视频解码装置可以为前述的装置400、装置500或者装置600。其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
所述网络模块106用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯,例如和无线接入点进行通讯。所述网络模块106可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。所述网络模块106可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。
该视频编解码器108可以用于对网络模块106从网络请求的数据进行解码,以便传输到屏幕112进行显示。具体的,视频编解码器108可以为GPU、专用的DSP、FPGA、ASIC芯片等。
请参考图11,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质800中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质800可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质800包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质800具有执行上述方法中的任何方法步骤的程序代码810的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码810可以例如以适当形式进行压缩。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种视频解码方法,其特征在于,应用于电子设备,所述方法包括:
    当检测到处于视频播放状态以后,获取所播放视频的码率;
    检测所述码率是否满足目标条件;
    若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
  3. 根据权利要求1或2所述的方法,其特征在于,所述目标条件包括:
    视频的码率低于目标值。
  4. 根据权利要求1或2所述的方法,其特征在于,所述目标条件包括:
    视频的码率在设定目标区间段内。
  5. 根据权利要求1所述的方法,其特征在于,所述若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码的步骤包括:
    若检测到所述码率满足所述目标条件,获取CPU的目标负载率;
    判断所述CPU的目标负载率是否低于负载率阈值;
    若判定所述CPU的目标负载率低于所述负载率阈值,采用软解码的方式对所播放的视频进行解码。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    若判定所述CPU的目标负载率不低于所述负载率阈值,采用硬解码的方式对所播放的视频进行解码。
  7. 根据权利要求5或6所述的方法,其特征在于,所述获取CPU的目标负载率的步骤包括:
    在所述视频的播放过程中,定时获取所述CPU的目标负载率。
  8. 根据权利要求5或6所述的方法,其特征在于,所述若检测到所述码率满足所述目标条件,获取CPU的目标负载率的步骤包括:
    若检测到所述码率满足所述目标条件,获取当前CPU的负载率;
    预估指定时长内新增CPU负载;
    基于所述新增CPU负载以及所述当前CPU的负载率,得到CPU的目标负载率。
  9. 根据权利要求8所述的方法,其特征在于,所述预估指定时长内新增CPU负载的步骤包括基于以下条件中的至少一种条件预估指定时长内新增CPU负载:
    当前正在运行的应用程序所对应的历史CPU负载;
    在所述指定时长内历史运行过的应用程序对应的历史CPU负载。
  10. 根据权利要求1-9任一所述的方法,其特征在于,所述当检测到处于视频播放状态以后,获取所播放视频的码率的步骤之前包括:
    检测是否有设定的视频播放应用程序在运行;
    若检测到有设定的视频播放应用程序在运行,判定为检测到处于视频播放状态。
  11. 根据权利要求1-9任一所述的方法,其特征在于,所述当检测到处于视频播放状态以后,获取所播放视频的码率的步骤之前包括:
    获取当前在前台运行的应用程序;
    检测所述应用程序是否在预先建立的视频播放应用程序的名单内;
    若是,判定为检测到处于视频播放状态。
  12. 根据权利要求11所述的方法,其特征在于,所述获取当前在前台运行的应用程序的步骤包括:
    获取用户使用的应用程序的列表;
    将所述列表中记录的最近使用的应用程序识别为当前在前台运行的应用程序。
  13. 根据权利要求1-9任一所述的方法,其特征在于,所述检测是否处于视频播放状态的步骤包括:
    检测是否有音频输出;
    若有,检测是否有视频播放应用程序运行;
    若是,判定处于视频播放状态。
  14. 根据权利要求1-13任一所述的方法,其特征在于,所述获取所播放视频的码率的步骤包括:
    获取所播放视频的一帧图像;
    对所述一帧图像进行识别,获取所述一帧图像的码率;
    将所述码率作为所播放视频的码率。
  15. 根据权利要求14所述的方法,其特征在于,所述获取所播放视频的一帧图像的步骤包括:
    获取所播放视频的中间部分的一帧图像;或
    在检测到播放视频内容部分的过程中获取一帧图像;或
    在检测到当前所播放的视频播放指定时长后,获取所述指定时长以后的视频内容中的一帧图像。
  16. 根据权利要求1-13任一所述的方法,其特征在于,所述获取所播放视频的码率的步骤包括:
    获取所播放的视频的一帧图像的码率作为第一待对比码率;
    获取存储在本地的表征用户所选择的码率作为第二待对比码率;
    将所述第一待对比码率与所述第二待对比码率进行比对;
    若所述第一待对比码率与所述第二待对比码率相同,将所述第一待对比码率与所述第二待对比码率中的任意一个作为所播放视频的码率;
    若所述第一待对比码率与所述第二待对比码率不相同,将所述第一待对比码率作为所播放视频的码率。
  17. 一种视频解码装置,其特征在于,运行于电子设备,所述装置包括:
    码率检测单元,用于当检测到处于视频播放状态以后,获取所播放视频的码率;
    码率判断单元,用于检测所述码率是否满足目标条件;
    解码方式控制单元,用于若检测到所述码率满足所述目标条件,采用软解码的方式对所播放的视频进行解码。
  18. 根据权利要求17所述的装置,其特征在于,所述解码方式控制单元还用于若检测到所述码率不满足所述目标条件,采用硬解码的方式对所播放的视频进行解码。
  19. 一种电子设备,其特征在于,包括一个或多个处理器、视频编解码器以及存储器;
    一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行权利要求1-16任一所述的方法。
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行权利要求1-16任一所述的方法。
PCT/CN2019/102858 2018-11-27 2019-08-27 视频解码方法、装置、电子设备及存储介质 WO2020107970A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811427992.0 2018-11-27
CN201811427992.0A CN109640094B (zh) 2018-11-27 2018-11-27 视频解码方法、装置以及电子设备

Publications (1)

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

Family

ID=66069339

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102858 WO2020107970A1 (zh) 2018-11-27 2019-08-27 视频解码方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN109640094B (zh)
WO (1) WO2020107970A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109640094B (zh) * 2018-11-27 2021-06-15 Oppo广东移动通信有限公司 视频解码方法、装置以及电子设备
CN111263162B (zh) * 2020-02-10 2022-02-18 广州市百果园信息技术有限公司 视频压缩方法、装置、设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010692B1 (en) * 2009-11-05 2011-08-30 Adobe Systems Incorporated Adapting audio and video content for hardware platform
CN102984587A (zh) * 2011-09-05 2013-03-20 深圳市快播科技有限公司 一种视频播放的优化方法、装置及点播终端
CN105898295A (zh) * 2015-12-01 2016-08-24 乐视致新电子科技(天津)有限公司 一种播放器解码方法和装置
CN106210726A (zh) * 2016-08-08 2016-12-07 成都佳发安泰科技股份有限公司 根据cpu与gpu的使用率对视频数据进行自适应解码的方法
CN107707976A (zh) * 2017-09-29 2018-02-16 维沃移动通信有限公司 一种视频解码方法及移动终端
CN108632667A (zh) * 2017-03-21 2018-10-09 腾讯科技(深圳)有限公司 一种多媒体文件的解码方法及终端
CN109640094A (zh) * 2018-11-27 2019-04-16 Oppo广东移动通信有限公司 视频解码方法、装置以及电子设备

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9648325B2 (en) * 2007-06-30 2017-05-09 Microsoft Technology Licensing, Llc Video decoding implementations for a graphics processing unit
JP2011029868A (ja) * 2009-07-24 2011-02-10 Ricoh Co Ltd 端末装置、遠隔会議システム、端末装置の制御方法、端末装置の制御プログラム、及び端末装置の制御プログラムを記録したコンピュータ読み取り可能な記録媒体
US8699582B2 (en) * 2010-10-06 2014-04-15 Qualcomm Incorporated Context-based adaptations of video decoder
CN202111812U (zh) * 2011-01-17 2012-01-11 博视联(苏州)信息科技有限公司 软硬件结合解码的通用多媒体播放设备
CN103778474A (zh) * 2012-10-18 2014-05-07 华为技术有限公司 资源负载量预测方法、分析预测系统及业务运营监控系统
CN104866381B (zh) * 2014-02-20 2018-10-12 联想(北京)有限公司 一种信息处理方法及第一电子设备
CN106454413B (zh) * 2016-09-20 2019-10-08 北京小米移动软件有限公司 直播编码切换方法、装置及设备
CN107241650B (zh) * 2017-08-09 2020-06-30 四川长虹电器股份有限公司 一种快速定位播放卡顿现象原因的方法
CN109120939B (zh) * 2018-07-16 2021-04-06 北京奇艺世纪科技有限公司 一种视频App解码方法及装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010692B1 (en) * 2009-11-05 2011-08-30 Adobe Systems Incorporated Adapting audio and video content for hardware platform
CN102984587A (zh) * 2011-09-05 2013-03-20 深圳市快播科技有限公司 一种视频播放的优化方法、装置及点播终端
CN105898295A (zh) * 2015-12-01 2016-08-24 乐视致新电子科技(天津)有限公司 一种播放器解码方法和装置
CN106210726A (zh) * 2016-08-08 2016-12-07 成都佳发安泰科技股份有限公司 根据cpu与gpu的使用率对视频数据进行自适应解码的方法
CN108632667A (zh) * 2017-03-21 2018-10-09 腾讯科技(深圳)有限公司 一种多媒体文件的解码方法及终端
CN107707976A (zh) * 2017-09-29 2018-02-16 维沃移动通信有限公司 一种视频解码方法及移动终端
CN109640094A (zh) * 2018-11-27 2019-04-16 Oppo广东移动通信有限公司 视频解码方法、装置以及电子设备

Also Published As

Publication number Publication date
CN109640094B (zh) 2021-06-15
CN109640094A (zh) 2019-04-16

Similar Documents

Publication Publication Date Title
CN109151573B (zh) 视频增强控制方法、装置以及电子设备
US11627369B2 (en) Video enhancement control method, device, electronic device, and storage medium
US11456013B2 (en) Video decoding control method, electronic device, and storage medium
KR102558385B1 (ko) 비디오 증강 제어 방법, 장치, 전자 기기 및 저장 매체
CN109600654B (zh) 弹幕处理方法、装置以及电子设备
WO2020038127A1 (zh) 解码方法、装置、电子设备以及存储介质
CN109618228B (zh) 视频增强控制方法、装置以及电子设备
US11562772B2 (en) Video processing method, electronic device, and storage medium
WO2020107970A1 (zh) 视频解码方法、装置、电子设备及存储介质
CN109587561B (zh) 视频处理方法、装置、电子设备及存储介质
CN109587555B (zh) 视频处理方法、装置、电子设备及存储介质
CN109120979B (zh) 视频增强控制方法、装置以及电子设备
CN109379630B (zh) 视频处理方法、装置、电子设备及存储介质
EP3264284B1 (en) Data processing method and device
CN109218803B (zh) 视频增强控制方法、装置以及电子设备
CN117221293A (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: 19891313

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19891313

Country of ref document: EP

Kind code of ref document: A1