Video encoding methods, video decoding methods, devices, equipment and storage media
By acquiring multiple matching blocks and determining the prediction block of the current block based on different prediction modes, the problem of insufficient intra-frame prediction accuracy is solved, thus improving the performance of video encoding and decoding.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT DIGITAL TIANJIN
- Filing Date
- 2024-11-25
- Publication Date
- 2026-05-26
AI Technical Summary
In existing video coding technologies, intra-frame prediction accuracy is poor, which affects video encoding and decoding performance.
By acquiring at least one first matching block and at least one second matching block, the prediction block of the current block is determined based on different prediction modes, thereby improving the accuracy of intra-frame prediction.
It improves the performance of video encoding and decoding and enhances the accuracy of intra-frame prediction.
Smart Images

Figure CN122093569A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to a video encoding method, a video decoding method, an apparatus, a device, and a storage medium. Background Technology
[0002] In current video compression technologies, such as VVC (Versatile Video Coding) and AVS3 (Audio Video Coding Standard 3), the possibility of similar textures appearing multiple times, such as the same letter appearing multiple times, is taken into account. To improve coding performance, similar textures that have already been encoded are used to predict the current coding unit (i.e., the current block).
[0003] In related technologies, intra-frame prediction is used to search within a given coded region within the frame to find the block most similar to the current coding unit, which is then used as the prediction block for the current coding unit. The current coding unit is then encoded using the prediction residual between the prediction block and the current coding unit.
[0004] However, in the aforementioned related technologies, directly searching from a given encoded region to obtain the block closest to the current coding unit results in poor accuracy of intra-frame prediction, thus affecting the performance of video encoding and decoding. Summary of the Invention
[0005] This application provides a video encoding method, a video decoding method, an apparatus, a device, and a storage medium, which can improve the accuracy of intra-frame prediction, thereby improving the performance of video encoding and decoding. The technical solution is as follows:
[0006] According to one aspect of the embodiments of this application, a video encoding method is provided, the method comprising:
[0007] For the current block within a video frame, at least one first matching block is obtained, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode;
[0008] Based on the at least one first matching block, at least one second matching block is obtained, and there exists at least one first matching block with a number of second matching blocks greater than or equal to 1. The second matching block is an encoded block that matches the first matching block based on the second prediction mode.
[0009] The prediction block corresponding to the current block is determined from the at least one first matching block and the at least one second matching block;
[0010] The current block is encoded based on the prediction block corresponding to the current block.
[0011] According to one aspect of the embodiments of this application, a video decoding method is provided, the method comprising:
[0012] For the current block within a video frame, obtain the encoding information of the current block;
[0013] Based on the encoding information of the current block, a prediction block corresponding to the current block is determined. The prediction block is either a first matching block or a second matching block. The first matching block is a decoded block that matches the current block based on a first prediction mode, and the second matching block is a decoded block that matches the first matching block based on a second prediction mode.
[0014] Decode the current block based on the prediction block corresponding to the current block.
[0015] According to one aspect of the embodiments of this application, a video encoding / decoding apparatus is provided, the apparatus comprising:
[0016] The first acquisition module is used to acquire at least one first matching block for the current block in a video frame, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode;
[0017] The second acquisition module is used to acquire at least one second matching block based on the at least one first matching block, wherein there exists at least one first matching block and the number of second matching blocks corresponding to it is greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block based on the second prediction mode.
[0018] A prediction block determination module is used to determine the prediction block corresponding to the current block from the at least one first matching block and the at least one second matching block;
[0019] The encoding module is used to encode the current block based on the prediction block corresponding to the current block.
[0020] According to one aspect of the embodiments of this application, a video encoding and decoding apparatus is provided, the apparatus comprising:
[0021] The acquisition module is used to acquire the encoding information of the current block within a video frame;
[0022] The decoding module is used to determine the prediction block corresponding to the current block based on the encoding information of the current block. The prediction block is either a first matching block or a second matching block. The first matching block is a decoded block that matches the current block based on a first prediction mode, and the second matching block is a decoded block that matches the first matching block based on a second prediction mode.
[0023] The decoding module is further configured to decode the current block based on the prediction block corresponding to the current block.
[0024] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-described video encoding method or video decoding method.
[0025] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program and a video stream are stored in the computer program, wherein the computer program is executed by a processor to implement the above-described video encoding method to generate the video stream; or, the computer program is executed by a processor to implement the above-described video decoding method to decode the video stream.
[0026] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program, the computer program being loaded and executed by a processor to implement the above-described video encoding method or video decoding method.
[0027] This application also provides a method for generating a video stream, wherein the video stream is obtained by encoding video data using the above-described video encoding method.
[0028] This application also provides a method for processing video streams, wherein the video streams are processed using the above-described video decoding method to obtain video data.
[0029] The technical solutions provided in this application embodiment may have the following beneficial effects:
[0030] For the current block (i.e., the current coding unit) within a video frame, not only is a first matching block determined by a first prediction mode that matches the current block acquired, but a second matching block that matches the first matching block is also acquired. From at least one first matching block and at least one second matching block, a prediction block that matches the current block is determined. Compared to related technologies that directly search for prediction blocks from the encoded region, the technical solution provided in this application, based on the first matching block, further acquires matching blocks of the first matching block, determining the prediction block that matches the current block from at least two matching blocks (including the first and second matching blocks). With more matching block choices compared to related technologies, this application also achieves higher accuracy in intra-frame prediction, thereby improving video encoding and decoding performance. Attached Figure Description
[0031] Figure 1 This application exemplarily illustrates a basic flowchart of a video encoding process;
[0032] Figure 2 This is a simplified block diagram of a communication system provided in one embodiment of this application;
[0033] Figure 3 This is a schematic diagram illustrating the placement of a video encoder and a video decoder in a streaming environment, as exemplarily shown in this application.
[0034] Figure 4 This is a schematic diagram showing the same letter appearing multiple times in a document provided in one embodiment of this application;
[0035] Figure 5 This is a schematic diagram of an IBC (Intra Block Copy) prediction mode provided in one embodiment of this application;
[0036] Figure 6 This is a schematic diagram of a prediction block determination method provided in one embodiment of this application;
[0037] Figure 7 This is a flowchart of a video encoding method provided in one embodiment of this application;
[0038] Figure 8 This is a flowchart of a video encoding method provided in another embodiment of this application;
[0039] Figure 9 This is a flowchart of a video encoding method provided in another embodiment of this application;
[0040] Figure 10 This is a flowchart of a video decoding method provided in one embodiment of this application;
[0041] Figure 11 This is a schematic diagram of an coded unit completely surrounding a first matching block, provided in one embodiment of this application;
[0042] Figure 12 This is a schematic diagram of a first matching block spanning multiple coded units provided in one embodiment of this application;
[0043] Figure 13 This is a flowchart of a video encoding / decoding method in a video call provided in one embodiment of this application;
[0044] Figure 14 This is a flowchart of a video encoding / decoding method in a video conferencing system provided in one embodiment of this application;
[0045] Figure 15 This is a flowchart of a video encoding / decoding method in a short video provided in one embodiment of this application;
[0046] Figure 16 This is a block diagram of a video encoding apparatus provided in one embodiment of this application;
[0047] Figure 17 This is a block diagram of a video decoding apparatus provided in one embodiment of this application;
[0048] Figure 18 This is a structural block diagram of a computer device provided in one embodiment of this application. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0050] Before describing the embodiments of this application, firstly, in conjunction with Figure 1 A brief introduction to video coding technology. Figure 1 An example is shown in a basic flowchart of a video encoding process.
[0051] A video signal is a sequence of images consisting of multiple frames. A frame represents the spatial information of a video signal. Taking YUV mode as an example, a frame includes a luminance sample matrix (Y) and two chrominance sample matrices (Cb and Cr). From the perspective of how video signals are acquired, they can be divided into two types: those captured by a camera and those generated by a computer. Due to differences in statistical characteristics, the corresponding compression coding methods may also differ.
[0052] In some mainstream video coding technologies, such as H.265 / HEVC (High Efficient Video Coding), H.266 / VVC (Versatile Video Coding), and AVS (Audio Video Coding Standard) (e.g., AVS3), a hybrid coding framework is used to perform a series of operations and processes on the input raw video signal:
[0053] 1. Block Partition Structure: The input image is divided into several non-overlapping processing units, each of which undergoes a similar compression operation. This processing unit is called a CTU (Coding Tree Unit) or LCU (Large Coding Unit). Further subdivisions can be made below the CTU to obtain one or more basic coding units, called CUs (Coding Units). Each CU is the most basic element in a coding process. The following describes the various coding methods that can be used for each CU.
[0054] 2. Predictive Coding: This 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 determine the most suitable predictive coding mode from among many possible modes for the current CU (i.e., the current block) and inform the decoder. Intra-frame prediction refers to predicting a signal from a region within the same image that has already been encoded and reconstructed. Inter-frame prediction refers to predicting a signal from another encoded image that is different from the current image (i.e., the current video frame).
[0055] 3. Transform Coding and Quantization: The residual video signal undergoes transform operations such as DFT (Discrete Fourier Transform) and DCT (Discrete Cosine Transform) to convert the signal into the transform domain, where the coefficients are called transform coefficients. In the transform domain, the signal undergoes further lossy quantization, losing some information to make the quantized signal more suitable for compression. Some video coding standards may offer more than one transform option; therefore, the encoder needs to select one transform for the current CU and inform the decoder. The fineness of quantization is usually determined by the quantization parameter. A larger QP (Quantization Parameter) value means that coefficients with a wider range of values will be quantized into the same output, which usually results in greater distortion and a lower bitrate. Conversely, a smaller QP value means that coefficients with a smaller range of values will be quantized into the same output, which usually results in less distortion and a higher bitrate.
[0056] 4. Entropy Coding or Statistical Coding: The quantized transform domain signal is statistically compressed and encoded 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 mode and motion vectors, 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) or Content-Adaptive Binary Arithmetic Coding (CABAC).
[0057] 5. Loop Filtering: An encoded image undergoes inverse quantization, inverse transform, and prediction compensation (the reverse operations of steps 2-4 above) to obtain a reconstructed decoded image. Compared to the original image, the reconstructed image differs in some information due to quantization, resulting in distortion. Filtering the reconstructed image, such as deblocking, SAO (Sample Adaptive Offset), or ALF (Adaptive Lattice Filter), can effectively reduce the distortion caused by quantization. Since these filtered reconstructed images will serve as a reference for subsequent encoded images to predict future signals, the above filtering operations are also called loop filtering, or filtering operations within the encoding loop.
[0058] As can be seen from the above encoding process, at the decoding end, for each CU, after obtaining the compressed bitstream, the decoder first performs entropy decoding to obtain various mode information and quantized transform coefficients. Each coefficient undergoes inverse quantization and inverse transform to obtain the residual signal. On the other hand, based on the known encoding mode information, the prediction signal corresponding to that CU can be obtained. After adding the two, the reconstructed signal is obtained. Finally, the reconstructed value of the decoded image needs to undergo a loop filtering operation to generate the final output signal.
[0059] Many mainstream video coding standards, such as HEVC, VVC, and AVS3, employ block-based hybrid coding frameworks. They divide the raw video data into a series of coded blocks and combine prediction, transform, and entropy coding methods to achieve video data compression. Motion compensation is a commonly used prediction method in video coding. Based on the redundancy characteristics of video content in the temporal or spatial domains, motion compensation derives the predicted value of the current block from the already coded regions. These prediction methods include inter-frame prediction, intra-frame block copy prediction, and intra-frame string copy prediction. In specific coding implementations, these prediction methods may be used individually or in combination. For coded blocks using these prediction methods, one or more two-dimensional displacement vectors are typically explicitly or implicitly encoded in the bitstream to indicate the displacement of the current block (or its sibling blocks) relative to one or more reference blocks.
[0060] The technical solutions provided in this application relate to the above-mentioned intra-frame prediction method, and the following explanations of the embodiments are provided for details.
[0061] like Figure 2The diagram illustrates a simplified block diagram of a communication system provided in one embodiment of this application. The communication system 200 includes a plurality of devices that can communicate with each other via, for example, a network 250. For example, the communication system 200 includes a first device 210 and a second device 220 interconnected via the network 250. Figure 2 In this embodiment, the first device 210 and the second device 220 perform unidirectional data transmission. For example, the first device 210 may encode video data, such as a video image stream captured by the first device 210, for transmission to the second device 220 via network 250. The encoded video data is transmitted in the form of one or more encoded video streams. The second device 220 may receive the encoded video data from network 250, decode the encoded video data to recover the video data, and display video images based on the recovered video data. Unidirectional data transmission is common in applications such as media services.
[0062] In another embodiment, the communication system 200 includes a third device 230 and a fourth device 240 that perform bidirectional transmission of encoded video data, which may occur, for example, during a video conference. For bidirectional data transmission, each of the third device 230 and the fourth device 240 may encode video data (e.g., a stream of video images captured by the device) for transmission over network 250 to the other device. Each of the third device 230 and the fourth device 240 may also receive encoded video data transmitted by the other 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.
[0063] exist Figure 2 In the embodiments described, the first device 210, the second device 220, the third device 230, and the fourth device 240 may be computer devices such as servers, personal computers, and smartphones, but the principles disclosed in this application are not limited to these. The embodiments of this application are applicable to PCs (Personal Computers), mobile phones, tablets, media players, and / or dedicated video conferencing equipment. Network 250 refers to any number of networks that transmit encoded video data between the first device 210, the second device 220, the third device 230, and the fourth device 240, including, for example, wired and / or wireless communication networks. Communication network 250 may exchange data in circuit-switched and / or packet-switched channels. This network may include telecommunications networks, local area networks, wide area networks, and / or the Internet. For the purposes of this application, unless explained below, the architecture and topology of network 250 may be irrelevant to the operation of the disclosures in this application.
[0064] As an example, Figure 3 The diagram illustrates the placement of a video encoder and a video decoder 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 TV, storing compressed video on digital media including CDs (Compact Discs), DVDs (Digital Versatile Discs), memory sticks, etc.
[0065] The streaming system may include an acquisition subsystem 313, which may include a video source 301 such as a digital camera, which creates an uncompressed video image stream 302. In an embodiment, the video image stream 302 includes samples captured by a digital camera. The video image stream 302 is depicted as a thick line to emphasize the high data volume of the video image stream compared to encoded video data 304 (or encoded video bitstream). The video image stream 302 may be processed by an electronic device 320, which includes a video encoder 303 coupled to the video source 301. The video encoder 303 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 304 (or encoded video bitstream 304) is depicted as a thin line to emphasize the lower data volume of the encoded video data 304 (or encoded video bitstream 304), which may be stored on a streaming server 305 for future use. One or more streaming client subsystems, such as Figure 3 Client subsystems 306 and 308 can access streaming server 305 to retrieve copies 307 and 309 of encoded video data 304. Client subsystem 306 may include, for example, a video decoder 310 in electronic device 330. Video decoder 310 decodes the incoming copy 307 of the encoded video data and produces an output video picture stream 311 that can be displayed on display 312 (e.g., a screen) or another presentation device (not depicted). In some streaming systems, the encoded video data 304, video data 307, and video data 309 (e.g., video stream) may be encoded according to certain video encoding / compression standards.
[0066] It should be noted that electronic devices 320 and 330 may include other components (not shown). For example, electronic device 320 may include a video decoder (not shown), and electronic device 330 may also include a video encoder (not shown). The video decoder is used to decode received encoded video data; the video encoder is used to encode the video data.
[0067] It should be noted that the technical solutions provided in this application can be applied to H.266 / VVC standards, H.265 / HEVC standards, AVS (such as AVS3), or next-generation video codec standards, and this application does not limit them.
[0068] It should also be noted that the execution entity for each step of the method provided in this application embodiment can be either a decoding end device or an encoding end device. The technical solutions provided in this application embodiment can be used in both video decoding and video encoding processes. Both the decoding end device and the encoding end device can be computer equipment, which refers to electronic devices with data computing, processing, and storage capabilities, such as PCs, mobile phones, tablets, media players, dedicated video conferencing equipment, servers, etc.
[0069] Furthermore, the method provided in this application can be used alone or in combination with other methods in any order. The encoder and decoder based on the method provided in this application can be implemented by one or more processors or one or more integrated circuits.
[0070] In some embodiments, similar textures may appear multiple times within a single video frame, and the same text or letters may appear multiple times. For example... Figure 4 As shown in the screen video demonstration, the same letter 410 appears multiple times. Therefore, it's possible to leverage already encoded similar textures for efficient prediction of the current block. For example, when encoding the current block 420, the previously encoded letter 410 can be referenced. Based on this, the IBC prediction mode was proposed for predicting repeating textures, thereby improving encoding quality.
[0071] For example, such as Figure 5 Sub-figure a shows a schematic diagram of the IBC prediction mode. Region 510 is the encoded region, which includes multiple CTUs. In some embodiments, region 510 is the area within the encoded region where the search range for the current block is defined by the standard. When encoding the current block 520, a search is performed within region 510 to find the block closest to the current block 520, which is then used as the prediction block 540 for the current block 520. The positional offset of the prediction block 540 relative to the current block 520 is called the block vector (BV) 530. Both the current block and the prediction block are within the current video frame. In IBC mode, the prediction block corresponding to the current block is determined using the block vector. For example, the difference in pixel values between the prediction block and the current block is determined as the prediction residual. The prediction residual is encoded and transmitted, and subsequent transform coding, quantization, entropy coding, and loop filtering are performed to complete the encoding process of the entire current block.
[0072] For example, such as Figure 5 As shown in subgraph b, region 550 (the cell containing coordinates m, n) is the CTU where the current block is located. Region 560 ( Figure 5 The area of gray cells in subgraph b, excluding region 550, is the CTU included within the search range of the current block.
[0073] IBC prediction methods in related technologies predict the value of a block by finding the block that best matches the current block within the search region. However, IBC prediction coding performance is poor due to limitations in the search range or the bit consumption of the block vector.
[0074] In some embodiments, such as Figure 6 The diagram illustrates a prediction block determination method provided in one embodiment of this application. Exemplarily, when encoding the current block 610, two encoded blocks matching the current block 610 are obtained through a first prediction mode: a first matching block 620 and another first matching block 630. In some embodiments, since the first matching block 620 is an encoded block, it also corresponds to a prediction block, namely the second matching block 621, when it was previously encoded. In some embodiments, since the first matching block 630 is an encoded block, it also corresponds to a prediction block, namely the second matching block 631, when it was previously encoded. Exemplarily, the prediction mode used when encoding the first matching block is the second prediction mode; the second prediction mode and the first prediction mode can be the same or different prediction modes. Furthermore, among the four matching blocks 620, 630, 621, and 631, the block that best matches the current block 610 (i.e., the block with the smallest error) is re-determined as the prediction block for the current block 610. It should be noted that... Figure 6 The diagram only shows two first matching blocks and two second matching blocks. The number of first matching blocks can be one or more, and the number of second matching blocks can also be one or more; this application does not limit this. Of course, some first matching blocks may not have a corresponding prediction block (i.e., no corresponding second matching block). However, at least one first matching block has a corresponding second matching block.
[0075] This application improves the accuracy of intra-frame block copy prediction by using information from predicted blocks obtained through block matching search, while saving syntax element information used to represent the position of the matching block. By utilizing the prediction mode information of several best matching blocks (i.e., at least one first matching block) within the search range of the current block, more matching blocks (i.e., at least one second matching block) are obtained. Then, the best matching block is selected as the prediction block for the current block through comparison. This improves the performance of intra-frame prediction and the overall performance of video coding.
[0076] Please refer to Figure 7 This document illustrates a flowchart of a video encoding method provided in one embodiment of this application. The execution subject of this method may be the first device 210 described above. For ease of explanation, the description focuses on the encoding end device as the execution subject of each step. The method may include at least one of the following steps (710-740).
[0077] Step 710: For the current block within a video frame, obtain at least one first matching block, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode.
[0078] In some embodiments, the first matching block is a predicted block that matches the current block, determined by a first prediction mode. For example, the number of predicted blocks that match the current block, determined by the first prediction mode, is at least one, meaning there is at least one first matching block.
[0079] In some embodiments, the first matching block is a block within an encoded region of a video frame. Exemplarily, the first matching block can be an encoded block within the current video frame or an encoded block within a video frame preceding the current video frame. If the first matching block is an encoded block within the current video frame, the first prediction mode is also called an intra-frame prediction mode. If the first matching block is an encoded block within a video frame preceding the current video frame, the video frames preceding the current video frame are also called encoded video frames, and the first prediction mode is also called an inter-frame prediction mode. In the embodiments of this application, an encoded block refers to a tile, image block, or pixel block appearing in an encoded region. Exemplarily, the encoded region includes multiple encoded coding units. Exemplarily, the coding units do not overlap. Exemplarily, a encoded block can overlap with a coding unit within an encoded region, be located within a coding unit within an encoded region, or span multiple coding units within an encoded region. Exemplarily, a encoded block can include multiple coding units within an encoded region.
[0080] In some embodiments, the first prediction mode is the prediction method used in the above predictive coding, including at least one of intra-frame prediction mode and inter-frame prediction mode. For example, the first prediction mode includes at least one of the following: IBC prediction mode, intra-frame TMP (Template Matching Prediction) mode, and ISC (IntraString Copy) prediction mode.
[0081] For example, the first prediction mode is the IBC prediction mode. IBC is an intra-frame coding tool adopted in the HEVC Screen Content Coding (SCC) extension, which significantly improves the coding efficiency of screen content. IBC technology is also adopted in AVS3 and VVC to improve the performance of screen content coding. IBC utilizes the spatial correlation of screen content video, using the pixel values of already encoded blocks in the current video frame to predict the pixel values of the current block, effectively saving the bits required to encode pixels.
[0082] For example, the first prediction mode is the intra-frame TMP mode. TMP mode is also an intra-frame coding tool adopted in the HEVC SCC extension. TMP mode matches an L-shaped template with the reconstructed portion of the current video frame and uses the corresponding block as the predicted value for the current block. For a predefined search range, the encoder searches for the template most similar to the current template in the reconstructed portion of the current video frame and uses the corresponding block as the prediction block. Similarly, the difference in pixel values between the predicted block and the current block is encoded.
[0083] For example, the first prediction mode is the ISC prediction mode. ISC technology divides a coded block into a series of pixel strings or unmatched pixels according to a certain scanning order (such as raster scanning, round-trip scanning, and Zig-Zag scanning). Similar to IBC, each string searches for a reference string of the same shape in the encoded region of the current video frame. By encoding the residual between the pixel values of the current string and the pixel values of the reference string, instead of directly encoding the pixel values, bits can be effectively saved.
[0084] In some embodiments, the first matching block has the same size as the current block. In some embodiments, the current block is also the current coding unit. In some embodiments, the video frame is divided into several coding units, and each coding unit is encoded in a specified order. Exemplarily, in the coding side of this application, the current block refers to a coding unit that has not yet been encoded. A coding unit can also be understood as a pre-divided image block, plot, or color block in the video frame.
[0085] In some embodiments, from the search range of the current block, the errors between each encoded block and the current block are determined, and the errors include at least one of the sum of squares due to error (SSE) and the sum of absolute differences (SAD); the encoded block with the smallest error or an error less than a first threshold is selected as the first matching block corresponding to the current block. For example, the error between the encoded block and the current block refers to the error between the pixel values of the encoded block and the pixel values of the current block.
[0086] In some embodiments, taking the IBC prediction mode as an example, the n most similar prediction blocks P to the current block are searched. i (i = 0, ..., n-1, where n is a positive integer, which can be set to 8). In IBC prediction, P0 is obtained by performing a block matching search in a given region around the current block that has already been encoded, that is, searching for the encoded block with the smallest error to the current block. The SSE of the current block (i.e., the current coding unit) and the encoded blocks P0 in the search range is given below: SSE0 = ∑ i,j (C(i,j)-P0(i,j)) 2 .
[0087] Here, i and j indicate the positions of different pixels within the block. C(i,j) refers to the pixel value of the pixel in the i-th row and j-th column of the current block. P0(i,j) refers to the pixel value of the pixel in the i-th row and j-th column of the encoded block P0.
[0088] For example, at least one encoded block with an error less than or equal to a first threshold is used as at least one first matching block corresponding to the current block.
[0089] In some embodiments, the aforementioned video frame is any frame appearing in a video. For example, the video here includes, but is not limited to, video during a real-time video call, video during a video conference, video during screen sharing, non-real-time video, etc.
[0090] In some embodiments, there may be an encoded video frame before the video frame mentioned in step 710, or there may be an unencoded video frame after the video frame mentioned in step 710. This application does not limit this.
[0091] Step 720: Based on at least one first matching block, obtain at least one second matching block, where there exists at least one first matching block with a number of second matching blocks greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block as determined by the second prediction mode.
[0092] In some embodiments, the second prediction mode is the prediction method used in the above-described predictive coding, including at least one of intra-frame prediction mode and inter-frame prediction mode. For example, the second prediction mode includes at least one of the following: IBC prediction mode, TMP mode, and ISC prediction mode.
[0093] In some embodiments, since the first matching block is an encoded block, the encoded block that matches the first matching block is already determined when the first matching block is encoded. Considering that the prediction methods used to encode the first matching block and the current block may be different, the first prediction mode and the second prediction mode may be different. Of course, the first prediction mode and the second prediction mode may also be the same. This application does not limit this.
[0094] In some embodiments, a first matching block may have a corresponding second matching block, or a first matching block may not have a corresponding second matching block. For example, if a first matching block has a corresponding second matching block, the number of second matching blocks corresponding to the first matching block is greater than or equal to one. For example, if each first matching block does not have a corresponding second matching block, the number of second matching blocks corresponding to the first matching block is zero.
[0095] In some embodiments, the specific method for determining the second matching block corresponding to the first matching block is explained in the following embodiments, and will not be repeated here.
[0096] In some embodiments, taking the ISC prediction mode as an example, the first matching block mentioned in this application may also be referred to as the first matching string (the reference string mentioned above), and the second matching block mentioned in this application may also be referred to as the second matching string (the reference string corresponding to the reference string mentioned above). In other embodiments within the context of this application, the term "matching block" is used to describe the prediction block in the IBC mode or TMP mode, or the reference string in the ISC mode. Alternatively, it can be understood that the first matching block or the second matching block does not strictly refer to a block, but may also refer to a string.
[0097] Compared to prediction methods in related technologies (directly finding the prediction block from a given encoded region), this application considers the prediction block found through a first prediction mode as at least one first matching block, and also obtains the prediction mode information of the first matching block, that is, the matching block corresponding to the first matching block when encoding the first matching block. Therefore, the selection range of matching blocks in this application is wider, that is, the search range is wider, thereby improving the accuracy of the prediction block corresponding to the current block.
[0098] Step 730: Determine the prediction block corresponding to the current block from at least one first matching block and at least one second matching block.
[0099] In some embodiments, from at least one matching block, the matching block with the smallest error to the current block is determined as the matching block corresponding to the current block. In some embodiments, from at least one matching block, a matching block with an error less than or equal to a second threshold is determined as the matching block corresponding to the current block.
[0100] In some embodiments, the errors between at least two matching blocks and the current block are calculated. Exemplarily, these errors include at least one of SSE and SAD. In some embodiments, the errors refer to the errors between pixel values. Each matching block includes multiple pixels, and each current block also includes multiple pixels. Since the matching block and the current block have the same size, they both include the same number of pixels. In some embodiments, the difference between the pixel values of corresponding pixels in the matching block and the current block is calculated to obtain the error between the matching block and the current block.
[0101] Step 740: Encode the current block based on the prediction block corresponding to the current block.
[0102] In some embodiments, the prediction block corresponding to the current block and the prediction residual between the current block are obtained. The prediction residual is encoded to obtain the encoding information of the current block. In some embodiments, the prediction residual between the prediction block corresponding to the current block and the current block refers to the difference between the pixel value of the prediction block and the pixel value of the current block. In some embodiments, the encoding process of the entire current block is completed by encoding and transmitting the prediction residual, and performing subsequent transform coding, quantization, entropy coding, and loop filtering. For details, please refer to the explanation of the above embodiments, which will not be repeated here.
[0103] In some embodiments, the encoding information of the current block also includes encoding information of the current block's location and encoding information of the prediction mode for the current block. See the explanations of the embodiments below for details, which will not be repeated here.
[0104] The technical solution provided in this application, for the current block within a video frame, not only acquires a first matching block determined by a first prediction mode that matches the current block, but also acquires a second matching block that matches the first matching block. From at least one first matching block and at least one second matching block, a prediction block matching the current block is determined. Compared to related technologies that directly search for prediction blocks from the encoded region, the technical solution provided in this application, based on the first matching block, further acquires matching blocks of the first matching block, determining the prediction block matching the current block from at least two matching blocks (including the first and second matching blocks). With more matching block options compared to related technologies, this application achieves higher accuracy in intra-frame prediction, thereby improving video encoding and decoding performance.
[0105] Please refer to Figure 8 The diagram illustrates a flowchart of a video encoding method provided in another embodiment of this application, wherein the execution subject of the method may be the first device 210 described above. For ease of explanation, the description focuses on the encoding end device as the execution subject of each step. The method may include at least one of the following steps (810-860).
[0106] Step 810: For the current block within a video frame, obtain at least one first matching block, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode.
[0107] Step 820: For the i-th first matching block in at least one first matching block, based on the position information of the i-th first matching block, determine the first encoded unit from at least one encoded unit in the video frame. The first encoded unit is the encoded unit where the i-th first matching block is located, and i is a positive integer.
[0108] In some embodiments, for the i-th first matching block in at least one first matching block, i.e., P i In some embodiments, a first encoded unit is determined from at least one encoded unit within a video frame based on the position information of the i-th first matching block.
[0109] In some embodiments, the sizes of different coding units within a video frame may be inconsistent, so the sizes of the coding units in the current block and the coded regions may be different.
[0110] In some embodiments, there is no predetermined positional relationship between the first matching block and the encoded units; that is, the first matching block is not limited to a single encoded unit or within a single encoded unit, but can span multiple encoded units. However, regardless of the position of the first matching block, its size is always consistent with the size of the current block.
[0111] For example, when the first matching block coincides with a certain encoded unit, the encoded unit is taken as the first encoded unit.
[0112] For example, when the first matching block is located inside a certain encoded unit, the encoded unit is used as the first encoded unit.
[0113] For example, when a first matching block spans multiple encoded units (with overlapping portions with each of the multiple encoded units), each of the multiple encoded units is treated as a first encoded unit.
[0114] For example, when the first matching block spans multiple encoded units (and overlaps with each of the multiple encoded units), the encoded unit with the largest area of overlap with the first matching block among the multiple encoded units is taken as the first encoded unit.
[0115] For example, when the first matching block spans multiple encoded units (and overlaps with each of the multiple encoded units), the encoded unit whose overlapping area with the first matching block is greater than or equal to a set area threshold is taken as the first encoded unit.
[0116] Before proceeding with determining the second matching block, it is necessary to determine the pattern of the first encoded unit.
[0117] In some embodiments, after step 820, at least one of the following steps S1 to S3 (not shown in the figure) is further included.
[0118] Step S1: Obtain the prediction mode of the first encoded unit.
[0119] For example, since the first encoded unit is an already encoded unit, the prediction mode for the first encoded unit can be directly obtained. The prediction mode here can be understood as the prediction mode used when encoding the first encoded unit. For example, the prediction mode here includes, but is not limited to, at least one of the IBC prediction mode, TMP mode, and ISC prediction mode mentioned above.
[0120] Step S2: If the prediction mode of the first encoded unit is the second prediction mode, perform the step of obtaining the block vector information of the first encoded unit.
[0121] For example, when the prediction mode of the first encoded cell is the second prediction mode, the step of obtaining the block vector information of the first encoded cell is performed.
[0122] For example, when the prediction mode of the first encoded cell is the IBC prediction mode, the step of obtaining the block vector information of the first encoded cell is performed.
[0123] For example, when the prediction mode of the first encoded unit is TMP mode, the step of obtaining the block vector information of the first encoded unit is performed.
[0124] For example, when the prediction mode of the first encoded unit is ISC prediction mode, the step of obtaining the block vector information of the first encoded unit is performed. It should be noted that when the prediction mode of the first encoded unit is ISC prediction mode, this block vector information can also be called string vector (SV) information. SV information refers to the displacement vector used for ISC prediction mode, and its value is the coordinate offset between the current string and the reference string.
[0125] When the prediction mode of the first coded unit is the second prediction mode, the first coded unit has block vector information, and the step of obtaining the block vector information of the first coded unit is executed. Therefore, the i-th first matching block has a corresponding second matching block.
[0126] Step S3: If the prediction mode of the first encoded unit is not the second prediction mode, determine that the i-th first matching block does not have a corresponding second matching block.
[0127] If the prediction mode of the first coded unit is not the second prediction mode, the first coded unit has no block vector information, and therefore the block vector information of the first coded unit cannot be obtained. Consequently, the i-th first matching block does not have a corresponding second matching block.
[0128] The technical solution provided in this application first determines the prediction mode of the first coded unit where the first matching block is located before determining the second matching block, so as to avoid the situation where there is no block vector information due to the prediction mode of the first coded unit not being the second prediction mode, and further the situation where there is no second matching block.
[0129] The following two scenarios will be used to explain how the first encoded unit is determined.
[0130] In some embodiments, step 820 includes at least one of steps 821 to 822 (not shown in the figures).
[0131] In the first case, the i-th first matching block is completely surrounded by an encoded unit.
[0132] Step 821: If it is determined based on the position information of the i-th first matching block that the i-th first matching block is completely surrounded by one of the encoded units in at least one encoded unit, the encoded unit that completely surrounds the i-th first matching block and is encoded based on the second prediction mode is determined as the first encoded unit.
[0133] In some embodiments, the position information of the i-th first matching block is obtained. If, based on the position information of the i-th first matching block, it is determined that the i-th first matching block is completely surrounded by an encoded unit, and the prediction mode of the encoded unit is the second prediction mode, the encoded unit is determined as the first encoded unit.
[0134] In some embodiments, the position information of the i-th first matching block is obtained. If, based on the position information of the i-th first matching block, it is determined that the i-th first matching block is completely surrounded by a coded unit, and the prediction mode of that coded unit is not the second prediction mode, then that coded unit is not determined as the first coded unit.
[0135] For example, such as Figure 11 As shown, the i-th first matching block P of the current CU i For example, the first matching block P i Encoded Unit CU i Completely enclosed, and the encoded unit CU i If the prediction mode is the second prediction mode, then the encoded unit CU will be... i It is identified as the first encoded unit.
[0136] In some embodiments, the first prediction mode and the second prediction mode are the same. In other embodiments, the first prediction mode and the second prediction mode may be different.
[0137] In the second case, the i-th first matching block spans at least two encoded units.
[0138] Step 822: If it is determined based on the position information of the i-th first matching block that the i-th first matching block overlaps with at least two encoded units in at least one encoded unit, the encoded unit encoded based on the second prediction mode in the at least two encoded units is determined as the first encoded unit.
[0139] In some embodiments, the position information of the i-th first matching block is obtained. If it is determined based on the position information of the i-th first matching block that the i-th first matching block overlaps with at least two encoded units, the encoded unit whose prediction mode is the second prediction mode is determined as the first encoded unit.
[0140] For example, the number of first coded units can be one or more.
[0141] The technical solution provided in this application provides two methods for determining the first encoded unit, which are tailored to different distributions of the first matching block. This demonstrates flexible determination of the first encoded unit while ensuring efficient determination.
[0142] In some embodiments, if there are at least two encoded units encoded based on the second prediction mode among at least two encoded units, the encoded unit with the largest overlap area with the i-th first matching block is determined as the first encoded unit.
[0143] For example, such as Figure 12 As shown, the i-th first matching block P of the current CU i For example, the first matching block P i Spanning encoded units CU0, CU1, CU2, and CU3, the first matching block P iIt overlaps with the encoded units CU0, CU1, CU2, and CU3 respectively. Among them, the encoded unit CU0 overlaps with the first matching block P. i The coded unit with the largest overlap area. If the prediction mode of the coded unit CU0 is the second prediction mode, then the coded unit CU0 is determined as the first coded unit.
[0144] The technical solution provided in this application embodiment, when the first matching block spans multiple coded units, takes the coded unit with the largest overlapping area as the first coded unit, which can improve the similarity between the determined second matching block and the current block, thereby improving the prediction effect.
[0145] Step 830: Obtain the block vector information of the first encoded unit. The block vector information of the first encoded unit is used to indicate the relative position between the matching block corresponding to the first encoded unit and the first encoded unit. The block vector information of the first encoded unit is determined based on the second prediction mode.
[0146] In some embodiments, when the second prediction mode is IBC mode or TMP mode, the block vector when the first coded unit is encoded using the second prediction mode is obtained. Exemplarily, the block vector is used to indicate the relative position between the matching block corresponding to the first coded unit and the first coded unit, that is, the positional offset between the prediction block corresponding to the first coded unit and the first coded unit.
[0147] In some embodiments, when the second prediction mode is ISC mode, a string vector is obtained when the first encoded unit is encoded using the second prediction mode. Exemplarily, the string vector is used to indicate the relative position between the matching string corresponding to the first encoded unit and the first encoded unit, that is, the positional offset between the prediction string (or reference string) corresponding to the first encoded unit and the first encoded unit.
[0148] The block vector information mentioned in the embodiments of this application includes at least one of the block vector (BV) and string vector (SV).
[0149] For example, the block vector information not only indicates the distance between the matching block corresponding to the first coded unit and the first coded unit, but also indicates the direction between the matching block corresponding to the first coded unit and the first coded unit. For example, based on this block vector information and the position information of the first coded unit, the location of the prediction block corresponding to the first coded unit can be determined.
[0150] The technical solution provided in this application does not limit the specific category of the first prediction mode or the second prediction mode, and supports first and second matching blocks obtained from multiple different intra-frame prediction modes or inter-frame prediction modes. This makes the types of matching blocks more diverse, thereby improving the prediction effect for the current block.
[0151] Step 840: Determine the second matching block corresponding to the i-th first matching block based on the position information of the i-th first matching block and the block vector information of the first encoded unit.
[0152] In some embodiments, the block vector information of the first encoded unit is used as the block vector information of the i-th first matching block to determine the second matching block corresponding to the i-th first matching block.
[0153] For example, within a video frame, based on the location of the i-th first matching block, the position is moved according to the position offset indicated by the block vector information of the first encoded unit to obtain the location of the second matching block corresponding to the i-th first matching block.
[0154] For example, such as Figure 11 As shown, the encoded unit CU i The corresponding prediction block is CU i ′, Encoded Unit CU i The block vector information is Bv i '. For example, the encoded unit CU i Block vector information Bv i 'As the first matching block P i Based on the block vector information, determine the first matching block P. i The corresponding second matching block P i ′.
[0155] For example, such as Figure 12 As shown, the prediction block corresponding to the encoded unit CU0 is PU0', and the block vector information of the encoded unit CU0 is Bv0'. For example, the block vector information Bv0' of the encoded unit CU0 is used as the first matching block P. i Based on the block vector information, determine the first matching block P. i The corresponding second matching block P i ′.
[0156] Step 850: Determine the prediction block corresponding to the current block from at least one first matching block and at least one second matching block.
[0157] In some embodiments, at least one first matching block and at least one second matching block are considered as at least two matching blocks. Based on the pixel values corresponding to the at least two matching blocks and the current block, the error between each of the at least two matching blocks and the current block is determined, whereby the error includes at least one of the sum of squared errors and the sum of absolute errors. In some embodiments, the matching block with the smallest error between the at least two matching blocks and the current block is determined as the prediction block corresponding to the current block.
[0158] For example, the sum of squared errors between each matching block and the current block is determined based on the pixel values corresponding to at least two matching blocks and the current block, respectively. In some embodiments, the matching block with the smallest sum of squared errors is determined as the prediction block corresponding to the current block. For example, the matching block with a sum of squared errors less than a set threshold is determined as the prediction block corresponding to the current block.
[0159] For example, based on the pixel values corresponding to at least two matching blocks and the current block, the sum of absolute errors between each matching block and the current block is determined. In some embodiments, the matching block with the smallest sum of absolute errors is determined as the prediction block corresponding to the current block. For example, the matching block with the smallest sum of absolute errors less than a set threshold is determined as the prediction block corresponding to the current block.
[0160] In this embodiment, the matching block with the smallest error is determined from at least two matching blocks (including at least one first matching block and at least one second matching block) as the prediction block corresponding to the current block. Compared with directly determining the first matching block as the prediction block, this application has more selection space, and still selects the matching block with the smallest error as the prediction block corresponding to the current block, which is beneficial to ensuring prediction accuracy.
[0161] Step 860: Encode the current block based on the prediction block corresponding to the current block.
[0162] The technical solution provided in this application determines the second matching block by using the block vector information of the encoded unit where the first matching block is located, thus ensuring the efficiency of determining the second matching block and the accuracy of the determined second matching block, thereby ensuring the prediction efficiency for the current block.
[0163] Please refer to Figure 9 The diagram illustrates a flowchart of a video encoding method according to another embodiment of this application, wherein the execution subject of the method may be the first device 210 described above. For ease of explanation, the description focuses on the encoding end device as the execution subject of each step. The method may include at least one of the following steps (910-960).
[0164] Step 910: For the current block within a video frame, obtain at least one first matching block, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode.
[0165] Step 920: Based on at least one first matching block, obtain at least one second matching block, where there exists at least one first matching block with a number of second matching blocks greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block based on the second prediction mode.
[0166] Step 930: Determine the prediction block corresponding to the current block from at least one first matching block and at least one second matching block.
[0167] Step 940: If the predicted block is a first matching block in at least one first matching block and there is no corresponding second matching block for the predicted block, the current block is encoded based on the predicted block.
[0168] In some embodiments, when the predicted block is a first matching block and there is no corresponding second matching block, it is not necessary to encode the first flag bit or the second flag bit described below.
[0169] In some embodiments, step 940 includes at least one of steps 941 to 942 (not shown in the figures).
[0170] Step 941: Obtain the block vector information of the current block. The block vector information of the current block is determined by the first prediction mode based on the relative position between the prediction block and the current block.
[0171] For example, based on the positions corresponding to the predicted block and the current block respectively, the position offset between the predicted block and the current block is obtained, and this position offset is determined as the block vector information of the current block.
[0172] In some embodiments, considering that when at least one first matching block is determined using a first prediction mode, the block vector information of the current block and each of the first matching blocks can be determined. Of course, when the second matching block corresponding to the first matching block is obtained using a second prediction mode, the position of the second matching block relative to the first matching block, that is, the block vector information of the first matching block, can also be directly obtained.
[0173] In some embodiments, if one of the first matching blocks is determined to be a predicted block, the block vector information of the predicted block relative to the current block is directly obtained.
[0174] In some embodiments, the first prediction mode and the second prediction mode are different. For example, the first prediction mode is the IBC mode, and the second prediction mode is the TMP mode.
[0175] In some embodiments, the first prediction mode and the second prediction mode are the same. For example, the first prediction mode is the IBC mode, and the second prediction mode is also the IBC mode. For example, the first prediction mode is the TMP mode, and the second prediction mode is also the TMP mode.
[0176] In some embodiments, regardless of whether it is the first prediction mode or the second prediction mode, if the matching block corresponding to the current block is obtained by using either prediction mode, the position of the matching block relative to the current block, that is, the block vector information of the current block, can be obtained.
[0177] Step 942: Encode the block vector information of the current block.
[0178] For example, the prediction mode of the current block is encoded simultaneously with the block vector information of the current block. For example, the encoded information of the current block includes not only the encoded block vector information but also the encoded prediction mode information.
[0179] Step 950: If the predicted block is a first matching block in at least one first matching block and the predicted block has a corresponding second matching block, the current block is encoded based on the predicted block and the first flag bit.
[0180] In some embodiments, when the predicted block is a first matching block and a corresponding second matching block exists, it is necessary to encode a first flag bit.
[0181] In some embodiments, the first flag bit is different from the second flag bit, or the first flag bit is the same as the second flag bit, but uses different values for encoding.
[0182] In some embodiments, if the first flag bit and the second flag bit are different, then as long as the first flag bit exists, the predicted block can be considered as a first matching block, and the predicted block has a corresponding second matching block. As long as the second flag bit exists, the predicted block can be considered as the second matching block corresponding to the first matching block. For example, if the first flag bit and the second flag bit are different, then the first flag bit and the second flag bit can correspond to different encoding positions or different encoding lengths.
[0183] In some embodiments, if the first flag bit and the second flag bit are the same, steps 950 and 960 can be distinguished by different values. For example, in step 950, the first flag bit is encoded as a first numerical value. For example, in step 960, the second flag bit is encoded as a second numerical value, and the first and second numerical values are different.
[0184] In some embodiments, step 950 includes at least one of steps 951 to 952 (not shown in the figures).
[0185] Step 951: Obtain the block vector information of the current block. The block vector information of the current block is determined by the first prediction mode based on the relative position between the prediction block and the current block.
[0186] In some embodiments, such as Figure 11 As shown, the predicted block is the first matching block P. i And the first matching block P i There is a corresponding second matching block P i If '', then the block vector information of the current CU is the first matching block P. i The relative position with respect to the current CU, i.e., Bv i In some embodiments, such as Figure 12 As shown, the predicted block is the first matching block P. i And the first matching block P i There is a corresponding second matching block P i If '', then the block vector information of the current CU is the first matching block P corresponding to the predicted block. i The relative position with respect to the current CU, i.e., Bv i .
[0187] Step 952: Encode the block vector information of the current block and encode the first flag bit as the first value.
[0188] In some embodiments, the encoded block vector information Bv i The encoding involves setting the first flag bit to a first numerical value. In some embodiments, if the first flag bit and the second flag bit are different, the first numerical value and the second numerical value can be the same. In other embodiments, if the first flag bit and the second flag bit are the same flag bit, the first numerical value and the second numerical value are different. For example, the first numerical value is 0, and the second numerical value is 1.
[0189] In some embodiments, the encoded block vector information Bv i The first flag is encoded as 0. For example, the prediction mode of the current block is encoded simultaneously with the block vector information and the first flag. For example, the encoded information of the current block includes not only the encoded information of the block vector information and the encoded information of the first flag, but also the encoded information of the prediction mode.
[0190] Step 960: If the predicted block is a second matching block in at least one second matching block, the current block is encoded based on the predicted block and the second flag bit.
[0191] In some embodiments, when the predicted block is a second matching block, a second flag bit needs to be encoded.
[0192] Step 960 includes at least one of the steps 961 to 962 (not shown in the figure).
[0193] Step 961: Obtain the block vector information of the current block. The block vector information of the current block is determined by the first prediction mode based on the relative position between the first matching block corresponding to the prediction block and the current block.
[0194] In some embodiments, since the predicted block is a second matching block among at least one second matching block, this second matching block necessarily corresponds to a first matching block. For example, the block vector information of the current block is also the position of the first matching block corresponding to the predicted block relative to the current block. For example, when determining at least one first matching block using the first prediction mode, the relative position of each first matching block relative to the current block is calculated by the first prediction mode.
[0195] For example, the first prediction mode is the IBC mode or the TMP mode. For example, the first prediction mode and the second prediction mode can be the same or different.
[0196] In some embodiments, such as Figure 11 As shown, the predicted block is the second matching block P. i If '', then the block vector information of the current CU is the first matching block P corresponding to the predicted block. i The relative position with respect to the current CU, i.e., Bv i In some embodiments, such as Figure 12 As shown, the predicted block is the second matching block P. i If '', then the block vector information of the current CU is the first matching block P corresponding to the predicted block. i The relative position with respect to the current CU, i.e., Bv i .
[0197] Step 962: Encode the block vector information of the current block and encode the second flag bit as the second value.
[0198] In some embodiments, the encoded block vector information Bv i And the second flag bit is encoded as the second value. In some embodiments, the block vector information Bv is encoded. i The second flag bit is encoded as 1. For example, the prediction mode of the current block is encoded simultaneously with the block vector information and the second flag bit. For example, the encoded information of the current block includes not only the encoded information of the block vector information and the encoded information of the second flag bit, but also the encoded information of the prediction mode.
[0199] In some embodiments, when encoding the current block, the relative position between the first matching block and the current block is always encoded, i.e., the block vector information of the encoding unit. For example, a first flag bit or a second flag bit, and a flag bit indicating whether to encode, are used to distinguish whether the second matching block is used as a prediction block, and whether a second matching block exists.
[0200] For example, when neither the first flag bit nor the second flag bit is encoded, the predicted block is considered a first matching block, and no second matching block exists for the first matching block. For example, when the first flag bit and the second flag bit are the same flag bit, the first value and the second value are used to distinguish whether to use the second matching block as a predicted block. For example, when the first flag bit and the second flag bit are different flag bits, the first flag bit and the second flag bit are used to distinguish whether to use the second matching block as a predicted block.
[0201] The technical solutions provided in this application employ different encoding methods for different situations. For example, the flag bit is not encoded to indicate that there is no second matching block, or the flag bit is encoded into different values to distinguish whether the second matching block is used as a prediction block, or different flag bits are encoded to distinguish whether the second matching block is used as a prediction block, which reflects the flexibility of the encoding method.
[0202] Furthermore, a single-bit flag can indicate whether the second matching block is to be used as a prediction block, as well as a non-encoded flag, which can reduce coding overhead and improve coding efficiency.
[0203] The following is combined Figure 10 The following explanations are provided regarding the decoding end. It should be noted that technical details not mentioned in the following embodiments can be found in the explanations in the above encoding end embodiments, and will not be repeated here.
[0204] Please refer to Figure 10 A flowchart of video decoding according to an embodiment of this application is shown. The execution subject of the method can be the second device 220 described above. For ease of explanation, only the decoding end device is described as the execution subject of each step. The method may include at least one of the following steps (1010 to 1030).
[0205] Step 1010: For the current block within the video frame, obtain the encoding information of the current block.
[0206] In some embodiments, different blocks within a video frame are decoded sequentially according to a preset order. These blocks can also be considered decoding units on the decoding side or encoding units on the encoding side. Exemplarily, each current block corresponds to one decoding unit, i.e., one encoding unit. Exemplarily, one decoding unit and one encoding unit correspond to the same image block, plot, or color block within the video frame. The blocks within the video frame are pre-divided; the block division is explained in the above embodiments.
[0207] In some embodiments, after obtaining the bitstream obtained from video encoding, the bitstream is decoded. Since the bitstream carries the position information of each block, the position information can be decoded to determine which block in the video frame is being decoded.
[0208] In some embodiments, the current block on the decoding side can be understood as the coding unit, image block, map tile, or pigment block being decoded corresponding to the current encoding information. In some embodiments, after encoding the current block on the encoding side, the encoding information of the current block is obtained. For example, obtaining the encoding information of the current block on the decoding side allows the location of the current block to be determined based on the encoding information.
[0209] Step 1020: Based on the encoding information of the current block, determine the prediction block corresponding to the current block. The prediction block is either the first matching block or the second matching block. The first matching block is a decoded block that matches the current block based on the first prediction mode, and the second matching block is a decoded block that matches the first matching block based on the second prediction mode.
[0210] In some embodiments, the current block is the decoding unit or decoding block currently being decoded. In some embodiments, the encoding information of the current block includes the encoding information of the current block's position information and block vector information.
[0211] In some embodiments, the position of the current block in a video frame can be determined by decoding the position information of the current block. In some embodiments, block vector information is obtained by decoding the encoded information of the block vector information.
[0212] In some embodiments, the first matching block corresponding to the current block is determined based on the relative position between the current block and the first matching block indicated by the block vector information. For example, the position of the first matching block is determined by moving along the position offset indicated by the block vector information based on the current block's location.
[0213] In some embodiments, if a first matching block is determined and a corresponding second matching block exists, then since the first matching block is a decoded block, the second matching block corresponding to the first matching block can be directly obtained.
[0214] In some embodiments, the encoding information of the current block further includes indication information. Exemplarily, this indication information is used to indicate whether a second matching block exists and whether the second matching block is to be used as a predicted block for the current block. Exemplarily, the indication information includes at least one of the encoding information of the first flag bit and the encoding information of the second flag bit described below. See the explanation of the embodiments below for details.
[0215] For example, if the first matching block is the prediction block of the current block, then the first matching block is determined to be the prediction block corresponding to the current block.
[0216] For example, if the second matching block is the prediction block of the current block, then the second matching block is determined to be the prediction block corresponding to the current block.
[0217] In some embodiments, the first decoded unit containing the first matching block can be determined based on the position of the first matching block. In some embodiments, the decoded unit on the decoding side and the encoded unit on the encoding side are the same concept, both referring to a coding unit, tile, image block, or pigment block of a video frame.
[0218] In some embodiments, block vector information of a first decoded unit is obtained, the block vector information of the first decoded unit is used to indicate the relative position between the matching block corresponding to the first decoded unit and the first decoded unit, and the block vector information of the first decoded unit is determined based on a second prediction mode; a second matching block corresponding to the first matching block is determined according to the position information of the first matching block and the block vector information of the first decoded unit.
[0219] In some embodiments, the prediction mode of the first decoded unit is obtained; if the prediction mode of the first decoded unit is the second prediction mode, the step of obtaining the block vector information of the first decoded unit is performed; if the prediction mode of the first decoded unit is not the second prediction mode, it is determined that the first matching block does not have a corresponding second matching block.
[0220] In some embodiments, if it is determined based on the location information of the first matching block that the first matching block is completely surrounded by one of the decoded units in at least one decoded unit, the decoded unit that completely surrounds the first matching block and is decoded based on the second prediction mode is determined as the first decoded unit.
[0221] In some embodiments, if it is determined based on the location information of the first matching block that the first matching block overlaps with at least two of the at least two decoded units, the decoded unit that is decoded based on the second prediction mode among the at least two decoded units is determined as the first decoded unit.
[0222] In some embodiments, if there are at least two decoded units that are decoded based on the second prediction mode among at least two decoded units, the decoded unit with the largest overlap area with the first matching block is determined as the first decoded unit.
[0223] In some embodiments, the second prediction mode includes at least one of the following: IBC mode, intra-frame TMP mode.
[0224] The first decoded unit in this embodiment corresponds to the first encoded unit on the encoding side, which will not be described in detail.
[0225] Step 1030: Decode the current block based on the prediction block corresponding to the current block.
[0226] In some embodiments, after determining the prediction block corresponding to the current block, the prediction residual between the prediction block corresponding to the current block and the current block is decoded. For example, the prediction residual is superimposed on the pixel values of the prediction block to obtain the pixel values of each pixel in the current block.
[0227] The technical solution provided in this application embodiment is that the prediction block of the current block is either the first matching block or the second matching block. Compared with the related technology that directly uses the first matching block as the prediction block, the prediction block in this application has more selection possibilities, so the accuracy of intra-frame prediction is also higher, thereby improving the performance of video encoding and decoding.
[0228] In some embodiments, where the encoding information of the current block includes the encoding information of the block vector information, step 1030 includes at least one of the following steps 1031 to 1033 (not shown in the figure).
[0229] Step 1031: Decode the encoded information of the block vector information to obtain the block vector information.
[0230] Step 1032: Based on the block vector information and the current block position information, determine the first matching block from at least one decoded block.
[0231] Please refer to the explanation of the above embodiments, which will not be repeated here.
[0232] Step 1033: Determine the first matching block as the prediction block corresponding to the current block, and determine that the first matching block does not have a corresponding second matching block.
[0233] In some embodiments, if the encoding information of the current block includes the encoding information of the block vector information but does not include the encoding information of the first flag bit or the encoding information of the second flag bit, that is, it does not include the indication information, it is considered that the first matching block does not have a corresponding second matching block, and the first matching block can be directly used as the prediction block corresponding to the current block.
[0234] In some embodiments, when the encoding information of the current block includes the encoding information of the block vector information and the encoding information of the first flag bit, step 1030 includes at least one of the following steps 1041 to 1043 (not shown in the figure).
[0235] Step 1041: Decode the encoded information of the block vector information to obtain the block vector information.
[0236] Step 1042: Based on the block vector information and the current block position information, determine the first matching block from at least one decoded block.
[0237] Step 1043: Decode the encoded information of the first flag bit. If the value of the first flag bit is the first value, determine the first matching block as the prediction block corresponding to the current block, and determine that the first matching block has a corresponding second matching block.
[0238] In some embodiments, when the first flag bit and the second flag bit are different flag bits, if the encoding information of the current block includes the encoding information of the first flag bit, it is considered that the first matching block has a corresponding second matching block, and the prediction block corresponding to the current block is the first matching block.
[0239] In some embodiments, when the first flag bit and the second flag bit are the same flag bit, if the encoding information of the current block includes the encoding information of the first flag bit, and decoding the encoding information of the first flag bit yields a first value for the first flag bit, then it is considered that the first matching block has a corresponding second matching block, and the predicted block corresponding to the current block is the first matching block. For example, if the encoding information of the current block includes the encoding information of the first flag bit, and decoding the encoding information of the first flag bit yields a value of 0 for the first flag bit, then it is considered that the first matching block has a corresponding second matching block, and the predicted block corresponding to the current block is the first matching block.
[0240] In some embodiments, where the encoding information of the current block includes the encoding information of the block vector information and the encoding information of the second flag bit, step 1030 includes at least one of the following steps 1051 to 1054 (not shown in the figure).
[0241] Step 1051: Decode the encoded information of the block vector information to obtain the block vector information.
[0242] Step 1052: Based on the block vector information and the current block position information, determine the first matching block from at least one decoded block.
[0243] Step 1053: Decode the encoded information of the second flag bit. If the value of the second flag bit is the second value, obtain the second matching block corresponding to the first matching block.
[0244] In some embodiments, when the first flag bit and the second flag bit are different flag bits, if the encoding information of the current block includes the encoding information of the second flag bit, it is considered that the first matching block has a corresponding second matching block, and the prediction block corresponding to the current block is the second matching block.
[0245] In some embodiments, when the first flag bit and the second flag bit are the same flag bit, if the encoding information of the current block includes the encoding information of the second flag bit, and decoding the encoding information of the second flag bit yields a second value for the second flag bit, it is considered that the first matching block has a corresponding second matching block, and the predicted block corresponding to the current block is the second matching block. For example, if the encoding information of the current block includes the encoding information of the second flag bit, and decoding the encoding information of the second flag bit yields a value of 1 for the second flag bit, it is considered that the first matching block has a corresponding second matching block, and the predicted block corresponding to the current block is the second matching block.
[0246] In some embodiments, the first decoded unit containing the first matching block is determined based on the above method. Furthermore, the second matching block corresponding to the first matching block is determined based on the block vector information of the first decoded unit. For example, the second matching block corresponding to the first matching block is obtained.
[0247] Step 1054: Determine the second matching block as the prediction block corresponding to the current block.
[0248] The technical solution provided in this application corresponds to the encoding end. If there is encoding information for the first flag bit or the second flag bit, it indicates that the first matching block corresponds to a second matching block. If there is no encoding information for the first flag bit or the second flag bit, it indicates that the first matching block does not have a corresponding second matching block, and the first matching block can be directly used as the prediction block corresponding to the current block.
[0249] Furthermore, if the first flag and the second flag are different flags, then if the encoded information of the first flag exists, it is assumed that the first matching block corresponds to a second matching block, and the first matching block is used as the prediction block corresponding to the current block. If the encoded information of the second flag exists, it is assumed that the first matching block corresponds to a second matching block, and the second matching block is used as the prediction block corresponding to the current block.
[0250] Furthermore, if the first flag bit and the second flag bit are the same flag bit, then if the decoded value of this flag bit is the first value, it is assumed that the first matching block corresponds to a second matching block, and the first matching block is used as the prediction block corresponding to the current block. If the decoded value of this flag bit is the second value, then it is assumed that the first matching block corresponds to a second matching block, and the second matching block is used as the prediction block corresponding to the current block. The technical solution provided in this application also reflects the flexibility of the decoding method and the diversity of prediction blocks corresponding to the current block. Of course, using a single flag bit to indicate whether to use the second matching block as a prediction block can reduce decoding overhead and improve decoding efficiency.
[0251] The following are exemplary descriptions of application scenarios.
[0252] In some embodiments, the video frame is a video frame from a video call.
[0253] Please refer to Figure 13 This document illustrates a flowchart of a video encoding / decoding method for video calls according to an embodiment of this application. The method can be executed by either the first device 210 or the second device 220 described above. For ease of explanation, the description focuses on a computer device as the executing entity for each step. The method may include at least one of the following steps (1310-1340).
[0254] Step 1310: For the current block of the video call within the video frame, obtain at least one first matching block, wherein the at least one first matching block is an encoded block that matches the current block of the video call based on a first prediction mode.
[0255] In some embodiments, a video frame here refers to any video frame generated during a video call. The current block of a video call refers to the coded unit, tile, image block, or pigment block divided within a video frame generated during the video call.
[0256] Step 1320: Based on at least one first matching block, obtain at least one second matching block, wherein there exists at least one first matching block and the number of second matching blocks corresponding to it is greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block based on the second prediction mode.
[0257] Step 1330: Determine the prediction block corresponding to the current block of the video call from at least one first matching block and at least one second matching block.
[0258] Step 1340: Encode the current block of the video call based on the predicted block corresponding to the current block of the video call.
[0259] In some embodiments, for the i-th first matching block in at least one first matching block, based on the position information of the i-th first matching block, a first coded unit is determined from at least one coded unit in the video frame, where the first coded unit is the coded unit where the i-th first matching block is located, and i is a positive integer; the block vector information of the first coded unit is obtained, which is used to indicate the relative position between the matching block corresponding to the first coded unit and the first coded unit, and the block vector information of the first coded unit is determined based on a second prediction mode; and a second matching block corresponding to the i-th first matching block is determined according to the position information of the i-th first matching block and the block vector information of the first coded unit.
[0260] In some embodiments, the prediction mode of the first coded unit is obtained; if the prediction mode of the first coded unit is the second prediction mode, the step of obtaining the block vector information of the first coded unit is performed; if the prediction mode of the first coded unit is not the second prediction mode, it is determined that the i-th first matching block does not have a corresponding second matching block.
[0261] In some embodiments, if it is determined based on the position information of the i-th first matching block that the i-th first matching block is completely surrounded by one of the at least one encoded units, the encoded unit that completely surrounds the i-th first matching block and is encoded based on the second prediction mode is determined as the first encoded unit; or, if it is determined based on the position information of the i-th first matching block that the i-th first matching block overlaps with at least two of the at least two encoded units, the encoded unit encoded based on the second prediction mode among the at least two encoded units is determined as the first encoded unit.
[0262] In some embodiments, if there are at least two encoded units encoded based on the second prediction mode among at least two encoded units, the encoded unit with the largest overlap area with the i-th first matching block is determined as the first encoded unit.
[0263] In some embodiments, the second prediction mode includes at least one of the following: IBC mode, intra-frame TMP mode.
[0264] In some embodiments, based on the pixel values corresponding to at least one first matching block, at least one second matching block, and the current block of the video call, the errors between at least one first matching block and at least one second matching block and the current block of the video call are determined, and the errors include at least one of the sum of squared errors and the sum of absolute errors; the matching block with the smallest error between at least one first matching block and at least one second matching block and the current block of the video call is determined as the prediction block corresponding to the current block of the video call.
[0265] In some embodiments, when the predicted block is one of at least one first matching blocks and there is no corresponding second matching block, the current block of the video call is encoded based on the predicted block; or, when the predicted block is one of at least one first matching blocks and there is a corresponding second matching block, the current block of the video call is encoded based on the predicted block and a first flag bit; or, when the predicted block is one of at least one second matching blocks, the current block of the video call is encoded based on the predicted block and a second flag bit; wherein the first flag bit and the second flag bit are different, or the first flag bit and the second flag bit are the same flag bit, but are encoded with different values.
[0266] In some embodiments, block vector information of the current block of the video call is obtained, the block vector information of the current block of the video call is determined by a first prediction mode based on the relative position between the prediction block and the current block of the video call; the block vector information of the current block of the video call is encoded.
[0267] In some embodiments, block vector information of the current block of the video call is obtained, the block vector information of the current block of the video call is determined by a first prediction mode based on the relative position between the prediction block and the current block of the video call; the block vector information of the current block of the video call is encoded, and a first flag bit is encoded as a first value.
[0268] In some embodiments, the block vector information of the current block of the video call is obtained, which is determined by a first prediction mode based on the relative position between the first matching block corresponding to the prediction block and the current block of the video call; the block vector information of the current block of the video call is encoded, and a second flag bit is encoded as a second value.
[0269] In some embodiments, for the current block of a video call within a video frame, the encoding information of the current block of the video call is obtained; based on the encoding information of the current block of the video call, the prediction block corresponding to the current block of the video call is determined, the prediction block being either a first matching block or a second matching block, the first matching block being a decoded block that matches the current block of the video call determined based on a first prediction mode, and the second matching block being a decoded block that matches the first matching block determined based on a second prediction mode; based on the prediction block corresponding to the current block of the video call, the current block of the video call is decoded.
[0270] In some embodiments, when the encoding information of the current block of the video call includes the encoding information of block vector information, the encoding information of block vector information is decoded to obtain block vector information; based on the block vector information and the position information of the current block of the video call, a first matching block is determined from at least one decoded block; the first matching block is determined as the prediction block corresponding to the current block of the video call, and it is determined that the first matching block does not have a corresponding second matching block.
[0271] In some embodiments, when the encoding information of the current block of the video call includes the encoding information of block vector information and the encoding information of the first flag bit, the encoding information of the block vector information is decoded to obtain the block vector information; based on the block vector information and the position information of the current block of the video call, a first matching block is determined from at least one decoded block; the encoding information of the first flag bit is decoded, and when the value of the first flag bit is a first value, the first matching block is determined as the prediction block corresponding to the current block of the video call, and it is determined that the first matching block has a corresponding second matching block.
[0272] In some embodiments, when the encoding information of the current block of the video call includes the encoding information of block vector information and the encoding information of the second flag bit, the encoding information of the block vector information is decoded to obtain the block vector information; based on the block vector information and the position information of the current block of the video call, a first matching block is determined from at least one decoded block; the encoding information of the second flag bit is decoded, and if the value of the second flag bit is a second value, a second matching block corresponding to the first matching block is obtained; the second matching block is determined as the prediction block corresponding to the current block of the video call.
[0273] The technical solution provided in this application, for the current block of a video call within a video frame, not only obtains a first matching block determined by a first prediction mode that matches the current block of the video call, but also obtains a second matching block that matches the first matching block. From at least one first matching block and at least one second matching block, a prediction block matching the current block of the video call is determined. Compared to related technologies that directly search for prediction blocks from the encoded region, the technical solution provided in this application, based on the first matching block, further obtains matching blocks of the first matching block, and determines the prediction block matching the current block of the video call from at least two matching blocks (including the first matching block and the second matching block). With more matching block options compared to related technologies, this application also achieves higher accuracy in intra-frame prediction, thereby improving the performance of video call encoding and decoding.
[0274] In some embodiments, the video frame is a video frame from a video conference.
[0275] Please refer to Figure 14This document illustrates a flowchart of a video encoding / decoding method for video conferencing according to an embodiment of this application. The execution subject of this method can be the first device 210 or the second device 220 described above. For ease of explanation, only computer devices are described as the execution subject of each step. The method may include at least one of the following steps (1410-1440).
[0276] Step 1410: For the current block of the video conference within a video frame, obtain at least one first matching block, wherein the at least one first matching block is an encoded block that matches the current block of the video conference based on a first prediction mode.
[0277] In some embodiments, a video frame here refers to any video frame generated by a video conference. The current block of a video conference refers to a coding unit, tile, image block, or pigment block divided within a video frame generated during the video conference.
[0278] Step 1420: Based on at least one first matching block, obtain at least one second matching block, where there exists at least one first matching block with a number of second matching blocks greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block based on the second prediction mode.
[0279] Step 1430: Determine the prediction block corresponding to the current block of the video conference from at least one first matching block and at least one second matching block.
[0280] Step 1440: Encode the current block of the video conference based on the predicted block corresponding to the current block of the video conference.
[0281] In some embodiments, for the i-th first matching block in at least one first matching block, based on the position information of the i-th first matching block, a first coded unit is determined from at least one coded unit in the video frame, where the first coded unit is the coded unit where the i-th first matching block is located, and i is a positive integer; the block vector information of the first coded unit is obtained, which is used to indicate the relative position between the matching block corresponding to the first coded unit and the first coded unit, and the block vector information of the first coded unit is determined based on a second prediction mode; and a second matching block corresponding to the i-th first matching block is determined according to the position information of the i-th first matching block and the block vector information of the first coded unit.
[0282] In some embodiments, the prediction mode of the first coded unit is obtained; if the prediction mode of the first coded unit is the second prediction mode, the step of obtaining the block vector information of the first coded unit is performed; if the prediction mode of the first coded unit is not the second prediction mode, it is determined that the i-th first matching block does not have a corresponding second matching block.
[0283] In some embodiments, if it is determined based on the position information of the i-th first matching block that the i-th first matching block is completely surrounded by one of the at least one encoded units, the encoded unit that completely surrounds the i-th first matching block and is encoded based on the second prediction mode is determined as the first encoded unit; or, if it is determined based on the position information of the i-th first matching block that the i-th first matching block overlaps with at least two of the at least two encoded units, the encoded unit encoded based on the second prediction mode among the at least two encoded units is determined as the first encoded unit.
[0284] In some embodiments, if there are at least two encoded units encoded based on the second prediction mode among at least two encoded units, the encoded unit with the largest overlap area with the i-th first matching block is determined as the first encoded unit.
[0285] In some embodiments, the second prediction mode includes at least one of the following: IBC mode, intra-frame TMP mode.
[0286] In some embodiments, based on the pixel values corresponding to at least one first matching block, at least one second matching block, and the current block of the video conference, the errors between at least one first matching block and at least one second matching block and the current block of the video conference are determined, and the errors include at least one of the sum of squared errors and the sum of absolute errors; the matching block with the smallest error between at least one first matching block and at least one second matching block and the current block of the video conference is determined as the prediction block corresponding to the current block of the video conference.
[0287] In some embodiments, when the predicted block is one of at least one first matching blocks and there is no corresponding second matching block, the current block of the video conference is encoded based on the predicted block; or, when the predicted block is one of at least one first matching blocks and there is a corresponding second matching block, the current block of the video conference is encoded based on the predicted block and a first flag bit; or, when the predicted block is one of at least one second matching blocks, the current block of the video conference is encoded based on the predicted block and a second flag bit; wherein the first flag bit and the second flag bit are different, or the first flag bit and the second flag bit are the same flag bit, but are encoded with different values.
[0288] In some embodiments, block vector information of the current block of the video conference is obtained, which is determined by a first prediction mode based on the relative position between the prediction block and the current block of the video conference; the block vector information of the current block of the video conference is encoded.
[0289] In some embodiments, the block vector information of the current block of the video conference is obtained, which is determined by a first prediction mode based on the relative position between the prediction block and the current block of the video conference; the block vector information of the current block of the video conference is encoded, and a first flag bit is encoded as a first value.
[0290] In some embodiments, the block vector information of the current block of the video conference is obtained, which is determined by a first prediction mode based on the relative position between the first matching block corresponding to the prediction block and the current block of the video conference; the block vector information of the current block of the video conference is encoded, and a second flag bit is encoded as a second value.
[0291] In some embodiments, for the current block of a video conference within a video frame, the encoding information of the current block of the video conference is obtained; based on the encoding information of the current block of the video conference, the prediction block corresponding to the current block of the video conference is determined, wherein the prediction block is a first matching block or a second matching block, wherein the first matching block is a decoded block that matches the current block of the video conference based on a first prediction mode, and the second matching block is a decoded block that matches the first matching block based on a second prediction mode; and based on the prediction block corresponding to the current block of the video conference, the current block of the video conference is decoded.
[0292] In some embodiments, when the encoding information of the current block of the video conference includes the encoding information of block vector information, the encoding information of block vector information is decoded to obtain block vector information; based on the block vector information and the position information of the current block of the video conference, a first matching block is determined from at least one decoded block; the first matching block is determined as the prediction block corresponding to the current block of the video conference, and it is determined that the first matching block does not have a corresponding second matching block.
[0293] In some embodiments, when the encoding information of the current block of the video conference includes the encoding information of block vector information and the encoding information of the first flag bit, the encoding information of the block vector information is decoded to obtain the block vector information; based on the block vector information and the position information of the current block of the video conference, a first matching block is determined from at least one decoded block; the encoding information of the first flag bit is decoded, and if the value of the first flag bit is a first value, the first matching block is determined as the prediction block corresponding to the current block of the video conference, and it is determined that the first matching block has a corresponding second matching block.
[0294] In some embodiments, when the encoding information of the current block of the video conference includes the encoding information of block vector information and the encoding information of the second flag bit, the encoding information of the block vector information is decoded to obtain the block vector information; based on the block vector information and the position information of the current block of the video conference, a first matching block is determined from at least one decoded block; the encoding information of the second flag bit is decoded, and if the value of the second flag bit is a second value, a second matching block corresponding to the first matching block is obtained; the second matching block is determined as the prediction block corresponding to the current block of the video conference.
[0295] The technical solution provided in this application, for the current block of a video conference within a video frame, not only obtains a first matching block determined by a first prediction mode that matches the current block of the video conference, but also obtains a second matching block that matches the first matching block. From at least one first matching block and at least one second matching block, a prediction block matching the current block of the video conference is determined. Compared to related technologies that directly search for prediction blocks from the encoded region, the technical solution provided in this application, based on the first matching block, further obtains matching blocks of the first matching block, and determines the prediction block matching the current block of the video conference from at least two matching blocks (including the first matching block and the second matching block). With more matching block options compared to related technologies, this application also achieves higher accuracy in intra-frame prediction, thereby improving the performance of video conferencing encoding and decoding.
[0296] In some embodiments, the video frame is a video frame from a short video.
[0297] Please refer to Figure 15 This document illustrates a flowchart of a video encoding / decoding method for short videos according to an embodiment of this application. The execution subject of this method can be the first device 210 or the second device 220 described above. For ease of explanation, only computer devices are described as the execution subject of each step. The method may include at least one of the following steps (1510-1540).
[0298] Step 1510: For the current block of the short video within the video frame, obtain at least one first matching block, wherein the at least one first matching block is an encoded block that matches the current block of the short video based on the first prediction mode.
[0299] In some embodiments, a video frame here refers to any one video frame in a short video. The current block of a short video refers to a coding unit, tile, image block, or pigment block divided within the video frame generated by the short video.
[0300] Step 1520: Based on at least one first matching block, obtain at least one second matching block, where there exists at least one first matching block with a number of second matching blocks greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block as determined by the second prediction mode.
[0301] Step 1530: Determine the prediction block corresponding to the current block of the short video from at least one first matching block and at least one second matching block.
[0302] Step 1540: Encode the current block of the short video based on the predicted block corresponding to the current block of the short video.
[0303] In some embodiments, for the i-th first matching block in at least one first matching block, based on the position information of the i-th first matching block, a first coded unit is determined from at least one coded unit in the video frame, where the first coded unit is the coded unit where the i-th first matching block is located, and i is a positive integer; the block vector information of the first coded unit is obtained, which is used to indicate the relative position between the matching block corresponding to the first coded unit and the first coded unit, and the block vector information of the first coded unit is determined based on a second prediction mode; and a second matching block corresponding to the i-th first matching block is determined according to the position information of the i-th first matching block and the block vector information of the first coded unit.
[0304] In some embodiments, the prediction mode of the first coded unit is obtained; if the prediction mode of the first coded unit is the second prediction mode, the step of obtaining the block vector information of the first coded unit is performed; if the prediction mode of the first coded unit is not the second prediction mode, it is determined that the i-th first matching block does not have a corresponding second matching block.
[0305] In some embodiments, if it is determined based on the position information of the i-th first matching block that the i-th first matching block is completely surrounded by one of the at least one encoded units, the encoded unit that completely surrounds the i-th first matching block and is encoded based on the second prediction mode is determined as the first encoded unit; or, if it is determined based on the position information of the i-th first matching block that the i-th first matching block overlaps with at least two of the at least two encoded units, the encoded unit encoded based on the second prediction mode among the at least two encoded units is determined as the first encoded unit.
[0306] In some embodiments, if there are at least two encoded units encoded based on the second prediction mode among at least two encoded units, the encoded unit with the largest overlap area with the i-th first matching block is determined as the first encoded unit.
[0307] In some embodiments, the second prediction mode includes at least one of the following: IBC mode, intra-frame TMP mode.
[0308] In some embodiments, based on the pixel values corresponding to at least one first matching block, at least one second matching block, and the current block of the short video, the errors between at least one first matching block and at least one second matching block and the current block of the short video are determined, and the errors include at least one of the sum of squared errors and the sum of absolute errors; the matching block with the smallest error between at least one first matching block and at least one second matching block and the current block of the short video is determined as the prediction block corresponding to the current block of the short video.
[0309] In some embodiments, when the predicted block is one of at least one first matching blocks and there is no corresponding second matching block, the current block of the short video is encoded based on the predicted block; or, when the predicted block is one of at least one first matching blocks and there is a corresponding second matching block, the current block of the short video is encoded based on the predicted block and a first flag bit; or, when the predicted block is one of at least one second matching blocks, the current block of the short video is encoded based on the predicted block and a second flag bit; wherein the first flag bit and the second flag bit are different, or the first flag bit and the second flag bit are the same flag bit, but are encoded with different values.
[0310] In some embodiments, the block vector information of the current block of the short video is obtained, which is determined by a first prediction mode based on the relative position between the prediction block and the current block of the short video; the block vector information of the current block of the short video is then encoded.
[0311] In some embodiments, the block vector information of the current block of the short video is obtained, which is determined by a first prediction mode based on the relative position between the prediction block and the current block of the short video; the block vector information of the current block of the short video is encoded, and a first flag bit is encoded as a first value.
[0312] In some embodiments, the block vector information of the current block of the short video is obtained, which is determined by a first prediction mode based on the relative position between the first matching block corresponding to the prediction block and the current block of the short video; the block vector information of the current block of the short video is encoded, and the second flag bit is encoded as a second value.
[0313] In some embodiments, for the current block of a short video within a video frame, the encoding information of the current block of the short video is obtained; based on the encoding information of the current block of the short video, the prediction block corresponding to the current block of the short video is determined, the prediction block being either a first matching block or a second matching block, the first matching block being a decoded block that matches the current block of the short video determined based on a first prediction mode, and the second matching block being a decoded block that matches the first matching block determined based on a second prediction mode; based on the prediction block corresponding to the current block of the short video, the current block of the short video is decoded.
[0314] In some embodiments, when the encoding information of the current block of the short video includes the encoding information of block vector information, the encoding information of block vector information is decoded to obtain block vector information; based on the block vector information and the position information of the current block of the short video, a first matching block is determined from at least one decoded block; the first matching block is determined as the prediction block corresponding to the current block of the short video, and it is determined that the first matching block does not have a corresponding second matching block.
[0315] In some embodiments, when the encoding information of the current block of the short video includes the encoding information of block vector information and the encoding information of the first flag bit, the encoding information of the block vector information is decoded to obtain the block vector information; based on the block vector information and the position information of the current block of the short video, a first matching block is determined from at least one decoded block; the encoding information of the first flag bit is decoded, and if the value of the first flag bit is a first value, the first matching block is determined as the prediction block corresponding to the current block of the short video, and it is determined that the first matching block has a corresponding second matching block.
[0316] In some embodiments, when the encoding information of the current block of the short video includes the encoding information of block vector information and the encoding information of the second flag bit, the encoding information of the block vector information is decoded to obtain the block vector information; based on the block vector information and the position information of the current block of the short video, a first matching block is determined from at least one decoded block; the encoding information of the second flag bit is decoded, and if the value of the second flag bit is a second value, a second matching block corresponding to the first matching block is obtained; the second matching block is determined as the prediction block corresponding to the current block of the short video.
[0317] The technical solution provided in this application, for the current block of a short video within a video frame, not only obtains a first matching block determined by a first prediction mode that matches the current block of the short video, but also obtains a second matching block that matches the first matching block. From at least one first matching block and at least one second matching block, a prediction block matching the current block of the short video is determined. Compared to related technologies that directly search for prediction blocks from the encoded region, the technical solution provided in this application, based on the first matching block, further obtains matching blocks of the first matching block, and determines the prediction block matching the current block of the short video from at least two matching blocks (including the first matching block and the second matching block). With more matching block options compared to related technologies, this application also achieves higher accuracy in intra-frame prediction, thereby improving the performance of short video encoding and decoding.
[0318] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0319] Please refer to Figure 16 This diagram illustrates a block diagram of a video encoding apparatus according to an embodiment of this application. The apparatus has the functionality to implement the method example described above; this functionality can be implemented in hardware or by hardware executing corresponding software. The apparatus can be the encoding end device described above, or it can be located within an encoding end device. The apparatus 1600 may include: a first acquisition module 1610, a second acquisition module 1620, a prediction block determination module 1630, and an encoding module 1640.
[0320] The first acquisition module 1610 is used to acquire at least one first matching block for the current block in a video frame, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode.
[0321] The second acquisition module 1620 is used to acquire at least one second matching block based on the at least one first matching block, wherein there exists at least one first matching block and the number of second matching blocks corresponding to it is greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block based on the second prediction mode.
[0322] The prediction block determination module 1630 is used to determine the prediction block corresponding to the current block from at least one first matching block and the at least one second matching block.
[0323] The encoding module 1640 is used to encode the current block based on the prediction block corresponding to the current block.
[0324] In some embodiments, the second acquisition module 1620 is configured to, for the i-th first matching block in the at least one first matching block, determine a first encoded unit from at least one encoded unit in the video frame based on the position information of the i-th first matching block, wherein the first encoded unit is the encoded unit where the i-th first matching block is located, and i is a positive integer.
[0325] The second acquisition module 1620 is further configured to acquire block vector information of the first encoded unit, wherein the block vector information of the first encoded unit is used to indicate the relative position between the matching block corresponding to the first encoded unit and the first encoded unit, and the block vector information of the first encoded unit is determined based on the second prediction mode.
[0326] The second acquisition module 1620 is further configured to determine the second matching block corresponding to the i-th first matching block based on the position information of the i-th first matching block and the block vector information of the first encoded unit.
[0327] In some embodiments, the second acquisition module 1620 is configured to acquire the prediction mode of the first encoded unit; if the prediction mode of the first encoded unit is the second prediction mode, perform the step of acquiring the block vector information of the first encoded unit; if the prediction mode of the first encoded unit is not the second prediction mode, determine that the i-th first matching block does not have a corresponding second matching block.
[0328] In some embodiments, the second acquisition module 1620 is configured to, when it is determined based on the position information of the i-th first matching block that the i-th first matching block is completely surrounded by one of the at least one encoded units, determine the encoded unit that completely surrounds the i-th first matching block and is encoded based on the second prediction mode as the first encoded unit; or, when it is determined based on the position information of the i-th first matching block that the i-th first matching block overlaps with at least two of the at least two encoded units, determine the encoded unit encoded based on the second prediction mode among the at least two encoded units as the first encoded unit.
[0329] In some embodiments, the second acquisition module 1620 is configured to determine the encoded unit with the largest overlap area with the i-th first matching block as the first encoded unit when there are at least two encoded units encoded based on the second prediction mode among the at least two encoded units.
[0330] In some embodiments, the second prediction mode includes at least one of the following: IBC mode and TMP mode.
[0331] In some embodiments, the prediction block determination module 1630 is configured to determine the errors between the at least one first matching block and the at least one second matching block and the current block respectively, based on the pixel values corresponding to the at least one first matching block, the at least one second matching block and the current block respectively, wherein the errors include at least one of the sum of squared errors and the sum of absolute errors; and determine the matching block with the smallest error between the at least one first matching block and the at least one second matching block and the current block as the prediction block corresponding to the current block.
[0332] In some embodiments, the encoding module 1640 is configured to: encode the current block based on the predicted block when the predicted block is one of the at least one first matching blocks and the predicted block does not have a corresponding second matching block; or, encode the current block based on the predicted block and a first flag bit when the predicted block is one of the at least one first matching blocks and the predicted block has a corresponding second matching block; or, encode the current block based on the predicted block and a second flag bit when the predicted block is one of the at least one second matching blocks, wherein the first flag bit is different from the second flag bit, or the first flag bit and the second flag bit are the same flag bit but are encoded with different values.
[0333] In some embodiments, the encoding module 1640 is used to obtain the block vector information of the current block, wherein the block vector information of the current block is encoded based on the first prediction mode.
[0334] In some embodiments, the encoding module 1640 is configured to obtain the block vector information of the current block, the block vector information of the current block being based on the first prediction mode; to encode the block vector information of the current block, and to encode the first flag bit as a first value.
[0335] In some embodiments, the encoding module 1640 is configured to obtain the block vector information of the current block, the block vector information of the current block being determined by the first prediction mode based on the relative position between the first matching block corresponding to the prediction block and the current block; encode the block vector information of the current block; and encode the second flag bit as a second value.
[0336] Please refer to Figure 17This diagram illustrates a block diagram of a video decoding apparatus according to an embodiment of this application. The apparatus has the functionality to implement the method example described above; this functionality can be implemented in hardware or by hardware executing corresponding software. The apparatus can be the decoding end device described above, or it can be located within a decoding end device. The apparatus 1700 may include: an acquisition module 1710 and a decoding module 1720.
[0337] The acquisition module 1710 is used to acquire the encoding information of the current block within a video frame.
[0338] The decoding module 1720 is used to determine the prediction block corresponding to the current block based on the encoding information of the current block. The prediction block is either a first matching block or a second matching block. The first matching block is a decoded block that matches the current block based on a first prediction mode, and the second matching block is a decoded block that matches the first matching block based on a second prediction mode.
[0339] The decoding module 1720 is also used to decode the current block according to the prediction block corresponding to the current block.
[0340] In some embodiments, when the encoding information of the current block includes the encoding information of block vector information but does not include the encoding information of the first flag bit or the encoding information of the second flag bit, the decoding module 1720 is used to decode the encoding information of the block vector information to obtain the block vector information; based on the block vector information and the position information of the current block, determine the first matching block from at least one decoded block; determine the first matching block as the prediction block corresponding to the current block, and determine that the first matching block does not have a corresponding second matching block.
[0341] In some embodiments, when the encoding information of the current block includes the encoding information of block vector information and the encoding information of the first flag bit, the decoding module 1720 is used to decode the encoding information of the block vector information to obtain the block vector information; based on the block vector information and the position information of the current block, determine the first matching block from at least one decoded block; decode the encoding information of the first flag bit, and when the value of the first flag bit is a first value, determine the first matching block as the prediction block corresponding to the current block, and determine that the first matching block has a corresponding second matching block.
[0342] In some embodiments, when the encoding information of the current block includes the encoding information of block vector information and the encoding information of the second flag bit, the decoding module 1720 is used to decode the encoding information of the block vector information to obtain the block vector information; based on the block vector information and the position information of the current block, determine the first matching block from at least one decoded block; decode the encoding information of the second flag bit, and when the value of the second flag bit is a second value, obtain the second matching block corresponding to the first matching block; and determine the second matching block as the prediction block corresponding to the current block.
[0343] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0344] Please refer to Figure 18 This diagram illustrates a structural block diagram of a computer device according to an embodiment of this application. The computer device can be either the encoding device or the decoding device described above. The computer device 180 may include a processor 181, a memory 182, a communication interface 183, and a bus 185.
[0345] The processor 181 includes one or more processing cores, and the processor 181 executes various functional applications and information processing by running software programs and modules.
[0346] The memory 182 can be used to store computer programs, and the processor 181 is used to execute the computer programs to implement the above-mentioned video encoding method and video decoding method.
[0347] Communication interface 183 can be used to communicate with other devices, such as receiving and receiving audio and video data.
[0348] The processor 181 can be used to implement encoding and decoding functions, such as encoding and decoding audio and video data.
[0349] The memory 182 is connected to the processor 181 via bus 185.
[0350] Furthermore, the memory 182 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, including but not limited to: magnetic disks or optical disks, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), SRAM (Static Random-Access Memory), ROM (Read-Only Memory), magnetic storage, flash memory, and PROM (Programmable Read-Only Memory).
[0351] Those skilled in the art will understand that Figure 18 The structure shown does not constitute a limitation on the computer device 180, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0352] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores a computer program and a video stream. When executed by a processor, the computer program implements the aforementioned video encoding method to generate a video stream; or, when executed by a processor, the computer program implements the aforementioned video decoding method to decode the video stream. Optionally, the computer-readable storage medium may include ROM (Read-Only Memory), RAM (Random Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0353] In an exemplary embodiment, a computer program product is also provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the aforementioned video encoding or video decoding method.
[0354] It should be noted that the collection and processing of relevant data (including videos) in this application should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0355] It should be understood that "multiple" as used herein 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 are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0356] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method of video coding, the method comprising: The method includes: For the current block within a video frame, at least one first matching block is obtained, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode; Based on the at least one first matching block, at least one second matching block is obtained, and there exists at least one first matching block with a number of second matching blocks greater than or equal to 1. The second matching block is an encoded block that matches the first matching block based on the second prediction mode. The prediction block corresponding to the current block is determined from the at least one first matching block and the at least one second matching block; The current block is encoded based on the prediction block corresponding to the current block.
2. The method of claim 1, wherein, The step of obtaining at least one second matching block based on the at least one first matching block includes: For the i-th first matching block in the at least one first matching block, based on the position information of the i-th first matching block, a first encoded unit is determined from at least one encoded unit in the video frame, where the first encoded unit is the encoded unit where the i-th first matching block is located, and i is a positive integer; Obtain the block vector information of the first encoded unit. The block vector information of the first encoded unit is used to indicate the relative position between the matching block corresponding to the first encoded unit and the first encoded unit. The block vector information of the first encoded unit is determined based on the second prediction mode. Based on the position information of the i-th first matching block and the block vector information of the first encoded unit, the second matching block corresponding to the i-th first matching block is determined.
3. The method of claim 2, wherein, The method further includes: Obtain the prediction pattern of the first encoded unit; If the prediction mode of the first encoded unit is the second prediction mode, then the step of obtaining the block vector information of the first encoded unit is performed. If the prediction mode of the first encoded unit is not the second prediction mode, it is determined that the i-th first matching block does not have a corresponding second matching block.
4. The method according to claim 2 or 3, characterized in that, Determining the first encoded unit from at least one encoded unit within the video frame based on the position information of the i-th first matching block includes: If, based on the position information of the i-th first matching block, it is determined that the i-th first matching block is completely surrounded by one of the at least one encoded units, then the encoded unit that completely surrounds the i-th first matching block and is encoded based on the second prediction mode is determined as the first encoded unit; or... If, based on the position information of the i-th first matching block, it is determined that the i-th first matching block overlaps with at least two of the at least two encoded units, the encoded unit encoded based on the second prediction mode among the at least two encoded units is determined as the first encoded unit.
5. The method of claim 4, wherein, The step of determining the encoded unit based on the second prediction mode among the at least two encoded units as the first encoded unit includes: If at least two of the at least two encoded units are encoded based on the second prediction mode, the encoded unit with the largest overlap area with the i-th first matching block is determined as the first encoded unit.
6. The method according to any one of claims 1 to 5, characterized in that, The second prediction mode includes at least one of the following: Intra-Block Copy (IBC) mode and Intra-Template Match Prediction (TMP) mode.
7. The method according to any one of claims 1 to 6, characterized in that, Determining the prediction block corresponding to the current block from the at least one first matching block and the at least one second matching block includes: Based on the pixel values corresponding to the at least one first matching block, the at least one second matching block, and the current block, respectively, the errors between the at least one first matching block and the at least one second matching block and the current block are determined, and the errors include at least one of the sum of squared errors and the sum of absolute errors; The matching block with the smallest error between the current block and the at least one first matching block and the at least one second matching block is determined as the prediction block corresponding to the current block.
8. The method according to any one of claims 1 to 7, characterized in that, Encoding the current block based on the predicted block corresponding to the current block includes: If the predicted block is one of the at least one first matching blocks, and the predicted block does not have a corresponding second matching block, then the current block is encoded based on the predicted block; or, If the predicted block is one of the at least one first matching blocks, and the predicted block has a corresponding second matching block, then the current block is encoded based on the predicted block and the first flag bit; or, If the predicted block is one of the at least one second matching blocks, the current block is encoded based on the predicted block and the second flag bit; Wherein, the first flag bit is different from the second flag bit, or the first flag bit and the second flag bit are the same flag bit, but are encoded with different values.
9. The method of claim 8, wherein, Encoding the current block based on the predicted block includes: Obtain the block vector information of the current block, which is determined by the first prediction mode based on the relative position between the predicted block and the current block; Encode the block vector information of the current block.
10. The method according to claim 8 or 9, characterized in that, Encoding the current block based on the predicted block and the first flag bit includes: Obtain the block vector information of the current block, which is determined by the first prediction mode based on the relative position between the predicted block and the current block; The block vector information of the current block is encoded, and the first flag bit is encoded as a first value.
11. The method according to any one of claims 8 to 10, characterized in that, Encoding the current block based on the predicted block and the second flag bit includes: Obtain the block vector information of the current block, which is determined by the first prediction mode based on the relative position between the first matching block corresponding to the predicted block and the current block; The block vector information of the current block is encoded, and the second flag bit is encoded as a second value.
12. A video decoding method, characterized in that, The method includes: For the current block within a video frame, obtain the encoding information of the current block; Based on the encoding information of the current block, a prediction block corresponding to the current block is determined. The prediction block is either a first matching block or a second matching block. The first matching block is a decoded block that matches the current block based on a first prediction mode, and the second matching block is a decoded block that matches the first matching block based on a second prediction mode. Decode the current block based on the prediction block corresponding to the current block.
13. The method according to claim 12, characterized in that, When the encoding information of the current block includes the encoding information of block vector information, determining the prediction block corresponding to the current block based on the encoding information of the current block includes: Decode the encoded information of the block vector information to obtain the block vector information; Based on the block vector information and the position information of the current block, the first matching block is determined from at least one decoded block; The first matching block is determined as the prediction block corresponding to the current block, and it is determined that the first matching block does not have a corresponding second matching block.
14. The method according to claim 12, characterized in that, When the encoding information of the current block includes the encoding information of the block vector information and the encoding information of the first flag bit, determining the prediction block corresponding to the current block based on the encoding information of the current block includes: Decode the encoded information of the block vector information to obtain the block vector information; Based on the block vector information and the position information of the current block, the first matching block is determined from at least one decoded block; Decode the encoded information of the first flag bit. If the value of the first flag bit is a first value, determine the first matching block as the prediction block corresponding to the current block, and determine that the first matching block has a corresponding second matching block.
15. The method according to claim 12, characterized in that, When the encoding information of the current block includes the encoding information of the block vector information and the encoding information of the second flag bit, determining the prediction block corresponding to the current block based on the encoding information of the current block includes: Decode the encoded information of the block vector information to obtain the block vector information; Based on the block vector information and the position information of the current block, the first matching block is determined from at least one decoded block; Decode the encoded information of the second flag bit, and if the value of the second flag bit is the second value, obtain the second matching block corresponding to the first matching block; The second matching block is determined as the prediction block corresponding to the current block.
16. A video encoding device, characterized in that, The device includes: The first acquisition module is used to acquire at least one first matching block for the current block in a video frame, wherein the at least one first matching block is an encoded block that matches the current block based on a first prediction mode; The second acquisition module is used to acquire at least one second matching block based on the at least one first matching block, wherein there exists at least one first matching block and the number of second matching blocks corresponding to it is greater than or equal to 1, and the second matching block is an encoded block that matches the first matching block based on the second prediction mode. A prediction block determination module is used to determine the prediction block corresponding to the current block from the at least one first matching block and the at least one second matching block; The encoding module is used to encode the current block based on the prediction block corresponding to the current block.
17. A video decoding device, characterized in that, The device includes: The acquisition module is used to acquire the encoding information of the current block within a video frame; The decoding module is used to determine the prediction block corresponding to the current block based on the encoding information of the current block. The prediction block is either a first matching block or a second matching block. The first matching block is a decoded block that matches the current block based on a first prediction mode, and the second matching block is a decoded block that matches the first matching block based on a second prediction mode. The decoding module is further configured to decode the current block based on the prediction block corresponding to the current block.
18. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the method as claimed in any one of claims 1 to 11, or to implement the method as claimed in any one of claims 12 to 15.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program and a video stream, wherein the computer program is executed by a processor to implement the method as described in any one of claims 1 to 11 to generate the video stream; or, the computer program is executed by a processor to implement the method as described in any one of claims 12 to 15 to decode the video stream.
20. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, which a processor reads from and executes to implement the method as claimed in any one of claims 1 to 11, or to implement the method as claimed in any one of claims 12 to 15.