WO2020038127A1 - 解码方法、装置、电子设备以及存储介质 - Google Patents

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

Info

Publication number
WO2020038127A1
WO2020038127A1 PCT/CN2019/094439 CN2019094439W WO2020038127A1 WO 2020038127 A1 WO2020038127 A1 WO 2020038127A1 CN 2019094439 W CN2019094439 W CN 2019094439W WO 2020038127 A1 WO2020038127 A1 WO 2020038127A1
Authority
WO
WIPO (PCT)
Prior art keywords
decoding
video data
target application
video
electronic device
Prior art date
Application number
PCT/CN2019/094439
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 WO2020038127A1 publication Critical patent/WO2020038127A1/zh

Links

Images

Classifications

    • 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/434Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
    • H04N21/4341Demultiplexing of audio and video streams
    • 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
    • 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/4431OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB characterized by the use of Application Program Interface [API] libraries

Definitions

  • the present application relates to the technical field of electronic devices, and more particularly, to a decoding method, device, electronic device, and storage medium.
  • this application proposes a decoding method, device, electronic device, and storage medium to solve the above problems.
  • an embodiment of the present application provides a decoding method applied to an electronic device.
  • the method includes: when the electronic device runs a target application, determining whether the target application is in a preset list, Wherein, the target application can output video data when it is running; if the target application is in the preset list, a decoding method of the video data is determined from a hard solution video enhancement method and a soft solution video enhancement method. ; Decoding and playing the video data using the determined decoding mode.
  • an embodiment of the present application provides a decoding apparatus applied to an electronic device.
  • the device includes: a determining module, configured to determine whether the target application is running when the electronic device runs a target application. In a preset list, the target application can output video data when it is running; a determining module is configured to: if the target application is in the preset list, from a hard solution video enhancement method and a soft solution video enhancement method A decoding mode of the video data is determined in a mode; a decoding module is configured to use the determined decoding mode to decode and play the video data.
  • an embodiment of the present application provides an electronic device including a memory and a processor.
  • the memory is coupled to the processor, the memory stores instructions, and is executed when the instructions are executed by the processor.
  • the processor executes the above method.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the foregoing method.
  • FIG. 1 is a schematic flowchart of video playback according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a decoding method according to an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another decoding method according to an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of still another decoding method according to an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of another decoding method according to an embodiment of the present application.
  • FIG. 7 shows a block diagram of a decoding device provided by an embodiment of the present application.
  • FIG. 8 is a block diagram of an electronic device for performing a decoding method according to an embodiment of the present application.
  • FIG. 9 illustrates a storage unit for storing or carrying a program code for implementing a decoding method according to an embodiment of the present application.
  • FIG. 1 illustrates a video playback process.
  • the next job is to parse the audio and video data.
  • General video files are composed of two parts: video stream and audio stream. Different video formats have different packaging formats.
  • the process of combining audio and video streams into a file is called muxer, and the process of separating audio and video streams from media files is called a demuxer.
  • muxer the process of separating audio and video streams from media files.
  • demuxer To play a video file, you need to separate the audio and video streams from the file stream and decode them separately.
  • the decoded video frames can be directly rendered, and the audio frames can be sent to the buffer of the audio output device for playback.
  • video rendering The time stamp and audio playback need to be controlled synchronously.
  • video decoding may include hard decoding and soft decoding.
  • the hardware decoding is to transfer a part of the video data that was originally processed by a central processing unit (CPU) to a graphics processing unit (GPU).
  • CPU central processing unit
  • GPU graphics processing unit
  • the GPU's parallel computing capacity is much higher than the CPU, which can greatly reduce the load on the CPU, after the CPU usage is low, you can run some other programs at the same time, of course, for the better
  • processors such as the i5 2320, or any AMD quad-core processor, both hard decoding and soft decoding can be performed.
  • Media Framework obtains the video file to be played by the client through the API interface with the client and delivers it to Video Decode.
  • Media Framework is the multimedia framework in the Android system, MediaPlayer, MediaPlayerService, and Stagefrightplayer. Part of the basic framework of Android multimedia.
  • the multimedia framework adopts the C / S structure.
  • MediaPlayer acts as the client of the C / S structure
  • MediaPlayerService and Stagefrightplayer serve as the server of the C / S structure. They are responsible for playing multimedia files.
  • Stagefrightplayer the server completes the client's request and Respond.
  • VideoDecode is a super decoder that integrates the most commonly used audio and video decoding and playback for decoding video data.
  • soft decoding means that the CPU is used to decode the video by software.
  • Hard decoding refers to the independent completion of video decoding tasks through a dedicated daughter card device without resorting to the CPU.
  • the decoded video data will be sent to SurfaceFlinger, and SurfaceFlinger will render and synthesize the decoded video data and display it on the display.
  • SurfaceFlinger is an independent service that receives all the Surface of the Window as input, calculates the position of each Surface in the final composite image according to the parameters of ZOrder, transparency, size, position, etc., and then sends it to HWComposer or OpenGL to generate the final Display buffer, and then display to a specific display device.
  • the CPU decodes the video data and passes it to SurfaceFlinger for rendering and compositing, and after hard decoding is decoded by the GPU, it passes to SurfaceFlinger for rendering and compositing.
  • the SurfaceFlinger will call the GPU to render and composite the image, and display it on the display.
  • the current electronic device's processing method of video data is fixed, for example, it is fixed to use hard decoding to decode or fixed to use soft decoding to decode, etc. It will not choose a suitable processing method for different applications. Poor video results and poor user experience.
  • the inventor has discovered through long-term research and proposed the decoding method, device, electronic device and storage medium provided in the embodiments of the present application.
  • the application is in a preset list
  • the video enhancement method and software In the video enhancement method, a decoding method is determined to decode and play video data, and an adaptive decoding method is automatically selected to improve video effects and user experience.
  • the specific decoding method is described in detail in the subsequent embodiments.
  • FIG. 2 is a schematic flowchart of a decoding method according to an embodiment of the present application.
  • the decoding method is used to determine a decoding method to decode and play video data from a hard solution video enhancement method and a soft solution video enhancement method when an application program is in a preset list, so as to automatically select an adaptive decoding method and improve the video. Effect and user experience.
  • the decoding method is applied to a decoding apparatus 200 as shown in FIG. 7 and an electronic device 100 (FIG. 8) configured with the decoding apparatus 200.
  • FIG. 8 an electronic device is taken as an example to describe the specific process of this embodiment.
  • the electronic device applied in this embodiment may be a smart phone, a tablet computer, a wearable electronic device, a vehicle-mounted device, a gateway, etc. This is not specifically limited.
  • the process shown in FIG. 2 will be described in detail below.
  • the decoding method may specifically include the following steps:
  • Step S110 When the electronic device has a target application running, determine whether the target application is on a preset list, where the target application can output video data when running.
  • the applications running on the electronic device may include applications running on the foreground of the electronic device, applications running on the background of the electronic device, or applications running on the foreground and background of the electronic device.
  • an application running in the foreground refers to an application that can usually interact with the user.
  • An application that can run in the foreground is suspended when it is not visible (such as a game).
  • An application running in the background refers to the user Interaction is very limited. Except during the configuration, its other lifetimes are hidden (such as SMS auto-response program and alarm clock program); applications that are switched between the foreground and background of the electronic device are those that can be used in the foreground and background. Switch between applications at will. Understandably, when the application program is not killed, it indicates that the application program runs on the electronic device.
  • the electronic device may run only one application or multiple applications at the same time.
  • the application may run in the foreground of the electronic device and in the background of the electronic device. Or switch operation in the foreground and background of the electronic device; when the electronic device runs multiple applications at the same time, the multiple applications can all run in the background of the electronic device, and one of the multiple applications is in the foreground of the electronic device Run, the remaining applications run in the background of the electronic device or one of the multiple applications is switched between the foreground and background of the electronic device, and the remaining applications run in the background of the electronic device, which are not limited here.
  • a target application program is determined from the application program.
  • the target application program may include a single application program or multiple application programs.
  • the number of the target applications is one and the target applications are run in the foreground of the electronic device.
  • the target application can output video data when it is running, that is, the target application can output video data and audio data at the same time.
  • the target application can include Video playback applications or game applications.
  • the electronic device when it is determined that the electronic device is running a target application, it indicates that the electronic device is outputting video data. Therefore, it may be performed to determine whether the target application is in a preset list, where the preset list may be whitelist.
  • the step of judging whether the target application is in a preset list is performed, where a touch on an icon corresponding to the target application can be detected.
  • the electronic device is considered to start running the target application.
  • the electronic device When receiving the voice message instructing to start the target application, the electronic device is considered to start running the target application, and the electronic device may start to display the target application. When the page is viewed, the electronic device is considered to start running the target application, which is not limited here.
  • the preset list may be established in advance by the electronic device, or may be established in advance by a server connected to the electronic device and sent to the electronic device for storage, which is not limited herein.
  • the preset list may include an application identifier of an application that meets the requirements of the preset list.
  • the application identifier may be an application package name, an application name, an application manufacturer, or an application layer. Therefore, when the target application is running on the electronic device, the application identifier of the target application can be extracted, and it can be determined whether the identifier of the target application is stored in a preset list in advance.
  • the preset when the identifier of the target application is included in the application identifier stored in the list, it indicates that the target application is in a preset list; when the identifier of the target application is not included in the application identifier stored in the preset list , Indicating that the target application is not in the preset list.
  • the identifier of the target application can be compared with multiple application identifiers stored in the preset list one by one to determine whether the application identifier stored in the preset list is consistent with the identifier of the target application. To determine whether the target application is in the preset list. Of course, in this embodiment, it can also be determined by other methods, which will not be repeated here.
  • Step S120 if the target application is in the preset list, determine a decoding mode of the video data from a hard solution video enhancement method and a soft solution video enhancement method.
  • the target application when the target application is in the preset list, it means that the target application meets the requirements of the preset list, that is, the video data output by the target application can be decoded.
  • Video enhancement at the same time, because different applications use different decoding methods, for example, applications can use hard decoding to decode, soft decoding to decode, and soft decoding and hard decoding to switch decoding. Therefore, when the target application is in the preset list, it can be determined based on the target application whether the video data is decoded using the hard solution video enhancement method or the video data is decoded using the soft solution video enhancement method.
  • Decode the video enhancement method to decode the video data through hard decoding, and then optimize and enhance the video data through the video enhancement method; softly decompress the video enhancement mode to characterize the video data through the soft decoding, and then use the video enhancement method. Optimize and enhance video data.
  • the way of video enhancement may include at least one of exposure enhancement, desiccation, edge sharpening, contrast increase, or saturation enhancement.
  • each frame of image data of the decoded video data is in the RGBA format
  • the data in the RGBA format needs to be converted into the data in the HSV format.
  • the histogram of the image data is obtained.
  • the exposure enhancement can be used to increase the brightness of the image.
  • the histogram of the image can be used to increase the brightness value of the area with a lower brightness value.
  • the brightness of the image can be increased by nonlinear superposition. Specifically, I represents a darker image to be processed, and T represents a lighter image after processing.
  • T and I are both [0,1] values. If one effect is not good, the algorithm can iterate multiple times.
  • denoising image data is used to remove image noise.
  • images are often degraded due to interference and influence of various noises. This has a subsequent effect on image processing and image visual effects. Will have adverse effects.
  • noise such as electrical noise, mechanical noise, channel noise and other noises. Therefore, in order to suppress noise, improve image quality, and facilitate higher-level processing, the image must be denoised pre-processed. 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 working principle is similar to the mean filter, which takes the mean value of the pixels in the filter window as the output.
  • the coefficients of the window template and the mean filter are different, and the template coefficients of the mean filter are all the same; while the template coefficient of the Gaussian filter decreases as the distance from the template center increases. Therefore, the Gaussian filter has less blurred image 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 to sample.
  • the coordinates of each position of the template are brought into the Gaussian function, and the value obtained is the coefficient of the template.
  • Convolution of the Gaussian filter window and the image can denoise the image.
  • edge sharpening is used to make blurred images clearer.
  • image sharpening There are two methods of 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 a grayscale transformation operation.
  • gray scale transformation the gray value is stretched to the entire range of 0-255, then its contrast is obviously greatly enhanced.
  • I (x, y) [(I (x, y) -Imin) / (Imax-Imin)] (MAX-MIN) + MIN;
  • Imin and Imax are the minimum and maximum gray values of the original image
  • MIN and MAX are the minimum and maximum gray values of the gray space to be stretched.
  • Step S130 Decode and play the video data using the determined decoding mode.
  • the decoding method may be used to decode and play the video data that the target application is ready to output.
  • the video data is first decoded by the hard decoding method, and then the video data is subjected to exposure enhancement, de-drying, Edge sharpening, contrast increase and / or saturation enhancement, etc., so as to obtain the video data after video enhancement for playback;
  • the soft decoding method is first adopted Decode the video data, and then perform exposure enhancement, desalination, edge sharpening, contrast increase, and / or saturation enhancement on the video data to obtain video enhanced video data for playback, thereby achieving Improve the video output of the target application.
  • the decoding method when an electronic device is running a target application program, it is determined whether the target application program is in a preset list. If the target application program is in the preset list, the video enhancement method and the soft solution are decoded from hard. The video enhancement method is used to determine the decoding method of the video data. The determined decoding method is used to decode and play the video data, so that when the application is in the preset list, the hard solution video enhancement method and soft solution video enhancement method Determine the decoding method to decode and play the video data, and automatically select the suitable decoding method to improve the video effect and user experience.
  • FIG. 3 is a schematic flowchart of a decoding method according to another embodiment of the present application.
  • the decoding method is applied to the above-mentioned electronic device.
  • the preset list includes a first-class list and a second-class list. The following describes the process shown in FIG. 3 in detail.
  • the method may specifically include the following steps:
  • Step S210 When the electronic device is running a target application, determine whether the target application is in a preset list, wherein the target application can output video data when the target application is running.
  • step S210 For a detailed description of step S210, please refer to step S110, and details are not described herein again.
  • Step S220 if the target application is in the first-type list, determine the hard-decoded video enhancement mode as the video data decoding mode.
  • the preset list includes a type 1 list and a type 2 list, and the type 1 list and the type 2 list correspond to different decoding methods, for example, a type 1 list corresponds to a hard solution video enhancement method and a type 2 list.
  • a type 1 list corresponds to a hard solution video enhancement method and a type 2 list.
  • the first type list corresponds to the soft solution video enhancement method
  • the second type list corresponds to the hard solution video enhancement method.
  • the first type list corresponds to the hard solution video enhancement method.
  • the second type list corresponds to a soft solution video enhancement method.
  • the first-class list includes application identifiers of applications that meet the requirements of the first-class list
  • the second-class list includes application identifiers of applications that meet the requirements of the second-class list. Therefore, target applications are run on electronic devices. During the program, it can be determined whether the target application is in a list, and the identifier of the target application can be compared with the application identifier in the list to determine whether the target application is in a list. And determine whether the target application is in the second-class list. Similarly, the identifier of the target application and the application ID in the second-class list can be compared to determine whether the target application is in the second-class list.
  • the video data output by the target application may be decoded correspondingly by using a decoding method corresponding to the type of list.
  • a hard solution video enhancement method may be determined as the video data. Decoding mode to decode the video data.
  • Step S230 if the target application is in the second-type list, determine the soft-decompressed video enhancement mode as the video data decoding mode.
  • the video data output by the target application can be decoded correspondingly by using the decoding method corresponding to the second category list.
  • the soft solution video enhancement mode can be determined as the video data. Decoding mode to decode the video data.
  • Step S240 Decode and play the video data using the determined decoding mode.
  • step S240 For a detailed description of step S240, please refer to step S130, and details are not described herein again.
  • the decoding method when the electronic device is running with a target application, it is determined whether the target application is in a preset list. If the target application is in a type of list, the hard solution video enhancement method is determined as The decoding method of the video data, if the target application is in the second category list, the soft solution video enhancement method is determined as the decoding method of the video data, and the determined decoding method is used to decode and play the video data, compared to FIG. 2
  • the decoding method shown in this embodiment divides the preset list into a first-type list and a second-type list, and determines different decoding methods according to different lists, so as to quickly determine the decoding method of the video data of the target application program, and improve the video data. Decoding speed.
  • FIG. 4 is a schematic flowchart illustrating a decoding method according to another embodiment of the present application.
  • the decoding method is applied to the above electronic device, and the process shown in FIG. 4 will be described in detail below.
  • the method may specifically include the following steps:
  • Step S310 When the electronic device has a target application running, determine whether the target application is on a preset list, where the target application can output video data when running.
  • step S310 For a detailed description of step S310, refer to step S110, and details are not described herein again.
  • Step S320 if the target application is in the preset list, identify the target application to obtain target data.
  • the target application when the target application is in the preset list, the target application is identified to extract target data in the target application. It is understandable that the target data can be located through the target data.
  • the target data may include a package name of the application, a name of the application, a manufacturer of the application, a layer of the application, and the like.
  • the target application when the target application is in the preset list, the target application is identified, and the package name of the application in the target application is extracted.
  • the package name of the application includes various information related to the application. Therefore, the application package name may be analyzed to obtain a specific application program characterized in the package name of the application.
  • the Android system is taken as an example.
  • the version number of the application program is configured in the AndroidManifest.xml file
  • the PackageInfo class encapsulates all the information obtained from the configuration file. , Describes the overall information of the package content, therefore, you can use the versionName property of the PackageInfo object to get the version number of the application, and you can get the PackageInfo object through the PackageManager object, where PackageManager is a retrieved related applications currently installed on the device
  • the getPackageInfo method in the PackageManager object can get the PackageInfo object. This method needs to pass two parameters: the application package name and the condition.
  • the package name of an application can be obtained by the getPackageName () method of Activity or Context (Activity inherits from Context), and adding can have many settings, usually set to 0. Finally, the PackageManager object is obtained.
  • the Context object provides the getPackageManager () method to obtain the object. Therefore, the package name of the target application can be obtained based on the above method.
  • Step S330 Based on the target data, determine a decoding mode of the video data from the hard solution video enhancement method and the soft solution video enhancement method.
  • a specific application program can be determined through the target data, and then a decoding method can be determined from the hard solution video enhancement method and the soft solution video enhancement method according to the decoding method corresponding to the application program.
  • a decoding method can be determined from the hard solution video enhancement method and the soft solution video enhancement method according to the decoding method corresponding to the application program.
  • the specific application can be determined by the package name of the application, and then according to the decoding method corresponding to the application, the hard solution video enhancement method and the soft solution video enhancement method can be selected. Determine a decoding method.
  • Step S340 Decode and play the video data using the determined decoding mode.
  • step S340 For a detailed description of step S340, please refer to step S130, and details are not described herein again.
  • Step S350 if the target application is not in the preset list, decode and play the video data by a default decoding method of the electronic device.
  • the target application when the target application is not in the preset list, that is, when the identifier of the application stored in the preset list does not include an identifier that matches the identifier of the target application , It indicates that the target application does not meet the requirements of the preset list. For example, due to the format problem of the target application, during the video enhancement process, there will be splash screens and stuck problems, such as the WMV format. Therefore, if a hard solution video enhancement method or a soft solution video enhancement method is used, Decoding the video data of the target application will cause the video data to be frozen and affect the playback effect and user experience. Therefore, for this type of application, the video data is decoded and played by the default decoding method of the electronic device. In order to avoid the problem of video data freeze, the electronic device default decoding mode does not perform video enhancement processing on the video data.
  • a blacklist may be created on the electronic device, and the identifier of an application program not in the preset list is stored in the blacklist.
  • a default decoding is adopted correspondingly. The method decodes the video data output by the application program to improve the decoding speed.
  • the decoding method when the electronic device is running a target application, it is determined whether the target application is in a preset list. If the target application is in the preset list, the target application is identified to obtain the target data. Based on the target data, determine the decoding method of the video data from the hard solution video enhancement method and the soft solution video enhancement method, and use the determined decoding method to decode and play the video data. If the target application is no longer in the preset list, Then the video data is decoded and played by the default decoding method of the electronic device. Compared with the decoding method shown in FIG. 2, this embodiment also obtains the target application by obtaining the target application when the target application is in the preset list. Select the corresponding decoding method for the method of target data, and select the default decoding method when the target application is not in the preset list, to accurately locate the decoding method of the target application, and improve the decoding speed of video data.
  • FIG. 5 is a schematic flowchart of a decoding method according to still another embodiment of the present application.
  • the decoding method is applied to the above-mentioned electronic device, and the process shown in FIG. 5 will be described in detail below.
  • the method may specifically include the following steps:
  • Step S410 When the electronic device has a target application running, determine whether the target application is on a preset list, where the target application can output video data when running.
  • Step S420 if the target application is in the preset list, determine a decoding mode of the video data from a hard solution video enhancement method and a soft solution video enhancement method.
  • steps S410 to S420 please refer to steps S310 to S320, and details are not described herein again.
  • Step S430 Decode the video data in the hard-decompressed video enhancement mode.
  • the target application when the target application supports both a hard-decompressed video enhancement method and a soft-decompressed video enhancement method, that is, when the target application can be decoded through hard decoding or soft decoding, and video enhancement processing can be performed after decoding
  • the video data of the target application can be decoded by a hard solution video enhancement method first.
  • Step S440 When it is detected that the decoding of the video data fails, the video data is decoded by the soft-decoding video enhancement mode.
  • the electronic device monitors the decoding status of the video data in real time, for example, monitors the decoding speed, decoding efficiency, decoding success rate, decoding process, etc. of the video data in real time, and then judges the decoding speed, decoding efficiency, and decoding success. It is understandable whether the decoding rate and the decoding process are normal. When the decoding speed is lower than the preset speed, the decoding efficiency is lower than the preset efficiency, the decoding success rate is lower than the preset success rate, or the decoding is interrupted, the video data is decoded.
  • the video data can continue to be decoded through the soft solution video enhancement method, where the object decoded by the soft solution video enhancement method can be all video data, or it can be left over after being decoded by the hard solution video enhancement method.
  • the video data is not limited here, so that the smoothness of video playback can be guaranteed.
  • Step S450 Play the decoded video data.
  • the decoding method when the electronic device is running a target application, it is determined whether the target application is in a preset list. If the target application is in the preset list, the video enhancement method and In the soft solution video enhancement method, the decoding method of the video data is determined, and the video data is decoded by the hard solution video enhancement method. When the video data decoding failure is detected, the video data is decoded by the soft solution video enhancement method. Compared with the decoding method shown in FIG. 2, the decoded video data is played. This embodiment can effectively reduce the CPU pressure and the failure of video decoding, and improve the decoding success rate.
  • FIG. 6 is a schematic flowchart of a decoding method according to another embodiment of the present application.
  • the decoding method is applied to the above-mentioned electronic device, and the process shown in FIG. 6 will be described in detail below.
  • the method may specifically include the following steps:
  • Step S510 When the electronic device has a target application running, determine whether the target application is on a preset list, wherein the target application can output video data when running.
  • Step S520 if the target application is in the preset list, determine a decoding mode of the video data from a hard-decoded video enhancement mode and a soft-decoded video enhancement mode.
  • Step S530 Decode the video data by using the hard-decompressed video enhancement method.
  • steps S510 to S530 please refer to steps S410 to S430, and details are not described herein again.
  • Step S540 Detect the current usage rate of the central processing unit and the current usage rate of the graphics processor of the electronic device.
  • the central processing unit can perform soft decoding on the video data, and the graphics processing unit can perform hard decoding on the video data. Therefore, in this embodiment, the current usage rate of the central processor of the electronic device and the current usage rate of the graphics processor in the process of decoding the video data in a hard-decoded video enhancement mode can be detected separately. In this embodiment, the current usage rate of the central processing unit can be detected in real time, or the current usage rate of the central processing unit can be detected at preset intervals.
  • Accuracy which can detect the current usage rate of the central processing unit in real time; similarly, the current usage rate of the graphics processor can be detected in real time, or the current usage rate of the graphics processor can be detected at preset intervals, as a way to ensure The accuracy of the current usage of the graphics processor can be detected in real time
  • Step S550 when the current usage rate of the central processing unit is lower than a first threshold and the current usage rate of the graphics processor is higher than a second threshold, decoding the video data through the soft solution video enhancement mode , Wherein the first threshold is not greater than the second threshold.
  • the current usage rate of the central processing unit when the current usage rate of the central processing unit is too high, it means that the central processing unit does not have sufficient resources to soft-decode the video data. Similarly, when the current utilization rate of the graphics processing unit is too high, it means that the graphics processing unit is insufficient. To hard-decode video data. Therefore, in the process of electronic device hard decoding video data through the graphics processor, if the current usage rate of the central processing unit is far lower than the current usage rate of the graphics processor, the video data can be switched to soft-decompressed video enhancement Decoding mode, that is, switching from graphics processor decoding to central processor decoding, thereby ensuring the decoding efficiency of video data.
  • the electronic device is preset with a first threshold and a second threshold, where the first preset is not greater than the second threshold, that is, the first threshold may be smaller than the second threshold, for example, the first A threshold value is 70%, the second threshold value is 80%, or the first threshold value may be equal to the second threshold value.
  • the first threshold value is 70% and the second threshold value is also 70%.
  • the first threshold and the second threshold are used as a basis for judging the current usage rate of the central processing unit and the current usage rate of the graphics processor, that is, obtaining the current usage rate of the central processing unit and the graphics processing unit's After the current usage rate, the current usage rate of the central processing unit may be compared with the first threshold value and the second threshold value to determine the current utilization rate of the central processing unit. Similarly, graphics processing may be performed. The current usage rate of the processor is compared with the first threshold and the second threshold, respectively, to determine the current usage rate of the graphics processor.
  • the video data is hard-decoded, and the current usage rate of the central processing unit is low, and the video data can be soft-decoded. Therefore, the video data can be decoded by using a soft-decoding video enhancement method.
  • the video enhancement method determines the decoding method of the video data, decode the video data through the hard decoding video enhancement method, and detect the current usage rate of the central processing unit of the electronic device and the current usage rate of the graphics processor.
  • the video data is decoded by means of soft-decoding video enhancement to reduce the power consumption of the CPU and improve Decoding efficiency of video data.
  • FIG. 7 illustrates a block diagram of a decoding device 200 according to an embodiment of the present application.
  • the decoding device 200 is applied to the electronic device. The following is a description of the block diagram shown in FIG. 7.
  • the decoding device 200 includes a judgment module 210, a determination module 220, and a decoding module 230, where:
  • the determining module 210 is configured to determine whether the target application is in a preset list when the electronic device is running a target application, and the target application can output video data when the target application is running.
  • a determining module 220 is configured to determine a decoding method of the video data from a hard solution video enhancement method and a soft solution video enhancement method if the target application is in the preset list. Further, the preset list includes a first-type list and a second-type list, and the determining module 220 includes a determining submodule, wherein:
  • a determining submodule configured to determine the hard-decoded video enhancement mode as the video data decoding mode if the target application is in the first-class list.
  • the determining submodule is further configured to determine the soft solution video enhancement mode as the video data decoding mode if the target application is in the second-type list.
  • the determining module 220 further includes: a target data acquisition submodule, wherein:
  • a target data acquisition submodule is configured to identify the target application to obtain target data if the target application is in the preset list. Further, the target data acquisition submodule includes: a package name acquisition unit, wherein:
  • the package name obtaining unit is configured to identify the target application to obtain the package name of the target application if the target application is in the preset list.
  • the determining submodule is further configured to determine a decoding mode of the video data from the hard solution video enhancement method and the soft solution video enhancement method based on the target data. Further, the determining submodule includes: a determining unit, wherein:
  • a determining unit configured to determine a decoding mode of the video data from the hard solution video enhancement mode and the soft solution video enhancement mode based on the package name.
  • the decoding module 230 is configured to decode and play the video data by using the determined decoding mode. Further, when the target application simultaneously supports the hard-view
  • the decoding module 230 includes a first decoding sub-module, a second decoding sub-module, a playback sub-module, a usage detection sub-module, and a third decoding sub-module, where:
  • a first decoding sub-module is configured to decode the video data by using the hard decoded video enhancement mode.
  • a second decoding sub-module is configured to decode the video data by using the soft solution video enhancement mode when the video data decoding failure is detected.
  • the playback sub-module is used to play the decoded video data.
  • a usage rate detection submodule is configured to detect a current usage rate of a central processing unit and a current usage rate of a graphics processor of the electronic device.
  • a third decoding submodule configured to pass the video data through the soft solution when the current usage rate of the central processing unit is lower than a first threshold and the current usage rate of the graphics processor is higher than a second threshold Decoding is performed in a video enhancement manner, wherein the first threshold is not greater than the second threshold.
  • the decoding device 200 further includes a playback module, wherein:
  • a playback module configured to decode and play the video data by using a default decoding mode of the electronic device if the target application program is not in the preset list.
  • 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 separately 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 functional modules.
  • the decoding device includes a determination module, a determination module, and a decoding module.
  • the determination module is configured to determine whether the target application is in a preset list when the electronic device runs the target application, where The target application can output video data when running, and the determining module is configured to determine the video data from a hard solution video enhancement method and a soft solution video enhancement method if the target application is in the preset list
  • the decoding module is configured to use the determined decoding mode to decode and play the video data, so that when the application is in the preset list, the decoding is determined from the hard solution video enhancement method and the soft solution video enhancement method.
  • the video data is decoded and played in a manner to automatically select an adaptive decoding method to improve the video effect and user experience.
  • FIG. 8 is a structural block diagram of an electronic device 100 according to 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, or an e-book.
  • the electronic device 100 in the present 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 applications, where one or more applications may be stored in the memory 120 and is configured to be executed by one or more processors 110, and one or more programs are configured to execute the method as described in the foregoing method embodiment.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts in the entire electronic device 100, and executes or executes instructions, programs, code sets, or instruction sets stored in the memory 120 by calling or executing 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 (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). To implement a hardware form.
  • the processor 110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), and a modem.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • modem modem
  • the CPU mainly handles the operating system, user interface, and application programs; the GPU is responsible for rendering and rendering of the displayed content; the modem is used for wireless communication. It can be understood that the modem may not be integrated into the processor 110, and may be implemented by a single communication chip.
  • the memory 120 may include Random Access Memory (RAM), and may also include 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, and the like.
  • the storage data area may also store data (such as phonebook, audio and video data, and chat history data) created by the terminal 100 during use.
  • the codec 140 may be used to encode or decode video data, and then transmit the decoded video data to the screen 130 for display.
  • the codec 140 may be a GPU, a dedicated DSP, an FPGA, or an ASIG chip. Wait.
  • FIG. 9 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 code, which can be called by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a 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 of a program code 310 that executes any of the method steps in the above method. These program codes can be read from or written into one or more computer program products.
  • the program code 310 may be compressed, for example, in a suitable form.
  • the decoding method, device, electronic device, and storage medium provided in the embodiments of the present application, when the electronic device is running a target application, it is determined whether the target application is in a preset list, where the target application is running Can output audio data when the target application is in the preset list, determine the decoding method of the video data from the hard solution video enhancement method and the soft solution video enhancement method, and use the determined decoding method to decode and play the video data , So that when the application is in the preset list, the decoding method is determined from the hard solution video enhancement method and the soft solution video enhancement method to decode and play the video data, and the adaptive decoding method is automatically selected to improve the video effect and user experience. .

Landscapes

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

Abstract

本申请公开了一种解码方法、装置、电子设备以及存储介质,涉及电子设备技术领域。该方法应用于电子设备,所述方法包括:当电子设备运行有目标应用程序时,判断目标应用程序是否在预设名单中,其中,目标应用程序在运行时可输出视频数据,若目标应用程序在预设名单中,从硬解视频增强方式和软解视频增强方式中确定该视频数据的解码方式,使用所确定的解码方式对视频数据进行解码并播放。本申请实施例提供的解码方法、装置、电子设备以及存储介质,当应用程序在预设名单中时,从硬解视频增强方式和软解视频增强方式中确定解码方式对视频数据进行解码并播放,以自动选择适配的解码方式,提升视频效果以及用户体验。

Description

解码方法、装置、电子设备以及存储介质
相关申请的交叉引用
本申请要求于2018年8月23日提交的申请号为2018109695023的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及电子设备技术领域,更具体地,涉及一种解码方法、装置、电子设备以及存储介质。
背景技术
随着科学技术的发展,电子设备已经成为人们日常生活中最常用的电子产品之一。并且,用户经常会通过电子设备看视频或玩游戏等。
发明内容
鉴于上述问题,本申请提出了一种解码方法、装置、电子设备以及存储介质,以解决上述问题。
第一方面,本申请实施例提供了一种解码方法,应用于电子设备,所述方法包括:当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据;若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式;使用所确定的解码方式对所述视频数据进行解码并播放。
第二方面,本申请实施例提供了一种解码装置,应用于电子设备,所述装置包括:判断模块,用于当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据;确定模块,用于若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式;解码模块,用于使用所确定的解码方式对所述视频数据进行解码并播放。
第三方面,本申请实施例提供了一种电子设备,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行上述方法。
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1示出了本申请实施例提供的视频播放的流程示意图;
图2示出了本申请实施例提供的一个解码方法的流程示意图;
图3示出了本申请实施例提供的又一个解码方法的流程示意图;
图4示出了本申请实施例提供的再一个解码方法的流程示意图;
图5示出了本申请实施例提供的又再一个解码方法的流程示意图;
图6示出了本申请实施例提供的另一个解码方法的流程示意图;
图7示出了本申请实施例提供的解码装置的模块框图;
图8示出了本申请实施例用于执行根据本申请实施例的解码方法的电子设备的框图;
图9示出了本申请实施例的用于保存或者携带实现根据本申请实施例的解码方法的程序代码的存储单元。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
请参阅图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实现图像的渲染和合成,并在显示屏上显示。但是,目前电子设备对视频数据的处理方式固定,例如,固定采用硬解码方式进行解码或者固定采用软解码方式进行解码等,不会针对不同的应用程序选择与之适配的处理方式,输出的视频效果较差,用户体验不佳。
针对上述问题,发明人经过长期的研究发现,并提出了本申请实施例提供的解码方法、装置、电子设备以及存储介质,当应用程序在预设名单中时,从硬解视频增强方式和软解视频增强方式中确定解码方式对视频数据进行解码播放,以自动选择适配的解码方式,提升视频效果以及用户体验。其中,具体的解码方法在后续的实施例中进行详细的说明。
参阅图2,图2示出了本申请一个实施例提供的解码方法的流程示意图。所述解码方法用于当应用程序在预设名单中时,从硬解视频增强方式和软解视频增强方式中确定解码方式对视频数据进行解码播放,以自动选择适配的解码方式,提升视频效果以及用 户体验。在具体的实施例中,所述解码方法应用于如图7所示的解码装置200以及配置有所述解码装置200的电子设备100(图8)。下面将以电子设备为例,说明本实施例的具体流程,当然,可以理解的,本实施例所应用的电子设备可以为智能手机、平板电脑、穿戴式电子设备、车载设备、网关等,在此不做具体的限定。下面将针对图2所示的流程进行详细的阐述,所述解码方法具体可以包括以下步骤:
步骤S110:当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据。
在本实施例中,电子设备运行的应用程序可以包括在电子设备的前台运行的应用程序、在电子设备的后台运行的应用程序或在电子设备的前台和后台切换运行的应用程序,在此不做限定。具体的,前台运行的应用程序是指通常可以和用户进行交互,能运行在前台的应用程序,当它不可见时就会被挂起(比如:游戏);后台运行的应用程序是指和用户交互非常有限,除了配置期间,其生存期的其他时间都是隐藏的(比如:SMS自动回复程序和闹钟程序);在电子设备的前台和后台切换运行的应用程序是指可以在前台以及后台之间随意切换的应用程序。可以理解的,当应用程序没有被杀掉(kill)时,表征该应用程序在电子设备上运行。
进一步地,电子设备可以仅运行一个应用程序,也可以同时运行多个应用程序,其中,当电子设备仅运行一个应用程序时,该应用程序可以在电子设备的前台运行、在电子设备的后台运行或在电子设备的前台和后台切换运行;当电子设备同时运行多个应用程序时,该多个应用程序可以均在电子设备的后台运行、多个应用程序中的一个应用程序在电子设备的前台运行,其余应用程序在电子设备的后台运行或多个应用程序中的一个应用程序在电子设备的前台和后台切换运行,其余应用程序在电子设备的后台运行等,在此不做限定。
其中,在获取电子设备运行的应用程序后,从所述应用程序中确定目标应用程序,同样的,该目标应用程序可以包括单个应用程序,也可以包括多个应用程序,可选的,在本实施例中,所述目标应用程序的数量为一个且该目标应用程序在电子设备的前台运行。在本实施例中,所述目标应用程序在运行时可输出视频数据,也就是说,该目标应用程序在运行时可以同时输出视频数据和音频数据,作为一种方式,该目标应用程序可以包括视频播放类应用程序、或者游戏类应用程序等。
在本实施例中,当确定电子设备运行有目标应用程序时,表征该电子设备正在输出视频数据,因此,可以执行判断该目标应用程序是否在预设名单中,其中,该预设名单可以为白名单。可选的,当检测到电子设备开始运行目标应用程序时,就执行判断目标应用程序是否在预设名单中的步骤,其中,可以在检测到作用于与该目标应用程序对应的图标上的触控操作时,认为该电子设备开始运行目标应用程序,可以在接收到指示启动该目标应用程序的语音信息时,认为该电子设备开始运行目标应用程序,也可以在电子设备开始显示目标应用程序的页面时,认为该电子设备开始运行目标应用程序,在此不做限定。
作为一种方式,该预设名单可以由电子设备预先建立,也可以由与该电子设备连接的服务器预先建立并发送至电子设备存储,在此不做限定。其中,该预设名单中可以包括满足该预设名单要求的应用程序的应用程序标识,该应用程序标识可以为应用程序的包名、应用程序的名称、应用程序的厂家、应用程序的图层等,因此,在电子设备运行有目标应用程序时,可以提取该目标应用程序的应用程序标识,判断该目标应用程序的标识是否预先存储在预设名单中,可以理解的,当所述预设名单中存储的应用程序标识中包括该目标应用程序的标识时,表征该目标应用程序在预设名单中;当所述预设名单中存储的应用程序标识中没有包括该目标应用程序的标识时,表征该目标应用程序不在预设名单中。
作为一种方式,可以将目标应用程序的标识与预设名单中存储的多个应用程序标识一一进行对比,以判断该预设名单中存储的应用程序标识是否有与目标应用程序的标识一致的标识,从而判断该目标应用程序是否在预设名单中,当然,在本实施例中,还可以通过其他方式进行判断,在此不再赘述。
步骤S120:若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式。
在本实施例中,当所述目标应用程序在该预设名单中时,表征该目标应用程序满足该预设名单的要求,也就是说,该目标应用程序输出的视频数据在解码后可以进行视频增强。同时,由于不同的应用程序,采用的解码方式不同,例如,应用程序可以采用硬解码的方式进行解码、可以采用软解码的方式进行解码、也可以采用软解码和硬解码切换解码的方式进行解码等,因此,当该目标应用程序在预设名单中时,可以基于目标应用程序确定采用硬解视频增强方式对视频数据进行解码,还是采用软解视频增强方式对视频数据进行解码,其中,硬解视频增强方式表征通过硬解码对视频数据进行解码后,再通过视频增强的方式对视频数据进行优化增强;软解视频增强方式表征通过软解码对视频数据进行解码后,再通过视频增强的方式对视频数据进行优化增强。
作为一种方式,视频增强的方式可以包括曝光度增强、去燥、边缘锐化、对比度增加或饱和度增强中的至少一种。
具体地,由于经过解码之后的视频数据的每帧图像数据为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是要拉伸到的灰度空间的灰度最小值和最大值。
步骤S130:使用所确定的解码方式对所述视频数据进行解码并播放。
在本实施例中,当确定针对该目标应用程序采用的解码方式后,可以使用该解码方式对该目标应用程序准备输出的视频数据进行解码并播放。例如,当确定所述目标应用程序的解码方式为硬解视频增强方式时,则首先通过硬解码的方式对所述视频数据进行解码,然后再对所述视频数据进行曝光度增强、去燥、边缘锐化、对比度增加和/或饱和度增强等,从而得到视频增强后的视频数据进行播放;当确定所述目标应用程序的解码方式为软解视频增强方式时,则首先通过软解码的方式对所述视频数据进行解码,然后再对所述视频数据进行曝光度增强、去燥、边缘锐化、对比度增加和/或饱和度增强等,从而得到视频增强后的视频数据进行播放,从而实现提升目标应用程序输出的视频效果。
本申请一个实施例提供的解码方法,当电子设备运行有目标应用程序时,判断目标应用程序是否在预设名单中,若目标应用程序在预设名单中,从硬解视频增强方式和软解视频增强方式中确定该视频数据的解码方式,使用所确定的解码方式对视频数据进行解码并播放,从而当应用程序在预设名单中时,从硬解视频增强方式和软解视频增强方式中确定解码方式对视频数据进行解码播放,以自动选择适配的解码方式,提升视频效果以及用户体验。
请参阅图3,图3示出了本申请又一个实施例提供的解码方法的流程示意图。所述解码方法应用于上述电子设备,其中,预设名单包括一类名单和二类名单,下面将针对图3所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S210:当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据。
其中,步骤S210的具体描述请参阅步骤S110,在此不再赘述。
步骤S220:若所述目标应用程序在所述一类名单中,将所述硬解视频增强方式确定为所述视频数据的解码方式。
在本实施例中,所述预设名单包括一类名单和二类名单,且该一类名单和二类名单对应不同的解码方式,例如,一类名单对应硬解视频增强方式,二类名单对应软解视频增强方式,或者一类名单对应软解视频增强方式,二类名单对应硬解视频增强方式等,可选的,在本实施例中,所述一类名单对应硬解视频增强方式,所述二类名单对应软解视频增强方式。
进一步地,一类名单中包括满足该一类名单要求的应用程序的应用程序标识,二类名单中包括满足该二类名单要求的应用程序的应用程序标识,因此,在电子设备运行有目标应用程序时,可以判断该目标应用程序是否在一类名单中,其中,可以将该目标应用程序的标识和一类名单中的应用程序标识进行比较以判断该目标应用程序是否在一类名单中;以及判断该目标应用程序是否在二类名单中,同样的,可以将该目标应用程序的标识和二类名单中的应用程序标识进行比较以判断该目标应用程序是否在二类名单中。
其中,当目标应用程序在一类名单中时,可以对应采用一类名单对应的解码方式对目标应用程序输出的视频数据进行解码,具体地,可以将硬解视频增强方式确定为所述视频数据的解码方式,以对所述视频数据进行解码。
步骤S230:若所述目标应用程序在所述二类名单中,将所述软解视频增强方式确定为所述视频数据的解码方式。
其中,当目标应用程序在二类名单中时,可以对应采用二类名单对应的解码方式对目标应用程序输出的视频数据进行解码,具体地,可以将软解视频增强方式确定为所述视频数据的解码方式,以对所述视频数据进行解码。
步骤S240:使用所确定的解码方式对所述视频数据进行解码并播放。
其中,步骤S240的具体描述请参阅步骤S130,在此不再赘述。
本申请又一个实施例提供的解码方法,当电子设备运行有目标应用程序时,判断目标应用程序是否在预设名单中,若目标应用程序在一类名单中,将硬解视频增强方式确定为该视频数据的解码方式,若目标应用程序在二类名单中,将软解视频增强方式确定为该视频数据的解码方式,使用确定的解码方式对视频数据进行解码并播放,相较于图 2所示的解码方式,本实施例将预设名单分为一类名单和二类名单,并根据不同的名单确定不同的解码方式,以快速确定目标应用程序的视频数据的解码方式,提升视频数据的解码速度。
请参阅图4,图4是示出了本申请再一个实施例提供的解码方法的流程示意图。所述解码方法应用于上述电子设备,下面将针对图4所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S310:当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据。
其中,步骤S310的具体描述请参阅步骤S110,在此不再赘述。
步骤S320:若所述目标应用程序在所述预设名单中,识别所述目标应用程序获得目标数据。
在本实施例中,当所述目标应用程序在该预设名单中时,对该目标应用进行识别,以提取该目标应用程序中的目标数据,可以理解的,通过所述目标数据可以定位到具体的应用程序,其中,该目标数据可以包括应用程序的包名、应用程序的名称、应用程序的厂家、应用程序的图层等。
其中,以目标数据为应用程序的包名为例,当所述目标应用程序在该预设名单中时,对该目标应用进行识别,提取该目标应用程序中的应用程序的包名。其中,由于应用程序的包名包括与应用程序相关的各种信息,因此,可以对所述应用程序包名进行分析,获取该应用程序的包名中所表征的具体的应用程序。
其中,在本实施例中,以Android系统为例,在Android系统中,应用程序的版本号是在AndroidManifest.xml文件中进行配置的,而PackageInfo类则封装了从该配置文件中获取的所有信息,描述了包内容的整体信息,因此,可以使用PackageInfo对象的versionName属性获取应用的版本号,且可以通过PackageManager对象来获取PackageInfo对象,其中,PackageManager是一个检索当前已安装在设备上的相关应用程序包的各种信息的类,PackageManager对象中的getPackageInfo方法可以获取PackageInfo对象,该方法需要传递两个参数:应用包名和条件。通常情况下,应用程序的包名可以通过Activity或Context(Activity继承自Context)的getPackageName()方法获取,而添加可以有很多设置,通常设置为0。最后是PackageManager对象的获取,Context对象提供了getPackageManager()方法来获取该对象。因此,基于上述方法可以获取所述目标应用程序的包名。
步骤S330:基于所述目标数据,从所述硬解视频增强方式和所述软解视频增强方式中确定所述视频数据的解码方式。
可以理解的,通过所述目标数据,可以确定具体的应用程序,然后再根据该应用程序对应的解码方式,可以从硬解视频增强方式和软解视频增强方式中确定一个解码方式。例如,以应用程序的包名为例,通过应用程序的包名,可以确定具体的应用程序,然后再根据该应用程序对应的解码方式,可以从硬解视频增强方式和软解视频增强方式中确定一个解码方式。
步骤S340:使用所确定的解码方式对所述视频数据进行解码并播放。
其中,步骤S340的具体描述请参阅步骤S130,在此不再赘述。
步骤S350:若所述目标应用程序不在所述预设名单中,则通过所述电子设备默认的解码方式对所述视频数据进行解码并播放。
作为一种方式,当所述目标应用程序不在所述预设名单中时,也就是说,当所述预设名单中存储的应用程序的标识没有包括与所述目标应用程序的标识匹配的标识时,表征该目标应用程序不满足预设名单的要求。例如,由于该目标应用程序的格式问题,在进行视频增强的过程中,会有闪屏、卡死的问题,例如,WMV格式,因此,若采用硬解视频增强方式或软解视频增强方式对所述目标应用程序的视频数据进行解码,会造成视频数据的卡顿,影响播放效果和用户体验,因此,对于该类应用程序则通过电子设备默认的解码方式对所述视频数据进行解码并播放,以避免出现视频数据卡顿的问题,其中,电子设备默认的解码方式不 对所述视频数据进行视频增强处理。
其中,可以在电子设备创建黑名单,将不在所述预设名单中的应用程序的标识存储在黑名单中,当检测到电子设备运行有黑名单中的应用程序时,则对应采用默认的解码方式对所述应用程序输出的视频数据进行解码,以提高解码速度。
本申请再一个实施例提供的解码方法,当电子设备运行有目标应用程序时,判断该目标应用程序是否在预设名单中,若目标应用程序在预设名单中,识别目标应用程序获得目标数据,基于该目标数据从硬解视频增强方式和软解视频增强方式中确定视频数据的解码方式,使用所确定的解码方式对视频数据进行解码并播放,若目标应用程序不再预设名单中,则通过该电子设备默认的解码方式对该视频数据进行解码并播放,相较于图2所示的解码方法,本实施例还在目标应用程序在预设名单中时,通过获取目标应用程序的目标数据的方式选择对应的解码方式,以及在目标应用程序不在预设名单中时,选择默认的解码方式,以准确的定位目标应用程序的解码方式,提升视频数据的解码速度。
请参阅图5,图5示出了本申请又再一个实施例提供的解码方法的流程示意图。所述解码方法应用于上述电子设备,下面将针对图5所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S410:当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据。
步骤S420:若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式。
其中,步骤S410-步骤S420的具体描述请参阅步骤S310-步骤S320,在此不再赘述。
步骤S430:将所述视频数据通过所述硬解视频增强方式进行解码。
其中,当所述目标应用程序同时支持硬解视频增强方式和软解视频增强方式时,即当该目标应用程序可以通过硬解码或软解码的方式进行解码,并在解码后可以进行视频增强处理时,可以首先将该目标应用程序的视频数据通过硬解视频增强方式进行解码,以降低CPU的功耗。
步骤S440:当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码。
在本实施例中,电子设备实时监控该视频数据的解码状态,例如,实时监控该视频数据的解码速度、解码效率、解码成功率、解码过程等,然后判断该解码速度、解码效率、解码成功率、解码过程等是否正常,可以理解的,当所述解码速度低于预设速度、解码效率低于预设效率、解码成功率低于预设成功率或者解码中断时,表征该视频数据解码失败,则可以将所述视频数据通过软解视频增强方式继续进行解码,其中,通过软解视频增强方式进行解码的对象可以是所有的视频数据,也可以是经硬解视频增强方式解码后剩余的视频数据,在此不做限定,从而可以保证视频播放的流畅性。
步骤S450:将解码后的视频数据进行播放。
本申请又再一个实施例提供的解码方法,当电子设备运行有目标应用程序时,判断目标应用程序是否在预设名单中,若目标应用程序在预设名单中,从硬解视频增强方式和软解视频增强方式中确定该视频数据的解码方式,将该视频数据通过硬解视频增强方式进行解码,当检测到该视频数据解码失败时,将视频数据通过软解视频增强方式进行解码,将解码后的视频数据进行播放,相较于图2所示的解码方法,本实施例可以有效的减少CPU压力以及视频解码失败的情况,提升解码成功率。
请参阅图6,图6示出了本申请另一个实施例提供的解码方法的流程示意图。所述解码方法应用于上述电子设备,下面将针对图6所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S510:当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预 设名单中,其中,所述目标应用程序在运行时可输出视频数据。
步骤S520:若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式。
步骤S530:将所述视频数据通过所述硬解视频增强方式进行解码。
步骤S510-步骤S530的具体描述请参阅步骤S410-步骤S430,在此不再赘述。
步骤S540:检测所述电子设备的中央处理器的当前使用率和图形处理器的当前使用率。
可以理解的,在视频解码的过程中,中央处理器可以对所述视频数据进行软解码,而图形处理器可以对所述视频数据进行硬解码。因此,在本实施例中,可以分别检测在视频数据通过硬解视频增强方式进行解码的过程中,电子设备的中央处理器的当前使用率以及图形处理器的当前使用率。其中,在本实施例中,可以实时检测中央处理器的当前使用率,也可以间隔预设时长检测中央处理器的当前使用率,作为一种方式,为了保证中央处理器的当前使用率检测的准确性,可以实时检测中央处理器的当前使用率;同样的,可以实时检测图形处理器的当前使用率,也可以间隔预设时长检测图形处理器的当前使用率,作为一种方式,为了保证图形处理器的当前使用率检测的准确性,可以实时检测图形处理器的当前使用率
步骤S550:当所述中央处理器的当前使用率低于第一阈值且所述图形处理器的当前使用率高于第二阈值时,将所述视频数据通过所述软解视频增强方式进行解码,其中,所述第一阈值不大于所述第二阈值。
其中,当中央处理器的当前使用率过高时,说明中央处理器没有足够的资源对视频数据进行软解码,同理,当图形处理器的当前使用率过高时,说明图形处理器没有足够的资源对视频数据进行硬解码。因此,在电子设备通过图形处理器对视频数据进行硬解码的过程中,若中央处理器的当前使用率远低于图形处理器的当前使用率时,则可以将视频数据切换到软解视频增强方式进行解码,即从图形处理器解码切换到中央处理器解码,从而保证视频数据的解码效率。
在本实施例中,电子设备预先设置有第一阈值和第二阈值,其中,该第一预设不大于第二阈值,也就是说,该第一阈值可以小于第二阈值,例如,该第一阈值为70%,该第二阈值为80%,或者该第一阈值可以等于第二阈值,例如,该第一阈值为70%,该第二阈值也为70%。进一步地,该第一阈值和第二阈值用于作为中央处理器的当前使用率和图形处理器的当前使用率的判断依据,即在获取所述中央处理器的当前使用率和图形处理器的当前使用率后,可以将中央处理器的当前使用率分别与所述第一阈值和所述第二阈值进行比较,以判断该中央处理器的当前使用率的大小;同样的,可以将图形处理器的当前使用率分别与所述第一阈值和第二阈值进行比较,以判断该图形处理器的当前使用率大小。作为一种方式,当所述中央处理器的当前使用率低于第一阈值且图形处理器的当前使用率高于第二阈值时,表征该图形处理器的当前使用率过高时,没有足够的资源对视频数据进行硬解码,而中央处理器的当前使用率较低,可以对所述视频数据进行软解码,因此,可以将所述视频数据通过软解视频增强方式进行解码。
本申请另一个实施例提供的解码方法,当电子设备运行有目标应用程序时,判断目标应用程序是否在预设名单中,若目标应用程序在预设名单中,从硬解视频增强方式和软解视频增强方式中确定该视频数据的解码方式,将该视频数据通过硬解视频增强方式进行解码,检测电子设备的中央处理器的当前使用率和图形处理器的当前使用率,当中央处理器的当前使用率低于第一阈值,且图形处理器的当前使用率的当前使用率高于第二阈值时,将视频数据通过软解视频增强的方式进行解码,以降低CPU的功耗以及提升视频数据的解码效率。
请参阅图7,图7示出了本申请实施例提供的解码装置200的模块框图。所述解码装置200应用于上述电子设备。下面将针对图7所述的框图进行阐述,所述解码装置200包括:判断模块210、确定模块220以及解码模块230,其中:
判断模块210,用于当所述电子设备运行有目标应用程序时,判断所述目标应用程序是 否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据。
确定模块220,用于若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式。进一步地,所述预设名单包括一类名单和二类名单,所述确定模块220包括:确定子模块,其中:
确定子模块,用于若所述目标应用程序在所述一类名单中,将所述硬解视频增强方式确定为所述视频数据的解码方式。
所述确定子模块,还用于若所述目标应用程序在所述二类名单中,将所述软解视频增强方式确定为所述视频数据的解码方式。
进一步地,所述确定模块220还包括:目标数据获取子模块,其中:
目标数据获取子模块,用于若所述目标应用程序在所述预设名单中,识别所述目标应用程序获得目标数据。进一步地,所述目标数据获取子模块包括:包名获取单元,其中:
包名获取单元,用于若所述目标应用程序在所述预设名单中,识别所述目标应用程序获得所述目标应用程序的包名。
所述确定子模块,还用于基于所述目标数据,从所述硬解视频增强方式和所述软解视频增强方式中确定所述视频数据的解码方式。进一步地,所述确定子模块包括:确定单元,其中:
确定单元,用于基于所述包名,从所述硬解视频增强方式和所述软解视频增强方式中确定所述视频数据的解码方式。
解码模块230,用于使用所确定的解码方式对所述视频数据进行解码并播放。进一步地,当所述目标应用程序同时支持所述硬解视
频增强方式和所述软解视频增强方式时,所述解码模块230包括:第一解码子模块、第二解码子模块、播放子模块、使用率检测子模块以及第三解码子模块,其中:
第一解码子模块,用于将所述视频数据通过所述硬解视频增强方式进行解码。
第二解码子模块,用于当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码。
播放子模块,用于将解码后的视频数据进行播放。
使用率检测子模块,用于检测所述电子设备的中央处理器的当前使用率和图形处理器的当前使用率。
第三解码子模块,用于当所述中央处理器的当前使用率低于第一阈值且所述图形处理器的当前使用率高于第二阈值时,将所述视频数据通过所述软解视频增强方式进行解码,其中,所述第一阈值不大于所述第二阈值。
进一步地,所述解码装置200还包括:播放模块,其中:
播放模块,用于若所述目标应用程序不在所述预设名单中,则通过所述电子设备默认的解码方式对所述视频数据进行解码并播放。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
本申请实施例提供的解码装置包括判断模块、确定模块以及解码模块,其中,判断模块用于当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据,确定模块用于若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式,解码模块用于使用所确定的解码方式对所述视频数据进行解码并播放,从而当应用程序在预 设名单中时,从硬解视频增强方式和软解视频增强方式中确定解码方式对视频数据进行解码播放,以自动选择适配的解码方式,提升视频效果以及用户体验。
请参阅图8,其示出了本申请实施例提供的一种电子设备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中,单独通过一块通信芯片进行实现。
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
所述编解码器140可以用于对视频数据进行编码或解码,然后将解码后的视频数据传输到屏幕130进行显示,其中,该编解码器140可以为GPU、专用的DSP、FPGA、ASIG芯片等。
请参阅图9,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质300中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质300可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质300包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质300具有执行上述方法中的任何方法步骤的程序代码310的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码310可以例如以适当形式进行压缩。
综上所述,本申请实施例提供的解码方法、装置、电子设备以及存储介质,当电子设备运行有目标应用程序时,判断目标应用程序是否在预设名单中,其中,目标应用程序在运行时可输出音频数据,若目标应用程序在预设名单中,从硬解视频增强方式和软解视频增强方式中确定该视频数据的解码方式,使用所确定的解码方式对视频数据进行解码并播放,从而当应用程序在预设名单中时,从硬解视频增强方式和软解视频增强方式中确定解码方式对视频数据进行解码播放,以自动选择适配的解码方式,提升视频效果以及用户体验。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可 以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种解码方法,其特征在于,应用于电子设备,所述方法包括:
    当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据;
    若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式;
    使用所确定的解码方式对所述视频数据进行解码并播放。
  2. 根据权利要求1所述的方法,其特征在于,所述预设名单包括一类名单和二类名单,所述若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式,包括:
    若所述目标应用程序在所述一类名单中,将所述硬解视频增强方式确定为所述视频数据的解码方式;
    若所述目标应用程序在所述二类名单中,将所述软解视频增强方式确定为所述视频数据的解码方式。
  3. 根据权利要求1或2所述的方法,其特征在于,所述若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式,包括:
    若所述目标应用程序在所述预设名单中,识别所述目标应用程序获得目标数据;
    基于所述目标数据,从所述硬解视频增强方式和所述软解视频增强方式中确定所述视频数据的解码方式。
  4. 根据权利要求3所述的方法,其特征在于,所述若所述目标应用程序在所述预设名单中,识别所述目标应用程序获得目标数据,包括:
    若所述目标应用程序在所述预设名单中,识别所述目标应用程序获得所述目标应用程序的包名;
    所述基于所述目标数据,从所述硬解视频增强方式和所述软解视频增强方式中确定所述视频数据的解码方式,包括:
    基于所述包名,从所述硬解视频增强方式和所述软解视频增强方式中确定所述视频数据的解码方式。
  5. 根据权利要求3或4所述的方法,其特征在于,所述目标数据包括应用程序的包名、应用程序的名称、应用程序的厂家以及应用程序的图层中的至少一种。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,当所述目标应用程序同时支持所述硬解视频增强方式和所述软解视频增强方式时,所述使用所确定的解码方式对所述视频数据进行解码并播放,包括:
    将所述视频数据通过所述硬解视频增强方式进行解码;
    当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码;
    将解码后的视频数据进行播放。
  7. 根据权利要求6所述的方法,其特征在于,所述当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码之前,还包括:
    监测所述视频数据的解码速度;
    判断所述解码速度是否低于预设速度;
    当所述解码速度低于所述预设速度时,确定所述视频数据解码失败。
  8. 根据权利要求6或7所述的方法,其特征在于,所述当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码之前,还包括:
    监测所述视频数据的解码效率;
    判断所述解码效率是否低于预设效率;
    当所述解码效率低于所述预设效率时,确定所述视频数据解码失败。
  9. 根据权利要求6-8任一项所述的方法,其特征在于,所述当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码之前,还包括:
    监测所述视频数据的解码成功率;
    判断所述解码成功率是否低于预设成功率;
    当所述解码成功率低于所述预设成功率时,确定所述视频数据解码失败。
  10. 根据权利要求6-9任一项所述的方法,其特征在于,所述当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码之前,还包括:
    对所述视频数据的解码过程进行监测;
    当所述视频数据的解码中断时,确定所述视频数据解码失败。
  11. 根据权利要求6-10任一项所述的方法,其特征在于,所述当检测到所述视频数据解码失败时,将所述视频数据通过所述软解视频增强方式进行解码,包括:
    当监测到所述视频数据解码失败时,重新将所述视频数据通过所述软解视频增强方式进行解码;或
    当监测到所述视频数据解码失败时,获取所述视频数据在解码失败时所剩余的未解码的视频数据;
    将所述未解码的视频数据通过所述软解视频增强方式进行解码。
  12. 根据权利要求6-11任一项所述的方法,其特征在于,所述将所述视频数据通过所述硬解视频增强方式进行解码之后,还包括:
    检测所述电子设备的中央处理器的当前使用率和图形处理器的当前使用率;
    当所述中央处理器的当前使用率低于第一阈值且所述图形处理器的当前使用率高于第二阈值时,将所述视频数据通过所述软解视频增强方式进行解码,其中,所述第一阈值不大于所述第二阈值。
  13. 根据权利要求12所述的方法,其特征在于,所述检测所述电子设备的中央处理器的当前使用率和图形处理器的当前使用率,包括:
    实时检测所述电子设备的中央处理器的当前使用率和图形处理器的当前使用率。
  14. 根据权利要求1-13任一项所述的方法,其特征在于,所述方法还包括:
    若所述目标应用程序不在所述预设名单中,则通过所述电子设备默认的解码方式对所述视频数据进行解码并播放。
  15. 根据权利要求1-14任一项所述的方法,其特征在于,所述当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,包括:
    当所述电子设备运行有目标应用程序时,获取所述目标应用程序的格式;
    判断所述应用程序的格式是否满足预设格式,其中,所述预设格式至少包括WMV格式;
    当所述应用程序的格式不满足所述预设格式时,确定所述目标应用程序在所述预设名单中;
    当所述应用程序的格式满足所述预设格式时,确定所述目标应用程序不在所述预设名单中。
  16. 根据权利要求1-15任一项所述的方法,其特征在于,所述视频增强方法包括曝光度增强、去燥、边缘锐化、对比度增加以及饱和度增强中的至少一种。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,包括:
    当检测到作用于所述目标应用程序对应的图标上的触控操作时,判断所述目标应用程序是否在所述预设名单中;
    当接收到指示启动所述目标应用程序的语音信息时,判断所述目标应用程序是否在所 述预设名单中;或
    当所述电子设备开始显示所述目标应用程序的界面时,判断所述目标应用程序是否在所述预设名单中。
  18. 一种解码装置,其特征在于,应用于电子设备,所述装置包括:
    判断模块,用于当所述电子设备运行有目标应用程序时,判断所述目标应用程序是否在预设名单中,其中,所述目标应用程序在运行时可输出视频数据;
    确定模块,用于若所述目标应用程序在所述预设名单中,从硬解视频增强方式和软解视频增强方式中确定所述视频数据的解码方式;
    解码模块,用于使用所确定的解码方式对所述视频数据进行解码并播放。
  19. 一种电子设备,其特征在于,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行如权利要求1-17任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-17任一项所述的方法。
PCT/CN2019/094439 2018-08-23 2019-07-02 解码方法、装置、电子设备以及存储介质 WO2020038127A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810969502.3A CN109120988B (zh) 2018-08-23 2018-08-23 解码方法、装置、电子设备以及存储介质
CN201810969502.3 2018-08-23

Publications (1)

Publication Number Publication Date
WO2020038127A1 true WO2020038127A1 (zh) 2020-02-27

Family

ID=64860967

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/094439 WO2020038127A1 (zh) 2018-08-23 2019-07-02 解码方法、装置、电子设备以及存储介质

Country Status (2)

Country Link
CN (1) CN109120988B (zh)
WO (1) WO2020038127A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109120988B (zh) * 2018-08-23 2020-07-24 Oppo广东移动通信有限公司 解码方法、装置、电子设备以及存储介质
CN109862409B (zh) * 2019-03-18 2021-03-26 广州市网星信息技术有限公司 视频解码、播放方法、装置、系统、终端及存储介质
CN114520927B (zh) * 2020-11-18 2024-04-05 西安诺瓦星云科技股份有限公司 视频处理方法、装置和设备以及显示系统
CN113038276A (zh) * 2021-03-08 2021-06-25 Oppo广东移动通信有限公司 视频播放方法、装置、电子设备及存储介质
CN114245208A (zh) * 2021-12-16 2022-03-25 荣耀终端有限公司 刷新率的设置方法及相关设备
CN114205673A (zh) * 2021-12-16 2022-03-18 荣耀终端有限公司 刷新率的设置方法及相关设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1992885A (zh) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 一种显示视频质量的方法及客户端
CN104780378A (zh) * 2015-04-16 2015-07-15 腾讯科技(北京)有限公司 一种用于解码视频的方法、装置和播放器
CN106131319A (zh) * 2016-06-29 2016-11-16 努比亚技术有限公司 一种信息处理方法及装置、终端
CN106131550A (zh) * 2016-07-25 2016-11-16 合网络技术(北京)有限公司 播放多媒体文件的方法及装置
CN109120988A (zh) * 2018-08-23 2019-01-01 Oppo广东移动通信有限公司 解码方法、装置、电子设备以及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104185062B (zh) * 2013-05-27 2018-11-09 南京中兴新软件有限责任公司 一种终端处理视频流的方法及终端
CN106331765B (zh) * 2015-06-30 2020-06-05 腾讯科技(深圳)有限公司 一种硬解测试方法、终端、服务器和计算机可读存储介质
US20170034551A1 (en) * 2015-07-29 2017-02-02 GM Global Technology Operations LLC Dynamic screen replication and real-time display rendering based on media-application characteristics
CN106559679B (zh) * 2015-09-28 2019-10-08 腾讯科技(深圳)有限公司 视频解码的方法、服务器和移动终端
CN105872755A (zh) * 2015-12-07 2016-08-17 乐视云计算有限公司 视频播放方法及装置
CN105721921B (zh) * 2016-01-29 2019-07-12 四川长虹电器股份有限公司 一种多窗口视频解码器的自适应选择方法
CN106210726A (zh) * 2016-08-08 2016-12-07 成都佳发安泰科技股份有限公司 根据cpu与gpu的使用率对视频数据进行自适应解码的方法
CN106792066A (zh) * 2016-12-20 2017-05-31 暴风集团股份有限公司 优化的视频解码播放的方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1992885A (zh) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 一种显示视频质量的方法及客户端
CN104780378A (zh) * 2015-04-16 2015-07-15 腾讯科技(北京)有限公司 一种用于解码视频的方法、装置和播放器
CN106131319A (zh) * 2016-06-29 2016-11-16 努比亚技术有限公司 一种信息处理方法及装置、终端
CN106131550A (zh) * 2016-07-25 2016-11-16 合网络技术(北京)有限公司 播放多媒体文件的方法及装置
CN109120988A (zh) * 2018-08-23 2019-01-01 Oppo广东移动通信有限公司 解码方法、装置、电子设备以及存储介质

Also Published As

Publication number Publication date
CN109120988A (zh) 2019-01-01
CN109120988B (zh) 2020-07-24

Similar Documents

Publication Publication Date Title
WO2020108018A1 (zh) 游戏场景处理方法、装置、电子设备以及存储介质
WO2020038127A1 (zh) 解码方法、装置、电子设备以及存储介质
WO2020107989A1 (zh) 视频处理方法、装置、电子设备以及存储介质
WO2020038128A1 (zh) 视频处理方法、装置、电子设备及计算机可读介质
US20210281718A1 (en) Video Processing Method, Electronic Device and Storage Medium
US20210168441A1 (en) Video-Processing Method, Electronic Device, and Computer-Readable Storage Medium
CN109379627B (zh) 视频处理方法、装置、电子设备以及存储介质
CN109379624B (zh) 视频处理方法、装置、电子设备及存储介质
WO2020062924A1 (zh) 视频增强控制方法、装置、电子设备及存储介质
WO2020108092A1 (zh) 视频处理方法、装置、电子设备及存储介质
CN109587558B (zh) 视频处理方法、装置、电子设备以及存储介质
JP7186877B2 (ja) 映像デコーディング制御方法、装置、電子機器及び記憶媒体
US11490157B2 (en) Method for controlling video enhancement, device, electronic device and storage medium
CN109618228B (zh) 视频增强控制方法、装置以及电子设备
US11562772B2 (en) Video processing method, electronic device, and storage medium
WO2020108010A1 (zh) 视频处理方法、装置、电子设备以及存储介质
WO2020108060A1 (zh) 视频处理方法、装置、电子设备以及存储介质
EP3886447A1 (en) Video enhancement control method and apparatus, electronic device, and storage medium
CN109587561B (zh) 视频处理方法、装置、电子设备及存储介质
WO2020038071A1 (zh) 视频增强控制方法、装置、电子设备及存储介质
CN109167946B (zh) 视频处理方法、装置、电子设备以及存储介质
CN109712100B (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: 19851545

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

Country of ref document: EP

Kind code of ref document: A1