The present disclosure generally relates to video processing, and more particularly, to methods and apparatuses for optical flow-based motion refinement.
A video is a set of static pictures (or “frames”) capturing the visual information. To reduce the storage memory and the transmission bandwidth, a video can be compressed before storage or transmission and decompressed before display. The compression process is usually referred to as encoding and the decompression process is usually referred to as decoding. There are various video coding formats which use standardized video coding technologies, most commonly based on prediction, transform, quantization, entropy coding and in-loop filtering. The video coding standards, such as the High Efficiency Video Coding (HEVC/H.265) standard, the Versatile Video Coding (VVC/H.266) standard, AVS standards, specifying the specific video coding formats, are developed by standardization organizations. With more and more advanced video coding technologies being adopted in the video standards, the coding efficiency of the new video coding standards get higher and higher.
Embodiments of the present disclosure provide methods and apparatuses for optical flow-based motion refinement.
According to some exemplary embodiments, there is provided a video processing method including: dividing a coding block into a first set of subblocks and a second set of subblocks; performing a first pass of optical flow-based motion vector refinement on the first set of subblocks; and performing a second pass of optical flow-based motion vector refinement on the second set of subblock.
According to some exemplary embodiments, there is provided an apparatus including: a memory storing computer instructions; and one or more processors configured to execute the computer instructions. The the execution of the computer instruction causes the apparatus to perform operations including: dividing a coding block into a first set of subblocks and a second set of subblocks; performing a first pass of optical flow-based motion vector refinement on the first set of subblocks; and performing a second pass of optical flow-based motion vector refinement on the second set of subblock.
According to some exemplary embodiments, there is provided a non-transitory computer readable storage medium storing a bitstream of a video. The bitstream is for processing according to a method including: dividing a coding block into a first set of subblocks and a second set of subblocks; performing a first pass of optical flow-based motion vector refinement on the first set of subblocks; and performing a second pass of optical flow-based motion vector refinement on the second set of subblock.
Embodiments and various aspects of the present disclosure are illustrated in the following detailed description and the accompanying figures. Various features shown in the figures are not drawn to scale.
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise represented. The implementations set forth in the following description of exemplary embodiments do not represent all implementations consistent with the invention. Instead, they are merely examples of apparatuses and methods consistent with aspects related to the invention as recited in the appended claims. Particular aspects of the present disclosure are described in greater detail below. The terms and definitions provided herein control, if in conflict with terms or definitions incorporated by reference.
The embodiments provided by the present disclosure are directed to encoding and decoding video information, and more particularly, to methods and systems for performing optical flow-based motion vector refinement. The disclosed methods perform multiple passes of optical flow-based motion vector refinement, and adaptively the subblock grid size, thereby leading to more stable results in the optical flow calculation.
For reducing the storage space and the transmission bandwidth needed by such applications, the video can be compressed before storage and transmission and decompressed before the display. The compression and decompression can be implemented by software executed by a processor (e.g., a processor of a generic computer) or specialized hardware. The module for compression is generally referred to as an “encoder,” and the module for decompression is generally referred to as a “decoder.” The encoder and decoder can be collectively referred to as a “codec.” The encoder and decoder can be implemented as any of a variety of suitable hardware, software, or a combination thereof. For example, the hardware implementation of the encoder and decoder can include circuitry, such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, or any combinations thereof. The software implementation of the encoder and decoder can include program codes, computer-executable instructions, firmware, or any suitable computer-implemented algorithm or process fixed in a computer-readable medium. Video compression and decompression can be implemented by various algorithms or standards, such as MPEG-1, MPEG-2, MPEG-4, H.26x, AVS series, or the like. In some applications, the codec can decompress the video from a first coding standard and re-compress the decompressed video using a second coding standard, in which case the codec can be referred to as a “transcoder.”
The video encoding process can identify and keep useful information that can be used to reconstruct a picture and disregard unimportant information for the reconstruction. If the disregarded, unimportant information cannot be fully reconstructed, such an encoding process can be referred to as “lossy.” Otherwise, it can be referred to as “lossless.” Most encoding processes are lossy, which is a tradeoff to reduce the needed storage space and the transmission bandwidth.
The useful information of a picture being encoded (referred to as a “current picture”) include changes with respect to a reference picture (e.g., a picture previously encoded and reconstructed). Such changes can include position changes, luminosity changes, or color changes of the pixels, among which the position changes are mostly concerned. Position changes of a group of pixels that represent an object can reflect the motion of the object between the reference picture and the current picture.
A picture coded without referencing another picture (i.e., it is its own reference picture) is referred to as an “I-picture.” A picture is referred to as a “P-picture” if some or all blocks (e.g., blocks that generally refer to portions of the video picture) in the picture are predicted using intra prediction or inter prediction with one reference picture (e.g., uni-prediction). A picture is referred to as a “B-picture” if at least one block in it is predicted with two reference pictures (e.g., bi-prediction).
As shown in
Typically, video codecs do not encode or decode an entire picture at one time due to the computing complexity of such tasks. Rather, they can split the picture into basic segments, and encode or decode the picture segment by segment. Such basic segments are referred to as basic processing units (“BPUs”) in the present disclosure. For example, structure 110 in
The basic processing units can be logical units, which can include a group of different types of video data stored in a computer memory (e.g., in a video frame buffer). For example, a basic processing unit of a color picture can include a luma component (Y) representing achromatic brightness information, one or more chroma components (e.g., Cb and Cr) representing color information, and associated syntax elements, in which the luma and chroma components can have the same size of the basic processing unit. The luma and chroma components can be referred to as “coding tree blocks” (“CTBs”) in some video coding standards (e.g., H.265/HEVC, H.266/VVC or AVS). Any operation performed to a basic processing unit can be repeatedly performed to each of its luma and chroma components.
Video coding has multiple stages of operations, examples of which are shown in
For example, at a mode decision stage (an example of which is shown in
For another example, at a prediction stage (an example of which is shown in
For another example, at a transform stage (an example of which is shown in
In structure 110 of
In some implementations, to provide the capability of parallel processing and error resilience to video encoding and decoding, a picture can be divided into regions for processing, such that, for a region of the picture, the encoding or decoding process can depend on no information from any other region of the picture. In other words, each region of the picture can be processed independently. By doing so, the codec can process different regions of a picture in parallel, thus increasing the coding efficiency. Also, when data of a region is corrupted in the processing or lost in network transmission, the codec can correctly encode or decode other regions of the same picture without reliance on the corrupted or lost data, thus providing the capability of error resilience. In some video coding standards, a picture can be divided into different types of regions. For example, H.265/HEVC, H.266/VVC and AVS provide two types of regions: “slices” and “tiles.” It should also be noted that different pictures of video sequence 100 can have different partition schemes for dividing a picture into regions.
For example, in
In
The encoder can perform process 200A iteratively to encode each original BPU of the original picture (in the forward path) and generate predicted reference 224 for encoding the next original BPU of the original picture (in the reconstruction path). After encoding all original BPUs of the original picture, the encoder can proceed to encode the next picture in video sequence 202.
Referring to process 200A, the encoder can receive video sequence 202 generated by a video capturing device (e.g., a camera). The term “receive” used herein can refer to receiving, inputting, acquiring, retrieving, obtaining, reading, accessing, or any action in any manner for inputting data.
At prediction stage 204, at a current iteration, the encoder can receive an original BPU and prediction reference 224 and perform a prediction operation to generate prediction data 206 and predicted BPU 208. Prediction reference 224 can be generated from the reconstruction path of the previous iteration of process 200A. The purpose of prediction stage 204 is to reduce information redundancy by extracting prediction data 206 that can be used to reconstruct the original BPU as predicted BPU 208 from prediction data 206 and prediction reference 224.
Ideally, predicted BPU 208 can be identical to the original BPU. However, due to non-ideal prediction and reconstruction operations, predicted BPU 208 is generally slightly different from the original BPU. For recording such differences, after generating predicted BPU 208, the encoder can subtract it from the original BPU to generate residual BPU 210. For example, the encoder can subtract values (e.g., greyscale values or RGB values) of pixels of predicted BPU 208 from values of corresponding pixels of the original BPU. Each pixel of residual BPU 210 can have a residual value as a result of such subtraction between the corresponding pixels of the original BPU and predicted BPU 208. Compared with the original BPU, prediction data 206 and residual BPU 210 can have fewer bits, but they can be used to reconstruct the original BPU without significant quality deterioration. Thus, the original BPU is compressed.
To further compress residual BPU 210, at transform stage 212, the encoder can reduce spatial redundancy of residual BPU 210 by decomposing it into a set of two-dimensional “base patterns,” each base pattern being associated with a “transform coefficient.” The base patterns can have the same size (e.g., the size of residual BPU 210). Each base pattern can represent a variation frequency (e.g., frequency of brightness variation) component of residual BPU 210. None of the base patterns can be reproduced from any combinations (e.g., linear combinations) of any other base patterns. In other words, the decomposition can decompose variations of residual BPU 210 into a frequency domain. Such a decomposition is analogous to a discrete Fourier transform of a function, in which the base patterns are analogous to the base functions (e.g., trigonometry functions) of the discrete Fourier transform, and the transform coefficients are analogous to the coefficients associated with the base functions.
Different transform algorithms can use different base patterns. Various transform algorithms can be used at transform stage 212, such as, for example, a discrete cosine transform, a discrete sine transform, or the like. The transform at transform stage 212 is invertible. That is, the encoder can restore residual BPU 210 by an inverse operation of the transform (referred to as an “inverse transform”). For example, to restore a pixel of residual BPU 210, the inverse transform can be multiplying values of corresponding pixels of the base patterns by respective associated coefficients and adding the products to produce a weighted sum. For a video coding standard, both the encoder and decoder can use the same transform algorithm (thus the same base patterns). Thus, the encoder can record only the transform coefficients, from which the decoder can reconstruct residual BPU 210 without receiving the base patterns from the encoder. Compared with residual BPU 210, the transform coefficients can have fewer bits, but they can be used to reconstruct residual BPU 210 without significant quality deterioration. Thus, residual BPU 210 is further compressed.
The encoder can further compress the transform coefficients at quantization stage 214. In the transform process, different base patterns can represent different variation frequencies (e.g., brightness variation frequencies). Because human eyes are generally better at recognizing low-frequency variation, the encoder can disregard information of high-frequency variation without causing significant quality deterioration in decoding. For example, at quantization stage 214, the encoder can generate quantized transform coefficients 216 by dividing each transform coefficient by an integer value (referred to as a “quantization scale factor”) and rounding the quotient to its nearest integer. After such an operation, some transform coefficients of the high-frequency base patterns can be converted to zero, and the transform coefficients of the low-frequency base patterns can be converted to smaller integers. The encoder can disregard the zero-value quantized transform coefficients 216, by which the transform coefficients are further compressed. The quantization process is also invertible, in which quantized transform coefficients 216 can be reconstructed to the transform coefficients in an inverse operation of the quantization (referred to as “inverse quantization”).
Because the encoder disregards the remainders of such divisions in the rounding operation, quantization stage 214 can be lossy. Typically, quantization stage 214 can contribute the most information loss in process 200A. The larger the information loss is, the fewer bits the quantized transform coefficients 216 can need. For obtaining different levels of information loss, the encoder can use different values of the quantization parameter or any other parameter of the quantization process.
At binary coding stage 226, the encoder can encode prediction data 206 and quantized transform coefficients 216 using a binary coding technique, such as, for example, entropy coding, variable length coding, arithmetic coding, Huffman coding, context-adaptive binary arithmetic coding, or any other lossless or lossy compression algorithm. In some embodiments, besides prediction data 206 and quantized transform coefficients 216, the encoder can encode other information at binary coding stage 226, such as, for example, a prediction mode used at prediction stage 204, parameters of the prediction operation, a transform type at transform stage 212, parameters of the quantization process (e.g., quantization parameters), an encoder control parameter (e.g., a bitrate control parameter), or the like. The encoder can use the output data of binary coding stage 226 to generate video bitstream 228. In some embodiments, video bitstream 228 can be further packetized for network transmission.
Referring to the reconstruction path of process 200A, at inverse quantization stage 218, the encoder can perform inverse quantization on quantized transform coefficients 216 to generate reconstructed transform coefficients. At inverse transform stage 220, the encoder can generate reconstructed residual BPU 222 based on the reconstructed transform coefficients. The encoder can add reconstructed residual BPU 222 to predicted BPU 208 to generate prediction reference 224 that is to be used in the next iteration of process 200A.
It should be noted that other variations of the process 200A can be used to encode video sequence 202. In some embodiments, stages of process 200A can be performed by the encoder in different orders. In some embodiments, one or more stages of process 200A can be combined into a single stage. In some embodiments, a single stage of process 200A can be divided into multiple stages. For example, transform stage 212 and quantization stage 214 can be combined into a single stage. In some embodiments, process 200A can include additional stages. In some embodiments, process 200A can omit one or more stages in
Generally, prediction techniques can be categorized into two types: spatial prediction and temporal prediction. Spatial prediction (e.g., an intra-picture prediction or “intra prediction”) can use pixels from one or more already coded neighboring BPUs in the same picture to predict the current BPU. That is, prediction reference 224 in the spatial prediction can include the neighboring BPUs. The spatial prediction can reduce the inherent spatial redundancy of the picture. Temporal prediction (e.g., an inter-picture prediction or “inter prediction”) can use regions from one or more already coded pictures to predict the current BPU. That is, prediction reference 224 in the temporal prediction can include the coded pictures. The temporal prediction can reduce the inherent temporal redundancy of the pictures.
Referring to process 200B, in the forward path, the encoder performs the prediction operation at spatial prediction stage 2042 and temporal prediction stage 2044. For example, at spatial prediction stage 2042, the encoder can perform the intra prediction. For an original BPU of a picture being encoded, prediction reference 224 can include one or more neighboring BPUs that have been encoded (in the forward path) and reconstructed (in the reconstructed path) in the same picture. The encoder can generate predicted BPU 208 by extrapolating the neighboring BPUs. The extrapolation technique can include, for example, a linear extrapolation or interpolation, a polynomial extrapolation or interpolation, or the like. In some embodiments, the encoder can perform the extrapolation at the pixel level, such as by extrapolating values of corresponding pixels for each pixel of predicted BPU 208. The neighboring BPUs used for extrapolation can be located with respect to the original BPU from various directions, such as in a vertical direction (e.g., on top of the original BPU), a horizontal direction (e.g., to the left of the original BPU), a diagonal direction (e.g., to the down-left, down-right, up-left, or up-right of the original BPU), or any direction defined in the used video coding standard. For the intra prediction, prediction data 206 can include, for example, locations (e.g., coordinates) of the used neighboring BPUs, sizes of the used neighboring BPUs, parameters of the extrapolation, a direction of the used neighboring BPUs with respect to the original BPU, or the like.
For another example, at temporal prediction stage 2044, the encoder can perform the inter prediction. For an original BPU of a current picture, prediction reference 224 can include one or more pictures (referred to as “reference pictures”) that have been encoded (in the forward path) and reconstructed (in the reconstructed path). In some embodiments, a reference picture can be encoded and reconstructed BPU by BPU. For example, the encoder can add reconstructed residual BPU 222 to predicted BPU 208 to generate a reconstructed BPU. When all reconstructed BPUs of the same picture are generated, the encoder can generate a reconstructed picture as a reference picture. The encoder can perform an operation of “motion estimation” to search for a matching region in a scope (referred to as a “search window”) of the reference picture. The location of the search window in the reference picture can be determined based on the location of the original BPU in the current picture. For example, the search window can be centered at a location having the same coordinates in the reference picture as the original BPU in the current picture and can be extended out for a predetermined distance. When the encoder identifies (e.g., by using a pel-recursive algorithm, a block-matching algorithm, or the like) a region similar to the original BPU in the search window, the encoder can determine such a region as the matching region. The matching region can have different dimensions (e.g., being smaller than, equal to, larger than, or in a different shape) from the original BPU. Because the reference picture and the current picture are temporally separated in the timeline (e.g., as shown in
The motion estimation can be used to identify various types of motions, such as, for example, translations, rotations, zooming, or the like. For inter prediction, prediction data 206 can include, for example, locations (e.g., coordinates) of the matching region, the motion vectors associated with the matching region, the number of reference pictures, weights associated with the reference pictures, or the like.
For generating predicted BPU 208, the encoder can perform an operation of “motion compensation.” The motion compensation can be used to reconstruct predicted BPU 208 based on prediction data 206 (e.g., the motion vector) and prediction reference 224. For example, the encoder can move the matching region of the reference picture according to the motion vector, in which the encoder can predict the original BPU of the current picture. When multiple reference pictures are used (e.g., as picture 106 in
In some embodiments, the inter prediction can be unidirectional or bidirectional. Unidirectional inter predictions can use one or more reference pictures in the same temporal direction with respect to the current picture. For example, picture 104 in
Still referring to the forward path of process 200B, after spatial prediction 2042 and temporal prediction stage 2044, at mode decision stage 230, the encoder can select a prediction mode (e.g., one of the intra prediction or the inter prediction) for the current iteration of process 200B. For example, the encoder can perform a rate-distortion optimization technique, in which the encoder can select a prediction mode to minimize a value of a cost function depending on a bit rate of a candidate prediction mode and distortion of the reconstructed reference picture under the candidate prediction mode. Depending on the selected prediction mode, the encoder can generate the corresponding predicted BPU 208 and predicted data 206.
In the reconstruction path of process 200B, if intra prediction mode has been selected in the forward path, after generating prediction reference 224 (e.g., the current BPU that has been encoded and reconstructed in the current picture), the encoder can directly feed prediction reference 224 to spatial prediction stage 2042 for later usage (e.g., for extrapolation of a next BPU of the current picture). The encoder can feed prediction reference 224 to loop filter stage 232, at which the encoder can apply a loop filter to prediction reference 224 to reduce or eliminate distortion (e.g., blocking artifacts) introduced during coding of the prediction reference 224. The encoder can apply various loop filter techniques at loop filter stage 232, such as, for example, deblocking, sample adaptive offsets, adaptive loop filters, or the like. The loop-filtered reference picture can be stored in buffer 234 (or “decoded picture buffer”) for later use (e.g., to be used as an inter-prediction reference picture for a future picture of video sequence 202). The encoder can store one or more reference pictures in buffer 234 to be used at temporal prediction stage 2044. In some embodiments, the encoder can encode parameters of the loop filter (e.g., a loop filter strength) at binary coding stage 226, along with quantized transform coefficients 216, prediction data 206, and other information.
In
The decoder can perform process 300A iteratively to decode each encoded BPU of the encoded picture and generate predicted reference 224 for encoding the next encoded BPU of the encoded picture. After decoding all encoded BPUs of the encoded picture, the decoder can output the picture to video stream 304 for display and proceed to decode the next encoded picture in video bitstream 228.
At binary decoding stage 302, the decoder can perform an inverse operation of the binary coding technique used by the encoder (e.g., entropy coding, variable length coding, arithmetic coding, Huffman coding, context-adaptive binary arithmetic coding, or any other lossless compression algorithm). In some embodiments, besides prediction data 206 and quantized transform coefficients 216, the decoder can decode other information at binary decoding stage 302, such as, for example, a prediction mode, parameters of the prediction operation, a transform type, parameters of the quantization process (e.g., quantization parameters), an encoder control parameter (e.g., a bitrate control parameter), or the like. In some embodiments, if video bitstream 228 is transmitted over a network in packets, the decoder can depacketize video bitstream 228 before feeding it to binary decoding stage 302.
In process 300B, for an encoded basic processing unit (referred to as a “current BPU”) of an encoded picture (referred to as a “current picture”) that is being decoded, prediction data 206 decoded from binary decoding stage 302 by the decoder can include various types of data, depending on what prediction mode was used to encode the current BPU by the encoder. For example, if intra prediction was used by the encoder to encode the current BPU, prediction data 206 can include a prediction mode indicator (e.g., a flag value) indicative of the intra prediction, parameters of the intra prediction operation, or the like. The parameters of the intra prediction operation can include, for example, locations (e.g., coordinates) of one or more neighboring BPUs used as a reference, sizes of the neighboring BPUs, parameters of extrapolation, a direction of the neighboring BPUs with respect to the original BPU, or the like. For another example, if inter prediction was used by the encoder to encode the current BPU, prediction data 206 can include a prediction mode indicator (e.g., a flag value) indicative of the inter prediction, parameters of the inter prediction operation, or the like. The parameters of the inter prediction operation can include, for example, the number of reference pictures associated with the current BPU, weights respectively associated with the reference pictures, locations (e.g., coordinates) of one or more matching regions in the respective reference pictures, one or more motion vectors respectively associated with the matching regions, or the like.
Based on the prediction mode indicator, the decoder can decide whether to perform a spatial prediction (e.g., the intra prediction) at spatial prediction stage 2042 or a temporal prediction (e.g., the inter prediction) at temporal prediction stage 2044. The details of performing such spatial prediction or temporal prediction are described in
In process 300B, the decoder can feed predicted reference 224 to spatial prediction stage 2042 or temporal prediction stage 2044 for performing a prediction operation in the next iteration of process 300B. For example, if the current BPU is decoded using the intra prediction at spatial prediction stage 2042, after generating prediction reference 224 (e.g., the decoded current BPU), the decoder can directly feed prediction reference 224 to spatial prediction stage 2042 for later usage (e.g., for extrapolation of a next BPU of the current picture). If the current BPU is decoded using the inter prediction at temporal prediction stage 2044, after generating prediction reference 224 (e.g., a reference picture in which all BPUs have been decoded), the decoder can feed prediction reference 224 to loop filter stage 232 to reduce or eliminate distortion (e.g., blocking artifacts). The decoder can apply a loop filter to prediction reference 224, in a way as described in
Apparatus 400 can also include memory 404 configured to store data (e.g., a set of instructions, computer codes, intermediate data, or the like). For example, as shown in
Bus 410 can be a communication device that transfers data between components inside apparatus 400, such as an internal bus (e.g., a CPU-memory bus), an external bus (e.g., a universal serial bus port, a peripheral component interconnect express port), or the like.
For ease of explanation without causing ambiguity, processor 402 and other data processing circuits are collectively referred to as a “data processing circuit” in this disclosure. The data processing circuit can be implemented entirely as hardware, or as a combination of software, hardware, or firmware. In addition, the data processing circuit can be a single independent module or can be combined entirely or partially into any other component of apparatus 400.
Apparatus 400 can further include network interface 406 to provide wired or wireless communication with a network (e.g., the Internet, an intranet, a local area network, a mobile communications network, or the like). In some embodiments, network interface 406 can include any combination of any number of a network interface controller (NIC), a radio frequency (RF) module, a transponder, a transceiver, a modem, a router, a gateway, a wired network adapter, a wireless network adapter, a Bluetooth adapter, an infrared adapter, a near-field communication (“NFC”) adapter, a cellular network chip, or the like.
In some embodiments, optionally, apparatus 400 can further include peripheral interface 408 to provide a connection to one or more peripheral devices. As shown in
It should be noted that video codecs (e.g., a codec performing process 200A, 200B, 300A, or 300B) can be implemented as any combination of any software or hardware modules in apparatus 400. For example, some or all stages of process 200A, 200B, 300A, or 300B can be implemented as one or more software modules of apparatus 400, such as program instructions that can be loaded into memory 404. For another example, some or all stages of process 200A, 200B, 300A, or 300B can be implemented as one or more hardware modules of apparatus 400, such as a specialized data processing circuit (e.g., an FPGA, an ASIC, an NPU, or the like).
The bi-directional optical flow (BDOF) tool was adopted in VVC standard. BDOF, previously referred to as bi-directional optical flow, was proposed to improve the inter prediction accuracy based on optical flow, and it was first adopted in JEM software. Compared to the JEM version, the BDOF in VVC is a simpler version that requires much less computation, especially in terms of number of multiplications and the size of the multiplier.
In VVC, BDOF is used to refine the bi-prediction signal of a CU at the 4×4 subblock level. BDOF is applied to a CU if it satisfies all the following conditions:
BDOF is only applied to the luma component. As its name indicates, the BDOF mode is based on the optical flow concept, which assumes that the motion of an object is smooth. For each 4×4 subblock, a motion refinement (vx, vy) is calculated by minimizing the difference between the L0 and L1 prediction samples. The motion refinement is then used to adjust the bi-predicted sample values in the 4×4 subblock. The following steps are applied in the BDOF process.
First, the horizontal and vertical gradients,
k=0,1, of the two prediction signals are computed by directly calculating the difference between two neighboring samples, i.e.,
where I(k)(i,j) are the sample value at coordinate (i,j) of the prediction signal in list k, k=0,1, and shift1 is calculated based on the luma bit depth, bitDepth, as shift1=max (6, bitDepth−6).
Then, the auto- and cross-correlation of the gradients, S1, S2, S3, S5 and S6, are calculated as
where Ω is a 6×6 window around the 4×4 subblock, and the values of na and nb are set equal to min(1, bitDepth−11) and min(4, bitDepth−8), respectively, wherein min(x, y) is a function to get the smaller one of x and y.
The motion refinement (vx, vy) is then derived using the cross- and auto-correlation terms using the following:
where
└·┘ is the floor function, and nS
Based on the motion refinement and the gradients, the following adjustment is calculated for each sample in the 4×4 subblock:
Finally, the BDOF samples of the CU are calculated by adjusting the bi-prediction samples as follows:
These values are selected such that the multipliers in the BDOF process do not exceed 15-bit, and the maximum bit-width of the intermediate parameters in the BDOF process is kept within 32-bit.
In order to derive the gradient values, some prediction samples I(k)(i,j) in list k (k=0,1) outside of the current CU boundaries need to be generated. As depicted in
When the width or height of a CU is larger than 16 luma samples, it will be split into subblocks with width or height equal to 16 luma samples, and the subblock boundaries are treated as the CU boundaries in the BDOF process. The maximum unit size for BDOF process is limited to 16×16. For each subblock, the BDOF process could skipped. When the SAD of between the initial L0 and L1 prediction samples is smaller than a threshold, the BDOF process is not applied to the subblock. The threshold is set equal to (8*W*(H>>1), where W indicates the subblock width, and H indicates subblock height. To avoid the additional complexity of SAD calculation, the SAD between the initial L0 and L1 prediction samples calculated in DMVR process is re-used here.
If BCW is enabled for the current block, i.e., the BCW weight index indicates unequal weight, then bi-directional optical flow is disabled. Similarly, if WP is enabled for the current block, i.e., the luma_weight_1x_flag is 1 for either of the two reference pictures, then BDOF is also disabled. When a CU is coded with symmetric MVD mode or CIIP mode, BDOF is also disabled.
In ECM, to further improve the coding performance, a sample-based BDOF is adopted. In the sample-based BDOF, instead of deriving motion refinement (vx, vy) on a block basis, it is performed per sample.
Besides the sample level motion refinement calculation, for the samples out of the CU boundaries, the true sample values instead of padded values are used. Thus, the decoder needs to fetch and interpolate a sample area larger than the current CU for gradient calculation. Similarly, as the true sample value is used for out-boundary samples, there is no need to split the CU into 16×16 subblock for boundary padding.
For threshold checking, the coding block is divided into 8×8 subblocks. For each subblock, whether to apply BDOF or not is determined by checking the SAD between the two reference subblocks against a threshold. If decided to apply BDOF to a subblock, for every sample in the subblock, a sliding 5×5 window is used and the existing BDOF process is applied for every sliding window to derive vx and vy. The derived motion refinement (vx, vy) is applied to adjust the bi-predicted sample value for the center sample of the window.
As the 8-tap interpolation filter used in VVC is replaced with a 12-tap filter, BDOF also use the 12-tap interpolation filter to generate the predicted samples.
Next, high precision BDOF is described. To improve the precision of motion refinement calculation, the following equations are used to replace equations (4).
First, the horizontal and vertical gradients,
k=0,1, of the two prediction signals are computed by directly calculating the difference between two neighboring samples, i.e.,
where I(k)(i,j) are the sample value at coordinate (i,j) of the prediction signal in list k, k=0,1, and shift1 is calculated based on the luma bit depth.
Then, the auto- and cross-correlation of the gradients, S1, S2, S3, S4, S5 and S6, are calculated as
where wij is a position dependent weight with position (i,j) closer to the current sample, the value of wij being greater, and Ω is a 5×5 window around the current sample, and the values of na and nb are set equal to min(1, bitDepth−11) and min(4, bitDepth−8), respectively, where min(x, y) is a function to get the smaller one of x and y.
In some implementations, regulation is applied by adding an offset to S1 and S5 before the derivation of motion refinement (vx, vy). The regulation can be expressed as:
wherein d is the offset whose value could be dependent on the subblock size.
The motion refinement (vx, vy) is then derived using the cross- and auto-correlation terms using the following:
Based on the motion refinement and the gradients, the following adjustment is calculated for each sample
Finally, the BDOF samples of the CU are calculated by adjusting the bi-prediction samples as follows:
Next, the decoder-side motion vector refinement (DMVR) is described. VVC adopts a bilateral-matching (BM) based decoder side motion vector refinement in bi-prediction operation to increase the accuracy of the MVs of the merge mode. In DMVR, a refined MV is searched around the initial MVs in the reference picture list L0 and reference picture list L1. The BM method calculates the distortion between the two candidate blocks in the reference picture list L0 and list L1. As illustrated in
In VVC, the application of DMVR is restricted and is only applied for the CUS which are coded with following modes and features:
The refined MV derived by DMVR process is used to generate the inter prediction samples and also used in temporal motion vector prediction for future pictures coding. While the original MV is used in deblocking process and also used in spatial motion vector prediction for future CU coding.
The additional features of DMVR are mentioned in the following sub-clauses.
Next, the searching scheme used in DMVR is described. In DMVR, the search points are surrounding the initial MV and the MV offset obey the MV difference mirroring rule. In other words, any points that are checked by DMVR, denoted by candidate MV pair (MV0, MV1) obey the following two equations:
where MV_offset represents the refinement offset between the initial MV and the refined MV in one of the reference pictures. The refinement search range is two integer luma samples from the initial MV. The searching includes the integer sample offset search stage and fractional sample refinement stage.
25 points full search is applied for integer sample offset searching. The SAD of the initial MV pair is first calculated. If the SAD of the initial MV pair is smaller than a threshold, the integer sample stage of DMVR is terminated. Otherwise SADs of the remaining 24 points are calculated and checked in raster scanning order. The point with the smallest SAD is selected as the output of integer sample offset searching stage. To reduce the penalty of the uncertainty of DMVR refinement, it is proposed to favor the original MV during the DMVR process. The SAD between the reference blocks referred by the initial MV candidates is decreased by ¼ of the SAD value.
The integer sample search is followed by fractional sample refinement. To save the calculational complexity, the fractional sample refinement is derived by using parametric error surface equation, instead of additional search with SAD comparison. The fractional sample refinement is conditionally invoked based on the output of the integer sample search stage. When the integer sample search stage is terminated with center having the smallest SAD in either the first iteration or the second iteration search, the fractional sample refinement is further applied.
In parametric error surface based sub-pixel offsets estimation, the center position cost and the costs at four neighboring positions from the center are used to fit a 2-D parabolic error surface equation of the following form:
where (xmin, ymin) corresponds to the fractional position with the least cost and C corresponds to the minimum cost value. By solving the above equations by using the cost value of the five search points, the (xmin, ymin) is computed as:
The value of xmin and ymin are automatically constrained to be between −8 and 8 since all cost values are positive and the smallest value is E(0,0). This corresponds to half peal offset with 1/16th-pel MV accuracy in VVC. The computed fractional (xmin,ymin) are added to the integer distance refinement MV to get the sub-pixel accurate refinement delta MV.
Next, bilinear-interpolation and sample padding are described. In VVC, the resolution of the MVs is 1/16 luma samples. The samples at the fractional position are interpolated using an 8-tap interpolation filter. In DMVR, the search points are surrounding the initial fractional-pel MV with integer sample offset, therefore the samples of those fractional position need to be interpolated for DMVR search process. To reduce the calculation complexity, the bi-linear interpolation filter is used to generate the fractional samples for the searching process in DMVR. Another important effect is that by using bi-linear filter is that with 2-sample search range, the DMVR does not access more reference samples compared to the normal motion compensation process. After the refined MV is attained with DMVR search process, the normal 8-tap interpolation filter is applied to generate the final prediction. In order to not access more reference samples to normal MC process, the samples, which is not needed for the interpolation process based on the original MV but is needed for the interpolation process based on the refined MV, will be padded from those available samples.
Next, the maximum DMVR processing unit is described. When the width or height of a CU are larger than 16 luma samples, it will be further split into subblocks with width or height equal to 16 luma samples. The maximum unit size for DMVR searching process is limit to 16×16.
Next, the multi-pass decoder-side motion vector refinement (MP-DMVR) is described. In ECM, to further improve the coding efficiency, a multi-pass decoder-side motion vector refinement is applied. In the first pass, bilateral matching (BM) is applied to the coding block. In the second pass, BM is applied to each 16×16 subblock within the coding block. In the third pass, MV in each 8×8 subblock is refined by applying bi-directional optical flow (BDOF). The refined MVs are stored for both spatial and temporal motion vector prediction.
In the first pass, block based bilateral matching MV refinement is performed. In the first pass, a refined MV is derived by applying BM to a coding block. Similar to decoder-side motion vector refinement (DMVR), in bi-prediction operation, a refined MV is searched around the two initial MVs (MV0 and MV1) in the reference picture lists L0 and L1. The refined MVs (MV0_pass1 and MV1_pass1) are derived around the initiate MVs based on the minimum bilateral matching cost between the two reference blocks in L0 and L1.
BM performs local search to derive integer sample precision intDeltaMV. The local search applies a 3×3 square search pattern to loop through the search range [−sHor, sHor] in horizontal direction and [−sVer, sVer] in vertical direction, wherein, the values of sHor and sVer are determined by the block dimension, and the maximum value of sHor and sVer is 8 or other values. For example, as in
The bilateral matching cost is calculated as: bilCost=mvDistanceCost+sadCost, wherein sadCost is the SAD between l0 predictor and l1 predictor on each search point and mvDistanceCost is based on intDeltaMV (i.e., the distance between the search point and the initial position). When the block size cbW*cbH is greater than 64, MRSAD cost function is applied to remove the DC effect of distortion between reference blocks. When the bilCost at the center point of the 3×3 search pattern has the minimum cost, the intDeltaMV local search is terminated. Otherwise, the current minimum cost search point becomes the new center point of the 3×3 search pattern and continue to search for the minimum cost, until it reaches the end of the search range.
The existing fractional sample refinement is further applied to derive the final deltaMV. The refined MVs after the first pass is then derived as:
In the second pass, subblock based bilateral matching MV refinement is performed. In the second pass, a refined MV is derived by applying BM to a 16×16 grid subblock. For each subblock, a refined MV is searched around the two MVs (MV0_pass1 and MV1_pass1), obtained on the first pass, in the reference picture list L0 and L1. The refined MVs (MV0_pass2 (sbIdx2) and MV1_pass2 (sbIdx2)) are derived based on the minimum bilateral matching cost between the two reference subblocks in L0 and L1.
For each subblock, BM performs full search to derive integer sample precision intDeltaMV (sbIdx2). The full search has a search range [−sHor, sHor] in horizontal direction and [−sVer, sVer] in vertical direction, wherein, the values of sHor and sVer are determined by the block dimension, and the maximum value of sHor and sVer is 8 or other values.
The bilateral matching cost is calculated by applying a cost factor to the SATD cost between two reference subblocks, as: bilCost=satdCost*costFactor. The search area (2*sHor+1)*(2*sVer+1) is divided up to 5 diamond shape search regions shown on
The existing VVC DMVR fractional sample refinement is further applied to derive the final deltaMV (sbIdx2). The refined MVs at second pass is then derived as:
where sbIdx2 is the subblock index for second pass of multi-pass DMVR
In the third pass, subblock based bi-directional optical flow MV refinement is performed. In the third pass, a refined MV is derived by applying BDOF to an 8×8 grid subblock. For each 8×8 subblock, BDOF refinement process is applied to derive motion refinement (vx, vy) without clipping starting from the refined MV of the parent subblock of the second pass. The method described above can be used. For example, equations (1) to (4) or equations (7) to (10) are invoked to derive (vx, vy), denoted as bioMV. After motion refinement derivation, bioMV is rounded to 1/16 sample precision and clipped between −32 and 32.
The refined MVs (MV0_pass3 (sbIdx3) and MV1_pass3 (sbIdx3)) at third pass are derived as:
where sbIdx2 is the subblock index for the second pass of multi-pass DMVR and sbIdx3 is the subblock index for the third pass of multi-pass DMVR.
Next, adaptive decoder-side motion vector refinement is described. In ECM, adaptive decoder side motion vector refinement method is an extension of multi-pass DMVR which consists of the two new merge modes to refine MV only in one direction, either L0 or L1, of the bi prediction for the merge candidates that meet the DMVR conditions. The multi-pass DMVR process is applied for the selected merge candidate to refine the motion vectors, however either MVD0 or MVD1 is set to zero in the 1st pass (i.e., PU level) DMVR. Thus, a new merge candidate list is constructed for adaptive decoder-side motion vector refinement. And the new merge mode for the new merge candidate list is called BM merge in ECM.
The merge candidates for BM merge mode are derived from spatial neighboring coded blocks, TMVPs, non-adjacent blocks, history based motion vector predictors (HMVPs), pair-wise candidate, similar as in the regular merge mode. The difference is that only those meet DMVR conditions are added into the candidate list. The same merge candidate list is used by the two new merge modes. If the list of BM candidates contains the inherited BCW weights and DMVR process is unchanged except the computation of the distortion is made using MRSAD or MRSATD if the weights are non-equal and the bi-prediction is weighted with BCW weights. Merge index is coded as in regular merge mode.
In the current multi-pass DMVR, the first pass and second pass are based on bilateral matching. CU level bilateral matching is performed in the first pass and it is followed by subblock level bilateral matching in the second pass. CU level bilateral matching refines the motion vector at a coarse level and subblock level bilateral matching refines the motion vector at a finer level. However, for the third pass of multi-pass DMVR which is based on optical flow, the refinement grid is fixed and there is only one pass for it. A smaller subblock level refinement gives a finer refinement, while a bigger subblock level refinement gives greater ability of error resilience and thus leads to more stable results in the optical flow calculation. Thus, only one pass of optical flow-based refinement on the fixed grid cannot achieve an accurate and stable results. Moreover, depending on the different video content, the best subblock size for motion vector refinement varies. For example, smooth content may prefer refinement on big subblock and sophisticated content may need small block level refinement. So, motion vector refinement on a fixed grid cannot fit for all the video contents.
The present disclosure provides methods for solving the above problems. In particular, it is proposed to have multiple passes for optical flow-based motion vector refinement. First, dividing the CU into big subblocks and the refinement is performed on the big subblock level. After that, the big subblocks are further divided into smaller subblocks and based on the results of the first pass of the refinement, a second pass of the refinement is performed on the smaller subblock level. In this method, the first pass refinement gives a base refinement to the big subblock and then for each smaller subblock within the big subblock, a more precise motion vector refinement can be obtained through the second pass of the refinement. For the smooth video content, the first pass refinement could bring sufficient motion vector improvement and for the sophisticated video content, the second pass refinement will give more benefits. Thus, both smooth video content and sophisticated video content could gain in the proposed method.
However, the smaller subblock level refinement gives much more complexity. To reduce the complexity, after the first pass of the refinement on the big subblock level, no further subblock splitting is performed. That is, the second pass of the refinement is performed on the subblock with the same size of the first pass of the refinement. In this case, after dividing the CU into the subblocks, two passes of the refinement are performed on each subblock. The first pass of the refinement derives a first motion refinement, and based on the refined motion, the motion compensation is performed on the each subblock and the optical flow based refinement is performed again to find a second motion refinement. The final refined motion is obtained by adding first and second motion refinement.
At step 910, the processor performs coding block level bilateral matching. The block level bilateral matching is performed on a coding block, and can be the first pass in the above-described multi-pass decoder-side motion vector refinement (MP-DMVR) process.
At step 920, the processor divides the coding block into N×N subblocks and performs subblock level bilateral matching. This step can be the second pass of the above-described MP-DMVR. For example, the coding block may have a size of 64×64, and the processor may divide the coding block into a grid of 16×16 subblocks. The processor may then apply the bilateral matching to the plurality of 16×16 subblocks.
At step 930, the processor divides the coding block into L×Z subblocks and performs optical flow-based motion vector refinement on the L×L subblocks. This step can be the third pass of the above-described MP-DMVR—the subblock-level bi-directional optical flow (BDOF) motion vector refinement process. For example, the coding block may have a size of 64×64, and the processor may divide the coding block into a grid of 16×16 or 8×8 subblocks. The processor may then apply the BDOF motion vector refinement process to the plurality of 16×16 or 8×8 subblocks.
At step 940, the processor divides the coding block into M×M subblocks and performs optical flow-based motion vector refinement on the M×M subblocks. Consistent with the disclosed embodiments, the processor may repeat the third pass of the above-described MP-DMVR multiple times, on different sized subblocks. Specifically, at step 940, each of the M×M subblocks is made smaller than each of the L×Z subblocks, i.e., L>M. For example, the L×L subblocks may be 8×8 subblocks, while the M×M subblocks may be 4×4 or 2×2 subblocks.
At step 950, the processor performs motion compensation with sample based bi-direction optical flow.
Although method 900 performs the BDOF motion vector refinement process twice (i.e., performs the third pass of the MP-DMVR twice), it is contemplated that the disclosed embodiments can perform this process in any number of passes, each pass on different sized subblocks. For example, method 900 may be modified to include an additional step 942 (not shown in
As shown in
Additionally, in some embodiments, adaptive subblock size can be used for optical flow-based motion vector refinement. For example,
Specifically, step 1110 is the same as steps 910 and 1010, and step 1120 is the same as steps 920 and 1020, the details of which are not repeated herein.
At step 1130, the processor checks the subblock size (resulted from step 1120) against a condition. If the condition is satisfied, the processor performs the optical flow-based motion vector refinement at a large subblock level, e.g., L×L subblocks (step 1140); and if the condition is not satisfied, the processor performs the optical flow-based motion vector refinement at a small subblock level, e.g., M×M subblocks (step 1150). In the disclosed embodiments, the condition can be based on the area of the coding block, the quantization parameters, or video resolution. For example, the condition may be one of: the coding block is coded using a bi-prediction mode; the coding block has a size exceeding a predetermined threshold; the coding block has a size less than a predetermined threshold; weighted prediction is disabled for the coding block; combined inter and intra (CIIP) is disabled for the coding block; local luma compensation is enabled for the coding block; subblock motion compensation is applied for the coding block; symmetrical motion vector difference is not used; or the coding block is not coded as merge mode with motion vector difference.
Additionally, at step 1160, the processor performs motion compensation with sample based bi-direction optical flow. Step 1160 is the same as steps 950 and 1050.
The algorithm for implementing the disclosed optical flow-based motion refinement method is described below in detail. Specifically, in some embodiments, after the second pass of multi-pass DMVR, the refined motion vectors MV0pass2 and MV1pass2 are obtained for each 16×16 subblock, where MV0pass2 is a motion vector of reference picture list0 and MV1pass2 is a motion vector of reference picture list1. Then, based on refined motion vector MV0pass2 and MV1pass2, inter prediction is performed and Pred0_sb16ext and Pred1_sb16ext are obtained, where Pred0_sb16ext is predicted block from reference picture list0 by using MV0pass2 and Pred1_sb16ext is predicted block from reference picture list1 by using MV1pass2. In the inter prediction, interpolation filter could be applied to generate the predicted pixel values on the sub-pel positions. The 8-tap, 12-tap or other interpolation filters can be used. As gradients are needed in optical flow equations, so the predicted block is extended. In this example, shown as
After the two predicted blocks are obtained. Then for each 8×8 subblock in the 16×16 subblock, the optical flow-based motion vector refinement method can be applied. For example, equations (1) to (4) or equations (7) to (11) are used to derive motion refinement MVfirstPass=(vx_firstPass, vy_firstPass) for the first pass. Similar with the current BDOF, SAD or SATD between Pred0_sb8 and Pred1_sb8 may be calculated and compared with a threshold, where Pred0_sb8 is the predicted subblock of the current 8×8 subblock from reference picture list 0 which is a subblock of Pred0_sb16ext and Pred1_sb8 is the predicted subblock of the current 8×8 subblock from reference picture list1 which is a subblock of Pred1_sb16ext. If the SAD is less than the threshold, the refinement process is skipped for this 8×8 subblock. The threshold, for example, can be set as k×sbWidth×sbHeight, where sbWidth and sbHeight are the width and height of predicted subblock for SAD or SATD calculation and k is a positive factor. As shown in
where MV0OFpass1 and MV1OFpass1 are the motion vector refined by first pass of optical flow-based refinement for reference picture list and reference picture list1, respectively. MV0pass2 and MV1pass2 are the motion vector refined by the second bypass of multi-pass DMVR, MVfirstPass is the motion refinement derived in the first pass of optical flow-based motion refinement. sbIdx3 is the index of the subblock for the first pass of optical flow-based motion refinement. sbIdx2 is the index of the subblock for the second pass of multi-pass DMVR.
After first pass of optical flow-based motion vector refinement, for each 8×8 subblock, based on the MV0OFpass1 and MV1OFpass1, which is obtained in the first pass of optical flow-based motion refinement, two predicted blocks Pred0_sb8ext and Pred1_sb8ext are obtained by inter prediction, where Pred0_sb8ext is predicted block from reference picture list0 by using MV0OFpass1 and Pred1_sb8ext is predicted block from reference picture list1 by using MV1OFpass1. In the inter prediction, interpolation filter could be applied to generate the predicted pixel values on the sub-pel positions. The 8-tap, 12-tap or other interpolation filters can be used. As gradients are needed in optical flow equations, so the predicted block is extended. In this embodiment, shown as
After the two predicted blocks are obtained, the optical flow-based motion vector refinement method can be applied to each L×L subblock in the 8×8 subblock, where L is a positive integer number equal to or less than 8. For example, equations (1) to (4) or equations (7) to (11) are used to derive motion refinement MVsecondPass= (vx_secondPass, vy_secondPass) for the second pass of optical flow-based motion refinement. Similar with the current BDOF, SAD or SATD between Pred0_sbL and Pred1_sbL may be calculated and compared with a threshold, where Pred0_sbL is the predicted subblock of the current L×L subblock from reference picture list 0 which is a subblock of Pred0_sb8ext and Pred1_sb4 is the predicted subblock of the current L×L subblock from reference picture list 1 which is a subblock of Pred1_sb8ext. If the SAD is less than the threshold, the refinement process is skipped for this L×L subblock. The threshold, for example, can be set to k×sbWidth×sbHeight, where sbWidth and sbHeight are the width and height of predicted subblock for SAD or SATD calculation and k is a positive factor. As shown in
where MV0OFpass2 and MV1OFpass2 are the motion vector refined by second pass of optical flow-based refinement for reference picture list0 and reference picture list1, respectively. MV0OFpass1 and MV1OFpass1 are the motion vectors refined by first pass of optical flow-based refinement for reference picture list0 and reference picture list1, respectively. MVsecondPass is the motion refinement derived in the second pass of optical flow-based motion refinement. sbIdx4 is the index of the subblock for the second pass of optical flow-based motion refinement and sbIdx3 is the index of the subblock for the first pass of optical flow-based motion refinement.
The derived MV0OFpass2 and MV0OFpass1 are the final motion vectors for the current L×L subblock. After that, the existing motion compensation could be performed. Subblock based BDOF or sample based BDOF could also be used in the motion compensation.
In the above-described embodiments, the proposed multi-passes optical flow-based motion refinement follows the first two passes of multi-pass DMVR. By doing it, the multi-pass DMVR is extended to four passes. However, the proposed method is not necessarily combined with multi-pass DMVR. It can be used independently from DMVR. For a bi-predicted CU, if some conditions are satisfied, the proposed multi-pass optical flow-based motion refinement can be performed to refine the motion of the CU. Thus, the input of the proposed multi-pass optical flow base motion refinement can be the motion vector derived in merge mode which is inherited from the previous coded blocks or decoded from the bitstream. And the output of proposed multi-pass optical flow base motion refinement can be further refined by other coding tools before motion compensation. The condition of multi-pass optical flow-based motion refinement could be but limited to:
In some embodiments, the difference between two predicted blocks of the current CU, one from reference picture list 0 and the other from reference picture list 1, is calculated and based on the difference, the optical-flow based refinement is skipped. The difference can be sum of absolute differences (SAD) or sum of transformed absolute differences (SATD) of the two predicted blocks.
In one example, the number of the refinement passes is dependent on the difference between the two predicted blocks. If the difference is less than or equal to a threshold, only one pass of optical flow-based refinement is performed (the second pass of optical flow-based refinement is skipped); otherwise two passes of optical flow based refinement is performed. Or if the difference is less than or equal to a first threshold, no optical flow-based refinement is performed; if the difference is larger than the first threshold but less than or equal to a second threshold, only one pass of optical flow-based refinement is performed; if the difference is larger than the second threshold, three passes of optical flow based refinement is performed.
In another example, dependent on the difference between the two predicted blocks, the optical flow-based refinement is skipped or not. First, the two predicted blocks are interpolated by using motion vector before refinement (denoted as MV0) and the difference between these two predicted blocks are calculated, denoted as D0. If D0 is less than or equal to a first threshold, no optical flow-based refinement is performed; if D0 is larger than a threshold, the first pass of optical flow-based refinement is performed and the motion vector refined, denoted as MV1. Then another two predicted blocks are obtained by using refined motion vector MV1 and the difference between these two predicted blocks are calculated, denoted as D1, and compared with a second threshold. If D1 is less than or equal to a second threshold, the refinement process terminates; if D0 is larger than a threshold, the second pass of optical flow-based refinement is performed continually, and the motion vector is refined again.
In yet another example, whether to perform the optical flow-based refinement is decided based on the change of the difference between two predicted blocks. First, the two predicted blocks are interpolated by using motion vector before refinement (denoted as MV0) and the difference between these two predicted blocks are calculated, denoted as D0. Then the optical flow-based refinement is performed, and the motion vector is refined, denoted as MV1. Then another two predicted blocks are obtained by using refined motion vector MV1 and the difference between these two predicted blocks are calculated, denoted as D1. If D1 is larger than D0, the results of the optical flow-based refinement is reverted. That is, refined motion vector MV1 is replaced with the original motion vector MV0; if D1 is less than or equal to D0, the result of the optical flow-based refinement is kept, and the following process is performed based on the refinement motion vector MV1. In some other examples, the changes of the difference is used to decided whether to perform another pass of optical flow based refinement. If D1 is larger than D0, the refinement process terminates and refinement motion vector MV1 is output to the next stage; if D1 is less than or equal to D0, another pass of optical flow-based refinement is performed based on MV1 to get another refined motion vector MV2. So the number of the pass of the optical flow-based refinement is based on the difference of the differences between two predicted blocks before and after refinement.
Variants of the above-described embodiments can be developed to implement the disclosed optical flow-based motion refinement method. In some embodiments, there can be more than two passes of optical flow-based motion refinement for a CU. For example, the first pass is performed on 8×8 subblock level, the second pass is performed on 4×4 subblock level and the third pass is performed on 2×2 subblock level. As another example, the first pass is performed on 8×8 subblock level, the second pass is performed on 8×8 subblock and the third pass is also performed on 8×8 subblock level.
In some embodiments, the number of the passes of the optical flow-based motion refinement is dependent on the CU size, the sequence resolution or quantization parameters. For example, for large CU, there are fewer passes and for small CU, there are more passes, as usually large CUs have more smooth content which can be refined on a big gird and multiple passes of optical flow-based motion refinement may not be necessary. For example, there is only one pass for a CU having an area larger than or equal to 4096; there are two passes for the CUs having an area less than 4096 but larger than 256; there are three passes for CUs having an area smaller than 256. For another example, for CUs coded with large quantization parameter, there are fewer passes and for CUs coded with small quantization parameter, there are more passes, as larger quantization parameter results in more distortion and thus it needs more passes of refinement. For yet another example, for large video sequences, there are fewer passes and for small video sequences, there are more passes, as usually there are more large CU in large video sequences which don't need more passes of refinement and there are more small CU in small video sequences and they need more passes of refinement.
In some embodiments, the size of the subblock for optical flow-based motion refinement is dependent on CU size, quantization parameter, or video sequence resolution. For example, for a large CU, the optical flow-based motion refinement is performed on a large subblock level and for small CU, the optical flow-based motion refinement is performed on a small subblock level. For example, for CU larger than 256, the optical flow-based refinement is performed on 8×8 subblock level and for CU smaller than or equal to 256, the optical flow-based refinement is performed on 4×4 subblock level. For another example, for CUs coded with large quantization parameters, the optical flow-based motion refinement is performed on a large subblock level and for CUs coded with small quantization parameters, the optical flow-based motion refinement is performed on a small subblock level. For yet another example, for large video sequences, the optical flow-based motion refinement is performed on a large subblock level and for small video sequences, the optical flow-based motion refinement is performed on a small subblock level.
And the adaptive subblock size for optical flow based motion refinement can be combined with multi-pass optical flow-based motion refinement. For example, for CUs having an area larger than 1024, the first pass of optical flow-based motion refinement is performed on 16×16 subblock level and the second pass is performed on 8×8 subblock level; for CUs having an area smaller than or equal to 1024, the first pass of optical flow-based motion refinement is performed on 8×8 subblock level and the second pass is performed on 4×4 subblock level. For another example, for the CUs having an area larger than or equal to 1024, both two passes are performed on 8×8 subblock level; for the CUs having an area less than 1024 but larger than or equal to 512, the first pass is performed on 8×8 subblock level and the second pass is performed on 4×4 subblock level; and for the CUs having an area less than 512, both two passes are performed on 4×4 subblock level. For yet another example, for CUs coded with quantization parameters larger than or equal to 32, the first pass of optical flow-based motion refinement is performed on 16×16 subblock level and the second pass is performed on 8×8 subblock level; for CUs coded with quantization parameter smaller than 32, the first pass of optical flow-based motion refinement is performed on 8×8 subblock level and the second pass is performed on 4×4 subblock level. For yet another example, for video sequence whose resolution larger than 1920×1080, the first pass of optical flow-based motion refinement is performed on 16×16 subblock level and the second pass is performed on 8×8 subblock level; for video sequence whose resolution smaller than 1920×1080 the first pass of optical flow-based motion refinement is performed on 8×8 subblock level and the second pass is performed on 4×4 subblock level.
Moreover, the adaptive subblock size optical flow based motion refinement can be combined with adaptive pass number optical flow based motion refinement. For example, for CUs whose area larger than 1024, there is only one pass of optical flow based motion refinement which is performed on 16×16 subblock level; for CUs whose area is smaller than or equal to 1024, there are two passes of optical flow based motion refinement, of which the first pass is performed on 8×8 subblock level and the second pass is performed on 4×4 subblock level. As another example, for CUs coded with quantization parameters larger than or equal to 32, there are two passes of optical flow based motion refinement, of which the first pass is performed on 16×16 subblock level and the second pass is performed on 8×8 subblock level; for CUs coded with a quantization parameter smaller than 32, there is only one pass of optical flow based motion refinement, which is performed on 8×8 subblock level. As yet another example, for a video sequence having a resolution larger than 1920×1080, there is only one pass of optical flow based motion refinement, which is performed on 16×16 subblock level; for a video sequence having a resolution smaller than 1920×1080, there are two passes of optical flow based motion refinement, of which the first pass is performed on 8×8 subblock level and the second pass is performed on 4×4 subblock level.
The embodiments described in the present disclosure can be freely combined.
In some embodiments, a non-transitory computer-readable storage medium storing a bitstream is also provided. The bitstream can be encoded and decoded according to the disclosed optical flow-based motion refinement method.
In some embodiments, a non-transitory computer-readable storage medium including instructions is also provided, and the instructions may be executed by a device (such as the disclosed encoder and decoder), for performing the above-described methods. Common forms of non-transitory media include, for example, a floppy disk, a flexible disk, hard disk, solid state drive, magnetic tape, or any other magnetic data storage medium, a CD-ROM, any other optical data storage medium, any physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM or any other flash memory, NVRAM, a cache, a register, any other memory chip or cartridge, and networked versions of the same. The device may include one or more processors (CPUs), an input/output interface, a network interface, and/or a memory.
The embodiments may further be described using the following clauses:
It should be noted that, the relational terms herein such as “first” and “second” are used only to differentiate an entity or operation from another entity or operation, and do not require or imply any actual relationship or sequence between these entities or operations. Moreover, the words “comprising,” “having,” “containing,” and “including,” and other similar forms are intended to be equivalent in meaning and be open ended in that an item or items following any one of these words is not meant to be an exhaustive listing of such item or items, or meant to be limited to only the listed item or items.
As used herein, unless specifically stated otherwise, the term “or” encompasses all possible combinations, except where infeasible. For example, if it is stated that a database may include A or B, then, unless specifically stated otherwise or infeasible, the database may include A, or B, or A and B. As a second example, if it is stated that a database may include A, B, or C, then, unless specifically stated otherwise or infeasible, the database may include A, or B, or C, or A and B, or A and C, or B and C, or A and B and C.
It is appreciated that the above-described embodiments can be implemented by hardware, or software (program codes), or a combination of hardware and software. If implemented by software, it may be stored in the above-described computer-readable media. The software, when executed by the processor can perform the disclosed methods. The computing units and other functional units described in the present disclosure can be implemented by hardware, or software, or a combination of hardware and software. One of ordinary skill in the art will also understand that multiple ones of the above described modules/units may be combined as one module/unit, and each of the above described modules/units may be further divided into a plurality of sub-modules/sub-units.
In the foregoing specification, embodiments have been described with reference to numerous specific details that can vary from implementation to implementation. Certain adaptations and modifications of the described embodiments can be made. Other embodiments can be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims. It is also intended that the sequence of steps shown in figures are only for illustrative purposes and are not intended to be limited to any particular sequence of steps. As such, those skilled in the art can appreciate that these steps can be performed in a different order while implementing the same method.
In the drawings and specification, there have been disclosed exemplary embodiments. However, many variations and modifications can be made to these embodiments. Accordingly, although specific terms are employed, they are used in a generic and descriptive sense only and not for purposes of limitation.
The disclosure claims the benefits of priority to: U.S. Provisional Application No. 63/495,768, filed on Apr. 12, 2023, and U.S. Provisional Application No. 63/508,010, filed on Jun. 14, 2023, the contents of all of which are incorporated herein by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
63495768 | Apr 2023 | US | |
63508010 | Jun 2023 | US |