Encoding, decoding method, apparatus, codec and medium
By acquiring the difference data between video image blocks, simplifying the calculation of rate distortion cost, and determining the appropriate inter-frame prediction method, the problem of high complexity in existing inter-frame prediction algorithms is solved, improving the efficiency and quality of video encoding and decoding, and reducing hardware resource consumption and cost.
Patent Information
- Application Number
- CN202610534763.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-22
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2046-04-22
AI Technical Summary
In existing video encoding and decoding technologies, the rate-distortion cost of inter-frame prediction algorithms has high computational complexity, resulting in high hardware computational overhead, high hardware resource utilization, low encoding efficiency, high hardware blocking and task latency, and high chip cost and power consumption.
By acquiring the difference data between the current block and its neighboring blocks, encoding parameters are obtained based on the difference data, simplifying the calculation of rate-distortion cost, determining the appropriate inter-frame prediction method, reducing hardware computational complexity, and improving the efficiency of the prediction process.
It reduces the hardware computational overhead of the encoding and decoding process, improves encoding quality and efficiency, reduces hardware resource consumption, and lowers chip cost and power consumption.
Smart Images

Figure CN122093563B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, apparatus, codec, and medium. Background Technology
[0002] During video encoding, the encoder needs to use an inter-frame prediction algorithm to perform predictive coding on the current block to obtain a prediction block; during video decoding, the decoder uses the corresponding inter-frame prediction algorithm to reconstruct the same prediction block as the encoding process from the decoded reference frame based on the motion vectors parsed from the bitstream and the reference frame index.
[0003] In related technologies, after obtaining the motion vector of the current block through motion estimation and the prediction data of the current block through motion compensation, based on the above motion vector and prediction data, the inter-frame prediction algorithm corresponding to the current block is determined by calculating the rate-distortion cost of different inter-frame prediction methods, thereby performing predictive coding processing on the current block to obtain the prediction block. Summary of the Invention
[0004] This application provides an encoding and decoding method, apparatus, codec, and medium. The technical solution includes the following aspects.
[0005] On one hand, embodiments of this application provide an encoding method, the method comprising: Obtain the difference data between the current block and adjacent blocks of a video image, wherein the video image is an image to be encoded; The encoding parameters of the current block are obtained based on the difference data, and the encoding parameters are used to indicate the inter-frame prediction method for the current block; The inter-frame prediction data of the current block is obtained based on the encoding parameters.
[0006] On the other hand, embodiments of this application provide a decoding method, the method comprising: Obtain the difference data between the current block and adjacent blocks of a video image, wherein the video image is an image to be decoded; The encoding parameters of the current block are obtained based on the difference data, and the encoding parameters are used to indicate the inter-frame prediction method for the current block; Based on the encoding parameters, the current block is reconstructed to obtain the inter-frame prediction data of the current block.
[0007] On the other hand, embodiments of this application provide an encoding device, the device comprising: The encoding module is used to acquire the difference data between the current block and adjacent blocks of a video image, wherein the video image is the image to be encoded; The encoding module is used to obtain the encoding parameters of the current block based on the difference data, and the encoding parameters are used to indicate the inter-frame prediction method for the current block; The encoding module is used to obtain inter-frame prediction data of the current block based on the encoding parameters.
[0008] On the other hand, embodiments of this application provide a decoding device, the device comprising: The decoding module is used to acquire the difference data between the current block and adjacent blocks of a video image, wherein the video image is the image to be decoded; The decoding module is used to obtain the encoding parameters of the current block based on the difference data, and the encoding parameters are used to indicate the inter-frame prediction method for the current block; The decoding module is used to reconstruct the current block based on the encoding parameters to obtain the inter-frame prediction data of the current block.
[0009] On the other hand, embodiments of this application provide an encoder, the encoder including a memory and a processor, the memory for storing a computer program running on the processor; the processor for executing the encoding method as described above when running the computer program.
[0010] On the other hand, embodiments of this application provide a decoder, the decoder including a memory and a processor, the memory being used to store a computer program running on the processor; the processor being used to execute the decoding method as described above when running the computer program.
[0011] On the other hand, embodiments of this application provide a computer-readable storage medium storing a bitstream thereon, and at least one of a computer program and instructions, wherein when the at least one of the computer program and instructions is executed by a processor, it implements the steps of the encoding method as described above to generate the bitstream.
[0012] On the other hand, embodiments of this application provide a computer-readable storage medium storing a bitstream thereon, and at least one of a computer program and instructions, wherein when the at least one of the computer program and instructions is executed by a processor, it implements the steps of the decoding method as described above to decode the bitstream to generate a video or image.
[0013] On the other hand, embodiments of this application provide a method for storing a bitstream, the method comprising: generating a bitstream by performing the encoding method as described above; and storing the bitstream.
[0014] On the other hand, embodiments of this application provide a method for reading a bitstream, the method comprising: reading the bitstream; and performing a decoding method as described above to decode the bitstream to generate a video or image.
[0015] On the other hand, embodiments of this application provide a method for transmitting a bitstream, the method comprising: performing an encoding method as described above to generate a bitstream; and transmitting the bitstream.
[0016] On the other hand, embodiments of this application provide a method for receiving a bitstream, the method comprising: receiving the bitstream; and performing a decoding method as described above to decode the bitstream to generate a video or image.
[0017] On the other hand, embodiments of this application provide a computer program product, which includes computer instructions that are executed by a processor to implement the encoding or decoding methods described above.
[0018] In this embodiment, by acquiring the difference data between the current block and adjacent blocks, the computational complexity of determining the encoding parameters corresponding to the current block by calculating the rate distortion cost is reduced, the process of determining the encoding parameters is simplified, thereby quickly determining the encoding parameters that are suitable for the current block, and performing predictive coding processing on the current block using the inter-frame prediction method indicated by the encoding parameters to obtain the inter-frame prediction data of the current block. This helps to improve the efficiency of the prediction process, reduce the hardware computational overhead in the encoding and decoding process, and improve the encoding quality. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the encoding process at the encoding end provided in an exemplary embodiment of this application; Figure 2 This is a schematic diagram of the decoding process at the decoding end provided in an exemplary embodiment of this application; Figure 3 This is a flowchart of an exemplary embodiment of the encoding method provided in this application; Figure 4 This is a schematic diagram illustrating the spatial relationship between the current block and adjacent blocks, provided in an exemplary embodiment of this application. Figure 5 This is a schematic diagram of adjacent pixel value pairs between the current block and the left adjacent block provided in an exemplary embodiment of this application; Figure 6 This is a schematic diagram of adjacent pixel value pairs between the current block and the previous adjacent block provided in an exemplary embodiment of this application; Figure 7 This is a flowchart of an encoding method provided by another exemplary embodiment of this application; Figure 8This is a flowchart of an encoding method provided in yet another exemplary embodiment of this application; Figure 9 This is a flowchart of a decoding method provided in an exemplary embodiment of this application; Figure 10 This is a structural block diagram of an encoding apparatus provided in an exemplary embodiment of this application; Figure 11 This is a structural block diagram of a decoding apparatus provided in an exemplary embodiment of this application; Figure 12 This is a structural block diagram of an encoder provided in an exemplary embodiment of this application; Figure 13 This is a block diagram of the decoder provided in an exemplary embodiment of this application. Detailed Implementation
[0020] 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.
[0021] In this article, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0022] Currently, most common video codec standards employ a block-based hybrid coding framework. Images in a video are divided into squares of equal size (e.g., 256×256, 128×128, or 64×64) called Largest Coding Units (LCUs) or Coding Tree Units (CTUs). These LCUs or CTUs can be further subdivided into rectangular Coding Units (CUs) according to rules. Coding units may also be further divided into Prediction Units (PUs), Transform Units (TUs), and so on.
[0023] The hybrid coding framework includes modules such as prediction, transformation, quantization, entropy coding, and in-loop filtering. The prediction module includes intra-prediction and inter-prediction. Inter-prediction includes motion estimation and motion compensation. Because there is a strong correlation between adjacent samples in the same image, intra-prediction can be used in video coding and decoding techniques to eliminate spatial redundancy between adjacent samples. Because there is a strong similarity between adjacent images in a video, inter-prediction can be used in video coding and decoding techniques to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.
[0024] Please refer to Figure 1 , Figure 1 This is a schematic diagram illustrating the encoding process at the encoding end according to an exemplary embodiment of this application. At the encoding end, such as... Figure 1 As shown, the encoder first divides the image 110 into multiple coding blocks. Then, it uses either the intra-frame prediction algorithm 120 or the inter-frame prediction algorithm 130 (including motion estimation and motion compensation) to generate a prediction block for the current block. The encoder then subtracts the prediction block from the original block to obtain a residual block. This residual block is then transformed and quantized to obtain quantization coefficients. Finally, entropy coding 140 encodes the quantization coefficients into the bitstream. Furthermore, the encoder reconstructs the current block based on the inverse quantization / inverse transform results and the prediction block, obtaining a reconstructed block. This reconstructed block undergoes loop filtering 150 to compensate for distortion information and provide a better reference for subsequent encoding. Specifically, the inter-frame prediction algorithm 130 performs prediction processing on the current block based on the motion vector of the current block and the reconstructed image processed by loop filtering 150 (i.e., the reference frame), obtaining the prediction block for the current block.
[0025] For example, the loop filter 150 includes different types of loop filter tools applied sequentially in the decoding loop in a specific order, including but not limited to Luma Mapping with Chroma Scaling (LMCS), De-blocking Filter (DBF), Sample Adaptive Offset (SAO), Adaptive Loop Filter (ALF), and Cross-Component Adaptive Loop Filter (CCALF).
[0026] Please refer to Figure 2 , Figure 2 This is a schematic diagram illustrating the decoding process at the decoding end according to an exemplary embodiment of this application. At the decoding end, such as... Figure 2 As shown, the decoder uses either intra-frame prediction algorithm 120 or inter-frame prediction algorithm 130 to predict the prediction block of the current block. Simultaneously, it parses the bitstream and obtains quantization coefficients through entropy decoding 210. The quantization coefficients are then dequantized and inversely transformed to obtain residual blocks. The prediction block and residual blocks are then added together to obtain the reconstructed block of the current block. For the reconstructed block, the decoder further performs loop filtering 150, and finally generates a decoded image 220 based on the reconstructed block after loop filtering 150.
[0027] Video codec standards include multiple different encoding tools, which are used to implement specific video compression functions. Optionally, encoding tools are standardized modules or algorithms defined in the video codec standard. In predictive coding, encoding tools include inter-frame prediction tools, which can be implemented as inter-frame prediction algorithms.
[0028] In some embodiments, the encoder constructs a complete coding scheme by combining at least one coding tool. During inter-frame prediction coding, the coding tools required for inter-frame prediction processing of the current block include, but are not limited to, motion estimation, motion compensation, and enhancement algorithms based on the two aforementioned inter-frame prediction algorithms. The enhancement algorithm is a post-processing algorithm for motion estimation and motion compensation, used to further optimize the prediction data of the current block based on the processing results of motion estimation and motion compensation, thereby obtaining the predicted block for the current block. Exemplarily, enhancement algorithms include Adaptive Motion Vector Prediction (AMVP), Overlapped Block Motion Compensation (OBMC), and local illumination compensation algorithms, etc.
[0029] In some embodiments, the methods for determining the required enhancement algorithms during inter-frame prediction include, but are not limited to: judging the coding effect of each enhancement algorithm according to rate-distortion optimization criteria; the encoder calculates the rate-distortion cost of different inter-frame prediction methods respectively, and determines the enhancement algorithm to be executed during inter-frame prediction of the current block based on the rate-distortion cost. Optionally, different inter-frame prediction methods include the current coding scheme using any enhancement algorithm, and the current coding scheme not using any enhancement algorithm; or, the method of dividing the image into coding blocks, etc. Rate-distortion cost refers to the evaluation coefficient of the current coding scheme jointly determined by video distortion and bitrate. Accordingly, the lower the rate-distortion cost, the more balanced the corresponding coding scheme is between video distortion and bitrate, that is, the current coding scheme reduces the error between the coding model and the real complex video data.
[0030] Specifically, for the current block, rate-distortion (RDC) processing, including predicted pixel generation, residual calculation, distortion calculation, and bitrate estimation, yields the corresponding RDC costs for whether or not the enhancement algorithm is used. During encoding, RDC cost calculations are performed on multiple coded blocks under different inter-frame prediction methods, with each method corresponding to at least two encoding schemes. The RDC cost calculation process simulates the subsequent encoding steps corresponding to the chosen scheme, including but not limited to obtaining prediction residuals, transforming, quantizing, and entropy coding, thereby estimating the distortion and bitrate corresponding to the current encoding scheme.
[0031] Because the rate-distortion cost calculation requires high precision and is complex, the above-mentioned analog encoding process is computationally complex and has a large computational overhead. With the encoder's computing power remaining unchanged, the encoding efficiency is low. From a hardware perspective, during the processing of encoding instructions by the hardware unit corresponding to the encoder, the hardware resource occupancy rate is high. Under intensive encoding tasks, the computing unit is close to full load. When a new task arrives, it may not be processed immediately due to the hardware resources being occupied, resulting in queuing and waiting, leading to hardware blockage, low throughput, and high task latency.
[0032] To illustrate, when the encoder is placed on the chip, the hardware logic and complexity of inter-frame prediction using the above encoding method increase with the complexity of the calculation process. To ensure encoding efficiency, the above encoding process requires an increase in the number of transistors, resulting in higher chip cost and power consumption.
[0033] Please refer to Figure 3 , Figure 3 This is a flowchart of an encoding method provided in an exemplary embodiment of this application. The method is applied to an encoder and may include at least one of the following steps.
[0034] Step 310: Obtain the difference data between the current block and adjacent blocks of the video image.
[0035] Video images are images to be encoded. During the encoding process, the video to be compressed is acquired. The video to be compressed includes at least one frame of image, and the data format corresponding to the image is the original pixel matrix. Each frame of image is divided into multiple coding blocks, and these multiple coding blocks are encoded into the bitstream through processes such as prediction, transformation, quantization, and entropy coding, which completes the encoding process.
[0036] The encoder performs inverse quantization and inverse transform based on the quantized transform coefficients to obtain the reconstructed residual block. The predicted block and the reconstructed residual block are added pixel by pixel to obtain the reconstructed block of the current block. The reconstructed block of the current block is subjected to normalization filtering such as deblocking filtering and sample adaptive offset to eliminate block boundary distortion and improve the subjective quality of the video. The final reconstructed block after filtering is written to the decoding image buffer maintained by the encoder, so that in the subsequent decoding process, the decoder is provided with the reconstructed and filtered image from the decoding image buffer as a reference frame.
[0037] After the multiple coded blocks corresponding to the complete image are reconstructed and written to the decoded image buffer, the resulting whole-frame reconstructed image can be used as a reference frame for subsequent frames during the encoding process. That is, the reference frame is a historical frame that has been encoded and reconstructed during the encoding process of the current frame; optionally, the reference frame can be a reconstructed image that has been encoded before the current frame is processed in the video time dimension.
[0038] In some embodiments, there is duplicate information between the reference frame and the current frame to be processed. During the encoding process, this duplicate information is a temporal redundancy to be compressed. Change data between the reference frame and the current frame is acquired during inter-frame prediction, and this change data is used to represent the information of the current frame, thereby achieving compression. The change data includes motion vectors obtained through motion estimation and residual data obtained through prediction blocks. The motion vector is a two-dimensional displacement vector used to indicate the positional offset of the current block relative to the matching block in the reference frame; the motion vector includes components in both horizontal and vertical directions.
[0039] In some embodiments, the process of referencing a reference frame during the encoding of the current frame includes inter-frame prediction. The encoder uses motion estimation to find a matching region in the reference frame for the current block. This matching region, which has minimal differences from the current block, provides reference pixel values for generating the prediction block of the current block, serving as a reference benchmark. Illustratively, the process of generating the prediction block of the current block based on the matching region includes, but is not limited to: accessing and reading the pixel values at the location of the matching region in the reference frame according to the motion vector of the current block; and filling the read pixel values according to the spatial order of the current block based on the position information of the corresponding pixels within the current block to generate the prediction block.
[0040] By performing the predictive coding process described above on the current block, the predicted data for the current block can be obtained, i.e., the predicted block for the current block can be obtained. Optionally, the predicted block and the current block may be the same or different. In some embodiments, natural videos (such as videos captured by a camera) include video image changes such as irregular motion, distortion, occlusion, and brightness variations. In the above cases, the probability that the predicted block and the current block are different is relatively high. Through predictive coding, a residual image representing the difference between the original image and the predicted image is obtained, i.e., the residual block corresponding to the current block. The residual block is stored to improve compression efficiency.
[0041] In some embodiments, motion estimation is used to search for a matching block in the reference frame corresponding to the current block, and the motion vector corresponding to the current block is obtained. Based on the motion vector corresponding to the current block, the pixels corresponding to the matching block are obtained, and inter-frame prediction data is obtained through motion compensation. The above processing is performed independently for each individual coding block, resulting in the inter-frame prediction data corresponding to different coding blocks being predicted only based on their own motion vectors. The prediction data in the boundary region between adjacent coding blocks is discontinuous. From a display perspective, the predicted image and the corresponding residual image will produce block artifacts, that is, the difference between the predicted image and the original image is large, and the compression efficiency is low.
[0042] In some embodiments, to address coding error issues such as block artifacts, enhancement algorithms, such as the OBMC algorithm, are needed to further predictive coding the initially obtained inter-frame prediction data. The OBMC algorithm performs weighted fusion on a pixel-by-pixel basis based on the motion vectors corresponding to the current block and its neighboring blocks, resulting in a smooth transition of prediction data in boundary regions between adjacent coding blocks.
[0043] The enhancement algorithm described above reduces the energy of the prediction residual, which indicates the degree of difference between the predicted block and the current block represented by the prediction residual. Illustratively, the degree of difference between the predicted block and the current block can be represented by the sum of absolute differences (SAD) or the sum of squared errors (SSE) between the pixel values corresponding to the predicted block and the current block, respectively. The energy of the prediction residual indicates the accuracy of the predictive coding process. Reducing the energy of the prediction residual and increasing the accuracy of the predictive coding process means that less correction information needs to be transmitted for the current block and the predicted block during the encoding process, i.e., higher compression efficiency.
[0044] The current block can be a Transform Block (TB) or a TU. Optionally, the current block can be a CU, a Coding Block (CB), or a block divided from a CU. Optionally, during the prediction process, different coding blocks correspond to their own sample sets. The sample set is a set obtained by referencing the pixel values of the corresponding matching block in the reference frame based on the motion vector. The sample set includes at least one predicted pixel value.
[0045] During inter-frame prediction, it is determined whether an enhancement algorithm should be executed for the current block to address coding errors. Taking the OBMC algorithm as an example, the difference data between the current block and its neighboring blocks is obtained. Based on the difference data, the coding parameters of the current block are obtained. These coding parameters indicate whether the preset conditions for executing the OBMC algorithm are met, and the inter-frame prediction method for the current block is determined. The difference data indicates the degree of difference between the predicted data in the boundary region between the current block and its neighboring blocks. Based on the difference data, it can be determined whether the predicted data corresponding to the current coding method will produce coding errors such as block artifacts. In other words, it determines whether the preset conditions for executing the OBMC algorithm are met. For example, if the predicted data will not produce block artifacts, the above preset conditions are not met, and the OBMC algorithm does not need to be executed. Executing the OBMC algorithm for the current block is equivalent to performing OBMC processing.
[0046] In some embodiments, adjacent blocks include a left adjacent block and an upper adjacent block. The left adjacent block is the coded block to the left of the current block and adjacent to it, and the upper adjacent block is the coded block above the current block and adjacent to it. A first difference data between the current block and the left adjacent block is obtained, and a second difference data between the current block and the upper adjacent block is obtained. The difference data includes both the first and second difference data. During video encoding, the encoding order is processed according to the raster scan order. When encoding the current block, the coded blocks corresponding to the right and below the current block have not yet been encoded. These coded blocks cannot provide prediction basis for the inter-frame prediction processing of the current block. Therefore, adjacent blocks include a left adjacent block and an upper adjacent block.
[0047] In some embodiments, the adjacent blocks corresponding to the current block share at least a portion of the boundary with the current block, and there is at least one adjacent block on the same side of the current block. If there is more than one adjacent block sharing a boundary with the current block to its left or above, the adjacent blocks may also include, for example, a second coded block above the current block, a second coded block to the left of the current block, etc. Optionally, the adjacent blocks may also include adjacent coded blocks that are not adjacent to the current block, including but not limited to coded blocks that are diagonally related to the current block, such as the upper right corner coded block of the current block, the lower left corner coded block of the current block, etc.
[0048] It is worth noting that, based on the rules of the encoder dividing the image into multiple coding blocks, the positional relationship between the current block and adjacent blocks is not fixed. That is, different coding block division structures correspond to different positional relationships between adjacent coding blocks. The specific implementation of the above-mentioned adjacent blocks is only an illustrative example, and this embodiment does not limit it.
[0049] For illustrative purposes, please refer to the following: Figure 4 , Figure 4 This is a schematic diagram illustrating the spatial relationship between the current block and adjacent blocks, provided in an exemplary embodiment of this application. For example... Figure 4 As shown, taking the sample coordinates corresponding to the coded block as an example, the adjacent block A of the current block E410 is the sample ( The block containing the sample (E410) is adjacent to block B. The block containing the sample (E410) is adjacent to block C. The block containing the sample (E410) is adjacent to block D. The block containing the sample (E410) is adjacent to block F. The block containing the sample (E410) is adjacent to the current block G. The block containing the sample. Here, the sample is an indivisible unit data point in the video, i.e., a pixel value; ) is the coordinate of the top-left corner sample of the current block E410 in the image. ) is the coordinate of the upper right corner sample of the current block E410 in the image. () represents the coordinates of the lower left corner sample of the current block E410 in the image.
[0050] like Figure 4 As shown, the existence of a neighboring block X means that the neighboring block should be within the image and belong to the same band as the current block E410; otherwise, the neighboring block X does not exist. If the neighboring block X does not exist or has not yet been decoded, then the neighboring block X is unavailable; otherwise, the neighboring block X is available. If the block containing the image sample does not exist or the sample has not yet been decoded, then the sample is unavailable; otherwise, the sample is available. Optionally, X can be A, B, C, D, F, or G.
[0051] Schematic, the difference data is used to indicate the influence of adjacent coded blocks on the current block's encoding in the boundary region during inter-frame prediction. The inter-frame prediction process relies on the motion of objects in the video; between the reference frame and the current frame, the motion of objects in the video is reflected in spatial continuity. Therefore, the difference data between the current block and the left and upper adjacent blocks can provide more accurate prediction basis for image boundaries. By introducing more adjacent blocks corresponding to different directions, expanding the range of adjacent blocks, and using this as data basis for the preset conditions of the OBMC algorithm, the accuracy of prediction fusion can be improved, the required inter-frame prediction method for the current block can be obtained, and thus the compression efficiency can be improved.
[0052] In some embodiments, obtaining the difference data between neighboring blocks and the current block includes at least one of the following steps.
[0053] 1. Obtain the first prediction data of the adjacent blocks and the second prediction data of the current block. The first prediction data is the prediction data obtained based on the motion vector of the adjacent blocks themselves, and the second prediction data is the prediction data obtained based on the motion vector of the current block itself.
[0054] In some embodiments, the adjacent block includes at least one first predicted pixel, the current block includes at least one second predicted pixel, the first prediction data includes the first predicted pixel value corresponding to at least one first predicted pixel, and the second prediction data includes the second predicted pixel value corresponding to at least one second predicted pixel.
[0055] Schematic, the first prediction data is inter-frame prediction data obtained by performing preliminary prediction processing on adjacent blocks, including but not limited to obtaining motion vectors through motion estimation, and extracting pixel blocks at corresponding positions from a specified reference frame based on the motion vectors of adjacent blocks through motion compensation, and initially using them as prediction blocks for adjacent blocks, thereby converting motion information into specific predicted pixel values; the second prediction data is inter-frame prediction data obtained by performing preliminary prediction processing on the current block, including but not limited to obtaining motion vectors through motion estimation, and extracting pixel blocks at corresponding positions from a specified reference frame based on the motion vectors of the current block through motion compensation, and initially using them as prediction blocks for the current block; optionally, the adjacent blocks are the current blocks processed within a historical time period.
[0056] 2. Based on the first prediction data and the second prediction data, obtain the difference data between the current block and the adjacent blocks.
[0057] In some embodiments, a block difference value between the current block and neighboring blocks is obtained based on at least one first predicted pixel value and at least one second predicted pixel value. The difference data includes the block difference value. Schematic, the block difference value is the difference between pixel values, or the block difference value is a difference function value obtained based on a pre-defined difference function, which indicates the difference between the predicted pixel values corresponding to the current block and neighboring blocks, respectively.
[0058] In some embodiments, based on the positional correspondence between at least one first predicted pixel and at least one second predicted pixel, at least one pair of adjacent pixel value pairs is obtained, wherein the at least one pair of adjacent pixel value pairs includes a first predicted pixel value and a second predicted pixel value; pixel differences corresponding to the at least one pair of adjacent pixel value pairs are obtained, wherein the pixel difference is the difference between the first predicted pixel value and the second predicted pixel value; and the average value of the pixel differences corresponding to the at least one pair of adjacent pixel value pairs is obtained as a block difference value.
[0059] The positional correspondence between at least one first predicted pixel and at least one second predicted pixel is determined by the encoder based on the segmentation of the image. For example, during the segmentation of coding blocks, the boundary positions between the current block and adjacent blocks are determined, and the coordinates of the corresponding first and second predicted pixels are symmetrical about these boundary positions. Based on the corresponding first and second predicted pixels, the pixel values corresponding to the predicted pixels are combined to obtain at least one pair of adjacent pixel value pairs.
[0060] For illustrative purposes, please refer to the following: Figure 5 , Figure 5 This is a schematic diagram of adjacent pixel value pairs between the current block and its left adjacent block, provided in an exemplary embodiment of this application. For example... Figure 5As shown, the left adjacent block 510 and the current block 520 share a first boundary 530. The boundary regions on both sides of the first boundary 530 each include at least one first predicted pixel and at least one second predicted pixel, with a one-to-one positional correspondence between them. Schematably, the first predicted pixel 1 of the left adjacent block 510 and the second predicted pixel 1 of the current block 520 correspond to each other, forming a first pair of adjacent pixel values. The index 1 of the first predicted pixel 1 and the second predicted pixel 1 indicates a positional correspondence between them. Similarly, the first predicted pixel 2 of the left adjacent block 510 and the second predicted pixel 2 of the current block 520 correspond to each other, forming a second pair of adjacent pixel values. The index 2 of the first predicted pixel 2 and the second predicted pixel 2 indicates a positional correspondence between them. This process continues, resulting in at least one pair of adjacent pixel values in the boundary regions. The pixel values corresponding to the first and second predicted pixels in each pair of adjacent pixel values are obtained, resulting in at least one pair of adjacent pixel values. That is, the first predicted pixel value of the corresponding first predicted pixel and the second predicted pixel value of the second predicted pixel are combined to obtain the adjacent pixel value pair.
[0061] For illustrative purposes, please refer to the following: Figure 6 , Figure 6 This is a schematic diagram of adjacent pixel value pairs between the current block and the previous adjacent block, provided in an exemplary embodiment of this application. Figure 6 As shown, the upper adjacent block 610 and the current block 620 share a second boundary 630. The boundary regions on both sides of the second boundary 630 each include at least one first predicted pixel and at least one second predicted pixel, with a one-to-one positional correspondence between them. Schematably, the first predicted pixel 1 of the upper adjacent block 610 and the second predicted pixel 1 of the current block 620 correspond to each other, forming a first pair of adjacent pixel values. The index 1 of the first predicted pixel 1 and the second predicted pixel 1 indicates a positional correspondence between them. Similarly, the first predicted pixel 2 of the upper adjacent block 610 and the second predicted pixel 2 of the current block 620 correspond to each other, forming a second pair of adjacent pixel values. The index 2 of the first predicted pixel 2 and the second predicted pixel 2 indicates a positional correspondence between them. This process continues, combining first and second predicted pixels with the same index to obtain at least one pair of adjacent pixel values in the boundary regions. Obtain the pixel values corresponding to the first predicted pixel and the second predicted pixel in at least one pair of adjacent pixel value pairs to obtain at least one pair of adjacent pixel value pairs. That is, combine the first predicted pixel value of the first predicted pixel and the second predicted pixel value of the second predicted pixel to obtain adjacent pixel value pairs.
[0062] In some embodiments, the process of obtaining block difference values based on at least one pair of adjacent pixel value pairs includes, but is not limited to, at least one of the following steps.
[0063] 2.1 Calculate the pixel difference between adjacent pixel values in the boundary region of the adjacent block and the current block respectively. Optionally, the boundary region includes two rows of pixels in the adjacent block and the current block that are closest to the boundary between the adjacent block and the current block. Schematic, the pixel difference is obtained by subtracting the corresponding first predicted pixel value and the second predicted pixel value.
[0064] 2.2 Based on at least one pixel difference in the boundary region, obtain a block difference value to indicate the overall difference in the boundary region. Illustratively, obtain the absolute value of the pixel difference, add the absolute values of at least one pixel difference, and average them to obtain the block difference value; or, obtain the sum of the absolute values of at least one pixel difference, i.e., the SAD corresponding to at least one first predicted pixel and at least one second predicted pixel, as the block difference value. The block difference value is an overall indication value obtained based on a single pixel difference, used to indicate the overall difference in predicted data between neighboring blocks and the current block in a pre-specified boundary region, serving as the difference data between neighboring blocks and the current block.
[0065] Schematic, the formula for the block difference value is expressed as block difference value = (∑|block difference value|) / n, where n is the number of pixels corresponding to the current block in the boundary region. For example... Figure 5 As shown, the block difference value between the left adjacent block 510 and the current block 520 is diff_sum_left=(∑|block difference value|) / n, where n is the number of pixels corresponding to the current block 520 in the boundary region, so n=16; Figure 6 As shown, the block difference value between the upper adjacent block 610 and the current block 620 is diff_sum_above=(∑|block difference value|) / n, where n is the number of pixels corresponding to the current block 620 in the boundary region, so n=16.
[0066] Step 320: Obtain the encoding parameters of the current block based on the difference data.
[0067] The coding parameters are used to indicate the inter-frame prediction method for the current block. In some embodiments, different coding parameters are obtained based on the degree of difference between the neighboring blocks and the current block in the boundary region indicated by the difference data, so as to reduce the energy of the prediction residual by using an inter-frame prediction method adapted to the current block.
[0068] Schematic, based on the difference requirements, the degree of difference between the adjacent blocks and the current block indicated by the difference data can be divided into at least three categories.
[0069] The first category involves cases where the difference data indicates a significant difference in the boundary region between the current block and its neighboring blocks. This means that the local images corresponding to the current block and its neighboring blocks at different display angles show obvious differences, indicating that the current block and its neighboring blocks do not belong to the same object or region represented by the image. When the difference data meets the difference requirement—that is, when the difference between the current block and its neighboring blocks is too large—the inter-frame prediction method avoids fusing boundary pixels of different coding blocks through the OBMC algorithm. This preserves the edge information corresponding to the coding blocks, thus avoiding problems such as edge blurring between different regions in the image and large coding errors.
[0070] The second category involves cases where the difference data indicates that the boundary region between the current block and its neighboring blocks has minimal differences. This means that the local images corresponding to the current block and its neighboring blocks at different display angles are almost identical (e.g., the block difference value is less than a threshold, indicating that the difference between the current block and its neighboring blocks at different display angles is negligible). This indicates that the current block and its neighboring blocks belong to the same object or region represented by the image, and the current encoding method does not produce block artifacts in the boundary region between the current block and its neighboring blocks. In cases where the differences between neighboring blocks and the current block are minimal, the inter-frame prediction method avoids fusing boundary pixels of different coded blocks through the OBMC algorithm, thereby avoiding redundant calculations. This reduces computational complexity and improves compression efficiency while maintaining coding accuracy.
[0071] Optionally, determining that the difference between adjacent blocks and the current block is small can be achieved by determining that the difference data is below a preset second threshold, or by performing rate-distortion processing on the current block to determine that the rate-distortion cost corresponding to the OBMC mode is higher than the rate-distortion cost corresponding to other inter-frame prediction methods. That is, at the same bitrate, the image quality after OBMC processing is lower, or at the same image quality, the bitrate after OBMC processing is higher. Here, bitrate is the total number of bits of video data transmitted or stored per unit time, expressed in bitrate (units are bit / s or kbps / Mbps). The above-mentioned inter-frame predictive coding determines the coding parameters by performing rate-distortion processing on the current block, thereby reducing the bitrate and improving compression efficiency.
[0072] The third category involves cases where the difference data indicates a significant difference in the boundary region between the current block and its neighboring blocks. This means that the local images of the current block and its neighboring blocks differ at different display angles, indicating that the current encoding method is causing block artifacts in the boundary region between the current block and its neighboring blocks. Optionally, if the difference data does not meet the difference requirement and exceeds a preset second threshold, meaning the difference between the current block and its neighboring blocks is significant, the inter-frame prediction method uses the OBMC algorithm to fuse boundary pixels from different coded blocks, thereby reducing the energy of the prediction residual and improving compression efficiency.
[0073] It is worth noting that the above difference data indicates the degree of difference between the boundary regions of the current block and its neighboring blocks. A small difference means that the difference data is below the preset second threshold, a large difference means that the difference data reaches the second threshold but does not meet the difference requirements, and an excessive difference means that the difference data meets the difference requirements.
[0074] In some embodiments, the encoding parameters are determined based on the relationship between the difference data between the current block and its neighboring blocks and a preset difference requirement. Obtaining the encoding parameters of the current block based on the difference data includes at least one of the following steps.
[0075] 1. If the difference data meets the preset difference requirements, obtain the first encoding parameter as the encoding parameter of the current block.
[0076] The first encoding parameter is used to indicate skipping the Overlapping Block Motion Compensation (OBMC) process. In some embodiments, obtaining the first encoding parameter when the difference data meets a preset difference requirement includes obtaining the first encoding parameter when the difference data reaches a preset first threshold.
[0077] The first threshold is used to indicate the upper limit of the difference data. Illustratively, the difference data reaching the preset first threshold includes, but is not limited to, at least one of the following: the difference data reaches a preset fixed first threshold, and when the difference data exceeds the first threshold, the difference between the adjacent block and the current block indicated by the difference data is classified as Class I, indicating excessive difference; or, the difference data reaches a dynamically determined first threshold, wherein the method for dynamically determining the first threshold includes, but is not limited to: generating the first threshold using an artificial intelligence model based on historical difference requirements; determining the first threshold based on the bit depth corresponding to the difference data between the current block and adjacent blocks, where bit depth refers to the capacity of each color component to store sample pixel values, such as 8 bits, 10 bits, 12 bits, etc.
[0078] 2. If the difference data does not meet the preset difference requirements, perform rate distortion processing on the current block to obtain the rate distortion processing result.
[0079] Schematic, the coding parameters of the current block are obtained based on the rate-distortion processing result. The coding parameters are used to indicate whether the inter-frame prediction mode for the current block includes OBMC processing. The rate-distortion processing determines whether the inter-frame prediction mode for the current block includes OBMC processing, and the rate-distortion processing result includes either of the following two states.
[0080] 2.1 If the rate-distortion processing result is in the first state, obtain the first encoding parameter as the encoding parameter of the current block.
[0081] The first encoding parameter is used to indicate skipping OBMC processing. The first state indicates that the rate-distortion cost corresponding to OBMC processing is higher than the rate-distortion cost corresponding to any other inter-frame prediction method. Specifically, the first state means that after rate-distortion processing, the rate-distortion cost corresponding to the OBMC mode is higher than the rate-distortion cost corresponding to any other inter-frame prediction method. In other words, the difference between the current block and the adjacent blocks indicated by the difference data is classified as Type II, meaning the difference is too small. This indicates that there is almost no difference between the local images corresponding to the current block and the adjacent blocks at the display angles, suggesting that the current block and the adjacent blocks belong to the same object or region represented by the image, and the current encoding method does not produce block artifacts in the boundary region between the current block and the adjacent blocks.
[0082] It is worth noting that the rate-distortion cost corresponding to OBMC processing is higher than the rate-distortion cost corresponding to any other inter-frame prediction method, including the highest value among the rate-distortion costs corresponding to OBMC processing and the rate-distortion costs corresponding to at least one inter-frame prediction method.
[0083] 2.2 If the rate-distortion processing result is in the second state, obtain the second encoding parameter as the encoding parameter for the current block.
[0084] The second encoding parameter is used to indicate the execution of OBMC processing. The second state indicates that the rate-distortion cost corresponding to OBMC processing is lower than the rate-distortion cost corresponding to at least one other inter-frame prediction method. Specifically, the second state means that after rate-distortion processing, the rate-distortion cost corresponding to the OBMC mode is lower than the rate-distortion cost corresponding to other inter-frame prediction methods. In other words, the difference between the current block and the adjacent blocks indicated by the difference data is classified as type three, indicating a large difference. This means that there are differences in the local images corresponding to the current block and the adjacent blocks at different display angles, indicating that the current encoding method produces block artifacts in the boundary region between the current block and the adjacent blocks.
[0085] It is worth noting that the rate-distortion cost corresponding to OBMC processing is lower than the rate-distortion cost corresponding to at least one other inter-frame prediction method, including the lowest value among the rate-distortion costs corresponding to OBMC processing and at least one other inter-frame prediction method.
[0086] Optionally, the above coding parameters are implemented as a mode decision flag obmc_flag. When the coding parameter of the current block is the first coding parameter, obmc_flag=0, which indicates that OBMC processing is skipped during inter-frame prediction; when the coding parameter is the second coding parameter, obmc_flag=1, which indicates that OBMC processing is performed during inter-frame prediction.
[0087] It is worth noting that the above process of obtaining the encoding parameters of the current block based on the difference data is only an illustrative example, and the specific method of obtaining the encoding parameters is not limited in the embodiments of this application.
[0088] Step 330: Obtain inter-frame prediction data for the current block based on the encoding parameters.
[0089] Based on the difference data, the encoding parameters are obtained, which indicate the inter-frame prediction method of the current block; based on the inter-frame prediction method, the current block is subjected to corresponding predictive coding processing to obtain the inter-frame prediction data of the current block.
[0090] For the encoding process of the current block, the correspondence between encoding parameters and inter-frame prediction methods is established through the hierarchical organization of syntax elements and encoding logic. The encoding / decoding standard predefines at least one syntax element, which constitutes a complete syntax structure tree. This syntax structure tree includes at least one type of syntax element: 1. High-level elements, such as stripe headers and slice headers, used to define global parameters. 2. Mid-level elements, such as coding units and prediction units, containing mode decision flags. 3. Low-level elements, such as motion vectors and intra-frame prediction mode indices, used to provide specific parameter values for the encoding process.
[0091] During compression, the encoder, after internally deciding on various encoding methods, traverses and searches the syntax element paths corresponding to those methods within the syntax structure, mapping the decision results to specific syntax element values. Following the standard-defined syntax order and entropy coding method, the encoder encodes the syntax element values corresponding to the decision results and writes them into the bitstream. By embedding the correspondence between encoding methods and encoding parameters (i.e., syntax element values) in the bitstream in a standardized, parsable data format, the encoder provides the decoder with a format for reading and reconstructing encoding parameters, ensuring that the same encoding method, such as inter-frame prediction, can be used to compress the video during both encoding and decoding processes.
[0092] In some embodiments, when the coding parameters of the current block are the first coding parameters, second prediction data is obtained as the inter-frame prediction data of the current block. The second prediction data is prediction data obtained based on the motion vector of the current block itself. At this time, the difference degree between the neighboring blocks and the current block indicated by the difference data is either of type I or type II. If the difference is too large or too small, the inter-frame prediction processing avoids fusing the boundary regions between the neighboring blocks and the current block through the OBMC algorithm. Therefore, the second inter-frame prediction data initially obtained through motion estimation and motion compensation is the final inter-frame prediction data of the current block. Optionally, obtaining the second prediction data as the inter-frame prediction data of the current block further includes: further optimizing the inter-frame prediction data of the current block based on other enhancement algorithms in the inter-frame prediction method; that is, in the process of skipping the OBMC algorithm for predictive coding, the use of other inter-frame algorithms is not restricted.
[0093] In some embodiments, when the encoding parameters are the second encoding parameters, inter-frame prediction data for the current block is obtained through OBMC processing. In this case, the difference between the current block and neighboring blocks indicated by the difference data is classified as type three, indicating a large difference. Accordingly, the inter-frame prediction processing includes fusing the boundary regions between neighboring blocks and the current block using the OBMC algorithm. Based on the second encoding parameters, the motion vectors corresponding to the current block and neighboring blocks are fused to obtain the inter-frame prediction data for the current block. Optionally, obtaining the inter-frame prediction data for the current block through OBMC processing further includes: further optimizing the inter-frame prediction data for the current block based on other enhancement algorithms in the inter-frame prediction method; that is, the use of other inter-frame algorithms is not restricted during the predictive coding process using the OBMC algorithm.
[0094] In this embodiment, by acquiring the difference data between the current block and adjacent blocks, the computational complexity of determining the encoding parameters corresponding to the current block by calculating the rate distortion cost is reduced, the process of determining the encoding parameters is simplified, thereby quickly determining the encoding parameters that are suitable for the current block, and performing predictive coding processing on the current block using the inter-frame prediction method indicated by the encoding parameters to obtain the inter-frame prediction data of the current block. This helps to improve the efficiency of the prediction process, reduce the hardware computational overhead in the encoding and decoding process, and improve the encoding quality.
[0095] Please refer to Figure 7 , Figure 7 This is a flowchart of an encoding method provided by another exemplary embodiment of this application. The method is applied to an encoder and may include at least one of the following steps.
[0096] Step 710: If the difference data does not meet the preset difference requirements, perform rate distortion processing on the current block to obtain the rate distortion processing result.
[0097] In some embodiments, the discrepancy data failing to meet a preset discrepancy requirement can be implemented as the discrepancy data failing to reach a first threshold, where the first threshold indicates an upper limit for the discrepancy data. When the discrepancy data fails to reach the first threshold, the difference between the adjacent blocks and the current block indicated by the discrepancy data is significant; that is, through the current preliminary inter-frame prediction method, the boundary region between the current block and adjacent blocks will produce block effects. Therefore, during the inter-frame prediction process for the current block, the boundary region between the current block and adjacent blocks is fused using the OBMC algorithm. The discrepancy data failing to reach the preset first threshold includes, but is not limited to, at least one of the following situations.
[0098] 1. The discrepancy data did not reach a pre-set fixed first threshold. Optionally, this fixed first threshold is predicted and set by the designer based on experience between coding processes.
[0099] 2. The difference data did not reach the dynamically determined first threshold. The methods for dynamically determining the first threshold include, but are not limited to, at least one of the following approaches.
[0100] 2.1 Generate a first threshold using an artificial intelligence model based on historical difference requirements. First, during the encoding process, historical difference data corresponding to the encoding units within a historical time period is continuously collected, such as SAD and SSE, as well as contextual features related to the historical difference data, including but not limited to texture complexity, motion intensity, and quantization parameter (QP), to construct a training dataset. The contextual features corresponding to the current block to be encoded are input into a pre-trained artificial intelligence (AI) model. Based on the patterns learned from the historical difference data, the AI model predicts and outputs a dynamic first threshold for the current block.
[0101] 2.2 Bit depth determination is based on the difference data between the current block and adjacent blocks. Bit depth refers to the capacity of each color component to store sample pixel values. The color components include luminance (Y), chrominance-difference U (U), and chrominance-difference V (V), or red (R), green (G), and blue (B). Bit depth determines the maximum number of luminance / chrominance levels that an image in a video can represent. In video encoding / decoding standards, it serves as a syntax element providing specific parameter values for the encoding process, controlling the processing precision of modules such as transform, quantization, and filtering during encoding and decoding.
[0102] To illustrate, with an 8-bit bit depth, each color component can use an 8-bit binary number to store the sample pixel value, representing a value range of 0 to 255, for a total of 256 possible values; with a 10-bit bit depth, each color component can use a 10-bit binary number to store the sample pixel value, representing a value range of 0 to 1023, for a total of 1024 possible values; and with a 12-bit bit depth, each color component can use a 12-bit binary number to store the sample pixel value, representing a value range of 0 to 4095, for a total of 4096 possible values.
[0103] In some embodiments, if the adjacent block is implemented as at least one adjacent block X, if any adjacent block X does not meet the preset difference requirement, rate distortion processing is performed on the current block to obtain the rate distortion processing result. Correspondingly, if at least one adjacent block X meets the preset difference requirement, OBMC processing is skipped for the current block.
[0104] In some embodiments, determining the first threshold based on the bit depth corresponding to the difference data between the current block and the adjacent blocks is implemented by using the unsigned intermediate value that the bit depth can represent, i.e., half the range, as the first threshold; for example, when the bit depth is 8 bits, the first threshold is 128. Illustratively, when the adjacent blocks are implemented as the left adjacent block and the top adjacent block, the block difference value between the current block and the left adjacent block is diff_sum_left ≤ (1 << (bit_depth-1)), or the block difference value between the current block and the top adjacent block is diff_sum_above ≤ (1 << (bit_depth-1)).
[0105] In some embodiments, rate-distortion processing of the current block includes, but is not limited to, at least one of the following steps: constructing a candidate mode set for the current block, the candidate mode set including at least two candidate modes, the candidate mode being a combination of parameters used to indicate the inter-frame prediction method of the current block; obtaining the rate-distortion cost corresponding to at least two candidate modes for the current block; and obtaining the rate-distortion processing result based on the comparison result between the rate-distortion costs corresponding to at least two candidate modes.
[0106] Step 720: Based on the rate-distortion processing results, obtain the encoding parameters of the current block.
[0107] In some embodiments, the encoding parameters are used to indicate whether the inter-frame prediction scheme for the current block includes Overlapping Block Motion Compensation (OBMC) processing. Rate-distortion processing is used to determine whether the inter-frame prediction scheme for the current block includes OBMC processing; that is, the rate-distortion processing result includes a first state indicating that the inter-frame prediction scheme for the current block does not include OBMC processing, and the rate-distortion processing result includes a second state indicating that the inter-frame prediction scheme for the current block includes OBMC processing.
[0108] Specifically, if the rate-distortion processing result is in the first state, the first encoding parameter is obtained and used as the encoding parameter for the current block; if the rate-distortion processing result is in the second state, the second encoding parameter is obtained and used as the encoding parameter for the current block.
[0109] Step 730: If the rate-distortion processing result is the first state, obtain the first encoding parameters.
[0110] Obtain the first encoding parameter as the encoding parameter for the current block. The first encoding parameter is used to indicate skipping OBMC processing, and the first state indicates that the rate-distortion cost corresponding to OBMC processing is higher than the rate-distortion cost corresponding to any other inter-frame prediction method. In some embodiments, the first state means that after rate-distortion processing, the rate-distortion cost corresponding to the OBMC mode is higher than the rate-distortion cost corresponding to any other inter-frame prediction method. Here, rate-distortion cost refers to the evaluation coefficient of the current encoding scheme jointly determined by video distortion and bitrate. Accordingly, the lower the rate-distortion cost, the more balanced the corresponding encoding scheme is between video distortion and bitrate, that is, the current encoding scheme reduces the error between the encoding model and the real complex video data.
[0111] Indicatively, in the case of rate-distortion processing result being in the first state, the difference between the adjacent blocks and the current block indicated by the difference data is too small. That is, there is almost no difference between the local images corresponding to the current block and the adjacent blocks at the display angles, indicating that the current block and the adjacent blocks belong to the same object or region represented by the image. Moreover, the current encoding method does not produce block effects on the boundary region between the current block and the adjacent blocks. The inter-frame prediction method for the current block does not include OBMC processing. Before and after OBMC processing, if the difference between the predicted block and the current block cannot be significantly reduced, the complex calculation process is saved. The current block is predicted and the processing of enhancement algorithms such as OBMC is terminated in advance, reducing the computational complexity of encoding, reducing the computational load, improving the encoding speed, and thus improving the compression efficiency.
[0112] In some embodiments, when the coding parameters of the current block are the first coding parameters, second prediction data is obtained as the inter-frame prediction data for the current block. The second prediction data is prediction data obtained based on the motion vector of the current block itself. Accordingly, the inter-frame prediction processing avoids fusing the boundary regions between adjacent blocks and the current block through the OBMC algorithm. Therefore, the second inter-frame prediction data initially obtained through motion estimation and motion compensation is the final inter-frame prediction data for the current block.
[0113] Step 740: If the rate-distortion processing result is the second state, obtain the second encoding parameters.
[0114] The second encoding parameter is obtained and used as the encoding parameter for the current block. The second encoding parameter is used to indicate the execution of OBMC processing. The second state indicates that the rate-distortion cost corresponding to OBMC processing is lower than the rate-distortion cost corresponding to at least one other inter-frame prediction method. Schematic, the second state means that after rate-distortion processing, the rate-distortion cost corresponding to the OBMC mode is lower than the rate-distortion cost corresponding to other inter-frame prediction methods. In other words, the difference between the current block and the adjacent blocks indicated by the difference data is large, meaning that there are differences in the local images corresponding to the current block and the adjacent blocks at different display angles. This indicates that the current encoding method produces block artifacts in the boundary region between the current block and the adjacent blocks.
[0115] In some embodiments, when the encoding parameter is the second encoding parameter, inter-frame prediction data for the current block is obtained through OBMC processing. Rate-distortion processing determines that the current inter-frame prediction method includes OBMC processing, and the decision result is written into the bitstream using the second encoding parameter. This separates the complex inter-frame prediction decision-making process from the actual encoding process, which involves prediction encoding at the encoding and decoding ends, improving encoding efficiency, reducing decoding complexity, and thus improving compression efficiency.
[0116] In some embodiments, OBMC processing of the current block is implemented by fusing the motion vectors corresponding to the current block and the adjacent blocks based on the second coding parameters to obtain the inter-frame prediction data of the current block.
[0117] Optionally, the motion vectors corresponding to the current block and the adjacent blocks are fused using the OBMC algorithm, including but not limited to at least one of the following steps.
[0118] 1. For at least one second predicted pixel in the current block that is located in the boundary region between the adjacent block and the current block, obtain second predicted data based on the motion vector of the current block itself, and obtain additional predicted data corresponding to the position of the second predicted pixel based on the motion vector of the adjacent block.
[0119] 2. For one of the second predicted pixels, allocate second predicted data and corresponding weights for additional predicted data based on the distance of the second predicted pixel to the boundary between the current block and the adjacent blocks. The shorter the distance of the second predicted pixel to the boundary, the higher the weight of the additional predicted data; correspondingly, the farther the second predicted pixel is from the boundary, the higher the weight of the second predicted data.
[0120] The allocation of weight values for the second prediction data and the additional prediction data includes, but is not limited to, at least one of the following steps.
[0121] 2.1 Pre-set a static weight table with linear or Gaussian weights. Schematic, a fixed weight value sequence is pre-calculated and stored for each pixel position in the blending region of the OBMC. The blending region of the OBMC is the boundary region between the current block and adjacent blocks; pixel positions at the same distance from the boundary have the same weight value; the weight value changes monotonically with the distance from the boundary.
[0122] 2.2 In the actual weight allocation process, the weights are obtained by querying the above weight table based on the distance from the second predicted pixel to the boundary, thereby reducing the complexity of real-time calculation.
[0123] 3. Based on the assigned weight values, the second prediction data and the additional prediction data are fused to obtain the inter-frame prediction data of the second prediction pixel. Illustratively, when the second prediction data is implemented as P_self with a weight value of W_self, and the additional prediction data is implemented as P_neighbor with a weight value of W_neighbor, the inter-frame prediction data P_final = (W_self × P_self + W_neighbor × P_neighbor) / (W_self + W_neighbor).
[0124] 4. Perform steps 2 to 3 above on other second predicted pixels in the boundary region within the current block. Optionally, at least one second predicted pixel can be processed in parallel to obtain the inter-frame prediction data of the current block.
[0125] By using the OBMC algorithm, the accuracy of inter-frame prediction for the current block is improved while controlling the bitrate, the prediction residual energy is reduced, and the subsequent coding efficiency is improved, thereby achieving higher video quality at the same bitrate or saving bitrate at the same video quality. By weighted fusion of the prediction values of adjacent blocks, the boundary of the prediction block corresponding to the current block caused by the inconsistency of motion vectors is forced to be smoothed, suppressing visually significant blocky mesh artifacts, making the edges of moving objects more natural, thereby improving subjective visual quality.
[0126] In this embodiment, by acquiring the difference data between the current block and adjacent blocks, the computational complexity of determining the encoding parameters corresponding to the current block by calculating the rate distortion cost is reduced, the process of determining the encoding parameters is simplified, thereby quickly determining the encoding parameters that are suitable for the current block, and performing predictive coding processing on the current block using the inter-frame prediction method indicated by the encoding parameters to obtain the inter-frame prediction data of the current block. This helps to improve the efficiency of the prediction process, reduce the hardware computational overhead in the encoding and decoding process, and improve the encoding quality.
[0127] Rate-distortion processing quantifies the benefits of each inter-frame prediction method in real time based on the content characteristics of the current block, enabling dynamic changes in coding mode decisions and improving coding accuracy. The mode corresponding to the rate-distortion processing result is encoded into a definite coding parameter and written into the bitstream, ensuring that the decoder can unambiguously reproduce the prediction process that is exactly the same as the coding process, thereby improving the encoding and decoding efficiency of inter-frame prediction.
[0128] Please refer to Figure 8 , Figure 8 This is a flowchart of an encoding method provided in another exemplary embodiment of this application. The method is applied to an encoder, and step 710 above may include at least one of the following steps.
[0129] Step 810: Construct a set of candidate patterns for the current block.
[0130] The candidate mode set includes at least two candidate modes. A candidate mode is a combination of parameters used to indicate the inter-frame prediction method of the current block. In other words, the candidate mode is used to indicate the coding scheme of the current block.
[0131] Due to the inherent limitations of the block-based hybrid coding framework—namely, the coding model contains errors compared to real, complex video data—different enhancement algorithms are needed to specifically address these errors when using motion estimation and motion compensation methods to predict the current block. This aims to reduce video distortion and improve image quality at the same bitrate, or, conversely, reduce the bitrate while maintaining the same image quality, thereby improving video compression efficiency. Combining at least one of the different enhancement algorithms yields at least two candidate modes.
[0132] Indicatively, different enhancement algorithms are used to address error problems in a targeted manner, including but not limited to: different errors caused by the independent processing of coding blocks, resulting in discontinuous predicted values in the boundary regions between adjacent coding blocks, leading to block artifacts; and using the OBMC algorithm to perform weighted fusion of the second predicted data of the current block with the additional predicted data generated based on the motion vectors of adjacent blocks in the boundary region.
[0133] Alternatively, when performing motion compensation, directly averaging the forward and backward prediction data of the current block may lead to errors such as loss of detail, resulting in blurred predictions. Therefore, the small motion between two reference blocks is estimated in pixels to adaptively weight and correct the forward and backward prediction data.
[0134] Alternatively, due to local brightness / contrast variations between the reference frame and the current frame, illumination errors may occur. Based on the current block, the scaling factor and offset corresponding to the prediction block are obtained, and the inter-frame prediction data is adjusted to compensate for illumination variations.
[0135] Alternatively, motion vectors, as single translation vectors, have low accuracy in describing complex motions such as rotation and scaling. By using the AMVP algorithm to build an affine model with multiple motion vectors, motion trajectories are generated for each predicted pixel within the current block, thereby improving the accuracy in describing complex motions.
[0136] It is worth noting that the above-described process of using different enhancement algorithms to specifically address error problems is merely an illustrative example, and the implementation of the enhancement algorithms in this application does not limit the specific implementation method of the enhancement algorithms.
[0137] In some embodiments, motion estimation, motion compensation, and at least two inter-frame prediction algorithms from a variety of enhancement algorithms are combined to construct a candidate mode set for the current block, wherein a candidate mode includes at least one inter-frame prediction algorithm.
[0138] Step 820: Obtain the rate-distortion cost corresponding to at least two candidate modes for the current block.
[0139] In some embodiments, rate-distortion cost refers to the evaluation coefficient of the current coding scheme, which is jointly determined by video distortion and bitrate. Accordingly, the lower the rate-distortion cost, the more balanced the corresponding coding scheme is between video distortion and bitrate, that is, the current coding scheme reduces the error between the coding model and the real complex video data.
[0140] The coding effect of each enhancement algorithm is judged according to the rate-distortion optimization criterion: the encoder calculates the rate-distortion cost of different inter-frame prediction methods, and determines the enhancement algorithm to be executed in the process of inter-frame prediction for the current block based on the rate-distortion cost.
[0141] Schematic, the process of calculating the rate-distortion cost corresponding to a candidate pattern based on the candidate pattern includes, but is not limited to, at least one of the following steps.
[0142] 1. Obtain candidate patterns and determine the parameter combinations corresponding to each candidate pattern. Optionally, the parameter combinations include, but are not limited to, prediction pattern flags, motion vectors, block partitioning structures, etc.
[0143] 2. Based on the above parameter combination, execute the complete encoding process for the current block according to the encoding scheme corresponding to the candidate mode, including generating a prediction block; calculating the prediction residual by using the prediction residual = current block - prediction block; transforming and quantizing the prediction residual to obtain the quantization coefficient; performing entropy encoding estimation on the quantization coefficient and the syntax elements in the parameter set to accurately calculate the total number of bits required for encoding the current block, i.e., the code rate; performing inverse quantization and inverse transformation on the quantization coefficient to obtain the reconstruction residual; and calculating the reconstruction block by using the reconstruction block = prediction block + reconstruction residual.
[0144] 3. Based on simulating the complete encoding process of the current block, the distortion degree used to measure the difference between the reconstructed image and the original image is calculated by using the distortion degree SSE=∑(original pixel - reconstructed pixel)², where the original pixel is at least one original pixel value in the current block and the reconstructed pixel is at least one reconstructed pixel value in the reconstructed block.
[0145] 4. Based on the distortion, bitrate, and Lagrange multipliers used to balance the weights of distortion and bitrate for the current block, obtain the rate-distortion cost. Illustratively, with the distortion implemented as D, the bitrate as R, and the Lagrange multipliers as λ for the current block, the rate-distortion cost J = D + λ × R. Here, the rate-distortion cost indicates the computational cost and compression efficiency corresponding to the candidate mode.
[0146] It is worth noting that the above-described process of obtaining rate distortion cost is merely an illustrative example, and the embodiments of this application do not limit the specific method of rate distortion processing for the current block.
[0147] Step 830: Based on the comparison results between the rate-distortion costs corresponding to at least two candidate modes, obtain the rate-distortion processing result.
[0148] In some embodiments, at least two candidate modes include the OBMC mode; if the rate-distortion cost corresponding to the OBMC mode reaches the rate-distortion cost corresponding to any other mode, the rate-distortion processing result is determined to be a first state; if the rate-distortion cost corresponding to the OBMC mode does not reach the rate-distortion cost corresponding to at least one other mode, the rate-distortion processing result is determined to be a second state.
[0149] In some embodiments, the OBMC mode is a candidate mode indicating that the inter-frame prediction processing includes OBMC processing; that is, the inter-frame prediction scheme includes an OBMC processing step. Optionally, at least two candidate modes include at least one OBMC mode. If any of the rate-distortion costs corresponding to at least one OBMC mode reaches the rate-distortion cost corresponding to any other mode, the rate-distortion processing result is determined to be a first state; if any of the rate-distortion costs corresponding to at least one OBMC mode does not reach the rate-distortion cost corresponding to at least one other mode, the rate-distortion processing result is determined to be a second state.
[0150] The encoder makes decisions by comparing the rate-distortion costs corresponding to different candidate modes, determining whether to enable and how to combine the corresponding enhancement algorithms for the current block; the enhancement algorithms improve the prediction accuracy and processing efficiency of inter-frame prediction, thereby increasing the compression rate of the video and reducing image distortion.
[0151] Optionally, rate-distortion processing calculates the rate-distortion cost corresponding to at least two candidate modes, and determines the candidate mode with the smaller rate-distortion cost as the target mode for indicating the inter-frame prediction method. Determining the smaller rate-distortion cost can be achieved by sorting the at least two candidate modes in ascending order of rate-distortion cost and selecting the first candidate mode in the sequence as the target mode; or by selecting a candidate mode with a fixed position in the sequence as the target mode to avoid getting trapped in local optima. When the OBMC mode is not the target mode, the deterministic rate-distortion processing result is in the first state; when the OBMC mode is the target mode, the deterministic rate-distortion processing result is in the second state.
[0152] In this embodiment, by acquiring the difference data between the current block and adjacent blocks, the computational complexity of determining the encoding parameters corresponding to the current block by calculating the rate distortion cost is reduced, the process of determining the encoding parameters is simplified, thereby quickly determining the encoding parameters that are suitable for the current block, and performing predictive coding processing on the current block using the inter-frame prediction method indicated by the encoding parameters to obtain the inter-frame prediction data of the current block. This helps to improve the efficiency of the prediction process, reduce the hardware computational overhead in the encoding and decoding process, and improve the encoding quality.
[0153] The encoder automatically selects the inter-frame prediction method that yields the highest video quality at a given bitrate or the lowest bitrate at a given video quality from among many candidate modes by comparing the rate-distortion costs of different inter-frame prediction methods for the current block. This improves decision-making efficiency compared to manually setting the encoding mode for inter-frame prediction.
[0154] Please refer to Figure 9 , Figure 9 This is a flowchart of a decoding method provided in an exemplary embodiment of this application. The method is applied to a decoder and may include at least one of the following steps.
[0155] Step 910: Obtain the difference data between the current block and adjacent blocks of the video image.
[0156] The video image is the image to be decoded. In some embodiments, considering that adjacent coding blocks typically have continuous residual features, samples from the reconstructed blocks can be added to the sample set; considering that residual features are typically affected by prediction performance, samples from the predicted blocks can also be added to the sample set. Optionally, different coding blocks correspond to their own sample sets, and the sample set includes at least one predicted pixel value.
[0157] The reconstructed block can include at least one of a reconstructed block in the current image and a reconstructed block in a reference image. Optionally, the reconstructed block can be a reconstructed block adjacent to the current block in the current image, such as a coded block composed of samples located in the reconstructed sample region adjacent to the current block. Optionally, the samples in the reconstructed block can also be samples in the reference sample matrix obtained during the inter-frame prediction process or the intra-block copy (IBC) prediction process, such as samples in the sample matrix pointed to by the motion vector (MV) and block vector (BV) of the current block. Optionally, when multiple reference sample matrices are used for inter-frame prediction or IBC prediction, the samples in the reconstructed block can be samples within multiple reference sample matrices, or samples within at least one of the reference sample matrices.
[0158] For example, the samples in the reconstructed block can be samples from the reconstructed sample region adjacent to the left of the current block in the current image, or samples from the reconstructed sample region adjacent to the top of the current block, or samples from the reconstructed sample region adjacent to the upper left of the current block, or samples from the reconstructed sample region adjacent to the upper right of the current block, or samples from the reconstructed sample region adjacent to the lower left of the current block. The height of the adjacent reconstructed sample regions above, to the upper left, and to the upper right can be greater than 2, and the width of the adjacent reconstructed sample regions to the left, to the upper left, and to the upper right can be greater than 2. This embodiment of the application does not specifically limit the reconstructed sample regions.
[0159] The prediction block includes at least one of the following: a prediction block generated during intra-frame prediction, a prediction block generated during inter-frame prediction, and a prediction block generated during IBC prediction. Optionally, the samples in the prediction block can be samples from the reference sample matrix obtained during inter-frame prediction or IBC prediction. Optionally, when multiple reference sample matrices are used for inter-frame prediction or IBC prediction, the samples in the prediction block can be samples from multiple reference sample matrices, or samples from at least one of the reference sample matrices.
[0160] Optionally, considering the complexity of inter-frame prediction or IBC prediction, analyzing the predicted block and transforming the current block after inter-frame prediction or IBC prediction is completed may require a long processing cycle. Therefore, to achieve a certain degree of parallelism between prediction and transformation, samples from any intermediate sample matrix generated during the prediction process can be added to the sample set. Optionally, the intermediate sample matrix may include a sample matrix after interpolation filtering, or a sample matrix processed by techniques such as decoder-side motion vector refinement (DMVR) or bidirectional optical flow (BDOF). Optionally, samples from multiple intermediate sample matrices can be added to the sample set, or samples from any one intermediate sample matrix can be added to the sample set; this embodiment of the application does not limit this.
[0161] Optionally, the decoder can directly obtain the content indicated by the difference data between the current block and adjacent blocks by parsing the encoding parameters in the bitstream. Alternatively, during inter-frame prediction, it can determine whether to execute an enhancement algorithm to address encoding errors for the current block. Taking the OBMC algorithm as an example, the decoder obtains the difference data between the current block and adjacent blocks; based on the difference data, it obtains the encoding parameters of the current block. These encoding parameters indicate whether the preset conditions for executing the OBMC algorithm are met, and determine the inter-frame prediction method for the current block.
[0162] In some embodiments, adjacent blocks include a left adjacent block and an upper adjacent block. The left adjacent block is the coded block to the left of the current block and adjacent to it, and the upper adjacent block is the coded block above the current block and adjacent to it. First difference data between the current block and the left adjacent block is obtained, and second difference data between the current block and the upper adjacent block is obtained. The difference data includes both the first and second difference data. During video encoding, the encoding order is processed according to the raster scan order. When encoding the current block, the coded blocks corresponding to the right and below the current block have not yet been encoded. Therefore, the coded blocks corresponding to the right and below the current block cannot provide a prediction basis for the inter-frame prediction processing of the current block.
[0163] In some embodiments, the adjacent blocks corresponding to the current block share at least a portion of the boundary with the current block, and there is at least one adjacent block on the same side of the current block. If there is more than one adjacent block sharing a boundary with the current block to its left or above, the adjacent blocks may also include, for example, a second coded block above the current block, a second coded block to the left of the current block, etc. Optionally, the adjacent blocks may also include adjacent coded blocks that are not adjacent to the current block, including but not limited to coded blocks that are diagonally related to the current block, such as the upper right corner coded block of the current block, the lower left corner coded block of the current block, etc.
[0164] It is worth noting that, based on the rules of the encoder dividing the image into multiple coding blocks, the positional relationship between the current block and adjacent blocks is not fixed. That is, different coding block division structures correspond to different positional relationships between adjacent coding blocks. The specific implementation of the above-mentioned adjacent blocks is only an illustrative example, and this embodiment does not limit it.
[0165] Schematic, the difference data is used to indicate the influence of adjacent coded blocks on the current block's encoding in the boundary region during inter-frame prediction. The inter-frame prediction process relies on the motion of objects in the video; between the reference frame and the current frame, the motion of objects in the video is reflected in spatial continuity. Therefore, the difference data between the current block and the left and upper adjacent blocks can provide more accurate prediction basis for image boundaries. By introducing more directional adjacent blocks, expanding the range of adjacent blocks, and using this as the data basis for the preset conditions of the OBMC algorithm, the accuracy of prediction fusion can be improved, the required inter-frame prediction method for the current block can be obtained, and thus the compression efficiency can be improved.
[0166] In some embodiments, obtaining the difference data between neighboring blocks and the current block includes at least one of the following steps.
[0167] 1. Obtain the first prediction data of the adjacent blocks and the second prediction data of the current block. The first prediction data is the prediction data obtained based on the motion vector of the adjacent blocks themselves, and the second prediction data is the prediction data obtained based on the motion vector of the current block itself.
[0168] In some embodiments, the adjacent block includes at least one first predicted pixel, the current block includes at least one second predicted pixel, the first prediction data includes the first predicted pixel value corresponding to at least one first predicted pixel, and the second prediction data includes the second predicted pixel value corresponding to at least one second predicted pixel.
[0169] Schematic, the first prediction data is the inter-frame prediction data initially obtained for adjacent blocks. Motion vectors are obtained through motion estimation, and pixel blocks at corresponding positions are extracted from a specified reference frame based on the motion vectors of adjacent blocks through motion compensation. These pixel blocks are then initially used as prediction blocks for adjacent blocks, thereby converting motion information into specific predicted pixel values. The second prediction data is the inter-frame prediction data initially obtained for the current block. Motion vectors are obtained through motion estimation, and pixel blocks at corresponding positions are extracted from a specified reference frame based on the motion vectors of the current block through motion compensation. These pixel blocks are then initially used as prediction blocks for the current block. Optionally, the adjacent blocks are the current blocks processed within a historical time period.
[0170] 2. Based on the first prediction data and the second prediction data, obtain the difference data between the current block and the adjacent blocks.
[0171] In some embodiments, a block difference value between the current block and neighboring blocks is obtained based on at least one first predicted pixel value and at least one second predicted pixel value, wherein the difference data between the current block and neighboring blocks includes the block difference value.
[0172] In some embodiments, based on the positional correspondence between at least one first predicted pixel and at least one second predicted pixel, at least one pair of adjacent pixel value pairs is obtained, wherein the at least one pair of adjacent pixel value pairs includes a first predicted pixel value and a second predicted pixel value; pixel differences corresponding to the at least one pair of adjacent pixel value pairs are obtained, wherein the pixel difference is the difference between the first predicted pixel value and the second predicted pixel value; and the average value of the pixel differences corresponding to the at least one pair of adjacent pixel value pairs is obtained as a block difference value.
[0173] The positional correspondence between at least one first predicted pixel and at least one second predicted pixel is determined by the encoder based on the segmentation of the image. For example, during the segmentation of coding blocks, the boundary positions between the current block and adjacent blocks are determined, and the coordinates of the corresponding first and second predicted pixels are symmetrical about these boundary positions. Based on the corresponding first and second predicted pixels, the pixel values corresponding to the predicted pixels are combined to obtain at least one pair of adjacent pixel value pairs.
[0174] In some embodiments, the process of obtaining block difference values based on at least one pair of adjacent pixel value pairs includes, but is not limited to, at least one of the following steps.
[0175] 2.1 Calculate the pixel difference between adjacent pixel values in the boundary region of the adjacent block and the current block respectively. Optionally, the boundary region includes two rows of pixels in the adjacent block and the current block that are closest to the boundary between the adjacent block and the current block. Schematic, the pixel difference is obtained by subtracting the corresponding first predicted pixel value and the second predicted pixel value.
[0176] 2.2 Based on at least one pixel difference in the boundary region, obtain a block difference value to indicate the overall difference in the boundary region. Schematic, the absolute values of the pixel differences are obtained, and the absolute values of at least one pixel difference are summed and averaged to obtain the block difference value. The block difference value is an overall indicator value obtained based on individual pixel differences, used to indicate the overall predicted data difference between neighboring blocks and the current block in a pre-specified boundary region, serving as the difference data between neighboring blocks and the current block. Schematic, the formula for the block difference value is expressed as: Block Difference Value = (∑|Block Difference Value|) / n, where n is the number of pixels corresponding to the current block in the boundary region.
[0177] Step 920: Obtain the encoding parameters of the current block based on the difference data.
[0178] The encoding parameters are used to indicate the inter-frame prediction method for the current block. In some embodiments, the difference between the neighboring blocks and the current block indicated by the difference data in the boundary region is used to obtain different encoding parameters to reduce the energy of the prediction residual through an inter-frame prediction method adapted to the current block.
[0179] In this embodiment of the application, the encoding parameters of the current block can also be obtained by reading and parsing the encoding parameters stored as syntax elements in the bitstream.
[0180] Schematic, based on the difference requirements, the degree of difference between the adjacent blocks and the current block indicated by the difference data can be divided into at least three categories.
[0181] The first category involves situations where the difference data indicates that the boundary region between the current block and its neighboring blocks is too different, meaning that there are significant differences in the local images corresponding to the current block and its neighboring blocks at different display angles, indicating that the current block and its neighboring blocks do not belong to the same object or region represented by the image. When the difference data meets the difference requirements, that is, when the difference between the neighboring blocks and the current block is too large, the inter-frame prediction method avoids fusing the boundary pixels of different coding blocks through the OBMC algorithm, thereby preserving the edge information corresponding to the coding blocks, which avoids problems such as edge blurring between different regions in the image and large decoding errors.
[0182] The second category involves cases where the difference data indicates that the boundary region between the current block and its neighboring blocks is too small. In other words, there is almost no difference between the local images of the current block and its neighboring blocks at the display angles. This indicates that the current block and its neighboring blocks belong to the same object or region represented by the image, and the current encoding method does not produce block effects on the boundary region between the current block and its neighboring blocks. In cases where the difference between the neighboring blocks and the current block is too small, the inter-frame prediction method avoids fusing the boundary pixels of different coded blocks through the OBMC algorithm, thereby avoiding redundant calculations. This reduces computational complexity and improves compression efficiency while ensuring decoding accuracy.
[0183] The third category is when the difference data indicates that the boundary region between the current block and the adjacent blocks is significantly different, that is, there is a difference between the local images of the current block and the adjacent blocks at the display angles, indicating that the current encoding method produces a block effect on the boundary region between the current block and the adjacent blocks; when the difference data does not meet the difference requirements and is higher than the preset second threshold, that is, when the difference between the adjacent blocks and the current block is significant, the inter-frame prediction method fuses the boundary pixels of different coding blocks through the OBMC algorithm, thereby reducing the energy of the prediction residual and improving the compression efficiency.
[0184] In some embodiments, the encoding parameters are determined based on the relationship between the difference data between the current block and its neighboring blocks and a preset difference requirement. Obtaining the encoding parameters of the current block based on the difference data includes at least one of the following steps.
[0185] 1. If the difference data meets the preset difference requirements, obtain the first encoding parameter as the encoding parameter of the current block.
[0186] The first encoding parameter is used to indicate skipping the Overlapping Block Motion Compensation (OBMC) process. Schematic, the difference data meeting a preset difference requirement can be implemented as the difference data reaching a first threshold, where the first threshold indicates the upper limit of the difference data. The difference data reaching the preset first threshold includes, but is not limited to, at least one of the following: the difference data reaches a preset fixed first threshold; if the difference data exceeds the first threshold, the difference degree between the adjacent block and the current block indicated by the difference data is classified as Class I, indicating excessive difference; or, the difference data reaches a dynamically determined first threshold, wherein the method for dynamically determining the first threshold includes, but is not limited to: generating the first threshold based on historical difference requirements using an artificial intelligence model; determining the first threshold based on the bit depth corresponding to the difference data between the current block and adjacent blocks, etc.
[0187] 2. If the difference data does not meet the preset difference requirements, perform rate distortion processing on the current block to obtain the rate distortion processing result.
[0188] Schematic, the coding parameters of the current block are obtained based on the rate-distortion processing result. The rate-distortion processing determines whether the inter-frame prediction method for the current block includes OBMC processing. Accordingly, the rate-distortion processing result includes either of the following two states.
[0189] 2.1 If the rate-distortion processing result is in the first state, obtain the first encoding parameter as the encoding parameter of the current block.
[0190] 2.2 If the rate-distortion processing result is in the second state, obtain the second encoding parameter as the encoding parameter for the current block.
[0191] Optionally, the above coding parameters are implemented as a mode decision flag obmc_flag. When the coding parameter of the current block is the first coding parameter, obmc_flag=0, which indicates that OBMC processing is skipped during inter-frame prediction; when the coding parameter is the second coding parameter, obmc_flag=1, which indicates that OBMC processing is performed during inter-frame prediction.
[0192] It is worth noting that the above process of obtaining the encoding parameters of the current block based on the difference data is only an illustrative example, and the embodiments of this application do not limit the specific method of obtaining the encoding parameters.
[0193] Step 930: Reconstruct the current block based on the coding parameters to obtain the inter-frame prediction data of the current block.
[0194] When the encoder writes the encoded parameters as syntax elements into the bitstream, the decoder's decoding process based on these parameters is a strict inverse and execution process of the encoder establishing correspondences. Starting from the beginning of the bitstream, the decoder parses the values of each syntax element layer by layer according to the syntax table, parsing order, and entropy decoding method specified by the video codec standard. This parsing process is implemented as a mechanical reading, including but not limited to at least one of the following steps: First, the decoder parses high-level global parameters such as sequence parameter sets and image parameter sets; then, following the raster scan order, it parses the partitioning flags of each coding tree unit to determine the block partitioning structure corresponding to each coding tree unit; it parses the prediction mode flags of each coding unit to determine whether the prediction mode required for the current block includes intra-frame prediction, inter-frame prediction, or IBC prediction. Based on the prediction mode, it continues to parse the specific parameters corresponding to each prediction mode, such as the merge_flag flag indicating the inter-frame prediction method (whether a fusion mode is used), the motion vector difference (mvd), and the reference frame index (ref_idx), thereby determining the specific decoding method.
[0195] In video codec standards, each syntax element value parsed by the decoder has a unique semantic interpretation. Based on these syntax element values, the decoder reconstructs locally a set of encoding parameters and encoding mode instructions that are identical to those of the encoder. For example, if `obmc_flag=1`, it indicates that OBMC processing is required. Based on the aforementioned set of encoding parameters and encoding mode instructions, the decoder executes the calculation process indicated by the encoding mode instructions and encoding parameters according to the video codec standard to reconstruct the current block.
[0196] In some embodiments, the reference block is stored in a decoded image buffer jointly maintained by the encoder and decoder, ensuring that both use identical reference data during prediction. Based on the motion vector corresponding to the current block, the reference block corresponding to the current block is obtained from the decoded image buffer; second prediction data is initially generated through motion compensation. If obmc_flag=1, OBMC processing continues, weighted fusion of the boundary regions between the current block and adjacent blocks is performed to obtain the final prediction block. Optionally, prediction blocks are generated from the reconstructed adjacent pixels of the current frame according to the prediction mode. The transform coefficients in the bitstream are inversely quantized and inversely transformed to obtain a residual block; the prediction block and the residual block are added pixel by pixel to initially obtain a reconstructed block; normalized filtering operations such as deblocking filtering and sample adaptive offset are performed sequentially to eliminate block artifacts, obtaining the final reconstructed block, which is stored in the decoded image buffer as a reference frame for subsequent frames. Schematic, reconstructed block = prediction block + reconstructed residual block.
[0197] The decoder and encoder follow the exact same syntax standard to parse and generate syntax elements. The operations performed by the decoder correspond to algorithms defined uniquely and definitively within the video codec standard. These algorithms include, but are not limited to, motion estimation, motion compensation, various enhancement algorithms, inverse transform, and filtering. The decoder ensures consistency of the reference frame content by maintaining a decoded image buffer synchronized with the encoder.
[0198] In this embodiment, by acquiring the difference data between the current block and adjacent blocks, the computational complexity of determining the encoding parameters corresponding to the current block by calculating the rate distortion cost is reduced, the process of determining the encoding parameters is simplified, and the encoding parameters adapted to the current block are quickly determined. The current block is then predicted and reconstructed using the inter-frame prediction method indicated by the encoding parameters, and the inter-frame prediction data of the current block is obtained. This helps to improve the efficiency of the prediction process, reduce the hardware computational overhead in the encoding and decoding process, and improve the decoding quality.
[0199] Please refer to Figure 10 , Figure 10 This is a structural block diagram of an encoding apparatus provided in an exemplary embodiment of this application. The encoding apparatus includes the following modules.
[0200] Encoding module 1010 is used to obtain the difference data between the current block and adjacent blocks of the video image, where the video image is the image to be encoded; The encoding module 1010 is used to obtain the encoding parameters of the current block based on the difference data. The encoding parameters are used to indicate the inter-frame prediction method for the current block. Encoding module 1010 is used to obtain inter-frame prediction data for the current block based on encoding parameters.
[0201] Optionally, the encoding module 1010 is used for: Obtain the first prediction data of the adjacent blocks and the second prediction data of the current block. The first prediction data is the prediction data obtained based on the motion vector of the adjacent blocks themselves, and the second prediction data is the prediction data obtained based on the motion vector of the current block itself. Based on the first and second prediction data, obtain the difference data between the current block and its neighboring blocks.
[0202] Optionally, adjacent blocks include at least one first predicted pixel, the current block includes at least one second predicted pixel, the first prediction data includes the first predicted pixel value corresponding to at least one first predicted pixel, and the second prediction data includes the second predicted pixel value corresponding to at least one second predicted pixel; the encoding module 1010 is used for: Based on the first and second prediction data, the difference data between the current block and its neighboring blocks is obtained, including: Based on at least one first predicted pixel value and at least one second predicted pixel value, the block difference value between the current block and the adjacent blocks is obtained, and the difference data includes the block difference value.
[0203] Optionally, the encoding module 1010 is used for: Based on the positional correspondence between at least one first predicted pixel and at least one second predicted pixel, at least one pair of adjacent pixel values is obtained; Obtain at least one pair of adjacent pixel value pairs corresponding to the pixel difference, where the pixel difference is the difference between the first predicted pixel value and the second predicted pixel value; The average value of the pixel difference corresponding to at least one pair of adjacent pixel values is obtained as the block difference value.
[0204] Optionally, the encoding module 1010 is used for: If the difference data meets the preset difference requirements, the first encoding parameter is obtained as the encoding parameter of the current block. The first encoding parameter is used to indicate to skip the execution of Overlapping Block Motion Compensation (OBMC) processing.
[0205] Optionally, the encoding module 1010 is used for: If the difference data reaches a preset first threshold, the first encoding parameter is obtained.
[0206] Optionally, the encoding module 1010 is used for: When the encoding parameters of the current block are the first encoding parameters, the second prediction data is obtained and used as the inter-frame prediction data of the current block. The second prediction data is the prediction data obtained based on the motion vector of the current block itself.
[0207] Optionally, the encoding module 1010 is used for: If the difference data does not meet the preset difference requirements, rate distortion processing is performed on the current block to obtain the rate distortion processing result; Based on the rate-distortion processing results, obtain the encoding parameters of the current block.
[0208] Optionally, the encoding module 1010 is used for: When the rate-distortion processing result is in the first state, the first coding parameter is obtained as the coding parameter of the current block. The first coding parameter is used to indicate that OBMC processing is skipped. The first state indicates that the rate-distortion cost corresponding to OBMC processing is higher than the rate-distortion cost corresponding to any other inter-frame prediction method.
[0209] Optionally, the encoding module 1010 is used for: When the rate-distortion processing result is in the second state, the second coding parameter is obtained as the coding parameter of the current block. The second coding parameter is used to indicate the execution of the OBMC processing. The second state indicates that the rate-distortion cost corresponding to the OBMC processing is lower than the rate-distortion cost corresponding to at least one other inter-frame prediction method.
[0210] Optionally, the encoding module 1010 is used for: When the encoding parameters are the second encoding parameters, the inter-frame prediction data of the current block is obtained through OBMC processing.
[0211] Optionally, the encoding module 1010 is used for: Construct a candidate mode set for the current block. The candidate mode set includes at least two candidate modes. The candidate mode is a combination of parameters used to indicate the inter-frame prediction method of the current block. For the current block, obtain the rate-distortion cost corresponding to at least two candidate modes respectively; Based on the comparison results between the rate-distortion costs corresponding to at least two candidate modes, the rate-distortion processing result is obtained.
[0212] Optionally, at least two candidate modes include the OBMC mode; encoding module 1010 is used for: If the rate distortion cost corresponding to the OBMC mode reaches the rate distortion cost corresponding to any other mode, the rate distortion processing result is determined to be the first state. If the rate-distortion cost corresponding to the OBMC mode does not reach the rate-distortion cost corresponding to at least one other mode, the rate-distortion processing result is determined to be the second state.
[0213] Optionally, the adjacent block includes a left adjacent block and an upper adjacent block. The left adjacent block is the coded block to the left of the current block and adjacent to the current block, and the upper adjacent block is the coded block above the current block and adjacent to the current block. The encoding module 1010 is used for: Obtain the first difference data between the current block and its left neighboring block, and obtain the second difference data between the current block and its upper neighboring block. The difference data includes the first difference data and the second difference data.
[0214] Please refer to Figure 11 , Figure 11 This is a structural block diagram of a decoding device provided in an exemplary embodiment of this application. The decoding device includes the following modules.
[0215] Decoding module 1110 is used to acquire the difference data between the current block and adjacent blocks of the video image, where the video image is the image to be decoded; The decoding module 1110 is used to obtain the encoding parameters of the current block based on the difference data. The encoding parameters are used to indicate the inter-frame prediction method for the current block. The decoding module 1110 is used to reconstruct the current block based on the encoding parameters to obtain the inter-frame prediction data of the current block.
[0216] Optionally, the decoding module 1110 is used for: Obtain the first prediction data of the adjacent blocks and the second prediction data of the current block. The first prediction data is the prediction data obtained based on the motion vector of the adjacent blocks themselves, and the second prediction data is the prediction data obtained based on the motion vector of the current block itself. Based on the first and second prediction data, obtain the difference data between the current block and its neighboring blocks.
[0217] Optionally, adjacent blocks include at least one first predicted pixel, the current block includes at least one second predicted pixel, the first prediction data includes the first predicted pixel value corresponding to at least one first predicted pixel, and the second prediction data includes the second predicted pixel value corresponding to at least one second predicted pixel; the decoding module 1110 is used for: Based on the first and second prediction data, the difference data between the current block and its neighboring blocks is obtained, including: Based on at least one first predicted pixel value and at least one second predicted pixel value, the block difference value between the current block and the adjacent blocks is obtained, and the difference data includes the block difference value.
[0218] Optionally, the decoding module 1110 is used for: Based on the positional correspondence between at least one first predicted pixel and at least one second predicted pixel, at least one pair of adjacent pixel values is obtained; Obtain at least one pair of adjacent pixel value pairs corresponding to the pixel difference, where the pixel difference is the difference between the first predicted pixel value and the second predicted pixel value; The average value of the pixel difference corresponding to at least one pair of adjacent pixel values is obtained as the block difference value.
[0219] Optionally, the decoding module 1110 is used for: If the difference data meets the preset difference requirements, the first encoding parameter is obtained as the encoding parameter of the current block. The first encoding parameter is used to indicate to skip the execution of Overlapping Block Motion Compensation (OBMC) processing.
[0220] Optionally, the decoding module 1110 is used for: If the difference data reaches a preset first threshold, the first encoding parameter is obtained.
[0221] Optionally, the decoding module 1110 is used for: When the encoding parameters of the current block are the first encoding parameters, the second prediction data is obtained and used as the inter-frame prediction data of the current block. The second prediction data is the prediction data obtained based on the motion vector of the current block itself.
[0222] Optionally, the decoding module 1110 is used for: If the difference data does not meet the preset difference requirements, rate distortion processing is performed on the current block to obtain the rate distortion processing result; Based on the rate-distortion processing results, obtain the encoding parameters of the current block.
[0223] Optionally, the decoding module 1110 is used for: When the rate-distortion processing result is in the first state, the first coding parameter is obtained as the coding parameter of the current block. The first coding parameter is used to indicate that OBMC processing is skipped. The first state indicates that the rate-distortion cost corresponding to OBMC processing is higher than the rate-distortion cost corresponding to any other inter-frame prediction method.
[0224] Optionally, the decoding module 1110 is used for: When the rate-distortion processing result is in the second state, the second coding parameter is obtained as the coding parameter of the current block. The second coding parameter is used to indicate the execution of the OBMC processing. The second state indicates that the rate-distortion cost corresponding to the OBMC processing is lower than the rate-distortion cost corresponding to at least one other inter-frame prediction method.
[0225] Optionally, the decoding module 1110 is used for: When the encoding parameters are the second encoding parameters, the inter-frame prediction data of the current block is obtained through OBMC processing.
[0226] Optionally, the decoding module 1110 is used for: Construct a candidate mode set for the current block. The candidate mode set includes at least two candidate modes. The candidate mode is a combination of parameters used to indicate the inter-frame prediction method of the current block. For the current block, obtain the rate-distortion cost corresponding to at least two candidate modes respectively; Based on the comparison results between the rate-distortion costs corresponding to at least two candidate modes, the rate-distortion processing result is obtained.
[0227] Optionally, at least two candidate modes include the OBMC mode; the decoding module 1110 is used for: If the rate distortion cost corresponding to the OBMC mode reaches the rate distortion cost corresponding to any other mode, the rate distortion processing result is determined to be the first state. If the rate-distortion cost corresponding to the OBMC mode does not reach the rate-distortion cost corresponding to at least one other mode, the rate-distortion processing result is determined to be the second state.
[0228] Optionally, the adjacent block includes a left adjacent block and an upper adjacent block. The left adjacent block is the encoded block to the left of the current block and adjacent to the current block, and the upper adjacent block is the encoded block above the current block and adjacent to the current block. The decoding module 1110 is used for: Obtain the first difference data between the current block and its left neighboring block, and obtain the second difference data between the current block and its upper neighboring block. The difference data includes the first difference data and the second difference data.
[0229] It should be noted that the encoding process of the above encoding module can refer to the above encoding method embodiment, and the decoding process of the above decoding module can refer to the above decoding method embodiment. This embodiment will not be described in detail here.
[0230] The apparatus provided in this application reduces the computational complexity of determining the encoding parameters corresponding to the current block by calculating the rate distortion cost by acquiring the difference data between the current block and adjacent blocks, simplifies the process of determining the encoding parameters, and thus quickly determines the encoding parameters that are suitable for the current block. The current block is then subjected to prediction and reconstruction processing using the inter-frame prediction method indicated by the encoding parameters to obtain the inter-frame prediction data of the current block. This helps to improve the efficiency of the prediction process, reduce the hardware computational overhead in the encoding and decoding process, and improve the decoding quality.
[0231] Please refer to Figure 12 , Figure 12 This is a structural block diagram of an encoder provided in an exemplary embodiment of this application. The encoder may include one or more components such as a processor 1201 and a memory 1202. The various components are coupled together via a bus system. It is understood that the bus system is used to realize the connection and communication between these components. In addition to a data bus, the bus system also includes a power bus, a control bus, and a status signal bus.
[0232] The memory 1202 is used to store a computer program that can run on the processor 1201; the processor 1201 is used to perform at least one of the following steps when running the computer program.
[0233] Obtain the difference data between the current block and adjacent blocks of the video image; the video image is the image to be encoded. The encoding parameters of the current block are obtained based on the difference data, and the encoding parameters are used to indicate the inter-frame prediction method for the current block; The inter-frame prediction data of the current block is obtained based on the encoding parameters.
[0234] It is understood that the memory 1202 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous DRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1202 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0235] The processor 1201 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above encoding method can be completed by the integrated logic circuitry in the hardware of the processor 1201 or by instructions in software form. The processor 1201 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 1202. Processor 1201 reads information from memory 1202 and, in conjunction with its hardware, completes the steps of the above method. It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more ASICs, DSPs, digital signal processing devices (DSP Devices, DSPDs), programmable logic devices (PLDs), FPGAs, general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by the processor. The memory can be implemented in the processor or external to the processor. Optionally, as another embodiment, processor 1201 is also configured to execute the encoding method described in any of the foregoing embodiments when running the computer program.
[0236] Please refer to Figure 13 , Figure 13This is a structural block diagram of a decoder provided in an exemplary embodiment of this application. The decoder may include one or more components such as a processor 1301 and a memory 1302. The various components are coupled together via a bus system. It is understood that the bus system is used to implement communication between these components. In addition to a data bus, the bus system also includes a power bus, a control bus, and a status signal bus.
[0237] The memory 1302 is used to store a computer program that can run on the processor 1301; the processor 1301 is used to perform at least one of the following steps when running the computer program.
[0238] Obtain the difference data between the current block and adjacent blocks of the video image; the video image is the image to be decoded. The encoding parameters of the current block are obtained based on the difference data, and the encoding parameters are used to indicate the inter-frame prediction method for the current block; Based on the encoding parameters, the current block is reconstructed to obtain the inter-frame prediction data of the current block.
[0239] It is understood that the memory 1302 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be ROM, PROM, EPRO, EEPROM, or flash memory. The volatile memory can be RAM, which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as SRAM, DRAM, SDRAM, DDRSDRAM, ESDRAM, SLDRAM, and DRRAM. The memory 1302 described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0240] The processor 1301 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above decoding method can be completed by the integrated logic circuitry in the hardware of the processor 1301 or by instructions in software form. The processor 1301 may be a general-purpose processor, DSP, ASIC, FPGA, or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of the hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 1302, and the processor 1301 reads the information in memory 1302 and, in conjunction with its hardware, completes the steps of the above method. It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more ASICs, DSPs, DSPDs, PLDs, FPGAs, general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented by modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor. Optionally, as another embodiment, the processor 1301 is also configured to execute the decoding method described in any of the foregoing embodiments when running the computer program.
[0241] This application also provides a computer-readable storage medium storing a bitstream thereon, and at least one of a computer program and instructions, which, when executed by a processor, implement the steps of the encoding method described in the above embodiments to generate the bitstream.
[0242] This application provides a computer-readable storage medium storing a bitstream thereon, and at least one of a computer program and instructions, wherein when the computer program and instructions are executed by a processor, they implement the steps of the decoding method as described in the above embodiments to decode the bitstream to generate a video or image.
[0243] This application provides a method for storing a bitstream, the method comprising: generating a bitstream by performing an encoding method as described in the above embodiments; and storing the bitstream.
[0244] This application provides a method for reading a bitstream, the method comprising: reading the bitstream; and performing a decoding method as described in the above embodiments to decode the bitstream to generate a video or image.
[0245] This application provides a method for transmitting a bitstream, the method comprising: generating a bitstream by performing an encoding method as described in the above embodiments; and transmitting the bitstream.
[0246] This application provides a method for receiving a bitstream, the method comprising: receiving the bitstream; and performing a decoding method as described in the above embodiments to decode the bitstream to generate a video or image.
[0247] This application also provides a computer program product, which includes computer instructions that are executed by a processor to implement the encoding or decoding method as described in the above embodiments.
[0248] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0249] The above description is merely an optional 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. An encoding method, characterized in that, The method includes: The difference data between the current block and the neighboring blocks of a video image is obtained. The video image is an image to be encoded. The difference data is used to indicate the difference between the first prediction data of the neighboring blocks and the second prediction data of the current block. The first prediction data is prediction data obtained based on the motion vector of the neighboring blocks themselves, and the second prediction data is prediction data obtained based on the motion vector of the current block itself. The encoding parameters of the current block are obtained based on the difference data. The encoding parameters include a first encoding parameter for indicating that the overlapping block motion compensation (OBMC) process should be skipped, and a second encoding parameter for indicating that the OBMC process should be performed. The inter-frame prediction data of the current block is obtained based on the encoding parameters.
2. The method according to claim 1, characterized in that, The adjacent block includes at least one first predicted pixel, the current block includes at least one second predicted pixel, the first prediction data includes the first predicted pixel value corresponding to the at least one first predicted pixel, and the second prediction data includes the second predicted pixel value corresponding to the at least one second predicted pixel. The step of acquiring the difference data between the current block and adjacent blocks of the video image includes: Based on at least one first predicted pixel value and at least one second predicted pixel value, a block difference value is obtained between the current block and the adjacent block, and the difference data includes the block difference value.
3. The method according to claim 2, characterized in that, The step of obtaining the block difference value between the current block and the neighboring blocks based on at least one first predicted pixel value and at least one second predicted pixel value includes: Based on the positional correspondence between the at least one first predicted pixel and the at least one second predicted pixel, at least one pair of adjacent pixel values is obtained; Obtain the pixel difference corresponding to each of the at least one pair of adjacent pixel values, wherein the pixel difference is the difference between the first predicted pixel value and the second predicted pixel value; The average value of the pixel differences corresponding to each of the at least one pair of adjacent pixel values is obtained as the block difference value.
4. The method according to claim 1, characterized in that, The step of obtaining the encoding parameters of the current block based on the difference data includes: If the difference data meets the preset difference requirements, the first encoding parameter is obtained and used as the encoding parameter of the current block.
5. The method according to claim 4, characterized in that, The step of obtaining the first encoding parameter when the difference data meets the preset difference requirements includes: When the difference data reaches a preset first threshold, the first encoding parameter is obtained.
6. The method according to claim 4, characterized in that, The step of obtaining the inter-frame prediction data of the current block based on the encoding parameters includes: If the encoding parameters of the current block are the first encoding parameters, the second prediction data is obtained and used as the inter-frame prediction data of the current block.
7. The method according to claim 1, characterized in that, The step of obtaining the encoding parameters of the current block based on the difference data includes: If the difference data does not meet the preset difference requirements, rate distortion processing is performed on the current block to obtain the rate distortion processing result; Based on the rate-distortion processing result, the encoding parameters of the current block are obtained.
8. The method according to claim 7, characterized in that, The step of obtaining the encoding parameters of the current block based on the rate-distortion processing result includes: When the rate-distortion processing result is in the first state, the first encoding parameter is obtained as the encoding parameter of the current block. The first state indicates that the rate-distortion cost corresponding to the OBMC processing is higher than the rate-distortion cost corresponding to any other inter-frame prediction method.
9. The method according to claim 7, characterized in that, The step of obtaining the encoding parameters of the current block based on the rate-distortion processing result includes: When the rate-distortion processing result is in the second state, the second coding parameter is obtained as the coding parameter of the current block. The second state indicates that the rate-distortion cost corresponding to the OBMC processing is lower than the rate-distortion cost corresponding to at least one other inter-frame prediction method.
10. The method according to claim 9, characterized in that, The step of obtaining the inter-frame prediction data of the current block based on the encoding parameters includes: When the encoding parameter is the second encoding parameter, the inter-frame prediction data of the current block is obtained through the OBMC processing.
11. The method according to claim 7, characterized in that, When the difference data does not meet the preset difference requirements, rate distortion processing is performed on the current block to obtain the rate distortion processing result, including: Construct a candidate mode set for the current block, the candidate mode set including at least two candidate modes, the candidate mode being a combination of parameters used to indicate the inter-frame prediction method of the current block; For the current block, obtain the rate-distortion costs corresponding to at least two candidate modes respectively; The rate-distortion processing result is obtained based on the comparison results between the rate-distortion costs corresponding to the at least two candidate modes.
12. The method according to claim 11, characterized in that, The at least two candidate modes include the OBMC mode; The step of obtaining the rate-distortion processing result based on the comparison result between the rate-distortion costs corresponding to the at least two candidate modes includes: If the rate-distortion cost corresponding to the OBMC mode reaches the rate-distortion cost corresponding to any other mode, the rate-distortion processing result is determined to be the first state. If the rate-distortion cost corresponding to the OBMC mode does not reach the rate-distortion cost corresponding to at least one other mode, the rate-distortion processing result is determined to be the second state.
13. The method according to claim 1, characterized in that, The adjacent block includes a left adjacent block and an upper adjacent block. The left adjacent block is the coded block to the left of the current block and adjacent to the current block. The upper adjacent block is the coded block above the current block and adjacent to the current block. The step of acquiring the difference data between the current block and adjacent blocks of the video image includes: Obtain first difference data between the current block and the left adjacent block, and obtain second difference data between the current block and the upper adjacent block, wherein the difference data includes the first difference data and the second difference data.
14. A decoding method, characterized in that, The method includes: Acquire difference data between the current block and neighboring blocks of a video image, wherein the video image is an image to be decoded, and the difference data is used to indicate the difference between the first prediction data of the neighboring blocks and the second prediction data of the current block, wherein the first prediction data is prediction data obtained based on the motion vector of the neighboring blocks themselves, and the second prediction data is prediction data obtained based on the motion vector of the current block itself; The encoding parameters of the current block are obtained based on the difference data. The encoding parameters include a first encoding parameter for indicating that the overlapping block motion compensation (OBMC) process should be skipped, and a second encoding parameter for indicating that the OBMC process should be performed. Based on the encoding parameters, the current block is reconstructed to obtain the inter-frame prediction data of the current block.
15. An encoding device, characterized in that, The device includes: An encoding module is used to acquire difference data between the current block and neighboring blocks of a video image, wherein the video image is an image to be encoded, and the difference data is used to indicate the difference between the first prediction data of the neighboring blocks and the second prediction data of the current block, wherein the first prediction data is prediction data obtained based on the motion vector of the neighboring blocks themselves, and the second prediction data is prediction data obtained based on the motion vector of the current block itself; The encoding module is used to obtain the encoding parameters of the current block based on the difference data. The encoding parameters include a first encoding parameter for indicating that the overlapping block motion compensation (OBMC) processing should be skipped, and a second encoding parameter for indicating that the OBMC processing should be performed. The encoding module is used to obtain inter-frame prediction data of the current block based on the encoding parameters.
16. A decoding device, characterized in that, The device includes: A decoding module is used to acquire difference data between the current block and adjacent blocks of a video image, wherein the video image is an image to be decoded, and the difference data is used to indicate the difference between the first prediction data of the adjacent blocks and the second prediction data of the current block. The first prediction data is prediction data obtained based on the motion vector of the adjacent blocks themselves, and the second prediction data is prediction data obtained based on the motion vector of the current block itself. The decoding module is used to obtain the encoding parameters of the current block based on the difference data. The encoding parameters include a first encoding parameter for indicating that the overlapping block motion compensation (OBMC) processing should be skipped, and a second encoding parameter for indicating that the OBMC processing should be performed. The decoding module is used to reconstruct the current block based on the encoding parameters to obtain the inter-frame prediction data of the current block.
17. An encoder, characterized in that, The encoder includes a memory and a processor, the memory being used to store a computer program running on the processor; the processor being used to execute the steps of the encoding method as described in any one of claims 1 to 13 when running the computer program.
18. A decoder, characterized in that, The decoder includes a memory and a processor, the memory being used to store a computer program running on the processor; the processor being used to execute the steps of the decoding method as described in claim 14 when running the computer program.
19. A computer-readable storage medium, characterized in that, It stores a bitstream thereon, and at least one of a computer program and instructions, which, when executed by a processor, implement the steps of the encoding method as described in any one of claims 1 to 13 to generate the bitstream.
20. A computer program product, characterized in that, The computer program product includes computer instructions that are executed by a processor to implement the steps of the encoding method as described in any one of claims 1 to 13.
21. A computer program product, characterized in that, The computer program product includes computer instructions that are executed by a processor to implement the steps of the decoding method as described in claim 14.
22. A method for transmitting a code stream, characterized in that, The method includes: generating a bitstream by performing the steps of the encoding method as described in any one of claims 1 to 13; and transmitting the bitstream.
Citation Information
Patent Citations
Video decoding method and device, video encoding method and device, storage medium, decoder and encoder
CN110677647A
Combination of inter-prediction and intra-prediction in video coding
CN110771163A