Video decoding method and device, video coding method and device, equipment and storage medium
By classifying the displacement vectors in the historical motion information list and generating a candidate displacement vector list, the problem of high video decoding complexity is solved and the decoding and encoding efficiency is improved.
Patent Information
- Application Number
- CN202410900471.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2024-10-08
AI Technical Summary
In the existing technology, during the video decoding process, one displacement vector may correspond to multiple types, resulting in high decoding complexity and increased computational burden.
During the video decoding and encoding process, the displacement vectors in the historical motion information list are classified. If the decoded or encoded block meets the conditions of multiple classes, it is classified into one class and the classification is stopped to generate a candidate displacement vector list. , avoid duplicate checking operations and reduce decoding complexity.
Through this method, the situation of displacement vectors being classified into multiple classes is avoided, the generation of candidate displacement vector lists is simplified, the efficiency of video decoding and encoding is improved, and the complexity is reduced.
Smart Images

Figure CN118748720A_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese patent application with application number 202010794517.8 filed on August 10, 2020 and invention name “Video decoding method, video encoding method, device, equipment and storage medium”. Technical Field
[0002] The present application relates to the field of video processing, and in particular to a video decoding method, a video encoding method, an apparatus, a computer device, and a storage medium. Background Art
[0003] With the development of network technology, more and more users watch videos through various terminals. Due to the limitation of network bandwidth, the videos obtained by the terminal are often compressed, that is, encoded videos. Therefore, when the terminal plays the video, it needs to decode the video.
[0004] In the related art, when a terminal decodes a video, it is necessary to classify the displacement vectors corresponding to the to-be-decoded blocks, and decode the to-be-decoded blocks based on the classified displacement vectors. However, a displacement vector may correspond to multiple types, resulting in high decoding complexity. Summary of the invention
[0005] The embodiments of the present application provide a video decoding method, a video encoding method, an apparatus, a computer device, and a storage medium, which can reduce the complexity of decoding. The technical solution is as follows:
[0006] On the one hand, a video decoding method is provided, the method comprising:
[0007] During video decoding, the displacement vectors of decoded blocks in the historical motion information list are classified;
[0008] During classification, if the decoded block meets the classification condition of any one of the multiple classes, the displacement vector of the decoded block is added to the any one class, and the classification of the displacement vector of the decoded block is stopped.
[0009] In a possible implementation, the method further includes:
[0010] During classification, if the decoded block satisfies the classification condition of any one of the multiple classes, and any displacement vector exists in any one of the classes, the displacement vector of the decoded block is not classified into any one of the classes.
[0011] In one aspect, a video encoding method is provided, the method comprising:
[0012] During video encoding, the displacement vectors of the encoded blocks in the historical motion information list are classified;
[0013] During classification, if the encoded block meets the classification condition of any one of the multiple classes, the displacement vector of the encoded block is added to the any one class, and the classification of the displacement vector of the encoded block is stopped.
[0014] In a possible implementation, the method further includes:
[0015] During classification, if the encoded block meets the classification conditions of any one of the multiple classes, and there is any displacement vector in any one of the classes, the displacement vector corresponding to the encoded block is not classified into any one of the classes.
[0016] In a possible implementation manner, generating a candidate displacement vector list according to the classified displacement vectors includes any of the following:
[0017] In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating the candidate displacement vector list according to displacement vectors included in other classes in the plurality of classes except the class;
[0018] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, adding the first displacement vector to the class, and generating the candidate displacement vector list based on the displacement vectors in the plurality of classes;
[0019] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding a second displacement vector of an encoded block adjacent to the position of the block to be encoded to the candidate displacement vector list;
[0020] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding a third displacement vector of an encoded block that is not adjacent to the position of the block to be encoded to the candidate displacement vector list;
[0021] In response to the presence of a class that does not contain any displacement vector in the multiple classes, adding the displacement vector of the encoded block in the historical motion information list that is adjacent to the block to be encoded in encoding order to the candidate displacement vector list;
[0022] In response to the presence of a class in the plurality of classes that does not include any displacement vector, the displacement vector of the target position in the historical motion information list is added to the candidate displacement vector list.
[0023] In a possible implementation, in response to the presence of a class in the multiple classes that does not include any displacement vector, adding the first displacement vector to the candidate displacement vector list includes:
[0024] In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating a first displacement vector list according to the plurality of first displacement vectors;
[0025] A first displacement vector corresponding to the class is determined from the first displacement vector list, and the first displacement vector corresponding to the class is added to the candidate displacement vector list.
[0026] In a possible implementation manner, in response to the presence of a class that does not include any displacement vector in the multiple classes, adding a second displacement vector of an encoded block adjacent to a position of the block to be encoded to the candidate displacement vector list includes:
[0027] In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating a second displacement vector list according to second displacement vectors of a plurality of encoded blocks adjacent to the position of the block to be encoded;
[0028] A second displacement vector corresponding to the class is determined from the second displacement vector list, and the second displacement vector corresponding to the class is added to the candidate displacement vector list.
[0029] In a possible implementation manner, before adding the displacement vector of the encoded block adjacent to the position of the block to be encoded to the candidate displacement vector list, the method further includes:
[0030] In response to the coded blocks adjacent to the position of the block to be coded not corresponding to any displacement vector, a fourth displacement vector is added to the candidate displacement vector list.
[0031] In a possible implementation, a target displacement vector corresponding to the block to be encoded is determined from a list of candidate displacement vectors.
[0032] In a possible implementation, determining the target displacement vector corresponding to the block to be encoded from the candidate displacement vector list includes: determining rate-distortion parameters of multiple displacement vectors in the candidate displacement vector list; and determining the displacement vector with the smallest rate-distortion parameter as the target displacement vector corresponding to the block to be encoded.
[0033] In a possible implementation, the classification condition includes at least one of the following:
[0034] The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
[0035] In one aspect, a video decoding device is provided, the device comprising:
[0036] The first classification module is used to classify the displacement vectors of the decoded blocks in the historical motion information list during the video decoding process; during classification, if the decoded block meets the classification conditions of any one of multiple classes, the displacement vector of the decoded block is added to any one of the classes, and the classification of the displacement vector of the decoded block is stopped.
[0037] In a possible implementation, the first classification module is further used for, during classification, if the decoded block meets the classification conditions of any one of multiple classes and there is any displacement vector in any one of the classes, not classifying the displacement vector of the decoded block into any of the classes.
[0038] In a possible implementation manner, the first classification module is further configured to add the index of the displacement vector of the decoded block in the historical motion information list to any one of the multiple classes if the decoded block meets the classification condition of the any one of the multiple classes.
[0039] In a possible implementation, the device further includes:
[0040] The first candidate displacement vector list generating module is used to generate a candidate displacement vector list according to the classified displacement vectors, and one block to be decoded corresponds to one candidate displacement vector list.
[0041] In a possible implementation manner, the first candidate displacement vector list generating module is configured to perform any of the following:
[0042] In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating the candidate displacement vector list according to displacement vectors included in other classes in the plurality of classes except the class;
[0043] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding the first displacement vector to the candidate displacement vector list;
[0044] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, adding a second displacement vector of a decoded block adjacent to the position of the block to be decoded to the candidate displacement vector list;
[0045] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding a third displacement vector of a decoded block that is not adjacent to the position of the block to be decoded to the candidate displacement vector list;
[0046] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding the displacement vectors of decoded blocks in the historical motion information list that are adjacent to the block to be decoded in decoding order to the candidate displacement vector list;
[0047] In response to the presence of a class in the plurality of classes that does not include any displacement vector, the displacement vector of the target position in the historical motion information list is added to the candidate displacement vector list.
[0048] In a possible implementation, the first candidate displacement vector list generating module is used to generate a first displacement vector list based on multiple first displacement vectors in response to the presence of a class in the multiple classes that does not contain any displacement vector; determine the first displacement vector corresponding to the class from the first displacement vector list, and add the first displacement vector corresponding to the class to the candidate displacement vector list.
[0049] In a possible implementation, the first candidate displacement vector list generating module is used to generate a second displacement vector list based on second displacement vectors of multiple decoded blocks adjacent to the position of the block to be decoded in response to the presence of a class in the multiple classes that does not contain any displacement vector; determine the second displacement vector corresponding to the class from the second displacement vector list, and add the second displacement vector corresponding to the class to the candidate displacement vector list.
[0050] In a possible implementation, the first candidate displacement vector list generating module is further configured to add a fourth displacement vector to the candidate displacement vector list in response to a decoded block adjacent to the position of the block to be decoded not corresponding to any displacement vector.
[0051] In a possible implementation, the device further includes:
[0052] The first target displacement vector determination module is used to determine the target displacement vector corresponding to the block to be decoded in the candidate displacement vector list according to the index of the block to be decoded;
[0053] A decoding module is used to decode the block to be decoded according to the target displacement vector.
[0054] In a possible implementation, the classification condition includes at least one of the following:
[0055] The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
[0056] In one aspect, a video encoding apparatus is provided, the apparatus comprising:
[0057] The second classification module is used to classify the displacement vectors of the encoded blocks in the historical motion information list during the video encoding process; during classification, if the encoded block meets the classification conditions of any one of multiple classes, the displacement vector of the encoded block is added to any one of the classes and the classification of the displacement vector of the encoded block is stopped.
[0058] In a possible implementation, the second classification module is further used to, during classification, if the encoded block meets the classification conditions of any one of multiple classes, and there is any displacement vector in any of the classes, not classify the displacement vector corresponding to the encoded block into any of the classes.
[0059] In a possible implementation, the second classification module is configured to add the index of the displacement vector of the encoded block in the historical motion information list to any one of the multiple classes if the encoded block meets the classification condition of the any one of the multiple classes.
[0060] In a possible implementation, the device further includes:
[0061] A second candidate displacement vector list generating module, used to generate a candidate displacement vector list according to the classified displacement vectors, wherein one candidate displacement vector list corresponds to one block to be encoded;
[0062] A second target displacement vector determination module, configured to determine a target displacement vector corresponding to the block to be encoded from the candidate displacement vector list;
[0063] The encoding module is used to encode the block to be encoded according to the target displacement vector, and generate an index of the block to be encoded according to the order of the target displacement vector in the candidate displacement vector list.
[0064] In a possible implementation manner, the second candidate displacement vector list generating module is configured to perform any of the following:
[0065] In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating the candidate displacement vector list according to displacement vectors included in other classes in the plurality of classes except the class;
[0066] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding the first displacement vector to the candidate displacement vector list;
[0067] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding a second displacement vector of an encoded block adjacent to the position of the block to be encoded to the candidate displacement vector list;
[0068] In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding a third displacement vector of an encoded block that is not adjacent to the position of the block to be encoded to the candidate displacement vector list;
[0069] In response to the presence of a class that does not contain any displacement vector in the multiple classes, adding the displacement vector of the encoded block in the historical motion information list that is adjacent to the block to be encoded in encoding order to the candidate displacement vector list;
[0070] In response to the presence of a class in the plurality of classes that does not include any displacement vector, the displacement vector of the target position in the historical motion information list is added to the candidate displacement vector list.
[0071] In a possible implementation, the second candidate displacement vector list generating module is used to generate a first displacement vector list based on multiple first displacement vectors in response to the presence of a class in the multiple classes that does not contain any displacement vector; determine the first displacement vector corresponding to the class from the first displacement vector list, and add the first displacement vector corresponding to the class to the candidate displacement vector list.
[0072] In a possible implementation, the second candidate displacement vector list generating module is used to generate a second displacement vector list according to the second displacement vectors of multiple encoded blocks adjacent to the position of the block to be encoded in response to the presence of a class in the multiple classes that does not contain any displacement vector; determine the second displacement vector corresponding to the class from the second displacement vector list, and add the second displacement vector corresponding to the class to the candidate displacement vector list.
[0073] In a possible implementation, the second candidate displacement vector list generating module is further configured to add a fourth displacement vector to the candidate displacement vector list in response to an encoded block adjacent to the position of the block to be encoded not corresponding to any displacement vector.
[0074] In a possible implementation, the second target displacement vector determination module is used to determine rate-distortion parameters of multiple displacement vectors in the candidate displacement vector list; and determine the displacement vector with the smallest rate-distortion parameter as the target displacement vector corresponding to the block to be encoded.
[0075] In a possible implementation, the classification condition includes at least one of the following:
[0076] The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
[0077] On the one hand, a computer device is provided, which includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the program code is loaded and executed by the one or more processors to implement the video decoding method or the video encoding method.
[0078] On the one hand, a computer-readable storage medium is provided, wherein at least one program code is stored in the computer-readable storage medium, and the program code is loaded and executed by a processor to implement the video decoding method or the video encoding method.
[0079] On the one hand, a computer program product or a computer program is provided, which includes a computer program code, and the computer program code is stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device performs the above-mentioned video decoding method or the above-mentioned video encoding method.
[0080] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the decoding end, once a displacement vector is classified into a class, the decoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video decoding and improving the efficiency of video decoding. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0082] Figure 1 is a schematic diagram of a motion vector provided in an embodiment of the present application;
[0083] Figure 2 It is a block vector schematic diagram provided in an embodiment of the present application;
[0084] Figure 3 It is a schematic diagram of a string vector provided in an embodiment of the present application;
[0085] Figure 4 It is a schematic diagram of an implementation environment of a video decoding method provided in an embodiment of the present application;
[0086] Figure 5 is a flowchart of a video decoding method provided by an embodiment of the present application;
[0087] Figure 6 is a flowchart of a video encoding method provided by an embodiment of the present application;
[0088] Figure 7 is a flowchart of a video decoding method provided by an embodiment of the present application;
[0089] Figure 8 This is a schematic diagram of the relative positions of a block to be decoded and a decoded block provided in an embodiment of the present application;
[0090] Fig. 9 This is a schematic diagram of the relative positions of a block to be decoded and a decoded block provided in an embodiment of the present application;
[0091] Fig.10 is a flowchart of a video encoding method provided by an embodiment of the present application;
[0092] Fig.11 is a structural diagram of a video decoding device provided in an embodiment of the present application;
[0093] Fig.12 is a structural diagram of a video encoding device provided in an embodiment of the present application;
[0094] Fig.13 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0095] Fig.14 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0096] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0097] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with basically the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order.
[0098] In the present application, the term "at least one" means one or more, and the meaning of "multiple" means two or more. For example, multiple blocks to be encoded means two or more blocks to be encoded.
[0099] First, the nouns involved in this application are introduced as follows:
[0100] Motion compensation: Motion compensation is a commonly used prediction method for video coding. Motion compensation is based on the redundant characteristics of video content in the time domain or spatial domain. The predicted value of the displacement vector of the block to be coded is derived according to the coded block. During the encoding process, the pixel value of the coded block can be used to replace the pixel value of the block to be coded, and the displacement vector of the block to be coded can be recorded, so as to realize the encoding of the block to be coded.
[0101] Motion compensation is divided into: inter-frame prediction, intra-frame block copy prediction, and intra-frame string copy prediction. During the encoding process, these prediction methods may be used alone or in combination.
[0102] For inter-frame prediction, the displacement vector is called a motion vector (MV) or a displacement vector. Inter-frame prediction uses the correlation of video content in the time domain and uses the pixels of adjacent coded blocks to predict the pixels of the block to be coded, so as to effectively remove the temporal redundancy of the video. Figure 1 , 101 is the frame to be encoded, 102 is the reference frame, coding block 1011 is the block to be encoded, and coding block 1021 is the reference block of coding block 1011. Coding block 1022 has the same coordinates as coding block 1011 in the image, and the coordinates of coding block 1021 are (x r ,y r ), the coordinates of coding block 1022 are (x, y). The displacement between coding block 1021 and coding block 1022 is also called motion vector, that is, MV = (x r -x,y r -y).
[0103] For intra block copy prediction (IBC), the displacement vector is called a block vector (BV). IBC uses the spatial correlation of video content to predict the pixels of the block to be coded using the pixels of the coded blocks on the current image, which can effectively save the bits required for coding pixels. Figure 3 As shown in Figure 1, the displacement between the current coding block and its reference block in IBC is called a block vector (BV). H.266 / VVC uses a BV prediction technique similar to inter-frame prediction to further save the bits required to encode BV. Figure 2 , 201 is the current frame, 2011 is the block to be encoded, 2012 is the encoded block, 2013 is the encoded area, 2014 is the area to be encoded, and 2015 is the block vector.
[0104] For Intra String Copy (ISC), the displacement vector is called a string vector (SV). According to a certain scanning order (raster scan, round-trip scan, Zig-Zag scan, etc.), a coding block is divided into a series of pixel strings or unmatched pixels. Similar to IBC, each string to be coded searches for a coded string of the same shape in the coded area of the current image, and derives the predicted value of the current string, which can effectively save bits. See Figure 3 , area 301 is the encoded area, 28 white pixels are the string to be encoded 302, 35 gray pixels are the string to be encoded 303, 1 black pixel represents the unmatched pixel 304, 305 is the encoded string corresponding to the string to be encoded 302, 306 is the encoded string corresponding to the string to be encoded 303, 307 is the string vector between the string to be encoded 302 and the encoded string 305, and 308 is the string vector between the string to be encoded 303 and the encoded string 306.
[0105] The video encoding method and the video decoding method provided in the present application can be used in the context of various video coding standards, such as the Versatile Video Coding (VVC / H.266) standard, and can also be used in the third-generation digital video coding and decoding technology standard (Audio Video Coding Standard 3, AVS3), which is not limited in the embodiments of the present application.
[0106] Figure 4 is a schematic diagram of an implementation environment of a video encoding method provided in an embodiment of the present application, see Figure 4 , the implementation environment may include a first terminal 410, a second terminal 420 and a server 440.
[0107] Optionally, the first terminal 410 can be connected to the second terminal 420 via a wireless network or a wired network, and the first terminal and the second terminal are smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, etc., but are not limited to this. An application that supports video encoding is installed and run on the first terminal 410, and the first terminal 410 can also be called an encoding end. An application that supports video decoding is installed and run on the second terminal 420, and the second terminal 420 can also be called a decoding end. After the first terminal 410 encodes the video, it can send the encoded video to the second terminal 420, and the second terminal can decode the encoded video.
[0108] In a possible implementation manner, the first terminal 410 and the second terminal 420 are both terminals capable of both encoding and decoding, which is not limited in this embodiment of the present application.
[0109] Optionally, the first terminal 410 and the second terminal 420 can be connected to the server 440 via a wireless network or a wired network. The first terminal 410 can encode the video and send it to the server 440, and the server 440 sends the encoded video to the second terminal 420, and the second terminal can decode the encoded video.
[0110] Optionally, server 440 is an independent physical server, or a server cluster or distributed system composed 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, distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0111] Of course, the server 440 can also directly encode the video and send the encoded video to the first terminal 410 or the second terminal 420, which is not limited in this embodiment of the present application.
[0112] In order to more clearly describe the video encoding method and the video decoding method provided in the present application, the application scenarios of the video encoding method and the video decoding method provided in the present application are first introduced.
[0113] In a possible implementation, the technical solution provided by the present application can be applied in a local video scenario, where the video author encodes the video through an encoding end and sends the encoded video to a decoding end, and the decoding end can decode the encoded video for users using the decoding end to watch the video. After the video author encodes the video at the encoding end, the encoded video can be sent to the decoding end through a network connection, or the encoded video can be transmitted to the decoding end through a storage medium, such as a compact disc read-only memory (CD-ROM), a high-density digital video disc (DVD) and a storage stick. The embodiments of the present application are not limited to this.
[0114] In a possible implementation, the technical solution provided by the present application can be applied to the process of online video playback. After the video author encodes the video through the encoding end, the encoding end can upload the encoded video to the server, and the server can send the encoded video to the decoding end, and the decoding end can decode the encoded video for users using the decoding end to watch the video.
[0115] In a possible implementation, the technical solution provided by the present application can be applied to the scene of video calls, such as the scene of online conferences. Taking the online conference as a meeting between two users as an example, the two users use terminals that can perform both video encoding and video decoding to conduct an online conference, wherein one terminal can collect video images, encode the collected video images, send the encoded video images to the server, and the server transmits the encoded video images to another terminal, and the other terminal can decode the encoded video images, and the user of the other terminal can see the video images. Of course, the other terminal can also collect video images, and encode the video images and send them to the server, which is forwarded by the server, so that an online conference between two users can be realized. Of course, based on the above description, it can also be expanded to an online conference between multiple users, and the embodiments of the present application are not limited to this.
[0116] In a possible implementation, the technical solution provided by the present application can be applied to a live broadcast scenario. The anchor collects video images through the encoding end, the encoding end encodes the collected video images, transmits the encoded video images to the server, and the server sends the encoded video images to the decoding end used by the audience, or the server decodes the encoded video images, encodes the video images according to different bit rates, and then sends them to the decoding end used by the audience. The embodiments of the present application are not limited to this.
[0117] It should be noted that in the following description of the technical solution provided by the present application, the terminal is used as an example of the execution subject. In other possible implementations, the server can also be used as the execution subject to execute the technical solution provided by the present application, and the embodiment of the present application does not limit the type of the execution subject.
[0118] Figure 5 is a flowchart of a video decoding method provided in an embodiment of the present application, see Figure 5 , methods include:
[0119] 501. During the video decoding process, the decoding end classifies the displacement vectors of the decoded blocks in the historical motion information list. During the classification, if the decoded blocks meet the classification conditions of any one of the multiple classes, the displacement vectors of the decoded blocks are added to the class.
[0120] Among them, the historical motion information list can also be called a history-based motion vector prediction list (Historybased Motion Vector Prediction, HMVP). The historical motion information list not only stores the displacement vectors of the decoded blocks, but also stores auxiliary information for classifying the displacement vectors. The auxiliary information includes the size information, position information and the number of times the displacement vector of the decoded block is reused.
[0121] 502. The decoding end stops classifying the displacement vectors of the decoded blocks.
[0122] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the decoding end, once a displacement vector is classified into a class, the decoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video decoding and improving the efficiency of video decoding.
[0123] Figure 6 is a flowchart of a video decoding method provided in an embodiment of the present application, see Figure 6 , methods include:
[0124] 601. During the video encoding process, the encoder classifies the displacement vectors of the encoded blocks in the historical motion information list. During the classification, if the encoded blocks meet the classification conditions of any one of the multiple classes, the displacement vectors of the encoded blocks are added to the class.
[0125] 602. The encoder stops classifying the displacement vectors of the encoded blocks.
[0126] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the encoding end, once a displacement vector is classified into a class, the encoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video encoding and improving the efficiency of video encoding.
[0127] The above steps 501-502 and steps 601-602 are brief descriptions of the technical solution provided by the present application. The technical solution provided by the present application will be described in detail with reference to some examples. Since the video decoding method and the video encoding method provided by the present application belong to the same inventive concept, in the following description, the video decoding method is first described. In the description process, for ease of understanding, the number of blocks to be decoded is one as an example. In the decoding process, multiple blocks to be decoded can be decoded, and the method for decoding multiple blocks to be decoded is the same as the process of decoding one block to be decoded.
[0128] Figure 7 is a flowchart of a video decoding method provided in an embodiment of the present application, see Figure 7 , methods include:
[0129] 701. During the video decoding process, the decoding end classifies the displacement vectors of the decoded blocks in the historical motion information list. During the classification, if the decoded blocks meet the classification conditions of any one of the multiple classes, the displacement vectors of the decoded blocks are added to the class.
[0130] The historical motion information list is a list of limited length. When the historical motion information list is filled and a new displacement vector is to be added to the historical motion information list, the displacement vector that first enters the historical motion information list will be removed to leave space for the new displacement vector. This storage method is called First Input First Output (FIFO). The length of the historical motion information list is related to the video decoding standard, such as 6, 8 or 12. Of course, as the video decoding standard is updated, the length of the historical motion information list will also be updated, and the embodiments of the present application do not limit this.
[0131] In addition, the displacement vectors stored in the historical motion information list correspond to different serial numbers. Optionally, the length of the historical motion information list is 3, then the displacement vectors stored in the historical motion information list correspond to serial numbers 0, 1 and 2 respectively. In the subsequent process of classifying the displacement vectors, the decoding end can classify the displacement vectors in positive order, that is, the order of 0→1→2, and can also classify the displacement vectors in reverse order, that is, the order of 2→1→0. The embodiments of the present application are not limited to this.
[0132] In a possible implementation, the decoding end can classify the displacement vector of the decoded block according to the auxiliary information of the decoded block stored in the historical motion information list. During the classification, the decoding end can compare the auxiliary information of the decoded block with the classification conditions of multiple classes, and in response to the auxiliary information of the decoded block satisfying the classification condition of any one of the multiple classes, the decoding end adds the displacement vector of the decoded block to the class.
[0133] In addition, before adding the displacement vector of the decoded block to the class, the decoding end can also determine whether there is a displacement vector identical to the displacement vector of the decoded block in the historical motion information list. In response to the presence of a displacement vector identical to the displacement vector of the decoded block in the historical motion information list, for example, the displacement vector identical to the displacement vector of the decoded block is recorded as A, the terminal removes the displacement vector A from the historical motion information list, adds the displacement vector of the decoded block to the historical motion information list, and increases the number of times the displacement vector of the decoded block is used by +1.
[0134] The following describes a method for classifying the displacement vector of the decoded block based on auxiliary information at the decoding end, taking the classification conditions that the size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition as an example.
[0135] First, based on the above classification conditions, 7 categories are set, and the classification conditions of the 7 categories are:
[0136] Class 0: The area of the decoded block is greater than or equal to 64 pixels;
[0137] Category 1: The number of times BV is used is greater than or equal to 2;
[0138] Category 2: The coordinates of the upper left corner of the decoded block are to the left of the coordinates of the upper left corner of the block to be decoded;
[0139] Category 3: The coordinates of the upper left corner of the decoded block are above the coordinates of the upper left corner of the block to be decoded;
[0140] Category 4: The coordinates of the upper left corner of the decoded block are located to the upper left of the coordinates of the upper left corner of the block to be decoded;
[0141] Category 5: The coordinates of the upper left corner of the decoded block are located to the upper right of the coordinates of the upper left corner of the block to be decoded;
[0142] Category 6: The coordinates of the upper left corner of the decoded block are below and to the left of the coordinates of the upper left corner of the block to be decoded.
[0143] The serial number of each class is the matching order when the decoder classifies the displacement vector of the decoded block based on the auxiliary information, that is, in the classification process, the decoder first compares the auxiliary information of the decoded block with the classification condition of class 0. If the auxiliary information of the decoded block does not meet the classification condition of class 0, the decoder compares the auxiliary information of the decoded block with the classification condition of class 1, and so on.
[0144] It should be noted that the classification conditions corresponding to the above-mentioned classes 0 to 6 are provided for example only. With the update of the video decoding standard, the number of classes and the classification conditions corresponding to the classes can be updated accordingly.
[0145] In addition, each class corresponds to a list for storing displacement vectors. In response to determining that the displacement vector of a decoded block belongs to any class, the decoding end can add the displacement vector of the decoded block to the list corresponding to the class. When the decoding end fills the displacement vector into the list corresponding to the class, it can also number the displacement vectors in the list. The decoding end determines the sequence number of the displacement vector that has recently entered the list as 1. For example, there is only one displacement vector A in the list, and the sequence number of displacement vector A in the list is 1. When the decoding end fills the displacement vector B into the list, the decoding end can set the sequence number of displacement vector B to 1 and change the sequence number of displacement vector A to 2. In the list corresponding to each class, the displacement vector with sequence number 1 is the candidate displacement vector corresponding to the class, and the candidate displacement vector is also the displacement vector used when the candidate displacement vector list is generated later.
[0146] Of course, the list for storing displacement vectors corresponding to each class can also store only the most recently added displacement vectors, that is, in the list for storing displacement vectors corresponding to each class, only the most recently added displacement vectors that meet the classification conditions are recorded. For example, if there is a displacement vector C that meets the classification conditions in the list, when a new displacement vector D that meets the classification conditions enters the list, the decoding end can delete the displacement vector C from the list and only store the displacement vector D.
[0147] After setting the classes and the classification conditions corresponding to the classes, the decoder can classify the displacement vectors of the decoded blocks according to the auxiliary information of the decoded blocks, which will be explained below with several examples:
[0148] Taking class 0 as an example, when the displacement vector and auxiliary information of decoded block A enter the historical motion information list, the decoder determines the size information of decoded block A from the historical motion information list, such as 4×4, that is, the area of decoded block A is 16 pixels. Since 16 pixels are less than 64 pixels, the decoder determines that decoded block A does not meet the classification conditions of class 0, and decoded block A cannot be classified into class 0. When the displacement vector and auxiliary information of decoded block B enter the historical motion information list, the decoder can determine the size information of decoded block B from the historical motion information list, such as 8×8, that is, the area of decoded block B is 64 pixels. The decoder determines that decoded block B meets the classification conditions of class 0, adds the displacement vector of decoded block B to the list corresponding to class 0, and sets the sequence number of the displacement vector of decoded block B to 1 in the list corresponding to class 0.
[0149] Taking class 1 as an example, when the displacement vector and auxiliary information of the decoded block C enter the historical motion information list, the decoder determines the number of times the displacement vector of the decoded block C is used from the historical motion information list, for example, if it is 1, the decoder can determine that the decoded block C does not meet the classification conditions of class 1, and the decoded block C cannot be classified into class 1. When the displacement vector of the decoded block D enters the historical motion information list, the decoder determines the number of times the displacement vector of the decoded block D is used from the historical motion information list, for example, if it is 3, the decoder can determine that the decoded block D meets the classification conditions of class 1, adds the decoded block D to the class table corresponding to class 1, and sets the sequence number of the displacement vector of the decoded block D to 1 in the list corresponding to class 1.
[0150] Taking class 2 as an example, when the displacement vector and auxiliary information of the decoded block E enter the historical motion information list, the decoder determines the coordinates of the upper left corner of the decoded block E from the historical motion information list, such as (1, 2). If the coordinates of the upper left corner of the block to be decoded are (0, 2), refer to Figure 8 , since the coordinates of the upper left corner of the decoded block E are located to the right of the coordinates of the upper left corner of the block to be decoded, the decoder determines that the decoded block E does not meet the classification conditions of class 2, and the decoded block E cannot be classified into class 2. When the displacement vector of the decoded block F enters the historical motion information list, the decoder determines the coordinates of the upper left corner of the decoded block F from the historical motion information list, for example (3, 2). If the coordinates of the upper left corner of the block to be decoded are (2, 2), refer to Figure 8 , since the coordinates of the upper left corner of the decoded block F are located to the left of the coordinates of the upper left corner of the block to be decoded, the decoding end determines that the decoded block F meets the classification conditions of class 2, adds the decoded block F to the class table corresponding to class 2, and sets the sequence number of the displacement vector of the decoded block F to 1 in the list corresponding to class 2.
[0151] It should be noted that the classification method of categories 3 to 6 belongs to the same inventive concept as that of category 2 and will not be elaborated here.
[0152] In a possible implementation, during classification, if a decoded block satisfies the classification condition of any one of multiple classes and there is any displacement vector in the class, the decoding end may not classify the displacement vector corresponding to the decoded block into the class.
[0153] Under this implementation, the decoding end can ensure that there is at most one displacement vector under each class, which can reduce the storage space occupied by the list corresponding to the class. At the same time, there is no need to check for duplicates before subsequently generating a candidate displacement vector list, thereby improving the efficiency of video decoding.
[0154] For example, when the displacement vector and auxiliary information of the decoded block G enter the historical motion information list, the decoder can classify the decoded block G according to the auxiliary information of the decoded block G. If the auxiliary information of the decoded block G meets the classification condition of the above-mentioned class 3, the decoder queries the list corresponding to class 3. If there is no displacement vector in the list corresponding to class 3, the decoder adds the displacement vector of the decoded block G to the list corresponding to class 3. If there is any displacement vector in the list corresponding to class 3, the decoder compares the auxiliary information of the decoded block G with the classification condition of class 4, and so on, to ensure that there is at most one displacement vector in one class.
[0155] In a possible implementation, if the decoded block meets the classification condition of any one of the multiple classes, the decoding end adds the index of the displacement vector of the decoded block in the historical motion information list to any one of the classes.
[0156] Optionally, the index is the order of a displacement vector in the historical motion information list, and of course, it can also be other indexes that can uniquely find the displacement vector in the historical motion information list, and the embodiments of the present application are not limited to this.
[0157] In this implementation, the decoder adds the index to the class instead of the displacement vector, which can reduce the storage space occupied by the list corresponding to the class.
[0158] 702. The decoding end stops classifying the displacement vectors of the decoded blocks.
[0159] Through steps 701 and 702, for any displacement vector of a decoded block, the decoding end can stop classifying it after classifying it into any class, thereby ensuring that a displacement vector is only classified into one class, avoiding the duplication check operation when subsequently exporting the candidate vector list, reducing the decoding complexity, and improving the decoding efficiency.
[0160] 703. The decoding end generates a candidate displacement vector list according to the classified displacement vectors, where one candidate displacement vector list corresponds to one block to be decoded.
[0161] In a possible implementation manner, the decoding end generates a candidate displacement vector list according to the classified displacement vectors by any of the following methods:
[0162] Method 1: In response to the presence of a class among multiple classes that does not contain any displacement vector, the decoding end can generate a candidate displacement vector list based on the displacement vectors contained in other classes among the multiple classes except the class.
[0163] For example, the decoding end can obtain the displacement vector from the list corresponding to each class in turn according to the size of the sequence number of the multiple classes. For example, if there are 6 classes, the decoding end can obtain a displacement vector from the list corresponding to the 6 classes in turn, and add the obtained displacement vector to the candidate displacement vector list. In response to the fact that any displacement vector is not stored in the list corresponding to any class in the multiple classes, the decoding end can skip the class, that is, the position corresponding to the class in the candidate displacement vector list is empty.
[0164] Method 2: In response to the presence of a class in multiple classes that does not contain any displacement vector, the decoding end can add the first displacement vector to the candidate displacement vector list.
[0165] Optionally, the first displacement vector is a displacement vector designed by a technician, such as a zero vector (0, 0), or a vector related to size, such as (-w, 0) and (0, -h), where w and h are the width and height of the minimum decoding unit, or the width and height of the block to be decoded, or a preset width and height, which is not limited in this embodiment of the present application.
[0166] Based on method 2, in response to the presence of a class in multiple classes that does not contain any displacement vector, the decoding end can generate a first displacement vector list based on multiple first displacement vectors, and the decoding end can determine the first displacement vector corresponding to the class from the first displacement vector list, and add the first displacement vector corresponding to the class to the candidate displacement vector list.
[0167] For example, the decoding end can create a first displacement vector list consisting of nine first displacement vectors: (0, 0), (-w, 0), (-2*w, 0), (0, -h), (0, -2*h), (-w, -h), (-w, -2*h), (-2*w, -h), and (-2*w, -2*h). The decoding end can number each first displacement vector in the first displacement vector list, such as numbering from left to right, or numbering from right to left. If the decoding end numbers from left to right, then the nine first displacement vectors (0, 0), (-w, 0), (-2*w, 0), (0, -h), (0, -2*h), (-w, -h), (-w, -2*h), (-2*w, -h), and (-2*w, -2*h) correspond to sequence numbers 0 to 8 respectively. If the decoding end numbers in order from right to left, then the nine first displacement vectors (0, 0), (-w, 0), (-2*w, 0), (0, -h), (0, -2*h), (-w, -h), (-w, -2*h), (-2*w, -h) and (-2*w, -2*h) correspond to serial numbers 8 to 0 respectively. The embodiment of the present application does not limit the numbering method of the decoding end. In response to the presence of a class in multiple classes that does not contain any displacement vector, the serial number of the class is, for example, 4, the decoding end can add the first displacement vector with serial number 4 from the first displacement vector list to the candidate displacement vector list as the displacement vector corresponding to the class with serial number 4.
[0168] Of course, in addition to adding the displacement vector to the candidate displacement vector list in the manner described in the above example, the decoding end can also determine the first displacement vector from the first displacement vector list in other possible ways and add the first displacement vector to the candidate displacement vector list. For example, the decoding end can randomly determine the first displacement vector from the first displacement vector list and add the first displacement vector to the candidate displacement vector list.
[0169] Mode 3: In response to the presence of a class in the multiple classes that does not contain any displacement vector, the decoding end can add the second displacement vector of the decoded block adjacent to the position of the block to be decoded to the candidate displacement vector list.
[0170] For example, see Fig. 9 , 901 is a block to be decoded, and decoded blocks 902-906 are decoded blocks adjacent to the position of the block to be decoded. In response to the presence of a class that does not contain any displacement vector in the multiple classes, such as class 3, the decoding end can add the second displacement vector of any decoded block in the decoded blocks 902-906 to the candidate displacement vector list, such as adding the second displacement vector of the decoded block 905 to the candidate displacement vector list as the displacement vector corresponding to class 3.
[0171] certainly, Fig. 9 The decoded blocks adjacent to the block to be decoded are shown only for ease of understanding. As the decoding standard is updated, the number and position of the decoded blocks adjacent to the block to be decoded may be updated accordingly, and the embodiments of the present application do not limit this.
[0172] In a possible implementation, in response to the decoded blocks adjacent to the block to be decoded not corresponding to any displacement vector, the decoding end can add the fourth displacement vector to the candidate displacement vector list.
[0173] For example, if the decoded block adjacent to the position of the block to be decoded does not contain a motion vector, for example, the decoded block is a non-IBC / ISC decoding block, or is an isolated point in an ISC decoding block, the decoding end can add a fourth displacement vector to the candidate displacement vector list, where the fourth displacement vector is also a preset displacement vector. Optionally, the preset vector includes the first displacement vector in the above-mentioned method 1 or method 2, and of course can also include a zero vector (0, 0). For the method for determining the first displacement vector, refer to the previous description and will not be repeated here.
[0174] Based on the method 3, in response to the presence of a class that does not contain any displacement vector in the multiple classes, the decoding end can generate a second displacement vector list according to the second displacement vectors of multiple decoded blocks adjacent to the position of the block to be decoded. The decoding end can determine the second displacement vector corresponding to the class from the second displacement vector list, and add the second displacement vector corresponding to the class to the candidate displacement vector list.
[0175] For example, the decoding end can be based on Fig. 9 The decoder can generate a second displacement vector list by using the second displacement vectors of the decoded blocks 902-906 shown in the figure. The decoder can number the second displacement vectors in the second displacement vector list in a left-to-right or right-to-left order. In response to the presence of a class that does not contain any displacement vector in the multiple classes, such as class 2, the decoder can obtain the second displacement vector with a sequence number of 2 from the second displacement vector list, and add the second displacement vector with a sequence number of 2 to the candidate displacement vector list.
[0176] In addition, the decoding end can also obtain the second displacement vector from the second displacement vector list in other ways. For example, the decoding end can add the second displacement vector that is first added to the second displacement vector list to the candidate displacement vector list. The decoding end can also add the second displacement vector that is last added to the second displacement vector list to the candidate displacement vector list. The embodiments of the present application do not limit this.
[0177] In addition, when the decoding end generates a second displacement vector list, it is possible to check for duplication of the second displacement vectors of multiple decoded blocks adjacent to the position of the block to be decoded. In response to the second displacement vectors of multiple decoded blocks including the same second displacement vector, the decoding end is able to delete the same second displacement vector and generate a second displacement vector list based on different second displacement vectors.
[0178] In addition, in response to the decoding end not finding the second displacement vector corresponding to the class in the second displacement vector list, the decoding end can add a preset displacement vector to the candidate displacement vector list. Optionally, the preset vector includes the first displacement vector in the above-mentioned method 1 or method 2, and of course can also include the zero vector (0, 0). The method for determining the first displacement vector refers to the previous description and will not be repeated here.
[0179] Mode 4: In response to the presence of a class in the multiple classes that does not contain any displacement vector, the decoding end can add a third displacement vector of a decoded block that is not adjacent to the position of the block to be decoded to the candidate displacement vector list.
[0180] For example, the decoding end can respectively obtain the third displacement vector of any one of the decoded blocks whose upper left corner coordinates are (x-8, y+h / 2), (x+2 / 2, y-8) and (x-8, y-8), and add the third displacement vector to the candidate displacement vector list as a displacement vector corresponding to the class that does not contain any displacement vector, where x and y are the horizontal and vertical coordinates of the upper left corner of the block to be decoded, respectively, and h is the height of the block to be decoded.
[0181] Of course, the coordinates of the decoded blocks that are not adjacent to the block to be decoded are only set for ease of understanding. In other possible implementations, they can also be set by technicians according to actual conditions, and the embodiments of the present application do not limit this.
[0182] Based on the method 4, in response to the presence of a class that does not contain any displacement vector in the multiple classes, the decoding end can generate a third displacement vector list according to the third displacement vectors of multiple decoded blocks that are not adjacent to the position of the block to be decoded. The decoding end can determine the third displacement vector corresponding to the class from the third displacement vector list, and add the third displacement vector corresponding to the class to the candidate displacement vector list.
[0183] For example, the decoding end can generate a third displacement vector list according to third displacement vectors of multiple decoded blocks that are not adjacent to the block to be decoded. The decoding end can number the third displacement vectors in the third displacement vector list in a left-to-right or right-to-left order. In response to the presence of a class that does not contain any displacement vector in the multiple classes, such as class 2, the decoding end can obtain a third displacement vector with a serial number of 2 from the third displacement vector list, and add the third displacement vector with a serial number of 2 to the candidate displacement vector list.
[0184] In addition, the decoding end can also obtain the third displacement vector from the third displacement vector list in other ways. For example, the decoding end can add the third displacement vector that is first added to the third displacement vector list to the candidate displacement vector list. The decoding end can also add the third displacement vector that is last added to the third displacement vector list to the candidate displacement vector list. The embodiments of the present application do not limit this.
[0185] In addition, when the decoding end generates a third displacement vector list, it is possible to check for duplication of the third displacement vectors of multiple decoded blocks that are not adjacent to the position of the block to be decoded. In response to the third displacement vectors of multiple decoded blocks including the same third displacement vector, the decoding end is able to delete the same third displacement vector and generate a third displacement vector list based on different third displacement vectors.
[0186] In addition, in response to the decoding end not finding the third displacement vector corresponding to the class in the third displacement vector list, the decoding end can add a preset displacement vector to the candidate displacement vector list. Optionally, the preset vector includes the first displacement vector in the above-mentioned method 1 or method 2, and of course can also include the zero vector (0, 0). The method for determining the first displacement vector refers to the previous description and will not be repeated here.
[0187] Method 5: In response to the presence of a class in the multiple classes that does not contain any displacement vector, the decoding end can add the displacement vectors of the decoded blocks in the historical motion information list whose decoding order is adjacent to the block to be decoded to the candidate displacement vector list.
[0188] In one possible implementation, in response to the presence of a class in multiple classes that does not contain any displacement vector, the decoding end can enter the displacement vector of the decoded block that was previously decoded before the block to be decoded into the candidate displacement vector list, that is, the displacement vector of the decoded block that is closest to the block to be decoded in decoding time is entered into the candidate displacement vector list.
[0189] For example, the decoding end can obtain the displacement vector that is last added to the historical motion information list from the historical motion information list, and add the displacement vector to the candidate displacement vector list.
[0190] Method 6: In response to the presence of a class in multiple classes that does not contain any displacement vector, the decoding end can add the displacement vector of the target position in the historical motion information list to the candidate displacement vector list.
[0191] Optionally, the displacement vector of the target position is a displacement vector in the historical motion information list whose sequence number is the same as the sequence number of the class.
[0192] In this way, depending on the different decoding methods of the displacement vectors in the historical motion information list by the decoding end, two different displacement vectors may be determined in the same historical motion information list. For example, the historical motion information list stores 6 displacement vectors (-1, -2), (-2, -3), (-1, -3), (-2, -4), (-1, -1) and (0, -1), of which (-1, -2) is the first displacement vector added to the historical motion information list, and (0, -1) is the last displacement vector added to the historical motion information list. If the sequence number of this class is 3, and the decoding end sorts the displacement vectors in the historical motion information list from left to right, then the decoding end can add the displacement vector (-1, -3) to the candidate displacement vector list. If the decoding end sorts the displacement vectors in the historical motion information list from right to left, then the decoding end can add the displacement vector (-1, -1) to the candidate displacement vector list.
[0193] In addition, if there is no displacement vector corresponding to this type at the target position in the historical motion information list, the decoding end can add a preset displacement vector to the candidate displacement vector list. Optionally, the preset vector includes the first displacement vector in the above-mentioned method 1 or method 2, and of course can also include a zero vector (0, 0). The method for determining the first displacement vector refers to the previous description and will not be repeated here.
[0194] For example, if the length of the historical motion information list is 6 and there are 7 classes, in response to the fact that there is no displacement vector in class 7, because the length of the historical motion information list is less than the sequence number of class 7, the decoding end cannot query the displacement vector corresponding to class 7 in the motion information list. The decoding end can add a preset displacement vector to the candidate displacement vector list.
[0195] It should be noted that the above-mentioned methods 1 to 6 can be used individually or simultaneously, and the embodiments of the present application do not limit this.
[0196] 704. The decoding end determines a target displacement vector corresponding to the block to be decoded in the candidate displacement vector list according to the index of the block to be decoded.
[0197] Taking the index of the block to be decoded as the sequential identifier of the target displacement vector corresponding to the block to be decoded in the candidate displacement vector list as an example, the decoding end can obtain the target displacement vector from the candidate displacement vector list according to the sequential identifier during the decoding process.
[0198] 705. The decoding end decodes the block to be decoded according to the target displacement vector.
[0199] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the decoding end, once a displacement vector is classified into a class, the decoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video decoding and improving the efficiency of video decoding.
[0200] It should be noted that the video encoding method and video decoding method provided in the present application belong to the same inventive concept. For the same image block in the same image frame, it is called a block to be encoded or an encoded block in the video encoding process, and is called a block to be decoded or a decoded block in the video decoding process.
[0201] Fig.10 is a flowchart of a video encoding method provided in an embodiment of the present application, see Fig.10 , methods include:
[0202] 1001. During the video encoding process, the encoder classifies the displacement vectors of the encoded blocks in the historical motion information list. During the classification, if the encoded blocks meet the classification conditions of any one of multiple classes, the displacement vectors of the encoded blocks are added to the class.
[0203] Optionally, the classification condition includes at least one of the following:
[0204] The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
[0205] Step 1001 and the above-mentioned step 701 belong to the same inventive concept. For the implementation method, please refer to the description of the above-mentioned step 701, which will not be repeated here.
[0206] In a possible implementation, during classification, if the encoded block meets the classification conditions of any one of the multiple classes and there is any displacement vector in any class, the encoder does not classify the displacement vector of the encoded block into the class.
[0207] In a possible implementation, if the encoded block meets the classification condition of any one of the multiple classes, the encoder adds the index of the displacement vector of the encoded block in the historical motion information list to the class.
[0208] 1002. The encoder stops classifying the displacement vectors of the encoded blocks.
[0209] Step 1002 and the above-mentioned step 702 belong to the same inventive concept. The implementation method refers to the description of the above-mentioned step 702 and will not be repeated here.
[0210] 1003. The encoding end generates a candidate displacement vector list according to the classified displacement vectors, and one block to be encoded corresponds to one candidate displacement vector list.
[0211] Step 1003 and the above-mentioned step 703 belong to the same inventive concept. For the implementation method, please refer to the description of the above-mentioned step 703, which will not be repeated here.
[0212] In a possible implementation manner, the encoder generates a candidate displacement vector list according to the classified displacement vectors by any of the following methods:
[0213] Method 1: In response to the presence of a class in multiple classes that does not contain any displacement vector, the encoder generates a candidate displacement vector list based on the displacement vectors contained in other classes in the multiple classes other than the class.
[0214] Method 2: In response to the presence of a class among multiple classes that does not contain any displacement vector, the encoder adds the first displacement vector to the candidate displacement vector list.
[0215] In one possible implementation, in response to the presence of a class in multiple classes that does not contain any displacement vector, the encoding end is able to generate a first displacement vector list based on multiple first displacement vectors, the encoding end determines the first displacement vector corresponding to the class from the first displacement vector list, and adds the first displacement vector corresponding to the class to the candidate displacement vector list.
[0216] Method 3: In response to the presence of a class in the multiple classes that does not contain any displacement vector, the encoder adds the second displacement vector of the encoded block adjacent to the position of the block to be encoded to the candidate displacement vector list.
[0217] In a possible implementation, in response to the fact that an encoded block adjacent to the block to be encoded does not correspond to any displacement vector, the encoder adds the fourth displacement vector to the candidate displacement vector list.
[0218] In a possible implementation, in response to the presence of a class that does not include any displacement vector among the multiple classes, the encoder generates a second displacement vector list based on second displacement vectors of multiple encoded blocks adjacent to the position of the block to be encoded. The encoder determines the second displacement vector corresponding to the class from the second displacement vector list, and adds the second displacement vector corresponding to the class to the candidate displacement vector list.
[0219] Method 4: In response to the presence of a class in the multiple classes that does not contain any displacement vector, the encoder adds a third displacement vector of an encoded block that is not adjacent to the position of the block to be encoded to the candidate displacement vector list.
[0220] Method 5: In response to the presence of a class in the multiple classes that does not contain any displacement vector, the encoder adds the displacement vector of the encoded block whose encoding time is adjacent to the block to be encoded to the candidate displacement vector list.
[0221] Method 6: In response to the presence of a class in multiple classes that does not contain any displacement vector, the encoder adds the displacement vector of the target position in the historical motion information list to the candidate displacement vector list.
[0222] 1004. The encoding end determines a target displacement vector corresponding to the block to be encoded from the candidate displacement vector list.
[0223] Optionally, the target displacement vector is a displacement vector whose rate-distortion parameter meets a target condition.
[0224] In a possible implementation, the encoder determines rate-distortion parameters of multiple displacement vectors in the candidate displacement vector list, and determines the displacement vector with the smallest rate-distortion parameter as the target displacement vector corresponding to the block to be encoded.
[0225] For example, if the bit rate of the video encoding is 1000 kbps, the encoder can determine the rate-distortion parameters corresponding to the displacement vectors in the candidate displacement vector list at the bit rate of 1000 kbps. The relationship between the video bit rate and the image distortion rate obtained by the same video encoding method is shown in formula (1). The encoder generates the Lagrangian cost function (2) based on formula (1). The encoder determines the rate-distortion parameters corresponding to the multiple partitioning modes through the Lagrangian cost function (2), thereby determining the target displacement vector with the minimum rate-distortion parameter.
[0226]
[0227] Among them, R is the bit rate, D is the image distortion rate, α is the coefficient, δ 2 is the variance of multiple pixels in the unit to be encoded.
[0228] Min{J=D+λR} (2)
[0229] Among them, Min{} is the minimum value, λ is the coefficient, and J is the rate-distortion parameter.
[0230] 1005. The encoding end encodes the block to be encoded according to the target displacement vector, and adds the index of the target displacement vector to the encoding information.
[0231] Optionally, the index of the target displacement vector is the order identifier of the target displacement vector in the candidate displacement vector list. For example, if there are 6 displacement vectors in the candidate displacement vector list, and the order of the target displacement vector in the candidate displacement vector list is 2, then the encoder can use 2 as the index of the target displacement vector. In the subsequent decoding process, the decoder can directly obtain the target displacement vector from the candidate displacement vector list through index 2.
[0232] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the encoding end, once a displacement vector is classified into a class, the encoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video encoding and improving the efficiency of video encoding.
[0233] Fig.11 This is a schematic diagram of the structure of a video decoding device provided in an embodiment of the present application, see Fig.11 The device includes: a first classification module 1101, a first candidate displacement vector list generation module 1102, a first target displacement vector determination module 1103 and a decoding module 1104.
[0234] The first classification module 1101 is used to classify the displacement vectors of the decoded blocks in the historical motion information list during the video decoding process. During the classification, if the decoded block meets the classification condition of any one of the multiple classes, the displacement vector of the decoded block is added to any class, and the classification of the displacement vector of the decoded block is stopped.
[0235] In a possible implementation, the first classification module 1101 is further used for, during classification, if the decoded block meets the classification conditions of any class among multiple classes and there is any displacement vector in any class, not classifying the displacement vector of the decoded block into any class.
[0236] In a possible implementation, the first classification module 1101 is further configured to add the index of the displacement vector of the decoded block in the historical motion information list to any class if the decoded block meets the classification condition of any class among multiple classes.
[0237] In a possible implementation, the device further includes:
[0238] The first candidate displacement vector list generating module 1102 is used to generate a candidate displacement vector list according to the classified displacement vectors, and one to-be-decoded block corresponds to one candidate displacement vector list.
[0239] In a possible implementation, the first candidate displacement vector list generating module 1102 is configured to perform any of the following:
[0240] In response to the presence of a class in the plurality of classes that does not include any displacement vector, a candidate displacement vector list is generated based on displacement vectors included in other classes in the plurality of classes other than the class.
[0241] In response to the presence of a class in the plurality of classes that does not include any of the displacement vectors, the first displacement vector is added to the candidate displacement vector list.
[0242] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, a second displacement vector of a decoded block adjacent to a position of a block to be decoded is added to the candidate displacement vector list.
[0243] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, a third displacement vector of a decoded block that is not adjacent to a position of the block to be decoded is added to the candidate displacement vector list.
[0244] In response to the presence of a class in the plurality of classes that does not include any displacement vector, the displacement vectors of decoded blocks in the historical motion information list that are adjacent in decoding order to the block to be decoded are added to the candidate displacement vector list.
[0245] In response to the presence of a class in the plurality of classes that does not include any displacement vector, the displacement vector of the target position in the historical motion information list is added to the candidate displacement vector list.
[0246] In one possible implementation, the first candidate displacement vector list generating module 1102 is used to generate a first displacement vector list based on multiple first displacement vectors in response to the presence of a class in multiple classes that does not contain any displacement vector, determine the first displacement vector corresponding to the class from the first displacement vector list, and add the first displacement vector corresponding to the class to the candidate displacement vector list.
[0247] In a possible implementation, the first candidate displacement vector list generating module 1102 is configured to generate a second displacement vector list according to second displacement vectors of multiple decoded blocks adjacent to the position of the block to be decoded in response to the presence of a class that does not contain any displacement vector in the multiple classes, determine the second displacement vector corresponding to the class from the second displacement vector list, and add the second displacement vector corresponding to the class to the candidate displacement vector list.
[0248] In a possible implementation, the first candidate displacement vector list generating module 1102 is further configured to add the fourth displacement vector to the candidate displacement vector list in response to a decoded block adjacent to the position of the block to be decoded not corresponding to any displacement vector.
[0249] In a possible implementation, the device further includes:
[0250] The first target displacement vector determination module 1103 is used to determine the target displacement vector corresponding to the block to be decoded in the candidate displacement vector list according to the index of the block to be decoded.
[0251] The decoding module 1104 is used to decode the block to be decoded according to the target displacement vector.
[0252] In a possible implementation, the classification condition includes at least one of the following:
[0253] The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
[0254] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the decoding end, once a displacement vector is classified into a class, the decoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video decoding and improving the efficiency of video decoding.
[0255] Fig.12 is a schematic diagram of the structure of a video encoding device provided in an embodiment of the present application, see Fig.12 The device includes: a second classification module 1201, a second candidate displacement vector list generation module 1202, a second target displacement vector determination module 1203 and an encoding module 1204.
[0256] The second classification module 1201 is used to classify the displacement vectors of the encoded blocks in the historical motion information list during the video encoding process. During the classification, if the encoded block meets the classification conditions of any of the multiple classes, the displacement vector of the encoded block is added to any class, and the classification of the displacement vector of the encoded block is stopped.
[0257] In a possible implementation, the second classification module 1201 is also used for, during classification, if the encoded block meets the classification conditions of any one of the multiple classes and there is any displacement vector in any class, not classifying the displacement vector corresponding to the encoded block into any class.
[0258] In a possible implementation, the second classification module 1201 is configured to add the index of the displacement vector of the coded block in the historical motion information list to any class if the coded block meets the classification condition of any class among multiple classes.
[0259] In a possible implementation, the device further includes:
[0260] The second candidate displacement vector list generating module 1202 is used to generate a candidate displacement vector list according to the classified displacement vectors, and one candidate displacement vector list corresponds to one block to be encoded.
[0261] The second target displacement vector determination module 1203 is used to determine the target displacement vector corresponding to the block to be encoded from the candidate displacement vector list.
[0262] The encoding module 1204 is used to encode the block to be encoded according to the target displacement vector, and generate an index of the block to be encoded according to the order of the target displacement vector in the candidate displacement vector list.
[0263] In a possible implementation, the second candidate displacement vector list generating module 1202 is configured to perform any of the following:
[0264] In response to the presence of a class in the plurality of classes that does not include any displacement vector, a candidate displacement vector list is generated based on displacement vectors included in other classes in the plurality of classes other than the class.
[0265] In response to the presence of a class in the plurality of classes that does not include any of the displacement vectors, the first displacement vector is added to the candidate displacement vector list.
[0266] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, a second displacement vector of an encoded block adjacent to a position of the block to be encoded is added to the candidate displacement vector list.
[0267] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, a third displacement vector of an encoded block that is not adjacent to a position of the block to be encoded is added to the candidate displacement vector list.
[0268] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, the displacement vectors of the encoded blocks in the historical motion information list that are adjacent in encoding order to the block to be encoded are added to the candidate displacement vector list.
[0269] In response to the presence of a class in the plurality of classes that does not contain any displacement vector, the displacement vectors of the encoded blocks in the historical motion information list that are adjacent in encoding order to the block to be encoded are added to the candidate displacement vector list.
[0270] In one possible implementation, the second candidate displacement vector list generating module 1202 is used to generate a first displacement vector list based on multiple first displacement vectors in response to the presence of a class in multiple classes that does not contain any displacement vector, determine the first displacement vector corresponding to the class from the first displacement vector list, and add the first displacement vector corresponding to the class to the candidate displacement vector list.
[0271] In a possible implementation, the second candidate displacement vector list generating module 1202 is configured to generate a second displacement vector list according to second displacement vectors of multiple coded blocks adjacent to the position of the block to be coded in response to the presence of a class that does not contain any displacement vector in the multiple classes, determine the second displacement vector corresponding to the class from the second displacement vector list, and add the second displacement vector corresponding to the class to the candidate displacement vector list.
[0272] In a possible implementation, the second candidate displacement vector list generating module 1202 is further configured to add the fourth displacement vector to the candidate displacement vector list in response to the coded block adjacent to the position of the block to be coded not corresponding to any displacement vector.
[0273] In a possible implementation, the second target displacement vector determination module 1203 is configured to determine rate-distortion parameters of multiple displacement vectors in the candidate displacement vector list, and determine the displacement vector with the smallest rate-distortion parameter as the target displacement vector corresponding to the block to be encoded.
[0274] In a possible implementation, the classification condition includes at least one of the following:
[0275] The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
[0276] Through the technical solution provided by the embodiment of the present application, in the process of classifying the displacement vectors in the historical motion information list at the encoding end, once a displacement vector is classified into a class, the encoding end will not continue to classify the displacement vector, but will terminate the classification of the displacement vector. Compared with the process of classifying the displacement vectors in the historical motion information list in the related art, it is possible to avoid the situation where a displacement vector is classified into multiple classes, so that there is no need to perform a duplicate check operation when constructing a candidate displacement vector list, thereby reducing the complexity of video encoding and improving the efficiency of video encoding.
[0277] The embodiment of the present application provides a computer device for executing the above method. The computer device can be implemented as a terminal or a server. The terminal includes an encoding end and a decoding end. The structure of the terminal is first introduced below:
[0278] Fig.13 1 is a schematic diagram of a terminal structure provided in an embodiment of the present application. The terminal 1300 may be: a smart phone, a tablet computer, a laptop computer or a desktop computer. The terminal 1300 may also be called a user equipment, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0279] Typically, the terminal 1300 includes: one or more processors 1301 and one or more memories 1302 .
[0280] The processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1301 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0281] The memory 1302 may include one or more computer-readable storage media, which may be non-transitory. The memory 1302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1302 is used to store at least one program code, which is used to be executed by the processor 1301 to implement the video decoding method or video encoding method provided in the method embodiment of the present application.
[0282] In some embodiments, the terminal 1300 may also optionally include: a peripheral device interface 1303 and at least one peripheral device. The processor 1301, the memory 1302 and the peripheral device interface 1303 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1303 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1304, a display screen 1305, a camera assembly 1306, an audio circuit 1307 and a power supply 1309.
[0283] The peripheral device interface 1303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1301 and the memory 1302. In some embodiments, the processor 1301, the memory 1302, and the peripheral device interface 1303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1301, the memory 1302, and the peripheral device interface 1303 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0284] The radio frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 1304 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 1304 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like.
[0285] The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1305 is a touch display screen, the display screen 1305 also has the ability to collect touch signals on the surface or above the surface of the display screen 1305. The touch signal may be input as a control signal to the processor 1301 for processing. At this time, the display screen 1305 may also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards.
[0286] The camera assembly 1306 is used to collect images or videos. Optionally, the camera assembly 1306 includes a front camera and a rear camera. Usually, the front camera is set on the front panel of the terminal, and the rear camera is set on the back of the terminal.
[0287] The audio circuit 1307 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them to the processor 1301 for processing, or input them to the RF circuit 1304 to achieve voice communication.
[0288] The power supply 1309 is used to supply power to various components in the terminal 1300. The power supply 1309 may be alternating current, direct current, a disposable battery, or a rechargeable battery.
[0289] In some embodiments, the terminal 1300 further includes one or more sensors 1310 , including but not limited to: an acceleration sensor 1311 , a gyroscope sensor 1312 , a pressure sensor 1313 , an optical sensor 1315 , and a proximity sensor 1316 .
[0290] The acceleration sensor 1311 can detect the magnitude of acceleration on three coordinate axes of the coordinate system established with the terminal 1300 .
[0291] The gyro sensor 1312 can detect the body direction and rotation angle of the terminal 1300 . The gyro sensor 1312 can cooperate with the acceleration sensor 1311 to collect the user's 3D actions on the terminal 1300 .
[0292] The pressure sensor 1313 may be provided at the side frame of the terminal 1300 and / or the lower layer of the display screen 1305. When the pressure sensor 1313 is provided at the side frame of the terminal 1300, it may detect the user's holding signal of the terminal 1300, and the processor 1301 may perform left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1313. When the pressure sensor 1313 is provided at the lower layer of the display screen 1305, the processor 1301 may control the operability controls on the UI interface according to the user's pressure operation on the display screen 1305.
[0293] The optical sensor 1315 is used to collect the ambient light intensity. In one embodiment, the processor 1301 can control the display brightness of the display screen 1305 according to the ambient light intensity collected by the optical sensor 1315.
[0294] The proximity sensor 1316 is used to collect the distance between the user and the front of the terminal 1300 .
[0295] Those skilled in the art will understand that Fig.13 The structure shown in the figure does not constitute a limitation on the terminal 1300, and the terminal 1300 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0296] The above-mentioned computer device can also be implemented as a server. The structure of the server is introduced below:
[0297] Fig.14 It is a structural diagram of a server provided in an embodiment of the present application. The server 1400 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1401 and one or more memories 1402, wherein at least one program code is stored in the one or more memories 1402, and the at least one program code is loaded and executed by the one or more processors 1401 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server 1400 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1400 may also include other components for implementing device functions, which will not be described in detail here.
[0298] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including a program code, and the program code can be executed by a processor to complete the video decoding method or the video encoding method in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0299] In an exemplary embodiment, a computer program product or a computer program is also provided, which includes a computer program code, and the computer program code is stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device performs the above-mentioned video decoding method or the above-mentioned video encoding method.
[0300] A person skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be accomplished by hardware or by hardware associated with a program code, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0301] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A video decoding method, characterized in that: The method comprises: During video decoding, the displacement vectors of decoded blocks in the historical motion information list are classified; During classification, if the decoded block meets the classification conditions of any one of the multiple classes, based on the auxiliary information of the decoded block in the historical motion information list, the displacement vector of the decoded block is added to any one of the classes, and the classification of the displacement vector of the decoded block is stopped.
2. The method according to claim 1, characterized in that The auxiliary information includes size information, position information and the number of times the displacement vector of the decoded block is repeatedly used.
3. The method according to claim 1, characterized in that If the decoded block satisfies the classification condition of any one of the multiple classes, adding the displacement vector of the decoded block to the any one of the classes comprises: If the decoded block meets the classification condition of any one of the multiple classes, the index of the displacement vector of the decoded block in the historical motion information list is added to the any one of the classes.
4. The method according to claim 1, characterized in that After stopping the classification of the displacement vectors of the decoded blocks, the method further comprises: A candidate displacement vector list is generated according to the classified displacement vectors, and one to-be-decoded block corresponds to one candidate displacement vector list.
5. The method according to claim 3, characterized in that: Generating a candidate displacement vector list according to the classified displacement vectors includes any of the following: In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating the candidate displacement vector list according to displacement vectors included in other classes in the plurality of classes except the class; In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding the first displacement vector to a candidate displacement vector list; In response to the presence of a class in the plurality of classes that does not contain any displacement vector, adding a second displacement vector of a decoded block adjacent to a position of the block to be decoded to a candidate displacement vector list; In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding a third displacement vector of a decoded block that is not adjacent to the position of the block to be decoded to the candidate displacement vector list; In response to the presence of a class that does not include any displacement vector in the multiple classes, adding the displacement vectors of decoded blocks in the historical motion information list that are adjacent to the block to be decoded in decoding order to the candidate displacement vector list; In response to the presence of a class in the plurality of classes that does not include any displacement vector, the displacement vector of the target position in the historical motion information list is added to the candidate displacement vector list.
6. The method according to claim 5, characterized in that In response to the presence of a class in the plurality of classes that does not include any displacement vector, adding the first displacement vector to the candidate displacement vector list comprises: In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating a first displacement vector list according to the plurality of first displacement vectors; A first displacement vector corresponding to the class is determined from the first displacement vector list, and the first displacement vector corresponding to the class is added to a candidate displacement vector list.
7. The method according to claim 5, characterized in that In response to the presence of a class that does not include any displacement vector in the multiple classes, adding a second displacement vector of a decoded block adjacent to a position of the block to be decoded to the candidate displacement vector list comprises: In response to the presence of a class in the plurality of classes that does not include any displacement vector, generating a second displacement vector list according to second displacement vectors of a plurality of decoded blocks adjacent to the position of the block to be decoded; A second displacement vector corresponding to the class is determined from the second displacement vector list, and the second displacement vector corresponding to the class is added to the candidate displacement vector list.
8. The method according to claim 5, characterized in that Before adding the second displacement vector of the decoded block adjacent to the position of the block to be decoded into the candidate displacement vector list, the method further includes: In response to the decoded blocks adjacent to the position of the block to be decoded not corresponding to any displacement vector, a fourth displacement vector is added to the candidate displacement vector list.
9. The method according to claim 4, characterized in that After generating the candidate displacement vector list, the method further includes: According to the index of the block to be decoded, determining a target displacement vector corresponding to the block to be decoded in the candidate displacement vector list; The block to be decoded is decoded according to the target displacement vector.
10. The method according to any one of claims 1 to 9, characterized in that: The classification condition includes at least one of the following: The size of the decoded block is greater than or equal to the size threshold, the number of times the displacement vector of the decoded block is used is greater than the number threshold, and the spatial position relationship between the decoded block and the block to be decoded meets the position condition.
11. A video encoding method, characterized in that: include: During video encoding, the displacement vectors of the encoded blocks in the historical motion information list are classified; During classification, if the encoded block meets the classification conditions of any one of the multiple classes, the displacement vector of the encoded block is added to any one of the classes based on the auxiliary information of the encoded block in the historical motion information list, and the classification of the displacement vector of the encoded block is stopped.
12. The method according to claim 11, characterized in that After stopping the classification of the displacement vectors of the encoded blocks, the method further comprises: Generate a candidate displacement vector list according to the classified displacement vectors, where one candidate displacement vector list corresponds to one block to be encoded; Determining a target displacement vector corresponding to the block to be encoded from the candidate displacement vector list; The block to be encoded is encoded according to the target displacement vector, and the index of the block to be encoded is generated according to the order of the target displacement vector in the candidate displacement vector list.
13. A video decoding device, characterized in that: The device comprises: A classification module is used to classify the displacement vectors of decoded blocks in the historical motion information list during video decoding; during classification, if the decoded block meets the classification conditions of any one of multiple classes, then based on the auxiliary information of the decoded block in the historical motion information list, the displacement vector of the decoded block is added to any one of the classes, and the classification of the displacement vector of the decoded block is stopped.
14. A video encoding device, characterized in that: The device comprises: A classification module is used to classify the displacement vectors of the encoded blocks in the historical motion information list during the video encoding process; during classification, if the encoded block meets the classification conditions of any one of the multiple classes, then based on the auxiliary information of the encoded block in the historical motion information list, the displacement vector of the encoded block is added to any one of the classes, and the classification of the displacement vector of the encoded block is stopped.
15. A computer device, characterized in that: The computer device includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the program code is loaded and executed by the one or more processors to implement the video decoding method according to any one of claims 1 to 10, or the video encoding method according to any one of claims 11 to 12.
