Video coding and decoding method and device, computer readable medium and electronic equipment

By updating the motion vector at the predicted position of the target with high encoding cost and pixel distortion less than the threshold during the video encoding and decoding process, the problem of inaccurate motion vectors in the existing technology is solved, and the efficiency of video encoding and decoding is improved.

CN121509677APending Publication Date: 2026-02-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411096730.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In the video encoding and decoding process, existing technologies consider the position with the minimum weighted average of pixel distortion and encoding cost when selecting motion vectors. However, this position may not be the optimal prediction block position, resulting in inaccurate motion vectors and affecting encoding and decoding efficiency.

Method used

The motion vector of the current block is updated by selecting target prediction locations from among a number of specified locations where the encoding cost is higher than that of the original motion vector and the pixel distortion is less than a set threshold, in order to optimize motion compensation processing.

Benefits of technology

It improves the accuracy of motion vectors, enhances video encoding and decoding efficiency, and reduces pixel distortion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121509677A_ABST
    Figure CN121509677A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a video encoding and decoding method and device, a computer readable medium and electronic equipment. The video decoding method comprises the following steps: decoding a video code stream to obtain an original motion vector of a current block; based on the original motion vector, selecting a target prediction position of which the coding cost is higher than that of the original motion vector and the pixel distortion is smaller than a set threshold value from a plurality of specified positions; and determining an updated motion vector of the current block based on the target prediction position, and performing motion compensation processing on the current block based on the updated motion vector. According to the technical scheme provided by the embodiment of the invention, the original motion vector of the current block can be optimized, so that the precision of the optimized motion vector can be improved, and the video coding and decoding efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer and communication technology, and more specifically, to a video encoding / decoding method, apparatus, computer-readable medium, and electronic device. Background Technology

[0002] In the field of video encoding and decoding, inter-frame prediction mode utilizes the correlation in the temporal domain of video to predict the pixels of the current image using pixels from neighboring encoded images (i.e., reference images), thereby effectively removing temporal redundancy in the video. The process of finding the optimal reference block in the reference image is called motion estimation, and the difference in image coordinates between the reference block in the reference image and the current block in the current image is called the motion vector (MV).

[0003] During motion estimation, a "best" position needs to be selected from multiple possible candidate positions based on a cost function as the inter-frame prediction block for the current block. The cost function typically includes pixel distortion (D) for block matching and coding cost (Rate) for motion vectors. Generally, the matching position with the minimum cost function is the best inter-frame prediction block. However, the prediction block position selected when the cost function is minimum may not be optimal in terms of block compensation (prediction) effect; that is, the determined motion vectors are not accurate, which will affect the efficiency of video encoding and decoding. Summary of the Invention

[0004] The embodiments of this application provide a video encoding / decoding method, apparatus, computer-readable medium, and electronic device, which can optimize the original motion vector of the current block, thereby improving the accuracy of the optimized motion vector and improving video encoding / decoding efficiency.

[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part by practice of this application.

[0006] In a first aspect, embodiments of this application provide a video decoding method, comprising: decoding a video stream to obtain the original motion vector of a current block; selecting a target prediction position from a plurality of specified positions based on the original motion vector, wherein the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; determining the updated motion vector of the current block based on the target prediction position, and performing motion compensation processing on the current block based on the updated motion vector.

[0007] Secondly, embodiments of this application provide a video coding method, including: determining the original motion vector of a current block; selecting a target prediction position from a specified plurality of positions based on the original motion vector, wherein the coding cost is higher than the coding cost of the original motion vector and the pixel distortion is less than a set threshold; determining the updated motion vector of the current block based on the target prediction position, and performing motion compensation processing on the current block based on the updated motion vector.

[0008] Thirdly, embodiments of this application provide a video decoding apparatus, comprising: a decoding unit configured to decode a video bitstream to obtain the original motion vector of a current block; a selection unit configured to select, based on the original motion vector, a target prediction position from a plurality of specified positions, wherein the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; and a processing unit configured to determine, based on the target prediction position, the updated motion vector of the current block, and to perform motion compensation processing on the current block based on the updated motion vector.

[0009] Fourthly, embodiments of this application provide a video encoding apparatus, comprising: a determining unit configured to determine the original motion vector of a current block; a selecting unit configured to select, based on the original motion vector, a target prediction position from a plurality of specified positions, wherein the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; and a processing unit configured to determine, based on the target prediction position, the updated motion vector of the current block, and to perform motion compensation processing on the current block based on the updated motion vector.

[0010] Fifthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the video decoding method or video encoding method as described in the above embodiments.

[0011] Sixthly, embodiments of this application provide an electronic device, including: one or more processors; and a storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the video decoding method or video encoding method as described in the above embodiments.

[0012] In a seventh aspect, embodiments of this application provide a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads from and executes the computer program from the computer-readable storage medium, causing the electronic device to perform the video decoding or video encoding methods provided in the various alternative embodiments described above.

[0013] In some embodiments of this application, the technical solutions provide that the video stream can be decoded to obtain the original motion vector of the current block. Then, based on the original motion vector, a target prediction position is selected from multiple specified positions, where the encoding cost is higher than that of the original motion vector and the pixel distortion is less than a set threshold. The updated motion vector of the current block is then determined based on the target prediction position, and motion compensation processing is performed on the current block based on the updated motion vector. Therefore, the technical solutions of this application can optimize the original motion vector of the current block to reduce pixel distortion, thereby improving the accuracy of the optimized motion vector and enhancing video encoding / decoding efficiency.

[0014] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0015] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown;

[0016] Figure 2 This diagram illustrates the placement of the video encoding and decoding devices in a streaming system.

[0017] Figure 3 A basic flowchart of a video encoder is shown;

[0018] Figure 4 A schematic diagram of an inter-frame prediction process is shown;

[0019] Figure 5 A schematic diagram of an inter-frame prediction process is shown;

[0020] Figure 6 A flowchart of a video decoding method according to an embodiment of this application is shown;

[0021] Figure 7 A flowchart of a video encoding method according to an embodiment of this application is shown;

[0022] Figure 8 A schematic diagram of a search area according to an embodiment of this application is shown;

[0023] Figure 9 A block diagram of a video decoding apparatus according to an embodiment of this application is shown;

[0024] Figure 10 A block diagram of a video encoding apparatus according to an embodiment of this application is shown;

[0025] Figure 11A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation

[0026] Exemplary embodiments will now be described in a more comprehensive manner with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to these examples; rather, these embodiments are provided so that this application will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art.

[0027] Furthermore, the features, structures, or characteristics described in this application can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to provide a full understanding of the embodiments of this application. However, those skilled in the art will recognize that when implementing the technical solutions of this application, not all the detailed features in the embodiments may be used, one or more specific details may be omitted, or other methods, elements, devices, steps, etc., may be employed.

[0028] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0029] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0030] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0031] It should be noted that "multiple" in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0032] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown.

[0033] like Figure 1 As shown, system architecture 100 includes multiple terminal devices that can communicate with each other via, for example, a network 150. For instance, system architecture 100 may include a first terminal device 110 and a second terminal device 120 interconnected via network 150. Figure 1 In one embodiment, the first terminal device 110 and the second terminal device 120 perform unidirectional data transmission.

[0034] For example, the first terminal device 110 can encode video data (e.g., a video image stream captured by the terminal device 110) to transmit it to the second terminal device 120 via the network 150. The encoded video data is transmitted in the form of one or more encoded video streams. The second terminal device 120 can receive the encoded video data from the network 150, decode the encoded video data to recover the video data, and display video images based on the recovered video data.

[0035] In one embodiment of this application, system architecture 100 may include a third terminal device 130 and a fourth terminal device 140 that perform bidirectional transmission of encoded video data, such as during a video conference. For bidirectional data transmission, each of the third terminal device 130 and the fourth terminal device 140 may encode video data (e.g., a video image stream captured by the terminal device) for transmission over network 150 to the other terminal device. Each of the third terminal device 130 and the fourth terminal device 140 may also receive encoded video data transmitted by the other terminal device, decode the encoded video data to recover the video data, and display the video images on an accessible display device based on the recovered video data.

[0036] exist Figure 1 In the embodiments shown, the first terminal device 110, the second terminal device 120, the third terminal device 130 and the fourth terminal device 140 may be servers or terminals, but the principles disclosed in this application are not limited to these.

[0037] Servers can be standalone physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing 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, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminals can be smartphones, tablets, laptops, desktop computers, smart speakers, smart voice interaction devices, smartwatches, smart home appliances, in-vehicle terminals, aircraft, etc., but are not limited to these.

[0038] Figure 1 The network 150 shown represents any number of networks, including, for example, wired and / or wireless communication networks, that transmit encoded video data between the first terminal device 110, the second terminal device 120, the third terminal device 130, and the fourth terminal device 140. The communication network 150 may exchange data in circuit-switched and / or packet-switched channels. This network may include telecommunications networks, local area networks (LANs), wide area networks (WANs), and / or the Internet. For the purposes of this application, unless explained below, the architecture and topology of network 150 may be irrelevant to the operation of the disclosure herein.

[0039] In one embodiment of this application, Figure 2 The illustration shows the placement of video encoding and decoding devices in a streaming environment. The subject matter disclosed in this application is equally applicable to other video-enabled applications, including, for example, video conferencing, digital television (TV), and storing compressed video on digital media including CDs, DVDs, memory sticks, etc.

[0040] The streaming system may include an acquisition subsystem 213, which may include a video source 201 such as a digital camera, which creates an uncompressed video image stream 202. In an embodiment, the video image stream 202 includes samples captured by a digital camera. The video image stream 202 is depicted as a thick line to emphasize the high data volume of the video image stream compared to encoded video data 204 (or encoded video bitstream 204). The video image stream 202 may be processed by an electronic device 220, which includes a video encoding device 203 coupled to the video source 201. The video encoding device 203 may include hardware, software, or a combination of hardware and software to implement or enforce aspects of the disclosed subject matter as described in more detail below. The encoded video data 204 (or encoded video bitstream 204) is depicted as a thin line to emphasize the lower data volume of the encoded video data 204 (or encoded video bitstream 204), which may be stored on a streaming server 205 for future use. One or more streaming client subsystems, such as Figure 2 Client subsystems 206 and 208 can access streaming server 205 to retrieve copies 207 and 209 of encoded video data 204. Client subsystem 206 may include, for example, a video decoding device 210 in electronic device 230. Video decoding device 210 decodes the incoming copy 207 of the encoded video data and produces an output video picture stream 211 that can be displayed on display 212 (e.g., a screen) or another presentation device. In some streaming systems, the encoded video data 204, video data 207, and video data 209 (e.g., video stream) may be encoded according to certain video encoding / compression standards.

[0041] It should be noted that electronic devices 220 and 230 may include other components not shown in the figures. For example, electronic device 220 may include a video decoding device, and electronic device 230 may also include a video encoding device.

[0042] In one embodiment of this application, taking High Efficiency Video Coding (HEVC) and Versatile Video Coding (VVC) from international video coding standards, as well as the Chinese national video coding standard AVS, as examples, after an input video frame image, the video frame image is divided into several non-overlapping processing units according to a block size. Each processing unit performs a similar compression operation. This processing unit is called a Coding Tree Unit (CTU) or Largest Coding Unit (LCU). The CTU can be further subdivided into more refined units to obtain one or more basic Coding Units (CUs). The CU is the most basic element in a coding process.

[0043] In another embodiment, this processing unit can also be called a tile, which is a rectangular area of ​​a multimedia data frame that can be independently decoded and encoded. In the Alliance for Open Media Video 1 (AV1) standard, the tile can be further subdivided into one or more superblocks (SBs). The SB is the starting point for block partitioning and can be further divided into multiple subblocks. The superblocks are then further subdivided into one or more blocks. Each block is the most basic element in a coding process. Optionally, an SB can contain several blocks (Bs).

[0044] The above method of dividing video frame images can be called a block partition structure. The following introduces some concepts in the encoding process:

[0045] Predictive coding includes intra-frame prediction and inter-frame prediction. The original video signal is predicted from a selected reconstructed video signal to obtain a residual video signal. The encoder needs to decide which predictive coding mode to choose for the current coding unit (or coding block) and inform the decoder. Intra-frame prediction refers to the predicted signal coming from a region within the same image that has already been encoded and reconstructed; inter-frame prediction refers to the predicted signal coming from another encoded image (called a reference image) that is different from the current image.

[0046] Transform and Quantization: After the residual video signal undergoes transformation operations such as Discrete Fourier Transform (DFT) and Discrete Cosine Transform (DCT), the signal is transformed into the transform domain, and these are called transform coefficients. The transform coefficients are then subjected to lossy quantization, losing some information to make the quantized signal more suitable for compression. In some video coding standards, there may be more than one transform method to choose from. Therefore, the encoder needs to select one of the transform methods for the current coding unit (or coding block) and inform the decoder. The fineness of quantization is usually determined by the quantization parameter (QP). A larger QP value means that coefficients with a wider range of values ​​will be quantized into the same output, which usually leads to greater distortion and a lower bit rate. Conversely, a smaller QP value means that coefficients with a smaller range of values ​​will be quantized into the same output, which usually leads to less distortion and a higher bit rate.

[0047] Entropy coding, or statistical coding, involves statistically compressing the quantized transform-domain signal based on the frequency of each value, ultimately outputting a binary (0 or 1) compressed bitstream. Simultaneously, other information generated during encoding, such as the selected coding mode and motion vector data, also requires entropy coding to reduce the bit rate. Statistical coding is a lossless coding method that effectively reduces the bit rate required to represent the same signal. Common statistical coding methods include Variable Length Coding (VLC) and Content-Adaptive Binary Arithmetic Coding (CABAC).

[0048] Context-Based Binary Arithmetic Coding (CABAC) primarily involves three steps: binarization, context modeling, and binary arithmetic coding. After binarizing the input syntax elements, the binary data can be encoded using either a regular coding mode or a bypass coding mode. The bypass coding mode eliminates the need to assign a specific probability model to each binary bit; the input binary bit bin value is directly encoded using a simple bypass encoder, thus accelerating the overall encoding and decoding speed. Generally, different syntax elements are not completely independent, and even identical syntax elements possess a certain degree of memory. Therefore, according to conditional entropy theory, using other encoded syntax elements for conditional coding can further improve coding performance compared to independent coding or memoryless coding. This encoded symbol information used as conditions is called the context. In the regular coding mode, the binary bits of the syntax elements sequentially enter the context modeler. The encoder assigns an appropriate probability model to each input binary bit based on the values ​​of previously encoded syntax elements or binary bits; this process is called context modeling. The context model corresponding to a grammatical element can be located using the context index increment (ctxIdxInc) and the context index start (ctxIdxStart). After the bin value and the assigned probability model are fed into the binary arithmetic encoder for encoding, the context model needs to be updated based on the bin value, which is the adaptive process in encoding.

[0049] Loop Filtering: The transformed and quantized signal undergoes inverse quantization, inverse transform, and prediction compensation to obtain a reconstructed image. Due to the effects of quantization, the reconstructed image differs from the original image in some aspects, resulting in distortion. Therefore, filtering operations can be performed on the reconstructed image, such as deblocking filters (DB), sample adaptive offset (SAO), or adaptive loop filters (ALF), to effectively reduce the distortion caused by quantization. Since these filtered reconstructed images will serve as a reference for subsequent coded images to predict future image signals, the aforementioned filtering operations are also called loop filtering, i.e., filtering operations within the coding loop.

[0050] In one embodiment of this application, Figure 3 A basic flowchart of a video encoder is shown, illustrating the process using intra-frame prediction as an example. The original image signal s...k [x,y] and the predicted image signal Perform the difference operation to obtain the residual signal u. k [x,y], residual signal u k After transformation and quantization, [x,y] is obtained as quantization coefficients. These coefficients are then used to obtain the encoded bitstream through entropy encoding, and to obtain the reconstructed residual signal u' through inverse quantization and inverse transform. k [x,y], predict image signal With the reconstructed residual signal u' k [x,y] superimposed to generate image signals Image signal On one hand, the signal is input to the intra-frame mode decision module and the intra-frame prediction module for intra-frame prediction processing; on the other hand, the reconstructed image signal s' is output through loop filtering. k [x,y], reconstruct the image signal s' k [x,y] can be used as a reference image for the next frame for motion estimation and motion compensation prediction. Then, based on the result s' of the motion compensation prediction... r [x+m x ,y+m y ] and intra-frame prediction results Obtain the predicted image signal for the next frame. And continue repeating the above process until the coding is complete.

[0051] Based on the above encoding process, at the decoding end, for each encoding unit (or encoding block), after acquiring the compressed bitstream (i.e., bitstream), entropy decoding is performed to obtain various mode information and quantization coefficients. Then, the quantization coefficients undergo inverse quantization and inverse transform processing to obtain the residual signal. On the other hand, based on the known encoding mode information, the prediction signal corresponding to the encoding unit (or encoding block) can be obtained. Then, the residual signal and the prediction signal are added together to obtain the reconstructed signal. The reconstructed signal then undergoes loop filtering and other operations to generate the final output signal.

[0052] In the field of coding technology, inter-frame prediction utilizes the correlation in the temporal domain of video, using pixels from neighboring encoded images to predict pixels in the current image. This effectively removes temporal redundancy and saves bits of encoded residual data. For example... Figure 4 As shown, P represents the current frame, Pr represents the reference frame, B represents the current coded block, and Br represents the reference block of B. The coordinates of B' in the reference frame are the same as the coordinates of B in the current frame, and the coordinates of Br are (x... r ,y r The coordinates of B' are (x, y). The displacement between the current coded block and its reference block is called the motion vector MV, where MV = (x, y). r -x,yr -y). In other words, inter-frame prediction refers to the process of searching for a reference block in neighboring encoded images (i.e., reference frames) based on the current block to be encoded in the current frame, with the aim of removing temporal redundancy in the video signal. For example... Figure 5 As shown, the current block to be encoded in the current frame is searched within a certain range in the reference frame (i.e., the search area formed by the search box) according to the block matching criteria to obtain the best matching block. Optionally, commonly used block matching criteria in video coding include: minimum mean square error (MSE), sum of absolute differences (SAD), and other matching criteria.

[0053] Considering the strong correlation between neighboring blocks in the temporal or spatial domains, MV prediction techniques can be used to further reduce the bits required to encode MVs. In some audio and video standards, such as H.265 / HEVC, inter-frame prediction includes two MV prediction techniques: Merge and Advanced Motion Vector Prediction (AMVP). Merge mode creates a candidate MV list for the current block, for example, there can be 5 candidate MVs (and their corresponding reference images). These 5 candidate MVs are traversed, and the one with the lowest rate-distortion cost is selected as the optimal MV. If the codec creates the MV candidate list in the same way, the encoder only needs to transmit the index of the optimal MV in the candidate list. It is worth noting that HEVC's MV prediction technique also has a skip mode, which is a special case of Merge mode. After finding the optimal MV using Merge mode, if the current block and the reference block are essentially the same, then residual data does not need to be transmitted; only the MV index and a skip flag need to be transmitted.

[0054] Similarly, the AMVP mode utilizes the correlation of motion vector predictions (MVs) between neighboring blocks in the spatial and temporal domains to establish a candidate predicted MV list for the current block. Unlike the Merge mode, the AMVP mode selects the optimal predicted MV from the candidate predicted MV list and performs differential encoding with the optimal MV obtained through motion search for the current block, i.e., encoded MVD = MV - MVP. The decoder, by establishing the same list, only needs the MVP (Motion Vector Predictor)'s index in the list and the MVD (Motion Vector Difference) to calculate the MV of the current block. The AMVP candidate MV list also includes both spatial and temporal domain scenarios.

[0055] As mentioned earlier, in the motion estimation process of inter-frame prediction technology, it is necessary to select an "optimal" position from multiple possible candidate positions as the inter-frame prediction block for the current block based on the cost function. The cost function typically includes pixel distortion (D) for block matching and coding cost (R) for motion vectors, and can be expressed as J = D + λ × R, where J represents the cost function and λ represents the parameter that balances pixel distortion D and coding cost R at different bit rates.

[0056] Generally, the final selection of the motion compensation matching position is not based on minimizing either the D or R cost, but rather on minimizing the weighted average of the two, i.e., the matching position with the minimum cost function J. However, the predicted block position selected when the cost function is minimized may not be the optimal one in terms of block compensation (prediction) effect. This leads to inaccurate motion vectors and affects video encoding / decoding efficiency. Based on this, the technical solution of this application can optimize the original motion vector of the current block to reduce pixel distortion, thereby improving the accuracy of the optimized motion vector and improving video encoding / decoding efficiency.

[0057] The implementation details of the technical solutions in the embodiments of this application are described in detail below:

[0058] Figure 6 A flowchart of a video decoding method according to an embodiment of this application is shown. This video decoding method can be executed by a device with computing processing capabilities, such as a terminal device or a server. (Refer to...) Figure 6 As shown, this video decoding method includes at least S610 to S630, which are described in detail below:

[0059] In S610, the video stream is decoded to obtain the original motion vector of the current block.

[0060] In some optional embodiments, the video contains a sequence of video image frames, which includes a series of images. Each image can be further divided into slices, and each slice can be further divided into a series of LCUs (or CTUs). Each LCU contains several CUs. Video image frames are encoded in blocks. In some newer video coding standards, such as H.264, there are macroblocks (MBs), which can be further divided into multiple prediction blocks for predictive coding. In the HEVC standard, basic concepts such as coding units (CUs), prediction units (PUs), and transform units (TUs) are used to functionally divide various block units, and a novel tree-based structure is used for description. For example, a CU can be divided into smaller CUs according to a quadtree, and these smaller CUs can be further divided to form a quadtree structure. In the embodiments of this application, the current block, reference block, and adjacent block can be CUs, or blocks smaller than CUs, such as smaller blocks obtained by dividing CUs.

[0061] Optionally, the current block uses an inter-frame prediction mode, such as Merge mode or AMVP prediction mode.

[0062] In some optional embodiments, if the current block uses the Merge mode, the video stream can be decoded to obtain the motion vector index of the current block, and then the original motion vector of the current block can be determined from the motion vector candidate list (i.e., the Merge list) corresponding to the current block based on the motion vector index of the current block.

[0063] In some optional embodiments, if the current block uses the AMVP mode, the video stream can be decoded to obtain the predicted motion vector index and motion vector residual (MVD) of the current block. Then, based on the predicted motion vector index, the predicted motion vector of the current block is determined from the candidate list of predicted motion vectors corresponding to the current block. Finally, based on the predicted motion vector and motion vector residual of the current block, the original motion vector of the current block is determined. Optionally, the sum of the predicted motion vector and the motion vector residual is the original motion vector of the current block.

[0064] In S620, based on the original motion vector of the current block, a target prediction position is selected from multiple specified positions where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold.

[0065] In some alternative embodiments, the specified multiple locations may be locations associated with the original motion vector of the current block, such as multiple locations that can be determined near the location indicated by the original motion vector of the current block.

[0066] In some optional embodiments, if the current block uses the Merge mode, then the specified multiple locations can include the locations indicated by each candidate motion vector in the motion vector candidate list (i.e., the Merge list). In this case, when selecting the target prediction location, a target motion vector with a coding cost higher than the original motion vector and pixel distortion less than a set threshold can be selected from the motion vector candidate list. The location indicated by this target motion vector is the target prediction location. It should be noted that the coding cost can be the coding rate (i.e., R in the above embodiments), and the pixel distortion can be Distortion (i.e., D in the above embodiments).

[0067] In some optional embodiments, if the index value in the motion vector candidate list is positively correlated with the encoding cost, then a set of candidate motion vectors with an index value greater than the motion vector index of the current block can be determined from the motion vector candidate list. Here, the motion vector index of the current block is the index of the original motion vector in the above embodiments, and the encoding cost of the candidate motion vectors in this set is greater than the encoding cost of the original motion vector in the current block. Then, candidate motion vectors with pixel distortion less than a set threshold can be selected as target motion vectors from the candidate motion vector set. Optionally, the candidate motion vector with the smallest pixel distortion can be selected as the target motion vector from the candidate motion vector set.

[0068] In some optional embodiments, if the current block uses the AMVP mode, the specified multiple locations can be locations contained within a location region determined based on the motion vector residual, centered on the location indicated by the predicted motion vector of the current block. In this case, the process of selecting the target predicted location can be to search for locations within the location region determined based on the motion vector residual, centered on the location indicated by the predicted motion vector, where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold, and then use the searched locations as the target predicted locations.

[0069] In some optional embodiments, if the magnitude of the motion vector residual is positively correlated with the magnitude of the encoding cost, a circular region with the magnitude of the motion vector residual as the radius and the position indicated by the predicted motion vector as the center can be determined. Then, the region outside the circular region within the set size region determined with the position indicated by the predicted motion vector as the center can be used as the target location region. In this target location region, the position where the pixel distortion is less than a set threshold can be searched.

[0070] Optionally, the location with the least pixel distortion can be searched within the target location area, and the searched location can be used as the target predicted location.

[0071] In some optional embodiments, if the sum of the absolute values ​​of the horizontal and vertical coordinates of the motion vector residuals is positively correlated with the magnitude of the encoding cost, a circular region with the position indicated by the predicted motion vector as the center and the sum of the absolute values ​​of the horizontal and vertical coordinates of the motion vector residuals as the radius can be determined. Then, the region outside the circular region within the set size region determined with the position indicated by the predicted motion vector as the center can be used as the target location region. In this target location region, the position where the pixel distortion is less than a set threshold can be searched.

[0072] Optionally, the location with the least pixel distortion can be searched within the target location area, and the searched location can be used as the target predicted location.

[0073] In S630, the updated motion vector of the current block is determined based on the predicted position of the target, and motion compensation processing is performed on the current block based on the updated motion vector.

[0074] In some optional embodiments, after determining the target prediction position, the displacement between the current block's position in the current image and the target prediction position can be used as the updated motion vector of the current block. Then, motion compensation processing can be performed on the current block based on the updated motion vector. Since the encoding cost (i.e., encoding rate) of the updated motion vector is greater than the encoding cost of the original motion vector of the current block, and the pixel distortion is less than a set threshold, motion compensation processing on the current block based on the updated motion vector can improve the effect of motion compensation, thereby improving the efficiency of video encoding and decoding.

[0075] In some optional embodiments, after determining the updated motion vector of the current block, the updated motion vector of the current block can be stored as a Temporal Motion Vector Prediction (TMVP). TMVP is a temporal motion vector prediction method that uses motion information of the corresponding position of the current block in the encoded neighboring images (corresponding images) to predict the motion vector of the current block. This method helps reduce the amount of motion vector data transmitted, thereby improving coding efficiency.

[0076] In some alternative embodiments, after determining the updated motion vector of the current block, the original motion vector of the current block can be used as the predicted motion vector of the subsequent blocks; or it can be used only for motion compensation processing of the current block, without being used for the predicted motion vector of the subsequent blocks.

[0077] Figure 6 This description focuses on the technical solutions of the embodiments of this application from the perspective of video decoding. The following is a combination of... Figure 7 The technical solutions of the embodiments of this application will be described again from the perspective of video encoding.

[0078] Figure 7 A flowchart of a video encoding method according to an embodiment of this application is shown. This video encoding method can be executed by a device with computing processing capabilities, such as a terminal device or a server. (Refer to...) Figure 7 As shown, this video encoding method includes at least S710 to S730, which are detailed below:

[0079] In S710, the original motion vector of the current block is determined.

[0080] In S720, based on the original motion vector, the target prediction position is selected from multiple specified positions where the encoding cost is higher than that of the original motion vector and the pixel distortion is less than a set threshold.

[0081] In S730, the updated motion vector of the current block is determined based on the target predicted position, and motion compensation processing is performed on the current block based on the updated motion vector.

[0082] It should be noted that the processing at the video encoding end is similar to that at the video decoding end. For details, please refer to the aforementioned processing at the decoding end, which will not be repeated here.

[0083] In summary, the technical solution of this application mainly involves searching in the direction of increasing the cost of motion vector coding (such as coding rate) during motion estimation, thereby finding the prediction position that can reduce block matching distortion and improve pixel prediction accuracy. After obtaining the prediction value and residual data of the current block, the decoder can reconstruct the reconstructed block, and then compare the reconstructed block with the prediction blocks at different positions in the reference frame to find the position with the minimum pixel distortion, which is then used as the updated motion vector for the current block.

[0084] In some optional embodiments, the decoder has two ways to obtain the motion vector of the current block: whether motion vector residual (MVD) exists.

[0085] If the current block uses the Merge mode, the positions in the motion vector prediction list (merge list) can be re-evaluated. In this case, the predicted motion vector value is the final motion vector, without MVD. Optionally, assuming that the index encoding of the merge list is such that the larger the index value, the greater the encoding cost, the predicted position pointed to by the index after the current index (i.e., the index of the original MV of the current block) (i.e., the encoding cost is higher than the current index) can be evaluated. Then, compared with the position pointed to by the motion vector corresponding to the current index, the MV corresponding to the position with the smallest pixel distortion is selected as the updated motion vector of the current block.

[0086] If the current block uses the AMVP mode, then the motion vector prediction value needs to be added to the MVD to obtain the final motion vector. After evaluating the MVD encoding cost of the current block, a matching search is performed in the region where the encoding cost is greater than the MVD value to obtain a prediction matching block with less distortion for the current block.

[0087] For example, suppose the cost of MVD encoding increases with the magnitude of MVD. MVD increases with size x and MVD y These represent the x and y coordinates of MVD, respectively. For example... Figure 8 As shown, in the reference image, within a certain size region (search range) T outside a circle centered at the position indicated by the MVP and with the MVD amplitude as the radius, a matching search is performed between the current block and reference blocks at various positions. This search is simultaneously constrained by the defined region T (i.e., ... Figure 8 The area within the box shown (excluding the area around the circle) is subject to size restrictions.

[0088] For example, suppose the cost of MVD encoding increases with |MVD x |+|MVD y |Increases in size and grows larger, MVD x and MVD y Let x and y represent the x and y coordinates of MVD, respectively. Then, centered at the position indicated by MVP, we can take values ​​greater than |MVD|. x |+|MVD y A certain size region T outside the current block is used to perform a matching search between the current block and reference blocks at various locations. The search process is also limited by the size of the defined region T.

[0089] The matching search process described above requires finding the optimal position with minimal pixel distortion, and then determining the updated motion vector for the current block based on the optimal position. The search process can be represented by the following formula:

[0090] min{D(MVD(i))|MVD(i)∈T,R(MVD(i) x ,MVD(i) y )>R(MVD x MVD y )}

[0091] Among them, R(MVD) x MVD y ) represents the encoding cost (e.g., encoding rate) at the decoded MVD position. D(MVD(i)) represents the pixel distortion of the reference block and the current block at the MVD(i) position; the smaller the value, the more similar the two are. T represents the search area.

[0092] In some optional embodiments, the updated motion vectors described above can be used for motion compensation of the current block and can also be used for motion vector prediction values ​​of future coded blocks.

[0093] In some alternative embodiments, the updated motion vectors described above may not be used to predict subsequent coding blocks of the current image, and the original decoded motion vectors may still be used as prediction values ​​for subsequent coding blocks.

[0094] In some alternative embodiments, the updated motion vectors described above can be stored as temporal motion vector predictions (TMVPs) to predict the motion vectors (MVs) of future image frames.

[0095] It should be noted that the technical solutions of the above embodiments of this application, by optimizing the original motion vector of the current block, can reduce pixel distortion, thereby improving the accuracy of the optimized motion vector and thus improving video encoding and decoding efficiency. The technical solutions of the various embodiments shown above can be used individually or in combination. Furthermore, the technical solutions of the embodiments of this application can be applied to video codecs or video compression and related products.

[0096] The following describes an apparatus embodiment of this application, which can be used to perform the methods described in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments described above.

[0097] Figure 9 A block diagram of a video decoding apparatus according to an embodiment of the present application is shown. The video decoding apparatus can be installed in a device with computing processing capabilities, such as a terminal device or a server.

[0098] Reference Figure 9 As shown, a video decoding apparatus 900 according to an embodiment of this application includes: a decoding unit 902, a selection unit 904, and a processing unit 906.

[0099] The decoding unit 902 is configured to decode the video stream to obtain the original motion vector of the current block; the selection unit 904 is configured to select a target prediction position from multiple specified positions based on the original motion vector, where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; the processing unit 906 is configured to determine the updated motion vector of the current block based on the target prediction position, and to perform motion compensation processing on the current block based on the updated motion vector.

[0100] In some embodiments of this application, based on the foregoing scheme, the decoding unit 902 is configured to: decode the video bitstream to obtain the motion vector index of the current block; and determine the original motion vector of the current block based on the motion vector index in the motion vector candidate list corresponding to the current block.

[0101] In some embodiments of this application, based on the foregoing scheme, the specified multiple locations include the locations indicated by each candidate motion vector in the motion vector candidate list;

[0102] The selection unit 904 is configured to: select a target motion vector from the motion vector candidate list whose encoding cost is higher than the encoding cost of the original motion vector and whose pixel distortion is less than a set threshold, wherein the target predicted position is the position indicated by the target motion vector.

[0103] In some embodiments of this application, based on the foregoing scheme, the selection unit 904 is configured to: if the index value in the motion vector candidate list is positively correlated with the encoding cost, then determine a set of candidate motion vectors in the motion vector candidate list whose index value is greater than the motion vector index of the current block; and select a candidate motion vector from the candidate motion vector set whose pixel distortion is less than a set threshold as the target motion vector.

[0104] In some embodiments of this application, based on the foregoing scheme, the selection unit 904 is configured to: select the candidate motion vector with the smallest pixel distortion from the candidate motion vector set as the target motion vector.

[0105] In some embodiments of this application, based on the foregoing scheme, the decoding unit 902 is configured to: perform decoding processing on the video bitstream to obtain the predicted motion vector index and motion vector residual of the current block; determine the predicted motion vector of the current block based on the predicted motion vector index in the predicted motion vector candidate list corresponding to the current block; and determine the original motion vector of the current block based on the predicted motion vector of the current block and the motion vector residual.

[0106] In some embodiments of this application, based on the foregoing scheme, the selection unit 904 is configured to: search for a location in the location region determined based on the motion vector residual, centered on the location indicated by the predicted motion vector, where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; wherein, the specified multiple locations include the determined location region; and the searched location is used as the target predicted location.

[0107] In some embodiments of this application, based on the foregoing scheme, the selection unit 904 is configured as follows: if the magnitude of the motion vector residual is positively correlated with the magnitude of the encoding cost, then a circular region with the position indicated by the predicted motion vector as the center and the magnitude of the motion vector residual as the radius is determined; the region other than the circular region within the set size region determined with the position indicated by the predicted motion vector as the center is taken as the target position region; and in the target position region, a position where the pixel distortion is less than a set threshold is searched.

[0108] In some embodiments of this application, based on the foregoing scheme, the selection unit 904 is configured as follows: if the sum of the absolute values ​​of the horizontal and vertical coordinates of the motion vector residuals is positively correlated with the magnitude of the encoding cost, then a circular region is determined with the position indicated by the predicted motion vector as the center and the sum of the absolute values ​​of the horizontal and vertical coordinates of the motion vector residuals as the radius; the region other than the circular region within the set size region determined with the position indicated by the predicted motion vector as the center is taken as the target position region; in the target position region, the position where the pixel distortion is less than a set threshold is searched.

[0109] In some embodiments of this application, based on the foregoing scheme, the selection unit 904 is configured to: search for the position with the least pixel distortion in the target position region, and use the searched position as the target predicted position.

[0110] In some embodiments of this application, based on the foregoing scheme, the processing unit 906 is further configured to: after determining the updated motion vector of the current block, store the updated motion vector of the current block as a temporal motion vector prediction value.

[0111] In some embodiments of this application, based on the foregoing scheme, the processing unit 906 is further configured to: use the original motion vector of the current block as the predicted motion vector of the subsequent block.

[0112] Figure 10 A block diagram of a video encoding apparatus according to an embodiment of the present application is shown. The video encoding apparatus can be installed in a device with computing processing capabilities, such as a terminal device or a server.

[0113] Reference Figure 10 As shown, a video encoding apparatus 1000 according to an embodiment of this application includes: a determining unit 1002, a selecting unit 1004, and a processing unit 1006.

[0114] The determining unit 1002 is configured to determine the original motion vector of the current block; the selecting unit 1004 is configured to select a target prediction position from a specified number of positions based on the original motion vector, wherein the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; and the processing unit 1006 is configured to determine the updated motion vector of the current block based on the target prediction position, and to perform motion compensation processing on the current block based on the updated motion vector.

[0115] Figure 11 A schematic diagram of a computer system suitable for implementing an electronic device according to the embodiments of this application is shown. The electronic device may be a video encoding device or a video decoding device as described in the foregoing embodiments.

[0116] It should be noted that, Figure 11 The computer system 1100 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0117] like Figure 11 As shown, the computer system 1100 may include a Central Processing Unit (CPU) 1101, which can perform various appropriate actions and processes based on a program stored in Read-Only Memory (ROM) 1102 or a program loaded from storage portion 1108 into Random Access Memory (RAM) 1103, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in RAM 1103. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via bus 1104. An input / output (I / O) interface 1105 is also connected to bus 1104.

[0118] The following components can be connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1110 as needed so that computer programs read from them can be installed into storage section 1108 as needed.

[0119] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit (CPU) 1101, it performs various functions defined in the system of this application.

[0120] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a computer program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0121] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and a computer program.

[0122] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0123] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more computer programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.

[0124] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0125] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, and includes several instructions to cause an electronic device to execute the method according to the embodiments of this application.

[0126] For example, an electronic device can be a video decoding device, then the video decoding device can perform... Figure 6 The video decoding method shown; for example, an electronic device can be a video encoding device, then the video encoding device can perform... Figure 7 The video encoding method shown.

[0127] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0128] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A video decoding method, characterized in that, include: The video stream is decoded to obtain the original motion vector of the current block; Based on the original motion vector, select a target prediction position from multiple specified positions where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; Based on the predicted target position, the updated motion vector of the current block is determined, and motion compensation processing is performed on the current block based on the updated motion vector.

2. The video decoding method according to claim 1, characterized in that, The video stream is decoded to obtain the original motion vector of the current block, including: The video stream is decoded to obtain the motion vector index of the current block; Based on the motion vector index, the original motion vector of the current block is determined from the motion vector candidate list corresponding to the current block.

3. The video decoding method according to claim 2, characterized in that, The specified multiple locations include the locations indicated by each candidate motion vector in the candidate list of motion vectors; Based on the motion vector of the current block, select target prediction locations from multiple specified locations where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold, including: In the candidate list of motion vectors, a target motion vector with an encoding cost higher than that of the original motion vector and a pixel distortion less than a set threshold is selected, wherein the predicted target position is the position indicated by the target motion vector.

4. The video decoding method according to claim 3, characterized in that, In the candidate list of motion vectors, target motion vectors with encoding costs higher than those of the original motion vector and pixel distortion less than a set threshold are selected, including: If the index value in the motion vector candidate list is positively correlated with the encoding cost, then a set of candidate motion vectors with an index value greater than the motion vector index of the current block is determined in the motion vector candidate list. The candidate motion vector with pixel distortion less than a set threshold is selected from the set of candidate motion vectors as the target motion vector.

5. The video decoding method according to claim 4, characterized in that, Selecting candidate motion vectors with pixel distortion less than a set threshold from the candidate motion vector set as the target motion vector includes: The candidate motion vector with the smallest pixel distortion is selected from the set of candidate motion vectors as the target motion vector.

6. The video decoding method according to claim 1, characterized in that, The video stream is decoded to obtain the original motion vector of the current block, including: The video stream is decoded to obtain the predicted motion vector index and motion vector residual of the current block; Based on the predicted motion vector index, the predicted motion vector of the current block is determined from the predicted motion vector candidate list corresponding to the current block; Based on the predicted motion vector of the current block and the motion vector residual, the original motion vector of the current block is determined.

7. The video decoding method according to claim 6, characterized in that, Based on the original motion vector of the current block, select target prediction locations from multiple specified locations where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold, including: Centered on the location indicated by the predicted motion vector, within the location region determined based on the motion vector residual, a location is searched where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; wherein, the specified plurality of locations includes the determined location region; The searched location is used as the predicted target location.

8. The video decoding method according to claim 7, characterized in that, Within the location region determined based on the motion vector residual and centered on the location indicated by the predicted motion vector, the search includes locations where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold, including: If the magnitude of the motion vector residual is positively correlated with the magnitude of the encoding cost, then a circular region with the predicted motion vector indicating the position as the center and the magnitude of the motion vector residual as the radius is determined. The area outside the circular region within a defined area of ​​a set size, centered on the position indicated by the predicted motion vector, is designated as the target location area. Within the target location region, search for locations where pixel distortion is less than a set threshold.

9. The video decoding method according to claim 7, characterized in that, Within the location region determined based on the motion vector residual and centered on the location indicated by the predicted motion vector, the search includes locations where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold, including: If the sum of the absolute values ​​of the horizontal and vertical coordinates of the motion vector residuals is positively correlated with the magnitude of the encoding cost, then a circular region is determined with the position indicated by the predicted motion vector as the center and the sum of the absolute values ​​of the horizontal and vertical coordinates of the motion vector residuals as the radius. The area outside the circular region within a defined area of ​​a set size, centered on the position indicated by the predicted motion vector, is designated as the target location area. Within the target location region, search for locations where pixel distortion is less than a set threshold.

10. The video decoding method according to claim 8 or 9, characterized in that, Within the target location region, locations where pixel distortion is less than a set threshold include: Within the target location region, the location with the minimum pixel distortion is searched, and the searched location is used as the predicted target location.

11. The video decoding method according to any one of claims 1 to 9, characterized in that, The video decoding method further includes: After determining the updated motion vector of the current block, the updated motion vector of the current block is stored as a temporal motion vector prediction value.

12. The video decoding method according to any one of claims 1 to 9, characterized in that, The video decoding method further includes: The original motion vector of the current block is used as the predicted motion vector for the subsequent block.

13. A video encoding method, characterized in that, include: Determine the original motion vector of the current block; Based on the original motion vector, select a target prediction position from multiple specified positions where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold; Based on the predicted target position, the updated motion vector of the current block is determined, and motion compensation processing is performed on the current block based on the updated motion vector.

14. A video decoding device, characterized in that, include: The decoding unit is configured to decode the video bitstream to obtain the original motion vector of the current block; The selection unit is configured to select, based on the original motion vector, a target prediction position from a specified number of positions where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold. The processing unit is configured to determine the updated motion vector of the current block based on the target predicted position, and to perform motion compensation processing on the current block based on the updated motion vector.

15. A video encoding device, characterized in that, include: Determine the unit, configured to determine the original motion vector of the current block; The selection unit is configured to select, based on the original motion vector, a target prediction position from a specified number of positions where the encoding cost is higher than the encoding cost of the original motion vector and the pixel distortion is less than a set threshold. The processing unit is configured to determine the updated motion vector of the current block based on the target predicted position, and to perform motion compensation processing on the current block based on the updated motion vector.

16. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the video decoding method of any one of claims 1 to 12; or implements the video encoding method of claim 13.

17. An electronic device, characterized in that, include: One or more processors; A memory for storing one or more computer programs that, when executed by one or more processors, cause the electronic device to implement the video decoding method of any one of claims 1 to 12; or to implement the video encoding method of claim 13.

18. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium. The processor of the electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the video decoding method of any one of claims 1 to 12; or implement the video encoding method of claim 13.