Video decoding method, device, electronic device and readable storage medium
By automatically detecting the hard decoding capability in the terminal device and determining the decoding method, the problem of poor hard decoding compatibility is solved, the compatibility and efficiency of video playback are improved, and the smooth playback of the video is ensured.
Patent Information
- Application Number
- CN202111519289.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-13
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-12-13
AI Technical Summary
In the existing technology, hard decoding has poor compatibility during video playback, resulting in blurred screens and inability to playback. Manual testing is also inefficient and cannot cover all terminal devices and video formats.
When the terminal device plays the video, it automatically detects the hard decoding capability value, and decides to use hard decoding or soft decoding based on this value to ensure the decoding effect of the video.
It improves the compatibility and decoding efficiency of video playback, reduces the time consumption of manual testing, can cover more terminal devices and video formats, and avoids compatibility issues during online video playback.
Smart Images

Figure CN114390336B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to the field of image processing technology. Specifically, the present disclosure relates to a video decoding method, device, electronic device, and readable storage medium. Background Art
[0002] With the rapid development of terminal equipment technology, more and more users watch videos through terminal equipment. At present, terminal equipment generally provides two modes of video decoding: soft decoding and hard decoding.
[0003] Compared with soft decoding, hard decoding has obvious advantages in decoding efficiency and power consumption, and has become the first choice for high-definition bitrate video decoding. However, the poor compatibility of hard decoding may cause problems such as screen distortion and inability to play when playing videos. Therefore, how to effectively determine the decoding method of videos has become an important technical issue in the field of video playback. Summary of the invention
[0004] In order to solve at least one of the above-mentioned defects, the present disclosure provides a video decoding method, device, electronic device and readable storage medium.
[0005] According to a first aspect of the present disclosure, a video decoding method is provided, the method comprising:
[0006] During the process of the terminal device playing the target video, determining the hard decoding capability value of the terminal device for the target video;
[0007] A target decoding mode is determined based on the hard decoding capability value, so as to decode the target video based on the target decoding mode.
[0008] According to a second aspect of the present disclosure, a video decoding device is provided, the device comprising:
[0009] A hard decoding capability determination module, used to determine the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video;
[0010] The decoding mode determination module is used to determine a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode.
[0011] According to a third aspect of the present disclosure, an electronic device is provided, the electronic device comprising:
[0012] at least one processor; and
[0013] A memory in communication with the at least one processor; wherein,
[0014] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the video decoding method.
[0015] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned video decoding method.
[0016] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the above-mentioned video decoding method when executed by a processor.
[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0019] Figure 1 It is a flowchart of a video decoding method provided by an embodiment of the present disclosure;
[0020] Figure 2 is a schematic diagram of a sub-hard-decoded image segmented based on a preset segmentation rule provided by an embodiment of the present disclosure;
[0021] Figure 3 It is a flowchart of a specific implementation of the video decoding method provided by the embodiment of the present disclosure;
[0022] Figure 4 is a schematic diagram of a process for calculating a hard decoding capability value provided by an embodiment of the present disclosure;
[0023] Figure 5 is a flowchart of another video decoding method provided by an embodiment of the present disclosure;
[0024] Figure 6 is a structural schematic diagram of a video decoding device provided according to the present disclosure;
[0025] Figure 7 is a structural schematic diagram of another video decoding device provided according to the present disclosure;
[0026] Figure 8 The present invention is a block diagram of an electronic device for implementing the video decoding method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] Hard decoding is a decoding method based on hardware, which decodes the video by calling the relevant modules of the graphics processing unit (GPU). Soft decoding is a decoding method based on software, which decodes the video by calling the CPU through software.
[0029] Compared with soft decoding, hard decoding has obvious advantages in decoding efficiency and power consumption, but its compatibility is poor, and it may cause problems such as screen distortion and inability to play videos due to incompatibility with video formats. Although soft decoding has good compatibility and can support decoding of video files in various formats, its decoding efficiency is low and its power consumption is high.
[0030] In the related art, the hard decoding compatibility of offline videos is generally tested manually. If the video can be decoded by hard decoding, the video is decoded by hard decoding. If the video cannot be decoded by hard decoding, the video is decoded by soft decoding. However, this method requires manual testing of each video separately and manual error checking, and the test efficiency is low. At the same time, this method is mainly performed on the model of the tested terminal device and the tested video, and comprehensive coverage cannot be guaranteed. In addition, this method is mostly performed on offline videos, and cannot be used for online videos. The flowery screen problem caused by the compatibility of hard decoding during the playback of online videos may be difficult to detect.
[0031] The video decoding method, device, electronic device and readable storage medium provided in the embodiments of the present application are intended to solve at least one of the above technical problems in the prior art.
[0032] Figure 1 A schematic diagram of a video decoding method provided by an embodiment of the present disclosure is shown. Figure 1 As shown in , the method can mainly include:
[0033] Step S110: during the process of the terminal device playing the target video, determining the hard decoding capability value of the terminal device for the target video;
[0034] Step S120: determining a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode.
[0035] The target video may be a video currently played by the terminal device, and may be an online video or an offline video.
[0036] The hard decoding capability value is used to measure the hard decoding capability of the terminal device for the target video. Based on the hard decoding capability value, the target decoding method used by the target video during decoding can be determined. The target decoding method can include hard decoding and soft decoding. By determining the target decoding method, the target video is decoded based on the target decoding method, which can ensure the decoding effect of the target video.
[0037] The method provided by the embodiment of the present disclosure determines the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value, thereby ensuring the decoding effect of the target video and improving the user experience.
[0038] In the disclosed embodiments, since the hard decoding capability value of the terminal device for the target video is automatically detected during the process of the terminal device playing the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value. Compared with manual testing and manual error checking in related technologies, the test efficiency is greatly improved, and is not limited to the model of the tested terminal device and the tested video, with more comprehensive coverage. It can also be used when playing online videos to avoid problems such as flowery screen caused by the compatibility of hard decoding when playing online videos.
[0039] In an optional manner of the present disclosure, determining a hard decoding capability value of a terminal device for a target video includes:
[0040] Get the key frame image in the target video;
[0041] Decoding the key frame image by hard decoding to obtain a hard decoded image;
[0042] The key frame image is decoded by soft decoding to obtain a soft decoded image;
[0043] The hard decoding capability value of the terminal device for the target video is determined based on the hard-decoded image and the soft-decoded image.
[0044] In the disclosed embodiment, the key frame is the I frame in the video. During decoding, only the data of the I frame can be used to reconstruct the complete image without relying on other frame images in the video package, so that the key frame can be decoded to obtain hard-decoded images and soft-decoded images, providing a basis for subsequent operations to calculate the hard decoding capability value. However, the P frames or B frames other than the I frames in the video need to rely on other frame images in the video package during decoding, which is not convenient for subsequent processing. In addition, the number of I frames in the video is relatively limited. In actual use, if the operation of calculating the hard decoding capability value is performed for each I frame, the amount of calculation will not be large due to too many images.
[0045] In the disclosed embodiment, when the target video is an online video, the video address of the online video can be set, the video file can be downloaded based on the video address, and then the video file is demultiplexed to separate the video stream and the audio stream. The video stream will be stored in the video packet queue in the form of a video packet, and the key frame can be obtained from the video packet.
[0046] In the disclosed embodiment, the key frame image can be hard-decoded to obtain a hard-decoded image, and the key frame image can be soft-decoded to obtain a soft-decoded image. The soft-decoded image can be used as the original image to measure the image quality of the hard-decoded image so as to determine the hard decoding capability value.
[0047] In an optional manner of the present disclosure, determining a hard decoding capability value of a terminal device for a target video based on a hard-decoded image and a soft-decoded image includes:
[0048] Calculate image evaluation metrics for hard-decoded images compared to soft-decoded images;
[0049] Based on the image evaluation index, the hard decoding capability value of the terminal device for the target video is determined.
[0050] In the disclosed embodiment, the image quality of the hard-decoded image can be measured by an image evaluation index. Specifically, the soft-decoded image can be used as the original image, and the hard-decoded image can be used as the compressed image. The image quality of the hard-decoded image compared with the soft-decoded image is calculated, and the image quality can be measured by the image evaluation index.
[0051] In the disclosed embodiment, the image evaluation index can reflect the image quality of the hard-decoded image, and thus can reflect the hard decoding capability of the terminal device for the target video.
[0052] As an example, an image evaluation index of a hard-decoded image compared with a soft-decoded image may be used as a hard-decoding capability value.
[0053] In an optional manner of the present disclosure, calculating an image evaluation index of a hard-decoded image compared to a soft-decoded image includes:
[0054] Based on a preset segmentation rule, the hard-decoded image is segmented into at least two sub-hard-decoded images and the soft-decoded image is segmented into at least two sub-soft-decoded images;
[0055] Calculating an image evaluation index for each sub-hard decoded image compared to a corresponding sub-soft decoded image;
[0056] Based on the image evaluation indicators, determine the hard decoding capability value of the terminal device for the target video, including:
[0057] Based on the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, the hard decoding capability value of the terminal device for the target video is determined.
[0058] In the disclosed embodiment, the hard-decoded image and the soft-decoded image can be segmented according to the same segmentation rule to obtain sub-hard-decoded images and sub-soft-decoded images, and the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image can be calculated respectively. Specifically, each sub-hard-decoded image can be used as a compressed image, and the corresponding sub-soft-decoded image can be used as an original image, and the image evaluation index of the sub-hard-decoded image can be calculated compared with the sub-soft-decoded image.
[0059] As an example, Figure 2 FIG. 4 is a schematic diagram of a sub-hard decoded image segmented based on a preset segmentation rule. Figure 2 As shown in , the segmented sub-hard-decoded images include a first sub-hard-decoded image a, a second sub-hard-decoded image b, a third sub-hard-decoded image c, a fourth sub-hard-decoded image d, and a fifth sub-hard-decoded image e. In this example, the segmentation rule may be to first segment the upper, lower, left, and right edges of the hard-decoded image into four sub-hard-decoded images, namely, the second sub-hard-decoded image b, the third sub-hard-decoded image c, the fourth sub-hard-decoded image d, and the fifth sub-hard-decoded image e. The lengths or widths of the four sub-hard-decoded images may be configured according to actual needs, such as being configured as a preset ratio of the overall width or height of the image, such as 5%. After the four sub-hard-decoded images are segmented from the four edges, the remaining portion located in the middle of the hard-decoded image may be used as another sub-hard-decoded image, namely, the first sub-hard-decoded image a. Accordingly, the soft-decoded image may also be segmented based on the segmentation rule to obtain the first sub-soft-decoded image, the second sub-soft-decoded image, the third sub-soft-decoded image, the fourth sub-soft-decoded image, and the fifth sub-soft-decoded image.
[0060] After the image evaluation index corresponding to each sub-hard-decoded image is calculated, the hard decoding capability value of the terminal device for the target video may be determined based on the image evaluation index corresponding to each sub-hard-decoded image.
[0061] When calculating image evaluation indicators, it is generally necessary to compare each pixel in the hard-decoded image and the soft-decoded image separately. However, since the hard-decoded image and the soft-decoded image may contain more pixels, this will result in a large amount of computation when calculating the image evaluation indicators and a long calculation time.
[0062] In the disclosed embodiment, the hard-decoded image and the soft-decoded image can be segmented to obtain sub-hard-decoded images and sub-soft-decoded images. The pixels in the sub-hard-decoded images and the sub-soft-decoded images are relatively small, thereby reducing the amount of calculation when calculating image evaluation indicators and reducing calculation time.
[0063] In an optional manner of the present disclosure, determining the hard decoding capability value of the terminal device for the target video based on the image evaluation index of each sub-hard decoded image compared with the corresponding sub-soft decoded image includes:
[0064] The image evaluation index with the smallest value among the image evaluation indexes corresponding to the sub-hard-decoded images is used as the hard decoding capability value of the terminal device for the target video.
[0065] In the disclosed embodiment, when determining the hard decoding capability value of the terminal device for the target video based on the image evaluation indicators corresponding to each sub-hard-decoded image, the image evaluation indicator with the smallest value among the image evaluation indicators corresponding to each sub-hard-decoded image can be used as the hard decoding capability value of the terminal device for the target video.
[0066] As an example, if the hard-decoded image is divided into five sub-hard-decoded images, which are respectively recorded as the first sub-hard-decoded image, the second sub-hard-decoded image, the third sub-hard-decoded image, the fourth sub-hard-decoded image and the fifth sub-hard-decoded image, wherein the image evaluation index of the second sub-hard-decoded image is the smallest compared to the corresponding second sub-soft-decoded image, the image evaluation index corresponding to the second sub-hard-decoded image can be used as the hard-decoding capability value of the terminal device for the target video.
[0067] In actual use, the average value of the image evaluation index corresponding to each sub-hard-decoded image may also be taken as the hard-decoding capability value of the terminal device for the target video.
[0068] In an optional manner of the present disclosure, calculating the image evaluation index of each sub-hard decoded image compared with the corresponding sub-soft decoded image includes:
[0069] The image evaluation index of each sub-hard decoded image compared with the corresponding sub-soft decoded image is calculated respectively by parallel processing.
[0070] In the disclosed embodiment, a parallel processing method may be adopted to calculate the image evaluation index corresponding to each sub-hard-decoded image in parallel, thereby reducing the time consumption of calculating the image evaluation index.
[0071] In an optional manner of the present disclosure, the image evaluation index includes any of the following:
[0072] Peak signal-to-noise ratio (PSNR);
[0073] Structural Similarity (SSIM).
[0074] In the embodiment of the present disclosure, the image evaluation index may include but is not limited to any one of PSNR and SSIM.
[0075] As an example, the image evaluation index is PSNR, and the PSNR can be calculated by the following formula 1.
[0076]
[0077] Among them, MAX I is the maximum value of the image point color, and MSE is the root mean square error.
[0078] The MSE can be calculated by the following formula 2.
[0079]
[0080] Among them, I represents the original image, that is, the soft-decoded image, K represents the compressed image, that is, the hard-decoded image, m is the number of pixels in the width direction of the soft-decoded image and the hard-decoded image, n is the number of pixels in the height direction of the soft-decoded image and the hard-decoded image, I(i, j) is the pixel in the i-th row and j-th column in the soft-decoded image, and K(i, j) is the pixel in the i-th row and j-th column in the hard-decoded image.
[0081] In an optional manner of the present disclosure, determining a target decoding mode based on a hard decoding capability value includes:
[0082] If the hard decoding capability value is not less than the preset value, the target decoding mode is determined to be hard decoding;
[0083] If the hard decoding capability value is less than a preset value, the target decoding mode is determined to be soft decoding.
[0084] In the disclosed embodiment, the hard decoding capability value can characterize the hard decoding capability of the terminal device for the target video. If the hard decoding capability value is determined based on the PSNR value or the SSIM value, the specific method of determining the target decoding method based on the hard decoding capability value is: if the hard decoding capability value is not less than the preset value, the target decoding method is determined to be hard decoding; if the hard decoding capability value is less than the preset value, the target decoding method is determined to be soft decoding.
[0085] The preset value may be set according to actual needs. As an example, when the hard decoding capability value is determined based on the PSNR value, the preset value may be 30.
[0086] In an optional manner of the present disclosure, determining a hard decoding capability value of a terminal device for a target video includes:
[0087] The preset duration of each interval determines the hard decoding capability value of the terminal device for the target video.
[0088] In the disclosed embodiment, during the process of the terminal device playing the target video, the operation of determining the hard decoding capability value of the terminal device for the target video can be performed at every preset time interval, so as to monitor the hard decoding capability of the terminal device for the target video in real time, and adjust the decoding method of the target video in real time based on the hard decoding capability value to ensure the decoding effect of the target video.
[0089] In an optional manner of the present disclosure, the above method further includes:
[0090] The hard decoding capability value is associated with the target video and stored.
[0091] In the disclosed embodiment, the hard decoding capability value may be associated with the target video and stored, so that when the target video is subsequently played again, the decoding method of the target video is determined based on the stored hard decoding capability value.
[0092] As an example, during the playback of the target video, the operation of determining the hard decoding capability value of the terminal device for the target video can be performed multiple times, and the determined hard decoding capability values can be associated with the target video and stored. When the target video is played again, the average value of the hard decoding capability values can be taken as the decoding method for determining the target video. If the average value is not less than the specified value, it can be considered that the hard decoding capability of the terminal device for the target video is strong enough, and the target video can be decoded by hard decoding. If the average value is less than the specified value, it can be considered that the hard decoding capability of the terminal device for the target video is not strong enough, and the target video needs to be decoded by soft decoding.
[0093] As an example, Figure 3 A flowchart of a specific implementation of a video decoding method provided by an embodiment of the present disclosure is shown in FIG.
[0094] like Figure 3 As shown in , when the terminal device plays the online video, it can create and initialize the player, and create a reading thread, a decoding thread, a decoding capability detection thread, and a rendering thread. Set the video address of the online video to the player, and the player's reading thread demultiplexes the video data, separates the video stream and the audio stream, and the video stream data is stored in the video packet queue in the form of video packets.
[0095] The decoding thread obtains video packets from the video packet queue. If the obtained video packets include key frames, the hard decoding capability value can be detected based on the key frames. Specifically, the key frames are sent to the hardware decoder and the software decoder for decoding at the same time. The hard-decoded images and soft-decoded images obtained after decoding are passed to the decoding capability detection thread to calculate the hard decoding capability value. If the obtained video packets do not include key frames, the decoded data can be directly stored in the video frame queue. The hard decoding capability value detected in this step can be used to determine whether to use hard decoding or soft decoding for subsequent decoding.
[0096] The rendering thread obtains video frames from the video frame queue, performs audio and video synchronization, and finally sends the video frame data to the display device for display.
[0097] As an example, Figure 4 A schematic diagram of a process for calculating a hard decoding capability value provided by an embodiment of the present disclosure is shown in FIG.
[0098] like Figure 4 As shown in , the hard-decoded image and the soft-decoded image may be image data in a YUV format.
[0099] In the decoding capability detection thread, the hard-decoded image and the soft-decoded image are respectively obtained, and the hard-decoded image and the soft-decoded image are respectively segmented based on a preset segmentation rule to obtain a sub-hard-decoded image and a sub-soft-decoded image.
[0100] Calculate the PNSR value for each sub-hard-decoded image, and then detect whether the hard-decoding capability is normal based on the PNSR value. Specifically, the hard-decoding capability value can be determined based on the PNSR value of each sub-hard-decoded image. If the hard-decoding capability value is not less than the preset value, it is determined that the hard-decoding capability is normal, and the target video can be decoded by hard decoding; if the hard-decoding capability value is less than the preset value, it is determined that the hard-decoding capability is abnormal, and the target video needs to be decoded by soft decoding.
[0101] The detection result is saved, that is, the hard decoding capability value is associated with the target video and stored, so as to provide a basis for determining the decoding method of the target video when the target video is played again in the future.
[0102] Figure 5 A schematic diagram of a process flow of another video decoding method provided by an embodiment of the present disclosure is shown. Figure 5 As shown in , the method can mainly include:
[0103] Step S510: Acquire a key frame image in the target video during the process of the terminal device playing the target video;
[0104] Step S520: decoding the key frame image by hard decoding to obtain a hard-decoded image, and decoding the key frame image by soft decoding to obtain a soft-decoded image;
[0105] Step S530: Calculate the image evaluation index of the hard-decoded image compared with the soft-decoded image;
[0106] Step S540: determining the hard decoding capability value of the terminal device for the target video based on the image evaluation index;
[0107] Step S550: Determine a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode.
[0108] The target video may be a video currently played by the terminal device, and may be an online video or an offline video.
[0109] The hard decoding capability value is used to measure the hard decoding capability of the terminal device for the target video. Based on the hard decoding capability value, the target decoding method used by the target video during decoding can be determined. The target decoding method can include hard decoding and soft decoding. By determining the target decoding method, the target video is decoded based on the target decoding method, which can ensure the decoding effect of the target video.
[0110] In the disclosed embodiment, the key frame is an I frame in a video packet. During decoding, only the data of the I frame can be used to reconstruct a complete image without relying on other frame images in the video packet.
[0111] In the disclosed embodiment, when the target video is an online video, the video address of the online video can be set, the video file can be downloaded based on the video address, and then the video file is demultiplexed to separate the video stream and the audio stream. The video stream will be stored in the video packet queue in the form of a video packet, and the key frame can be obtained from the video packet.
[0112] In the disclosed embodiment, the key frame image can be hard-decoded to obtain a hard-decoded image, and the key frame image can be soft-decoded to obtain a soft-decoded image. The soft-decoded image can be used as the original image to measure the image quality of the hard-decoded image so as to determine the hard decoding capability value.
[0113] In the disclosed embodiment, the image quality of the hard-decoded image can be measured by an image evaluation index. Specifically, the soft-decoded image can be used as the original image, and the hard-decoded image can be used as the compressed image. The image quality of the hard-decoded image compared with the soft-decoded image is calculated, and the image quality can be measured by the image evaluation index.
[0114] In the disclosed embodiment, the image evaluation index can reflect the image quality of the hard-decoded image, and thus can reflect the hard decoding capability of the terminal device for the target video.
[0115] In the embodiment of the present disclosure, the image evaluation index may include but is not limited to any one of PSNR and SSIM.
[0116] As an example, an image evaluation index of a hard-decoded image compared with a soft-decoded image may be used as a hard-decoding capability value.
[0117] In the disclosed embodiment, the hard decoding capability value can characterize the hard decoding capability of the terminal device for the target video. If the hard decoding capability value is determined based on the PSNR value or the SSIM value, the specific method of determining the target decoding method based on the hard decoding capability value is: if the hard decoding capability value is not less than the preset value, the target decoding method is determined to be hard decoding; if the hard decoding capability value is less than the preset value, the target decoding method is determined to be soft decoding.
[0118] The method provided by the embodiment of the present disclosure obtains key frame images in the target video during the process of playing the target video on the terminal device, decodes the key frame images by hard decoding to obtain hard-decoded images; decodes the key frame images by soft decoding to obtain soft-decoded images, calculates image evaluation indicators of the hard-decoded images compared with the soft-decoded images, determines the hard decoding capability value of the terminal device for the target video based on the image evaluation indicators, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to decode the target video by hard decoding or soft decoding based on the hard decoding capability value, thereby ensuring the decoding effect of the target video and improving the user experience.
[0119] Based on Figure 1 The same principle as shown in the method, Figure 6 A schematic diagram of the structure of a video decoding device provided by an embodiment of the present disclosure is shown. Figure 6 As shown, the video decoding device 60 may include:
[0120] The hard decoding capability determination module 610 is used to determine the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video;
[0121] The decoding mode determination module 620 is used to determine a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode.
[0122] The device provided by the embodiment of the present disclosure determines the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value, which can ensure the decoding effect of the target video and improve the user experience.
[0123] Optionally, when determining the hard decoding capability value of the terminal device for the target video, the hard decoding capability determination module is specifically used to:
[0124] Get the key frame image in the target video;
[0125] Decoding the key frame image by hard decoding to obtain a hard decoded image;
[0126] The key frame image is decoded by soft decoding to obtain a soft decoded image;
[0127] The hard decoding capability value of the terminal device for the target video is determined based on the hard-decoded image and the soft-decoded image.
[0128] Optionally, when the hard decoding capability determination module determines the hard decoding capability value of the terminal device for the target video based on the hard-decoded image and the soft-decoded image, it is specifically used to:
[0129] Calculate image evaluation metrics for hard-decoded images compared to soft-decoded images;
[0130] Based on the image evaluation index, the hard decoding capability value of the terminal device for the target video is determined.
[0131] Optionally, when calculating the image evaluation index of the hard-decoded image compared with the soft-decoded image, the hard-decoding capability determination module is specifically used to:
[0132] Based on a preset segmentation rule, the hard-decoded image is segmented into at least two sub-hard-decoded images and the soft-decoded image is segmented into at least two sub-soft-decoded images;
[0133] Calculating an image evaluation index for each sub-hard decoded image compared to a corresponding sub-soft decoded image;
[0134] The hard decoding capability determination module is specifically used to determine the hard decoding capability value of the terminal device for the target video based on the image evaluation index:
[0135] Based on the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, the hard decoding capability value of the terminal device for the target video is determined.
[0136] Optionally, when determining the hard decoding capability value of the terminal device for the target video based on the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, the hard decoding capability determination module is specifically used to:
[0137] The image evaluation index with the smallest value among the image evaluation indexes corresponding to the sub-hard-decoded images is used as the hard decoding capability value of the terminal device for the target video.
[0138] Optionally, when calculating the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, the hard-decoding capability determination module is specifically used to:
[0139] The image evaluation index of each sub-hard decoded image compared with the corresponding sub-soft decoded image is calculated respectively by parallel processing.
[0140] Optionally, the image evaluation index includes any of the following:
[0141] PSNR;
[0142] SSIM.
[0143] Optionally, when determining the target decoding mode based on the hard decoding capability value, the decoding mode determination module is specifically used to:
[0144] If the hard decoding capability value is not less than the preset value, the target decoding mode is determined to be hard decoding;
[0145] If the hard decoding capability value is less than a preset value, the target decoding mode is determined to be soft decoding.
[0146] Optionally, when determining the hard decoding capability value of the terminal device for the target video, the hard decoding capability determination module is specifically used to:
[0147] The preset duration of each interval determines the hard decoding capability value of the terminal device for the target video.
[0148] Optionally, the above device further includes:
[0149] The hard decoding capability value storage module is used to store the hard decoding capability value in association with the target video.
[0150] It can be understood that the above modules of the video decoding device in the embodiment of the present disclosure have the function of implementing Figure 1 The functions of the corresponding steps of the video decoding method in the embodiment shown in . The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The above modules can be software and / or hardware, and the above modules can be implemented separately or integrated with multiple modules. For the functional description of each module of the above video decoding device, please refer to Figure 1 The corresponding description of the video decoding method in the embodiment shown in is not repeated here.
[0151] Based on Figure 5 The same principle as shown in the method, Figure 7 A schematic diagram of the structure of another video decoding device provided by an embodiment of the present disclosure is shown. Figure 7 As shown, the video decoding device 70 may include:
[0152] The key frame image acquisition module 710 is used to acquire the key frame image in the target video during the process of the terminal device playing the target video;
[0153] A decoding module 720, configured to decode the key frame image by hard decoding to obtain a hard-decoded image, and to decode the key frame image by soft decoding to obtain a soft-decoded image;
[0154] An image evaluation index determination module 730, for calculating an image evaluation index of a hard-decoded image compared to a soft-decoded image;
[0155] A hard decoding capability value determination module 740, used to determine the hard decoding capability value of the terminal device for the target video based on the image evaluation index;
[0156] The decoding mode determination module 750 is used to determine a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode.
[0157] The device provided by the embodiment of the present disclosure obtains key frame images in the target video during the process of playing the target video on the terminal device, decodes the key frame images by hard decoding to obtain hard-decoded images; decodes the key frame images by soft decoding to obtain soft-decoded images, calculates image evaluation indicators of the hard-decoded images compared with the soft-decoded images, determines the hard decoding capability value of the terminal device for the target video based on the image evaluation indicators, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value, thereby ensuring the decoding effect of the target video and improving the user experience.
[0158] It can be understood that the above modules of the video decoding device in the embodiment of the present disclosure have the function of implementing Figure 5The functions of the corresponding steps of the video decoding method in the embodiment shown in . The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The above modules can be software and / or hardware, and the above modules can be implemented separately or integrated with multiple modules. For the functional description of each module of the above video decoding device, please refer to Figure 5 The corresponding description of the video decoding method in the embodiment shown in is not repeated here.
[0159] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0160] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0161] The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a video decoding method as provided in an embodiment of the present disclosure.
[0162] Compared with the prior art, the electronic device determines the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value, thereby ensuring the decoding effect of the target video and improving the user experience.
[0163] The readable storage medium is a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the video decoding method provided by the embodiment of the present disclosure.
[0164] Compared with the prior art, the readable storage medium determines the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value, thereby ensuring the decoding effect of the target video and improving the user experience.
[0165] The computer program product includes a computer program, and when the computer program is executed by a processor, the video decoding method provided by the embodiment of the present disclosure is implemented.
[0166] Compared with the prior art, the computer program product determines the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video, determines the target decoding method based on the hard decoding capability value, and decodes the target video based on the target decoding method. In this solution, by automatically determining the hard decoding capability value of the terminal device for the target video when the terminal device plays the target video, it is possible to determine whether to use hard decoding or soft decoding to decode the target video based on the hard decoding capability value, thereby ensuring the decoding effect of the target video and improving the user experience.
[0167] Figure 8 A schematic block diagram of an example electronic device 2000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0168] like Figure 8 As shown, the electronic device 2000 includes a computing unit 2010, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 2020 or a computer program loaded from a storage unit 2080 into a random access memory (RAM) 2030. In the RAM 2030, various programs and data required for the operation of the device 2000 can also be stored. The computing unit 2010, the ROM 2020, and the RAM 2030 are connected to each other via a bus 2040. An input / output (I / O) interface 2050 is also connected to the bus 2040.
[0169] A number of components in the device 2000 are connected to the I / O interface 2050, including: an input unit 2060, such as a keyboard, a mouse, etc.; an output unit 2070, such as various types of displays, speakers, etc.; a storage unit 2080, such as a disk, an optical disk, etc.; and a communication unit 2090, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 2090 allows the device 2000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0170] The computing unit 2010 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 2010 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 2010 performs the decoding method of the video provided in the embodiment of the present disclosure. For example, in some embodiments, the decoding method of the video provided in the embodiment of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 2080. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 2000 via the ROM 2020 and / or the communication unit 2090. When the computer program is loaded into the RAM 2030 and executed by the computing unit 2010, one or more steps of the decoding method of the video provided in the embodiment of the present disclosure may be performed. Alternatively, in other embodiments, the computing unit 2010 may be configured in any other appropriate manner (for example, by means of firmware) to execute the video decoding method provided in the embodiments of the present disclosure.
[0171] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0172] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0173] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0174] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0175] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0176] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0177] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0178] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A video decoding method, comprising: During the process of the terminal device playing the target video, determining a hard decoding capability value of the terminal device for the target video, wherein the hard decoding capability value is a value measuring the hard decoding capability of the terminal device for the target video; Determine a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode; The determining the hard decoding capability value of the terminal device for the target video includes: Acquire a key frame image in the target video; Decoding the key frame image by hard decoding to obtain a hard decoded image; Decoding the key frame image by soft decoding to obtain a soft decoded image; A hard decoding capability value of the terminal device for the target video is determined based on the hard-decoded image and the soft-decoded image.
2. The method according to claim 1, wherein: The determining, based on the hard-decoded image and the soft-decoded image, a hard-decoding capability value of the terminal device for the target video includes: Calculating an image evaluation index of the hard-decoded image compared to the soft-decoded image; Based on the image evaluation index, a hard decoding capability value of the terminal device for the target video is determined.
3. The method according to claim 2, wherein: The calculating of the image evaluation index of the hard-decoded image compared with the soft-decoded image includes: Based on a preset segmentation rule, the hard-decoded image is segmented into at least two sub-hard-decoded images and the soft-decoded image is segmented into at least two sub-soft-decoded images; Calculating an image evaluation index of each of the sub-hard decoded images compared to the corresponding sub-soft decoded image; The determining, based on the image evaluation index, a hard decoding capability value of the terminal device for the target video includes: Based on the image evaluation index of each of the sub-hard-decoded images compared with the corresponding sub-soft-decoded images, the hard decoding capability value of the terminal device for the target video is determined.
4. The method according to claim 3, wherein: The determining, based on the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, the hard-decoding capability value of the terminal device for the target video includes: The image evaluation index with the smallest value among the image evaluation indexes corresponding to the sub-hard-decoded images is used as the hard decoding capability value of the terminal device for the target video.
5. The method according to claim 3 or 4, wherein: The calculating of the image evaluation index of each sub-hard decoded image compared with the corresponding sub-soft decoded image includes: The image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image is calculated respectively by parallel processing.
6. The method according to any one of claims 2 to 5, wherein: The image evaluation index includes any of the following: Peak signal-to-noise ratio (PSNR); Structural Similarity SSIM.
7. The method according to any one of claims 1 to 6, wherein: The determining a target decoding mode based on the hard decoding capability value includes: If the hard decoding capability value is not less than a preset value, determining the target decoding mode to be hard decoding; If the hard decoding capability value is less than a preset value, the target decoding mode is determined to be soft decoding.
8. The method according to any one of claims 1 to 7, wherein: Determining a hard decoding capability value of the terminal device for the target video includes: The hard decoding capability value of the terminal device for the target video is determined at each preset interval.
9. The method according to any one of claims 1 to 8, wherein: Also includes: The hard decoding capability value is associated with the target video and stored.
10. A video decoding device, comprising: A hard decoding capability determination module, used to determine the hard decoding capability value of the terminal device for the target video during the process of the terminal device playing the target video, wherein the hard decoding capability value is a value measuring the hard decoding capability of the terminal device for the target video; A decoding mode determination module, used to determine a target decoding mode based on the hard decoding capability value, so as to decode the target video based on the target decoding mode; When determining the hard decoding capability value of the terminal device for the target video, the hard decoding capability determination module is specifically used to: Acquire a key frame image in the target video; Decoding the key frame image by hard decoding to obtain a hard decoded image; Decoding the key frame image by soft decoding to obtain a soft decoded image; A hard decoding capability value of the terminal device for the target video is determined based on the hard-decoded image and the soft-decoded image.
11. The device according to claim 10, wherein: When the hard decoding capability determination module determines the hard decoding capability value of the terminal device for the target video based on the hard-decoded image and the soft-decoded image, it is specifically used to: Calculating an image evaluation index of the hard-decoded image compared to the soft-decoded image; Based on the image evaluation index, a hard decoding capability value of the terminal device for the target video is determined.
12. The device according to claim 11, wherein When calculating the image evaluation index of the hard-decoded image compared with the soft-decoded image, the hard-decoding capability determination module is specifically used to: Based on a preset segmentation rule, the hard-decoded image is segmented into at least two sub-hard-decoded images and the soft-decoded image is segmented into at least two sub-soft-decoded images; Calculating an image evaluation index of each of the sub-hard decoded images compared to the corresponding sub-soft decoded image; When the hard decoding capability determination module determines the hard decoding capability value of the terminal device for the target video based on the image evaluation index, it is specifically used to: Based on the image evaluation index of each of the sub-hard-decoded images compared with the corresponding sub-soft-decoded images, the hard decoding capability value of the terminal device for the target video is determined.
13. The device according to claim 12, wherein: When the hard decoding capability determination module determines the hard decoding capability value of the terminal device for the target video based on the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, it is specifically used to: The image evaluation index with the smallest value among the image evaluation indexes corresponding to the sub-hard-decoded images is used as the hard decoding capability value of the terminal device for the target video.
14. The device according to claim 12 or 13, wherein: When calculating the image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image, the hard-decoding capability determination module is specifically used to: The image evaluation index of each sub-hard-decoded image compared with the corresponding sub-soft-decoded image is calculated respectively by parallel processing.
15. The device according to any one of claims 10 to 14, wherein: When the decoding mode determination module determines the target decoding mode based on the hard decoding capability value, it is specifically used to: If the hard decoding capability value is not less than a preset value, determining the target decoding mode to be hard decoding; If the hard decoding capability value is less than a preset value, the target decoding mode is determined to be soft decoding.
16. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
17. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
18. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Video decoding method and client
CN104980797A
VIDEO PROCESSING METHOD, device thereof, ELECTRONIC equipment AND STORAGE MEDIUM
CN109151574A
Decoding method and apparatus, and device
CN109309879A
Video decoding method and device, computer device and storage medium
CN110139104A
Decoding capability detection method and device
CN110636284A
