Video decoding method, device, computer equipment, readable storage medium and program product
By starting parallel decoding of the video frame to be decoded when the video frame decoding is completed, and judging the decoding completion degree based on the reference information, parallel decoding of multiple video frames is achieved while maintaining dependence on previous and subsequent frames, and the video decoding speed is improved.
Patent Information
- Application Number
- CN202410750908.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-12
AI Technical Summary
The video decoding speed of video formats such as H.264/H.265/H.266/vp9/AV1 is slow, mainly due to the dependency between the previous and subsequent frames, which causes the decoding process to be processed sequentially frame by frame, and parallel processing cannot be fully utilized. ability.
When the decoding of the video frame is completed, the parallel decoding of the video frame to be decoded is started according to the preset number of parallel decoded video frames, and by judging whether the reference information of the block to be decoded is decoded, it is decided whether to continue decoding, ensuring that the dependence of the previous and next frames is maintained. Under the premise, multiple video frames can be decoded in parallel to improve decoding speed.
By processing multiple video frames in parallel, the video decoding speed is significantly improved, the decoding speed and resource usage are balanced, and resource overload caused by too much parallel decoding is avoided.
Smart Images

Figure CN118338003B
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing technology, and in particular to a video decoding method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of computer technology, more and more scenes require the use of video. However, due to the dependency between the previous and next frames, the video compression streams in formats such as H.264 / H.265 / H.266 / vp9 / AV1 can only be processed in sequence, one frame at a time, during decoding. Therefore, the decoding speed of related video decoding methods is slow. Summary of the invention
[0003] Based on this, it is necessary to provide a video decoding method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the decoding speed in response to the above technical problems.
[0004] In a first aspect, the present application provides a video decoding method, comprising:
[0005] When decoding of a video frame is completed, starting video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames;
[0006] When performing video decoding on each block to be decoded in the video frame to be decoded, judging whether the reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes a video frame that has been decoded and a video frame being decoded; the latest decoded block is a block in the video frame that has completed video decoding;
[0007] If the decoding of the reference information of the block to be decoded is completed, the video decoding of the block to be decoded is continued.
[0008] In one of the embodiments, the reference information includes at least one of motion vector reference information and pixel reference information, and judging whether the reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded includes:
[0009] In the case where the reference information includes motion vector reference information, judging whether the motion vector reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded;
[0010] In the case where the reference information includes pixel reference information, it is determined whether the pixel reference information of the block to be decoded is decoded based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded, and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0011] In one of the embodiments, judging whether the motion vector reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded includes:
[0012] For each reference video frame of the block to be decoded, compare the coordinates of the block to be decoded with the coordinates of the latest decoded block of the reference video frame, and determine whether the block at the same position as the block to be decoded in the reference video frame has been decoded;
[0013] If the blocks at the same position as the block to be decoded in each of the reference video frames are all decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded is completed.
[0014] In one of the embodiments, judging whether the pixel reference information of the block to be decoded is decoded according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded includes:
[0015] For each reference video frame of the block to be decoded, calculating the coordinates of the reference pixels of the reference video frame required by the block to be decoded according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded with respect to the reference video frame;
[0016] Comparing the coordinates of the reference pixel with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel block of the reference video frame required by the block to be decoded has been decoded;
[0017] If the reference pixel blocks of the reference video frames required by the block to be decoded are all decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
[0018] In one embodiment, the method further comprises:
[0019] If the motion vector reference information of the block to be decoded has not been decoded, after waiting for a preset first time, returning to the step of determining whether the motion vector reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded;
[0020] If the pixel reference information of the block to be decoded has not been decoded, after waiting for a preset second time, return to the step of judging whether the pixel reference information of the block to be decoded has been decoded based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0021] In one embodiment, the method further comprises:
[0022] For each video frame being decoded, assigning a thread to the video frame; and / or,
[0023] For each video frame being decoded, a core is allocated to the video frame.
[0024] In a second aspect, the present application further provides a video decoding device, comprising:
[0025] A starting module, used for starting the video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames when the decoding of a video frame is completed;
[0026] A judgment module, used for judging whether the reference information of the block to be decoded is decoded when performing video decoding on each block to be decoded in the video frame to be decoded, according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes the video frame that has been decoded and the video frame being decoded; the latest decoded block is the block in the video frame that has completed video decoding;
[0027] The decoding module is used to continue video decoding of the block to be decoded if the decoding of the reference information of the block to be decoded is completed.
[0028] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps described in the first aspect when executing the computer program.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps described in the first aspect above when executed by a processor.
[0030] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements the steps described in the first aspect when executed by a processor.
[0031] The above-mentioned video decoding method, device, computer equipment, computer-readable storage medium and computer program product, when there is a video frame whose decoding is completed, start the video decoding of the video frame to be decoded that is located after the video frame and closest to the video frame according to the preset number of parallel decoded video frames; when video decoding is performed on each block to be decoded in the video frame to be decoded, judge whether the reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes the video frame that has been decoded and the video frame being decoded; the latest decoded block is the block in the video frame that has completed video decoding; if the reference information of the block to be decoded is decoded, continue video decoding of the block to be decoded. In this way, video decoding is performed in parallel on a preset number of parallel decoding video frames. When there is a video frame whose decoding is completed, video decoding of the video frame to be decoded that is located behind the decoded video frame and is closest to the decoded video frame is started. Video decoding is still performed in parallel on the preset number of parallel decoding video frames, and video decoding is performed on the video frame to be decoded block by block. During the decoding process, it is determined whether the reference information of the block to be decoded has been decoded based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded, so as to achieve parallel decoding of multiple video frames while maintaining the dependency between the previous and next frames. Parallel decoding processing is achieved at the frame level, which can improve the video decoding speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 is a schematic flow chart of a video decoding method in one embodiment;
[0034] Figure 2 A schematic diagram of a flow chart of a step of determining whether the reference information of a block to be decoded has been decoded in one embodiment;
[0035] Figure 3 A schematic diagram of a flow chart of a step of determining whether the motion vector reference information of a block to be decoded has been decoded in one embodiment;
[0036] Figure 4 A schematic diagram of a flow chart of a step of determining whether the pixel reference information of a to-be-decoded block has been decoded in one embodiment;
[0037] Figure 5A schematic flow chart of steps further included in the video decoding method in one embodiment;
[0038] Figure 6 A flowchart diagram of steps further included in the video decoding method in another embodiment;
[0039] Figure 7 is a structural block diagram of a video decoding device in one embodiment;
[0040] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] In one embodiment, Figure 1 As shown, a video decoding method is provided. This embodiment uses the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be but is not limited to various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. In this embodiment, the method includes the following steps:
[0043] Step 101 : when a video frame is decoded, start video decoding of a to-be-decoded video frame that is located after the video frame and closest to the video frame according to a preset number of video frames to be decoded in parallel.
[0044] In an embodiment of the present application, the video frame to be decoded is the video frame that is closest to the video frame in the video frame to be decoded. The decoded video frame and the video frame to be decoded are both video frames of the same target video. The target video is the video to be decoded, which can be a complete video or a video clip. The target video includes multiple video frames, and the multiple video frames are arranged in the order of receiving the code stream. The terminal decodes each video frame in the target video according to the decoding order. The decoding order is the order of receiving the code stream. The number of parallel decoded video frames is the number of video frames for parallel video decoding. If the number of parallel decoded video frames is n, n video frames are video decoded in parallel. The video decoding progress of the video frames for parallel video decoding may be different, and the time for their decoding completion may also be different. The video frame to be decoded and the decoded video frame are separated by a preset interval number of video frames. The number of intervals is the number of parallel decoded video frames minus 1. The number of parallel decoded video frames is a positive integer greater than 1. Preferably, the number of parallel decoded video frames can be 2-4. In this way, the video decoding speed can be improved without excessive resource occupation due to too many video frames being decoded in parallel, thereby balancing the video decoding speed and resource occupation.
[0045] Step 102, when decoding each block to be decoded in the video frame to be decoded, determine whether the reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0046] The reference video frame includes a video frame that has been decoded and a video frame that is being decoded. The latest decoded block is a block in the video frame that has recently completed video decoding.
[0047] In an embodiment of the present application, the terminal decodes the video frame to be decoded in a preset order by block, and records the coordinates of the latest decoded block of the video frame to be decoded. The preset order may be a row scanning order. The size of the block in the video frame is between 8×8 and 128×128. In this way, the compression rate and resource occupancy can be balanced. The block to be decoded is a block to be video decoded in a video frame. The reference information is the information that the block to be decoded needs to refer to when the block to be decoded is video decoded, which is the information of the reference video frame of the block to be decoded. The reference information may include multiple pieces of information. In the case where the reference information includes multiple pieces of information, if the multiple pieces of information are all decoded, the terminal determines that the reference information of the block to be decoded is decoded. The reference video frame is located before the video frame where the block to be decoded is located, and may be one video frame or multiple video frames. For example, the reference video frame of the block to be decoded in the P frame may be one; the reference video frames of the block to be decoded in the B frame may be two. The reference video frames of different blocks to be decoded in the same video frame may be different. In the case where the reference video frame is a plurality of video frames, if the reference information of the plurality of reference video frames has been decoded, the terminal determines that the reference information of the block to be decoded has been decoded.
[0048] Step 103: If the decoding of the reference information of the block to be decoded is completed, the video decoding of the block to be decoded is continued.
[0049] In an embodiment of the present application, if the reference information of the block to be decoded has not been decoded, then after waiting for a preset time, the step of returning to determine whether the reference information of the block to be decoded has been decoded is performed based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0050] In the above-mentioned video decoding method, video decoding is performed in parallel on a preset number of parallel decoding video frames. When there is a video frame whose decoding is completed, video decoding of the video frame to be decoded that is located behind the decoded video frame and is closest to the decoded video frame is started. Video decoding is still performed in parallel on the preset number of parallel decoding video frames, and video decoding is performed on the video frame to be decoded block by block. During the decoding process, it is determined whether the reference information of the block to be decoded has been decoded based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded, so as to achieve parallel decoding of multiple video frames while maintaining the dependency between the previous and next frames, and realize parallel decoding processing at the frame level, which can improve the video decoding speed.
[0051] In an exemplary embodiment, Figure 2 As shown, the reference information includes at least one of motion vector reference information and pixel reference information, and step 102 includes steps 201 to 202. Among them:
[0052] Step 201 : when the reference information includes motion vector reference information, judging whether the motion vector reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0053] Step 202, when the reference information includes pixel reference information, determine whether the pixel reference information of the block to be decoded is decoded according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0054] In an embodiment of the present application, when the reference information includes motion vector reference information and pixel reference information, the terminal determines whether the decoding of the motion vector reference information of the block to be decoded is completed based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded. If the decoding of the motion vector reference information of the block to be decoded is completed, the terminal decodes the motion vector information of the block to be decoded based on the motion vector information of the same position block as the block to be decoded in the reference video frame of the block to be decoded. Then, the terminal determines whether the decoding of the pixel reference information of the block to be decoded is completed based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded, and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0055] In the case where the reference information includes pixel reference information but does not include motion vector reference information, the terminal decodes the motion vector information of the block to be decoded. Then, the terminal determines whether the pixel reference information of the block to be decoded is decoded based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded, and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0056] In the above-mentioned video decoding method, the reference information includes at least one of motion vector reference information and pixel reference information. When the reference information includes motion vector reference information, it is determined whether the decoding of the motion vector reference information of the block to be decoded is completed according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; when the reference information includes pixel reference information, it is determined whether the decoding of the pixel reference information of the block to be decoded is completed according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded. In this way, the specific situation of the dependence of the subsequent frame on the previous frame is comprehensively considered, that is, the subsequent frame may need to refer to the motion vector information and / or pixel information of the previous frame, which is more in line with the actual situation and can ensure the accuracy of video decoding.
[0057] In an exemplary embodiment, Figure 3 As shown, step 201 includes steps 301 to 302. Among them:
[0058] Step 301 , for each reference video frame of the block to be decoded, compare the coordinates of the block to be decoded with the coordinates of the latest decoded block of the reference video frame to determine whether the block at the same position as the block to be decoded in the reference video frame has been decoded.
[0059] In an embodiment of the present application, for each reference video frame of the block to be decoded, the terminal compares the coordinates of the block to be decoded with the coordinates of the latest decoded block of the reference video frame. If the coordinates of the block to be decoded are less than or equal to the coordinates of the latest decoded block of the reference video frame, the terminal determines that the block at the same position as the block to be decoded in the reference video frame is decoded. If the coordinates of the block to be decoded are greater than the coordinates of the latest decoded block of the reference video frame, the terminal determines that the block at the same position as the block to be decoded in the reference video frame is not decoded.
[0060] Step 302: If the blocks at the same position as the block to be decoded in each reference video frame are all decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded is completed.
[0061] In the above-mentioned video decoding method, by comparing the coordinates of the block to be decoded with the coordinates of the latest decoded blocks of each reference video frame of the block to be decoded, it is determined whether the blocks at the same position as the block to be decoded in each reference video frame have been decoded, thereby determining whether the motion vector reference information of the block to be decoded has been decoded. In this way, the dependence of the subsequent frame on the decoding completion information of the previous frame is converted into dependence on the decoding completion information of the blocks at the same position of the previous frame, which can reduce the dependence of the subsequent frame on the previous frame in video decoding, increase the possibility that the reference information has been decoded, and further improve the video decoding speed.
[0062] In an exemplary embodiment, Figure 4 As shown, step 202 includes steps 401 to 403. Among them:
[0063] Step 401 : for each reference video frame of the block to be decoded, the coordinates of the reference pixels of the reference video frame required by the block to be decoded are calculated according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded for the reference video frame.
[0064] In an embodiment of the present application, the motion vector information of the block to be decoded includes the motion vector information of the block to be decoded for each reference video frame of the block to be decoded. The reference video frames of the block to be decoded are different, and the coordinates of the reference pixels of the reference video frame required by the block to be decoded are different. For each reference video frame of the block to be decoded, the terminal adds the coordinates of the block to be decoded and the motion vector of the block to be decoded for the reference video frame to obtain the coordinates of the reference pixels of the reference video frame required by the block to be decoded.
[0065] Step 402 , compare the coordinates of the reference pixel with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel block of the reference video frame required by the block to be decoded has been decoded.
[0066] In an embodiment of the present application, the terminal compares the coordinates of the reference pixel with the coordinates of the latest decoded block of the reference video frame. If the coordinates of the reference pixel are less than or equal to the coordinates of the latest decoded block of the reference video frame, the terminal determines that the reference pixel block of the reference video frame required for the block to be decoded has been decoded. If the coordinates of the reference pixel are greater than the coordinates of the latest decoded block of the reference video frame, the terminal determines that the reference pixel block of the reference video frame required for the block to be decoded has not been decoded. Among them, the reference pixel block is a reference pixel area, which can be a block where the reference pixel is located.
[0067] Step 403: If the reference pixel blocks of each reference video frame required by the block to be decoded are all decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
[0068] In the above-mentioned video decoding method, the coordinates of the reference pixels of the reference video frames required by the block to be decoded are calculated according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded for each reference video frame to be decoded, and by comparing the coordinates of the reference pixels with the coordinates of the latest decoded blocks of each reference video frame of the block to be decoded, it is determined whether the reference pixel blocks of each reference video frame required by the block to be decoded have been decoded, thereby determining whether the pixel reference information of the block to be decoded has been decoded. In this way, the dependence of the subsequent frame on the decoding completion information of the previous frame is converted into the dependence on the decoding completion information of the reference pixel block of the required previous frame, which can reduce the dependence of the subsequent frame on the previous frame in video decoding, and is more in line with the actual situation that the reference information may have been decoded, which can further improve the video decoding speed.
[0069] In an exemplary embodiment, Figure 5 As shown, the method further includes step 501 to step 502. Among them:
[0070] Step 501, if the motion vector reference information of the block to be decoded has not been decoded, then after waiting for a preset first time, return to the step of judging whether the motion vector reference information of the block to be decoded has been decoded based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0071] Step 502, if the pixel reference information of the block to be decoded has not been decoded, then after waiting for a preset second time, return to the step of judging whether the pixel reference information of the block to be decoded has been decoded based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0072] In the embodiment of the present application, the first time and the second time may be the same or different. The first time and the second time may both be the time for performing video decoding on a block in a video frame.
[0073] In the above-mentioned video decoding method, if the motion vector reference information of the block to be decoded has not been decoded, then after waiting for a preset first time, the step of judging whether the decoding of the motion vector reference information of the block to be decoded has been completed is returned based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded is returned; if the decoding of the pixel reference information of the block to be decoded has not been completed, then after waiting for a preset second time, the step of judging whether the decoding of the pixel reference information of the block to be decoded has been completed is returned based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded is returned. In this way, when the decoding of the reference information of the block to be decoded has not been completed, it is judged again whether the decoding of the reference information of the block to be decoded has been completed after waiting for a period of time, and the video decoding is continued until the condition is met, which can further ensure the accuracy of the video decoding.
[0074] In an exemplary embodiment, Figure 6 As shown, the method further comprises the following steps:
[0075] Step 601, for each video frame being decoded, allocate a thread to the video frame. And / or,
[0076] Step 602: for each video frame being decoded, a core is allocated to the video frame.
[0077] In an embodiment of the present application, different threads correspond to different video frames for video decoding in parallel. And / or different cores correspond to different video frames for video decoding in parallel. The number of threads may be the same as the number of video frames for parallel decoding. The number of cores may be the same as the number of video frames for parallel decoding.
[0078] In the above video decoding method, in software implementation, parallelism is achieved through multi-threading, and a thread is allocated to each video frame being decoded; in hardware implementation, parallelism is achieved through multi-core, and a core is allocated to each video frame being decoded. In this way, software support and / or hardware support are provided for parallel processing of decoding at the frame level, which can further ensure the improvement of video decoding speed.
[0079] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0080] Based on the same inventive concept, the embodiment of the present application also provides a video decoding device for implementing the above-mentioned video decoding method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more video decoding device embodiments provided below can refer to the limitations on the video decoding method above, and will not be repeated here.
[0081] In an exemplary embodiment, Figure 7 As shown, a video decoding device 700 is provided, comprising: a starting module 710, a determination module 720 and a decoding module 730, wherein:
[0082] A starting module 710 is used for starting video decoding of a video frame to be decoded that is located after the video frame and is closest to the video frame according to a preset number of parallel decoded video frames when decoding of the video frame is completed;
[0083] The judging module 720 is used to judge whether the reference information of the block to be decoded has been decoded when performing video decoding on each block to be decoded in the video frame to be decoded, according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes a video frame that has been decoded and a video frame being decoded; the latest decoded block is a block in the video frame that has completed video decoding;
[0084] The decoding module 730 is configured to continue video decoding of the block to be decoded if the decoding of the reference information of the block to be decoded is completed.
[0085] Optionally, the reference information includes at least one of motion vector reference information and pixel reference information, and the determination module 720 is specifically configured to:
[0086] In the case where the reference information includes motion vector reference information, judging whether the motion vector reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded;
[0087] In the case where the reference information includes pixel reference information, it is determined whether the pixel reference information of the block to be decoded is decoded based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded, and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0088] Optionally, the judging module 720 is specifically configured to:
[0089] For each reference video frame of the block to be decoded, compare the coordinates of the block to be decoded with the coordinates of the latest decoded block of the reference video frame, and determine whether the block at the same position as the block to be decoded in the reference video frame has been decoded;
[0090] If the blocks at the same position as the block to be decoded in each of the reference video frames are all decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded is completed.
[0091] Optionally, the judging module 720 is specifically configured to:
[0092] For each reference video frame of the block to be decoded, calculating the coordinates of the reference pixels of the reference video frame required by the block to be decoded according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded with respect to the reference video frame;
[0093] Comparing the coordinates of the reference pixel with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel block of the reference video frame required by the block to be decoded has been decoded;
[0094] If the reference pixel blocks of the reference video frames required by the block to be decoded are all decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
[0095] Optionally, the device 700 further includes:
[0096] a first waiting module, configured to return to the step of determining whether the decoding of the motion vector reference information of the block to be decoded is completed according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded after waiting for a preset first time if the decoding of the motion vector reference information of the block to be decoded is not completed;
[0097] The second waiting module is used to return to the step of judging whether the pixel reference information of the block to be decoded is decoded according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded after waiting for a preset second time if the pixel reference information of the block to be decoded has not been decoded.
[0098] Optionally, the device 700 further includes:
[0099] A first allocation module is used to allocate a thread to each video frame being decoded; and / or,
[0100] The second allocation module is used to allocate a core to each video frame being decoded.
[0101] Each module in the above video decoding device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0102] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a video decoding method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0103] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0105] When decoding of a video frame is completed, starting video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames;
[0106] When performing video decoding on each block to be decoded in the video frame to be decoded, judging whether the reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes a video frame that has been decoded and a video frame being decoded; the latest decoded block is a block in the video frame that has completed video decoding;
[0107] If the decoding of the reference information of the block to be decoded is completed, the video decoding of the block to be decoded is continued.
[0108] In one embodiment, the reference information includes at least one of motion vector reference information and pixel reference information, and the processor further implements the following steps when executing the computer program: when the reference information includes motion vector reference information, judging whether the decoding of the motion vector reference information of the block to be decoded is completed according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; when the reference information includes pixel reference information, judging whether the decoding of the pixel reference information of the block to be decoded is completed according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0109] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each reference video frame of the block to be decoded, the coordinates of the block to be decoded are compared with the coordinates of the latest decoded block of the reference video frame, and it is determined whether the same-position blocks as the block to be decoded in the reference video frame have been decoded; if the same-position blocks as the block to be decoded in each of the reference video frames have been decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded has been completed.
[0110] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each reference video frame of the block to be decoded, according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded to the reference video frame, the coordinates of the reference pixels of the reference video frame required for the block to be decoded are calculated; the coordinates of the reference pixels are compared with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel blocks of the reference video frame required for the block to be decoded are decoded; if the reference pixel blocks of each reference video frame required for the block to be decoded are decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
[0111] In one embodiment, when the processor executes the computer program, the following steps are further implemented: if the motion vector reference information of the block to be decoded has not been decoded, then after waiting for a preset first time, the step of judging whether the decoding of the motion vector reference information of the block to be decoded has been completed is returned based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; if the pixel reference information of the block to be decoded has not been decoded, then after waiting for a preset second time, the step of judging whether the decoding of the pixel reference information of the block to be decoded has been completed is returned based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0112] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each video frame being decoded, a thread is allocated to the video frame; and / or for each video frame being decoded, a core is allocated to the video frame.
[0113] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0114] When decoding of a video frame is completed, starting video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames;
[0115] When performing video decoding on each block to be decoded in the video frame to be decoded, judging whether the reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes a video frame that has been decoded and a video frame being decoded; the latest decoded block is a block in the video frame that has completed video decoding;
[0116] If the decoding of the reference information of the block to be decoded is completed, the video decoding of the block to be decoded is continued.
[0117] In one embodiment, the reference information includes at least one of motion vector reference information and pixel reference information, and the computer program, when executed by the processor, further implements the following steps: when the reference information includes motion vector reference information, judging whether the decoding of the motion vector reference information of the block to be decoded is completed according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; when the reference information includes pixel reference information, judging whether the decoding of the pixel reference information of the block to be decoded is completed according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0118] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each reference video frame of the block to be decoded, the coordinates of the block to be decoded are compared with the coordinates of the latest decoded block of the reference video frame, and it is determined whether the same-position blocks as the block to be decoded in the reference video frame have been decoded; if the same-position blocks as the block to be decoded in each of the reference video frames have been decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded has been completed.
[0119] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each reference video frame of the block to be decoded, according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded with respect to the reference video frame, the coordinates of the reference pixels of the reference video frame required for the block to be decoded are calculated; the coordinates of the reference pixels are compared with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel blocks of the reference video frame required for the block to be decoded are decoded; if the reference pixel blocks of the reference video frames required for the block to be decoded are all decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
[0120] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: if the motion vector reference information of the block to be decoded has not been decoded, then after waiting for a preset first time, returning to the step of judging whether the decoding of the motion vector reference information of the block to be decoded has been completed based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; if the pixel reference information of the block to be decoded has not been decoded, then after waiting for a preset second time, returning to the step of judging whether the decoding of the pixel reference information of the block to be decoded has been completed based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0121] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each video frame being decoded, a thread is allocated to the video frame; and / or, for each video frame being decoded, a core is allocated to the video frame.
[0122] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0123] When decoding of a video frame is completed, starting video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames;
[0124] When performing video decoding on each block to be decoded in the video frame to be decoded, judging whether the reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes a video frame that has been decoded and a video frame being decoded; the latest decoded block is a block in the video frame that has completed video decoding;
[0125] If the decoding of the reference information of the block to be decoded is completed, the video decoding of the block to be decoded is continued.
[0126] In one embodiment, the reference information includes at least one of motion vector reference information and pixel reference information, and the computer program, when executed by the processor, further implements the following steps: when the reference information includes motion vector reference information, judging whether the decoding of the motion vector reference information of the block to be decoded is completed according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; when the reference information includes pixel reference information, judging whether the decoding of the pixel reference information of the block to be decoded is completed according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each reference video frame of the block to be decoded, the coordinates of the block to be decoded are compared with the coordinates of the latest decoded block of the reference video frame, and it is determined whether the same-position blocks as the block to be decoded in the reference video frame have been decoded; if the same-position blocks as the block to be decoded in each of the reference video frames have been decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded has been completed.
[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each reference video frame of the block to be decoded, according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded with respect to the reference video frame, the coordinates of the reference pixels of the reference video frame required for the block to be decoded are calculated; the coordinates of the reference pixels are compared with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel blocks of the reference video frame required for the block to be decoded are decoded; if the reference pixel blocks of the reference video frames required for the block to be decoded are all decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
[0129] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: if the motion vector reference information of the block to be decoded has not been decoded, then after waiting for a preset first time, returning to the step of judging whether the decoding of the motion vector reference information of the block to be decoded has been completed based on the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; if the pixel reference information of the block to be decoded has not been decoded, then after waiting for a preset second time, returning to the step of judging whether the decoding of the pixel reference information of the block to be decoded has been completed based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
[0130] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each video frame being decoded, a thread is allocated to the video frame; and / or, for each video frame being decoded, a core is allocated to the video frame.
[0131] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0132] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0133] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0134] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A video decoding method, characterized in that: The method comprises: When decoding of a video frame is completed, starting video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames; When performing video decoding on each block to be decoded in the video frame to be decoded, judging whether the reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes a video frame that has been decoded and a video frame being decoded; the latest decoded block is a block in the video frame that has completed video decoding; If the decoding of the reference information of the block to be decoded is completed, continuing video decoding of the block to be decoded; The reference information includes at least one of motion vector reference information and pixel reference information, and judging whether the reference information of the block to be decoded is completely decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded includes: when the reference information includes motion vector reference information, judging whether the motion vector reference information of the block to be decoded is completely decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; when the reference information includes pixel reference information, judging whether the pixel reference information of the block to be decoded is completely decoded according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
2. The method according to claim 1, characterized in that The step of judging whether the motion vector reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded comprises: For each reference video frame of the block to be decoded, compare the coordinates of the block to be decoded with the coordinates of the latest decoded block of the reference video frame, and determine whether the block at the same position as the block to be decoded in the reference video frame has been decoded; If the blocks at the same position as the block to be decoded in each of the reference video frames are all decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded is completed.
3. The method according to claim 1, characterized in that The determining whether the pixel reference information of the block to be decoded is completely decoded according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded, and the coordinates of the latest decoded block of the reference video frame of the block to be decoded comprises: For each reference video frame of the block to be decoded, calculating the coordinates of the reference pixels of the reference video frame required by the block to be decoded according to the coordinates of the block to be decoded and the motion vector information of the block to be decoded with respect to the reference video frame; Comparing the coordinates of the reference pixel with the coordinates of the latest decoded block of the reference video frame to determine whether the reference pixel block of the reference video frame required by the block to be decoded has been decoded; If the reference pixel blocks of the reference video frames required by the block to be decoded are all decoded, it is determined that the decoding of the pixel reference information of the block to be decoded is completed.
4. The method according to claim 1, characterized in that: The method further comprises: If the motion vector reference information of the block to be decoded has not been decoded, after waiting for a preset first time, returning to the step of determining whether the motion vector reference information of the block to be decoded has been decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; If the pixel reference information of the block to be decoded has not been decoded, after waiting for a preset second time, return to the step of judging whether the pixel reference information of the block to be decoded has been decoded based on the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
5. The method according to claim 1, characterized in that The method further comprises: For each video frame being decoded, assigning a thread to the video frame; and / or, For each video frame being decoded, a core is allocated to the video frame.
6. A video decoding device, characterized in that: The device comprises: A starting module, used for starting the video decoding of a video frame to be decoded that is located after the video frame and closest to the video frame according to a preset number of parallel decoded video frames when the decoding of a video frame is completed; A judgment module, used for judging whether the reference information of the block to be decoded is decoded when performing video decoding on each block to be decoded in the video frame to be decoded, according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; the reference video frame includes the video frame that has been decoded and the video frame being decoded; the latest decoded block is the block in the video frame that has completed video decoding; A decoding module, configured to continue video decoding of the block to be decoded if the decoding of the reference information of the block to be decoded is completed; The reference information includes at least one of motion vector reference information and pixel reference information, and the judgment module is specifically used to: when the reference information includes motion vector reference information, judge whether the motion vector reference information of the block to be decoded is decoded according to the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded; when the reference information includes pixel reference information, judge whether the pixel reference information of the block to be decoded is decoded according to the motion vector information of the block to be decoded, the coordinates of the block to be decoded and the coordinates of the latest decoded block of the reference video frame of the block to be decoded.
7. The device according to claim 6, characterized in that The judgment module is specifically used for: For each reference video frame of the block to be decoded, compare the coordinates of the block to be decoded with the coordinates of the latest decoded block of the reference video frame, and determine whether the block at the same position as the block to be decoded in the reference video frame has been decoded; If the blocks at the same position as the block to be decoded in each of the reference video frames are all decoded, it is determined that the decoding of the motion vector reference information of the block to be decoded is completed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
