Video coding method and device, video decoding method and device, computer equipment and storage medium
By turning off encoding filtering when the device performance is insufficient and obtaining the target video code stream, the problem of video decoding speed decreases when the device performance is insufficient, and a more efficient decoding process is achieved.
Patent Information
- Application Number
- CN202311001155.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2025-02-18
AI Technical Summary
When the equipment performance is insufficient, the prior art will find it difficult to effectively improve the video decoding speed, which can easily lead to problems such as lag in decoding and slowdown.
By obtaining the current video code stream sent by the encoding end, decoding and obtaining the reference decoding consumption parameters, when the parameters exceed the preset threshold, an instruction to turn off the encoding filtering is sent to the encoding end, closing the filtering and obtaining the target video code stream, and the target video code stream It is encoded by the code filtering of the off-state and decoded.
When the equipment performance is insufficient, the video decoding speed is significantly improved by turning off encoding filtering and obtaining the target video code stream, and decoding is avoided.
Smart Images

Figure CN119484872A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a video encoding and decoding method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of computer technology, real-time video encoding and decoding technology has emerged. For example, in cloud gaming or online live broadcasting, real-time video encoding and decoding is required to extract corresponding business services. At present, when decoding videos, the decoding speed is usually increased by multi-channel parallelism. However, decoding acceleration through multi-channel parallelism requires higher device performance. When the device performance is insufficient, it is easy to cause decoding jams and reduce the decoding speed. Summary of the invention
[0003] Based on this, it is necessary to provide a video decoding, encoding method, device, computer equipment, computer-readable storage medium and computer program product that can improve the video decoding speed when the device performance is insufficient to address the above technical problems.
[0004] In a first aspect, the present application provides a video decoding method. The method comprises:
[0005] Get the current video code stream sent by the encoder. The current video code stream is the code stream obtained by encoding the current video frame through the coding filter in the turned-on state;
[0006] Decode the current video code stream to obtain the current video frame, and obtain the reference decoding consumption parameter corresponding to the current video frame, where the reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0007] When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, a coding filter closing instruction is sent to the encoder, and the encoder receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction;
[0008] The target video code stream sent by the encoding end is obtained, where the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in a closed state, and the target video code stream is decoded to obtain the target video frame.
[0009] In a second aspect, the present application further provides a video decoding device. The device comprises:
[0010] The current code stream acquisition module is used to obtain the current video code stream sent by the encoding end. The current video code stream is the code stream obtained by encoding the current video frame through the coding filter in the turned-on state;
[0011] A decoding module is used to decode the current video code stream to obtain the current video frame and obtain reference decoding consumption parameters corresponding to the current video frame, where the reference decoding consumption parameters are used to characterize the resources consumed during decoding;
[0012] The consumption judgment module is used to send a coding filter closing instruction to the encoder when the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold. The encoder receives the closing instruction and closes the coding filter in the open state according to the closing instruction;
[0013] The target bitstream acquisition module is used to acquire the target video bitstream sent by the encoding end. The target video bitstream is the bitstream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in the closed state, and decode the target video bitstream to obtain the target video frame.
[0014] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0015] Get the current video code stream sent by the encoder. The current video code stream is the code stream obtained by encoding the current video frame through the coding filter in the turned-on state;
[0016] Decode the current video code stream to obtain the current video frame, and obtain the reference decoding consumption parameter corresponding to the current video frame, where the reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0017] When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, a coding filter closing instruction is sent to the encoder, and the encoder receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction;
[0018] The target video code stream sent by the encoding end is obtained, where the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in a closed state, and the target video code stream is decoded to obtain the target video frame.
[0019] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0020] Get the current video code stream sent by the encoder. The current video code stream is the code stream obtained by encoding the current video frame through the coding filter in the turned-on state;
[0021] Decode the current video code stream to obtain the current video frame, and obtain the reference decoding consumption parameter corresponding to the current video frame, where the reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0022] When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, a coding filter closing instruction is sent to the encoder, and the encoder receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction;
[0023] The target video code stream sent by the encoding end is obtained, where the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in a closed state, and the target video code stream is decoded to obtain the target video frame.
[0024] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0025] Get the current video code stream sent by the encoder. The current video code stream is the code stream obtained by encoding the current video frame through the coding filter in the turned-on state;
[0026] Decode the current video code stream to obtain the current video frame, and obtain the reference decoding consumption parameter corresponding to the current video frame, where the reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0027] When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, a coding filter closing instruction is sent to the encoder, and the encoder receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction;
[0028] The target video code stream sent by the encoding end is obtained, where the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in a closed state, and the target video code stream is decoded to obtain the target video frame.
[0029] The above-mentioned video decoding method, device, computer equipment, storage medium and computer program product obtain the current video code stream sent by the encoding end, the current video code stream is the code stream obtained after the current video frame is encoded by the coding filter in the turned-on state; decode the current video code stream to obtain the current video frame, and obtain the reference decoding consumption parameter corresponding to the current video frame, the reference decoding consumption parameter is used to characterize the resources consumed during decoding; when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, send a coding filter closing instruction to the encoding end, the encoding end receives the closing instruction, and closes the coding filter in the turned-on state according to the closing instruction; obtain the target video code stream sent by the encoding end, the target video code stream is the code stream obtained after the backward video frame corresponding to the current video frame is encoded by the coding filter in the turned-off state, and decode the target video code stream to obtain the target video frame. That is, when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, send the coding filter closing instruction to the encoding end, so as to obtain the target video code stream, and then decode the target video code stream without filtering during decoding, thereby improving the decoding speed when the device performance is insufficient.
[0030] In a first aspect, the present application provides a video encoding method. The method comprises:
[0031] Get a video encoding request, which carries the current video frame;
[0032] Acquire a coding filter state based on a video coding request, and when the coding filter state is in an on state, encode the current video frame through the coding filter in the on state to obtain a current video code stream, and send the current video code stream to a decoding end;
[0033] Obtain the closing instruction of the coding filter. The closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, it is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0034] According to the closing instruction, the coding filter in the turned-on state is closed, and the coding filter state is updated to be in the turned-off state;
[0035] A backward video frame corresponding to the current video frame is obtained, the backward video frame is encoded through a coding filter in a closed state to obtain a target video code stream, and the target video code stream is sent to a decoding end.
[0036] In a second aspect, the present application further provides a video decoding device. The device comprises:
[0037] A request acquisition module is used to obtain a video encoding request, where the video encoding request carries the current video frame;
[0038] A filter encoding module is used to obtain a coding filter state based on a video encoding request. When the coding filter state is in an on state, the current video frame is encoded by the coding filter in the on state to obtain a current video code stream, and the current video code stream is sent to a decoding end;
[0039] A closing instruction acquisition module is used to obtain a closing instruction of the coding filter. The closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, it is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0040] A state updating module, used to close the coding filter in the turned-on state according to the closing instruction, and update the coding filter state to the turned-off state;
[0041] The backward encoding module is used to obtain the backward video frame corresponding to the current video frame, encode the backward video frame through the coding filter in the closed state, obtain the target video code stream, and send the target video code stream to the decoding end.
[0042] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0043] Get a video encoding request, which carries the current video frame;
[0044] Acquire a coding filter state based on a video coding request, and when the coding filter state is in an on state, encode the current video frame through the coding filter in the on state to obtain a current video code stream, and send the current video code stream to a decoding end;
[0045] Obtain the closing instruction of the coding filter. The closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, it is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0046] According to the closing instruction, the coding filter in the turned-on state is closed, and the coding filter state is updated to be in the turned-off state;
[0047] A backward video frame corresponding to the current video frame is obtained, the backward video frame is encoded through a coding filter in a closed state to obtain a target video code stream, and the target video code stream is sent to a decoding end.
[0048] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0049] Get a video encoding request, which carries the current video frame;
[0050] Acquire a coding filter state based on a video coding request, and when the coding filter state is in an on state, encode the current video frame through the coding filter in the on state to obtain a current video code stream, and send the current video code stream to a decoding end;
[0051] Obtain the closing instruction of the coding filter. The closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, it is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0052] According to the closing instruction, the coding filter in the turned-on state is closed, and the coding filter state is updated to be in the turned-off state;
[0053] A backward video frame corresponding to the current video frame is obtained, the backward video frame is encoded through a coding filter in a closed state to obtain a target video code stream, and the target video code stream is sent to a decoding end.
[0054] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0055] Get a video encoding request, which carries the current video frame;
[0056] Acquire a coding filter state based on a video coding request, and when the coding filter state is in an on state, encode the current video frame through the coding filter in the on state to obtain a current video code stream, and send the current video code stream to a decoding end;
[0057] Obtain the closing instruction of the coding filter. The closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, it is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0058] According to the closing instruction, the coding filter in the turned-on state is closed, and the coding filter state is updated to be in the turned-off state;
[0059] A backward video frame corresponding to the current video frame is obtained, the backward video frame is encoded through a coding filter in a closed state to obtain a target video code stream, and the target video code stream is sent to a decoding end.
[0060] The above-mentioned video encoding method, device, computer equipment, storage medium and computer program product obtain a video encoding request, which carries the current video frame; obtain the encoding filter state based on the video encoding request, and when the encoding filter state is in the on state, encode the current video frame through the encoding filter in the on state to obtain the current video code stream, and send the current video code stream to the decoding end; obtain the closing instruction of the encoding filter, the closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame, and obtains the reference decoding consumption parameter corresponding to the current video frame, which is sent when the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, and the reference decoding consumption parameter is used to characterize the resources consumed during decoding; according to the closing instruction, the encoding filter in the on state is closed, and the encoding filter state is updated to be in the off state; obtain the backward video frame corresponding to the current video frame, encode the backward video frame through the encoding filter in the off state, obtain the target video code stream, and send the target video code stream to the decoding end. That is, when the coding filter closing instruction sent by the decoding end is obtained, encoding is performed through the coding filter in the closed state to obtain the target video code stream, and then the target video code stream is sent to the decoding end, so that the decoding end decodes the target video code stream without filtering during decoding, thereby improving the decoding speed when the device performance is insufficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A diagram showing an application environment of a video decoding method in an embodiment;
[0062] Figure 2 is a schematic flow chart of a video decoding method in one embodiment;
[0063] Figure 3 A schematic diagram of a flow chart of obtaining reference decoding consumption parameters in one embodiment;
[0064] Figure 4 A schematic diagram of a process for obtaining a target cloud game video frame in one embodiment;
[0065] Figure 5 is a schematic flow chart of a video decoding method in a specific embodiment;
[0066] Figure 6is a schematic flow chart of a video encoding method in one embodiment;
[0067] Figure 7 It is a schematic diagram of a process flow of encoding performed by an encoding end in a specific embodiment;
[0068] Figure 8 It is a schematic diagram of a flow chart of updating the coding filter state at the coding end in a specific embodiment;
[0069] Fig. 9 A schematic diagram of a process for obtaining a target cloud game video stream in a specific embodiment;
[0070] Fig.10 is a schematic flow chart of a video decoding method in a specific embodiment;
[0071] Fig.11 This is an application environment diagram of a real-time live broadcast scenario in a specific embodiment;
[0072] Fig.12 is a structural block diagram of a video decoding device in one embodiment;
[0073] Fig.13 is a structural block diagram of a video encoding device in one embodiment;
[0074] Fig.14 is an internal structure diagram of a computer device in one embodiment;
[0075] Fig.15 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0076] 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.
[0077] Cloud gaming, also known as gaming on demand, is an online gaming technology based on cloud computing technology. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, the game is not played on the player's game terminal, but on a cloud server, which renders the game scene into a video and audio stream and transmits it to the player's game terminal over the network. The player's game terminal does not need to have powerful graphics computing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input commands and send them to the cloud server.
[0078] The video decoding method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the decoding end 102 communicates with the encoding end 104 through a network. The data storage system can store data that the encoding end 104 needs to process. The data storage system can exist independently, or can be integrated on the encoding end 104, or can be placed on the cloud or other servers. The decoding end 102 obtains the current video code stream sent by the encoding end 104, and the current video code stream is a code stream obtained by encoding the current video frame through the coding filter in the turned-on state; the decoding end 102 decodes the current video code stream to obtain the current video frame, and obtains the reference decoding consumption parameter corresponding to the current video frame, and the reference decoding consumption parameter is used to characterize the resources consumed during decoding; when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, the decoding end 102 sends a coding filter closing instruction to the encoding end 104, and the encoding end 104 receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction; the decoding end 102 obtains the target video code stream sent by the encoding end 104, and the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in the turned-off state, and decodes the target video code stream to obtain the target video frame. Among them, the decoding end 102 can be a terminal or a server. The encoder 104 can be a terminal or a server. The terminal may be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected via wired or wireless communications, which is not limited in this application.
[0079] In one embodiment, Figure 2 As shown, a video decoding method is provided, which is applied to Figure 1 The decoding end in the example is used for explanation. It can be understood that the method can also be applied to the encoding end, and can also be applied to a system including the encoding end and the decoding end, and is implemented through the interaction between the encoding end and the decoding end. The following steps are included:
[0080] S202, obtaining a current video code stream sent by the encoding end, where the current video code stream is a code stream obtained by encoding the current video frame through an encoding filter that is in an enabled state.
[0081] Among them, the encoding end is used to encode the video frame. The current video code stream refers to the code stream obtained after the current video frame is encoded by the encoding end, and the encoding end uses the encoding filter in the turned-on state for encoding. The current video frame refers to the video frame corresponding to the current video code stream. The encoding filter refers to the filter used in encoding, which reduces the error and distortion after encoding by filtering the pixel values in the encoding process. The encoding filter may include loop filtering. The video quality can be improved by filtering, and the deblocking effect and ringing effect can be reduced. The encoding filter in the turned-on state means that the filter can be used normally during encoding.
[0082] Specifically, the current video code stream is a code stream obtained after encoding the current video frame through the coding filter in the turned-on state, wherein the current video code stream can be obtained after the encoding end encodes the current video frame through the coding filter in the turned-on state, that is, when the encoding end encodes the video frame, it is necessary to perform the filtering step in the encoding process to obtain the current video code stream. Then, the current video code stream is transmitted to the decoding end. The decoding end receives the current video code stream transmitted by the encoding end.
[0083] In one embodiment, the decoding end may also obtain the current video code stream from a database, may also obtain the current video code stream from a service provider, may also obtain the current video code stream uploaded by a terminal, and so on.
[0084] S204, decoding the current video code stream to obtain a current video frame, and obtaining a reference decoding consumption parameter corresponding to the current video frame, where the reference decoding consumption parameter is used to characterize resources consumed during decoding.
[0085] The reference decoding consumption parameter is used to characterize the resources consumed during decoding, which include but are not limited to time resources, memory resources, and processor resources, etc., that is, the reference decoding consumption parameter can be decoding consumption time, decoding consumption memory, or decoding consumption processor, etc. The reference decoding consumption parameters obtained when decoding the bitstreams corresponding to different video frames are different.
[0086] Specifically, the decoding end decodes the current video code stream. Since the current video code stream is a code stream obtained by encoding the current video frame through an encoding filter that is in an open state, at this time, when decoding, it is necessary to perform decoding through filtering, that is, the reconstructed image obtained by decoding is filtered to obtain the current video frame. Then the decoding end obtains the reference decoding consumption parameter corresponding to the current video frame, wherein the decoding end can obtain the current decoding consumption parameter corresponding to the current video frame, and the current decoding consumption parameter is used to characterize the resources consumed when decoding the code stream corresponding to the current video frame, and then the current decoding consumption parameter is used as the reference decoding consumption parameter. The decoding end can also obtain the decoding consumption parameter within a period of time, and then calculate the average decoding consumption parameter, and use the average decoding consumption parameter as the reference decoding consumption parameter.
[0087] In one embodiment, when video decoding starts, the decoding end may also obtain the bitstream encoded using the filter in the closed state. Then, during decoding, decoding may also be performed using the filter in the closed state, that is, the decoded video frame is obtained without filtering during decoding.
[0088] S206, when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, a coding filter closing instruction is sent to the encoder, and the encoder receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction.
[0089] The preset parameter threshold refers to a preset decoding consumption parameter threshold for converting the coding filter from the on state to the off state. The off instruction refers to an instruction for prohibiting the use of the filter during the encoding process. The coding filter in the on state can be used normally during the encoding process, and the coding filter in the off state is prohibited from being used during the encoding process.
[0090] Specifically, the decoding end compares the reference decoding consumption parameter corresponding to the current video frame with the preset parameter threshold. When the reference decoding consumption parameter corresponding to the current video frame does not exceed the preset parameter threshold, it means that the performance of the decoding end is able to support normal decoding. At this time, the decoding end can normally obtain the code stream obtained after encoding by the coding filter in the turned-on state and decode it. When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, it means that the decoding performance at this time cannot support normal decoding, resulting in a decrease in the decoding speed. At this time, in order to increase the decoding speed, the decoding end needs to send a closing instruction of the coding filter to the encoding end. The encoding end receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction. Among them, the encoding end can set the state corresponding to the coding filter to the closed state. When it is detected that the state corresponding to the coding filter is the closed state, the encoding end will not encode through the filter during the video encoding process, that is, the obtained coded code stream is a code stream that has not passed the filter.
[0091] S208, obtaining a target video code stream sent by the encoding end, where the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through a coding filter in a closed state, and decoding the target video code stream to obtain a target video frame.
[0092] The target video bitstream is the bitstream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in the closed state, that is, the target video bitstream is the bitstream that has not passed the coding filter. The target video frame is the video frame obtained by decoding the target video bitstream. Since the target video bitstream is the bitstream that has not passed the coding filter, the video frame can be directly decoded without filtering during decoding.
[0093] Specifically, when the encoder encodes the backward video frame corresponding to the current video frame, it first detects the state of the encoding filter. When the encoding filter is in the off state, it means that the filter is prohibited from being used during the encoding process. At this time, the encoder will not use filtering for encoding during encoding, that is, the filtering step in the encoding process can be skipped to directly obtain the final target video code stream. The encoder then sends the obtained target video code stream to the decoder. The decoder obtains the target video code stream sent by the encoder. The target video code stream is the code stream obtained by encoding the backward video frame corresponding to the current video frame through the encoding filter in the off state, and decodes the target video code stream to obtain the target video frame. At this time, when decoding the target video code stream, the decoder does not need to perform the filtering step in the decoding process, and can directly obtain the target video frame.
[0094] The above-mentioned video decoding method obtains the current video code stream sent by the encoding end, which is the code stream obtained by encoding the current video frame through the coding filter in the turned-on state; decodes the current video code stream to obtain the current video frame, and obtains the reference decoding consumption parameter corresponding to the current video frame, which is used to characterize the resources consumed during decoding; when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, sends a coding filter closing instruction to the encoding end, and the encoding end receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction; obtains the target video code stream sent by the encoding end, which is the code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in the turned-off state, and decodes the target video code stream to obtain the target video frame. That is, when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, sends the coding filter closing instruction to the encoding end, thereby obtaining the target video code stream, and then decodes the target video code stream without filtering during decoding, thereby improving the decoding speed when the device performance is insufficient.
[0095] In one embodiment, after step S208, that is, after decoding the target video code stream through the preset decoding loop filter in the closed state to obtain the target video frame, the process further includes:
[0096] Obtain a reference decoding consumption parameter corresponding to the target video frame. When the reference decoding consumption parameter corresponding to the target video frame is less than a preset target parameter threshold, send a coding filter start instruction to the encoder. The encoder receives the start instruction and turns on the coding filter that is in a closed state according to the start instruction. The preset target parameter threshold is less than the preset parameter threshold.
[0097] The updated video code stream sent by the encoding end is obtained, where the updated video code stream is a code stream obtained by encoding the backward video frame corresponding to the target video frame through the encoding filter in the turned-on state, and the updated video code stream is decoded to obtain the updated video frame.
[0098] Among them, the preset target parameter threshold refers to the preset decoding consumption parameter threshold that converts the coding filter from the closed state to the open state. The preset target parameter threshold is less than the preset parameter threshold. The open instruction refers to an instruction to use the filter during the encoding process. The coding filter in the start state can be used normally during the encoding process, and the coding filter in the closed state is prohibited from being used during the encoding process. Updating the video code stream refers to the video code stream obtained after the state of the coding filter is converted from the closed state to the started state, that is, the video code stream encoded when the state of the coding filter is in the start state.
[0099] Specifically, the decoding end obtains the reference decoding consumption parameter corresponding to the target video frame, and then compares the reference decoding consumption parameter corresponding to the target video frame with the preset target parameter threshold. When the reference decoding consumption parameter corresponding to the target video frame is less than the preset target parameter threshold, it indicates that the current performance of the decoding end is sufficient. For example, when the decoding end completes the task of other competing performance resources, the performance of the decoding end is sufficient, or the performance of the decoding end is jittered, and when the jitter ends, the performance of the decoding end is sufficient. At this time, the decoding end can send an opening instruction of the coding filter to the encoding end. The encoding end receives the opening instruction and opens the coding filter in the closed state according to the opening instruction. For example, the state of the coding filter can be modified from the closed state to the open state. The preset target parameter threshold is less than the preset parameter threshold. Then when the encoding end encodes the video frame, it first determines that the state of the coding filter is the open state, indicating that the filtering step can be used in the encoding process. At this time, when the server is encoding, it encodes the video code stream by encoding the coding filter in the open state, and then the obtained video code stream is sent to the decoding end. The decoding end obtains the updated video code stream sent by the encoding end, and then decodes the updated video code stream. In the decoding process, the filtering step needs to be used for decoding, and finally the updated video frame is obtained.
[0100] In one embodiment, the server can obtain the corresponding reference decoding consumption parameters when decoding a preset number of target video frames, and then determine whether the decoding consumption parameters corresponding to the preset number of video frames are less than the preset target parameter threshold. When the reference decoding consumption parameters corresponding to the preset number of target video frames are less than the preset target parameter threshold, the server sends an encoding filter start instruction to the encoding end, thereby reducing the consumption of judgment resources.
[0101] In the above embodiment, by obtaining the reference decoding consumption parameter corresponding to the target video frame, when the reference decoding consumption parameter corresponding to the target video frame is less than the preset target parameter threshold, a coding filter start instruction is sent to the encoding end, and then the updated video code stream sent by the encoding end is obtained, and the updated video code stream is obtained by encoding the backward video frame corresponding to the target video frame through the coding filter in the turned-on state, and the updated video code stream is decoded to obtain the updated video frame. That is, when the performance of the decoding end is sufficient, the coding filter can be used for encoding during encoding, and then the decoding end obtains the code stream obtained after encoding using the coding filter, and decodes the code stream to obtain the video frame, that is, the quality of the decoded video frame can be improved on the basis of ensuring the decoding speed.
[0102] In one embodiment, the video decoding method further includes the steps of:
[0103] When the reference decoding consumption parameter corresponding to the target video frame is greater than or equal to the preset target parameter threshold, the target coded bitstream obtained by encoding by the encoding filter in the closed state at the encoding end is obtained, and the target coded bitstream is decoded to obtain a decoded video frame.
[0104] Specifically, the decoding end compares the reference decoding consumption parameter corresponding to the target video frame with the preset target parameter threshold. When the reference decoding consumption parameter corresponding to the target video frame is greater than or equal to the preset target parameter threshold, it indicates that the performance of the decoding end is insufficient, which may easily lead to decoding jams. At this time, the decoding end obtains the target coded bitstream obtained by the encoding end through the coding filter in the closed state, and decodes the target coded bitstream, that is, it does not need to be decoded through the filtering step during decoding, thereby obtaining a decoded video frame.
[0105] In the above embodiment, when the reference decoding consumption parameter corresponding to the target video frame is greater than or equal to the preset target parameter threshold, the target coded stream is obtained, and the target coded stream is decoded to obtain a decoded video frame. That is, if the performance of the decoding end is insufficient, the target coded stream obtained by encoding with the coding filter in the closed state can be obtained all the time, and then the target coded stream can be decoded to obtain a decoded video frame, which can improve the decoding speed and prevent the decoding from being stuck.
[0106] In one embodiment, Figure 3 As shown, S204, obtaining reference decoding consumption parameters corresponding to the current video frame, including:
[0107] S302, obtaining the number of historically decoded video frames, and performing self-increment based on the number of historically decoded video frames to obtain the number of currently decoded video frames,
[0108] The historical number of decoded video frames refers to the number of video frames that have been decoded in the past, which is incremented from the initial value when a historical video frame is decoded. The current number of decoded video frames refers to the number of decoded video frames obtained after decoding the current video stream.
[0109] Specifically, the decoding end can obtain the historical number of decoded video frames from the memory, or obtain the historical number of decoded video frames from the cache. The decoding end can also count the number of decoded video frames before decoding the current video stream to obtain the historical number of decoded video frames. Then, the number of decoded video frames is incremented based on the historical number of decoded video frames to obtain the current number of decoded video frames. Among them, the self-increment can refer to adding the historical number of decoded video frames to the preset value to obtain the current number of decoded video frames. The preset value can be 1 or other values, which can be set according to requirements.
[0110] S304: When the number of currently decoded video frames exceeds a preset number threshold, a total parameter consumed by decoding is obtained.
[0111] The preset number threshold refers to a preset threshold of the number of decoded video frames. The total decoded consumption parameter is used to characterize the total resources consumed when decoding the decoded video frames.
[0112] Specifically, the decoding end compares the current number of decoded video frames with a preset number threshold. When the current number of decoded video frames exceeds the preset number threshold, the decoding end obtains the total decoded consumption parameters of all video frames corresponding to the current number of decoded video frames, wherein the consumption parameters of each decoded video frame during decoding can be recorded, and then the total decoded consumption parameters can be calculated. For example, the consumption time of each decoded video frame during decoding can be recorded, and then the sum of all consumption times can be calculated to obtain the total decoded consumption time.
[0113] S306, performing an average calculation based on the total parameters of the decoded messages and the current number of decoded video frames to obtain an average decoding consumption parameter, using the average decoding consumption parameter as a reference decoding consumption parameter, and restoring the current number of decoded video frames to an initial value.
[0114] The average decoding consumption parameter is used to characterize the decoding consumption parameter corresponding to a single video frame.
[0115] Specifically, the decoding end calculates the ratio of the total parameter of the decoded message to the number of currently decoded video frames to obtain the average decoding consumption parameter, and then uses the average decoding consumption parameter as the reference decoding consumption parameter, and restores the current number of decoded video frames to the initial value, which may be 0. The decoding end then recounts the current number of decoded video frames, and returns to the step of obtaining the total parameter of decoding consumption when the current number of decoded video frames exceeds the preset number threshold, and iteratively executes until the video decoding is completed.
[0116] In the above embodiment, when the current number of decoded video frames exceeds the preset number threshold, the total decoded consumption parameter is obtained, and then the average calculation is performed based on the total decoded message parameter and the current number of decoded video frames to obtain the average decoding consumption parameter, and the average decoding consumption parameter is used as the reference decoding consumption parameter, thereby improving the accuracy of the reference decoding consumption parameter.
[0117] In one embodiment, the preset parameter threshold is calculated based on the decoding time of the preset video stream frame rate, and the total decoded consumption parameter includes the total decoded consumption time;
[0118] S306, performing average calculation based on the total parameters of the decoded messages and the number of currently decoded video frames to obtain an average decoding consumption parameter, and using the average decoding consumption parameter as a reference decoding consumption parameter, including the steps of:
[0119] The ratio of the total decoding consumption time to the number of currently decoded video frames is calculated to obtain the average decoding consumption time, and the average decoding consumption time is used as a reference decoding consumption parameter.
[0120] Specifically, the decoding end can count the decoding time of each video frame during decoding, and then calculate the sum of the decoding time of all decoded video frames to obtain the total decoding time. Then, the ratio of the total decoding time to the number of currently decoded video frames is calculated to obtain the average decoding time, and the average decoding time is used as a reference decoding time parameter.
[0121] In one embodiment, the decoding end can count the memory usage of each video frame during decoding, and then calculate the sum of the memory usage of all decoded video frames to obtain the total memory usage of decoding. Then, the ratio of the total memory usage of decoding to the number of currently decoded video frames is calculated to obtain the average memory usage of decoding, and the average memory usage of decoding is used as a reference decoding consumption parameter.
[0122] In one embodiment, the decoding end can count the percentage of processor consumed by decoding each video frame during decoding, and then calculate the sum of the percentage of processor consumed by decoding of all decoded video frames to obtain the total percentage of processor consumed by decoding. Then, the ratio of the total percentage of processor consumed by decoding to the number of currently decoded video frames is calculated to obtain the average percentage of processor consumed by decoding, and the average percentage of processor consumed by decoding is used as a reference decoding consumption parameter.
[0123] In the above embodiment, the average decoding consumption time is obtained by calculating the ratio of the total decoding consumption time to the current number of decoded video frames, and the average decoding consumption time is used as a reference decoding consumption parameter, thereby improving the accuracy of the obtained reference decoding consumption parameter.
[0124] In one embodiment, the video decoding method further includes the steps of:
[0125] When the current number of decoded video frames is less than or equal to a preset number threshold, a backward video stream corresponding to the current video stream is obtained, the backward video bit rate is used as the current video stream, the current video stream is decoded back to obtain the current video frame, and the steps of obtaining a reference decoding consumption parameter corresponding to the current video frame are iteratively executed until the current number of decoded video frames exceeds the preset number threshold, and the total decoded consumption parameter is obtained.
[0126] The backward video code stream refers to the code stream of the backward video frame corresponding to the current video frame, and the backward video code stream is the code stream obtained after the backward video frame is encoded by the coding filter in the turned-on state.
[0127] Specifically, the decoding end compares the current number of decoded video frames with a preset number threshold. When the current number of decoded video frames is less than or equal to the preset number threshold, the decoding end continues to obtain a video code stream, which is a code stream obtained by encoding with a coding filter in an on state. Then, the decoding end uses the backward video bit rate as the current video code stream, returns to decode the current video code stream, obtains the current video frame, and iteratively executes the steps of obtaining a reference decoding consumption parameter corresponding to the current video frame until the current number of decoded video frames exceeds the preset number threshold, and obtains the total decoded consumption parameter.
[0128] In the above embodiment, when the number of currently decoded video frames is less than or equal to the preset number threshold, the backward video code stream corresponding to the current video code stream is obtained, and the backward video bit rate is used as the current video code stream and iterative execution is performed until the number of currently decoded video frames exceeds the preset number threshold, and the total decoded consumption parameter is obtained. That is, the total decoded consumption parameter can be obtained at intervals of the preset number threshold, and the parameter threshold does not need to be compared after each decoding, which can save service resources.
[0129] In one embodiment, S204, decoding the current video code stream to obtain the current video frame includes the following steps:
[0130] The current video code stream is entropy decoded to obtain entropy decoded image information; based on the entropy decoded image information, inverse quantization, inverse transformation and inverse prediction are performed to obtain a reconstructed image; the reconstructed image is filtered to obtain the current video frame.
[0131] Among them, entropy decoding refers to reversing the steps performed during entropy coding and extracting the original elements from the coded sequence. Entropy coding refers to coding that does not lose any information according to the entropy principle during the coding process, which belongs to lossless compression. Entropy decoded image information refers to image information obtained by entropy decoding. Dequantization refers to reversing the steps performed during quantization. Quantization refers to quantizing the data of the transform unit into a uniform pattern during the coding process. Dequantization is to multiply the quantization value by the quantization step size to obtain the change coefficient value of the discrete cosine transform. Inverse transformation refers to reversing the steps performed during transformation. Transformation refers to mapping the spatial domain signal in the image to the frequency domain during the coding process, and then encoding the generated transform coefficients. Deprediction refers to reversing the steps performed during prediction. Prediction refers to using the temporal and spatial correlation of the image to predict the pixel currently being encoded through the reconstructed pixel data. Reconstructed image refers to the reconstructed video frame.
[0132] Specifically, the decoding end entropy decodes the current video bitstream to obtain entropy decoded image information, which can be integer coefficients, and then dequantizes the integer system into floating point numbers, and then performs inverse transformation and inverse prediction operations on the floating point numbers to obtain a reconstructed image. Finally, the decoding end filters the reconstructed image to obtain the current video frame.
[0133] In the above embodiment, after decoding the current video code stream to obtain a reconstructed image, the reconstructed image is filtered to obtain the current video frame, thereby improving the quality of the obtained current video frame and ensuring the rate-distortion performance of the encoding.
[0134] In one embodiment, S208, decoding the target video code stream to obtain a target video frame includes:
[0135] The target video code stream is entropy decoded to obtain target entropy decoded image information; based on the target entropy decoded image information, inverse quantization, inverse transformation and inverse prediction are performed to obtain a target reconstructed image; and the target reconstructed image is used as a target video frame.
[0136] The target entropy decoded image information refers to the image information obtained by entropy decoding the target video code stream, and the target reconstructed image refers to the reconstructed image obtained by decoding the target video code stream.
[0137] Specifically, the decoding end performs entropy decoding on the target video bitstream to obtain target entropy decoded image information. Based on the target entropy decoded image information, inverse quantization, inverse transformation and inverse prediction are performed to obtain the target reconstructed image. Finally, the decoding end can directly use the target reconstructed image as the target video frame.
[0138] In the above embodiment, the target video code stream is decoded to obtain a target reconstructed image, and then the target reconstructed image is directly used as a target video frame without filtering the target reconstructed image, thereby improving the speed of video decoding.
[0139] In one embodiment, Figure 4 As shown, the video decoding method further includes:
[0140] S402, obtaining the current cloud game video code stream sent by the cloud game server, where the current cloud game video code stream is a code stream obtained by encoding the current cloud game video frame through an encoding filter that is in an enabled state.
[0141] Among them, cloud gaming server refers to the cloud server of cloud gaming.
[0142] Specifically, cloud game users can play cloud games through cloud game clients. The cloud games can be various types of games, such as turn-based games, role-playing games, simulation games, etc. The cloud game client refers to the terminal that runs the cloud game. When a cloud game user starts playing a cloud game through a cloud game client, the cloud game client obtains the current cloud game video stream sent by the cloud game server. The current cloud game video stream is the stream obtained by the cloud game server after encoding the current cloud game video frame through the encoding filter in the turned on state.
[0143] S404, decode the current cloud game video code stream to obtain the current cloud game video frame, and display the current cloud game video frame.
[0144] Specifically, the cloud game client decodes the current cloud game video code stream, and decodes it by using filtering during decoding to obtain the current cloud game video frame, and then displays the current cloud game video frame in the cloud game client.
[0145] S406, when the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds the preset parameter threshold, a coding filter shutdown instruction is sent to the cloud game server. The cloud game server receives the shutdown instruction and shuts down the coding filter that is in the turned on state according to the shutdown instruction.
[0146] Specifically, the cloud game client obtains the reference decoding consumption parameter corresponding to the current cloud game video frame, and then when the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds the preset parameter threshold, it sends a coding filter shutdown instruction to the cloud game server. The cloud game server receives the shutdown instruction and shuts down the coding filter in the turned-on state according to the shutdown instruction. That is, the cloud game server encodes the subsequent video through the coding filter in the turned-off state, that is, the coding filter is not used during encoding.
[0147] S408, obtain the target cloud game video code stream sent by the cloud game server, the target cloud game video code stream is the code stream obtained by encoding the backward cloud game video frame corresponding to the current cloud game video frame through the coding filter in the closed state, and decode the target cloud game video code stream to obtain the target cloud game video frame, and display the target cloud game video frame.
[0148] Specifically, the cloud game client obtains the target cloud game video code stream sent by the cloud game server. The target cloud game video code stream is a code stream obtained by encoding the backward cloud game video frame corresponding to the current cloud game video frame through a closed coding filter. Then the target cloud game video code stream is decoded, that is, the target cloud game video frame can be obtained without using a filtering process during decoding. Finally, the target cloud game video frame is displayed on the cloud game client. That is, the cloud game client can be used as a decoding end to implement the steps of the video decoding method in any of the above embodiments.
[0149] In the above embodiment, when the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds the preset parameter threshold, a coding filter shutdown instruction is sent to the cloud game server, and then the target cloud game video stream sent by the cloud game server is obtained. The target cloud game video stream is a stream obtained by encoding the backward cloud game video frame corresponding to the current cloud game video frame through the coding filter in a closed state, and the target cloud game video stream is decoded to obtain the target cloud game video frame. When the performance of the cloud game client is insufficient, the decoding efficiency of the cloud game video frame can be improved to avoid freezes in the cloud game video decoding.
[0150] In a specific embodiment, Figure 5As shown, a flow chart of a video decoding method is provided. Specifically, at the beginning of decoding, the decoding end obtains a video code stream of a default type and decodes the video code stream of the default type. The video code stream of the default type refers to the code stream obtained after encoding by the coding filter in the turned-on state. Then, it is determined whether the number c of decoded video frames is less than the preset number threshold T. When the number c of decoded video frames is less than the preset number threshold T, the video code stream of the default type is continued to be obtained for decoding. At this time, the decoding end records the decoding time of each frame. And the frame count is self-incremented, that is, it can be added by 1, and the initial value of the frame count can be 0. Then, it is determined whether there are still video frames to be decoded. When there are still video frames to be decoded, it is determined whether the number c of decoded video frames is less than the preset number threshold T. When the number c of decoded video frames is greater than or equal to the preset number threshold T, the decoding end calculates the sum of the decoding time of the decoded video frames, and then averages the total number of decoded video frames and the sum of the decoding time to obtain the average decoding time. That is, the decoding end can use the average decoding time s of each T frame as the basis for judging the decoding performance. That is, it is determined whether s is greater than 1 / f. The f refers to the frame rate of the video stream, and 1 / f refers to the decoding time threshold of a single frame. When s is greater than 1 / f, it means that the performance of the decoding end is insufficient and cannot support the decoding of the default type of code stream. At this time, the decoding end can apply for a decoding acceleration code stream, which refers to the code stream obtained after encoding through the coding filter in the closed state. At this time, the decoding end sends a closing instruction of the coding filter to the encoding end, and resets the frame count to 0. When the encoding end receives the closing instruction, it sets the state of the coding filter to the closed state. At this time, the coding segment detects that the state of the coding filter is closed during encoding, and skips the filtering step in the encoding process to obtain a decoding acceleration code stream, and then sends the decoding acceleration code stream to the decoding end. The decoding end receives the decoding acceleration code stream, decodes the decoding acceleration code stream, that is, skips the filtering step in the decoding process, and obtains the decoded video frame. At this time, the decoding end records the decoding time, and the frame count is increased by 1. Then it is determined whether the number c of decoded video frames is less than the preset number threshold T. When the number c of decoded video frames is greater than or equal to the preset number threshold T, the decoder calculates the sum of the decoding time of the decoded video frames, and then performs an average calculation based on the total number of decoded video frames and the sum of the decoding time to obtain the average decoding time. Then when s is less than or equal to 1 / f, the decoder further determines whether s is less than the product of 0.6 and 1 / f, where 0.6 is a weighting coefficient that can be set according to requirements, and the weighting coefficient is in the range of 0 to 1. When s is not less than the product of 0.6 and 1 / f, it means that the performance of the decoder is still insufficient. At this time, the frame count is reset to 0, and the decoding acceleration code stream continues to be obtained.When s is less than the product of 0.6 and 1 / f, it means that the performance of the decoding end is sufficient. At this time, the decoding end can re-apply for the default type of code stream, that is, send a command to start the coding filter to the encoding end, and reset the frame count to 0. The encoding end updates the state of the coding filter to the on state according to the start command. Then the decoding end can obtain the default type of code stream and decode it, and continue to iterate until there are no video frames to be decoded, and the decoding of the decoding end ends. That is, when the decoding speed of the decoding end decreases, for example, when the consumed decoding time exceeds the preset time threshold, the decoding speed of a single frame is increased without affecting the decoding, that is, the decoding acceleration code stream is applied for decoding. At the same time, when the decoding speed of the decoding end increases, for example, when the consumed decoding time is less than the preset time threshold, the default type of code stream is applied, that is, the rate-distortion performance of the encoder can be guaranteed when the decoding performance is sufficient.
[0151] In one embodiment, Figure 6 As shown, a video encoding method is provided, which is applied to Figure 1 The encoding end in the example is used for explanation. It can be understood that the method can also be applied to the decoding end, and can also be applied to a system including the encoding end and the decoding end, and is implemented through the interaction between the encoding end and the decoding end. The following steps are included:
[0152] S602, obtaining a video encoding request, where the video encoding request carries a current video frame;
[0153] S604, obtaining a coding filter state based on a video coding request, when the coding filter state is in an on state, encoding the current video frame through the coding filter in the on state to obtain a current video code stream, and sending the current video code stream to a decoding end.
[0154] The coding filter state is used to indicate whether the filter can be used during the coding process, including an on state and an off state. When the filter is in the on state, the filter needs to be performed normally during the coding process. When the filter is in the off state, the filtering step needs to be skipped during the coding process, that is, the filtering step does not need to be performed. The coding end can set the coding filter state to the on state before the coding starts.
[0155] Specifically, the encoding end obtains the video encoding request, and then parses to obtain the current video frame carried by the video encoding request. Then before encoding the current video frame, the encoding end must first detect the encoding filter state. When the encoding filter state is in the on state, the current video frame is encoded by the encoding filter in the on state to obtain the current video code stream, that is, the current video code stream is the code stream obtained by performing the filtering step in the encoding process, and the current video code stream is sent to the decoding end. When the encoding filter state is in the off state, the current video frame is encoded by the encoding filter in the off state to obtain the target video code stream, that is, the target video code stream is the code stream obtained without performing the filtering step in the encoding process, and then the target video code stream is sent to the decoding end.
[0156] S606, obtain the coding filter shutdown instruction, the shutdown instruction is that the decoding end decodes the current video stream to obtain the current video frame, and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, it is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding.
[0157] Specifically, the encoder obtains the instruction to turn off the coding filter sent by the decoder, and the instruction is sent when the decoder decodes the current video bitstream, obtains the current video frame, and obtains the reference decoding consumption parameter corresponding to the current video frame, and the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold. That is, when the performance of the decoder is insufficient, the encoder can apply to the encoder not to perform insufficient filtering on the bitstream, reduce the complexity of the obtained bitstream, thereby improving the decoding speed and preventing decoding jams.
[0158] S608, closing the coding filter in the turned-on state according to the closing instruction, and updating the coding filter state to the turned-off state.
[0159] S610, obtaining a backward video frame corresponding to the current video frame, encoding the backward video frame through a coding filter in a closed state to obtain a target video code stream, and sending the target video code stream to a decoding end.
[0160] Specifically, when the encoder receives the instruction to turn off the coding filter sent by the decoder, the encoder can turn off the coding filter in the on state, that is, change the coding filter state from the on state to the off state. Then, when the encoder obtains the video frame to be encoded, it detects that the coding filter state is in the off state. At this time, the video frame to be encoded is encoded through the coding filter in the off state, that is, the filtering step is not performed during the encoding process, and the target video code stream is obtained, and the target video code stream is sent to the decoder. After the decoder receives the target video code stream, it does not need to perform the filtering step during the decoding process, thereby improving the decoding speed.
[0161] The above-mentioned video encoding method obtains a video encoding request, and the video encoding request carries the current video frame; obtains the encoding filter state based on the video encoding request, and when the encoding filter state is in the on state, encodes the current video frame through the encoding filter in the on state to obtain the current video code stream, and sends the current video code stream to the decoding end; obtains the closing instruction of the encoding filter, and the closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame, and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, the reference decoding consumption parameter is sent, and the reference decoding consumption parameter is used to characterize the resources consumed during decoding; according to the closing instruction, the encoding filter in the on state is closed, and the encoding filter state is updated to the closed state; obtains the backward video frame corresponding to the current video frame, encodes the backward video frame through the encoding filter in the closed state, obtains the target video code stream, and sends the target video code stream to the decoding end. That is, when the coding filter closing instruction sent by the decoding end is obtained, encoding is performed through the coding filter in the closed state to obtain the target video code stream, and then the target video code stream is sent to the decoding end, so that the decoding end decodes the target video code stream without filtering during decoding, thereby improving the decoding speed when the device performance is insufficient.
[0162] In one embodiment, after S610, that is, after obtaining the backward video frame corresponding to the current video frame, encoding the backward video frame through the coding filter in the closed state to obtain the target video code stream, and sending the target video code stream to the decoding end, the step of:
[0163] Obtain a coding filter start instruction sent by the decoding end, turn on the coding filter that is in a closed state according to the start instruction, and update the coding filter state to an open state; obtain a video frame to be encoded, encode the video frame to be encoded through the coding filter in the open state, obtain a target coding stream, and send the target coding stream to the decoding end.
[0164] Specifically, the encoder obtains the start instruction of the coding filter sent by the decoder. The start instruction is that when the decoder detects that the reference decoding consumption parameter corresponding to the target video frame is less than the preset target parameter threshold, the decoder sends the start instruction of the coding filter to the encoder. The decoder can detect whether the corresponding reference decoding consumption parameter is less than the preset target parameter threshold at intervals of a preset number of target video frames. When it is less than the preset target parameter threshold, it indicates that the performance of the decoder is sufficient. At this time, the decoder sends the start instruction of the coding filter to the encoder. Then the encoder turns on the coding filter in the closed state according to the start instruction, and updates the coding filter state to the open state. The encoder obtains the video frame to be encoded, encodes the video frame to be encoded through the coding filter in the open state, that is, performs the filtering step in the encoding process to obtain the target coding code stream, and finally sends the target coding code stream to the decoder. The decoder receives the target coding code stream and performs the filtering step in the decoding process to decode and obtain the decoded video frame.
[0165] In the above embodiment, when the start instruction of the decoding end is obtained, the coding filter state is updated to the turned-on state, and the video frame to be encoded is encoded through the coding filter in the turned-on state to obtain the target coding stream, and finally the target coding stream is sent to the decoding end, thereby enabling the decoding end to improve the quality of video decoding.
[0166] In a specific embodiment, Figure 7 The figure shows a schematic diagram of the process of encoding at the encoding end. Specifically, when the encoding end obtains the frame data to be encoded, the encoding filter state is detected. When the encoding filter state is in the on state, the encoder starts the loop filtering process, and performs the loop filtering process when encoding the current frame again, obtains the bit stream after the encoding is completed, and sends it to the decoding end. When the encoding filter state is in the off state, the encoder disables the loop filtering process, and skips the loop filtering process when encoding the current frame again, obtains the bit stream that can accelerate the decoding, and sends it to the decoding end.
[0167] In a specific embodiment, Figure 8 As shown, it is a schematic diagram of the encoding end updating the encoding filter state. Specifically: the encoding end detects in real time whether it has received the request sent by the decoding end. When receiving the request sent by the decoding end, it determines whether the request is a request for the decoding end to apply for decoding acceleration code stream. When the decoding end applies for decoding acceleration code stream, the decoding end updates the encoding filter state of the encoder to the closed state. When the decoding end does not apply for decoding acceleration code stream, that is, when applying for the default type code stream, the decoding end updates the encoding filter state of the encoder to the open state. That is, the encoding end can update the state of the encoding filter in real time according to the request of the decoding end during the video encoding process, thereby ensuring the decoding speed of the decoding end and preventing decoding from being stuck.
[0168] In one embodiment, the video encoding method further includes the steps of:
[0169] The decoding thread obtains the closing instruction of the coding filter sent by the decoding end, and the coding filter in the turned-on state is closed according to the closing instruction, and the coding filter state is updated to the closed state; the backward video frame corresponding to the current video frame is obtained through the encoding thread, the backward video frame is encoded through the coding filter in the closed state, the target video code stream is obtained, and the target video code stream is sent to the decoding end.
[0170] The decoding thread refers to a thread used to obtain messages from the decoding end and set the encoding filter state. The encoding thread refers to a thread used to encode video frames.
[0171] Specifically, the encoding end includes at least two threads, one thread is a decoding thread, and the other thread is an encoding thread. Before a frame of image data starts to be encoded, the state of the encoder will be detected. If it is in the encoding and decoding accelerated code stream state, that is, the encoding filter is in the off state, the loop filtering process in the encoder will be directly skipped, and the encoded code stream does not need to perform the decoding process of the loop filtering when decoding. On the contrary, the loop filtering process will be executed during the encoding and decoding process. The state of the encoder is modified by an independent thread. This thread is also responsible for obtaining the message sent by the decoding end and setting the state of the encoder according to the content of the message. Before encoding the first frame, the encoder will be initialized to the encoding default type code stream state, which means that the encoding filter is in the on state, and then the state is modified according to the message sent by the decoding end.
[0172] In the above embodiment, the decoding thread obtains the closing instruction of the coding filter sent by the decoding end, and the coding filter in the turned-on state is closed according to the closing instruction, and the coding filter state is updated to the turned-off state. Then, the backward video frame corresponding to the current video frame is obtained through the encoding thread, and the backward video frame is encoded through the coding filter in the turned-off state to obtain the target video code stream, and the target video code stream is sent to the decoding end, that is, encoding and state update are performed through different threads, thereby improving the encoding efficiency of the encoding end.
[0173] In one embodiment, Fig. 9 As shown, the video encoding method further includes:
[0174] S902, obtaining a cloud game video encoding request, where the cloud game video encoding request carries a current cloud game video frame;
[0175] S904, obtain the encoding filter status based on the cloud game video encoding request. When the encoding filter status is in the on state, encode the current cloud game video frame through the on-state encoding filter to obtain the current cloud game video stream, and send the current cloud game video stream to the cloud game client.
[0176] Among them, the cloud game video encoding request refers to a request to encode the cloud game identification frame.
[0177] Specifically, when the cloud game server obtains a cloud game video encoding request when detecting that the cloud game client is running a cloud game, it can parse the cloud game video encoding request to carry the current cloud game video frame. At this time, the cloud game server first detects the encoding filter state. When the encoding filter state is in the on state, the current cloud game video frame is encoded by the encoding filter in the on state to obtain the current cloud game video stream, and the current cloud game video stream is sent to the cloud game client. When the encoding filter state is in the off state, the current cloud game video frame is encoded by the encoding filter in the off state to obtain the target cloud game video stream, and the target cloud game video stream is sent to the cloud game client.
[0178] S906, obtain the coding filter shutdown instruction, the shutdown instruction is that the cloud game client decodes the current cloud game video stream, obtains the current cloud game video frame, and obtains the reference decoding consumption parameters corresponding to the current cloud game video frame. It is sent when the reference decoding consumption parameters corresponding to the current cloud game video frame exceed the preset parameter threshold.
[0179] S908, shut down the coding filter that is in the turned-on state according to the shut-down instruction, and update the coding filter state to the turned-off state.
[0180] Specifically, when the cloud game server obtains the coding filter shutdown instruction sent by the cloud game client, it will shut down the coding filter that is in the turned-on state, and update the coding filter state to the turned-off state, so that the cloud game server skips the filtering process when performing subsequent video encoding. Among them, the shutdown instruction is sent when the cloud game client decodes the current cloud game video stream, obtains the current cloud game video frame, and obtains the reference decoding consumption parameters corresponding to the current cloud game video frame, and the reference decoding consumption parameters corresponding to the current cloud game video frame exceed the preset parameter threshold. That is, when the cloud game client detects that insufficient performance causes the cloud game video frame decoding time to increase, which is likely to cause cloud game freezes, it sends a coding filter shutdown instruction to the cloud game server.
[0181] S910, obtain the backward cloud game video frame corresponding to the current cloud game video frame, encode the backward cloud game video frame through the coding filter in the closed state, obtain the target cloud game video stream, and send the target cloud game video stream to the cloud game client.
[0182] Specifically, when the cloud game server encodes the backward cloud game video frame corresponding to the current cloud game video frame, it first detects the encoding filter state. If the encoding filter state is in the off state, the filtering process is skipped when encoding the backward cloud game video frame, thereby obtaining the target cloud game video stream, and sending the target cloud game video stream to the cloud game client. When the cloud game client decodes the target cloud game video stream, the filtering process is skipped, thereby increasing the decoding speed. The cloud game server can implement the steps of the video encoding method in any of the above embodiments.
[0183] In the above embodiment, when a closing instruction of the coding filter is obtained, the coding filter in the turned-on state is turned off according to the closing instruction, and the coding filter state is updated to the turned-off state, and then the backward cloud game video frame is encoded through the coding filter in the turned-off state to obtain the target cloud game video stream, and the target cloud game video stream is sent to the cloud game client, which improves the speed of cloud game decoding and prevents the cloud game from being stuck during operation.
[0184] In a specific embodiment, Fig.10 As shown, it is a flowchart of the video decoding method, specifically:
[0185] S1002, obtaining a current video code stream sent by the encoding end, where the current video code stream is a code stream obtained by encoding the current video frame through an encoding filter that is in an enabled state.
[0186] S1004, decode the current video code stream to obtain the current video frame, and obtain the historical number of decoded video frames, and increment based on the historical number of decoded video frames to obtain the current number of decoded video frames. When the current number of decoded video frames exceeds a preset number threshold, obtain the total decoded consumption parameter.
[0187] S1006, performing an average calculation based on the total parameters of the decoded messages and the current number of decoded video frames to obtain an average decoding consumption parameter, using the average decoding consumption parameter as a reference decoding consumption parameter, and restoring the current number of decoded video frames to an initial value.
[0188] S1008, when the reference decoding consumption parameter corresponding to the current video frame exceeds the preset parameter threshold, a coding filter closing instruction is sent to the encoder. The encoder receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction.
[0189] S1010, obtaining a target video code stream sent by the encoding end, where the target video code stream is a code stream obtained by encoding a backward video frame corresponding to the current video frame through a coding filter in a closed state, and decoding the target video code stream to obtain a target video frame.
[0190] S1012, obtaining the number of historically decoded video frames, and self-increasing based on the number of historically decoded video frames to obtain the current number of decoded video frames. When the current number of decoded video frames exceeds a preset number threshold, obtaining the total decoded consumption parameter.
[0191] S1014, performing an average calculation based on the total parameters of the decoded messages and the current number of decoded video frames to obtain an average decoding consumption parameter, using the average decoding consumption parameter as a reference decoding consumption parameter, and restoring the current number of decoded video frames to an initial value.
[0192] S1016, when the reference decoding consumption parameter corresponding to the target video frame is less than the preset target parameter threshold, a coding filter start instruction is sent to the encoding end. The encoding end receives the start instruction and turns on the coding filter that is in a closed state according to the start instruction. The preset target parameter threshold is less than the preset parameter threshold.
[0193] S1018, obtaining an updated video code stream sent by the encoding end, where the updated video code stream is a code stream obtained by encoding the backward video frame corresponding to the target video frame through the encoding filter in the turned-on state, and decoding the updated video code stream to obtain an updated video frame.
[0194] In a specific embodiment, the video decoding method can be applied in a real-time live broadcast scenario. Specifically: Fig.11As shown, it is an application environment diagram of a real-time live broadcast scene, wherein the live broadcast platform server 1104 forwards the live video code stream obtained from the live broadcast terminal 1102 to each audience terminal, including audience terminal a, audience terminal b, audience terminal c and audience terminal n, etc. Audience terminal a obtains the live video code stream, and the index video code rate is the code stream obtained after encoding by the coding filter in the open state. At this time, when the audience terminal a decodes the live video code stream, it is necessary to perform the process of loop filtering to obtain the live video frame, and then display the live video frame. When the audience terminal a detects that the number of decoded video frames reaches the number threshold, a performance test is performed. At this time, the audience terminal a can obtain the total time consumed by the decoded video frame when decoding, and then calculate the average decoding time of a single video frame, and finally compare the average decoding time with the preset decoding time threshold. When the average decoding time exceeds the preset decoding time threshold, it means that the audience terminal has spent more time decoding, and the audience terminal a has a problem of insufficient performance. At this time, in order to improve the decoding speed of the audience terminal, it is necessary to prevent the audience terminal a from decoding jam. At this time, the audience terminal a sends a closing instruction of the coding filter to the live broadcast terminal 1102 through the live broadcast platform server 1104. When the live broadcast terminal 1102 receives the closing instruction, it updates the state of the coding filter from the open state to the closed state. At this time, when the live broadcast terminal 1102 needs to encode the live video frame, it skips the process of loop filtering, and sends the obtained target video code stream to the audience terminal a through the live broadcast platform server 1104. When the audience terminal a decodes the target video code stream, it will skip the process of loop filtering and directly obtain the live video frame, thereby improving the decoding speed of the live video frame. Then, when the audience terminal a decodes the video frame of the preset number threshold, it will detect, and when the average decoding time is less than the normal decoding threshold value set in advance, it will send the opening instruction of the coding filter to the live broadcast terminal 1102 through the live broadcast server 1104, so that the code stream encoded by the loop filtering can be obtained from the live broadcast terminal, and the live video frame is obtained by decoding the loop filtering process, and the live broadcast display is performed, thereby ensuring the decoding speed of the audience terminal, avoiding the decoding jam at the audience terminal, and causing the problem of the live video being not smooth when being watched.
[0195] 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.
[0196] Based on the same inventive concept, the embodiment of the present application also provides a video decoding device for implementing the video decoding method and a video encoding device for implementing the video encoding method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more video decoding devices or video encoding devices provided below can refer to the limitations of the video decoding method or video encoding above, and will not be repeated here.
[0197] In one embodiment, Fig.12 As shown, a video decoding device 1200 is provided, including: a current code stream acquisition module 1202, a decoding module 1204, a consumption determination module 1206 and a target code stream acquisition module 1208, wherein:
[0198] The current code stream acquisition module 1202 is used to acquire the current video code stream sent by the encoding end. The current video code stream is a code stream obtained by encoding the current video frame through the coding filter in the turned-on state;
[0199] The decoding module 1204 is used to decode the current video code stream to obtain the current video frame and obtain the reference decoding consumption parameter corresponding to the current video frame, where the reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0200] The consumption judgment module 1206 is used to send a coding filter closing instruction to the encoder when the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold. The encoder receives the closing instruction and closes the coding filter in the open state according to the closing instruction.
[0201] The target bitstream acquisition module 1208 is used to acquire the target video bitstream sent by the encoding end, where the target video bitstream is the bitstream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in the closed state, and decode the target video bitstream to obtain the target video frame.
[0202] In one embodiment, the video decoding apparatus 1200 further includes:
[0203] The state opening module is used to obtain the reference decoding consumption parameter corresponding to the target video frame. When the reference decoding consumption parameter corresponding to the target video frame is less than the preset target parameter threshold, the opening instruction of the coding filter is sent to the encoding end. The encoding end receives the opening instruction and turns on the coding filter in the closed state according to the opening instruction. The preset target parameter threshold is less than the preset parameter threshold; the updated video code stream sent by the encoding end is obtained, the updated video code stream is the code stream obtained by encoding the backward video frame corresponding to the target video frame through the coding filter in the opened state, and the updated video code stream is decoded to obtain the updated video frame.
[0204] In one embodiment, the video decoding apparatus 1200 further includes:
[0205] The target decoding module is used to obtain the target encoded code stream obtained by the encoding end through the encoding filter in the closed state when the reference decoding consumption parameter corresponding to the target video frame is greater than or equal to the preset target parameter threshold, and decode the target encoded code stream to obtain a decoded video frame.
[0206] In one embodiment, the decoding module 1204 is also used to obtain the historical number of decoded video frames, and to increase the number of historical decoded video frames to obtain the current number of decoded video frames; when the current number of decoded video frames exceeds a preset number threshold, to obtain the total decoding consumption parameter; to perform an average calculation based on the total parameters of the decoded message and the current number of decoded video frames to obtain the average decoding consumption parameter, to use the average decoding consumption parameter as a reference decoding consumption parameter, and to restore the current number of decoded video frames to the initial value.
[0207] In one embodiment, the preset parameter threshold is calculated based on the decoding time of the preset video stream frame rate, and the total decoded consumption parameter includes the total decoded consumption time;
[0208] The decoding module 1204 is further used to calculate the ratio of the total decoding consumption time to the number of currently decoded video frames to obtain the average decoding consumption time, and use the average decoding consumption time as a reference decoding consumption parameter.
[0209] In one embodiment, the decoding module 1204 is also used to obtain a backward video stream corresponding to the current video stream when the current number of decoded video frames is less than or equal to a preset number threshold, and use the backward video rate as the current video stream; return to decode the current video stream, obtain the current video frame, and iteratively execute the steps of obtaining the reference decoding consumption parameter corresponding to the current video frame until the current number of decoded video frames exceeds the preset number threshold, and obtain the total decoded consumption parameter.
[0210] In one embodiment, the decoding module 1204 is also used to entropy decode the current video code stream to obtain entropy decoded image information; perform inverse quantization, inverse transformation and inverse prediction based on the entropy decoded image information to obtain a reconstructed image; and filter the reconstructed image to obtain the current video frame.
[0211] In one embodiment, the target bitstream acquisition module 1208 is further used to entropy decode the target video bitstream to obtain target entropy decoded image information; perform inverse quantization, inverse transformation and inverse prediction based on the target entropy decoded image information to obtain a target reconstructed image; and use the target reconstructed image as the target video frame.
[0212] In one embodiment, the video decoding apparatus 1200 further includes:
[0213] The cloud game decoding module is used to obtain the current cloud game video code stream sent by the cloud game server. The current cloud game video code stream is the code stream obtained by encoding the current cloud game video frame through the coding filter in the turned-on state; decode the current cloud game video code stream to obtain the current cloud game video frame, and display the current cloud game video frame; when the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds the preset parameter threshold, send a coding filter shutdown instruction to the cloud game server, and the cloud game server receives the shutdown instruction and shuts down the coding filter in the turned-on state according to the shutdown instruction; obtain the target cloud game video code stream sent by the cloud game server, the target cloud game video code stream is the code stream obtained by encoding the backward cloud game video frame corresponding to the current cloud game video frame through the coding filter in the turned-off state, and decode the target cloud game video code stream to obtain the target cloud game video frame, and display the target cloud game video frame.
[0214] In one embodiment, Fig.13 As shown, a video encoding device 1300 is provided, including: a request acquisition module 1302, a filter encoding module 1304, a closing instruction acquisition module 1306, a state update module 1308 and a backward encoding module 1310, wherein:
[0215] A request acquisition module 1302 is used to acquire a video encoding request, where the video encoding request carries a current video frame;
[0216] The filter encoding module 1304 is used to obtain the encoding filter state based on the video encoding request. When the encoding filter state is in the on state, the current video frame is encoded by the encoding filter in the on state to obtain the current video code stream, and the current video code stream is sent to the decoding end;
[0217] A closing instruction acquisition module 1306 is used to acquire a closing instruction of the coding filter. The closing instruction is that the decoding end decodes the current video code stream to obtain the current video frame and obtains the reference decoding consumption parameter corresponding to the current video frame. When the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, the reference decoding consumption parameter is sent. The reference decoding consumption parameter is used to characterize the resources consumed during decoding;
[0218] A state updating module 1308 is used to close the coding filter in the turned-on state according to the closing instruction, and update the coding filter state to the turned-off state;
[0219] The backward encoding module 1310 is used to obtain a backward video frame corresponding to the current video frame, encode the backward video frame through a coding filter in a closed state to obtain a target video code stream, and send the target video code stream to a decoding end.
[0220] In one embodiment, the video encoding apparatus 1300 further includes:
[0221] Obtaining a coding filter activation instruction sent by a decoding end, activating the coding filter in an OFF state according to the activation instruction, and updating the coding filter state to an OPEN state;
[0222] The state-on module is used to obtain the video frame to be encoded, encode the video frame to be encoded through the encoding filter in the enabled state, obtain the target encoding code stream, and send the target encoding code stream to the decoding end.
[0223] In one embodiment, the video encoding apparatus 1300 further includes:
[0224] The thread processing module is used to obtain the closing instruction of the coding filter sent by the decoding end through the decoding thread, close the coding filter in the turned-on state according to the closing instruction, and update the coding filter state to the turned-off state; obtain the backward video frame corresponding to the current video frame through the encoding thread, encode the backward video frame through the coding filter in the turned-off state, obtain the target video code stream, and send the target video code stream to the decoding end.
[0225] In one embodiment, the video encoding apparatus 1300 further includes:
[0226] A cloud game encoding module is used to obtain a cloud game video encoding request, which carries the current cloud game video frame; obtain the encoding filter state based on the cloud game video encoding request, and when the encoding filter state is in the on state, encode the current cloud game video frame through the encoding filter in the on state to obtain the current cloud game video stream, and send the current cloud game video stream to the cloud game client; obtain the closing instruction of the encoding filter, which is that the cloud game client decodes the current cloud game video stream to obtain the current cloud game video frame, and obtains the reference decoding consumption parameter corresponding to the current cloud game video frame, and is sent when the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds the preset parameter threshold; according to the closing instruction, the encoding filter in the on state is closed, and the encoding filter state is updated to the closed state; obtain the backward cloud game video frame corresponding to the current cloud game video frame, encode the backward cloud game video frame through the encoding filter in the off state, obtain the target cloud game video stream, and send the target cloud game video stream to the cloud game client.
[0227] Each module in the above video decoding and video encoding 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.
[0228] In one embodiment, a computer device is provided. The computer device may be a server. The server may be a decoding end or an encoding end. The internal structure diagram thereof may be as follows: Fig.14 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store video frame data, video code streams, decoding consumption parameters, etc. 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 through a network connection. When the computer program is executed by the processor, a video encoding method or a video decoding method is implemented.
[0229] In one embodiment, a computer device is provided. The computer device may be a terminal. The terminal may be a decoding terminal or an encoding terminal. The internal structure diagram thereof may be as follows: Fig.15 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, 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. Among them, 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, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a video decoding method or a video encoding method is implemented. The display unit of the computer device is used to form a visually visible image, and 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. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0230] Those skilled in the art will understand that Fig.14 or Fig.15 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.
[0231] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0232] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0233] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0234] 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 laws, regulations and standards of relevant countries and regions.
[0235] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods 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 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), magnetoresistive 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, etc., but are not limited to this.
[0236] 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 specification.
[0237] 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: Obtaining a current video code stream sent by the encoding end, wherein the current video code stream is a code stream obtained by encoding the current video frame through a coding filter in an enabled state; Decoding the current video code stream to obtain a current video frame, and obtaining a reference decoding consumption parameter corresponding to the current video frame, wherein the reference decoding consumption parameter is used to characterize resources consumed during decoding; When the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, sending a closing instruction of the coding filter to the coding end, and the coding end receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction; A target video code stream sent by the encoding end is obtained, where the target video code stream is a code stream obtained by encoding a backward video frame corresponding to the current video frame through a coding filter in a closed state, and the target video code stream is decoded to obtain a target video frame.
2. The method according to claim 1, characterized in that After decoding the target video code stream through the preset decoding loop filter in the closed state to obtain the target video frame, the method further includes: Acquire a reference decoding consumption parameter corresponding to the target video frame, and when the reference decoding consumption parameter corresponding to the target video frame is less than a preset target parameter threshold, send an opening instruction of the coding filter to the encoding end, and the encoding end receives the opening instruction, and opens the coding filter in a closed state according to the opening instruction, and the preset target parameter threshold is less than the preset parameter threshold; An updated video code stream sent by the encoding end is obtained, where the updated video code stream is a code stream obtained by encoding a backward video frame corresponding to the target video frame through an encoding filter in an enabled state, and the updated video code stream is decoded to obtain an updated video frame.
3. The method according to claim 2, characterized in that The method further comprises: When the reference decoding consumption parameter corresponding to the target video frame is greater than or equal to the preset target parameter threshold, the target encoded code stream obtained by the encoding end through the encoding filter in the closed state is obtained, and the target encoded code stream is decoded to obtain a decoded video frame.
4. The method according to claim 1, characterized in that: The obtaining the reference decoding consumption parameter corresponding to the current video frame includes: Obtain the number of historically decoded video frames, and increment the number of historically decoded video frames to obtain the number of currently decoded video frames; When the number of currently decoded video frames exceeds a preset number threshold, obtaining a total parameter consumed by decoding; An average calculation is performed based on the total parameters of the decoded messages and the current number of decoded video frames to obtain an average decoding consumption parameter, the average decoding consumption parameter is used as the reference decoding consumption parameter, and the current number of decoded video frames is restored to an initial value.
5. The method according to claim 4, characterized in that The preset parameter threshold is calculated based on the decoding time of the preset video stream frame rate, and the total decoded consumption parameter includes the total decoded consumption time; The performing an average calculation based on the total parameter of the decoded message and the number of currently decoded video frames to obtain an average decoding consumption parameter, and using the average decoding consumption parameter as the reference decoding consumption parameter, comprises: The ratio of the total decoding consumption time to the number of currently decoded video frames is calculated to obtain an average decoding consumption time, and the average decoding consumption time is used as the reference decoding consumption parameter.
6. The method according to claim 4, characterized in that When the number of currently decoded video frames exceeds a preset number threshold, obtaining a total parameter consumed by decoding includes: When the number of currently decoded video frames is less than or equal to a preset number threshold, obtaining a backward video code stream corresponding to the current video code stream, and using the backward video code rate as the current video code stream; The steps of returning to decoding the current video code stream to obtain the current video frame and obtaining the reference decoding consumption parameter corresponding to the current video frame are iteratively executed until the number of the current decoded video frames exceeds a preset number threshold, and the total decoded consumption parameter is obtained.
7. The method according to any one of claims 1 to 6, characterized in that: The decoding of the current video code stream to obtain a current video frame includes: Performing entropy decoding on the current video code stream to obtain entropy decoded image information; Perform inverse quantization, inverse transformation and inverse prediction based on the entropy decoded image information to obtain a reconstructed image; The reconstructed image is filtered to obtain a current video frame.
8. The method according to any one of claims 1 to 6, characterized in that: The decoding of the target video code stream to obtain a target video frame includes: Performing entropy decoding on the target video code stream to obtain target entropy decoded image information; Perform inverse quantization, inverse transformation and inverse prediction based on the target entropy decoded image information to obtain a target reconstructed image; The target reconstructed image is used as the target video frame.
9. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtain the current cloud game video code stream sent by the cloud game server, where the current cloud game video code stream is a code stream obtained by encoding the current cloud game video frame through an encoding filter in an enabled state; Decode the current cloud game video code stream to obtain the current cloud game video frame, and display the current cloud game video frame; When the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds a preset parameter threshold, a closing instruction of the coding filter is sent to the cloud game server, and the cloud game server receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction; Obtain a target cloud game video code stream sent by the cloud game server, where the target cloud game video code stream is a code stream obtained by encoding the backward cloud game video frame corresponding to the current cloud game video frame through a coding filter in a closed state, decode the target cloud game video code stream to obtain a target cloud game video frame, and display the target cloud game video frame.
10. A video encoding method, characterized in that: The method comprises: Obtain a video encoding request, where the video encoding request carries a current video frame; Acquire a coding filter state based on the video coding request, and when the coding filter state is in an on state, encode the current video frame through the coding filter in the on state to obtain a current video code stream, and send the current video code stream to a decoding end; Obtaining a closing instruction for the coding filter, wherein the closing instruction is that the decoding end decodes the current video code stream to obtain a current video frame, and obtains a reference decoding consumption parameter corresponding to the current video frame, and is sent when the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, and the reference decoding consumption parameter is used to characterize resources consumed during decoding; According to the closing instruction, the coding filter in the turned-on state is closed, and the coding filter state is updated to be in the turned-off state; A backward video frame corresponding to the current video frame is obtained, the backward video frame is encoded through a coding filter in a closed state to obtain a target video code stream, and the target video code stream is sent to the decoding end.
11. The method according to claim 10, characterized in that After acquiring the backward video frame corresponding to the current video frame, encoding the backward video frame through a coding filter in a closed state to obtain a target video code stream, and sending the target video code stream to the decoding end, the method further includes: Obtaining an enable instruction of the coding filter sent by the decoding end, enabling the coding filter in a disabled state according to the enable instruction, and updating the coding filter state to be in an enabled state; A video frame to be encoded is obtained, the video frame to be encoded is encoded through an encoding filter in an enabled state, a target encoding code stream is obtained, and the target encoding code stream is sent to the decoding end.
12. The method according to claim 11, characterized in that The method further comprises: Obtaining, through a decoding thread, a closing instruction of the coding filter sent by the decoding end, closing the coding filter in the turned-on state according to the closing instruction, and updating the coding filter state to be in the turned-off state; The backward video frame corresponding to the current video frame is obtained through the encoding thread, the backward video frame is encoded through the encoding filter in the closed state to obtain the target video code stream, and the target video code stream is sent to the decoding end.
13. The method according to any one of claims 10 to 12, characterized in that: The method further comprises: Obtain a cloud game video encoding request, where the cloud game video encoding request carries a current cloud game video frame; Based on the cloud game video encoding request, an encoding filter state is obtained. When the encoding filter state is in an on state, the current cloud game video frame is encoded by the encoding filter in the on state to obtain a current cloud game video stream, and the current cloud game video stream is sent to the cloud game client; Obtaining a closing instruction for the encoding filter, wherein the closing instruction is sent by the cloud game client when the cloud game client decodes the current cloud game video stream to obtain the current cloud game video frame and obtains the reference decoding consumption parameter corresponding to the current cloud game video frame and the reference decoding consumption parameter corresponding to the current cloud game video frame exceeds a preset parameter threshold; According to the closing instruction, the coding filter in the turned-on state is closed, and the coding filter state is updated to be in the turned-off state; Obtain a backward cloud game video frame corresponding to the current cloud game video frame, encode the backward cloud game video frame through a coding filter in a closed state, obtain a target cloud game video stream, and send the target cloud game video stream to the cloud game client.
14. A video decoding device, characterized in that: The device comprises: A current code stream acquisition module is used to acquire a current video code stream sent by the encoding end, wherein the current video code stream is a code stream obtained by encoding the current video frame through an encoding filter in an enabled state; A decoding module, used to decode the current video code stream to obtain a current video frame, and obtain a reference decoding consumption parameter corresponding to the current video frame, wherein the reference decoding consumption parameter is used to characterize the resources consumed during decoding; a consumption judgment module, configured to send a closing instruction of the coding filter to the coding end when the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, and the coding end receives the closing instruction and closes the coding filter in the turned-on state according to the closing instruction; The target code stream acquisition module is used to acquire the target video code stream sent by the encoding end, wherein the target video code stream is a code stream obtained by encoding the backward video frame corresponding to the current video frame through the coding filter in a closed state, and decode the target video code stream to obtain the target video frame.
15. A video encoding device, characterized in that: The device comprises: A request acquisition module, used to acquire a video encoding request, wherein the video encoding request carries a current video frame; A filter encoding module, configured to obtain an encoding filter state based on the video encoding request, and when the encoding filter state is in an on state, encode the current video frame through the encoding filter in the on state to obtain a current video code stream, and send the current video code stream to a decoding end; A closing instruction acquisition module, used to acquire a closing instruction of the coding filter, wherein the closing instruction is that the decoding end decodes the current video code stream to obtain a current video frame, and acquires a reference decoding consumption parameter corresponding to the current video frame, and is sent when the reference decoding consumption parameter corresponding to the current video frame exceeds a preset parameter threshold, and the reference decoding consumption parameter is used to characterize the resources consumed during decoding; A state updating module, used for shutting down the coding filter in the turned-on state according to the shut-down instruction, and updating the coding filter state to the turned-off state; The backward encoding module is used to obtain a backward video frame corresponding to the current video frame, encode the backward video frame through a coding filter in a closed state to obtain a target video code stream, and send the target video code stream to the decoding end.
16. 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 13 are implemented.
17. 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 13 are implemented.
18. 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 13 are implemented.