WO2020119525A1 - 一种帧间预测的方法及装置 - Google Patents

一种帧间预测的方法及装置 Download PDF

Info

Publication number
WO2020119525A1
WO2020119525A1 PCT/CN2019/122735 CN2019122735W WO2020119525A1 WO 2020119525 A1 WO2020119525 A1 WO 2020119525A1 CN 2019122735 W CN2019122735 W CN 2019122735W WO 2020119525 A1 WO2020119525 A1 WO 2020119525A1
Authority
WO
WIPO (PCT)
Prior art keywords
prediction
block
image
width
height
Prior art date
Application number
PCT/CN2019/122735
Other languages
English (en)
French (fr)
Inventor
陈焕浜
杨海涛
陈建乐
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201910325612.0A external-priority patent/CN111327907B/zh
Priority to EP19897262.2A priority Critical patent/EP3890325A4/en
Priority to CA3122618A priority patent/CA3122618A1/en
Priority to CN201980013385.6A priority patent/CN112088534B/zh
Priority to AU2019397944A priority patent/AU2019397944B2/en
Priority to KR1020217021694A priority patent/KR20210096282A/ko
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to MX2021006787A priority patent/MX2021006787A/es
Priority to BR112021011307-0A priority patent/BR112021011307A2/pt
Priority to SG11202105848YA priority patent/SG11202105848YA/en
Priority to JP2021533635A priority patent/JP7384908B2/ja
Publication of WO2020119525A1 publication Critical patent/WO2020119525A1/zh
Priority to US17/345,556 priority patent/US20210306644A1/en
Priority to JP2023191838A priority patent/JP2024014927A/ja
Priority to AU2024200854A priority patent/AU2024200854A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction

Definitions

  • the present application relates to the field of video encoding and decoding, and in particular to an inter-frame prediction method and device.
  • Inter-frame prediction utilizes the correlation between video images, that is, temporal correlation, to achieve the purpose of image compression. It is widely used for compression encoding or decoding of scenes such as ordinary TV, conference TV, video telephony, and high-definition TV. Both the encoding side and the decoding side use inter prediction operations to process images.
  • Embodiments of the present application provide an inter prediction method and device, which can reduce the implementation complexity of inter prediction and improve processing efficiency.
  • the present application provides an inter prediction method.
  • the method according to a preset image division width, a preset image division height, and the width and height of the image block to be processed, the Determining a plurality of first image blocks in the processing image block; performing bidirectional prediction based on optical flow on the plurality of first image blocks to obtain a prediction value of each first image block; combining the plurality of first images The predicted value of the block to obtain the predicted value of the image block to be processed.
  • the width and height of the image block to be processed are the same as the width and height of the first image block, respectively, that is, the image block to be processed includes only one first image block.
  • the image block to be processed is The processing unit performs bidirectional prediction based on optical flow to obtain the prediction value of the image block to be processed.
  • the preset image division width and the width of the image block to be processed are compared to determine the width of the first image block; the preset image division height and the target image are compared
  • the height of the image block is processed to determine the height of the first image block; and the plurality of first image blocks are determined in the image block to be processed according to the width and height of the first image block.
  • the width of the first image block is constrained by the preset image division width
  • the height of the first image block is constrained by the preset image division height, which does not make the determined area of each first image block larger, thereby It can reduce the consumption of hardware resources such as memory, reduce the implementation complexity of inter-frame prediction, and improve processing efficiency.
  • the width of the first image block is the minimum value between the preset image division width and the width of the image block to be processed
  • the height of the first image block is The minimum value between the preset image division height and the height of the image block to be processed. Therefore, the area for determining the first image can be reduced, the implementation complexity of inter prediction can be reduced to the greatest extent, and the processing efficiency can be improved.
  • a first prediction block of the first image block is obtained; a gradient operation is performed on the first prediction block to obtain the first The first gradient value matrix of the image block; based on the first prediction block and the first gradient value matrix, calculating the amount of motion information correction for each basic processing unit in the first image block; based on each basic The motion information correction amount of the processing unit obtains the predicted value of the first image block. Since the predicted value of the first image block is obtained based on the motion information correction amount of each basic processing unit, the accuracy of the predicted value of the first image block can be improved.
  • the width and height of the first prediction block are first expanded, so that the first expanded first prediction
  • the width and height of the block are greater than the width and height of the first image block by 2 pixel distances; and/or, based on the first gradient value matrix, the gradient value of the matrix edge position is applied to the first gradient
  • the width and height of the value matrix are first expanded, so that the width and height of the first expanded first gradient value matrix are greater than the width and height of the first image block by 2 pixel distances; correspondingly, according to The first expanded first prediction block and/or the first expanded first gradient value matrix calculates the motion information correction amount of each basic processing unit in the first image block.
  • the width and height of the first prediction block By first expanding the width and height of the first prediction block, so that the width and height of the first expanded first prediction block are greater than the width and height of the first image block by 2 pixel distances, in this way, when bidirectional prediction is performed on the image block in the reference image to obtain the first prediction block, the size of the obtained first prediction block can be reduced, and accordingly, the size of the image block is also reduced, thereby reducing the bidirectional prediction The amount of data to reduce the occupation of hardware resources.
  • interpolation filtering is performed on the pixel value of the block edge region of the first prediction block, or the pixel value of the block edge position of the first prediction block is copied to Perform a second expansion on the width and height of the first prediction block; correspondingly, perform a gradient operation on the second expanded first prediction block. Since the pixel value at the block edge position of the first prediction block is copied, the width and height of the first prediction block can be secondly extended, the implementation is simple, and the calculation complexity is low.
  • the first prediction block includes a forward prediction block and a backward prediction block
  • the first gradient value matrix includes a forward horizontal gradient value matrix, a forward vertical gradient value matrix, and a Horizontal gradient value matrix and backward vertical gradient value matrix.
  • the preset image division width is 64, 32 or 16
  • the preset image division height is 64, 32 or 16. In this way, the size of the determined first image block can be reduced based on the constraints of the predicted image division width and the predicted image division height.
  • the basic processing unit is a 4x4 pixel matrix.
  • the present application provides an inter-frame prediction device, including: a determination module, a prediction module, and a combination module.
  • the determining module determines a plurality of first image blocks in the image block to be processed according to a preset image dividing width, a preset image dividing height, and the width and height of the image block to be processed;
  • the plurality of first image blocks respectively perform bidirectional prediction based on optical flow to obtain the prediction value of each first image block;
  • the combining module combines the prediction values of the plurality of first image blocks to obtain the Process the predicted value of the image block.
  • the determining module determines multiple first image blocks among the image blocks to be processed according to the preset image division width, the preset image division height, and the width and height of the image block to be processed, the size of the first image block Constrained by the preset image division width and preset image division height, it does not make the determined area of each first image block larger, which can reduce the consumption of hardware resources such as memory and reduce the complexity of the implementation of inter prediction Degree, improve processing efficiency.
  • the determination module, the prediction module, and the combination module may also be used to perform the operation of the method in any possible implementation manner of the first aspect, which is not described in detail here. Instructions.
  • an embodiment of the present application provides an apparatus for inter prediction, the apparatus includes: a processor and a memory, the processor and the memory are connected; the memory stores one or more programs, and the one or more A program is configured to be executed by the processor, and the one or more programs contain instructions for performing the method of the first aspect or any possible implementation manner of the first aspect.
  • the present application provides a non-volatile computer-readable storage medium for storing a computer program, the computer program is loaded by a processor to perform the first aspect or any possible implementation of the first aspect Instruction of the method of the method.
  • the present application provides a chip including programmable logic circuits and/or program instructions, which are used to implement the above-mentioned first aspect or any possible implementation manner of the first aspect when the chip is running method.
  • an embodiment of the present application provides an inter prediction method, including: acquiring motion information of an image block to be processed, the image block to be processed includes a plurality of virtual pipeline data units, and the virtual pipeline data unit includes At least one basic processing unit; based on the motion information, obtain a predicted value matrix for each of the virtual pipeline data units; according to each predicted value matrix, calculate a horizontal prediction gradient matrix and for each virtual pipeline data unit A vertical prediction gradient matrix; based on the prediction value matrix, the horizontal prediction gradient matrix, and the vertical prediction gradient matrix, calculating the motion information correction amount of each of the basic processing units in each of the virtual pipeline data units .
  • the obtaining the predicted value matrix of each of the virtual pipeline data units according to the motion information includes: obtaining each of the virtual pipelines according to the motion information An initial prediction matrix of a data unit, the initial prediction matrix and the virtual pipeline data unit are equal in size; the initial prediction matrix is used as the prediction value matrix.
  • the method further includes: performing pixel expansion on edges of the initial prediction matrix to obtain expansion Prediction matrix, the size of the extended prediction matrix is larger than the size of the initial prediction matrix; correspondingly, the use of the initial prediction matrix as the predicted value matrix includes: the extended prediction matrix as the predicted value matrix.
  • the pixel expansion of the edge of the initial prediction matrix includes: obtaining the initial prediction matrix based on pixel value interpolation of pixels in the initial prediction matrix The pixel values of the pixels outside, or the pixel values of the pixels on the edge of the initial prediction matrix as the pixel values of the pixels adjacent to the edge outside the initial prediction matrix.
  • the virtual pipeline data unit includes a plurality of motion compensation units
  • the obtaining a predicted value matrix of each virtual pipeline data unit according to the motion information includes: According to the motion information, a compensation value matrix of each of the motion compensation units is obtained; the compensation value matrices of the plurality of motion compensation units are combined to obtain the predicted value matrix.
  • the calculating the horizontal prediction gradient matrix and the vertical prediction gradient matrix of each virtual pipeline data unit according to each of the prediction value matrices includes: The prediction value matrix performs horizontal gradient calculation and vertical gradient calculation to obtain the horizontal prediction gradient matrix and the vertical prediction gradient matrix, respectively.
  • the method further includes: performing pixel expansion on the edge of the predicted value matrix to obtain a filled prediction matrix, the filled prediction matrix having a preset size; and the horizontal prediction gradient matrix
  • the edge and the edge of the vertical prediction gradient matrix are respectively subjected to gradient value expansion to obtain a filled horizontal gradient matrix and a filled vertical gradient matrix, and the filled horizontal gradient matrix and the filled vertical gradient matrix respectively have the preset Size; correspondingly, the motion information correction amount of each basic processing unit in each of the virtual pipeline data units is calculated according to the predicted value matrix, the horizontal predicted gradient matrix and the vertical predicted gradient matrix
  • the method includes: calculating a motion information correction amount of each basic processing unit in each virtual pipeline data unit according to the filling prediction matrix, the filling horizontal gradient matrix, and the filling vertical gradient matrix.
  • the method before the pixel expansion of the edge of the predicted value matrix, the method further includes: determining that the size of the predicted value matrix is smaller than the preset size.
  • the method before the gradient value expansion is performed on the edge of the horizontal prediction gradient matrix and the edge of the vertical prediction gradient matrix, the method further includes: determining the horizontal prediction The size of the gradient matrix and/or the size of the vertical prediction gradient matrix is smaller than the preset size.
  • the method further includes: according to the virtual The prediction value matrix of the pipeline data unit and the motion correction amount of each basic processing unit in the virtual pipeline data unit obtain the prediction value of each basic processing unit.
  • the method is used for bidirectional prediction; correspondingly, the motion information includes first reference frame list motion information and second reference frame list motion information; the prediction value matrix It includes a first predicted value matrix and a second predicted value matrix, the first predicted value matrix is obtained according to the first reference frame list motion information, and the second predicted value matrix is obtained according to the second reference frame list motion information
  • the horizontal prediction gradient matrix includes a first horizontal prediction gradient matrix and a second horizontal prediction gradient matrix, the first horizontal prediction gradient matrix is calculated according to the first predicted value matrix, and the second horizontal prediction gradient matrix is based on The second prediction value matrix is calculated;
  • the vertical prediction gradient matrix includes a first vertical prediction gradient matrix and a second vertical prediction gradient matrix, and the first vertical prediction gradient matrix is based on the first prediction value Matrix calculation, the second vertical prediction gradient matrix is calculated according to the second prediction value matrix;
  • the motion information correction amount includes the first reference frame list motion information correction amount and the second reference frame list motion information correction amount , The correction amount of the first reference frame list motion information is calculated according to the first
  • the method before the pixel expansion of the edge of the initial prediction matrix, the method further includes: determining that the time domain position of the image frame where the image block to be processed is located is Between the first reference frame indicated by the first reference frame list motion information and the second reference frame indicated by the second reference frame list motion information.
  • the method further includes: determining the first predicted value matrix and the second predicted value matrix The difference is less than the first threshold.
  • the motion information correction amount of the basic processing unit corresponds to a basic predicted value matrix in the predicted value matrix.
  • the method further includes: determining the first basic prediction value matrix and all The difference of the second basic predicted value matrix is smaller than the second threshold.
  • the size of the basic processing unit is 4x4.
  • the width of the virtual pipeline data unit is W and the height is H
  • the size of the extended prediction matrix is (W+n+2)x(H+n+2 )
  • the size of the horizontal prediction gradient matrix is (W+n)x(H+n)
  • the size of the vertical prediction gradient matrix is (W+n)x(H+n)
  • n 0, 2, or -2.
  • the method before acquiring the motion information of the image block to be processed, the method further includes: determining that the image block to be processed includes the plurality of virtual pipeline data units.
  • an embodiment of the present application provides an apparatus for inter prediction, including: an acquisition module for acquiring motion information of an image block to be processed, the image block to be processed includes a plurality of virtual pipeline data units, the The virtual pipeline data unit includes at least one basic processing unit; a compensation module for obtaining a predicted value matrix of each virtual pipeline data unit based on the motion information; a calculation module for each predicted value matrix according to the motion information, Calculating a horizontal prediction gradient matrix and a vertical prediction gradient matrix of each of the virtual pipeline data units; a correction module is used to calculate each according to the prediction value matrix, the horizontal prediction gradient matrix and the vertical prediction gradient matrix The amount of motion information correction for each of the basic processing units in the virtual pipeline data unit.
  • the compensation module is specifically configured to obtain, according to the motion information, an initial prediction matrix of each virtual pipeline data unit, the initial prediction matrix and the virtual The pipeline data units are equal in size; the initial prediction matrix is used as the prediction value matrix.
  • the compensation module is specifically configured to: perform pixel expansion on edges of the initial prediction matrix to obtain an extended prediction matrix, and the size of the extended prediction matrix is larger than the The size of the initial prediction matrix; use the extended prediction matrix as the prediction value matrix.
  • the compensation module is specifically configured to obtain pixel values of pixels outside the initial prediction matrix based on pixel value interpolation of pixels within the initial prediction matrix, or , Taking the pixel values of the pixels on the edge of the initial prediction matrix as the pixel values of the pixels adjacent to the edge outside the initial prediction matrix.
  • the virtual pipeline data unit includes multiple motion compensation units, and the compensation module is specifically configured to: obtain compensation for each of the motion compensation units according to the motion information Value matrix; combining the compensation value matrices of the plurality of motion compensation units to obtain the predicted value matrix.
  • the calculation module is specifically configured to: perform horizontal gradient calculation and vertical gradient calculation on the predicted value matrix to obtain the horizontal predicted gradient matrix and the vertical gradient, respectively Directly predict the gradient matrix.
  • it further includes a filling module, configured to: perform pixel expansion on edges of the predicted value matrix to obtain a filled prediction matrix, the filled prediction matrix having a preset size; Performing gradient value expansion on the edge of the horizontal prediction gradient matrix and the edge of the vertical prediction gradient matrix to obtain a filled horizontal gradient matrix and a filled vertical gradient matrix, the filled horizontal gradient matrix and the filled vertical
  • the gradient matrices have the preset sizes respectively; according to the filling prediction matrix, the filling horizontal gradient matrix and the filling vertical gradient matrix, calculating the motion information of each basic processing unit in each virtual pipeline data unit Correction amount.
  • it further includes a judgment module, configured to: determine that the size of the predicted value matrix is smaller than the preset size.
  • the judgment module is further configured to: determine the size of the horizontal prediction gradient matrix and/or the size of the vertical prediction gradient matrix to be smaller than the preset size.
  • the correction module is further configured to: based on the predicted value matrix of the virtual pipeline data unit and the motion correction of each of the basic processing units in the virtual pipeline data unit Amount to obtain the predicted value of each basic processing unit.
  • the apparatus is used for bidirectional prediction; correspondingly, the motion information includes motion information of a first reference frame list and motion information of a second reference frame list; the prediction value matrix It includes a first predicted value matrix and a second predicted value matrix, the first predicted value matrix is obtained according to the first reference frame list motion information, and the second predicted value matrix is obtained according to the second reference frame list motion information
  • the horizontal prediction gradient matrix includes a first horizontal prediction gradient matrix and a second horizontal prediction gradient matrix, the first horizontal prediction gradient matrix is calculated according to the first predicted value matrix, and the second horizontal prediction gradient matrix is based on The second prediction value matrix is calculated;
  • the vertical prediction gradient matrix includes a first vertical prediction gradient matrix and a second vertical prediction gradient matrix, and the first vertical prediction gradient matrix is based on the first prediction value Matrix calculation, the second vertical prediction gradient matrix is calculated according to the second prediction value matrix;
  • the motion information correction amount includes the first reference frame list motion information correction amount and the second reference frame list motion information correction amount , The correction amount of the first reference frame list motion information
  • the judgment module is further configured to: determine that the time domain position of the image frame where the image block to be processed is located is located in the first position indicated by the motion information of the first reference frame list Between a reference frame and the second reference frame indicated by the motion information of the second reference frame list.
  • the judgment module is further configured to: determine that the difference between the first predicted value matrix and the second predicted value matrix is less than a first threshold.
  • the judgment module is further configured to: determine that the difference between the first basic predicted value matrix and the second basic predicted value matrix is less than a second threshold.
  • the size of the basic processing unit is 4x4.
  • the width of the virtual pipeline data unit is W and the height is H
  • the size of the extended prediction matrix is (W+n+2)x(H+n+2 )
  • the size of the horizontal prediction gradient matrix is (W+n)x(H+n)
  • the size of the vertical prediction gradient matrix is (W+n)x(H+n)
  • n 0, 2, or -2.
  • the judgment module is further configured to: determine that the image block to be processed includes the multiple virtual pipeline data units.
  • an embodiment of the present application provides an encoding device, including: a nonvolatile memory and a processor coupled to each other, and the processor calls program code stored in the memory to perform any one of the first aspect Part or all of the steps of the method, or to perform part or all of the steps of the method of the sixth aspect.
  • an embodiment of the present application provides a decoding device, including: a nonvolatile memory and a processor coupled to each other, and the processor calls program codes stored in the memory to perform any one of the first aspect Part or all of the steps of the method, or to perform part or all of the steps of the method of the sixth aspect.
  • an embodiment of the present application provides a computer-readable storage medium that stores a program code, where the program code includes a part for performing any one of the methods of the first aspect or Instructions for all steps, or to perform part or all of the steps of any method of the sixth aspect.
  • an embodiment of the present application provides a computer program product, which, when the computer program product runs on a computer, causes the computer to perform some or all of the steps of the method of the first aspect, or, Perform part or all of the steps of any method of the sixth aspect.
  • FIG. 1A is a block diagram of an example of a video encoding and decoding system 10 for implementing embodiments of the present application;
  • FIG. 1B is a block diagram of an example of a video decoding system 40 for implementing an embodiment of the present application
  • FIG. 2 is a block diagram of an example structure of an encoder 20 for implementing an embodiment of the present application
  • FIG. 3 is a block diagram of an example structure of a decoder 30 for implementing an embodiment of the present application
  • FIG. 4 is a block diagram of an example of a video decoding device 400 for implementing an embodiment of the present application
  • FIG. 5 is a block diagram of another example of an encoding device or a decoding device used to implement embodiments of the present application;
  • FIG. 6 is a schematic diagram of a candidate position for motion information for implementing an embodiment of the present application.
  • FIG. 7 is a schematic diagram of motion information used for inter prediction in an embodiment of the present application.
  • FIG. 8 is a schematic diagram for implementing bidirectional weighted prediction according to an embodiment of the present application.
  • FIG. 9 is a schematic diagram of CU boundary padding used to implement the embodiment of the present application.
  • FIG. 10 is a schematic diagram of VPDU partitioning used to implement an embodiment of the present application.
  • FIG. 11 is a schematic diagram of illegal division of VPDUs for implementing an embodiment of the present application.
  • 13 is another schematic diagram for implementing the motion information of the embodiment of the present application for inter prediction
  • 15 is another schematic diagram for implementing motion information used for inter prediction according to an embodiment of the present application.
  • 16 is a flowchart of another method for implementing inter prediction according to an embodiment of the present application.
  • 17 is a flowchart of a method for implementing an embodiment of the present application.
  • FIG. 18 is a structural block diagram of an apparatus for implementing an inter prediction according to an embodiment of the present application.
  • 19 is a structural block diagram of another apparatus for implementing inter prediction according to an embodiment of the present application.
  • the corresponding device may include one or more units such as functional units to perform the one or more method steps described (eg, one unit performs one or more steps , Or multiple units, each of which performs one or more of multiple steps), even if such one or more units are not explicitly described or illustrated in the drawings.
  • the corresponding method may include one step to perform the functionality of one or more units (eg, one step executes one or more units Functionality, or multiple steps, each of which performs the functionality of one or more of the multiple units), even if such one or more steps are not explicitly described or illustrated in the drawings.
  • the features of the exemplary embodiments and/or aspects described herein may be combined with each other.
  • Video coding generally refers to processing a sequence of pictures that form a video or video sequence.
  • picture In the field of video coding, the terms “picture”, “frame” or “image” may be used as synonyms.
  • Video coding as used herein means video coding or video decoding.
  • Video encoding is performed on the source side and usually includes processing (eg, by compressing) the original video picture to reduce the amount of data required to represent the video picture, thereby storing and/or transmitting more efficiently.
  • Video decoding is performed on the destination side and usually involves inverse processing relative to the encoder to reconstruct the video picture.
  • the "encoding" of video pictures involved in the embodiments should be understood as referring to the “encoding” or “decoding” of video sequences.
  • the combination of the encoding part and the decoding part is also called codec (encoding and decoding).
  • the video sequence includes a series of pictures, which are further divided into slices, and the slices are further divided into blocks.
  • Video encoding is performed in units of blocks.
  • the concept of blocks is further expanded.
  • macroblock macroblock, MB
  • partitions multiple prediction blocks (partitions) that can be used for predictive coding.
  • basic concepts such as coding unit (coding unit (CU), prediction unit (PU) and transform unit (TU), etc. are used, and various block units are functionally divided and new The description is based on the tree structure.
  • the CU can be divided into smaller CUs according to the quadtree, and the smaller CU can continue to be divided to form a quadtree structure.
  • the CU is the basic unit for dividing and coding the encoded image.
  • PU can correspond to the prediction block and is the basic unit of predictive coding.
  • the CU is further divided into multiple PUs according to the division mode.
  • the TU can correspond to the transform block and is the basic unit for transforming the prediction residual.
  • PU or TU they all belong to the concept of block (or image block) in essence.
  • a coding tree unit is split into multiple CUs by using a quadtree structure represented as a coding tree.
  • a decision is made at the CU level whether to use inter-picture (temporal) or intra-picture (spatial) prediction to encode picture regions.
  • Each CU can be further split into one, two, or four PUs according to the PU split type.
  • the same prediction process is applied within a PU, and related information is transmitted to the decoder on the basis of the PU.
  • the CU may be divided into transform units (TU) according to other quadtree structures similar to the coding tree used for the CU.
  • quad-tree and binary-tree (Quad-tree and binary tree, QTBT) split frames are used to split the coding blocks.
  • the CU may have a square or rectangular shape.
  • the image block to be encoded in the current encoded image may be referred to as the current block.
  • the reference block is a block that provides a reference signal for the current block, where the reference signal represents a pixel value within the image block.
  • the block in the reference image that provides the prediction signal for the current block may be a prediction block, where the prediction signal represents a pixel value or a sample value or a sample signal within the prediction block. For example, after traversing multiple reference blocks, the best reference block is found. This best reference block will provide a prediction for the current block. This block is called a prediction block.
  • the original video picture can be reconstructed, that is, the reconstructed video picture has the same quality as the original video picture (assuming no transmission loss or other data loss during storage or transmission).
  • further compression is performed by, for example, quantization to reduce the amount of data required to represent the video picture, but the decoder side cannot fully reconstruct the video picture, that is, the quality of the reconstructed video picture is better than the original video picture. The quality is lower or worse.
  • Several video coding standards of H.261 belong to "lossy hybrid video codec” (ie, combining spatial and temporal prediction in the sample domain with 2D transform coding for applying quantization in the transform domain).
  • Each picture of the video sequence is usually divided into non-overlapping block sets, which are usually encoded at the block level.
  • the encoder side usually processes the encoded video at the block (video block) level.
  • the prediction block is generated by spatial (intra-picture) prediction and temporal (inter-picture) prediction.
  • the encoder duplicates the decoder processing loop so that the encoder and decoder generate the same prediction (eg, intra prediction and inter prediction) and/or reconstruction for processing, ie, encoding subsequent blocks.
  • FIG. 1A exemplarily shows a schematic block diagram of a video encoding and decoding system 10 to which an embodiment of the present application is applied.
  • the video encoding and decoding system 10 may include a source device 12 and a destination device 14, the source device 12 generates encoded video data, and therefore, the source device 12 may be referred to as a video encoding device.
  • the destination device 14 may decode the encoded video data generated by the source device 12, and therefore, the destination device 14 may be referred to as a video decoding device.
  • Various implementations of source device 12, destination device 14, or both may include one or more processors and memory coupled to the one or more processors.
  • Source device 12 and destination device 14 may include various devices, including desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set-top boxes, telephone handsets such as so-called "smart" phones, etc. Devices, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, wireless communication devices, or the like.
  • FIG. 1A depicts the source device 12 and the destination device 14 as separate devices
  • device embodiments may also include the functionality of the source device 12 and the destination device 14 or both, ie, the source device 12 or the corresponding Functionality of the destination device 14 or the corresponding functionality.
  • the source device 12 or corresponding functionality and the destination device 14 or corresponding functionality may be implemented using the same hardware and/or software, or using separate hardware and/or software, or any combination thereof .
  • a communication connection can be made between the source device 12 and the destination device 14 via the link 13, and the destination device 14 can receive the encoded video data from the source device 12 via the link 13.
  • Link 13 may include one or more media or devices capable of moving encoded video data from source device 12 to destination device 14.
  • link 13 may include one or more communication media that enable source device 12 to transmit encoded video data directly to destination device 14 in real time.
  • the source device 12 may modulate the encoded video data according to a communication standard (eg, a wireless communication protocol), and may transmit the modulated video data to the destination device 14.
  • the one or more communication media may include wireless and/or wired communication media, such as a radio frequency (RF) spectrum or one or more physical transmission lines.
  • RF radio frequency
  • the one or more communication media may form part of a packet-based network, such as a local area network, a wide area network, or a global network (eg, the Internet).
  • the one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from source device 12 to destination device 14.
  • the source device 12 includes an encoder 20.
  • the source device 12 may further include a picture source 16, a picture pre-processor 18, and a communication interface 22.
  • the encoder 20, the picture source 16, the picture preprocessor 18, and the communication interface 22 may be hardware components in the source device 12, or may be software programs in the source device 12. They are described as follows:
  • Picture source 16 which can include or can be any kind of picture capture device, for example, to capture real-world pictures, and/or any kind of pictures or comments (for screen content encoding, some text on the screen is also considered to be encoded Part of the picture or image) generation device, for example, a computer graphics processor for generating computer animation pictures, or for acquiring and/or providing real-world pictures, computer animation pictures (for example, screen content, virtual reality, VR) pictures) in any category of equipment, and/or any combination thereof (for example, augmented reality (AR) pictures).
  • the picture source 16 may be a camera for capturing pictures or a memory for storing pictures.
  • the picture source 16 may also include any type of (internal or external) interface that stores previously captured or generated pictures and/or acquires or receives pictures.
  • the picture source 16 When the picture source 16 is a camera, the picture source 16 may be, for example, a local or integrated camera integrated in the source device; when the picture source 16 is a memory, the picture source 16 may be a local or integrated, for example, integrated in the source device Memory.
  • the interface When the picture source 16 includes an interface, the interface may be, for example, an external interface that receives pictures from an external video source.
  • the external video source is, for example, an external picture capture device, such as a camera, an external memory, or an external picture generation device.
  • the external picture generation device for example It is an external computer graphics processor, computer or server.
  • the interface may be any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, an optical interface.
  • the picture can be regarded as a two-dimensional array or matrix of pixels (picture elements).
  • the pixels in the array can also be called sampling points.
  • the number of sampling points in the horizontal and vertical directions (or axes) of the array or picture defines the size and/or resolution of the picture.
  • three color components are usually used, that is, a picture can be represented or contain three sampling arrays.
  • the picture includes corresponding red, green, and blue sampling arrays.
  • each pixel is usually expressed in a brightness/chroma format or color space. For example, for a picture in YUV format, it includes the brightness component indicated by Y (sometimes also indicated by L) and the two indicated by U and V.
  • the luma component Y represents luminance or gray-scale horizontal intensity (for example, both are the same in gray-scale pictures), and the two chroma components U and V represent chroma or color information components.
  • the picture in the YUV format includes a luminance sampling array of luminance sampling values (Y), and two chrominance sampling arrays of chrominance values (U and V). RGB format pictures can be converted or transformed into YUV format and vice versa, this process is also called color transformation or conversion. If the picture is black and white, the picture may include only the brightness sampling array.
  • the picture transmitted from the picture source 16 to the picture processor may also be referred to as original picture data 17.
  • the picture pre-processor 18 is configured to receive the original picture data 17 and perform pre-processing on the original picture data 17 to obtain the pre-processed picture 19 or the pre-processed picture data 19.
  • the pre-processing performed by the picture pre-processor 18 may include trimming, color format conversion (eg, conversion from RGB format to YUV format), color grading, or denoising.
  • the encoder 20 (or video encoder 20) is used to receive the pre-processed picture data 19, and process the pre-processed picture data 19 in a related prediction mode (such as the prediction mode in various embodiments herein), thereby
  • the encoded picture data 21 is provided (the structural details of the encoder 20 will be further described below based on FIG. 2 or FIG. 4 or FIG. 5).
  • the encoder 20 may be used to execute various embodiments described below to implement the application of the chroma block prediction method described in the present application on the encoding side.
  • the communication interface 22 can be used to receive the encoded picture data 21, and can transmit the encoded picture data 21 to the destination device 14 or any other device (such as a memory) through the link 13 for storage or direct reconstruction.
  • the other device may be any device used for decoding or storage.
  • the communication interface 22 may be used, for example, to encapsulate the encoded picture data 21 into a suitable format, such as a data packet, for transmission on the link 13.
  • the destination device 14 includes a decoder 30, and optionally, the destination device 14 may further include a communication interface 28, a picture post-processor 32, and a display device 34. They are described as follows:
  • the communication interface 28 may be used to receive the encoded picture data 21 from the source device 12 or any other source, such as a storage device, such as an encoded picture data storage device.
  • the communication interface 28 can be used to transmit or receive the encoded picture data 21 via the link 13 between the source device 12 and the destination device 14 or via any type of network.
  • the link 13 is, for example, a direct wired or wireless connection.
  • the category of network is, for example, a wired or wireless network or any combination thereof, or any category of private and public networks, or any combination thereof.
  • the communication interface 28 may be used, for example, to decapsulate the data packet transmitted by the communication interface 22 to obtain the encoded picture data 21.
  • Both the communication interface 28 and the communication interface 22 can be configured as a one-way communication interface or a two-way communication interface, and can be used, for example, to send and receive messages to establish a connection, confirm and exchange any other communication link and/or for example encoded picture data Information about data transmission.
  • the decoder 30 (or referred to as the decoder 30) is used to receive the encoded picture data 21 and provide the decoded picture data 31 or the decoded picture 31 (hereinafter, the decoder 30 will be further described based on FIG. 3 or FIG. 4 or FIG. 5 Structural details).
  • the decoder 30 may be used to implement various embodiments described below to implement the application of the chroma block prediction method described in the present application on the decoding side.
  • the post-picture processor 32 is configured to perform post-processing on the decoded picture data 31 (also referred to as reconstructed picture data) to obtain post-processed picture data 33.
  • the post-processing performed by the image post-processor 32 may include: color format conversion (for example, conversion from YUV format to RGB format), color adjustment, retouching or resampling, or any other processing, and may also be used to convert the post-processed image data 33 Transmission to the display device 34.
  • the display device 34 is used to receive post-processed picture data 33 to display pictures to, for example, a user or a viewer.
  • the display device 34 may be or may include any type of display for presenting reconstructed pictures, for example, an integrated or external display or monitor.
  • the display may include a liquid crystal display (liquid crystal display, LCD), an organic light emitting diode (organic light emitting diode, OLED) display, a plasma display, a projector, a micro LED display, a liquid crystal on silicon (LCoS), Digital Light Processor (DLP) or other displays of any kind.
  • FIG. 1A depicts source device 12 and destination device 14 as separate devices
  • device embodiments may also include the functionality of source device 12 and destination device 14 or both, ie source device 12 or The corresponding functionality and the destination device 14 or corresponding functionality.
  • the source device 12 or corresponding functionality and the destination device 14 or corresponding functionality may be implemented using the same hardware and/or software, or using separate hardware and/or software, or any combination thereof .
  • Source device 12 and destination device 14 may include any of a variety of devices, including any type of handheld or stationary device, for example, notebook or laptop computers, mobile phones, smartphones, tablets or tablet computers, cameras, desktops Computers, set-top boxes, televisions, cameras, in-vehicle devices, display devices, digital media players, video game consoles, video streaming devices (such as content service servers or content distribution servers), broadcast receiver devices, broadcast transmitter devices And so on, and can not use or use any kind of operating system.
  • handheld or stationary device for example, notebook or laptop computers, mobile phones, smartphones, tablets or tablet computers, cameras, desktops Computers, set-top boxes, televisions, cameras, in-vehicle devices, display devices, digital media players, video game consoles, video streaming devices (such as content service servers or content distribution servers), broadcast receiver devices, broadcast transmitter devices And so on, and can not use or use any kind of operating system.
  • Both the encoder 20 and the decoder 30 can be implemented as any of various suitable circuits, for example, one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (application-specific integrated circuits) circuit, ASIC), field-programmable gate array (FPGA), discrete logic, hardware, or any combination thereof.
  • DSPs digital signal processors
  • ASIC application-specific integrated circuits
  • FPGA field-programmable gate array
  • the device may store the instructions of the software in a suitable non-transitory computer-readable storage medium, and may use one or more processors to execute the instructions in hardware to perform the techniques of the present disclosure . Any one of the foregoing (including hardware, software, a combination of hardware and software, etc.) may be regarded as one or more processors.
  • the video encoding and decoding system 10 shown in FIG. 1A is only an example, and the technology of the present application may be applied to video encoding settings that do not necessarily include any data communication between encoding and decoding devices (for example, video encoding or video decoding).
  • data can be retrieved from local storage, streamed on the network, and so on.
  • the video encoding device may encode the data and store the data to the memory, and/or the video decoding device may retrieve the data from the memory and decode the data.
  • encoding and decoding are performed by devices that do not communicate with each other but only encode data to and/or retrieve data from memory and decode the data.
  • FIG. 1B is an explanatory diagram of an example of a video coding system 40 including the encoder 20 of FIG. 2 and/or the decoder 30 of FIG. 3 according to an exemplary embodiment.
  • the video decoding system 40 can implement a combination of various technologies in the embodiments of the present application.
  • the video decoding system 40 may include an imaging device 41, an encoder 20, a decoder 30 (and/or a video encoder/decoder implemented by the logic circuit 47 of the processing unit 46), an antenna 42 , One or more processors 43, one or more memories 44, and/or display devices 45.
  • the imaging device 41, the antenna 42, the processing unit 46, the logic circuit 47, the encoder 20, the decoder 30, the processor 43, the memory 44, and/or the display device 45 can communicate with each other.
  • the video coding system 40 is shown with the encoder 20 and the decoder 30, in different examples, the video coding system 40 may include only the encoder 20 or only the decoder 30.
  • antenna 42 may be used to transmit or receive an encoded bitstream of video data.
  • the display device 45 may be used to present video data.
  • the logic circuit 47 may be implemented by the processing unit 46.
  • the processing unit 46 may include application-specific integrated circuit (ASIC) logic, a graphics processor, a general-purpose processor, and the like.
  • the video decoding system 40 may also include an optional processor 43, which may similarly include application-specific integrated circuit (ASIC) logic, a graphics processor, a general-purpose processor, and the like.
  • the logic circuit 47 may be implemented by hardware, such as dedicated hardware for video encoding, and the processor 43 may be implemented by general-purpose software, an operating system, and so on.
  • the memory 44 may be any type of memory, such as volatile memory (for example, static random access memory (Static Random Access Memory, SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.) or non-volatile Memory (for example, flash memory, etc.), etc.
  • volatile memory for example, static random access memory (Static Random Access Memory, SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
  • non-volatile Memory for example, flash memory, etc.
  • the memory 44 may be implemented by cache memory.
  • the logic circuit 47 can access the memory 44 (eg, to implement an image buffer).
  • the logic circuit 47 and/or the processing unit 46 may include memory (eg, cache, etc.) for implementing image buffers and the like.
  • the encoder 20 implemented by a logic circuit may include an image buffer (eg, implemented by the processing unit 46 or the memory 44) and a graphics processing unit (eg, implemented by the processing unit 46).
  • the graphics processing unit may be communicatively coupled to the image buffer.
  • the graphics processing unit may include the encoder 20 implemented by a logic circuit 47 to implement the various modules discussed with reference to FIG. 2 and/or any other encoder system or subsystem described herein.
  • Logic circuits can be used to perform the various operations discussed herein.
  • decoder 30 may be implemented by logic circuit 47 in a similar manner to implement the various modules discussed with reference to decoder 30 of FIG. 3 and/or any other decoder systems or subsystems described herein.
  • the decoder 30 implemented by the logic circuit may include an image buffer (implemented by the processing unit 2820 or the memory 44) and a graphics processing unit (for example, implemented by the processing unit 46).
  • the graphics processing unit may be communicatively coupled to the image buffer.
  • the graphics processing unit may include a decoder 30 implemented by a logic circuit 47 to implement various modules discussed with reference to FIG. 3 and/or any other decoder system or subsystem described herein.
  • antenna 42 may be used to receive an encoded bitstream of video data.
  • the encoded bitstream may include data related to encoded video frames, indicators, index values, mode selection data, etc. discussed herein, such as data related to encoded partitions (eg, transform coefficients or quantized transform coefficients , (As discussed) optional indicators, and/or data that defines the code segmentation).
  • the video coding system 40 may also include a decoder 30 coupled to the antenna 42 and used to decode the encoded bitstream.
  • the display device 45 is used to present video frames.
  • the decoder 30 may be used to perform the reverse process.
  • the decoder 30 may be used to receive and parse such syntax elements and decode the relevant video data accordingly.
  • encoder 20 may entropy encode syntax elements into an encoded video bitstream. In such instances, decoder 30 may parse such syntax elements and decode the relevant video data accordingly.
  • the encoder 20 and the decoder 30 in the embodiment of the present application may be, for example, H .263, H.264, HEVV, MPEG-2, MPEG-4, VP8, VP9 and other video standard protocols or next-generation video standard protocols (such as H.266, etc.) corresponding codec/decoder.
  • FIG. 2 shows a schematic/conceptual block diagram of an example of an encoder 20 for implementing an embodiment of the present application.
  • the encoder 20 includes a residual calculation unit 204, a transform processing unit 206, a quantization unit 208, an inverse quantization unit 210, an inverse transform processing unit 212, a reconstruction unit 214, a buffer 216, a loop filter Unit 220, decoded picture buffer (DPB) 230, prediction processing unit 260, and entropy encoding unit 270.
  • the prediction processing unit 260 may include an inter prediction unit 244, an intra prediction unit 254, and a mode selection unit 262.
  • the inter prediction unit 244 may include a motion estimation unit and a motion compensation unit (not shown).
  • the encoder 20 shown in FIG. 2 may also be referred to as a hybrid video encoder or a video encoder based on a hybrid video codec.
  • the residual calculation unit 204, the transform processing unit 206, the quantization unit 208, the prediction processing unit 260, and the entropy encoding unit 270 form the forward signal path of the encoder 20, while, for example, the inverse quantization unit 210, the inverse transform processing unit 212, and
  • the structural unit 214, the buffer 216, the loop filter 220, the decoded picture buffer (DPB) 230, and the prediction processing unit 260 form the backward signal path of the encoder, where the backward signal path of the encoder corresponds The signal path for the decoder (see decoder 30 in FIG. 3).
  • the encoder 20 receives a picture 201 or an image block 203 of the picture 201 through, for example, an input 202, for example, forming a picture in a picture sequence of a video or a video sequence.
  • the image block 203 may also be referred to as a current picture block or a picture block to be coded
  • the picture 201 may be referred to as a current picture or a picture to be coded (especially when the current picture is distinguished from other pictures in video coding, other pictures such as the same video sequence That is, the previously encoded and/or decoded pictures in the video sequence of the current picture are also included).
  • An embodiment of the encoder 20 may include a division unit (not shown in FIG. 2) for dividing the picture 201 into a plurality of blocks such as an image block 203, usually into a plurality of non-overlapping blocks.
  • the segmentation unit can be used to use the same block size and corresponding grid that defines the block size for all pictures in the video sequence, or to change the block size between pictures or subsets or picture groups, and divide each picture into The corresponding block.
  • the prediction processing unit 260 of the encoder 20 may be used to perform any combination of the above-mentioned segmentation techniques.
  • image block 203 is also or can be regarded as a two-dimensional array or matrix of sampling points with sample values, although its size is smaller than picture 201.
  • the image block 203 may include, for example, one sampling array (for example, the brightness array in the case of a black and white picture 201) or three sampling arrays (for example, one brightness array and two chroma arrays in the case of a color picture) or An array of any other number and/or category depending on the color format applied.
  • the number of sampling points in the horizontal and vertical directions (or axes) of the image block 203 defines the size of the image block 203.
  • the encoder 20 shown in FIG. 2 is used to encode the picture 201 block by block, for example, to perform encoding and prediction on each image block 203.
  • the residual calculation unit 204 is used to calculate the residual block 205 based on the picture image block 203 and the prediction block 265 (further details of the prediction block 265 are provided below), for example, by subtracting the sample value of the picture image block 203 sample by sample (pixel by pixel) The sample values of the block 265 are depredicted to obtain the residual block 205 in the sample domain.
  • the transform processing unit 206 is used to apply a transform such as discrete cosine transform (DCT) or discrete sine transform (DST) to the sample values of the residual block 205 to obtain transform coefficients 207 in the transform domain .
  • the transform coefficient 207 may also be referred to as a transform residual coefficient, and represents a residual block 205 in the transform domain.
  • the transform processing unit 206 may be used to apply integer approximations of DCT/DST, such as the transform specified by HEVC/H.265. Compared with the orthogonal DCT transform, this integer approximation is usually scaled by a factor. In order to maintain the norm of the residual block processed by the forward and inverse transform, an additional scaling factor is applied as part of the transform process.
  • the scaling factor is usually selected based on certain constraints, for example, the scaling factor is a power of two used for the shift operation, the bit depth of the transform coefficient, the accuracy, and the trade-off between implementation cost and so on.
  • a specific scaling factor can be specified for the inverse transform by the inverse transform processing unit 212 on the decoder 30 side (and corresponding inverse transform by the inverse transform processing unit 212 on the encoder 20 side), and accordingly, the encoder can be The 20 side specifies the corresponding scaling factor for the positive transform by the transform processing unit 206.
  • the quantization unit 208 is used to quantize the transform coefficient 207 by, for example, applying scalar quantization or vector quantization to obtain the quantized transform coefficient 209.
  • the quantized transform coefficient 209 may also be referred to as the quantized residual coefficient 209.
  • the quantization process can reduce the bit depth associated with some or all of the transform coefficients 207. For example, n-bit transform coefficients can be rounded down to m-bit transform coefficients during quantization, where n is greater than m.
  • the degree of quantization can be modified by adjusting the quantization parameter (QP). For example, for scalar quantization, different scales can be applied to achieve thinner or coarser quantization.
  • QP quantization parameter
  • a smaller quantization step size corresponds to a finer quantization
  • a larger quantization step size corresponds to a coarser quantization.
  • a suitable quantization step size can be indicated by a quantization parameter (QP).
  • the quantization parameter may be an index of a predefined set of suitable quantization steps.
  • smaller quantization parameters may correspond to fine quantization (smaller quantization step size)
  • larger quantization parameters may correspond to coarse quantization (larger quantization step size)
  • the quantization may include dividing by the quantization step size and the corresponding quantization or inverse quantization performed by, for example, inverse quantization 210, or may include multiplying the quantization step size.
  • Embodiments according to some standards such as HEVC may use quantization parameters to determine the quantization step size.
  • the quantization step size can be calculated based on the quantization parameter using fixed-point approximation that includes equations for division. Additional scaling factors can be introduced for quantization and inverse quantization to restore the norm of the residual block that may be modified due to the scale used in the fixed-point approximation of the equations for quantization step size and quantization parameter.
  • the scale of inverse transform and inverse quantization may be combined.
  • a custom quantization table can be used and signaled from the encoder to the decoder in a bitstream, for example. Quantization is a lossy operation, where the larger the quantization step, the greater the loss.
  • the inverse quantization unit 210 is used to apply the inverse quantization of the quantization unit 208 on the quantized coefficients to obtain the inverse quantized coefficients 211, for example, based on or using the same quantization step size as the quantization unit 208, apply the quantization scheme applied by the quantization unit 208 Inverse quantization scheme.
  • the inverse quantized coefficient 211 may also be referred to as the inverse quantized residual coefficient 211, which corresponds to the transform coefficient 207, although the loss due to quantization is usually not the same as the transform coefficient.
  • the inverse transform processing unit 212 is used to apply the inverse transform of the transform applied by the transform processing unit 206, for example, inverse discrete cosine transform (DCT) or inverse discrete sine transform (DST), in the sample domain
  • the inverse transform block 213 is obtained.
  • the inverse transform block 213 may also be referred to as an inverse transform dequantized block 213 or an inverse transform residual block 213.
  • the reconstruction unit 214 (eg, summer 214) is used to add the inverse transform block 213 (ie, the reconstructed residual block 213) to the prediction block 265 to obtain the reconstructed block 215 in the sample domain, for example, The sample values of the reconstructed residual block 213 and the sample values of the prediction block 265 are added.
  • a buffer unit 216 (or simply "buffer" 216), such as a line buffer 216, is used to buffer or store the reconstructed block 215 and corresponding sample values for, for example, intra prediction.
  • the encoder may be used to use the unfiltered reconstructed blocks and/or corresponding sample values stored in the buffer unit 216 for any type of estimation and/or prediction, such as intra prediction.
  • an embodiment of the encoder 20 may be configured such that the buffer unit 216 is used not only for storing the reconstructed block 215 for intra prediction 254, but also for the loop filter unit 220 (not shown in FIG. 2) Out), and/or, for example, causing the buffer unit 216 and the decoded picture buffer unit 230 to form a buffer.
  • Other embodiments may be used to use the filtered block 221 and/or blocks or samples from the decoded picture buffer 230 (neither shown in FIG. 2) as an input or basis for intra prediction 254.
  • the loop filter unit 220 (or simply “loop filter” 220) is used to filter the reconstructed block 215 to obtain the filtered block 221, so as to smoothly perform pixel conversion or improve video quality.
  • the loop filter unit 220 is intended to represent one or more loop filters, such as deblocking filters, sample-adaptive offset (SAO) filters, or other filters, such as bilateral filters, Adaptive loop filter (adaptive loop filter, ALF), or sharpening or smoothing filter, or collaborative filter.
  • the loop filter unit 220 is shown as an in-loop filter in FIG. 2, in other configurations, the loop filter unit 220 may be implemented as a post-loop filter.
  • the filtered block 221 may also be referred to as the filtered reconstructed block 221.
  • the decoded picture buffer 230 may store the reconstructed coding block after the loop filter unit 220 performs a filtering operation on the reconstructed coding block.
  • Embodiments of the encoder 20 may be used to output loop filter parameters (eg, sample adaptive offset information), for example, directly output or by the entropy encoding unit 270 or any other
  • the entropy coding unit outputs after entropy coding, for example, so that the decoder 30 can receive and apply the same loop filter parameters for decoding.
  • the decoded picture buffer (DPB) 230 may be a reference picture memory for storing reference picture data for the encoder 20 to encode video data.
  • DPB 230 can be formed by any of a variety of memory devices, such as dynamic random access memory (dynamic random access (DRAM) (including synchronous DRAM (synchronous DRAM, SDRAM), magnetoresistive RAM (magnetoresistive RAM, MRAM), resistive RAM (resistive RAM, RRAM)) or other types of memory devices.
  • DRAM dynamic random access
  • the DPB 230 and the buffer 216 may be provided by the same memory device or separate memory devices.
  • a decoded picture buffer (DPB) 230 is used to store the filtered block 221.
  • the decoded picture buffer 230 may be further used to store other previous filtered blocks of the same current picture or different pictures such as previous reconstructed pictures, such as the previously reconstructed and filtered block 221, and may provide the complete previous The reconstructed ie decoded pictures (and corresponding reference blocks and samples) and/or partially reconstructed current pictures (and corresponding reference blocks and samples), for example for inter prediction.
  • a decoded picture buffer (DPB) 230 is used to store the reconstructed block 215.
  • the prediction processing unit 260 also known as the block prediction processing unit 260, is used to receive or acquire the image block 203 (current image block 203 of the current picture 201) and reconstructed picture data, such as the same (current) picture from the buffer 216 Reference samples and/or reference picture data 231 of one or more previously decoded pictures from the decoded picture buffer 230, and used to process such data for prediction, that is, to provide an inter prediction block 245 or The prediction block 265 of the intra prediction block 255.
  • the mode selection unit 262 may be used to select a prediction mode (eg, intra or inter prediction mode) and/or the corresponding prediction block 245 or 255 used as the prediction block 265 to calculate the residual block 205 and reconstruct the reconstructed block 215.
  • a prediction mode eg, intra or inter prediction mode
  • the corresponding prediction block 245 or 255 used as the prediction block 265 to calculate the residual block 205 and reconstruct the reconstructed block 215.
  • An embodiment of the mode selection unit 262 may be used to select a prediction mode (eg, from those prediction modes supported by the prediction processing unit 260), which provides the best match or the minimum residual (the minimum residual means Better compression in transmission or storage), or provide minimum signaling overhead (minimum signaling overhead means better compression in transmission or storage), or consider or balance both at the same time.
  • the mode selection unit 262 may be used to determine a prediction mode based on rate distortion optimization (RDO), that is, to select a prediction mode that provides minimum bit rate distortion optimization, or to select a prediction mode in which the related rate distortion at least meets the prediction mode selection criteria .
  • RDO rate distortion optimization
  • the encoder 20 is used to determine or select the best or optimal prediction mode from the (predetermined) prediction mode set.
  • the set of prediction modes may include, for example, intra prediction modes and/or inter prediction modes.
  • the intra prediction mode set may include 35 different intra prediction modes, for example, non-directional modes such as DC (or mean) mode and planar mode, or directional modes as defined in H.265, or may include 67 Different intra prediction modes, for example, non-directional modes such as DC (or mean) mode and planar mode, or directional modes as defined in the developing H.266.
  • non-directional modes such as DC (or mean) mode and planar mode
  • directional modes as defined in the developing H.266.
  • the set of inter prediction modes depends on the available reference pictures (ie, for example, the aforementioned at least partially decoded pictures stored in DBP 230) and other inter prediction parameters, for example, depending on whether the entire reference picture is used or only Use a part of the reference picture, for example a search window area surrounding the area of the current block, to search for the best matching reference block, and/or for example depending on whether pixel interpolation such as half-pixel and/or quarter-pixel interpolation is applied
  • the set of inter prediction modes may include advanced motion vector (Advanced Motion Vector Prediction, AMVP) mode and merge mode.
  • AMVP Advanced Motion Vector Prediction
  • the set of inter prediction modes may include an improved control point-based AMVP mode according to an embodiment of the present application, and an improved control point-based merge mode.
  • intra prediction unit 254 may be used to perform any combination of inter prediction techniques described below.
  • the embodiments of the present application may also apply skip mode and/or direct mode.
  • the prediction processing unit 260 may be further used to split the image block 203 into smaller block partitions or sub-blocks, for example, iteratively using quad-tree (QT) segmentation, binary-tree (BT) segmentation Or triple-tree (TT) partitioning, or any combination thereof, and for performing predictions for each of block partitions or sub-blocks, for example, where mode selection includes selecting the tree structure of the divided image block 203 and selecting applications The prediction mode for each of the block partitions or sub-blocks.
  • QT quad-tree
  • BT binary-tree
  • TT triple-tree
  • the inter prediction unit 244 may include a motion estimation (ME) unit (not shown in FIG. 2) and a motion compensation (MC) unit (not shown in FIG. 2).
  • the motion estimation unit is used to receive or acquire a picture image block 203 (current picture image block 203 of the current picture 201) and a decoded picture 231, or at least one or more previously reconstructed blocks, for example, one or more other/different
  • the reconstructed block of the previously decoded picture 231 is used for motion estimation.
  • the video sequence may include the current picture and the previously decoded picture 31, or in other words, the current picture and the previously decoded picture 31 may be part of or form a sequence of pictures that form the video sequence.
  • the encoder 20 may be used to select a reference block from multiple reference blocks of the same or different pictures in multiple other pictures, and provide a reference picture and/or provide a reference to a motion estimation unit (not shown in FIG. 2)
  • the offset (spatial offset) between the position of the block (X, Y coordinates) and the position of the current block is used as an inter prediction parameter. This offset is also called motion vector (MV).
  • the motion compensation unit is used to acquire inter prediction parameters and perform inter prediction based on or using inter prediction parameters to obtain inter prediction blocks 245.
  • the motion compensation performed by the motion compensation unit may include extracting or generating a prediction block based on a motion/block vector determined by motion estimation (possibly performing interpolation of sub-pixel accuracy). Interpolation filtering can generate additional pixel samples from known pixel samples, potentially increasing the number of candidate prediction blocks that can be used to encode picture blocks.
  • the motion compensation unit 246 may locate the prediction block pointed to by the motion vector in a reference picture list. Motion compensation unit 246 may also generate syntax elements associated with blocks and video slices for use by decoder 30 when decoding picture blocks of video slices.
  • the above inter prediction unit 244 may transmit a syntax element to the entropy encoding unit 270, where the syntax element includes inter prediction parameters (such as an inter prediction mode selected for the current block prediction after traversing multiple inter prediction modes Instructions).
  • inter prediction parameters such as an inter prediction mode selected for the current block prediction after traversing multiple inter prediction modes Instructions.
  • the decoding terminal 30 may directly use the default prediction mode for decoding. It can be understood that the inter prediction unit 244 may be used to perform any combination of inter prediction techniques.
  • the intra prediction unit 254 is used to acquire, for example, a picture block 203 (current picture block) that receives the same picture and one or more previously reconstructed blocks, such as reconstructed neighboring blocks, for intra estimation.
  • the encoder 20 may be used to select an intra prediction mode from a plurality of (predetermined) intra prediction modes.
  • Embodiments of the encoder 20 may be used to select an intra-prediction mode based on optimization criteria, for example, based on a minimum residual (eg, an intra-prediction mode that provides the prediction block 255 that is most similar to the current picture block 203) or a minimum code rate distortion.
  • a minimum residual eg, an intra-prediction mode that provides the prediction block 255 that is most similar to the current picture block 203
  • a minimum code rate distortion eg, an intra-prediction mode that provides the prediction block 255 that is most similar to the current picture block 203
  • the intra prediction unit 254 is further used to determine the intra prediction block 255 based on the intra prediction parameters of the intra prediction mode as selected. In any case, after selecting the intra-prediction mode for the block, the intra-prediction unit 254 is also used to provide the intra-prediction parameters to the entropy encoding unit 270, that is, to provide an indication of the selected intra-prediction mode for the block Information. In one example, the intra prediction unit 254 may be used to perform any combination of intra prediction techniques.
  • the above-mentioned intra-prediction unit 254 may transmit a syntax element to the entropy encoding unit 270, where the syntax element includes intra-prediction parameters (such as an intra-prediction mode selected for the current block prediction after traversing multiple intra-prediction modes) Instructions).
  • the intra prediction parameters may not be carried in the syntax element.
  • the decoding terminal 30 may directly use the default prediction mode for decoding.
  • the entropy coding unit 270 is used to encode an entropy coding algorithm or scheme (for example, variable length coding (VLC) scheme, context adaptive VLC (context adaptive VLC, CAVLC) scheme, arithmetic coding scheme, context adaptive binary arithmetic) Encoding (context adaptive) binary arithmetic coding (CABAC), syntax-based context-adaptive binary arithmetic coding (SBAC), probability interval entropy (probability interval interpartitioning entropy, PIPE) encoding or other entropy Encoding method or technique) applied to a single or all of the quantized residual coefficients 209, inter prediction parameters, intra prediction parameters and/or loop filter parameters (or not applied) to obtain the output 272 to For example, the encoded picture data 21 output in the form of an encoded bit stream 21.
  • VLC variable length coding
  • CABAC context adaptive binary arithmetic
  • SBAC syntax-based context-adaptive binary arithmetic coding
  • the encoded bitstream can be transmitted to the video decoder 30 or archived for later transmission or retrieval by the video decoder 30.
  • the entropy encoding unit 270 may also be used to entropy encode other syntax elements of the current video slice being encoded.
  • video encoder 20 may be used to encode video streams.
  • the non-transform based encoder 20 may directly quantize the residual signal without the transform processing unit 206 for certain blocks or frames.
  • the encoder 20 may have a quantization unit 208 and an inverse quantization unit 210 combined into a single unit.
  • the encoder 20 may be used to implement the inter prediction method described in the embodiments below.
  • the video encoder 20 can directly quantize the residual signal without processing by the transform processing unit 206, and accordingly, without processing by the inverse transform processing unit 212; or, for some For image blocks or image frames, the video encoder 20 does not generate residual data, and accordingly does not need to be processed by the transform processing unit 206, quantization unit 208, inverse quantization unit 210, and inverse transform processing unit 212; or, the video encoder 20 may convert The reconstructed image block is directly stored as the reference block without being processed by the filter 220; alternatively, the quantization unit 208 and the inverse quantization unit 210 in the video encoder 20 may be merged together.
  • the loop filter 220 is optional, and in the case of lossless compression coding, the transform processing unit 206, quantization unit 208, inverse quantization unit 210, and inverse transform processing unit 212 are optional. It should be understood that the inter prediction unit 244 and the intra prediction unit 254 may be selectively enabled according to different application scenarios.
  • FIG. 3 shows a schematic/conceptual block diagram of an example of a decoder 30 for implementing an embodiment of the present application.
  • the video decoder 30 is used to receive encoded picture data (eg, encoded bitstream) 21, for example, encoded by the encoder 20, to obtain the decoded picture 231.
  • encoded picture data eg, encoded bitstream
  • video decoder 30 receives video data from video encoder 20, such as an encoded video bitstream and associated syntax elements representing picture blocks of the encoded video slice.
  • the decoder 30 includes an entropy decoding unit 304, an inverse quantization unit 310, an inverse transform processing unit 312, a reconstruction unit 314 (such as a summer 314), a buffer 316, a loop filter 320, a The decoded picture buffer 330 and the prediction processing unit 360.
  • the prediction processing unit 360 may include an inter prediction unit 344, an intra prediction unit 354, and a mode selection unit 362.
  • video decoder 30 may perform a decoding pass that is generally reciprocal to the encoding pass described with reference to video encoder 20 of FIG. 2.
  • the entropy decoding unit 304 is used to perform entropy decoding on the encoded picture data 21 to obtain, for example, quantized coefficients 309 and/or decoded encoding parameters (not shown in FIG. 3), for example, inter prediction, intra prediction parameters , Any or all of the loop filter parameters and/or other syntax elements (decoded).
  • the entropy decoding unit 304 is further used to forward inter prediction parameters, intra prediction parameters, and/or other syntax elements to the prediction processing unit 360.
  • Video decoder 30 may receive syntax elements at the video slice level and/or the video block level.
  • the inverse quantization unit 310 can be functionally the same as the inverse quantization unit 110
  • the inverse transform processing unit 312 can be functionally the same as the inverse transform processing unit 212
  • the reconstruction unit 314 can be functionally the same as the reconstruction unit 214
  • the buffer 316 can be functionally
  • the loop filter 320 may be functionally the same as the loop filter 220
  • the decoded picture buffer 330 may be functionally the same as the decoded picture buffer 230.
  • the prediction processing unit 360 may include an inter prediction unit 344 and an intra prediction unit 354, where the inter prediction unit 344 may be similar in function to the inter prediction unit 244, and the intra prediction unit 354 may be similar in function to the intra prediction unit 254 .
  • the prediction processing unit 360 is generally used to perform block prediction and/or obtain the prediction block 365 from the encoded data 21, and receive or obtain prediction-related parameters and/or information about the entropy decoding unit 304 (explicitly or implicitly). Information about the selected prediction mode.
  • the intra prediction unit 354 of the prediction processing unit 360 is used to signal-based the intra prediction mode and the previous decoded block from the current frame or picture. Data to generate a prediction block 365 for the picture block of the current video slice.
  • the inter prediction unit 344 eg, motion compensation unit
  • Other syntax elements generate a prediction block 365 for the video block of the current video slice.
  • a prediction block may be generated from a reference picture in a reference picture list.
  • the video decoder 30 may construct the reference frame lists: list 0 and list 1 based on the reference pictures stored in the DPB 330 using default construction techniques.
  • the prediction processing unit 360 is used to determine the prediction information for the video block of the current video slice by parsing the motion vector and other syntax elements, and use the prediction information to generate the prediction block for the current video block being decoded.
  • the prediction processing unit 360 uses some received syntax elements to determine the prediction mode (eg, intra or inter prediction) of the video block used to encode the video slice, and the inter prediction slice type ( For example, B slice, P slice, or GPB slice), construction information for one or more of the reference picture lists for slices, motion vectors for each inter-coded video block for slices, The inter prediction status and other information of each inter-coded video block of the slice to decode the video block of the current video slice.
  • the prediction mode eg, intra or inter prediction
  • the inter prediction slice type For example, B slice, P slice, or GPB slice
  • the syntax elements received by the video decoder 30 from the bitstream include an adaptive parameter set (adaptive parameter set, APS), a sequence parameter set (SPS), and a picture parameter set (picture parameter (set, PPS) or the syntax element in one or more of the stripe headers.
  • an adaptive parameter set adaptive parameter set
  • SPS sequence parameter set
  • PPS picture parameter set
  • the inverse quantization unit 310 may be used to inverse quantize (ie, inverse quantize) the quantized transform coefficients provided in the bitstream and decoded by the entropy decoding unit 304.
  • the inverse quantization process may include using the quantization parameters calculated by the video encoder 20 for each video block in the video slice to determine the degree of quantization that should be applied and also determine the degree of inverse quantization that should be applied.
  • the inverse transform processing unit 312 is used to apply an inverse transform (eg, inverse DCT, inverse integer transform, or conceptually similar inverse transform process) to the transform coefficients, so as to generate a residual block in the pixel domain.
  • an inverse transform eg, inverse DCT, inverse integer transform, or conceptually similar inverse transform process
  • the reconstruction unit 314 (for example, the summer 314) is used to add the inverse transform block 313 (ie, the reconstructed residual block 313) to the prediction block 365 to obtain the reconstructed block 315 in the sample domain, for example, by adding The sample values of the reconstructed residual block 313 and the sample values of the prediction block 365 are added.
  • the loop filter unit 320 (during the encoding loop or after the encoding loop) is used to filter the reconstructed block 315 to obtain the filtered block 321 to smoothly perform pixel conversion or improve video quality.
  • the loop filter unit 320 may be used to perform any combination of filtering techniques described below.
  • the loop filter unit 320 is intended to represent one or more loop filters, such as deblocking filters, sample-adaptive offset (SAO) filters, or other filters, such as bilateral filters, Adaptive loop filter (adaptive loop filter, ALF), or sharpening or smoothing filter, or collaborative filter.
  • the loop filter unit 320 is shown as an in-loop filter in FIG. 3, in other configurations, the loop filter unit 320 may be implemented as a post-loop filter.
  • the decoded video block 321 in a given frame or picture is then stored in a decoded picture buffer 330 that stores reference pictures for subsequent motion compensation.
  • the decoder 30 is used, for example, to output the decoded picture 31 through the output 332 for presentation to the user or for the user to view.
  • video decoder 30 may be used to decode the compressed bitstream.
  • the decoder 30 may generate the output video stream without the loop filter unit 320.
  • the non-transform based decoder 30 may directly inversely quantize the residual signal without the inverse transform processing unit 312 for certain blocks or frames.
  • the video decoder 30 may have an inverse quantization unit 310 and an inverse transform processing unit 312 combined into a single unit.
  • the decoder 30 is used to implement the inter prediction method described in the embodiments below.
  • video decoder 30 may be used to decode the encoded video bitstream.
  • the video decoder 30 may generate an output video stream without being processed by the filter 320; or, for certain image blocks or image frames, the entropy decoding unit 304 of the video decoder 30 does not decode the quantized coefficients, and accordingly does not It needs to be processed by the inverse quantization unit 310 and the inverse transform processing unit 312.
  • the loop filter 320 is optional; and in the case of lossless compression, the inverse quantization unit 310 and the inverse transform processing unit 312 are optional.
  • the inter prediction unit and the intra prediction unit may be selectively enabled.
  • the processing results for a certain link can be further processed and then output to the next link, for example, in interpolation filtering, motion vector derivation or loop filtering, etc. After the link, the results of the corresponding link are further clipped or shift shifted.
  • the motion vector of the control point of the current image block derived from the motion vector of the adjacent affine coding block, or the motion vector of the sub-block of the current image block derived can be further processed, and this application does not do this limited.
  • the value range of the motion vector is constrained to be within a certain bit width. Assuming that the allowed bit width of the motion vector is bitDepth, the range of the motion vector is -2 ⁇ (bitDepth-1) ⁇ 2 ⁇ (bitDepth-1)-1, where the " ⁇ " symbol indicates a power. If bitDepth is 16, the value ranges from -32768 to 32767. If bitDepth is 18, the value ranges from -131072 to 131071.
  • the value of the motion vector (such as the motion vectors MV of four 4x4 sub-blocks in an 8x8 image block) is constrained so that the maximum difference between the integer parts of the four 4x4 sub-blocks MV does not exceed N pixels, for example no more than one pixel.
  • ux (vx+2 bitDepth )%2 bitDepth
  • vx is the horizontal component of the motion vector of the image block or the sub-block of the image block
  • vy is the vertical component of the motion vector of the image block or the sub-block of the image block
  • ux and uy are intermediate values
  • bitDepth represents the bit width
  • the value of vx is -32769, and 32767 is obtained by the above formula. Because in the computer, the value is stored in the form of two's complement, the complement of -32769 is 1,0111,1111,1111,1111 (17 bits), the computer handles the overflow as discarding the high bit, then the value of vx If it is 0111,1111,1111,1111, it is 32767, which is consistent with the result obtained by formula processing.
  • vx Clip3(-2 bitDepth-1 , 2 bitDepth-1 -1, vx)
  • vx is the horizontal component of the motion vector of the image block or the sub-block of the image block
  • vy is the vertical component of the motion vector of the image block or the sub-block of the image block
  • x, y, and z respectively correspond to the MV clamp
  • FIG. 4 is a schematic structural diagram of a video decoding device 400 (for example, a video encoding device 400 or a video decoding device 400) provided by an embodiment of the present application.
  • the video coding apparatus 400 is suitable for implementing the embodiments described herein.
  • the video coding device 400 may be a video decoder (eg, decoder 30 of FIG. 1A) or a video encoder (eg, encoder 20 of FIG. 1A).
  • the video decoding device 400 may be one or more components in the decoder 30 of FIG. 1A or the encoder 20 of FIG. 1A described above.
  • the video decoding device 400 includes: an inlet port 410 for receiving data and a receiving unit (Rx) 420, a processor for processing data, a logic unit or a central processing unit (CPU) 430, and a transmitter unit for transmitting data (Tx) 440 and exit port 450, and a memory 460 for storing data.
  • the video decoding device 400 may further include a photoelectric conversion component and an electro-optical (EO) component coupled to the inlet port 410, the receiver unit 420, the transmitter unit 440, and the outlet port 450 for the outlet or inlet of the optical signal or the electrical signal.
  • EO electro-optical
  • the processor 430 is implemented by hardware and software.
  • the processor 430 may be implemented as one or more CPU chips, cores (eg, multi-core processors), FPGA, ASIC, and DSP.
  • the processor 430 communicates with the inlet port 410, the receiver unit 420, the transmitter unit 440, the outlet port 450, and the memory 460.
  • the processor 430 includes a decoding module 470 (for example, an encoding module 470 or a decoding module 470).
  • the encoding/decoding module 470 implements the embodiments disclosed herein to implement the chroma block prediction method provided by the embodiments of the present application. For example, the encoding/decoding module 470 implements, processes, or provides various encoding operations.
  • the encoding/decoding module 470 provides a substantial improvement in the function of the video decoding device 400 and affects the conversion of the video decoding device 400 to different states.
  • the encoding/decoding module 470 is implemented with instructions stored in the memory 460 and executed by the processor 430.
  • the memory 460 includes one or more magnetic disks, tape drives, and solid state drives, and can be used as an overflow data storage device for storing programs when these programs are selectively executed, and storing instructions and data read during the execution of the programs.
  • the memory 460 may be volatile and/or non-volatile, and may be read only memory (ROM), random access memory (RAM), random access memory (ternary content-addressable memory (TCAM), and/or static Random Access Memory (SRAM).
  • FIG. 5 is a simplified block diagram of an apparatus 500 that can be used as either or both of the source device 12 and the destination device 14 in FIG. 1A according to an exemplary embodiment.
  • the device 500 can implement the technology of the present application.
  • FIG. 5 is a schematic block diagram of an implementation manner of an encoding device or a decoding device (referred to simply as a decoding device 500) according to an embodiment of the present application.
  • the decoding device 500 may include a processor 510, a memory 530, and a bus system 550.
  • the processor and the memory are connected through a bus system, the memory is used to store instructions, and the processor is used to execute the instructions stored in the memory.
  • the memory of the decoding device stores program codes, and the processor can call the program codes stored in the memory to perform various video encoding or decoding methods described in this application. In order to avoid repetition, they are not described in detail here.
  • the processor 510 may be a central processing unit (Central Processing Unit, referred to as "CPU"), and the processor 510 may also be other general-purpose processors, digital signal processors (DSPs), dedicated integrated Circuit (ASIC), ready-made programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 530 may include a read only memory (ROM) device or a random access memory (RAM) device. Any other suitable type of storage device may also be used as the memory 530.
  • the memory 530 may include code and data 531 accessed by the processor 510 using the bus 550.
  • the memory 530 may further include an operating system 533 and an application program 535 including at least one program that allows the processor 510 to perform the video encoding or decoding method described in the present application (in particular, the inter prediction method described in the present application).
  • the application program 535 may include applications 1 to N, which further include a video encoding or decoding application that performs the video encoding or decoding method described in this application (referred to as a video coding application for short).
  • the bus system 550 may also include a power bus, a control bus, and a status signal bus. However, for clear explanation, various buses are marked as the bus system 550 in the figure.
  • the decoding device 500 may also include one or more output devices, such as a display 570.
  • the display 570 may be a tactile display that combines the display with a tactile unit that operably senses touch input.
  • the display 570 may be connected to the processor 510 via the bus 550.
  • Video coding mainly includes intra prediction (Intra Prediction), inter prediction (Inter Prediction), transform (Transform), quantization (Quantization), entropy encoding (Entropy encoding), in-loop filtering (in-loop filtering) (mainly Block filtering, de-blocking (filtering) and other links.
  • intra prediction or inter prediction is performed, and after the residual is obtained, transform and quantization are performed, and finally entropy coding is performed and the code stream is output.
  • the coding block is an array of pixels of size (M may be equal to N or may not be equal to N), and the pixel value of each pixel position is known.
  • Intra prediction refers to using the pixel values of pixels in the reconstructed area in the current image to predict the pixel values of pixels in the current coding block.
  • Inter prediction is to find a matching reference block for the current coding block in the current image in the reconstructed image, so as to obtain the motion information of the current coding block, and then calculate the pixel value of the pixel in the current coding block according to the motion information Predicted information or predicted value (the information and value will not be distinguished below).
  • the process of calculating motion information is called motion estimation (ME)
  • the process of calculating the predicted value of the pixel value of the pixel in the current coding block is called motion compensation (Motion compensation, MC).
  • the motion information of the current coding block includes indication information of the prediction direction (usually forward prediction, backward prediction, or bidirectional prediction), one or two motion vectors (Motion vector, MV) pointing to the reference block, And the indication information of the image where the reference block is located (usually referred to as reference frame index, Reference).
  • Forward prediction means that the current coding block selects one reference image from the set of forward reference images to obtain the reference block.
  • Backward prediction means that the current coding block selects a reference image from the set of backward reference images to obtain the reference block.
  • Bidirectional prediction refers to selecting a reference image from a set of forward and backward reference images to obtain a reference block.
  • each reference block needs a motion vector and a reference frame index to indicate, and then determine the pixels in the current block according to the pixel values of the pixels in the two reference blocks The predicted value of the pixel value.
  • the motion estimation process needs to try multiple reference blocks in the reference image for the current coding block, and which one or several reference blocks are ultimately used for prediction is determined using rate-distortion optimization (RDO) or other methods.
  • RDO rate-distortion optimization
  • the pixel value of the pixel in the current coding block is subtracted from the corresponding prediction information to obtain residual information, and then the discrete cosine transform (Discrete Cosine Transformation, DCT) and other methods are used The difference information is transformed, and then quantized entropy coding is used to obtain a code stream. After the prediction signal is added to the reconstructed residual signal, a further filtering operation is required to obtain a reconstructed signal, which is used as a reference signal for subsequent encoding.
  • DCT Discrete Cosine Transformation
  • Decoding is equivalent to the reverse process of encoding. For example, first, entropy decoding, inverse quantization and inverse transformation are used to obtain residual information, and the code stream is decoded to determine whether the current coding block uses intra prediction or inter prediction.
  • intra prediction prediction information is constructed according to the intra prediction method used by using pixel values of pixels in surrounding reconstructed areas. If it is inter prediction, you need to parse out the motion information, and use the parsed motion information to determine the reference block in the reconstructed image, and use the pixel values of the pixels in the block as prediction information. This process is called motion compensation. (Motion compensation, MC).
  • the reconstruction information can be obtained by using the prediction information plus the residual information through a filtering operation.
  • AMVP Advanced Motion Vector Prediction
  • Merge mode Merge mode
  • the motion information of the coded blocks adjacent to the current coding block in the spatial or temporal domain is used to construct a candidate motion vector list, and then the optimal motion vector is determined from the candidate motion vector list as the motion vector of the current coding block Predictor (Motion vector predictor, MVP).
  • MVP Motion vector predictor
  • the motion information of the coded blocks adjacent to the current coding block in the spatial or temporal domain is first constructed to construct a candidate motion information list, and then the optimal motion information is determined as the current coding block from the candidate motion information list through the rate distortion cost The motion information, and then transfer the index value of the optimal motion information in the candidate motion information list (recorded as merge index, the same below) to the decoding end.
  • the candidate motion information of the spatial and temporal domains of the current coding block is shown in Fig. 6.
  • the candidate motion information of the spatial domain comes from the 5 spatially adjacent blocks (A0, A1, B0, B1 and B2). If the adjacent block is not available or it is a frame In the intra coding mode, the candidate motion information list is not added.
  • Time domain candidate motion information of the current coding block is obtained by scaling the MV of the corresponding position block in the reference frame according to the picture order count (POC) of the reference frame and the current frame. First determine whether the block at position T in the reference frame is available. If not, select the block at position C.
  • POC picture order count
  • all pixels in the coding block adopt the same motion information, and then perform motion compensation according to the motion information to obtain the prediction value of the pixels of the coding block.
  • a video sequence contains a certain number of pictures-usually called frames. Adjacent pictures are usually very similar, that is, contain a lot of redundancy.
  • the purpose of using motion compensation is to improve the compression ratio by eliminating such redundancy between adjacent frames.
  • Motion compensation is a method to describe the difference between adjacent frames (adjacent here means adjacent in the coding relationship, and the two frames are not necessarily adjacent in the playback order), and belongs to a part of the inter-frame prediction process. Before doing motion compensation, the motion information of the coding block has been obtained through motion estimation or code stream decoding.
  • the motion information mainly includes: (1) the prediction direction of the coding block: including forward, backward and bidirectional prediction, the forward prediction indicates that the coding block is predicted from the previous encoded frame, and the backward prediction indicates that the coding block is predicted from the following Encoded frame prediction, bidirectional prediction indicates that the encoding block is predicted by combining the forward and backward encoded frames; (2) the reference frame index of the encoding block, indicating the frame where the reference block of the current encoding block is located; (3) the motion of the encoding block
  • the vector MV represents the motion displacement of the coding block relative to the reference block.
  • the MV includes a horizontal component (denoted as MV x ) and a vertical component (denoted as MV y ), which represent the horizontal and vertical directions of the coding block relative to the reference block. Movement displacement.
  • MV x a horizontal component
  • MV y a vertical component
  • Figure 7 gives an explanation of the above motion information.
  • 0 represents the forward direction
  • 1 represents the backward direction.
  • Ref0 represents a forward reference frame
  • Ref1 represents a backward reference frame
  • MV0 represents a forward motion vector
  • MV1 represents a backward motion vector.
  • A, B, and C represent the forward reference block, current coding block, and backward reference block, respectively.
  • Cur is the current coded frame, and the dashed line indicates the movement trajectory of B.
  • Motion compensation is the process of finding the reference block according to the motion information and processing the reference block to obtain the prediction block of the coding block.
  • the prediction blocks obtained by backward prediction and forward prediction motion compensation are called forward prediction block and backward prediction block, respectively.
  • the forward prediction block and backward prediction obtained at this time are obtained.
  • the prediction block is the prediction block of the current coding block.
  • bidirectional prediction For bidirectional prediction, first obtain the forward prediction block and the backward prediction block according to the motion compensation process of the forward prediction and the backward prediction according to the motion information, and then the pixel values of the same position in the forward prediction block and the backward prediction block
  • the prediction block of the coding block B is obtained after weighted prediction or based on bi-directional optical flow technology (Bi-directional optical flow, BIO or BDOF).
  • the weighted prediction method only needs to weight and sum the pixel values of the forward prediction block and the co-located pixel values of the backward prediction block in order to obtain the prediction value of the current coding block, that is,
  • PredB(i,j) ⁇ 0 PredA(i,j)+ ⁇ 1 PredC(i,j) (1)
  • PredB(i,j), PredA(i,j) and PredC(i,j) are the prediction block, forward prediction block and backward prediction block of the current coding block at coordinates (i, j) the predicted value.
  • both ⁇ 0 and ⁇ 1 are 1/2.
  • Fig. 8 shows an example of a weighted sum to obtain the prediction block of the current coding block.
  • PredB, PredA and PredC are the prediction block, forward prediction block and backward prediction block of the current coding block respectively, the size is 4x4, the value of the small block in the prediction block is the prediction value of a certain point, PredB, PredA and PredC Establish the coordinate system with the upper left corner as the origin respectively.
  • the predicted value of PredB at coordinates (0,0) is:
  • PredB(0,0) ⁇ 0 PredA(0,0)+ ⁇ 1 PredC(0,0)
  • PredB(0,1) ⁇ 0 PredA(0,1)+ ⁇ 1 PredC(0,1)
  • the bidirectional prediction weighted prediction technology is simple to calculate, but this block-level motion compensation method is very rough, especially for images with complex textures. The prediction effect is poor, and the compression efficiency is not high.
  • the BIO completes the bidirectional prediction motion compensation in the current CU, obtains the forward and backward prediction blocks, and then derives the corrected motion vector of each 4x4 sub-block in the current CU according to the forward and backward prediction values. Finally, each pixel in the current coding block is compensated again, and finally the prediction block of the current CU is obtained.
  • the modified motion vector (v x , v y ) of each 4x4 sub-block is obtained by applying BIO to the 6x6 window ⁇ around the sub-block, thereby minimizing the predicted values of L0 and L1.
  • (v x , v y ) is derived by the formula.
  • I (k) (i,j) is the predicted value of the (i,j) pixel position in the current CU (k equals 0 or 1,0 means forward, 1 means backward, the same below); with Respectively, the horizontal gradient value and numerical gradient value of (i, j) pixel position are obtained by the following formula:
  • the final predicted value of each pixel in the current block is determined according to the following formula:
  • shift and o offset are 15-BD and 1 ⁇ (14-BD)+2 ⁇ (1 ⁇ 13).
  • rnd(.) is the rounding function (rounded).
  • the forward and backward prediction values I (k) (x, y), horizontal and vertical gradient values of the forward and backward directions of the 6x6 area where it is located need to be used with To calculate the gradient value of the 6x6 area, the predicted value of the 8x8 area needs to be used. Therefore, when the forward and backward prediction values are obtained through the interpolation filter, it is necessary to extend 2 rows and 2 columns to the surroundings to obtain a predicted pixel block with a size of (W+4)*(H+4) in order to calculate (W+2) *(H+2) gradient value, where W is the width of the current CU and H is the height of the current CU.
  • the predicted value of the W*H region is obtained according to the 8-tap filter, and only one row and one column are expanded to the surroundings, and the predicted value of the expanded region is obtained through the bilinear filter, thereby obtaining (W+2)*(H+2) The predicted pixel value of the area.
  • the gradient value of the W*H area can be calculated.
  • the gradient value of the W*H area is expanded to four weeks to obtain the gradient value of the (W+2)*(H+2) area; the predicted value of the W*H area is expanded to four weeks to obtain ( Predicted value of W+2)*(H+2) area.
  • Padding is shown in Figure 9, which assigns the pixel value of the edge to the extended area.
  • BIO The specific implementation process of BIO is as follows:
  • Step 1 Determine the current CU motion information
  • the current CU motion information can be determined in the Merge mode or the AMVP mode (see description in the background art) or other modes, which is not limited herein.
  • Step 2 Determine whether the current CU meets the use conditions of BIO
  • the current CU meets the usage conditions of BIO:
  • step 3 If the current CU meets the BIO usage conditions, go to step 3; otherwise, perform motion compensation in other ways.
  • Step 3 Calculate the forward and backward prediction of the current CU
  • the prediction value of the extended area can also be obtained by other methods, such as the same use of an 8-tap interpolation filter, or the reference pixel of the entire pixel position, which is not limited herein.
  • BIO when calculating the SAD between the forward and backward prediction values, it is judged whether it is smaller than the threshold TH_CU, and if it is smaller, BIO is not executed. Otherwise, execute BIO.
  • Other judgment methods can also be applied to this application, which will not be repeated here.
  • the SAD calculation formula is as follows:
  • the threshold TH_CU can be set to (1 ⁇ (BD–8+shift))*cuW*cuH, and the shift is Max(2,14-BD).
  • Step 4 Calculate the horizontal and vertical gradient values of the forward and backward prediction values of the current CU
  • Step 5 Padding the forward and backward prediction values of the current CU and the gradient values in the horizontal and vertical directions
  • Step 6 Derive the corrected motion vector of each 4x4 sub-block, and then weight
  • vx and vy are obtained according to formula (2), and finally weighted according to formula (6) to obtain the predicted value of each 4x4 sub-block.
  • TU_SCU can be set to 1 ⁇ (BD–3+shift).
  • Virtual pipeline data units are non-overlapping MxM brightness/NxN chroma processing units.
  • consecutive VPDUs are processed simultaneously in different pipeline stages. Different pipeline stages process different VPDUs at the same time.
  • the criteria for dividing VPDU are:
  • the CU is completely included in the VPDU.
  • the VPDU is completely included in the CU.
  • the size of the VPDU is 64x64. As shown in FIG. 10, the broken line indicates the boundary of the VPDU, and the solid line indicates the boundary of the CU. Figure 11 shows the illegal CU division.
  • the hardware decoder splits into continuous VPDUs for processing when processing. For example, if the CU size is 128x128 and the VPDU size is 64x64, four VPDUs are processed in succession.
  • the technical problem to be solved by this application is that when the CU adopts the BIO technology for motion compensation, the processing method of the CU boundary pixels is different from the processing method of the CU internal pixels. If there is a VPDU division boundary within the CU, in order to ensure that the results of the VPDU processing and the CU processing are consistent during the BIO prediction, the boundary needs to be processed according to the internal pixels of the CU, which increases the complexity of implementation.
  • an embodiment of the present application provides an inter prediction method, which can be applied to the inter prediction unit 244 in the encoder shown in FIG. 2 or to the inter prediction in the decoder shown in FIG. 3
  • the method may be a bidirectional inter prediction method, including:
  • Step 101 Select the smallest one from the preset image division width Width and the width cuW of the image block to be processed, and record it as blkW, as the width of the first image block, and divide the height Hight and the image block to be processed from the preset image Choose the smallest one of the heights cuH and record it as blkH as the height of the first image block.
  • the decoder receives a video stream from the encoder, and the video stream includes the image block to be processed.
  • the preset image division width Width and the preset image division height Hight may be equal to the width and height of the VPDU, respectively.
  • the preset image division width Width is a value of 64, 32 or 16
  • the preset image division height Hight is a value of 64, 32 or 16 and the like.
  • Step 102 Determine a plurality of first image blocks in the image block to be processed according to the width blkW and the height blkH of the first image block.
  • the width and height of the image block to be processed are the same as the width and height of the first image block, respectively, that is, the image block to be processed includes only one first image block.
  • Obtaining the prediction value of the first image block is obtaining the prediction value of the image block to be processed.
  • the following steps 103 to 107 are used to obtain the predicted value of the first image block.
  • Step 103 Acquire the first prediction block of the first image block based on the motion information of the image block to be processed.
  • the width of the first prediction block is greater than the width of the first image block, and the height of the first prediction block is greater than the height of the first image block.
  • the motion information of the image block to be processed includes the motion information of the first image block, and the motion information of the first image block includes information such as the reference image and the motion vector.
  • the inter prediction in this implementation adopts a bidirectional prediction method based on optical flow (that is, the BIO or BDOF related technology described above), so the motion information of the first image block includes a forward reference image, a backward reference image, and a forward motion vector And backward motion vectors.
  • the encoder may determine the motion information of the image block to be processed by using the Merge mode, the AMVP mode, or other modes.
  • the motion information of the image block to be processed includes the image block to be processed.
  • the decoder receives the motion information of the image block to be processed included in the video stream from the encoder, and the motion information of the image block to be processed includes each of the image blocks to be processed Motion information of the first image block.
  • the motion information of the image block to be processed is extracted from the video code stream, and the motion information of the first image block is obtained from the motion information of the image block to be processed.
  • the first prediction block of the first image block includes a first forward prediction block and a first backward prediction block.
  • the first forward prediction block and the first backward prediction block of the first image block may be obtained through the following steps (1) to (8).
  • the steps from (1) to (8) can be:
  • the first forward area is determined in the forward reference image, the width of the first forward area is blkW+2, and the height is blkH+2.
  • the motion information of the first image block B includes a forward reference image Ref0, a backward reference image Ref1, a forward motion vector MV0, and a backward motion vector MV1.
  • the second forward area B11 is determined in the forward reference image Ref0 according to the first position of the first image block B.
  • the width of the second forward area B11 is blkW and the height is blkH.
  • the third forward area B12 is determined according to the forward motion vector MV0 and the position of the second forward area B11.
  • the width of the third forward area B12 is blkW and the height is blkH.
  • step (3) In the forward reference image, determine whether the vertex position of the first forward area coincides with the position of the pixel point in the forward reference image, if it coincides with the position of the pixel point in the forward reference image, then from the forward direction
  • the image block located in the first forward area is acquired from the reference image as the first forward prediction block of the first image block; if it does not coincide with the position of the pixel point in the forward reference image, step (3) is performed.
  • the upper left vertex of the first forward area A1 is (15, 16) in the forward reference image Ref0, then the upper left vertex The position of the vertex of is coincident with the position of a pixel in the forward reference image Ref0, which is the pixel at (15, 16) in the forward reference image Ref0.
  • the vertex position of the upper left vertex of the first forward area A1 is (15.3, 16.2)
  • the vertex position of the upper left vertex is not the same as that of the pixels in the forward reference image Ref0
  • the positions coincide, that is to say, there is no pixel at the position (15.3, 16.2) in the forward reference image Ref0.
  • the position of the upper left vertex of the first forward area is taken as an example.
  • determine a pixel point closest to the position of the upper left vertex and use the pixel point as the upper left
  • the apex determines the fourth forward area.
  • the width of the fourth forward area is blkW+2 and the height is blkH+2.
  • the vertex position of the upper left vertex of the first forward area A1 is (15.3, 16.2)
  • the position of the pixel closest to the vertex position (15.3, 16.2) in the forward reference image Ref0 is ( 15, 16)
  • the fourth forward area A2 is determined by taking the pixel position (15, 16) as the upper left vertex
  • the width of the fourth forward area A2 is blkW+2
  • the height is blkH+2.
  • the fifth forward area A3 includes the fourth forward area A2, and the center of the fourth forward area A2 coincides with the center of the fifth forward area A3 ,
  • the width of the fifth forward area A3 is blkW+9, and the height is blkH+9
  • the image block located in the fifth forward area A3 is obtained from the forward reference image Ref0, and the image block is interpolated and filtered using an interpolation filter
  • the first forward prediction block of the first image block B is obtained.
  • the width of the first forward prediction block is blkW+2, and the height is blkH+2.
  • the first backward region is determined in the backward reference image, the width of the first backward region is blkW+2, and the height is blkH+2.
  • the second backward area C11 is determined in the backward reference image Ref1, and the width of the second backward area C11 is blkW and the height is blkH.
  • the third backward area C12 is determined according to the backward motion vector MV1 and the position of the second backward area C11.
  • the width of the third backward area C12 is blkW and the height is blkH.
  • the first backward region D1 including the third backward region C12 is determined.
  • the width of the first backward region D1 is blkW+2, and the height is blkH+2.
  • the center of the third backward region C12 and the center of the first backward region D1 may coincide.
  • step (6) In the backward reference image, determine whether the position of the vertex of the first backward area coincides with the position of the pixel in the backward reference image, if it coincides with the position of the pixel in the backward reference image, Acquire the image block located in the first backward area from the reference image as the first backward prediction block of the first image block; if it does not coincide with the position of the pixel point in the backward reference image, perform step (7).
  • the upper left vertex of the first backward area A1 is (5, 6) in the backward reference image Ref0, then the upper left vertex The position of the vertex of is coincident with the position of a pixel in the backward reference image Ref0, which is the pixel at (5, 6) in the backward reference image Ref0.
  • the vertex position of the upper left vertex of the first backward area D1 is (5.3, 6.2)
  • the vertex position of the upper left vertex is not the same as that of the pixels in the backward reference image Ref0
  • the positions coincide, that is to say, there is no pixel at the position (5.3, 6.2) in the backward reference image Ref0.
  • the position of the upper left vertex of the first backward area is taken as an example.
  • determine a pixel closest to the position of the upper left vertex and use the pixel as the upper left
  • the apex determines the fourth backward area, the width of the fourth backward area is blkW+2, and the height is blkH+2.
  • the vertex position of the upper left vertex of the first backward region D1 is (5.3, 6.2)
  • the position of the pixel closest to the vertex position (5.3, 6.2) in the backward reference image Ref1 is ( 5, 6)
  • the fourth backward area D2 is determined by using the pixel at position (5, 6) as the upper left vertex
  • the width of the fourth backward area D2 is blkW+2
  • the height is blkH+2.
  • the fifth backward area D3 including the fourth backward area D2, the center of the fourth backward area D2 and the center of the fifth backward area D3 coincide ,
  • the width of the fifth backward region D3 is blkW+9, and the height is blkH+9.
  • the image block located in the fifth backward region D3 is obtained from the backward reference image Ref1, and the interpolation block is used to perform interpolation filtering on the image block
  • the first backward prediction block of the first image block B is obtained.
  • the width of the first backward prediction block is blkW+2, and the height is blkH+2.
  • the value of the number of taps n of the interpolation filter may be 6, 8, or 10 and so on.
  • the determination process can be:
  • the preset BIO use condition may be the condition shown in the first formula below.
  • the first formula is (POC_L0-POC_Cur)*(POC_L1-POC_Cur) ⁇ 0;
  • POC_L0 is the frame number of the forward reference image
  • POC_Cur is the frame number of the image block to be processed
  • POC_L1 is the frame number of the backward reference image
  • * is the multiplication operation.
  • step 104 you can also determine whether to use the BIO method for inter prediction based on the first forward prediction block and the first backward prediction block of the first image block.
  • BIO method for inter prediction start Perform the operation in step 104 below.
  • the determination process can be:
  • the SAD is calculated by the following second formula. If the SAD exceeds the preset threshold TH_CU, it is determined that the BIO mode is used for inter prediction, and the operation of the following step 104 is started. If the SAD does not exceed the preset threshold TH_CU, it is determined that the method other than the BIO method is used for inter-frame prediction. The implementation process of other methods is not described in detail here.
  • the second formula is:
  • I (1) (i, j) is the predicted value of the pixel in the i-th row and j-th column in the first backward prediction block
  • I (0) (i, j) is the first front The predicted value of the pixel in the i-th row and j-th column in the prediction block.
  • Step 104 Perform a gradient operation on the first prediction block of the first image block to obtain a first gradient value matrix of the first image block.
  • the width of the first gradient value matrix is blkW and the height is blkH.
  • the first gradient value matrix includes a first forward horizontal gradient value matrix, a first forward vertical gradient value matrix, a first backward horizontal gradient value matrix, and a first backward vertical gradient value matrix.
  • each calculated horizontal gradient value corresponds to a row number and a column number
  • Each calculated vertical gradient value corresponds to a row number and a column number
  • the calculated each horizontal gradient value forms a first horizontal gradient matrix of the first image block
  • the calculated vertical gradient values form a first vertical gradient matrix of the first image block.
  • the predicted values of two pixels are obtained from the first prediction block, and the predicted values of the two pixels are obtained according to The value calculates a horizontal gradient value or a vertical gradient value by the following third formula, the horizontal gradient value corresponds to the row number and the column number respectively, or the vertical gradient value corresponds to the row number and the column number respectively correspond.
  • the first prediction block includes a first forward prediction block and a first backward prediction block.
  • the forward horizontal gradient value and the forward vertical gradient value are calculated by the following third formula;
  • Each forward horizontal gradient value corresponds to a row number and column number, and each calculated forward vertical gradient value corresponds to a row number and column number; according to the calculated row number and column number corresponding to each forward horizontal gradient value, the The calculated forward horizontal gradient values constitute the first forward horizontal gradient matrix of the first image block; according to the row and column numbers of the calculated forward vertical gradient values, the calculated forward vertical gradient values are composed The first forward vertical gradient matrix of the first image block.
  • the backward horizontal gradient value and the backward vertical gradient value are calculated by the following third formula; each calculated backward horizontal gradient value corresponds to a row number and a column number, and each calculated The vertical gradient value corresponds to a row number and column number; according to the row number and column number corresponding to the calculated backward horizontal gradient values, the calculated backward horizontal gradient values form the first backward level of the first image block Gradient matrix; according to the row numbers and column numbers corresponding to the calculated backward vertical gradient values, the calculated backward vertical gradient values form a first backward vertical gradient matrix of the first image block.
  • the third formula is:
  • I (k) (i+1, j) is the predicted value of the pixel in the i+1th row and jth column in the first prediction block.
  • I (k) (i+1,j) Is the predicted value of the pixel in the i+1th row and jth column in the first forward prediction block.
  • I (k) (i+1, j) is the value in the first backward prediction block.
  • I (k) (i-1, j) is the predicted value of the pixel in the i-1th row and jth column of the first prediction block.
  • I (k) (i-1, j) Is the predicted value of the pixel in the i-1th row and jth column in the first forward prediction block.
  • I (k) (i-1, j) is the value in the first backward prediction block. The predicted value of the pixel in the i-1th row and jth column.
  • I (k) (i, j+1) is the predicted value of the pixel in the i-th row and j+1 column in the first prediction block.
  • I (k) (i, j+1) Is the predicted value of the pixel in the i-th row and j+1 column in the first forward prediction block.
  • I (k) (i, j+1) is the value in the first backward prediction block.
  • I (k) (i, j-1) is the predicted value of the pixel in the i-th row and j-1th column in the first prediction block.
  • I (k) (i, j-1) Is the predicted value of the pixel in the i-th row and j-1th column in the first forward prediction block.
  • I (k) (i, j-1) is the value in the first backward prediction block. The predicted value of the pixel in the i-th row and j-1th column.
  • the first gradient value matrix with a width of blkW and a height of blkH can be obtained by the above third formula
  • the first gradient value matrix includes a first horizontal gradient value matrix with a width of blkW and a height of blkH and a first vertical gradient value matrix with a width of blkW and a height of blkH.
  • the first formula with a width of blkW and a height of blkH can be obtained by the above third formula
  • a forward horizontal gradient value matrix, and a first forward vertical gradient value matrix with a width of blkW and a height of blkH is obtained.
  • the first backward horizontal gradient with a width of blkW and a height of blkH can be obtained by the above third formula A value matrix, and a first backward vertical gradient value matrix with a width of blkW and a height of blkH.
  • Step 105 Perform a first expansion on the width and height of the first gradient value matrix based on the gradient value of the matrix edge position of the first gradient value matrix, so that the width and height of the first expanded first gradient value matrix are respectively The distance greater than the width and height of the first image block by 2 pixels.
  • the width and height of the first expanded first gradient value matrix are equal to the width and height of the first prediction block, respectively.
  • the width of the first prediction block is blkW+2, the height is blkH+2, the width of the first gradient value matrix is also blkW+2, and the height is also blkH+2.
  • the width and height of the first forward horizontal gradient value matrix, the first forward vertical gradient value matrix, the first backward horizontal gradient value matrix and the first backward vertical gradient value matrix are respectively An extension such that the widths of the first forward horizontal gradient value matrix, the first forward vertical gradient value matrix, the first backward horizontal gradient value matrix and the first backward vertical gradient value matrix after the first expansion are all blkW+2, the height is blkH+2.
  • the first gradient value matrix includes four edges.
  • the gradient value of the left matrix edge position of the first gradient value matrix the gradient value based on the left matrix edge position is extended on the left side of the first gradient value matrix A list of gradient values;
  • a list of gradient values is extended on the right side of the first gradient value matrix based on the gradient value of the right matrix edge position;
  • the gradient value of the edge position of the upper matrix based on the gradient value of the edge position of the upper matrix, is extended by a row of gradient values on the upper side of the first gradient value matrix;
  • for the gradient value of the edge position of the lower matrix of the first gradient value matrix based on The gradient value of the edge position of the side matrix is extended by a row of gradient values below the first gradient value matrix, so that the width and height of the first expanded first gradient value matrix are larger than the width and height of the first image block, respectively The distance of one pixel.
  • Step 106 Calculate the motion information correction amount of each basic processing unit in the first image block according to the first prediction block and the first gradient value matrix.
  • the width of the basic processing unit may be M, and the height may also be M, that is, the basic processing unit is an image block including M*M pixels.
  • the value of M can be 2, 3 or 4 and so on.
  • the motion information correction amount of the basic processing unit includes a horizontal motion information correction amount and a vertical motion information correction amount.
  • the operations from 1061 to 1064 can be implemented.
  • the operations from 1061 to 1064 can be:
  • the basic prediction block of the basic processing unit is determined from the first prediction block according to the position of the basic processing unit, the width of the basic prediction block is M+2, and the height is M+2.
  • the basic prediction block of the basic processing unit includes a forward basic prediction block and a backward basic prediction block. That is, in the first forward prediction block, the image blocks in the 0th to M+1 rows and the 0th to M+1 columns are used as the forward basic prediction block of the basic processing unit, and in the first backward prediction block The image blocks in the 0th to M+1 rows and the 0th to M+1 columns are used as the backward basic prediction blocks of the basic processing unit.
  • the matrix of rows 0 to M+1 and columns 0 to M+1 in the first gradient value matrix The basic gradient value matrix as the basic processing unit.
  • the basic gradient value matrix of the basic processing unit includes a forward horizontal basic gradient value matrix, a forward vertical basic gradient value matrix, a backward horizontal basic gradient value matrix, and a backward vertical basic gradient value matrix. That is, in the first forward horizontal gradient value matrix, the matrix of the 0th to M+1 rows and the 0th to M+1 columns is taken as the forward horizontal basic gradient value matrix of the basic processing unit. In the vertical gradient value matrix, the matrix of the 0th to M+1 rows and the 0th to M+1 columns is taken as the forward vertical basic gradient value matrix of the basic processing unit, in the first backward horizontal gradient value matrix The matrix of the 0th to M+1 rows and the 0th to M+1 columns is used as the backward horizontal basic gradient value matrix of the basic processing unit. In the first backward vertical gradient value matrix, the 0th to M+1 The matrix of rows and columns 0 to M+1 serves as the matrix of backward vertical basic gradient values of the basic processing unit.
  • the forward basic prediction block the backward basic prediction block, the forward horizontal basic gradient value matrix, the forward vertical horizontal basic gradient value matrix, the backward horizontal basic gradient value matrix and the backward direction of the basic processing unit
  • the horizontal motion information correction amount and the vertical motion information correction amount of the basic processing unit are calculated by the following fourth formula and fifth formula.
  • the fourth formula is:
  • the fifth formula is:
  • v x is the amount of correction of horizontal motion information of the basic processing unit
  • v y is the amount of correction of vertical motion information of the basic processing unit.
  • the motion information correction amount of each basic processing unit included in the first image block can be obtained.
  • Step 107 Obtain the predicted value of the first image block according to the motion information correction amount of each basic processing unit included in the first image block.
  • the predicted value of the first image block includes the predicted value of each pixel in each basic processing unit in the first image block.
  • the horizontal basic gradient value matrix and the backward vertical basic gradient value matrix calculate the predicted value of each pixel included in the basic processing unit by the following sixth formula.
  • the sixth formula is:
  • pred BIO (i, j) is the predicted value of the pixel in the i-th row and j-th column in the basic processing unit.
  • shift 15-BD
  • o offset 1 ⁇ (14-BD)+2 ⁇ (1 ⁇ 13).
  • rnd() is rounded.
  • Step 108 Combine the prediction values of the plurality of first image blocks included in the image block to be processed to obtain the prediction value of the image block to be processed.
  • the above method of inter prediction shown in FIG. 12 can be summarized as the operations of steps 1 to 6 as follows.
  • the operations in steps 1 to 6 can be:
  • Step 1 Determine the current CU motion information
  • the current CU motion information can be determined in the Merge mode or the AMVP mode (see description in the background art) or other modes, which is not limited herein.
  • Step 2 Determine whether the current CU meets the use conditions of BIO
  • the current CU meets the usage conditions of BIO:
  • step 3 If the current CU meets the BIO usage conditions, go to step 3; otherwise, perform motion compensation in other ways.
  • the Min function means taking the minimum value.
  • the CU size is 128x128 and the VPDU size is 64x64, then blkW is 64 and blkH is 64.
  • blkW is 128 and blkH is 32.
  • the CU size is 128x128 and the VPDU size is 32x128, then blkW is 32 and blkH is 128.
  • blkW and blkH can be set according to the following formula.
  • the CU size is 128x128, and the size of the largest inter prediction processing unit is 32x32, then blkW is 32 and blkH is 32.
  • Step 3 Calculate the forward and backward prediction of the current CU
  • the predicted value may be obtained by using the size of the VPDU as the smallest unit obtained by the predicted value, or the block size smaller than the size of the VPDU may be used as the smallest unit obtained by the predicted value, which is not limited.
  • the prediction value of the extended area can also be obtained by other methods, such as the same use of an 8-tap interpolation filter, or the reference pixel of the entire pixel position, which is not limited herein.
  • BIO when calculating the SAD between the forward and backward prediction values, it is judged whether it is smaller than the threshold TH_CU, and if it is smaller, BIO is not executed. Otherwise, execute BIO.
  • Other judgment methods can also be applied to this application, which will not be repeated here.
  • the SAD calculation formula is as follows:
  • the threshold TH_CU can be set to (1 ⁇ (BD–8+shift))*blkW*blkH, and the shift is Max(2,14-BD).
  • Step 4 Calculate the horizontal and vertical gradient values of the forward and backward prediction values of the current CU
  • Step 5 Padding the forward and backward prediction values of the current CU and the gradient values in the horizontal and vertical directions
  • Step 6 Derive the corrected motion vector of each 4x4 sub-block, and then weight
  • vx and vy are obtained according to formula (2), and finally weighted according to formula (6) to obtain the predicted value of each 4x4 sub-block.
  • TU_SCU can be set to 1 ⁇ (BD–3+shift).
  • the height Hight and the height of the image block to be processed are divided from the preset image Choose a smaller height, denoted as blkH, and determine the first image block included in the image block to be processed according to blkW and blkH, so as to avoid the determination of the larger area of each first image block.
  • an embodiment of the present application provides an inter prediction method, which can be applied to the inter prediction unit 244 in the encoder shown in FIG. 2 or to the inter prediction in the decoder shown in FIG. 3
  • the method may be a bidirectional inter prediction method, including:
  • Steps 201-202 the same as steps 101-102, and will not be described in detail here.
  • Step 203 Acquire the first prediction block of the first image block based on the motion information of the image block to be processed.
  • the width of the first prediction block is equal to the width of the first image block
  • the height of the first prediction block is equal to the height of the first image block.
  • the motion information of the first image block includes information such as reference image and motion vector.
  • the inter prediction in this embodiment adopts a bidirectional prediction method based on optical flow, so the motion information of the first image block includes information such as a forward reference image, a backward reference image, a forward motion vector, and a backward motion vector.
  • the encoder may determine the motion information of the image block to be processed by using the Merge mode, the AMVP mode, or other modes.
  • the motion information of the image block to be processed includes the image block to be processed.
  • the decoder receives the motion information of the image block to be processed included in the video stream from the encoder, and the motion information of the image block to be processed includes each of the image blocks to be processed Motion information of the first image block.
  • the motion information of the image block to be processed is extracted from the video code stream, and the motion information of the first image block is obtained from the motion information of the image block to be processed.
  • the first prediction block of the first image block includes a first forward prediction block and a first backward prediction block.
  • the first forward prediction block and the first backward prediction block of the first image block may be obtained through the following steps (1) to (8).
  • the steps from (1) to (8) can be:
  • the first forward area is determined in the forward reference image, the width of the first forward area is equal to blkW, and the height is equal to blkH.
  • the motion information of the first image block B includes a forward reference image Ref0, a backward reference image Ref1, a forward motion vector MV0, and a backward motion vector MV1.
  • a second forward area B11 is determined in the forward reference image Ref0, the width of the second forward area B11 is blkW, and the height is blkH.
  • the first forward area B12 is determined according to the forward motion vector MV0 and the position of the second forward area B11.
  • the width of the first forward area B12 is blkW and the height is blkH.
  • step (3) In the forward reference image, determine whether the vertex position of the first forward area coincides with the position of the pixel point in the forward reference image, if it coincides with the position of the pixel point in the forward reference image, then from the forward direction
  • the image block located in the first forward area is acquired from the reference image as the first forward prediction block of the first image block; if it does not coincide with the position of the pixel point in the forward reference image, step (3) is performed.
  • the upper left vertex of the first forward area B12 is (15, 16) in the forward reference image Ref0, then the upper left The position of the vertex of the vertex coincides with the position of a pixel in the forward reference image Ref0, which is the pixel at (15, 16) in the forward reference image Ref0.
  • the vertex position of the upper left vertex of the first forward area B12 is (15.3, 16.2)
  • the vertex position of the upper left vertex is not the same as that of the pixels in the forward reference image Ref0
  • the positions coincide, that is to say, there is no pixel at the position (15.3, 16.2) in the forward reference image Ref0.
  • the third forward area has a width of blkW and a height of blkH.
  • the vertex position of the upper left vertex of the first forward area B12 is (15.3, 16.2)
  • the position of a pixel closest to the vertex position (15.3, 16.2) in the forward reference image Ref0 is ( 15, 16)
  • the third forward area A1 is determined by using the pixel at position (15, 16) as the upper left vertex.
  • the width of the third forward area A1 is blkW and the height is blkH.
  • the width of the fourth forward area A2 is blkW+7, and the height is blkH+7.
  • the image block located in the fourth forward area A2 is obtained from the forward reference image Ref0, and the image block is interpolated and filtered using an interpolation filter
  • the first forward prediction block of the first image block B is obtained.
  • the width of the first forward prediction block is blkW, and the height is blkH.
  • the first backward region is determined in the backward reference image, the width of the first backward region is blkW, and the height is blkH.
  • the second backward area C11 is determined in the backward reference image Ref1, and the width of the second backward area C11 is blkW and the height is blkH.
  • the first backward region C12 is determined according to the backward motion vector MV1 and the position of the second backward region C12.
  • the width of the first backward region C12 is blkW and the height is blkH.
  • step (6) In the backward reference image, determine whether the position of the vertex of the first backward area coincides with the position of the pixel in the backward reference image, if it coincides with the position of the pixel in the backward reference image, Acquire the image block located in the first backward area from the reference image as the first backward prediction block of the first image block; if it does not coincide with the position of the pixel point in the backward reference image, perform step (7).
  • the vertex position of the upper left vertex of the first backward region C12 is (5, 6)
  • the upper left The position of the vertex of the vertex coincides with the position of a pixel in the backward reference image Ref1
  • the pixel is the pixel with the position (5, 6) in the backward reference image Ref1.
  • the vertex position of the upper left vertex of the first backward area C12 is (5.3, 6.2)
  • the vertex position of the upper left vertex is not the same as that of the pixels in the backward reference image Ref0
  • the positions coincide, that is to say, there is no pixel at the position (5.3, 6.2) in the backward reference image Ref0.
  • the third backward region has a width of blkW and a height of blkH.
  • the vertex position of the upper left vertex of the first backward region C12 is (5.3, 6.2)
  • the position of the pixel closest to the vertex position (5.3, 6.2) in the backward reference image Ref1 is ( 5, 6)
  • the third backward area D1 is determined by using the pixel at position (5, 6) as the upper left vertex.
  • the width of the third backward area D1 is blkW and the height is blkH.
  • the fourth backward area D2 includes the third backward area D1, and the center of the third backward area D1 coincides with the center of the fourth backward area D2 ,
  • the width of the fourth backward region D2 is blkW+7, and the height is blkH+7, and the image block located in the fourth backward region D2 is obtained from the backward reference image Ref1, and the image block is interpolated and filtered using an interpolation filter
  • the first backward prediction block of the first image block B is obtained.
  • the width of the first backward prediction block is blkW, and the height is blkH.
  • step 103 When performing this step, you can also determine whether to use the BIO method for inter prediction according to the motion information of the image block to be processed. When you determine to use the BIO method for inter prediction, start performing this step. For the determination process, reference may be made to the relevant content in step 103 in the embodiment shown in FIG. 12, and details are not described herein again.
  • step 204 you can also determine whether to use the BIO method for inter prediction based on the first forward prediction block and the first backward prediction block of the first image block.
  • Step 204 Perform a gradient operation on the first prediction block of the first image block to obtain a first gradient value matrix of the first image block, the width of the first gradient value matrix is blkW-2, and the height of the first gradient value matrix is blkH -2.
  • the first gradient value matrix includes a first forward horizontal gradient value matrix, a first forward vertical gradient value matrix, a first backward horizontal gradient value matrix, and a first backward vertical gradient value matrix.
  • the width of the first forward horizontal gradient value matrix, the width of the first forward vertical gradient value matrix, the width of the first backward horizontal gradient value matrix and the width of the first backward vertical gradient value matrix may all be blkW- 2.
  • the height of the first forward horizontal gradient value matrix, the height of the first forward vertical gradient value matrix, the height of the first backward horizontal gradient value matrix and the height of the first backward vertical gradient value matrix may all be blkH-2.
  • step 104 for the detailed implementation process of performing the gradient operation on the first prediction block of the first image block, reference may be made to the relevant content in step 104 in the embodiment shown in FIG. 12, and details are not described herein again.
  • Step 205 Based on the gradient value of the matrix edge position of the first gradient value matrix, perform a first expansion on the width and height of the first gradient value matrix, so that the width and height of the first expanded first gradient value matrix are respectively The distance greater than the width and height of the first image block by 2 pixels.
  • the width and height of the first expanded first gradient value matrix are respectively the width blkW+2 of the first prediction block, and the height is blkH+2.
  • the width and height of the first forward horizontal gradient value matrix, the first forward vertical gradient value matrix, the first backward horizontal gradient value matrix and the first backward vertical gradient value matrix are respectively An extension such that the widths of the first forward horizontal gradient value matrix, the first forward vertical gradient value matrix, the first backward horizontal gradient value matrix and the first backward vertical gradient value matrix after the first expansion are all blkW+2, the height is blkH+2.
  • Step 206 Copy the pixel value of the block edge position of the first prediction block to perform a second expansion on the width and height of the first prediction block, the width of the first prediction block after the second expansion is blkW+2, height It is blkH+2.
  • the pixel value of the block edge position of the first forward prediction block is copied, and the pixel value of the block edge position of the first backward prediction block is copied to determine the width of the first forward prediction block Perform a second extension on the height and height, and perform a second extension on the width and height of the first backward prediction block. That is, in this step, the width and height of the first extended prediction block after the second extension are blkW+2 and blkH+2, respectively, and the width and height of the first extended prediction block after the second extension are blkW+ 2 and blkH+2.
  • the pixel values of the block edge area of the first prediction block may also be interpolated and filtered to perform a second expansion on the width and height of the first prediction block.
  • step 203 if the image block with a width of blkW and a height of blkH in the reference image is directly used as the first prediction block of the first image block, that is, referring to FIG. 15, in the forward reference image Ref0
  • the image block in the first forward area B12 is used as the first forward prediction block
  • the image block in the first backward area C12 is used as the first backward prediction block in the backward reference picture Ref1.
  • the first prediction block is an image block in the reference image.
  • a circle of pixels around the first prediction block that is closest to the first prediction block is selected in the reference image.
  • the first prediction block form a second expanded first prediction block with a width of blkW+2 and a height of blkH+2.
  • the first prediction block of the first image block is obtained through an interpolation filter.
  • the first prediction block is not an image block in the reference image.
  • the edge is called the first edge.
  • the second position of each pixel included in the second edge is obtained.
  • the two edges are located outside the first prediction block, the second edge is different from the first edge by one pixel, and the second edge includes blkW+2 pixels or blkH+2 pixels.
  • the second position of the pixel is between two adjacent pixels or between four adjacent pixels.
  • each edge corresponding to each edge of the first prediction block is obtained in the above manner, and each obtained second edge and the first prediction block form a second expanded second block with a width of blkW+2 and a height of blkH+2 One prediction block.
  • Step 206 can also be performed before step 204, so that when the second expanded first prediction block is obtained, the gradient value operation can be performed on the second expanded first prediction block to obtain the first image block
  • the width of the first expanded prediction block after the second expansion is blkW+2 and the height is blkH+2
  • the width of the first gradient value matrix is blkW and the height is blkH.
  • the width and height of the first gradient value matrix are first expanded, so that the width and height of the first gradient value matrix after the first expansion are respectively The width and height of an image block are two pixels away.
  • Steps 207-209 the same as steps 106-108 respectively, and will not be described in detail here.
  • the above method of inter prediction shown in FIG. 16 can be summarized as the operations of steps 1 to 6 as follows.
  • the operations in steps 1 to 6 can be:
  • Step 1 Determine the current CU motion information
  • the current CU motion information can be determined in the Merge mode or the AMVP mode (see description in the background art) or other modes, which is not limited herein.
  • Step 2 Determine whether the current CU meets the use conditions of BIO
  • the current CU meets the usage conditions of BIO:
  • step 3 If the current CU meets the BIO usage conditions, go to step 3; otherwise, perform motion compensation in other ways.
  • the CU size is 128x128 and the VPDU size is 64x64, then blkW is 64 and blkH is 64.
  • blkW is 128 and blkH is 32.
  • the CU size is 128x128 and the VPDU size is 32x128, then blkW is 32 and blkH is 128.
  • blkW and blkH can be set according to the following formula.
  • the CU size is 128x128, and the size of the largest inter prediction processing unit is 32x32, then blkW is 32 and blkH is 32.
  • Step 3 Calculate the forward and backward prediction of the current CU
  • the predicted value may be obtained by using the size of the VPDU as the smallest unit obtained by the predicted value, or the block size smaller than the size of the VPDU may be used as the smallest unit obtained by the predicted value, which is not limited.
  • Step 4 Calculate the horizontal and vertical gradient values of the forward and backward prediction values of the current CU
  • Step 5 Padding the forward and backward prediction values of the current CU and the gradient values in the horizontal and vertical directions
  • Step 6 Derive the corrected motion vector of each 4x4 sub-block, and then weight
  • vx and vy are obtained according to formula (2), and finally weighted according to formula (6) to obtain the predicted value of each 4x4 sub-block.
  • the height Hight and the height of the image block to be processed are divided from the preset image Choose a smaller height, denoted as blkH, and determine the first image block included in the image block to be processed according to blkW and blkH, so as to avoid the determination of the larger area of each first image block.
  • a large amount of memory space is reduced.
  • the first prediction block of the first image block is obtained according to the motion information of the first image block.
  • the first prediction block can be made smaller, which can reduce hardware resources such as CPU resources and memory resources consumed by acquiring the first prediction block, reduce implementation complexity, and improve processing efficiency.
  • an embodiment of the present application provides an inter prediction method, which can be applied to the inter prediction unit 244 in the encoder shown in FIG. 2 or to the inter prediction in the decoder shown in FIG. 3
  • the method may be a bidirectional inter prediction method, including:
  • Step 301 Compare the width cuW of the first image block with the preset image division width Width, and compare the height cuH of the first image block with the preset image division height Hight, where cuW is greater than or equal to Width and/or cuH is greater than or equal to When Hight, step 302 is executed, and when cuW is less than Width and cuH is less than Hight, step 305 is executed.
  • the encoder divides the image into first image blocks when encoding the image. Before this step, the first image block is obtained from the encoder.
  • the decoder receives a video code stream from the encoder, the video code stream including the first image block. Before this step, the first image block is extracted from the video code stream.
  • BIO mode for inter prediction it may also be determined whether to use the BIO mode for inter prediction according to the motion information of the first image block. After determining to use the BIO method for inter prediction, start the operation of this step.
  • BIO method for inter prediction start the operation of this step.
  • Step 302 Acquire the second prediction block of the first image block based on the motion information of the first image block.
  • the width of the second prediction block is cuW+4, and the height is cuH+4.
  • the motion information of the first image block includes information such as reference image and motion vector.
  • the inter prediction in this embodiment adopts a bidirectional prediction method based on optical flow, so the motion information of the first image block includes information such as a forward reference image, a backward reference image, a forward motion vector, and a backward motion vector.
  • the encoder may determine the motion information of the first image block by using the Merge mode, the AMVP mode, or other modes. In this step, the motion information of the first image block determined by the encoder is obtained.
  • the decoder receives motion information including the first image block in the video code stream from the encoder. In this step, the motion information of the first image block is extracted from the video code stream.
  • the second prediction block of the first image block includes a second forward prediction block and a second backward prediction block.
  • the second forward prediction block and the second backward prediction block of the first image block may be obtained through the following steps (1) to (8).
  • the steps from (1) to (8) can be:
  • the first forward area is determined in the forward reference image, the width of the first forward area is blkW+4, and the height is blkH+4.
  • the motion information of the first image block B includes a forward reference image Ref0, a backward reference image Ref1, a forward motion vector MV0, and a backward motion vector MV1.
  • the second forward area B11 is determined in the forward reference image Ref0 according to the first position of the first image block B, the width of the second forward area B11 is blkW, and the height is blkH.
  • the third forward area B12 is determined according to the forward motion vector MV0 and the position of the second forward area B11.
  • the width of the third forward area B12 is blkW and the height is blkH.
  • step (3) In the forward reference image, determine whether the vertex position of the first forward area coincides with the position of the pixel point in the forward reference image, if it coincides with the position of the pixel point in the forward reference image, then from the forward direction
  • the image block located in the first forward area is obtained from the reference image as the second forward prediction block of the first image block; if it does not coincide with the position of the pixel point in the forward reference image, step (3) is performed.
  • the vertex position of the upper left vertex of the first forward area A1 is (15.3, 16.2)
  • the vertex position of the upper left vertex is not the same as that of the pixels in the forward reference image Ref0
  • the positions coincide, that is to say, there is no pixel at the position (15.3, 16.2) in the forward reference image Ref0.
  • the fourth forward area has a width of blkW+4 and a height of blkH+4.
  • the vertex position of the upper left vertex of the first forward area A1 is (15.3, 16.2), and the position of the pixel closest to the vertex position (15.3, 16.2) in the forward reference image Ref0 is ( 15, 16).
  • the fourth forward area A2 is determined by using the pixel at position (15, 16) as the upper left vertex.
  • the width of the fourth forward area A2 is blkW+4, and the height is blkH+4.
  • the width of the forward prediction block is blkW+4, the height is blkH+4, and n is the number of taps of the interpolation filter.
  • the fifth forward area A3 includes the fourth forward area A2, and the center of the fourth forward area A2 coincides with the center of the fifth forward area A3 ,
  • the width of the fifth forward area A3 is blkW+11, and the height is blkH+11.
  • the image block located in the fifth forward area A3 is obtained from the forward reference image Ref0, and the image block is interpolated and filtered using an interpolation filter
  • the second forward prediction block of the first image block B is obtained.
  • the width of the second forward prediction block is blkW+4, and the height is blkH+4.
  • the first backward region is determined in the backward reference image, the width of the first backward region is blkW+4, and the height is blkH+4.
  • the second backward area C11 is determined in the backward reference image Ref1, and the width of the second backward area C11 is blkW and the height is blkH.
  • the third backward area C12 is determined according to the backward motion vector MV1 and the position of the second backward area C11.
  • the width of the third backward area C12 is blkW and the height is blkH.
  • the first backward region D1 including the third backward region C12 is determined.
  • the width of the first backward region D1 is blkW+4 and the height is blkH+4.
  • the center of the third backward region C12 and the center of the first backward region D1 may coincide.
  • step (6) In the backward reference image, determine whether the position of the vertex of the first backward area coincides with the position of the pixel in the backward reference image, if it coincides with the position of the pixel in the backward reference image, Acquire the image block located in the first backward area from the reference image as the second backward prediction block of the first image block; if it does not coincide with the position of the pixel point in the backward reference image, perform step (7).
  • the vertex position of the upper left vertex of the first backward area D1 is (5.3, 6.2)
  • the vertex position of the upper left vertex is not the same as that of the pixels in the backward reference image Ref0
  • the positions coincide, that is to say, there is no pixel at the position (5.3, 6.2) in the backward reference image Ref0.
  • the fourth backward region has a width of blkW+4 and a height of blkH+4.
  • the vertex position of the upper left vertex of the first backward region D1 is (5.3, 6.2)
  • the position of the pixel closest to the vertex position (5.3, 6.2) in the backward reference image Ref1 is ( 5, 6)
  • the fourth backward area D2 is determined by taking the pixel position (5, 6) as the upper left vertex
  • the width of the fourth backward area D2 is blkW+4
  • the height is blkH+4.
  • the fifth backward area D3 including the fourth backward area D2, the center of the fourth backward area D2 and the center of the fifth backward area D3 coincide
  • the width of the fifth backward region D3 is blkW+11, and the height is blkH+11, and the image block located in the fifth backward region D3 is obtained from the backward reference image Ref1, and the image block is interpolated and filtered using an interpolation filter
  • the second backward prediction block of the first image block B is obtained.
  • the width of the second backward prediction block is blkW+4, the height is blkH+4, and n is the number of taps of the interpolation filter.
  • Step 303 Perform a gradient operation on the second prediction block of the first image block to obtain a first gradient value matrix of the first image block.
  • the width of the first gradient value matrix is cuW+2, and the height is cuH+2.
  • the first gradient value matrix includes a first forward horizontal gradient value matrix, a first forward vertical gradient value matrix, a first backward horizontal gradient value matrix, and a first backward vertical gradient value matrix.
  • the gradient operation is performed on the second prediction block of the first image block to obtain the detailed implementation process of the first gradient value matrix.
  • step 104 in the embodiment shown in FIG. 12 The detailed process will not be described in detail here.
  • the first prediction block includes a second forward prediction block and a second backward prediction block.
  • a second forward horizontal gradient matrix and a width of cuW+2 and a height of cuH+2 can be obtained
  • the second forward vertical gradient matrix is cuW+2 and the height is cuH+2.
  • a second backward horizontal gradient matrix with a width of cuW+2 and a height of cuH+2 and a second backward vertical gradient matrix with a width of cuW+2 and a height of cuH+2 can be obtained .
  • Step 304 Determine the first prediction block of the first image block in the second prediction block.
  • the width of the first prediction block is cuW+2 and the height is cuH+2.
  • Step 308 is executed.
  • the center of the first prediction block and the center of the second prediction block coincide.
  • the first prediction block includes a first forward prediction block and a first backward prediction block.
  • the first forward prediction block with a width of cuW+2 and a height of cuH+2 is determined in the second forward prediction block; the first image is determined in the second backward prediction block The first backward prediction block with a width of cuW+2 and a height of cuH+2.
  • Step 305 Acquire the first prediction block of the first image block based on the motion information of the first image block.
  • the width of the first prediction block is cuW+2, and the height of the first prediction block is cuH+2.
  • step 103 for the detailed process of acquiring the first prediction block, reference may be made to the relevant content in step 103 in the embodiment shown in FIG. 12, and no more detailed description is provided here.
  • Step 306 Perform a gradient operation on the first prediction block of the first image block to obtain a first gradient value matrix of the first image block.
  • the first gradient value matrix has a width of cuW and a height of cuH.
  • the first gradient value matrix includes a first forward horizontal gradient value matrix, a first forward vertical gradient value matrix, a first backward horizontal gradient value matrix, and a first backward vertical gradient value matrix.
  • step 104 For the detailed implementation process of this step, reference may be made to the relevant content in step 104 in the embodiment shown in FIG. 12, and details are not described here.
  • Step 307 Based on the gradient value at the edge position of the matrix of the first gradient value matrix, perform a first expansion on the width and height of the first gradient value matrix, so that the width and height of the first expanded first gradient value matrix are respectively The distance greater than the width and height of the first image block by 2 pixels.
  • step 105 For the detailed implementation process of this step, reference may be made to the relevant content in step 105 in the embodiment shown in FIG. 12, and details are not described here.
  • Steps 308-310 the same as steps 106-108, and will not be described in detail here.
  • the above method of inter prediction shown in FIG. 15 can be summarized as the operations of steps 1 to 6 as follows.
  • the operations in steps 1 to 6 can be:
  • Step 1 Determine the current CU motion information
  • the current CU motion information can be determined in the Merge mode or the AMVP mode (see description in the background art) or other modes, which is not limited herein.
  • Step 2 Determine whether the current CU meets the use conditions of BIO
  • the current CU meets the usage conditions of BIO:
  • step 3 If the current CU meets the BIO usage conditions, go to step 3; otherwise, perform motion compensation in other ways.
  • Step 3 Calculate the forward and backward prediction of the current CU
  • the predicted value may be obtained by using the size of the VPDU as the smallest unit obtained by the predicted value, or the block size smaller than the size of the VPDU may be used as the smallest unit obtained by the predicted value, which is not limited.
  • the prediction value of the extended area can also be obtained by other methods, such as the same use of an 8-tap interpolation filter, or the reference pixel of the entire pixel position, which is not limited herein.
  • BIO when calculating the SAD between the forward and backward prediction values, it is judged whether it is smaller than the threshold TH_CU, and if it is smaller, BIO is not executed. Otherwise, execute BIO.
  • Other judgment methods can also be applied to this application, which will not be repeated here.
  • the SAD calculation formula is as follows:
  • the threshold TH_CU can be set to (1 ⁇ (BD–8+shift))*cuW*cuH, and the shift is Max(2,14-BD).
  • Step 4 Calculate the horizontal and vertical gradient values of the forward and backward prediction values of the current CU
  • Step 5 If cuW is less than VPDU_X and cuH is less than VPDU_Y, Padding the forward and backward prediction values of the current CU and the gradient values in the horizontal and vertical directions
  • Step 6 Derive the corrected motion vector of each 4x4 sub-block, and then weight
  • vx and vy are obtained according to formula (2), and finally weighted according to formula (6) to obtain the predicted value of each 4x4 sub-block.
  • TU_SCU can be set to 1 ⁇ (BD–3+shift).
  • the BIO prediction is performed in the same manner as the CU boundary.
  • the CU includes multiple VPDUs, the complexity of implementing motion compensation prediction is reduced.
  • the second prediction block of the first image block is obtained according to the motion information of the first image block, because the width of the second prediction block cuW+4, the height is cuH+4, so: perform the gradient operation on the second prediction block of the first image block to obtain a first gradient value matrix with a width of cuW+2 and a height of cuH+2, so that the The edges of the first gradient value matrix are expanded to improve the efficiency of inter-frame prediction.
  • FIG. 17 is a schematic method flowchart of an embodiment of the present application. As shown in the figure, a method for inter prediction is provided, including:
  • S1201 Obtain motion information of an image block to be processed, the image block to be processed includes a plurality of virtual pipeline data units, and the virtual pipeline data unit includes at least one basic processing unit;
  • S1203 Calculate a horizontal prediction gradient matrix and a vertical prediction gradient matrix of each virtual pipeline data unit according to each prediction value matrix;
  • S1204 Calculate the motion information correction amount of each basic processing unit in each virtual pipeline data unit according to the predicted value matrix, the horizontal predicted gradient matrix, and the vertical predicted gradient matrix.
  • the obtaining the predicted value matrix of each virtual pipeline data unit according to the motion information includes: obtaining the initial value of each virtual pipeline data unit according to the motion information A prediction matrix, the initial prediction matrix and the virtual pipeline data unit are equal in size; the initial prediction matrix is used as the prediction value matrix.
  • the method further includes: performing pixel expansion on edges of the initial prediction matrix to obtain an extended prediction matrix.
  • the size of the extended prediction matrix is larger than the size of the initial prediction matrix; correspondingly, using the initial prediction matrix as the predicted value matrix includes: using the extended prediction matrix as the predicted value matrix.
  • the pixel expansion of the edge of the initial prediction matrix includes: obtaining pixel points outside the initial prediction matrix based on pixel value interpolation of pixels in the initial prediction matrix The pixel value of, or the pixel value of the pixel point on the edge of the initial prediction matrix is used as the pixel value of the pixel point adjacent to the edge outside the initial prediction matrix.
  • the virtual pipeline data unit includes a plurality of motion compensation units
  • obtaining the predicted value matrix of each virtual pipeline data unit according to the motion information includes: according to the motion Information, obtain a compensation value matrix for each of the motion compensation units; combine the compensation value matrices of the plurality of motion compensation units to obtain the predicted value matrix.
  • the calculating the horizontal prediction gradient matrix and the vertical prediction gradient matrix of each virtual pipeline data unit according to each prediction value matrix includes: performing the prediction value matrix Horizontal gradient calculation and vertical gradient calculation to obtain the horizontal prediction gradient matrix and the vertical prediction gradient matrix, respectively.
  • the calculation of the basic processing unit of each virtual pipeline data unit according to the predicted value matrix, the horizontal prediction gradient matrix and the vertical prediction gradient matrix Before the motion information correction amount, it further includes: performing pixel expansion on the edges of the predicted value matrix to obtain a filled prediction matrix, the filled prediction matrix having a preset size; and the edge of the horizontal prediction gradient matrix and the The edges of the vertical prediction gradient matrix are respectively expanded by gradient values to obtain a filled horizontal gradient matrix and a filled vertical gradient matrix, and the filled horizontal gradient matrix and the filled vertical gradient matrix have the preset sizes respectively; corresponding ,
  • the calculating the motion information correction amount of each basic processing unit in each virtual pipeline data unit according to the predicted value matrix, the horizontal predicted gradient matrix, and the vertical predicted gradient matrix includes: The filling prediction matrix, the filling horizontal gradient matrix, and the filling vertical gradient matrix, and calculating the motion information correction amount of each basic processing unit in each of the virtual pipeline data units.
  • the method before the pixel expansion of the edge of the predicted value matrix, the method further includes: determining that the size of the predicted value matrix is smaller than the preset size.
  • the method before the gradient value expansion is performed on the edge of the horizontal prediction gradient matrix and the edge of the vertical prediction gradient matrix, the method further includes: determining the size of the horizontal prediction gradient matrix And/or the size of the vertical prediction gradient matrix is smaller than the preset size.
  • the method further includes: according to the virtual pipeline data unit's The predicted value matrix and the motion correction amount of each of the basic processing units in the virtual pipeline data unit obtain the predicted value of each of the basic processing units.
  • the method is used for bidirectional prediction; correspondingly, the motion information includes first reference frame list motion information and second reference frame list motion information; and the prediction value matrix includes first prediction A value matrix and a second predicted value matrix, the first predicted value matrix is obtained according to the first reference frame list motion information, the second predicted value matrix is obtained according to the second reference frame list motion information; the level The prediction gradient matrix includes a first horizontal prediction gradient matrix and a second horizontal prediction gradient matrix, the first horizontal prediction gradient matrix is calculated according to the first prediction value matrix, and the second horizontal prediction gradient matrix is based on the second The prediction value matrix is calculated and obtained; the vertical prediction gradient matrix includes a first vertical prediction gradient matrix and a second vertical prediction gradient matrix, and the first vertical prediction gradient matrix is calculated and obtained according to the first prediction value matrix, The second vertical prediction gradient matrix is calculated according to the second prediction value matrix; the motion information correction amount includes a first reference frame list motion information correction amount and a second reference frame list motion information correction amount, the first A reference frame list motion information correction amount is calculated according to the first prediction value
  • the method before the pixel expansion of the edge of the initial prediction matrix, the method further includes: determining that the time domain position of the image frame where the image block to be processed is located is in the first reference Between the first reference frame indicated by the frame list motion information and the second reference frame indicated by the second reference frame list motion information.
  • the method further includes: determining that the difference between the first predicted value matrix and the second predicted value matrix is less than the first A threshold.
  • the motion information correction amount of the basic processing unit corresponds to a basic predicted value matrix in the predicted value matrix, and in the prediction gradient matrix based on the predicted value matrix and the level
  • the vertical prediction gradient matrix before calculating the motion information correction amount of each of the basic processing units in each of the virtual pipeline data units, further includes: determining the first basic prediction value matrix and the second basic The difference of the predicted value matrix is smaller than the second threshold.
  • the size of the basic processing unit is 4x4.
  • the width of the virtual pipeline data unit is W and the height is H
  • the size of the extended prediction matrix is (W+n+2)x(H+n+2), corresponding to
  • the size of the horizontal prediction gradient matrix is (W+n)x(H+n)
  • the size of the vertical prediction gradient matrix is (W+n)x(H+n), where W, H are Positive integer, n is even.
  • n 0, 2, or -2.
  • the motion information of the image block to be processed before acquiring the motion information of the image block to be processed, it further includes: determining that the image block to be processed includes the plurality of virtual pipeline data units.
  • FIG. 18 is a schematic method flowchart of an embodiment of the present application. As shown in the figure, an apparatus for inter prediction is provided, including:
  • the obtaining module 1301 is configured to obtain motion information of an image block to be processed, the image block to be processed includes a plurality of virtual pipeline data units, and the virtual pipeline data unit includes at least one basic processing unit;
  • the compensation module 1302 is configured to obtain a prediction value matrix of each virtual pipeline data unit according to the motion information
  • the calculation module 1303 is configured to calculate a horizontal prediction gradient matrix and a vertical prediction gradient matrix of each virtual pipeline data unit according to each prediction value matrix;
  • the correction module 1304 is configured to calculate the motion information correction amount of each basic processing unit in each virtual pipeline data unit according to the prediction value matrix, the horizontal prediction gradient matrix, and the vertical prediction gradient matrix .
  • the compensation module 1302 is specifically configured to obtain an initial prediction matrix of each virtual pipeline data unit according to the motion information, the initial prediction matrix and the virtual pipeline data unit The sizes are equal; the initial prediction matrix is used as the prediction value matrix.
  • the compensation module 1302 is specifically configured to: perform pixel expansion on the edge of the initial prediction matrix to obtain an extended prediction matrix, and the size of the extended prediction matrix is larger than the initial prediction matrix The size of the prediction matrix as the prediction value matrix.
  • the compensation module 1302 is specifically configured to: obtain pixel values of pixels outside the initial prediction matrix based on pixel value interpolation of pixels within the initial prediction matrix, or The pixel values of the pixels on the edge of the initial prediction matrix are taken as the pixel values of the pixels adjacent to the edge outside the initial prediction matrix.
  • the virtual pipeline data unit includes multiple motion compensation units, and the compensation module is specifically configured to: obtain a compensation value matrix for each of the motion compensation units according to the motion information; The compensation value matrix of the plurality of motion compensation units obtains the prediction value matrix.
  • the calculation module 1303 is specifically configured to: perform horizontal gradient calculation and vertical gradient calculation on the predicted value matrix to obtain the horizontal predicted gradient matrix and the vertical predicted gradient, respectively matrix.
  • a filling module 1305 is further included, which is used to: perform pixel expansion on the edge of the predicted value matrix to obtain a filled prediction matrix, the filled prediction matrix having a preset size; The edge of the horizontal prediction gradient matrix and the edge of the vertical prediction gradient matrix are respectively subjected to gradient value expansion to obtain a filled horizontal gradient matrix and a filled vertical gradient matrix.
  • the filled horizontal gradient matrix and the filled vertical gradient matrix are respectively Having the preset size; according to the filling prediction matrix, the filling horizontal gradient matrix, and the filling vertical gradient matrix, calculating the motion information correction amount of each basic processing unit in each of the virtual pipeline data units.
  • a judgment module 1306 is further included, which is used to determine that the size of the predicted value matrix is smaller than the preset size.
  • the judgment module 1306 is further configured to: determine the size of the horizontal prediction gradient matrix and/or the size of the vertical prediction gradient matrix to be smaller than the preset size.
  • the correction module 1304 is further configured to obtain, according to the predicted value matrix of the virtual pipeline data unit and the motion correction amount of each of the basic processing units in the virtual pipeline data unit, The predicted value of each said basic processing unit.
  • the device is used for bidirectional prediction; correspondingly, the motion information includes first reference frame list motion information and second reference frame list motion information; and the prediction value matrix includes first prediction A value matrix and a second predicted value matrix, the first predicted value matrix is obtained according to the first reference frame list motion information, the second predicted value matrix is obtained according to the second reference frame list motion information; the level The prediction gradient matrix includes a first horizontal prediction gradient matrix and a second horizontal prediction gradient matrix, the first horizontal prediction gradient matrix is calculated according to the first prediction value matrix, and the second horizontal prediction gradient matrix is based on the second The prediction value matrix is calculated and obtained; the vertical prediction gradient matrix includes a first vertical prediction gradient matrix and a second vertical prediction gradient matrix, and the first vertical prediction gradient matrix is calculated and obtained according to the first prediction value matrix, The second vertical prediction gradient matrix is calculated according to the second prediction value matrix; the motion information correction amount includes a first reference frame list motion information correction amount and a second reference frame list motion information correction amount, the first A reference frame list motion information correction amount is calculated according to the first prediction value
  • the judgment module 1306 is further configured to: determine that the time domain position of the image frame where the image block to be processed is located is in the first reference frame indicated by the motion information of the first reference frame list And the second reference frame indicated by the second reference frame list motion information.
  • the judgment module 1306 is further configured to: determine that the difference between the first predicted value matrix and the second predicted value matrix is less than a first threshold.
  • the judgment module 1306 is further configured to: determine that the difference between the first basic predicted value matrix and the second basic predicted value matrix is less than a second threshold.
  • the size of the basic processing unit is 4x4.
  • the width of the virtual pipeline data unit is W and the height is H
  • the size of the extended prediction matrix is (W+n+2)x(H+n+2), corresponding to
  • the size of the horizontal prediction gradient matrix is (W+n)x(H+n)
  • the size of the vertical prediction gradient matrix is (W+n)x(H+n), where W, H are Positive integer, n is even.
  • n 0, 2, or -2.
  • the judgment module 1306 is further configured to: determine that the image block to be processed includes the plurality of virtual pipeline data units.
  • FIG. 19 is a schematic method flowchart of an embodiment of the present application.
  • an apparatus 1400 for inter prediction including:
  • the determining module 1401 is configured to determine a plurality of first image blocks in the image block to be processed according to a preset image splitting width, a preset image splitting height, and the width and height of the image block to be processed;
  • the prediction module 1402 is configured to perform bidirectional prediction based on optical flow on the plurality of first image blocks to obtain the prediction value of each first image block;
  • the combining module 1403 is configured to combine the prediction values of the plurality of first image blocks to obtain the prediction values of the image blocks to be processed.
  • the determination module 1401 is configured to:
  • a plurality of first image blocks are determined in the image block to be processed.
  • the width of the first image block is the minimum value between the preset image division width and the width of the image block to be processed
  • the height of the first image block is The minimum value between the preset image division height and the height of the image block to be processed.
  • the prediction module 1402 is configured to:
  • the predicted value of the first image block is obtained.
  • the device 1400 further includes a first expansion module 1404:
  • the first expansion module is configured to perform a first expansion on the width and height of the first prediction block based on the pixel value of the block edge position of the first prediction block, so that the first expanded first prediction
  • the width and height of the block are greater than the width and height of the first image block by 2 pixel distances; and/or, based on the first gradient value matrix, the gradient value of the matrix edge position is applied to the first gradient Performing a first expansion on the width and height of the value matrix, so that the width and height of the first expanded first gradient value matrix are greater than the width and height of the first image block by 2 pixel distances, respectively;
  • the prediction module 1402 is configured to calculate each basic element in the first image block according to the first expanded first prediction block and/or the first expanded first gradient value matrix The amount of motion information correction for the processing unit.
  • the device further includes a second expansion module 1405:
  • the second expansion module is configured to perform interpolation filtering on the pixel value of the block edge region of the first prediction block, or copy the pixel value of the block edge position of the first prediction block to Perform a second extension on the width and height of the first prediction block;
  • the prediction module 1402 is configured to perform a gradient operation on the second expanded first prediction block.
  • the first prediction block includes a forward prediction block and a backward prediction block
  • the first gradient value matrix includes a forward horizontal gradient value matrix, a forward vertical gradient value matrix, and a Horizontal gradient value matrix and backward vertical gradient value matrix.
  • the preset image division width is 64, 32, or 16
  • the preset image division height is 64, 32, or 16.
  • the basic processing unit is a 4x4 pixel matrix.
  • the determination module determines multiple first image blocks among the image blocks to be processed according to the preset image division width, the preset image division height, and the width and height of the image block to be processed, In this way, the size of the first image block is constrained by the preset image division width and the preset image division height, and will not make the determined area of each first image block larger, thereby reducing the consumption of hardware resources such as memory, Reduce the implementation complexity of inter-frame prediction and improve processing efficiency.
  • Computer readable media may include computer readable storage media, which corresponds to tangible media, such as data storage media, or communication media including any medium that facilitates transfer of a computer program from one place to another (eg, according to a communication protocol).
  • computer-readable media may generally correspond to (1) non-transitory tangible computer-readable storage media, or (2) communication media, such as signals or carrier waves.
  • Data storage media may be any available media that can be accessed by one or more computers or one or more processors to retrieve instructions, code and/or data structures for implementation of the techniques described in this application.
  • the computer program product may include a computer-readable medium.
  • Such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM, or other optical disk storage devices, magnetic disk storage devices, or other magnetic storage devices, flash memory, or may be used to store instructions or data structures
  • coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technology such as infrared, radio, and microwave are used to transmit instructions from a website, server, or other remote source
  • coaxial cable Wire, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media.
  • the computer-readable storage media and data storage media do not include connections, carrier waves, signals, or other temporary media, but are actually directed to non-transitory tangible storage media.
  • magnetic disks and optical discs include compact discs (CDs), laser discs, optical discs, digital versatile discs (DVDs), and Blu-ray discs, where magnetic discs typically reproduce data magnetically, while optical discs reproduce optically using lasers data. Combinations of the above should also be included in the scope of computer-readable media.
  • DSPs digital signal processors
  • ASICs application specific integrated circuits
  • FPGAs field programmable logic arrays
  • processors may refer to any of the foregoing structure or any other structure suitable for implementation of the techniques described herein.
  • the functions described in the various illustrative logical blocks, modules, and steps described herein may be provided within dedicated hardware and/or software modules configured for encoding and decoding, or in combination Into the combined codec.
  • the techniques can be fully implemented in one or more circuits or logic elements.
  • the technology of the present application can be implemented in a variety of devices or equipment, including wireless handsets, integrated circuits (ICs), or a set of ICs (eg, chipsets).
  • ICs integrated circuits
  • a set of ICs eg, chipsets
  • Various components, modules or units are described in this application to emphasize the functional aspects of the device for performing the disclosed technology, but do not necessarily need to be implemented by different hardware units.
  • various units may be combined in a codec hardware unit in combination with suitable software and/or firmware, or by interoperating hardware units (including one or more processors as described above) provide.

Abstract

本申请公开了一种帧间预测的方法和装置,该方法包括:根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块;对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值;组合所述多个第一图像块的预测值,以获得所述待处理图像块的预测值。所述装置包括确定模块、预测模块和组合模块。本申请能够降低帧间预测的实现复杂度,提高处理效率。

Description

一种帧间预测的方法及装置
本申请要求于2018年12月13日提交的申请号为201811530481.1、发明名称为“视频编码器、视频解码器及相应方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。以及,本申请要求于2019年4月22日提交的申请号为201910325612.0、发明名称为“一种帧间预测的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及视频编解码领域,尤其涉及一种帧间预测的方法及装置。
背景技术
帧间预测是利用视频图像帧间的相关性,即时间相关性,来达到图像压缩的目的,广泛用于普通电视、会议电视、视频电话、高清晰度电视等场景的压缩编码或解码。在编码侧和解码侧均使用帧间预测的操作来处理图像。
在对图像进行帧间预测处理时,先根据该图像对应的图像块的高度和宽度,将该图像划分成多个图像块,然后对划分的每个图像块进行帧间预测处理。当该图像对应的图像块的宽度和高度较大时,划分得到的每个图像块的面积较大,这样在对划分的每个图像块进行帧间预测处理时,帧间预测的实现复杂度较高。
发明内容
本申请实施例提供一种帧间预测方法及装置,可以降低帧间预测的实现复杂度,提高处理效率。
第一方面,本申请提供了一种帧间预测的方法,在所述方法中,根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块;对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值;组合所述多个第一图像块的预测值,以获得所述待处理图像块的预测值。由于根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块,这样第一图像块的尺寸受到预设图像划分宽度和预设图像划分高度的约束,不会使确定的每个第一图像块的面积较大,从而可以减小对内存等硬件资源的消耗,降低帧间预测的实现复杂度,提高处理效率。
在一种可能的实施方式中,所述待处理图像块的宽度和高度分别与第一图像块的宽度和高度相同,即所述待处理图像块仅包含一个第一图像块。对应的,当根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,确定所述待处理图像块为第一图像块 时,以所述待处理图像块为处理单元进行基于光流的双向预测,以获得待处理图像块的预测值。
在一种可能的实施方式中,比较所述预设图像划分宽度和所述待处理图像块的宽度,以确定所述第一图像块的宽度;比较所述预设图像划分高度和所述待处理图像块的高度,以确定所述第一图像块的高度;根据所述第一图像块的宽度和高度,在所述待处理图像块中确定所述多个第一图像块。这样使第一图像块的宽度受到预设图像划分宽度的约束,使第一图像块的高度受预设图像划分高度的约束,不会使确定的每个第一图像块的面积较大,从而可以减小对内存等硬件资源的消耗,降低帧间预测的实现复杂度,提高处理效率。
在一种可能的实施方式中,所述第一图像块的宽度为所述预设图像划分宽度和所述待处理图像块的宽度之间的最小值,且所述第一图像块的高度为所述预设图像划分高度和所述待处理图像块的高度之间的最小值。从而可以减小确定第一图像的面积,最大程度地降低帧间预测的实现复杂度,提高处理效率。
在一种可能的实施方式中,基于所述待处理图像块的运动信息,获得所述第一图像块的第一预测块;对所述第一预测块进行梯度运算,以获得所述第一图像块的第一梯度值矩阵;根据所述第一预测块和所述第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量;基于所述每个基本处理单元的运动信息修正量,获得所述第一图像块的预测值。由于所述第一图像块的预测值是基于所述每个基本处理单元的运动信息修正量获得的,从而可以提高第一图像块的预测值的精度。
在一种可能的实施方式中,基于所述第一预测块进行块边缘位置的像素值,对所述第一预测块的宽度和高度进行第一扩展,以使第一扩展后的第一预测块的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;和/或,基于所述第一梯度值矩阵进行矩阵边缘位置的梯度值,对所述第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;对应的,根据所述第一扩展后的第一预测块和/或所述第一扩展后的第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量。通过对所述第一预测块的宽度和高度进行第一扩展,使第一扩展后的第一预测块的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离,这样在参考图像中的图像块进行双向预测得到第一预测块时,可以减小得到的第一预测块的尺寸,对应的,该图像块的尺寸也随之减小,从而减小了双向预测的数据量,以减小对硬件资源的占用。
在一种可能的实施方式中,对所述第一预测块的块边缘区域的像素值进行插值滤波,或者,对所述第一预测块的块边缘位置的像素值进行复制,以对所述第一预测块的宽度和高度进行第二扩展;对应的,对所述第二扩展后的第一预测块进行梯度运算。由于对第一预测块的块边缘位置的像素值进行复制,便可对述第一预测块的宽度和高度进行第二扩展,实现方式简单,运算复杂度低。
在一种可能的实施方式中,所述第一预测块包括前向预测块和后向预测块,所述第一梯度值矩阵包括前向水平梯度值矩阵、前向竖直梯度值矩阵、后向水平梯度值矩阵和后向竖直梯度值矩阵。
在一种可能的实施方式中,所述预设图像划分宽度为64、32或16,所述预设图像划分高度为64、32或16。如此可以基于预测图像划分宽度和预测图像划分高度的约束,减小确定的第一图像块的尺寸。
在一种可能的实施方式中,所述基本处理单元为4x4的像素矩阵。
第二方面,本申请提供了一种帧间预测的装置,包括:确定模块、预测模块和组合模块。所述确定模块根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块;所述预测模块对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值;所述组合模块组合所述多个第一图像块的预测值,以获得所述待处理图像块的预测值。由于确定模块根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块,这样第一图像块的尺寸受到预设图像划分宽度和预设图像划分高度的约束,不会使确定的每个第一图像块的面积较大,从而可以减小对内存等硬件资源的消耗,降低帧间预测的实现复杂度,提高处理效率。
在一种可能的实现方式中,所述确定模块、所述预测模块和所述组合模块还可以用于执行第一方面的任意一种可能的实现方式中的方法的操作,在此不再详细说明。
第三方面,本申请实施例提供了一种帧间预测的装置,所述装置包括:处理器和存储器,处理器和存储器连接;所述存储器存储有一个或多个程序,所述一个或多个程序被配置成由所述处理器执行,所述一个或多个程序包含用于进行第一方面或第一方面的任意一种可能的实现方式的方法的指令。
第四方面,本申请提供了一种非易失性计算机可读存储介质,用于存储计算机程序,所述计算机程序通过处理器进行加载来执行上述第一方面或第一方面的任意可能的实现方式的方法的指令。
第五方面,本申请提供了一种芯片,所述芯片包括可编程逻辑电路和/或程序指令,当所述芯片运行时用于实现上述第一方面或第一方面的任意可能的实现方式的方法。
第六方面,本申请实施例提供了一种帧间预测的方法,包括:获取待处理图像块的运动信息,所述待处理图像块包括多个虚拟流水数据单元,所述虚拟流水数据单元包括至少一个基本处理单元;根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵;根据每 个所述预测值矩阵,计算每个所述虚拟流水数据单元的水平预测梯度矩阵和竖直预测梯度矩阵;根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量。
在第六方面的一种可行的实施方式中,所述根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵,包括:根据所述运动信息,获得每个所述虚拟流水数据单元的初始预测矩阵,所述初始预测矩阵和所述虚拟流水数据单元大小相等;将所述初始预测矩阵作为所述预测值矩阵。
在第六方面的一种可行的实施方式中,在所述获得每个所述虚拟流水数据单元的初始预测矩阵之后,还包括:对所述初始预测矩阵的边沿进行像素点扩展,以获得扩展预测矩阵,所述扩展预测矩阵的尺寸大于所述初始预测矩阵的尺寸;对应的,所述将所述初始预测矩阵作为所述预测值矩阵,包括:将所述扩展预测矩阵作为所述预测值矩阵。
在第六方面的一种可行的实施方式中,所述对所述初始预测矩阵的边沿进行像素点扩展,包括:基于所述初始预测矩阵内的像素点的像素值插值获得所述初始预测矩阵外的像素点的像素值,或者,以所述初始预测矩阵边沿的像素点的像素值作为所述初始预测矩阵外与所述边沿相邻的像素点的像素值。
在第六方面的一种可行的实施方式中,所述虚拟流水数据单元包括多个运动补偿单元,所述根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵,包括:根据所述运动信息,获得每个所述运动补偿单元的补偿值矩阵;组合所述多个运动补偿单元的补偿值矩阵以获得所述预测值矩阵。
在第六方面的一种可行的实施方式中,所述根据每个所述预测值矩阵,计算每个所述虚拟流水数据单元的水平预测梯度矩阵和竖直预测梯度矩阵,包括:对所述预测值矩阵进行水平梯度计算和竖直梯度计算,以分别获得所述水平预测梯度矩阵和所述竖直预测梯度矩阵。
在第六方面的一种可行的实施方式中,在所述根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量之前,还包括:对所述预测值矩阵的边沿进行像素点扩展,以获得填充预测矩阵,所述填充预测矩阵具有预设尺寸;对所述水平预测梯度矩阵的边沿和所述竖直预测梯度矩阵的边沿分别进行梯度值扩展,以获得填充水平梯度矩阵和填充竖直梯度矩阵,所述填充水平梯度矩阵和所述填充竖直梯度矩阵分别具有所述预设尺寸;对应的,所述根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量,包括:根据所述填充预测矩阵、所述填充水平梯度矩阵和所述填充竖直梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量。
在第六方面的一种可行的实施方式中,在所述对所述预测值矩阵的边沿进行像素点扩展之前,还包括:确定所述预测值矩阵的尺寸小于所述预设尺寸。
在第六方面的一种可行的实施方式中,在所述对所述水平预测梯度矩阵的边沿和所述竖直预测梯度矩阵的边沿分别进行梯度值扩展之前,还包括:确定所述水平预测梯度矩阵的尺寸和/或所述竖直预测梯度矩阵的尺寸小于所述预设尺寸。
在第六方面的一种可行的实施方式中,在所述计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量之后,所述方法还包括:根据所述虚拟流水数据单元的预 测值矩阵和所述虚拟流水数据单元中每个所述基本处理单元的运动修正量,获得每个所述基本处理单元的预测值。
在第六方面的一种可行的实施方式中,所述方法用于双向预测;对应的,所述运动信息包括第一参考帧列表运动信息和第二参考帧列表运动信息;所述预测值矩阵包括第一预测值矩阵和第二预测值矩阵,所述第一预测值矩阵根据所述第一参考帧列表运动信息获得,所述第二预测值矩阵根据所述第二参考帧列表运动信息获得;所述水平预测梯度矩阵包括第一水平预测梯度矩阵和第二水平预测梯度矩阵,所述第一水平预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二水平预测梯度矩阵根据所述第二预测值矩阵计算获得;所述竖直预测梯度矩阵包括第一竖直预测梯度矩阵和第二竖直预测梯度矩阵,所述第一竖直预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二竖直预测梯度矩阵根据所述第二预测值矩阵计算获得;所述运动信息修正量包括第一参考帧列表运动信息修正量和第二参考帧列表运动信息修正量,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第一竖直预测梯度矩阵计算获得,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第二竖直预测梯度矩阵计算获得。
在第六方面的一种可行的实施方式中,在所述对所述初始预测矩阵的边沿进行像素点扩展之前,还包括:确定所述待处理图像块所在的图像帧的时域位置位于所述第一参考帧列表运动信息所指示的第一参考帧和所述第二参考帧列表运动信息所指示的第二参考帧之间。
在第六方面的一种可行的实施方式中,在所述获得每个所述虚拟流水数据单元的预测值矩阵之后,还包括:确定所述第一预测值矩阵和所述第二预测值矩阵的差异小于第一阈值。
在第六方面的一种可行的实施方式中,所述基本处理单元的运动信息修正量对应所述预测值矩阵中的一个基本预测值矩阵,在所述根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量之前,还包括:确定所述第一基本预测值矩阵和所述第二基本预测值矩阵的差异小于第二阈值。
在第六方面的一种可行的实施方式中,所述基本处理单元的尺寸为4x4。
在第六方面的一种可行的实施方式中,所述虚拟流水数据单元的宽为W,高为H,所述扩展预测矩阵的尺寸为(W+n+2)x(H+n+2),对应的,所述水平预测梯度矩阵的尺寸为(W+n)x(H+n),所述竖直预测梯度矩阵的尺寸为(W+n)x(H+n),其中,W,H为正整数,n为偶数。
在第六方面的一种可行的实施方式中,n为0、2或-2。
在第六方面的一种可行的实施方式中,在所述获取待处理图像块的运动信息之前,还包括:确定所述待处理图像块包括所述多个虚拟流水数据单元。
第七方面,本申请实施例提供了一种帧间预测的装置,包括:获取模块,用于获取待处理图像块的运动信息,所述待处理图像块包括多个虚拟流水数据单元,所述虚拟流水数据单元包括至少一个基本处理单元;补偿模块,用于根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵;计算模块,用于根据每个所述预测值矩阵,计算每个所述虚拟流水数据单元的水平预测梯度矩阵和竖直预测梯度矩阵;修正模块,用于根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量。
在第七方面的一种可行的实施方式中,所述补偿模块具体用于:根据所述运动信息,获得每个所述虚拟流水数据单元的初始预测矩阵,所述初始预测矩阵和所述虚拟流水数据单元大小相等;将所述初始预测矩阵作为所述预测值矩阵。
在第七方面的一种可行的实施方式中,所述补偿模块具体用于:对所述初始预测矩阵的边沿进行像素点扩展,以获得扩展预测矩阵,所述扩展预测矩阵的尺寸大于所述初始预测矩阵的尺寸;将所述扩展预测矩阵作为所述预测值矩阵。
在第七方面的一种可行的实施方式中,所述补偿模块具体用于:基于所述初始预测矩阵内的像素点的像素值插值获得所述初始预测矩阵外的像素点的像素值,或者,以所述初始预测矩阵边沿的像素点的像素值作为所述初始预测矩阵外与所述边沿相邻的像素点的像素值。
在第七方面的一种可行的实施方式中,所述虚拟流水数据单元包括多个运动补偿单元,所述补偿模块具体用于:根据所述运动信息,获得每个所述运动补偿单元的补偿值矩阵;组合所述多个运动补偿单元的补偿值矩阵以获得所述预测值矩阵。
在第七方面的一种可行的实施方式中,所述计算模块具体用于:对所述预测值矩阵进行水平梯度计算和竖直梯度计算,以分别获得所述水平预测梯度矩阵和所述竖直预测梯度矩阵。
在第七方面的一种可行的实施方式中,还包括填充模块,用于:对所述预测值矩阵的边沿进行像素点扩展,以获得填充预测矩阵,所述填充预测矩阵具有预设尺寸;对所述水平预测梯度矩阵的边沿和所述竖直预测梯度矩阵的边沿分别进行梯度值扩展,以获得填充水平梯度矩阵和填充竖直梯度矩阵,所述填充水平梯度矩阵和所述填充竖直梯度矩阵分别具有所述预设尺寸;根据所述填充预测矩阵、所述填充水平梯度矩阵和所述填充竖直梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量。
在第七方面的一种可行的实施方式中,还包括判断模块,用于:确定所述预测值矩阵的尺寸小于所述预设尺寸。
在第七方面的一种可行的实施方式中,所述判断模块还用于:确定所述水平预测梯度矩阵的尺寸和/或所述竖直预测梯度矩阵的尺寸小于所述预设尺寸。
在第七方面的一种可行的实施方式中,所述修正模块还用于:根据所述虚拟流水数据单元的预测值矩阵和所述虚拟流水数据单元中每个所述基本处理单元的运动修正量,获得每个所述基本处理单元的预测值。
在第七方面的一种可行的实施方式中,所述装置用于双向预测;对应的,所述运动信息包括第一参考帧列表运动信息和第二参考帧列表运动信息;所述预测值矩阵包括第一预测值矩阵和第二预测值矩阵,所述第一预测值矩阵根据所述第一参考帧列表运动信息获得,所述第二预测值矩阵根据所述第二参考帧列表运动信息获得;所述水平预测梯度矩阵包括第一水平预测梯度矩阵和第二水平预测梯度矩阵,所述第一水平预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二水平预测梯度矩阵根据所述第二预测值矩阵计算获得;所述竖直预测梯度矩阵包括第一竖直预测梯度矩阵和第二竖直预测梯度矩阵,所述第一竖直预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二竖直预测梯度矩阵根据所述第二预测值矩阵计算获得;所述运动信息修正量包括第一参考帧列表运动信息修正量和第二参考帧列表运动信息修正量,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第一竖直预测梯度矩阵计算获得,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第二竖直预测梯度矩阵计算获 得。
在第七方面的一种可行的实施方式中,所述判断模块还用于:确定所述待处理图像块所在的图像帧的时域位置位于所述第一参考帧列表运动信息所指示的第一参考帧和所述第二参考帧列表运动信息所指示的第二参考帧之间。
在第七方面的一种可行的实施方式中,所述判断模块还用于:确定所述第一预测值矩阵和所述第二预测值矩阵的差异小于第一阈值。
在第七方面的一种可行的实施方式中,所述判断模块还用于:确定所述第一基本预测值矩阵和所述第二基本预测值矩阵的差异小于第二阈值。
在第七方面的一种可行的实施方式中,所述基本处理单元的尺寸为4x4。
在第七方面的一种可行的实施方式中,所述虚拟流水数据单元的宽为W,高为H,所述扩展预测矩阵的尺寸为(W+n+2)x(H+n+2),对应的,所述水平预测梯度矩阵的尺寸为(W+n)x(H+n),所述竖直预测梯度矩阵的尺寸为(W+n)x(H+n),其中,W,H为正整数,n为偶数。
在第七方面的一种可行的实施方式中,n为0、2或-2。
在第七方面的一种可行的实施方式中,所述判断模块还用于:确定所述待处理图像块包括所述多个虚拟流水数据单元。
第八方面,本申请实施例提供一种编码设备,包括:相互耦合的非易失性存储器和处理器,所述处理器调用存储在所述存储器中的程序代码以执行第一方面的任意一种方法的部分或全部步骤,或者,以执行第六方面的任意一种方法的部分或全部步骤。
第九方面,本申请实施例提供一种解码设备,包括:相互耦合的非易失性存储器和处理器,所述处理器调用存储在所述存储器中的程序代码以执行第一方面的任意一种方法的部分或全部步骤,或者,以执行第六方面的任意一种方法的部分或全部步骤。
第十方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质存储了程序代码,其中,所述程序代码包括用于执行第一方面的任意一种方法的部分或全部步骤的指令,或者,以执行第六方面的任意一种方法的部分或全部步骤。
第十一方面,本申请实施例提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行第一方面的任意一种方法的部分或全部步骤,或者,以执行第六方面的任意一种方法的部分或全部步骤。
附图说明
为了更清楚地说明本申请实施例或背景技术中的技术方案,下面将对本申请实施例或背景技术中所需要使用的附图进行说明。
图1A是用于实现本申请实施例的视频编码及解码系统10实例的框图;
图1B是用于实现本申请实施例的视频译码系统40实例的框图;
图2是用于实现本申请实施例的编码器20实例结构的框图;
图3是用于实现本申请实施例的解码器30实例结构的框图;
图4是用于实现本申请实施例的视频译码设备400实例的框图;
图5是用于实现本申请实施例的另一种编码装置或解码装置实例的框图;
图6是用于实现本申请实施例的运动信息候选位置的示意图;
图7是用于实现本申请实施例的运动信息用于帧间预测的示意图;
图8是用于实现本申请实施例的双向加权预测的示意图;
图9是用于实现本申请实施例的CU边界padding的示意图;
图10是用于实现本申请实施例的VPDU划分示意图;
图11是用于实现本申请实施例的VPDU非法划分示意图;
图12是用于实现本申请实施例的一种帧间预测的方法流程图;
图13是用于实现本申请实施例的运动信息用于帧间预测的另一示意图;
图14是用于实现本申请实施例的另一种帧间预测的方法流程图;
图15是用于实现本申请实施例的运动信息用于帧间预测的另一示意图;
图16是用于实现本申请实施例的另一种帧间预测的方法流程图;
图17是用于实现本申请实施例的一种方法流程图;
图18是用于实现本申请实施例的一种帧间预测的装置结构框图;
图19是用于实现本申请实施例的另一种帧间预测的装置结构框图。
具体实施方式
下面结合本申请实施例中的附图对本申请实施例进行描述。以下描述中,参考形成本公开一部分并以说明之方式示出本申请实施例的具体方面或可使用本申请实施例的具体方面的附图。应理解,本申请实施例可在其它方面中使用,并可包括附图中未描绘的结构或逻辑变化。因此,以下详细描述不应以限制性的意义来理解,且本申请的范围由所附权利要求书界定。例如,应理解,结合所描述方法的揭示内容可以同样适用于用于执行所述方法的对应设备或系统,且反之亦然。例如,如果描述一个或多个具体方法步骤,则对应的设备可以包含如功能单元等一个或多个单元,来执行所描述的一个或多个方法步骤(例如,一个单元执行一个或多个步骤,或多个单元,其中每个都执行多个步骤中的一个或多个),即使附图中未明确描述或说明这种一个或多个单元。另一方面,例如,如果基于如功能单元等一个或多个单元描述具体装置,则对应的方法可以包含一个步骤来执行一个或多个单元的功能性(例如,一个步骤执行一个或多个单元的功能性,或多个步骤,其中每个执行多个单元中一个或多个单元的功能性),即使附图中未明确描述或说明这种一个或多个步骤。进一步,应理解的是,除非另外明确提出,本文中所描述的各示例性实施例和/或方面的特征可以相互组合。
本申请实施例所涉及的技术方案不仅可能应用于现有的视频编码标准中(如H.264、高性能视频编码(high efficiency video coding,HEVC)等标准),还可能应用于未来的视频编码标准中(如H.266标准)。本申请的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。下面先对本申请实施例可能涉及的一些概念进行简单介绍。
视频编码通常是指处理形成视频或视频序列的图片序列。在视频编码领域,术语“图片(picture)”、“帧(frame)”或“图像(image)”可以用作同义词。本文中使用的视频编码表示视频编码或视频解码。视频编码在源侧执行,通常包括处理(例如,通过压缩)原始视频图片以减少表示该视频图片所需的数据量,从而更高效地存储和/或传输。视频解码在目的地侧执行,通常包括相对于编码器作逆处理,以重构视频图片。实施例涉及的视频图片“编码”应理解为涉及视频序列的“编码”或“解码”。编码部分和解码部分的组合也称为编解码(编码 和解码)。
视频序列包括一系列图像(picture),图像被进一步划分为切片(slice),切片再被划分为块(block)。视频编码以块为单位进行编码处理,在一些新的视频编码标准中,块的概念被进一步扩展。比如,在H.264标准中有宏块(macroblock,MB),宏块可进一步划分成多个可用于预测编码的预测块(partition)。在HEVC标准中,采用编码单元(coding unit,CU),预测单元(prediction unit,PU)和变换单元(transform unit,TU)等基本概念,从功能上划分了多种块单元,并采用全新的基于树结构进行描述。比如CU可以按照四叉树进行划分为更小的CU,而更小的CU还可以继续划分,从而形成一种四叉树结构,CU是对编码图像进行划分和编码的基本单元。对于PU和TU也有类似的树结构,PU可以对应预测块,是预测编码的基本单元。对CU按照划分模式进一步划分成多个PU。TU可以对应变换块,是对预测残差进行变换的基本单元。然而,无论CU,PU还是TU,本质上都属于块(或称图像块)的概念。
例如在HEVC中,通过使用表示为编码树的四叉树结构将编码树单元(coding tree unit,CTU)拆分为多个CU。在CU层级处作出是否使用图片间(时间)或图片内(空间)预测对图片区域进行编码的决策。每个CU可以根据PU拆分类型进一步拆分为一个、两个或四个PU。一个PU内应用相同的预测过程,并在PU基础上将相关信息传输到解码器。在通过基于PU拆分类型应用预测过程获取残差块之后,可以根据类似于用于CU的编码树的其它四叉树结构将CU分割成变换单元(transform unit,TU)。在视频压缩技术最新的发展中,使用四叉树和二叉树(Quad-tree and binary tree,QTBT)分割帧来分割编码块。在QTBT块结构中,CU可以为正方形或矩形形状。
本文中,为了便于描述和理解,可将当前编码图像中待编码的图像块称为当前块,例如在编码中,指当前正在编码的块;在解码中,指当前正在解码的块。将参考图像中用于对当前块进行预测的已解码的图像块称为参考块,即参考块是为当前块提供参考信号的块,其中,参考信号表示图像块内的像素值。可将参考图像中为当前块提供预测信号的块为预测块,其中,预测信号表示预测块内的像素值或者采样值或者采样信号。例如,在遍历多个参考块以后,找到了最佳参考块,此最佳参考块将为当前块提供预测,此块称为预测块。
无损视频编码情况下,可以重构原始视频图片,即经重构视频图片具有与原始视频图片相同的质量(假设存储或传输期间没有传输损耗或其它数据丢失)。在有损视频编码情况下,通过例如量化执行进一步压缩,来减少表示视频图片所需的数据量,而解码器侧无法完全重构视频图片,即经重构视频图片的质量相比原始视频图片的质量较低或较差。
H.261的几个视频编码标准属于“有损混合型视频编解码”(即,将样本域中的空间和时间预测与变换域中用于应用量化的2D变换编码结合)。视频序列的每个图片通常分割成不重叠的块集合,通常在块层级上进行编码。换句话说,编码器侧通常在块(视频块)层级处理亦即编码视频,例如,通过空间(图片内)预测和时间(图片间)预测来产生预测块,从当前块(当前处理或待处理的块)减去预测块以获取残差块,在变换域变换残差块并量化残差块,以减少待传输(压缩)的数据量,而解码器侧将相对于编码器的逆处理部分应用于经编码或经压缩块,以重构用于表示的当前块。另外,编码器复制解码器处理循环,使得编码器和解码器生成相同的预测(例如帧内预测和帧间预测)和/或重构,用于处理亦即编码后续块。
下面描述本申请实施例所应用的系统架构。参见图1A,图1A示例性地给出了本申请实 施例所应用的视频编码及解码系统10的示意性框图。如图1A所示,视频编码及解码系统10可包括源设备12和目的地设备14,源设备12产生经编码视频数据,因此,源设备12可被称为视频编码装置。目的地设备14可对由源设备12所产生的经编码的视频数据进行解码,因此,目的地设备14可被称为视频解码装置。源设备12、目的地设备14或两个的各种实施方案可包含一或多个处理器以及耦合到所述一或多个处理器的存储器。所述存储器可包含但不限于RAM、ROM、EEPROM、快闪存储器或可用于以可由计算机存取的指令或数据结构的形式存储所要的程序代码的任何其它媒体,如本文所描述。源设备12和目的地设备14可以包括各种装置,包含桌上型计算机、移动计算装置、笔记型(例如,膝上型)计算机、平板计算机、机顶盒、例如所谓的“智能”电话等电话手持机、电视机、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机、无线通信设备或其类似者。
虽然图1A将源设备12和目的地设备14绘示为单独的设备,但设备实施例也可以同时包括源设备12和目的地设备14或同时包括两者的功能性,即源设备12或对应的功能性以及目的地设备14或对应的功能性。在此类实施例中,可以使用相同硬件和/或软件,或使用单独的硬件和/或软件,或其任何组合来实施源设备12或对应的功能性以及目的地设备14或对应的功能性。
源设备12和目的地设备14之间可通过链路13进行通信连接,目的地设备14可经由链路13从源设备12接收经编码视频数据。链路13可包括能够将经编码视频数据从源设备12移动到目的地设备14的一或多个媒体或装置。在一个实例中,链路13可包括使得源设备12能够实时将经编码视频数据直接发射到目的地设备14的一或多个通信媒体。在此实例中,源设备12可根据通信标准(例如无线通信协议)来调制经编码视频数据,且可将经调制的视频数据发射到目的地设备14。所述一或多个通信媒体可包含无线和/或有线通信媒体,例如射频(RF)频谱或一或多个物理传输线。所述一或多个通信媒体可形成基于分组的网络的一部分,基于分组的网络例如为局域网、广域网或全球网络(例如,因特网)。所述一或多个通信媒体可包含路由器、交换器、基站或促进从源设备12到目的地设备14的通信的其它设备。
源设备12包括编码器20,另外可选地,源设备12还可以包括图片源16、图片预处理器18、以及通信接口22。具体实现形态中,所述编码器20、图片源16、图片预处理器18、以及通信接口22可能是源设备12中的硬件部件,也可能是源设备12中的软件程序。分别描述如下:
图片源16,可以包括或可以为任何类别的图片捕获设备,用于例如捕获现实世界图片,和/或任何类别的图片或评论(对于屏幕内容编码,屏幕上的一些文字也认为是待编码的图片或图像的一部分)生成设备,例如,用于生成计算机动画图片的计算机图形处理器,或用于获取和/或提供现实世界图片、计算机动画图片(例如,屏幕内容、虚拟现实(virtual reality,VR)图片)的任何类别设备,和/或其任何组合(例如,实景(augmented reality,AR)图片)。图片源16可以为用于捕获图片的相机或者用于存储图片的存储器,图片源16还可以包括存储先前捕获或产生的图片和/或获取或接收图片的任何类别的(内部或外部)接口。当图片源16为相机时,图片源16可例如为本地的或集成在源设备中的集成相机;当图片源16为存储器时,图片源16可为本地的或例如集成在源设备中的集成存储器。当所述图片源16包括接口时,接口可例如为从外部视频源接收图片的外部接口,外部视频源例如为外部图片捕获设备,比如相机、外部存储器或外部图片生成设备,外部图片生成设备例如为外部计算机图形 处理器、计算机或服务器。接口可以为根据任何专有或标准化接口协议的任何类别的接口,例如有线或无线接口、光接口。
其中,图片可以视为像素点(picture element)的二维阵列或矩阵。阵列中的像素点也可以称为采样点。阵列或图片在水平和垂直方向(或轴线)上的采样点数目定义图片的尺寸和/或分辨率。为了表示颜色,通常采用三个颜色分量,即图片可以表示为或包含三个采样阵列。例如在RBG格式或颜色空间中,图片包括对应的红色、绿色及蓝色采样阵列。但是,在视频编码中,每个像素通常以亮度/色度格式或颜色空间表示,例如对于YUV格式的图片,包括Y指示的亮度分量(有时也可以用L指示)以及U和V指示的两个色度分量。亮度(luma)分量Y表示亮度或灰度水平强度(例如,在灰度等级图片中两者相同),而两个色度(chroma)分量U和V表示色度或颜色信息分量。相应地,YUV格式的图片包括亮度采样值(Y)的亮度采样阵列,和色度值(U和V)的两个色度采样阵列。RGB格式的图片可以转换或变换为YUV格式,反之亦然,该过程也称为色彩变换或转换。如果图片是黑白的,该图片可以只包括亮度采样阵列。本申请实施例中,由图片源16传输至图片处理器的图片也可称为原始图片数据17。
图片预处理器18,用于接收原始图片数据17并对原始图片数据17执行预处理,以获取经预处理的图片19或经预处理的图片数据19。例如,图片预处理器18执行的预处理可以包括整修、色彩格式转换(例如,从RGB格式转换为YUV格式)、调色或去噪。
编码器20(或称视频编码器20),用于接收经预处理的图片数据19,采用相关预测模式(如本文各个实施例中的预测模式)对经预处理的图片数据19进行处理,从而提供经编码图片数据21(下文将进一步基于图2或图4或图5描述编码器20的结构细节)。在一些实施例中,编码器20可以用于执行后文所描述的各个实施例,以实现本申请所描述的色度块预测方法在编码侧的应用。
通信接口22,可用于接收经编码图片数据21,并可通过链路13将经编码图片数据21传输至目的地设备14或任何其它设备(如存储器),以用于存储或直接重构,所述其它设备可为任何用于解码或存储的设备。通信接口22可例如用于将经编码图片数据21封装成合适的格式,例如数据包,以在链路13上传输。
目的地设备14包括解码器30,另外可选地,目的地设备14还可以包括通信接口28、图片后处理器32和显示设备34。分别描述如下:
通信接口28,可用于从源设备12或任何其它源接收经编码图片数据21,所述任何其它源例如为存储设备,存储设备例如为经编码图片数据存储设备。通信接口28可以用于藉由源设备12和目的地设备14之间的链路13或藉由任何类别的网络传输或接收经编码图片数据21,链路13例如为直接有线或无线连接,任何类别的网络例如为有线或无线网络或其任何组合,或任何类别的私网和公网,或其任何组合。通信接口28可以例如用于解封装通信接口22所传输的数据包以获取经编码图片数据21。
通信接口28和通信接口22都可以配置为单向通信接口或者双向通信接口,以及可以用于例如发送和接收消息来建立连接、确认和交换任何其它与通信链路和/或例如经编码图片数据传输的数据传输有关的信息。
解码器30(或称为解码器30),用于接收经编码图片数据21并提供经解码图片数据31或经解码图片31(下文将进一步基于图3或图4或图5描述解码器30的结构细节)。在一些 实施例中,解码器30可以用于执行后文所描述的各个实施例,以实现本申请所描述的色度块预测方法在解码侧的应用。
图片后处理器32,用于对经解码图片数据31(也称为经重构图片数据)执行后处理,以获得经后处理图片数据33。图片后处理器32执行的后处理可以包括:色彩格式转换(例如,从YUV格式转换为RGB格式)、调色、整修或重采样,或任何其它处理,还可用于将将经后处理图片数据33传输至显示设备34。
显示设备34,用于接收经后处理图片数据33以向例如用户或观看者显示图片。显示设备34可以为或可以包括任何类别的用于呈现经重构图片的显示器,例如,集成的或外部的显示器或监视器。例如,显示器可以包括液晶显示器(liquid crystal display,LCD)、有机发光二极管(organic light emitting diode,OLED)显示器、等离子显示器、投影仪、微LED显示器、硅基液晶(liquid crystal on silicon,LCoS)、数字光处理器(digital light processor,DLP)或任何类别的其它显示器。
虽然,图1A将源设备12和目的地设备14绘示为单独的设备,但设备实施例也可以同时包括源设备12和目的地设备14或同时包括两者的功能性,即源设备12或对应的功能性以及目的地设备14或对应的功能性。在此类实施例中,可以使用相同硬件和/或软件,或使用单独的硬件和/或软件,或其任何组合来实施源设备12或对应的功能性以及目的地设备14或对应的功能性。
本领域技术人员基于描述明显可知,不同单元的功能性或图1A所示的源设备12和/或目的地设备14的功能性的存在和(准确)划分可能根据实际设备和应用有所不同。源设备12和目的地设备14可以包括各种设备中的任一个,包含任何类别的手持或静止设备,例如,笔记本或膝上型计算机、移动电话、智能手机、平板或平板计算机、摄像机、台式计算机、机顶盒、电视机、相机、车载设备、显示设备、数字媒体播放器、视频游戏控制台、视频流式传输设备(例如内容服务服务器或内容分发服务器)、广播接收器设备、广播发射器设备等,并可以不使用或使用任何类别的操作系统。
编码器20和解码器30都可以实施为各种合适电路中的任一个,例如,一个或多个微处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、离散逻辑、硬件或其任何组合。如果部分地以软件实施所述技术,则设备可将软件的指令存储于合适的非暂时性计算机可读存储介质中,且可使用一或多个处理器以硬件执行指令从而执行本公开的技术。前述内容(包含硬件、软件、硬件与软件的组合等)中的任一者可视为一或多个处理器。
在一些情况下,图1A中所示视频编码及解码系统10仅为示例,本申请的技术可以适用于不必包含编码和解码设备之间的任何数据通信的视频编码设置(例如,视频编码或视频解码)。在其它实例中,数据可从本地存储器检索、在网络上流式传输等。视频编码设备可以对数据进行编码并且将数据存储到存储器,和/或视频解码设备可以从存储器检索数据并且对数据进行解码。在一些实例中,由并不彼此通信而是仅编码数据到存储器和/或从存储器检索数据且解码数据的设备执行编码和解码。
参见图1B,图1B是根据一示例性实施例的包含图2的编码器20和/或图3的解码器30 的视频译码系统40的实例的说明图。视频译码系统40可以实现本申请实施例的各种技术的组合。在所说明的实施方式中,视频译码系统40可以包含成像设备41、编码器20、解码器30(和/或藉由处理单元46的逻辑电路47实施的视频编/解码器)、天线42、一个或多个处理器43、一个或多个存储器44和/或显示设备45。
如图1B所示,成像设备41、天线42、处理单元46、逻辑电路47、编码器20、解码器30、处理器43、存储器44和/或显示设备45能够互相通信。如所论述,虽然用编码器20和解码器30绘示视频译码系统40,但在不同实例中,视频译码系统40可以只包含编码器20或只包含解码器30。
在一些实例中,天线42可以用于传输或接收视频数据的经编码比特流。另外,在一些实例中,显示设备45可以用于呈现视频数据。在一些实例中,逻辑电路47可以通过处理单元46实施。处理单元46可以包含专用集成电路(application-specific integrated circuit,ASIC)逻辑、图形处理器、通用处理器等。视频译码系统40也可以包含可选的处理器43,该可选处理器43类似地可以包含专用集成电路(application-specific integrated circuit,ASIC)逻辑、图形处理器、通用处理器等。在一些实例中,逻辑电路47可以通过硬件实施,如视频编码专用硬件等,处理器43可以通过通用软件、操作系统等实施。另外,存储器44可以是任何类型的存储器,例如易失性存储器(例如,静态随机存取存储器(Static Random Access Memory,SRAM)、动态随机存储器(Dynamic Random Access Memory,DRAM)等)或非易失性存储器(例如,闪存等)等。在非限制性实例中,存储器44可以由超速缓存内存实施。在一些实例中,逻辑电路47可以访问存储器44(例如用于实施图像缓冲器)。在其它实例中,逻辑电路47和/或处理单元46可以包含存储器(例如,缓存等)用于实施图像缓冲器等。
在一些实例中,通过逻辑电路实施的编码器20可以包含(例如,通过处理单元46或存储器44实施的)图像缓冲器和(例如,通过处理单元46实施的)图形处理单元。图形处理单元可以通信耦合至图像缓冲器。图形处理单元可以包含通过逻辑电路47实施的编码器20,以实施参照图2和/或本文中所描述的任何其它编码器系统或子系统所论述的各种模块。逻辑电路可以用于执行本文所论述的各种操作。
在一些实例中,解码器30可以以类似方式通过逻辑电路47实施,以实施参照图3的解码器30和/或本文中所描述的任何其它解码器系统或子系统所论述的各种模块。在一些实例中,逻辑电路实施的解码器30可以包含(通过处理单元2820或存储器44实施的)图像缓冲器和(例如,通过处理单元46实施的)图形处理单元。图形处理单元可以通信耦合至图像缓冲器。图形处理单元可以包含通过逻辑电路47实施的解码器30,以实施参照图3和/或本文中所描述的任何其它解码器系统或子系统所论述的各种模块。
在一些实例中,天线42可以用于接收视频数据的经编码比特流。如所论述,经编码比特流可以包含本文所论述的与编码视频帧相关的数据、指示符、索引值、模式选择数据等,例如与编码分割相关的数据(例如,变换系数或经量化变换系数,(如所论述的)可选指示符,和/或定义编码分割的数据)。视频译码系统40还可包含耦合至天线42并用于解码经编码比特流的解码器30。显示设备45用于呈现视频帧。
应理解,本申请实施例中对于参考编码器20所描述的实例,解码器30可以用于执行相反过程。关于信令语法元素,解码器30可以用于接收并解析这种语法元素,相应地解码相关视频数据。在一些例子中,编码器20可以将语法元素熵编码成经编码视频比特流。在此类实 例中,解码器30可以解析这种语法元素,并相应地解码相关视频数据。
需要说明的是,本申请实施例描述的方法主要用于帧间预测过程,此过程在编码器20和解码器30均存在,本申请实施例中的编码器20和解码器30可以是例如H.263、H.264、HEVV、MPEG-2、MPEG-4、VP8、VP9等视频标准协议或者下一代视频标准协议(如H.266等)对应的编/解码器。
参见图2,图2示出用于实现本申请实施例的编码器20的实例的示意性/概念性框图。在图2的实例中,编码器20包括残差计算单元204、变换处理单元206、量化单元208、逆量化单元210、逆变换处理单元212、重构单元214、缓冲器216、环路滤波器单元220、经解码图片缓冲器(decoded picture buffer,DPB)230、预测处理单元260和熵编码单元270。预测处理单元260可以包含帧间预测单元244、帧内预测单元254和模式选择单元262。帧间预测单元244可以包含运动估计单元和运动补偿单元(未图示)。图2所示的编码器20也可以称为混合型视频编码器或根据混合型视频编解码器的视频编码器。
例如,残差计算单元204、变换处理单元206、量化单元208、预测处理单元260和熵编码单元270形成编码器20的前向信号路径,而例如逆量化单元210、逆变换处理单元212、重构单元214、缓冲器216、环路滤波器220、经解码图片缓冲器(decoded picture buffer,DPB)230、预测处理单元260形成编码器的后向信号路径,其中编码器的后向信号路径对应于解码器的信号路径(参见图3中的解码器30)。
编码器20通过例如输入202,接收图片201或图片201的图像块203,例如,形成视频或视频序列的图片序列中的图片。图像块203也可以称为当前图片块或待编码图片块,图片201可以称为当前图片或待编码图片(尤其是在视频编码中将当前图片与其它图片区分开时,其它图片例如同一视频序列亦即也包括当前图片的视频序列中的先前经编码和/或经解码图片)。
编码器20的实施例可以包括分割单元(图2中未绘示),用于将图片201分割成多个例如图像块203的块,通常分割成多个不重叠的块。分割单元可以用于对视频序列中所有图片使用相同的块大小以及定义块大小的对应栅格,或用于在图片或子集或图片群组之间更改块大小,并将每个图片分割成对应的块。
在一个实例中,编码器20的预测处理单元260可以用于执行上述分割技术的任何组合。
如图片201,图像块203也是或可以视为具有采样值的采样点的二维阵列或矩阵,虽然其尺寸比图片201小。换句话说,图像块203可以包括,例如,一个采样阵列(例如黑白图片201情况下的亮度阵列)或三个采样阵列(例如,彩色图片情况下的一个亮度阵列和两个色度阵列)或依据所应用的色彩格式的任何其它数目和/或类别的阵列。图像块203的水平和垂直方向(或轴线)上采样点的数目定义图像块203的尺寸。
如图2所示的编码器20用于逐块编码图片201,例如,对每个图像块203执行编码和预测。
残差计算单元204用于基于图片图像块203和预测块265(下文提供预测块265的其它细节)计算残差块205,例如,通过逐样本(逐像素)将图片图像块203的样本值减去预测块265的样本值,以在样本域中获取残差块205。
变换处理单元206用于在残差块205的样本值上应用例如离散余弦变换(discrete cosine  transform,DCT)或离散正弦变换(discrete sine transform,DST)的变换,以在变换域中获取变换系数207。变换系数207也可以称为变换残差系数,并在变换域中表示残差块205。
变换处理单元206可以用于应用DCT/DST的整数近似值,例如为HEVC/H.265指定的变换。与正交DCT变换相比,这种整数近似值通常由某一因子按比例缩放。为了维持经正变换和逆变换处理的残差块的范数,应用额外比例缩放因子作为变换过程的一部分。比例缩放因子通常是基于某些约束条件选择的,例如,比例缩放因子是用于移位运算的2的幂、变换系数的位深度、准确性和实施成本之间的权衡等。例如,在解码器30侧通过例如逆变换处理单元212为逆变换(以及在编码器20侧通过例如逆变换处理单元212为对应逆变换)指定具体比例缩放因子,以及相应地,可以在编码器20侧通过变换处理单元206为正变换指定对应比例缩放因子。
量化单元208用于例如通过应用标量量化或向量量化来量化变换系数207,以获取经量化变换系数209。经量化变换系数209也可以称为经量化残差系数209。量化过程可以减少与部分或全部变换系数207有关的位深度。例如,可在量化期间将n位变换系数向下舍入到m位变换系数,其中n大于m。可通过调整量化参数(quantization parameter,QP)修改量化程度。例如,对于标量量化,可以应用不同的标度来实现较细或较粗的量化。较小量化步长对应较细量化,而较大量化步长对应较粗量化。可以通过量化参数(quantization parameter,QP)指示合适的量化步长。例如,量化参数可以为合适的量化步长的预定义集合的索引。例如,较小的量化参数可以对应精细量化(较小量化步长),较大量化参数可以对应粗糙量化(较大量化步长),反之亦然。量化可以包含除以量化步长以及例如通过逆量化210执行的对应的量化或逆量化,或者可以包含乘以量化步长。根据例如HEVC的一些标准的实施例可以使用量化参数来确定量化步长。一般而言,可以基于量化参数使用包含除法的等式的定点近似来计算量化步长。可以引入额外比例缩放因子来进行量化和反量化,以恢复可能由于在用于量化步长和量化参数的等式的定点近似中使用的标度而修改的残差块的范数。在一个实例实施方式中,可以合并逆变换和反量化的标度。或者,可以使用自定义量化表并在例如比特流中将其从编码器通过信号发送到解码器。量化是有损操作,其中量化步长越大,损耗越大。
逆量化单元210用于在经量化系数上应用量化单元208的逆量化,以获取经反量化系数211,例如,基于或使用与量化单元208相同的量化步长,应用量化单元208应用的量化方案的逆量化方案。经反量化系数211也可以称为经反量化残差系数211,对应于变换系数207,虽然由于量化造成的损耗通常与变换系数不相同。
逆变换处理单元212用于应用变换处理单元206应用的变换的逆变换,例如,逆离散余弦变换(discrete cosine transform,DCT)或逆离散正弦变换(discrete sine transform,DST),以在样本域中获取逆变换块213。逆变换块213也可以称为逆变换经反量化块213或逆变换残差块213。
重构单元214(例如,求和器214)用于将逆变换块213(即经重构残差块213)添加至预测块265,以在样本域中获取经重构块215,例如,将经重构残差块213的样本值与预测块265的样本值相加。
可选地,例如线缓冲器216的缓冲器单元216(或简称“缓冲器”216)用于缓冲或存储经重构块215和对应的样本值,用于例如帧内预测。在其它的实施例中,编码器可以用于使用存储在缓冲器单元216中的未经滤波的经重构块和/或对应的样本值来进行任何类别的估计和 /或预测,例如帧内预测。
例如,编码器20的实施例可以经配置以使得缓冲器单元216不只用于存储用于帧内预测254的经重构块215,也用于环路滤波器单元220(在图2中未示出),和/或,例如使得缓冲器单元216和经解码图片缓冲器单元230形成一个缓冲器。其它实施例可以用于将经滤波块221和/或来自经解码图片缓冲器230的块或样本(图2中均未示出)用作帧内预测254的输入或基础。
环路滤波器单元220(或简称“环路滤波器”220)用于对经重构块215进行滤波以获取经滤波块221,从而顺利进行像素转变或提高视频质量。环路滤波器单元220旨在表示一个或多个环路滤波器,例如去块滤波器、样本自适应偏移(sample-adaptive offset,SAO)滤波器或其它滤波器,例如双边滤波器、自适应环路滤波器(adaptive loop filter,ALF),或锐化或平滑滤波器,或协同滤波器。尽管环路滤波器单元220在图2中示出为环内滤波器,但在其它配置中,环路滤波器单元220可实施为环后滤波器。经滤波块221也可以称为经滤波的经重构块221。经解码图片缓冲器230可以在环路滤波器单元220对经重构编码块执行滤波操作之后存储经重构编码块。
编码器20(对应地,环路滤波器单元220)的实施例可以用于输出环路滤波器参数(例如,样本自适应偏移信息),例如,直接输出或由熵编码单元270或任何其它熵编码单元熵编码后输出,例如使得解码器30可以接收并应用相同的环路滤波器参数用于解码。
经解码图片缓冲器(decoded picture buffer,DPB)230可以为存储参考图片数据供编码器20编码视频数据之用的参考图片存储器。DPB 230可由多种存储器设备中的任一个形成,例如动态随机存储器(dynamic random access memory,DRAM)(包含同步DRAM(synchronous DRAM,SDRAM)、磁阻式RAM(magnetoresistive RAM,MRAM)、电阻式RAM(resistive RAM,RRAM))或其它类型的存储器设备。可以由同一存储器设备或单独的存储器设备提供DPB 230和缓冲器216。在某一实例中,经解码图片缓冲器(decoded picture buffer,DPB)230用于存储经滤波块221。经解码图片缓冲器230可以进一步用于存储同一当前图片或例如先前经重构图片的不同图片的其它先前的经滤波块,例如先前经重构和经滤波块221,以及可以提供完整的先前经重构亦即经解码图片(和对应参考块和样本)和/或部分经重构当前图片(和对应参考块和样本),例如用于帧间预测。在某一实例中,如果经重构块215无需环内滤波而得以重构,则经解码图片缓冲器(decoded picture buffer,DPB)230用于存储经重构块215。
预测处理单元260,也称为块预测处理单元260,用于接收或获取图像块203(当前图片201的当前图像块203)和经重构图片数据,例如来自缓冲器216的同一(当前)图片的参考样本和/或来自经解码图片缓冲器230的一个或多个先前经解码图片的参考图片数据231,以及用于处理这类数据进行预测,即提供可以为经帧间预测块245或经帧内预测块255的预测块265。
模式选择单元262可以用于选择预测模式(例如帧内或帧间预测模式)和/或对应的用作预测块265的预测块245或255,以计算残差块205和重构经重构块215。
模式选择单元262的实施例可以用于选择预测模式(例如,从预测处理单元260所支持的那些预测模式中选择),所述预测模式提供最佳匹配或者说最小残差(最小残差意味着传输或存储中更好的压缩),或提供最小信令开销(最小信令开销意味着传输或存储中更好的压缩), 或同时考虑或平衡以上两者。模式选择单元262可以用于基于码率失真优化(rate distortion optimization,RDO)确定预测模式,即选择提供最小码率失真优化的预测模式,或选择相关码率失真至少满足预测模式选择标准的预测模式。
下文将详细解释编码器20的实例(例如,通过预测处理单元260)执行的预测处理和(例如,通过模式选择单元262)执行的模式选择。
如上文所述,编码器20用于从(预先确定的)预测模式集合中确定或选择最好或最优的预测模式。预测模式集合可以包括例如帧内预测模式和/或帧间预测模式。
帧内预测模式集合可以包括35种不同的帧内预测模式,例如,如DC(或均值)模式和平面模式的非方向性模式,或如H.265中定义的方向性模式,或者可以包括67种不同的帧内预测模式,例如,如DC(或均值)模式和平面模式的非方向性模式,或如正在发展中的H.266中定义的方向性模式。
在可能的实现中,帧间预测模式集合取决于可用参考图片(即,例如前述存储在DBP 230中的至少部分经解码图片)和其它帧间预测参数,例如取决于是否使用整个参考图片或只使用参考图片的一部分,例如围绕当前块的区域的搜索窗区域,来搜索最佳匹配参考块,和/或例如取决于是否应用如半像素和/或四分之一像素内插的像素内插,帧间预测模式集合例如可包括先进运动矢量(Advanced Motion Vector Prediction,AMVP)模式和融合(merge)模式。具体实施中,帧间预测模式集合可包括本申请实施例改进的基于控制点的AMVP模式,以及,改进的基于控制点的merge模式。在一个实例中,帧内预测单元254可以用于执行下文描述的帧间预测技术的任意组合。
除了以上预测模式,本申请实施例也可以应用跳过模式和/或直接模式。
预测处理单元260可以进一步用于将图像块203分割成较小的块分区或子块,例如,通过迭代使用四叉树(quad-tree,QT)分割、二进制树(binary-tree,BT)分割或三叉树(triple-tree,TT)分割,或其任何组合,以及用于例如为块分区或子块中的每一个执行预测,其中模式选择包括选择分割的图像块203的树结构和选择应用于块分区或子块中的每一个的预测模式。
帧间预测单元244可以包含运动估计(motion estimation,ME)单元(图2中未示出)和运动补偿(motion compensation,MC)单元(图2中未示出)。运动估计单元用于接收或获取图片图像块203(当前图片201的当前图片图像块203)和经解码图片231,或至少一个或多个先前经重构块,例如,一个或多个其它/不同先前经解码图片231的经重构块,来进行运动估计。例如,视频序列可以包括当前图片和先前经解码图片31,或换句话说,当前图片和先前经解码图片31可以是形成视频序列的图片序列的一部分,或者形成该图片序列。
例如,编码器20可以用于从多个其它图片中的同一或不同图片的多个参考块中选择参考块,并向运动估计单元(图2中未示出)提供参考图片和/或提供参考块的位置(X、Y坐标)与当前块的位置之间的偏移(空间偏移)作为帧间预测参数。该偏移也称为运动向量(motion vector,MV)。
运动补偿单元用于获取帧间预测参数,并基于或使用帧间预测参数执行帧间预测来获取帧间预测块245。由运动补偿单元(图2中未示出)执行的运动补偿可以包含基于通过运动估计(可能执行对子像素精确度的内插)确定的运动/块向量取出或生成预测块。内插滤波可从已知像素样本产生额外像素样本,从而潜在地增加可用于编码图片块的候选预测块的数目。一旦接收到用于当前图片块的PU的运动向量,运动补偿单元246可以在一个参考图片列表 中定位运动向量指向的预测块。运动补偿单元246还可以生成与块和视频条带相关联的语法元素,以供解码器30在解码视频条带的图片块时使用。
具体的,上述帧间预测单元244可向熵编码单元270传输语法元素,所述语法元素包括帧间预测参数(比如遍历多个帧间预测模式后选择用于当前块预测的帧间预测模式的指示信息)。可能应用场景中,如果帧间预测模式只有一种,那么也可以不在语法元素中携带帧间预测参数,此时解码端30可直接使用默认的预测模式进行解码。可以理解的,帧间预测单元244可以用于执行帧间预测技术的任意组合。
帧内预测单元254用于获取,例如接收同一图片的图片块203(当前图片块)和一个或多个先前经重构块,例如经重构相相邻块,以进行帧内估计。例如,编码器20可以用于从多个(预定)帧内预测模式中选择帧内预测模式。
编码器20的实施例可以用于基于优化标准选择帧内预测模式,例如基于最小残差(例如,提供最类似于当前图片块203的预测块255的帧内预测模式)或最小码率失真。
帧内预测单元254进一步用于基于如所选择的帧内预测模式的帧内预测参数确定帧内预测块255。在任何情况下,在选择用于块的帧内预测模式之后,帧内预测单元254还用于向熵编码单元270提供帧内预测参数,即提供指示所选择的用于块的帧内预测模式的信息。在一个实例中,帧内预测单元254可以用于执行帧内预测技术的任意组合。
具体的,上述帧内预测单元254可向熵编码单元270传输语法元素,所述语法元素包括帧内预测参数(比如遍历多个帧内预测模式后选择用于当前块预测的帧内预测模式的指示信息)。可能应用场景中,如果帧内预测模式只有一种,那么也可以不在语法元素中携带帧内预测参数,此时解码端30可直接使用默认的预测模式进行解码。
熵编码单元270用于将熵编码算法或方案(例如,可变长度编码(variable length coding,VLC)方案、上下文自适应VLC(context adaptive VLC,CAVLC)方案、算术编码方案、上下文自适应二进制算术编码(context adaptive binary arithmetic coding,CABAC)、基于语法的上下文自适应二进制算术编码(syntax-based context-adaptive binary arithmetic coding,SBAC)、概率区间分割熵(probability interval partitioning entropy,PIPE)编码或其它熵编码方法或技术)应用于经量化残差系数209、帧间预测参数、帧内预测参数和/或环路滤波器参数中的单个或所有上(或不应用),以获取可以通过输出272以例如经编码比特流21的形式输出的经编码图片数据21。可以将经编码比特流传输到视频解码器30,或将其存档稍后由视频解码器30传输或检索。熵编码单元270还可用于熵编码正被编码的当前视频条带的其它语法元素。
视频编码器20的其它结构变型可用于编码视频流。例如,基于非变换的编码器20可以在没有针对某些块或帧的变换处理单元206的情况下直接量化残差信号。在另一实施方式中,编码器20可具有组合成单个单元的量化单元208和逆量化单元210。
具体的,在本申请实施例中,编码器20可用于实现后文实施例中描述的帧间预测方法。
应当理解的是,视频编码器20的其它的结构变化可用于编码视频流。例如,对于某些图像块或者图像帧,视频编码器20可以直接地量化残差信号而不需要经变换处理单元206处理,相应地也不需要经逆变换处理单元212处理;或者,对于某些图像块或者图像帧,视频编码器20没有产生残差数据,相应地不需要经变换处理单元206、量化单元208、逆量化单元210和逆变换处理单元212处理;或者,视频编码器20可以将经重构图像块作为参考块直接地进行存储而不需要经滤波器220处理;或者,视频编码器20中量化单元208和逆量化单元210 可以合并在一起。环路滤波器220是可选的,以及针对无损压缩编码的情况下,变换处理单元206、量化单元208、逆量化单元210和逆变换处理单元212是可选的。应当理解的是,根据不同的应用场景,帧间预测单元244和帧内预测单元254可以是被选择性的启用。
参见图3,图3示出用于实现本申请实施例的解码器30的实例的示意性/概念性框图。视频解码器30用于接收例如由编码器20编码的经编码图片数据(例如,经编码比特流)21,以获取经解码图片231。在解码过程期间,视频解码器30从视频编码器20接收视频数据,例如表示经编码视频条带的图片块的经编码视频比特流及相关联的语法元素。
在图3的实例中,解码器30包括熵解码单元304、逆量化单元310、逆变换处理单元312、重构单元314(例如求和器314)、缓冲器316、环路滤波器320、经解码图片缓冲器330以及预测处理单元360。预测处理单元360可以包含帧间预测单元344、帧内预测单元354和模式选择单元362。在一些实例中,视频解码器30可执行大体上与参照图2的视频编码器20描述的编码遍次互逆的解码遍次。
熵解码单元304用于对经编码图片数据21执行熵解码,以获取例如经量化系数309和/或经解码的编码参数(图3中未示出),例如,帧间预测、帧内预测参数、环路滤波器参数和/或其它语法元素中(经解码)的任意一个或全部。熵解码单元304进一步用于将帧间预测参数、帧内预测参数和/或其它语法元素转发至预测处理单元360。视频解码器30可接收视频条带层级和/或视频块层级的语法元素。
逆量化单元310功能上可与逆量化单元110相同,逆变换处理单元312功能上可与逆变换处理单元212相同,重构单元314功能上可与重构单元214相同,缓冲器316功能上可与缓冲器216相同,环路滤波器320功能上可与环路滤波器220相同,经解码图片缓冲器330功能上可与经解码图片缓冲器230相同。
预测处理单元360可以包括帧间预测单元344和帧内预测单元354,其中帧间预测单元344功能上可以类似于帧间预测单元244,帧内预测单元354功能上可以类似于帧内预测单元254。预测处理单元360通常用于执行块预测和/或从经编码数据21获取预测块365,以及从例如熵解码单元304(显式地或隐式地)接收或获取预测相关参数和/或关于所选择的预测模式的信息。
当视频条带经编码为经帧内编码(I)条带时,预测处理单元360的帧内预测单元354用于基于信号表示的帧内预测模式及来自当前帧或图片的先前经解码块的数据来产生用于当前视频条带的图片块的预测块365。当视频帧经编码为经帧间编码(即B或P)条带时,预测处理单元360的帧间预测单元344(例如,运动补偿单元)用于基于运动向量及从熵解码单元304接收的其它语法元素生成用于当前视频条带的视频块的预测块365。对于帧间预测,可从一个参考图片列表内的一个参考图片中产生预测块。视频解码器30可基于存储于DPB330中的参考图片,使用默认建构技术来建构参考帧列表:列表0和列表1。
预测处理单元360用于通过解析运动向量和其它语法元素,确定用于当前视频条带的视频块的预测信息,并使用预测信息产生用于正经解码的当前视频块的预测块。在本申请的一实例中,预测处理单元360使用接收到的一些语法元素确定用于编码视频条带的视频块的预测模式(例如,帧内或帧间预测)、帧间预测条带类型(例如,B条带、P条带或GPB条带)、用于条带的参考图片列表中的一个或多个的建构信息、用于条带的每个经帧间编码视频块的 运动向量、条带的每个经帧间编码视频块的帧间预测状态以及其它信息,以解码当前视频条带的视频块。在本公开的另一实例中,视频解码器30从比特流接收的语法元素包含接收自适应参数集(adaptive parameter set,APS)、序列参数集(sequence parameter set,SPS)、图片参数集(picture parameter set,PPS)或条带标头中的一个或多个中的语法元素。
逆量化单元310可用于逆量化(即,反量化)在比特流中提供且由熵解码单元304解码的经量化变换系数。逆量化过程可包含使用由视频编码器20针对视频条带中的每一视频块所计算的量化参数来确定应该应用的量化程度并同样确定应该应用的逆量化程度。
逆变换处理单元312用于将逆变换(例如,逆DCT、逆整数变换或概念上类似的逆变换过程)应用于变换系数,以便在像素域中产生残差块。
重构单元314(例如,求和器314)用于将逆变换块313(即经重构残差块313)添加到预测块365,以在样本域中获取经重构块315,例如通过将经重构残差块313的样本值与预测块365的样本值相加。
环路滤波器单元320(在编码循环期间或在编码循环之后)用于对经重构块315进行滤波以获取经滤波块321,从而顺利进行像素转变或提高视频质量。在一个实例中,环路滤波器单元320可以用于执行下文描述的滤波技术的任意组合。环路滤波器单元320旨在表示一个或多个环路滤波器,例如去块滤波器、样本自适应偏移(sample-adaptive offset,SAO)滤波器或其它滤波器,例如双边滤波器、自适应环路滤波器(adaptive loop filter,ALF),或锐化或平滑滤波器,或协同滤波器。尽管环路滤波器单元320在图3中示出为环内滤波器,但在其它配置中,环路滤波器单元320可实施为环后滤波器。
随后将给定帧或图片中的经解码视频块321存储在存储用于后续运动补偿的参考图片的经解码图片缓冲器330中。
解码器30用于例如,藉由输出332输出经解码图片31,以向用户呈现或供用户查看。
视频解码器30的其它变型可用于对压缩的比特流进行解码。例如,解码器30可以在没有环路滤波器单元320的情况下生成输出视频流。例如,基于非变换的解码器30可以在没有针对某些块或帧的逆变换处理单元312的情况下直接逆量化残差信号。在另一实施方式中,视频解码器30可以具有组合成单个单元的逆量化单元310和逆变换处理单元312。
具体的,在本申请实施例中,解码器30用于实现后文实施例中描述的帧间预测方法。
应当理解的是,视频解码器30的其它结构变化可用于解码经编码视频位流。例如,视频解码器30可以不经滤波器320处理而生成输出视频流;或者,对于某些图像块或者图像帧,视频解码器30的熵解码单元304没有解码出经量化的系数,相应地不需要经逆量化单元310和逆变换处理单元312处理。环路滤波器320是可选的;以及针对无损压缩的情况下,逆量化单元310和逆变换处理单元312是可选的。应当理解的是,根据不同的应用场景,帧间预测单元和帧内预测单元可以是被选择性的启用。
应当理解的是,本申请的编码器20和解码器30中,针对某个环节的处理结果可以经过进一步处理后,输出到下一个环节,例如,在插值滤波、运动矢量推导或环路滤波等环节之后,对相应环节的处理结果进一步进行Clip或移位shift等操作。
例如,按照相邻仿射编码块的运动矢量推导得到的当前图像块的控制点的运动矢量,或者推导得到的当前图像块的子块的运动矢量,可以经过进一步处理,本申请对此不做限定。 例如,对运动矢量的取值范围进行约束,使其在一定的位宽内。假设允许的运动矢量的位宽为bitDepth,则运动矢量的范围为-2^(bitDepth-1)~2^(bitDepth-1)-1,其中“^”符号表示幂次方。如bitDepth为16,则取值范围为-32768~32767。如bitDepth为18,则取值范围为-131072~131071。又例如,对运动矢量(例如一个8x8图像块内的四个4x4子块的运动矢量MV)的取值进行约束,使得所述四个4x4子块MV的整数部分之间的最大差值不超过N个像素,例如不超过一个像素。
可以通过以下两种方式进行约束,使其在一定的位宽内:
方式1,将运动矢量溢出的高位去除:
ux=(vx+2 bitDepth)%2 bitDepth
vx=(ux>=2 bitDepth-1)?(ux-2 bitDepth):ux
uy=(vy+2 bitDepth)%2 bitDepth
vy=(uy>=2 bitDepth-1)?(uy-2 bitDepth):uy
其中,vx为图像块或所述图像块的子块的运动矢量的水平分量,vy为图像块或所述图像块的子块的运动矢量的垂直分量,ux和uy为中间值;bitDepth表示位宽。
例如vx的值为-32769,通过以上公式得到的为32767。因为在计算机中,数值是以二进制的补码形式存储的,-32769的二进制补码为1,0111,1111,1111,1111(17位),计算机对于溢出的处理为丢弃高位,则vx的值为0111,1111,1111,1111,则为32767,与通过公式处理得到的结果一致。
方法2,将运动矢量进行Clipping,如以下公式所示:
vx=Clip3(-2 bitDepth-1,2 bitDepth-1-1,vx)
vy=Clip3(-2 bitDepth-1,2 bitDepth-1-1,vy)
其中vx为图像块或所述图像块的子块的运动矢量的水平分量,vy为图像块或所述图像块的子块的运动矢量的垂直分量;其中,x、y和z分别对应MV钳位过程Clip3的三个输入值,所述Clip3的定义为,表示将z的值钳位到区间[x,y]之间:
Figure PCTCN2019122735-appb-000001
参见图4,图4是本申请实施例提供的视频译码设备400(例如视频编码设备400或视频解码设备400)的结构示意图。视频译码设备400适于实施本文所描述的实施例。在一个实施例中,视频译码设备400可以是视频解码器(例如图1A的解码器30)或视频编码器(例如图1A的编码器20)。在另一个实施例中,视频译码设备400可以是上述图1A的解码器30或图1A的编码器20中的一个或多个组件。
视频译码设备400包括:用于接收数据的入口端口410和接收单元(Rx)420,用于处理数据的处理器、逻辑单元或中央处理器(CPU)430,用于传输数据的发射器单元(Tx)440 和出口端口450,以及,用于存储数据的存储器460。视频译码设备400还可以包括与入口端口410、接收器单元420、发射器单元440和出口端口450耦合的光电转换组件和电光(EO)组件,用于光信号或电信号的出口或入口。
处理器430通过硬件和软件实现。处理器430可以实现为一个或多个CPU芯片、核(例如,多核处理器)、FPGA、ASIC和DSP。处理器430与入口端口410、接收器单元420、发射器单元440、出口端口450和存储器460通信。处理器430包括译码模块470(例如编码模块470或解码模块470)。编码/解码模块470实现本文中所公开的实施例,以实现本申请实施例所提供的色度块预测方法。例如,编码/解码模块470实现、处理或提供各种编码操作。因此,通过编码/解码模块470为视频译码设备400的功能提供了实质性的改进,并影响了视频译码设备400到不同状态的转换。或者,以存储在存储器460中并由处理器430执行的指令来实现编码/解码模块470。
存储器460包括一个或多个磁盘、磁带机和固态硬盘,可以用作溢出数据存储设备,用于在选择性地执行这些程序时存储程序,并存储在程序执行过程中读取的指令和数据。存储器460可以是易失性和/或非易失性的,可以是只读存储器(ROM)、随机存取存储器(RAM)、随机存取存储器(ternary content-addressable memory,TCAM)和/或静态随机存取存储器(SRAM)。
参见图5,图5是根据一示例性实施例的可用作图1A中的源设备12和目的地设备14中的任一个或两个的装置500的简化框图。装置500可以实现本申请的技术。换言之,图5为本申请实施例的编码设备或解码设备(简称为译码设备500)的一种实现方式的示意性框图。其中,译码设备500可以包括处理器510、存储器530和总线系统550。其中,处理器和存储器通过总线系统相连,该存储器用于存储指令,该处理器用于执行该存储器存储的指令。译码设备的存储器存储程序代码,且处理器可以调用存储器中存储的程序代码执行本申请描述的各种视频编码或解码方法。为避免重复,这里不再详细描述。
在本申请实施例中,该处理器510可以是中央处理单元(Central Processing Unit,简称为“CPU”),该处理器510还可以是其他通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
该存储器530可以包括只读存储器(ROM)设备或者随机存取存储器(RAM)设备。任何其他适宜类型的存储设备也可以用作存储器530。存储器530可以包括由处理器510使用总线550访问的代码和数据531。存储器530可以进一步包括操作系统533和应用程序535,该应用程序535包括允许处理器510执行本申请描述的视频编码或解码方法(尤其是本申请描述的帧间预测方法)的至少一个程序。例如,应用程序535可以包括应用1至N,其进一步包括执行在本申请描述的视频编码或解码方法的视频编码或解码应用(简称视频译码应用)。
该总线系统550除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线系统550。
可选的,译码设备500还可以包括一个或多个输出设备,诸如显示器570。在一个示例中,显示器570可以是触感显示器,其将显示器与可操作地感测触摸输入的触感单元合并。 显示器570可以经由总线550连接到处理器510。
下面详细阐述本申请实施例的方案:
视频编码主要包括帧内预测(Intra Prediction)、帧间预测(Inter Prediction)、变换(Transform)、量化(Quantization)、熵编码(Entropy encode)、环内滤波(in-loop filtering)(主要为去块滤波,de-blocking filtering)等环节。将图像划分为编码块之后进行帧内预测或者帧间预测,并且在得到残差之后进行变换量化,最终进行熵编码并输出码流。此处编码块为由像素点组成的大小的阵列(M可以等于N,也可以不等于N),并且已知各个像素点位置的像素值。
帧内预测是指利用当前图像内已重建区域内像素点的像素值对当前编码块内像素点的像素值进行预测。
帧间预测是在已重建的图像中,为当前图像中的当前编码块寻找匹配的参考块,从而得到当前编码块的运动信息,然后根据运动信息计算出当前编码块中像素点的像素值的预测信息或者预测值(以下不再区分信息和值)。其中,计算运动信息的过程称为运动估计(Motion estimation,ME),计算出当前编码块中像素点的像素值的预测值的过程称为运动补偿(Motion compensation,MC)。
需要说明的是,当前编码块的运动信息包括了预测方向的指示信息(通常为前向预测、后向预测或者双向预测),一个或两个指向参考块的运动矢量(Motion vector,MV),以及参考块所在图像的指示信息(通常记为参考帧索引,Reference index)。
前向预测是指当前编码块从前向参考图像集合中选择一个参考图像获取参考块。后向预测是指当前编码块从后向参考图像集合中选择一个参考图像获取参考块。双向预测是指从前向和后向参考图像集合中各选择一个参考图像获取参考块。当使用双向预测方法时,当前编码块会存在两个参考块,每个参考块各自需要运动矢量和参考帧索引进行指示,然后根据两个参考块内像素点的像素值确定当前块内像素点像素值的预测值。
运动估计过程需要为当前编码块在参考图像中尝试多个参考块,最终使用哪一个或者哪几个参考块用作预测则使用率失真优化(Rate-distortion optimization,RDO)或者其他方法确定。
利用帧内预测或者帧间预测得到预测信息之后,当前编码块内像素点的像素值减去对应的预测信息便得到残差信息,然后利用离散余弦变换(Discrete Cosine Transformation,DCT)等方法对残差信息进行变换,再使用量化熵编码得到码流。预测信号加上重建残差信号之后需进一步进行滤波操作,进而得到重建信号,并将其作为后续编码的参考信号。
解码则相当于编码的逆过程。例如,首先利用熵解码反量化反变换得到残差信息,解码码流以确定当前编码块使用的是帧内预测还是帧间预测。如果是帧内预测,则利用周围已重建区域内像素点的像素值按照所使用的帧内预测方法构建预测信息。如果是帧间预测,则需要解析出运动信息,并使用所解析出的运动信息在已重建的图像中确定参考块,并将块内像素点的像素值作为预测信息,此过程称为运动补偿(Motion compensation,MC)。使用预测信息加上残差信息经过滤波操作便可以得到重建信息。
在HEVC中,使用两种帧间预测模式,分别为先进的运动矢量预测(Advanced Motion Vector Prediction,AMVP)模式和融合(Merge)模式。
对于AMVP模式,先通过当前编码块空域或者时域相邻的已编码块的运动信息,构建候选运动矢量列表,然后通过从候选运动矢量列表中确定最优的运动矢量作为当前编码块的运动矢量预测值(Motion vector predictor,MVP)。率失真代价由公式J=SAD+λ计算获得,其中J为率失真代价RD Cost,SAD为使用候选运动矢量预测值进行运动估计后得到的预测像素值与原始像素值之间的绝对误差和(Sum of Absolute Differences,SAD),R为码率,λ为拉格朗日乘子,编码端将选择的运动矢量预测值在候选运动矢量列表中的索引值和参考帧索引值传递到解码端。进一步地,在MVP为中心的邻域内进行运动搜索获得当前编码块实际的运动矢量,编码端将MVP与实际运动矢量之间的差值(Motion vector difference)传递到解码端。
对于Merge模式,先通过当前编码块空域或者时域相邻的已编码块的运动信息,构建候选运动信息列表,然后通过率失真代价从候选运动信息列表中确定最优的运动信息作为当前编码块的运动信息,再将最优的运动信息在候选运动信息列表中位置的索引值(记为merge index,下同)传递到解码端。当前编码块空域和时域候选运动信息如图6所示,空域候选运动信息来自于空间相邻的5个块(A0,A1,B0,B1和B2),若相邻块不可得或者为帧内编码模式,则不加入候选运动信息列表。当前编码块的时域候选运动信息根据参考帧和当前帧的图序计数(Picture order count,POC)对参考帧中对应位置块的MV进行缩放后获得。首先判断参考帧中位置为T的块是否可得,若不可得则选择位置在C的块。
在HEVC的帧间预测中,编码块内的所有像素都采用了相同的运动信息,然后根据运动信息进行运动补偿,得到编码块的像素的预测值。
一个视频序列包含一定数量的图片——通常称为帧(Frame)。相邻的图片通常很相似,也就是说,包含了很多冗余。使用运动补偿的目的是通过消除这种相邻帧之间的冗余,来提高压缩比。运动补偿是一种描述相邻帧(相邻在这里表示在编码关系上相邻,在播放顺序上两帧未必相邻)差别的方法,属于帧间预测过程中的一环。在做运动补偿之前,编码块的运动信息已经通过运动估计或者码流解码得到。这些运动信息主要包括:(1)编码块的预测方向:包括前向、后向和双向预测,前向预测表明编码块由前面的已编码帧预测得到,后向预测表示编码块由后面的已编码帧预测得到,双向预测则表明编码块是结合前后向已编码帧预测得到的;(2)编码块的参考帧索引,指示当前编码块的参考块所在的帧;(3)编码块的运动矢量MV,表示编码块相对于参考块的运动位移,MV包括水平分量(记作MV x)和垂直分量(记作MV y),分别表示编码块相对于参考块在水平方向和垂直方向上的运动位移。当编码块是前向或者后向预测时,MV只有一个,当编码块是双向预测时,MV有两个。图7给出了以上运动信息的说明。在图7以及下文的关于运动信息以及预测信息的描述中,0表示前向,1表示后向。例如,Ref0表示前向参考帧,Ref1表示后向参考帧,MV0表示前向运动矢量,MV1表示后向运动矢量。A、B、C分别表示前向参考块、当前编码块和后向参考块。Cur为当前编码帧,虚线表示B的运动轨迹。运动补偿就是根据运动信息找到参考块,对参考块经过处理得到编码块的预测块的过程。
前向预测的运动补偿基本过程如下:图7所示,当前编码块为图中的块B,B的宽和高分别为W和H。此时根据运动信息已知当前编码块B的前向参考帧为Ref0帧,当前编码块B的前向运动矢量MV0=(MV0 x,MV0 y)。在编码Cur帧中的编码块B时,首先根据B的左上角的点在Cur帧中的坐标(i,j)在第Ref0帧中找到同样的坐标点,根据块B的宽和高可以 得到Ref0中的块B’,然后根据块B’的MV0,将B’移动到块A。最后对块A经过插值处理得到当前编码块B的预测块,当前编码块B的预测块中各个像素点的像素值称为块B中对应像素点的预测值。后向预测与前向预测的运动补偿过程相同,只是参考方向不同。需要说明的是,后向预测与前向预测运动补偿得到的预测块分别称为前向预测块和后向预测块,当编码块不是双向预测时,此时得到的前向预测块和后向预测块就是当前编码块的预测块。
对于双向预测,首先根据运动信息分别按照前向预测和后向预测的运动补偿过程,得到前向预测块和后向预测块,然后将前向预测块和后向预测块中位置相同的像素值经过加权预测或者基于双向预测的光流技术(Bi-directional optical flow,BIO或BDOF)才得到编码块B的预测块。
加权预测方法在求当前编码块的预测值时,只需将前向预测块的像素值和后向预测块的同位像素值依次加权求和即可,即
PredB(i,j)=ω 0PredA(i,j)+ω 1PredC(i,j)         (1)
在公式(1)中,PredB(i,j)、PredA(i,j)和PredC(i,j)分别为当前编码块的预测块、前向预测块和后向预测块在坐标(i,j)的预测值。ω 0、ω 1(0<=ω 0<=1,0<=ω 1<=1,且ω 01=1)分别为加权系数,不同的编码器可能有不同的具体取值。通常地,ω 0和ω 1均为1/2。
图8给出了一个加权求和得出当前编码块的预测块的示例。图8中,PredB、PredA和PredC分别为当前编码块的预测块、前向预测块和后向预测块,大小为4x4,预测块中小块的数值为某一点的预测值,PredB、PredA和PredC分别以左上角为原点建立坐标系。例如,PredB在坐标(0,0)处的预测值为:
PredB(0,0)=ω 0PredA(0,0)+ω 1PredC(0,0)
=ω 0a 0,01c 0,0
PredB在坐标(0,1)处的预测值为:
PredB(0,1)=ω 0PredA(0,1)+ω 1PredC(0,1)
=ω 0a 0,11c 0,1
依次计算其余各点,不再赘述。
可以看出,双向预测加权预测技术计算简单但是这种基于块级的运动补偿方法十分粗糙,尤其对于纹理复杂的图像预测效果差,压缩效率不高。
BIO在当前CU做完双向预测的运动补偿,得到前后向预测块,再根据前后向预测值,推导当前CU中每一个4x4子块的修正运动矢量。最后对当前编码块内的各个像素点再进行一次补偿,最终得到当前CU的预测块。
每个4x4子块的修正运动矢量(v x,v y)通过将BIO应用到子块周边的6x6窗口Ω,从而最小化L0和L1的预测值得到。具体地,(v x,v y)通过公式进行推导。
Figure PCTCN2019122735-appb-000002
其中,
Figure PCTCN2019122735-appb-000003
为floor函数(floor(A)表示不大于A的最大整数);th' BIO=2 13-BD,为防止修正运动矢量过大导致误差传递的阈值。S 2,m=S 2>>12,S 2,s=S 2&(2 12-1)。BD为当前的像素 位宽。?运算表示如果S 1>0,则
Figure PCTCN2019122735-appb-000004
否则,v x=0。&是位与操作。
S 1,S 2,S 3,S 5和S 6按照以下公式计算:
Figure PCTCN2019122735-appb-000005
其中,
Figure PCTCN2019122735-appb-000006
θ(i,j)=(I (1)(i,j)>>6)-(I (0)(i,j)>>6)
其中,I (k)(i,j)为当前CU中(i,j)像素位置的预测值(k等于0或1,0表示前向,1表示后向,下同);
Figure PCTCN2019122735-appb-000007
Figure PCTCN2019122735-appb-000008
分别为(i,j)像素位置的水平梯度值和数值梯度值,通过以下公式得到:
Figure PCTCN2019122735-appb-000009
根据公式(2)得到修正运动矢量后,当前块中各个像素点的最终预测值,按照以下公式确定:
Figure PCTCN2019122735-appb-000010
其中shift和o offset为15-BD和1<<(14-BD)+2·(1<<13)。rnd(.)为rounding函数(四舍五入)。
由于计算一个4x4子块的修正运动矢量,需要采用其所在6x6区域的前后向预测值I (k)(x,y),前后向的水平和竖直梯度值
Figure PCTCN2019122735-appb-000011
Figure PCTCN2019122735-appb-000012
而计算6x6区域的梯度值,需要 用到8x8区域的预测值。因此,在通过插值滤波器获得前后向预测值时,需要向四周各扩展2行2列,得到尺寸为(W+4)*(H+4)的预测像素块,才能计算(W+2)*(H+2)的梯度值,其中W为当前CU的宽度,H为当前CU的高度。
为了降低BIO的复杂度,现有技术对于CU的边界进行了特殊的处理。
首先,按照8抽头滤波器得到W*H区域的预测值,而只向四周扩展1行1列,通过bilinear滤波器得到扩展区域的预测值,从而获得(W+2)*(H+2)区域的预测像素值。
接着,根据(W+2)*(H+2)区域的预测像素值,按照公式(5),可计算得到W*H区域的梯度值。
最后,按照padding的方法,将W*H区域的梯度值向四周扩充,得到(W+2)*(H+2)区域的梯度值;将W*H区域的预测值向四周扩充,得到(W+2)*(H+2)区域的预测值。Padding如图9所示,即将边缘的像素值赋值给扩展区域。
BIO的具体实现流程如下:
步骤1:确定当前CU的运动信息
当前CU的运动信息可以Merge模式或者AMVP模式(见背景技术中描述)或者其他模式确定得到,在此不做限定。
需要说明的是,其他运动信息的确定方法也可应用到本申请中,在此不再赘述。
步骤2:判断当前CU是否满足BIO的使用条件
若当前CU采用双向预测,并且前向参考帧号POC_L0、后向参考帧号POC_L1和当前帧号POC_Cur的关系满足以下公式,则当前CU满足BIO的使用条件:
(POC_L0–POC_Cur)*(POC_L1–POC_Cur)<0
需要说明的是,也可以通过判断当前CU的尺寸是否大于预设的阈值,决定是否采用BIO。如只有当前CU的高度W>=8且宽度H>=8,才能采用BIO。
需要说明的是,其他BIO的使用条件也可应用到本申请中,在此不再赘述。
若当前CU满足BIO的使用条件,执行步骤3;否则,按照其他方式进行运动补偿。
步骤3:计算当前CU的前后向预测值
利用运动信息,进行运动补偿,得到前后向预测值I (k)(i,j),其中i=-1..cuW,j=-1..cuH(则得到(cuW+2)*(cuH+2)的预测矩阵)。
其中,I (k)(i,j)中,i=0..cuW-1,j=0..cuH-1,通过8抽头插值滤波器进行插值得到,其他位置预测值(扩展1行1列位置)通过bilinear插值滤波器插值得到。
需要说明的是,扩展区域的预测值也可以采用其他方法获得,如同样采用8抽头插值滤波器,或者直接采用整像素位置的参考像素,在此不做限定。
需要说明的是,在计算前后向预测值之间的SAD,判断其是否小于阈值TH_CU,若小于,则不执行BIO。否则,执行BIO。其他判断方法也可应用到本申请中,在此不再赘述。
SAD计算公式如下:
Figure PCTCN2019122735-appb-000013
阈值TH_CU可以设置为(1<<(BD–8+shift))*cuW*cuH,shift为Max(2,14-BD)。
步骤4:计算当前CU的前后向预测值的水平和竖直的梯度值
根据前后向预测值按照公式(4)计算得到水平和竖直的梯度值
Figure PCTCN2019122735-appb-000014
Figure PCTCN2019122735-appb-000015
其中i=0..cuW-1,j=0..cuH-1(则得到cuW*cuH的预测矩阵)。
步骤5:对当前CU的前后向预测值,及水平和竖直方向的梯度值进行Padding
如图9的方法进行Padding,得到I (k)(i,j)、
Figure PCTCN2019122735-appb-000016
Figure PCTCN2019122735-appb-000017
其中i=-1..cuW,j=-1..cuH(则得到(cuW+2)*(cuH+2)的预测矩阵、水平梯度矩阵和竖直梯度矩阵)。
步骤6:推导每个4x4子块的修正运动矢量,再进行加权
对于每个4x4的子块,按照公式(2)得到vx,vy,最后根据公式(6)进行加权,得到每个4x4子块的预测值。
需要说明的是,可以通过计算每个4x4子块的前后向预测值之间的SAD,判断其是否小于阈值TH_SCU,若小于,则直接进行加权平均;否则,根据公式(2)得到vx,vy,再根据公式(6)进行加权。其他判断方法也可应用到本申请中,在此不再赘述。TU_SCU可以设置为1<<(BD–3+shift)。
虚拟流水数据单元(VPDUs,Virtual pipeline data units)为非重叠的MxM亮度/NxN色度的处理单元。在硬件解码器中,连续的VPDU在不同的流水级中被同时处理。不同的流水级在同一时刻处理不同的VPDU。
VPDU的划分准则为:
1)若VPDU包括了一个或多个CU,CU完全被包含在VPDU中。
2)若CU包括一个或多个VPDU,VPDU完全被包含在CU中。
在现有技术中,VPDU的尺寸为64x64,如图10所示,虚线表示VPDU的边界,实线表示CU的边界。图11所示为非法的CU划分。
当CU的包括多个VPDU时,硬件解码器在处理时,拆分为连续的VPDU进行处理。例如CU尺寸为128x128,VPDU的尺寸为64x64,则连续处理4个VPDU。
本申请所要解决的技术问题在于当CU采用BIO技术进行运动补偿时,CU边界像素的处理方式与CU内部像素的处理方式不同。若CU内部存在VPDU划分边界,在进行BIO预测时,为了保证VPDU处理与CU处理的结果一致,需要将该边界按照CU内部像素的方式进行处理,增加了实现的复杂度。
参见图12,本申请实施例提供了一种帧间预测的方法,该方法可以应用于图2所示编码器中的帧间预测单元244或应用于图3所示解码器中的帧间预测单元344中,该方法可以是双向帧间预测的方法,包括:
步骤101:从预设图像划分宽度Width和待处理图像块的宽度cuW中选择最小的一个宽度,记作blkW,作为第一图像块的宽度,从预设图像划分高度Hight和待处理图像块的高度cuH中选择最小的一个高度,记作blkH,作为第一图像块的高度。
在本实施例的方法应用于编码器的情况下,编码器在对图像进行编码时,将图像划分成待处理图像块。在本步骤中,获取待处理图像块,然后选择最小宽度blkW=min(Width,cuW)并将最小宽度blkW作为第一图像块的宽度,以及选择最小高度blkH=min(Hight,cuH)并将最小高度blkH作为第一图像块的高度。
在本实施例的方法应用于解码器的情况下,解码器接收来自编码器的视频码流,该视频码流包括待处理图像块。在本步骤中,从视频码流中提取待处理图像块,然后选择最小宽度blkW=min(Width,cuW)并将最小宽度blkW作为第一图像块的宽度,以及选择最小高度blkH=min(Hight,cuH)并将最小高度blkH作为第一图像块的高度。
预设图像划分宽度Width和预设图像划分高度Hight可以分别与VPDU的宽度和高度相等。或者,预设图像划分宽度Width为64、32或16等数值,预设图像划分高度Hight为64、32或16等数值。例如,Width=64、Hight=64;或者,Width=32、Hight=32;或者,Width=16、Hight=16;或者,Width=64、Hight=32;或者,Width=32、Hight=64;或者,Width=64、Hight=16;或者,Width=16、Hight=64;或者,Width=32、Hight=16;或者,Width=16、Hight=32等。
步骤102:根据第一图像块的宽度blkW和高度blkH在待处理图像块中确定多个第一图像块。
应当理解,在一种可行的实施方式中,待处理图像块的宽度和高度分别与第一图像块的宽度和高度相同,即待处理图像块仅包含一个第一图像块。获取该第一图像块的预测值即获取待处理图像块的预测值。
对于任一个第一图像块,按如下步骤103至107的操作获取该第一图像块的预测值。
步骤103:基于待处理图像块的运动信息获取第一图像块的第一预测块,第一预测块的宽度大于第一图像块的宽度,第一预测块的高度大于第一图像块的高度。
待处理图像块的运动信息包括第一图像块的运动信息,第一图像块的运动信息包括参考图像和运动矢量等信息。本实施的帧间预测采用基于光流的双向预测方式(即前文所述的BIO或BDOF相关技术),所以第一图像块的运动信息包括前向参考图像、后向参考图像、前向运动矢量和后向运动矢量等信息。
在本实施例的方法应用于编码器的情况下,编码器可以采用Merge模式或者AMVP模式或者其他模式确定得到待处理图像块的运动信息,待处理图像块的运动信息中包括待处理图像块中的每个第一图像块的运动信息。在本步骤中,获取编码器确定的待处理图像块的运动信息,从待处理图像块的运动信息中获取第一图像块的运动信息。
在本实施例的方法应用于解码器的情况下,解码器接收来自编码器的视频码流中包括待处理图像块的运动信息,待处理图像块的运动信息中包括待处理图像块中的每个第一图像块的运动信息。在本步骤中,从视频码流中提取待处理图像块的运动信息,从待处理图像块的运动信息中获取第一图像块的运动信息。
第一图像块的第一预测块包括第一前向预测块和第一后向预测块。在本步骤中可以通过如下(1)至(8)的步骤获取第一图像块的第一前向预测块和第一后向预测块。该(1)至(8)的步骤可以为:
(1):根据第一图像块在待处理图像块中的第一位置和运动信息,在前向参考图像中确定第一前向区域,第一前向区域的宽度为blkW+2,高度为blkH+2。
例如,参见图13,第一图像块B的运动信息包括前向参考图像Ref0、后向参考图像Ref1、前向运动矢量MV0和后向运动矢量MV1。根据第一图像块B的第一位置在前向参考图像Ref0中确定第二前向区域B11,第二前向区域B11的宽度为blkW,高度为blkH。根据前向运动矢量MV0和第二前向区域B11的位置确定第三前向区域B12,第三前向区域B12的宽度为blkW,高度为blkH。确定包括第三前向区域B12的第一前向区域A1,第一前向区域A1的 宽度为blkW+2,高度为blkH+2,第三前向区域B12的中心和第一前向区域A1的中心重合。
(2):在前向参考图像中,判断第一前向区域的顶点位置是否与前向参考图像中的像素点位置重合,如果与前向参考图像中的像素点的位置重合,则从前向参考图像中获取位于第一前向区域内的图像块作为第一图像块的第一前向预测块;如果不与前向参考图像中的像素点的位置重合,则执行步骤(3)。
例如,参见图13,以第一前向区域A1左上顶点为例,假设在前向参考图像Ref0中,第一前向区域A1的左上顶点的顶点位置为(15,16),则该左上顶点的顶点位置与前向参考图像Ref0中的一个像素点的位置重合,该像素点是前向参考图像Ref0中的位置为(15,16)的像素点。再例如,假设在前向参考图像Ref0中,第一前向区域A1的左上顶点的顶点位置为(15.3,16.2),则该左上顶点的顶点位置不与前向参考图像Ref0中的像素点的位置重合,也就是说在前向参考图像Ref0中的位置(15.3,16.2)处无像素点。
(3):在前向参考图像中,确定与第一前向区域的顶点位置最近的一个像素点,以该像素点为顶点确定第四前向区域,第四前向区域的宽度为blkW+2,高度为blkH+2。
对于第一前向区域的任一个顶点位置,假设以第一前向区域的左上顶点位置为例,在前向参考图像中,确定与左上顶点位置最近的一个像素点,以该像素点为左上顶点确定第四前向区域,第四前向区域的宽度为blkW+2,高度为blkH+2。
例如,参见图13,第一前向区域A1的左上顶点的顶点位置为(15.3,16.2),在前向参考图像Ref0中确定离顶点位置(15.3,16.2)最近的一个像素点的位置为(15,16),以位置为(15,16)的像素点为左上顶点确定第四前向区域A2,第四前向区域A2的宽度为blkW+2,高度为blkH+2。
(4):确定包括第四前向区域的第五前向区域,第四前向区域的中心和第五前向区域的中心重合,第五前向区域的宽度为blkW+n+1,高度为blkH+n+1,在前向参考图像中获取位于第五前向区域的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块的第一前向预测块,第一前向预测块的宽度为blkW+2,高度为blkH+2,n为插值滤波器的抽头数目。
例如,以8抽头的插值滤波器为例,参见图13,确定包括第四前向区域A2的第五前向区域A3,第四前向区域A2的中心和第五前向区域A3的中心重合,第五前向区域A3的宽度为blkW+9,高度为blkH+9,在前向参考图像Ref0中获取位于第五前向区域A3的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块B的第一前向预测块,第一前向预测块的宽度为blkW+2,高度为blkH+2。
(5):根据第一图像块的第一位置和运动信息,在后向参考图像中确定第一后向区域,第一后向区域的宽度为blkW+2,高度为blkH+2。
例如,参见图13,根据第一图像块B的第一位置,在后向参考图像Ref1中确定第二后向区域C11,第二后向区域C11的宽度为blkW,高度为blkH。根据后向运动矢量MV1和第二后向区域C11的位置确定第三后向区域C12,第三后向区域C12的宽度为blkW,高度为blkH。确定包括第三后向区域C12的第一后向区域D1,第一后向区域D1的宽度为blkW+2,高度为blkH+2。第三后向区域C12的中心和第一后向区域D1的中心可以重合。
(6):在后向参考图像中,判断第一后向区域的顶点位置是否与后向参考图像中的像素点位置重合,如果与后向参考图像中的像素点的位置重合,则从后向参考图像中获取位于第一后向区域内的图像块作为第一图像块的第一后向预测块;如果不与后向参考图像中的像素 点的位置重合,则执行步骤(7)。
例如,参见图13,以第一后向区域A1左上顶点为例,假设在后向参考图像Ref0中,第一后向区域D1的左上顶点的顶点位置为(5,6),则该左上顶点的顶点位置与后向参考图像Ref0中的一个像素点的位置重合,该像素点是后向参考图像Ref0中的位置为(5,6)的像素点。再例如,假设在后向参考图像Ref0中,第一后向区域D1的左上顶点的顶点位置为(5.3,6.2),则该左上顶点的顶点位置不与后向参考图像Ref0中的像素点的位置重合,也就是说在后向参考图像Ref0中的位置(5.3,6.2)处无像素点。
(7):在后向参考图像中,确定与第一后向区域的顶点位置最近的一个像素点,以该像素点为顶点确定第四后向区域,第四后向区域的宽度为blkW+2,高度为blkH+2。
对于第一后向区域的任一个顶点位置,假设以第一后向区域的左上顶点位置为例,在后向参考图像中,确定与左上顶点位置最近的一个像素点,以该像素点为左上顶点确定第四后向区域,第四后向区域的宽度为blkW+2,高度为blkH+2。
例如,参见图13,第一后向区域D1的左上顶点的顶点位置为(5.3,6.2),在后向参考图像Ref1中确定离顶点位置(5.3,6.2)最近的一个像素点的位置为(5,6),以位置为(5,6)的像素点为左上顶点确定第四后向区域D2,第四后向区域D2的宽度为blkW+2,高度为blkH+2。
(8):确定包括第四后向区域的第五后向区域,第四后向区域的中心和第五后向区域的中心重合,第五后向区域的宽度为blkW+n+1,高度为blkH+n+1,在后向参考图像中获取位于第五后向区域的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块的第一后向预测块,第一后向预测块的宽度为blkW+2,高度为blkH+2。
例如,以8抽头的插值滤波器为例,参见图13,确定包括第四后向区域D2的第五后向区域D3,第四后向区域D2的中心和第五后向区域D3的中心重合,第五后向区域D3的宽度为blkW+9,高度为blkH+9,在后向参考图像Ref1中获取位于第五后向区域D3的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块B的第一后向预测块,第一后向预测块的宽度为blkW+2,高度为blkH+2。
插值滤波器的抽头数目n的取值可以为6、8或10等数值。
在执行本步骤时,还可以根据待处理图像块的运动信息确定是否使用BIO方式来进行帧间预测,在确定使用BIO方式来进行帧间预测时,开始本步骤的操作。该确定过程可以为:
确定待处理图像块的帧号、前向参考图像的帧号和后向参考图像的帧号是否满足预设BIO使用条件。如果满足预设BIO使用条件,确定使用BIO方式来进行帧间预测,开始本步骤的操作。如果不满足预设BIO使用条件,确定使用除BIO方式以外的其他方式来进行帧间预测,对于其他方式的实现过程在此不详细说明。
预设BIO使用条件可以为如下第一公式所示的条件。
第一公式为(POC_L0-POC_Cur)*(POC_L1-POC_Cur)<0;
在第一公式中,POC_L0为前向参考图像的帧号,POC_Cur为待处理图像块的帧号,POC_L1为后向参考图像的帧号,*为乘法运算。
在本步骤中,还可以根据第一图像块的第一前向预测块和第一后向预测块确定是否使用BIO方式来进行帧间预测,在确定使用BIO方式来进行帧间预测时,开始执行如下步骤104的操作。该确定过程可以为:
根据第一图像块的第一前向预测块和第一后向预测块,通过如下第二公式计算SAD。如果SAD超过预设阈值TH_CU,则确定使用BIO方式来进行帧间预测,开始如下步骤104的操作。如果SAD未超过预设阈值TH_CU,确定使用除BIO方式以外的其他方式来进行帧间预测,对于其他方式的实现过程在此不详细说明。
第二公式为:
Figure PCTCN2019122735-appb-000018
在第二公式中,I (1)(i,j)为第一后向预测块中的第i行第j列的像素点的预测值,I (0)(i,j)为第一前向预测块中的第i行第j列的像素点的预测值。
TH_CU=(1<<(BD-8+shift))*blkW*blkH,shift=Max(2,14-BD),BD为当前的像素位宽,abs()为取绝对值运算,<<为左移运算。
步骤104:对第一图像块的第一预测块进行梯度运算,得到第一图像块的第一梯度值矩阵,第一梯度值矩阵的宽度为blkW,高度为blkH。
第一梯度值矩阵包括第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵。
在本步骤中,根据第一预测块包括的各像素点的预测值,通过如下第三公式计算水平梯度值和竖直梯度值;计算出的每个水平梯度值对应一个行号和列号,计算的每个竖直梯度值对应一个行号和列号;根据计算的各水平梯度值对应的行号和列号,将计算的各水平梯度值组成第一图像块的第一水平梯度矩阵;根据计算的各竖直梯度值的行号和列号,将计算的各竖直梯度值组成第一图像块的第一竖直梯度矩阵。
其中,在计算梯度值矩阵中的某行或某列的梯度值时,根据该行号和该列号,从第一预测块获取两个像素点的预测值,根据该两个像素点的预测值通过如下第三公式计算出一个水平梯度值或一个竖直梯度值,该水平梯度值分别与该行号和该列号对应,或者,该竖直梯度值分别与该行号和该列号对应。
第一预测块包括第一前向预测块和第一后向预测块,根据第一前向预测块,通过如下第三公式计算前向水平梯度值和前向竖直梯度值;计算出的每个前向水平梯度值对应一个行号和列号,计算的每个前向竖直梯度值对应一个行号和列号;根据计算的各前向水平梯度值对应的行号和列号,将计算的各前向水平梯度值组成第一图像块的第一前向水平梯度矩阵;根据计算的各前向竖直梯度值的行号和列号,将计算的各前向竖直梯度值组成第一图像块的第一前向竖直梯度矩阵。
根据第一后向预测块,通过如下第三公式计算后向水平梯度值和后向竖直梯度值;计算出的每个后向水平梯度值对应一个行号和列号,计算的每个后向竖直梯度值对应一个行号和列号;根据计算的各后向水平梯度值对应的行号和列号,将计算的各后向水平梯度值组成第一图像块的第一后向水平梯度矩阵;根据计算的各后向竖直梯度值对应的行号和列号,将计算的各后向竖直梯度值组成第一图像块的第一后向竖直梯度矩阵。
第三公式为:
Figure PCTCN2019122735-appb-000019
在第三公式中:k的取值可以为0或1,0表示前向,1表示后向。
Figure PCTCN2019122735-appb-000020
为第i行第j列的水平梯度值,当k=0时,
Figure PCTCN2019122735-appb-000021
为第i行第j列的前向水平梯度值,当k=1时,
Figure PCTCN2019122735-appb-000022
为第i行第j列的后向水平梯度值,>>为右移运算。
I (k)(i+1,j)为第一预测块中的第i+1行第j列的像素点的预测值,当k=0时,I (k)(i+1,j)为第一前向预测块中的第i+1行第j列的像素点的预测值,当k=1时,I (k)(i+1,j)为第一后向预测块中的第i+1行第j列的像素点的预测值。I (k)(i-1,j)为第一预测块中的第i-1行第j列的像素点的预测值,当k=0时,I (k)(i-1,j)为第一前向预测块中的第i-1行第j列的像素点的预测值,当k=1时,I (k)(i-1,j)为第一后向预测块中的第i-1行第j列的像素点的预测值。
I (k)(i,j+1)为第一预测块中的第i行第j+1列的像素点的预测值,当k=0时,I (k)(i,j+1)为第一前向预测块中的第i行第j+1列的像素点的预测值,当k=1时,I (k)(i,j+1)为第一后向预测块中的第i行第j+1列的像素点的预测值。I (k)(i,j-1)为第一预测块中的第i行第j-1列的像素点的预测值,当k=0时,I (k)(i,j-1)为第一前向预测块中的第i行第j-1列的像素点的预测值,当k=1时,I (k)(i,j-1)为第一后向预测块中的第i行第j-1列的像素点的预测值。
需要说明的是:对于宽度为blkW+2,高度为blkH+2的第一预测块,根据该第一预测块,通过上述第三公式可以得到宽度为blkW,高度为blkH的第一梯度值矩阵,第一梯度值矩阵包括宽度为blkW,高度为blkH的第一水平梯度值矩阵和宽度为blkW,高度为blkH的第一竖直梯度值矩阵。也就是说,对于宽度为blkW+2,高度为blkH+2的第一前向预测块,根据该第一前向预测块,通过上述第三公式可以得到宽度为blkW,高度为blkH的第一前向水平梯度值矩阵,以及得到宽度为blkW,高度为blkH的第一前向竖直梯度值矩阵。对于宽度为blkW+2,高度为blkH+2的第一后向预测块,根据该第一后向预测块,通过上述第三公式可以得到宽度为blkW,高度为blkH的第一后向水平梯度值矩阵,以及得到宽度为blkW,高度为blkH的第一后向竖直梯度值矩阵。
步骤105:基于第一梯度值矩阵的矩阵边缘位置的梯度值,对第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度为和高度分别比第一图像块的宽度和高度大2个像素点的距离。
第一扩展后的第一梯度值矩阵的宽度和高度分别与第一预测块的宽度和高度相等。第一预测块的宽度为blkW+2,高度为blkH+2,第一梯度值矩阵的宽度也为blkW+2,高度也为blkH+2。
在本步骤中,分别对第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵的宽度和高度进行第一扩展,使第一扩展后的第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵的宽度均为blkW+2,高度均为blkH+2。
在本步骤中,第一梯度值矩阵包括四个边缘,对于第一梯度值矩阵的左侧矩阵边缘位置的梯度值,基于左侧矩阵边缘位置的梯度值在第一梯度值矩阵的左侧扩展一列梯度值;对于第一梯度值矩阵的右侧矩阵边缘位置的梯度值,基于右侧矩阵边缘位置的梯度值在第一梯度值矩阵的右侧扩展一列梯度值;对于第一梯度值矩阵的上侧矩阵边缘位置的梯度值,基于上侧矩阵边缘位置的梯度值在第一梯度值矩阵的上侧扩展一行梯度值;对于第一梯度值矩阵的下侧矩阵边缘位置的梯度值,基于下侧矩阵边缘位置的梯度值在第一梯度值矩阵的下侧扩展一行梯度值,从而使第一扩展后的第一梯度值矩阵的宽度为和高度分别比第一图像块的宽度和高度大2个像素点的距离。
步骤106:根据第一预测块和第一梯度值矩阵,计算第一图像块中的每个基本处理单元的运动信息修正量。
基本处理单元的宽度可以为M,高度也可以M,即基本处理单元是包括M*M个像素点的图像块。M的取值可以为2、3或4等数值。
基本处理单元的运动信息修正量包括水平运动信息修正量和竖直运动信息修正量。
在本步骤中,可以通过如下1061至1064的操作来实现,该1061至1064的操作可以分别为:
1061:对第一图像块进行划分,得到第一图像块包括的每个基本处理单元,每个基本处理单元是大小为M*M的图像块。
1062:对于任一个基本处理单元,根据该基本处理单元的位置,从第一预测块中确定该基本处理单元的基本预测块,基本预测块的宽度为M+2,高度为M+2。
假设该基本处理单元位于第一图像块中的第1至M行和第1至M列,则在第一预测块中将第0至M+1行和第0至M+1列的图像块作为该基本处理单元的基本预测块。
该基本处理单元的基本预测块包括前向基本预测块和后向基本预测块。也就是说,在第一前向预测块中将第0至M+1行和第0至M+1列的图像块作为该基本处理单元的前向基本预测块,在第一后向预测块中将第0至M+1行和第0至M+1列的图像块作为该基本处理单元的后向基本预测块。
1063:根据该基本处理单元的位置,从第一梯度值矩阵中确定基本处理单元的基本梯度值矩阵,基本梯度值矩阵的宽度为M+2,高度为M+2。
假设该基本处理单元位于第一图像块中的第1至M行和第1至M列,则在第一梯度值矩阵中将第0至M+1行和第0至M+1列的矩阵作为该基本处理单元的基本梯度值矩阵。
该基本处理单元的基本梯度值矩阵包括前向水平基本梯度值矩阵、前向竖直基本梯度值矩阵、后向水平基本梯度值矩阵和后向竖直基本梯度值矩阵。也就是说,在第一前向水平梯度值矩阵中将第0至M+1行和第0至M+1列的矩阵作为该基本处理单元的前向水平基本梯度值矩阵,在第一前向竖直梯度值矩阵中将第0至M+1行和第0至M+1列的矩阵作为该基本处理单元的前向竖直基本梯度值矩阵,在第一后向水平梯度值矩阵中将第0至M+1行和第0至M+1列的矩阵作为该基本处理单元的后向水平基本梯度值矩阵,在第一后向竖直梯度值 矩阵中将第0至M+1行和第0至M+1列的矩阵作为该基本处理单元的后向竖直基本梯度值矩阵。
1064:根据该基本处理单元的基本预测块和基本梯度值矩阵,计算该基本处理单元的运动信息修正量。
在1064中,根据该基本处理单元的前向基本预测块、后向基本预测块、前向水平基本梯度值矩阵、前向竖直水平基本梯度值矩阵、后向水平基本梯度值矩阵和后向竖直基本梯度值矩阵,通过如下第四公式和第五公式计算该基本处理单元的水平运动信息修正量和竖直运动信息修正量。
第四公式为:
Figure PCTCN2019122735-appb-000023
第五公式为:
Figure PCTCN2019122735-appb-000024
在上述第四公式中,(i,j)∈Ω表示i=0、1……M+1,j=0、1……M+1。在上述第五公式中,v x为该基本处理单元的水平运动信息修正量,v y为该基本处理单元的竖直运动信息修正量。th' BIO=2 13-BD
Figure PCTCN2019122735-appb-000025
为floor函数(floor(A)表示不大于A的最大整数);S 2,m=S 2>>12,S 2,s=S 2&(2 12-1)。
重复执行上述1062至1064的操作,可以得到第一图像块包括的每个基本处理单元的运动信息修正量。
步骤107:根据第一图像块包括的每个基本处理单元的运动信息修正量,获取第一图像块的预测值。
第一图像块的预测值包括第一图像块中的每个基本处理单元中的每个像素点的预测值。
对于第一图像块包括的任一个基本处理单元,根据该基本处理单元的前向基本预测块、后向基本预测块、前向水平基本梯度值矩阵、前向竖直基本梯度值矩阵、后向水平基本梯度值矩阵和后向竖直基本梯度值矩阵,通过如下第六公式计算该基本处理单元包括的每个像素点的预测值。
第六公式为:
Figure PCTCN2019122735-appb-000026
在第六公式中,pred BIO(i,j)为该基本处理单元中的第i行第j列的像素点的预测值。shift=15-BD,o offset=1<<(14-BD)+2·(1<<13)。rnd()为四舍五入。
重复执行上述103至107的流程,获取待处理图像块中的每个第一图像块的预测值。
步骤108:组合待处理图像块包括的多个第一图像块的预测值,以获得待处理图像块的预测值。
对上述图12所示的帧间预测的方法,可以概括为如下步骤1至6的操作。该步骤1至6的操作可以分别为:
步骤1:确定当前CU的运动信息
当前CU的运动信息可以Merge模式或者AMVP模式(见背景技术中描述)或者其他模式确定得到,在此不做限定。
需要说明的是,其他运动信息的确定方法也可应用到本申请中,在此不再赘述。
步骤2:判断当前CU是否满足BIO的使用条件
若当前CU采用双向预测,并且前向参考帧号POC_L0、后向参考帧号POC_L1和当前帧号POC_Cur的关系满足以下公式,则当前CU满足BIO的使用条件:
(POC_L0–POC_Cur)*(POC_L1–POC_Cur)<0
需要说明的是,也可以通过判断当前CU的尺寸是否大于预设的阈值,决定是否采用BIO。如只有当前CU的高度W>=8且宽度H>=8,才能采用BIO。
需要说明的是,其他BIO的使用条件也可应用到本申请中,在此不再赘述。
若当前CU满足BIO的使用条件,执行步骤3;否则,按照其他方式进行运动补偿。
获得VPDU的尺寸,VPDU_X和VPDU_Y,设置参数blkW和blkH。
blkW=Min(cuW,VPDU_X)
blkH=Min(cuH,VPDU_Y)
其中Min函数表示取最小值。
例如CU尺寸为128x128,VPDU尺寸为64x64,则blkW为64,blkH为64。
例如CU尺寸为128x128,VPDU尺寸为128x32,则blkW为128,blkH为32。
例如CU尺寸为128x128,VPDU尺寸为32x128,则blkW为32,blkH为128。
可选的,若最大帧间预测处理单元的尺寸小于VPDU尺寸,可以按照以下公式设置blkW 和blkH。
blkW=Min(cuW,MAX_MC_X)
blkH=Min(cuH,MAX_MC_Y)
例如CU尺寸为128x128,最大帧间预测处理单元的尺寸为32x32,则blkW为32,blkH为32。
对于每个CU,根据blkW,blkH进行划分,执行BIO:
步骤3:计算当前CU的前后向预测值
利用运动信息,进行运动补偿,得到前后向预测值I (k)(i,j),其中i=-1..blkW,j=-1..blkH(则得到(blkW+2)*(blkH+2)的预测矩阵)。
其中,I (k)(i,j)中,i=0..blkW-1,j=0..blkH-1,通过8抽头插值滤波器进行插值得到,其他位置预测值(扩展1行1列位置)通过bilinear插值滤波器插值得到。
应理解,可以以VPDU的尺寸为预测值获得的最小单元来获得预测值,也可以使用比VPDU的尺寸更小的块尺寸为预测值获得的最小单元来获得预测值,不做限定。
需要说明的是,扩展区域的预测值也可以采用其他方法获得,如同样采用8抽头插值滤波器,或者直接采用整像素位置的参考像素,在此不做限定。
需要说明的是,在计算前后向预测值之间的SAD,判断其是否小于阈值TH_CU,若小于,则不执行BIO。否则,执行BIO。其他判断方法也可应用到本申请中,在此不再赘述。
SAD计算公式如下:
Figure PCTCN2019122735-appb-000027
阈值TH_CU可以设置为(1<<(BD–8+shift))*blkW*blkH,shift为Max(2,14-BD)。
步骤4:计算当前CU的前后向预测值的水平和竖直的梯度值
根据前后向预测值按照公式(4)计算得到水平和竖直的梯度值
Figure PCTCN2019122735-appb-000028
Figure PCTCN2019122735-appb-000029
其中i=0..blkW-1,j=0..blkH-1(则得到blkW*blkH的梯度矩阵)。
步骤5:对当前CU的前后向预测值,及水平和竖直方向的梯度值进行Padding
如图9的方法进行Padding,得到I (k)(i,j)、
Figure PCTCN2019122735-appb-000030
Figure PCTCN2019122735-appb-000031
其中i=-1..blkW,j=-1..blkH(则得到(blkW+2)*(blkH+2)的预测矩阵、水平梯度矩阵和竖直梯度矩阵)。
步骤6:推导每个4x4子块的修正运动矢量,再进行加权
对于每个4x4的子块,按照公式(2)得到vx,vy,最后根据公式(6)进行加权,得到每个4x4子块的预测值。
需要说明的是,可以通过计算每个4x4子块的前后向预测值之间的SAD,判断其是否小于阈值TH_SCU,若小于,则直接进行加权平均;否则,根据公式(2)得到vx,vy,再根据公式(6)进行加权。其他判断方法也可应用到本申请中,在此不再赘述。TU_SCU可以设置为1<<(BD–3+shift)。
在本申请实施例中,由于从预设图像划分宽度Width和待处理图像块的宽度cuW中选择较小的一个宽度,记作blkW,从预设图像划分高度Hight和待处理图像块的高度cuH中选择较小的一个高度,记作blkH,根据blkW和blkH确定待处理图像块包括的第一图像块,这样避免确 定得到的每个第一图像块的面积较大,在对每个第一图像块进行帧间预测处理时,减少消耗大量的内存空间等硬件资源,降低了实现复杂度,提高了帧间预测的处理效率。
参见图14,本申请实施例提供了一种帧间预测的方法,该方法可以应用于图2所示编码器中的帧间预测单元244或应用于图3所示解码器中的帧间预测单元344中,该方法可以是双向帧间预测的方法,包括:
步骤201-202:分别与步骤101-102相同,在此不再详细说明。
步骤203:基于待处理图像块的运动信息获取第一图像块的第一预测块,第一预测块的宽度等于第一图像块的宽度,第一预测块的高度等于第一图像块的高度。
第一图像块的运动信息包括参考图像和运动矢量等信息。本实施的帧间预测采用基于光流的双向预测方式,所以第一图像块的运动信息包括前向参考图像、后向参考图像、前向运动矢量和后向运动矢量等信息。
在本实施例的方法应用于编码器的情况下,编码器可以采用Merge模式或者AMVP模式或者其他模式确定得到待处理图像块的运动信息,待处理图像块的运动信息中包括待处理图像块中的每个第一图像块的运动信息。在本步骤中,获取编码器确定的待处理图像块的运动信息,从待处理图像块的运动信息中获取第一图像块的运动信息。
在本实施例的方法应用于解码器的情况下,解码器接收来自编码器的视频码流中包括待处理图像块的运动信息,待处理图像块的运动信息中包括待处理图像块中的每个第一图像块的运动信息。在本步骤中,从视频码流中提取待处理图像块的运动信息,从待处理图像块的运动信息中获取第一图像块的运动信息。
第一图像块的第一预测块包括第一前向预测块和第一后向预测块。在本步骤中可以通过如下(1)至(8)的步骤获取第一图像块的第一前向预测块和第一后向预测块。该(1)至(8)的步骤可以为:
(1):根据第一图像块的第一位置和运动信息,在前向参考图像中确定第一前向区域,第一前向区域的宽度等于blkW,高度等于blkH。
例如,参见图15,第一图像块B的运动信息包括前向参考图像Ref0、后向参考图像Ref1、前向运动矢量MV0和后向运动矢量MV1。根据第一图像块B的第一位置,在前向参考图像Ref0中确定第二前向区域B11,第二前向区域B11的宽度为blkW,高度为blkH。根据前向运动矢量MV0和第二前向区域B11的位置确定第一前向区域B12,第一前向区域B12的宽度为blkW,高度为blkH。
(2):在前向参考图像中,判断第一前向区域的顶点位置是否与前向参考图像中的像素点位置重合,如果与前向参考图像中的像素点的位置重合,则从前向参考图像中获取位于第一前向区域内的图像块作为第一图像块的第一前向预测块;如果不与前向参考图像中的像素点的位置重合,则执行步骤(3)。
例如,参见图15,以第一前向区域B12的左上顶点为例,假设在前向参考图像Ref0中,第一前向区域B12的左上顶点的顶点位置为(15,16),则该左上顶点的顶点位置与前向参考图像Ref0中的一个像素点的位置重合,该像素点是前向参考图像Ref0中的位置为(15,16)的像素点。再例如,假设在前向参考图像Ref0中,第一前向区域B12的左上顶点的顶点位置为(15.3,16.2),则该左上顶点的顶点位置不与前向参考图像Ref0中的像素点的位置重 合,也就是说在前向参考图像Ref0中的位置(15.3,16.2)处无像素点。
(3):在前向参考图像中,确定与第一前向区域的顶点位置最近的一个像素点,以该像素点为顶点确定第三前向区域,第三前向区域的宽度为blkW,高度为blkH。
对于第一前向区域的任一个顶点位置,假设以第一前向区域的左上顶点位置,在前向参考图像中,确定与左上顶点位置最近的一个像素点,以该像素点为左上顶点确定第三前向区域,第三前向区域的宽度为blkW,高度为blkH。
例如,参见图15,第一前向区域B12的左上顶点的顶点位置为(15.3,16.2),在前向参考图像Ref0中确定离顶点位置(15.3,16.2)最近的一个像素点的位置为(15,16),以位置为(15,16)的像素点为左上顶点确定第三前向区域A1,第三前向区域A1的宽度为blkW,高度为blkH。
(4):确定包括第三前向区域的第四前向区域,第三前向区域的中心和第四前向区域的中心重合,第四前向区域的宽度为blkW+n-1,高度为blkH+n-1,在前向参考图像中获取位于第四前向区域的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块的第一前向预测块,第一前向预测块的宽度为blkW,高度为blkH,n为插值滤波器的抽头数目。
例如,以8抽头的插值滤波器为例,参见图15,确定包括第三前向区域A1的第四前向区域A2,第三前向区域A1的中心和第四前向区域A2的中心重合,第四前向区域A2的宽度为blkW+7,高度为blkH+7,在前向参考图像Ref0中获取位于第四前向区域A2的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块B的第一前向预测块,第一前向预测块的宽度为blkW,高度为blkH。
(5):根据第一图像块的第一位置和运动信息,在后向参考图像中确定第一后向区域,第一后向区域的宽度为blkW,高度为blkH。
例如,参见图15,根据第一图像块B的第一位置,在后向参考图像Ref1中确定第二后向区域C11,第二后向区域C11的宽度为blkW,高度为blkH。根据后向运动矢量MV1和第二后向区域C12的位置确定第一后向区域C12,第一后向区域C12的宽度为blkW,高度为blkH。
(6):在后向参考图像中,判断第一后向区域的顶点位置是否与后向参考图像中的像素点位置重合,如果与后向参考图像中的像素点的位置重合,则从后向参考图像中获取位于第一后向区域内的图像块作为第一图像块的第一后向预测块;如果不与后向参考图像中的像素点的位置重合,则执行步骤(7)。
例如,参见图15,以第一后向区域C12的左上顶点为例,假设在后向参考图像Ref1中,第一后向区域C12的左上顶点的顶点位置为(5,6),则该左上顶点的顶点位置与后向参考图像Ref1中的一个像素点的位置重合,该像素点是后向参考图像Ref1中的位置为(5,6)的像素点。再例如,假设在后向参考图像Ref1中,第一后向区域C12的左上顶点的顶点位置为(5.3,6.2),则该左上顶点的顶点位置不与后向参考图像Ref0中的像素点的位置重合,也就是说在后向参考图像Ref0中的位置(5.3,6.2)处无像素点。
(7):在后向参考图像中,确定与第一后向区域的顶点位置最近的一个像素点,以该像素点为顶点确定第三后向区域,第三后向区域的宽度为blkW,高度为blkH。
对于第一后向区域的任一个顶点位置,假设以第一后向区域的左上顶点位置,在后向参考图像中,确定与左上顶点位置最近的一个像素点,以该像素点为左上顶点确定第三后向区域,第三后向区域的宽度为blkW,高度为blkH。
例如,参见图15,第一后向区域C12的左上顶点的顶点位置为(5.3,6.2),在后向参考图像Ref1中确定离顶点位置(5.3,6.2)最近的一个像素点的位置为(5,6),以位置为(5,6)的像素点为左上顶点确定第三后向区域D1,第三后向区域D1的宽度为blkW,高度为blkH。
(8):确定包括第三后向区域的第四后向区域,第三后向区域的中心和第四后向区域的中心重合,第四后向区域的宽度为blkW+n-1,高度为blkH+n-1,在后向参考图像中获取位于第四后向区域的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块的第一后向预测块,第一后向预测块的宽度为blkW,高度为blkH。
例如,以8抽头的插值滤波器为例,参见图15,确定包括第三后向区域D1的第四后向区域D2,第三后向区域D1的中心和第四后向区域D2的中心重合,第四后向区域D2的宽度为blkW+7,高度为blkH+7,在后向参考图像Ref1中获取位于第四后向区域D2的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块B的第一后向预测块,第一后向预测块的宽度为blkW,高度为blkH。
在执行本步骤时,还可以根据待处理图像块的运动信息确定是否使用BIO方式来进行帧间预测,在确定使用BIO方式来进行帧间预测时,开始执行本步骤。该确定过程可以参见图12所示实施例中的步骤103中的相关内容,在此不再详细说明。
在本步骤中,还可以根据第一图像块的第一前向预测块和第一后向预测块确定是否使用BIO方式来进行帧间预测,在确定使用BIO方式来进行帧间预测时,开始执行如下步骤204。该确定过程可以参见图12所示实施例中的步骤103中的相关内容,在此不再详细说明。
步骤204:对第一图像块的第一预测块进行梯度运算,得到第一图像块的第一梯度值矩阵,第一梯度值矩阵的宽度为blkW-2,第一梯度值矩阵的高度为blkH-2。
第一梯度值矩阵包括第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵。
第一前向水平梯度值矩阵的宽度、第一前向竖直梯度值矩阵的宽度、第一后向水平梯度值矩阵的宽度和第一后向竖直梯度值矩阵的宽度可以均为blkW-2,第一前向水平梯度值矩阵的高度、第一前向竖直梯度值矩阵的高度、第一后向水平梯度值矩阵的高度和第一后向竖直梯度值矩阵的高度可以均为blkH-2。
在本步骤中,对第一图像块的第一预测块进行梯度运算的详细实现过程可以参见图12所示实施例中的步骤104中的相关内容,在此不再详细说明。
步骤205:基于第一梯度值矩阵的矩阵边缘位置的梯度值,对第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度为和高度分别比第一图像块的宽度和高度大2个像素点的距离。
第一扩展后的第一梯度值矩阵的宽度和高度分别与第一预测块的宽度blkW+2,高度为blkH+2。
在本步骤中,分别对第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵的宽度和高度进行第一扩展,使第一扩展后的第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵的宽度均为blkW+2,高度均为blkH+2。
对第一梯度值矩阵进行第一扩展的方式可以参见图12所示的实施例中的步骤205中的相关内容,在此不再详细说明。
步骤206:对第一预测块的块边缘位置的像素值进行复制,以对第一预测块的宽度和高度进行第二扩展,第二扩展后的第一预测块的宽度为blkW+2,高度为blkH+2。
在本步骤中,对第一前向预测块的块边缘位置的像素值进行复制,以及对第一后向预测块的块边缘位置的像素值进行复制,以对第一前向预测块的宽度和高度进行第二扩展,以及对第一后向预测块的宽度和高度进行第二扩展。即在本步骤中,第二扩展后的第一前向预测块的宽度和高度分别为blkW+2和blkH+2、第二扩展后的第一后向预测块的宽度和高度分别为blkW+2和blkH+2。
在本步骤中,还可以对第一预测块的块边缘区域的像素值进行插值滤波,以对第一预测块的的宽度和高度进行第二扩展。
可选的,在步骤203中,如果直接将参考图像中的宽度为blkW,高度为blkH的图像块作为第一图像块的第一预测块,即参见图15,在前向参考图Ref0中将第一前向区域B12中的图像块作为第一前向预测块,在后向参考图Ref1中将第一后向区域C12中的图像块作为第一后向预测块。在此情况下,第一预测块为参考图像中的一个图像块,此时在参考图像中选择围绕第一预测块且与第一预测块最近的一圈像素点,将选择的一圈像素点和第一预测块组成宽度为blkW+2,高度为blkH+2的第二扩展后的第一预测块。
可选的,在步骤203中,通过插值滤波器得到第一图像块的第一预测块,此种情况下第一预测块不是参考图像中的图像块,对于第一预测块的任一边缘上的像素点,为了便于说明称该边缘为第一边缘,根据第一边缘上的每个像素点在参考图像中的第一位置,获取第二边缘包括的每个像素点的第二位置,第二边缘位于第一预测块之外,第二边缘与第一边缘相差一个像素点距离,第二边缘上包括blkW+2个像素点或blkH+2个像素点。对于第二边缘上的每个像素点,在参考图像中,该像素点的第二位置位于相邻的两个像素点之间或位于相邻的四个像素点之间,使用插值滤波器对该相邻的两个像素点进行插值滤波或对该相邻的四个像素点进行插值滤波,得到该像素点。按上述方式得到第一预测块的每个边缘对应的第二边缘,将得到的每个第二边缘和第一预测块组成宽度为blkW+2,高度为blkH+2的第二扩展后的第一预测块。
其中,步骤206也可以先于步骤204之前执行,这样在得到第二扩展后的第一预测块时,可以对第二扩展后的第一预测块进行梯度值运算,得到第一图像块的第一梯度值矩阵,由于第二扩展后的第一预测块的宽度为blkW+2,高度为blkH+2,所以得到第一梯度值矩阵的宽度为blkW,高度为blkH。然后基于第一梯度值矩阵的矩阵边缘位置的梯度值,对第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度为和高度分别比第一图像块的宽度和高度大2个像素点的距离。
步骤207-209:分别与步骤106-108相同,在此不再详细说明。
对上述图16所示的帧间预测的方法,可以概括为如下步骤1至6的操作。该步骤1至6的操作可以分别为:
步骤1:确定当前CU的运动信息
当前CU的运动信息可以Merge模式或者AMVP模式(见背景技术中描述)或者其他模式确定得到,在此不做限定。
需要说明的是,其他运动信息的确定方法也可应用到本申请中,在此不再赘述。
步骤2:判断当前CU是否满足BIO的使用条件
若当前CU采用双向预测,并且前向参考帧号POC_L0、后向参考帧号POC_L1和当前帧号POC_Cur的关系满足以下公式,则当前CU满足BIO的使用条件:
(POC_L0–POC_Cur)*(POC_L1–POC_Cur)<0
需要说明的是,也可以通过判断当前CU的尺寸是否大于预设的阈值,决定是否采用BIO。如只有当前CU的高度W>=8且宽度H>=8,才能采用BIO。
需要说明的是,其他BIO的使用条件也可应用到本申请中,在此不再赘述。
若当前CU满足BIO的使用条件,执行步骤3;否则,按照其他方式进行运动补偿。
获得VPDU的尺寸,VPDU_X和VPDU_Y,设置参数blkW和blkH。
blkW=Min(cuW,VPDU_X)
blkH=Min(cuH,VPDU_Y)
例如CU尺寸为128x128,VPDU尺寸为64x64,则blkW为64,blkH为64。
例如CU尺寸为128x128,VPDU尺寸为128x32,则blkW为128,blkH为32。
例如CU尺寸为128x128,VPDU尺寸为32x128,则blkW为32,blkH为128。
可选的,若最大帧间预测处理单元的尺寸小于VPDU尺寸,可以按照以下公式设置blkW和blkH。
blkW=Min(cuW,MAX_MC_X)
blkH=Min(cuH,MAX_MC_Y)
例如CU尺寸为128x128,最大帧间预测处理单元的尺寸为32x32,则blkW为32,blkH为32。
对于每个CU,根据blkW,blkH进行划分,执行BIO:
步骤3:计算当前CU的前后向预测值
利用运动信息,进行运动补偿,得到前后向预测值I (k)(i,j),其中i=0..blkW-1,j=0..blkH-1(则得到blkW*blkH的预测矩阵)。
应理解,可以以VPDU的尺寸为预测值获得的最小单元来获得预测值,也可以使用比VPDU的尺寸更小的块尺寸为预测值获得的最小单元来获得预测值,不做限定。
步骤4:计算当前CU的前后向预测值的水平和竖直的梯度值
根据前后向预测值按照公式(4)计算得到水平和竖直的梯度值
Figure PCTCN2019122735-appb-000032
Figure PCTCN2019122735-appb-000033
其中i=1..blkW-2,j=1..blkH-2(则得到(blkW-2)*(blkH-2)的梯度矩阵)。
步骤5:对当前CU的前后向预测值,及水平和竖直方向的梯度值进行Padding
如图9的方法进行Padding,得到I (k)(i,j)、
Figure PCTCN2019122735-appb-000034
Figure PCTCN2019122735-appb-000035
其中i=-1..blkW,j=-1..blkH(将(blkW-2)*(blkH-2)的矩阵向四周padding 2行2列,得到得到(blkW+2)*(blkH+2)的预测矩阵、水平梯度矩阵和竖直梯度矩阵)。
步骤6:推导每个4x4子块的修正运动矢量,再进行加权
对于每个4x4的子块,按照公式(2)得到vx,vy,最后根据公式(6)进行加权,得到每个4x4子块的预测值。
在本申请实施例中,由于从预设图像划分宽度Width和待处理图像块的宽度cuW中选择较小的一个宽度,记作blkW,从预设图像划分高度Hight和待处理图像块的高度cuH中选择较小的一个高度,记作blkH,根据blkW和blkH确定待处理图像块包括的第一图像块,这样避免确定得到的每个第一图像块的面积较大,在对每个第一图像块进行帧间预测处理时,减少消耗大量的内存空间。另外,根据第一图像块的运动信息获取第一图像块的第一预测块,由于第一预测块的宽度等于第一图像块的宽度,第一预测块的高度等于第一图像块的高度,可以使第一预测块较小,这样可以减小获取第一预测块所消耗的CPU资源和内存资源等硬件资源,降低了实现复杂度,提高了处理效率。
参见图16,本申请实施例提供了一种帧间预测的方法,该方法可以应用于图2所示编码器中的帧间预测单元244或应用于图3所示解码器中的帧间预测单元344中,该方法可以是双向帧间预测的方法,包括:
步骤301:比较第一图像块的宽度cuW和预设图像划分宽度Width,以及比较第一图像块的高度cuH和预设图像划分高度Hight,在cuW大于或等于Width和/或在cuH大于或等于Hight时,执行步骤302,在cuW小于Width且cuH小于Hight时,执行步骤305。
在本实施例的方法应用于编码器的情况下,编码器在对图像进行编码时,将图像划分成第一图像块。在本步骤之前,从编码器中获取第一图像块。
在本实施例的方法应用于解码器的情况下,解码器接收来自编码器的视频码流,该视频码流包括第一图像块。在本步骤之前,从视频码流中提取第一图像块。
在执行本步骤时,还可以根据第一图像块的运动信息确定是否使用BIO方式来进行帧间预测。在确定使用BIO方式来进行帧间预测,开始本步骤的操作。详细实现过程可以参见图12所示的实施例中的步骤103中的相关内容,在此不再详细说明。
步骤302:基于第一图像块的运动信息获取第一图像块的第二预测块,第二预测块的宽度cuW+4,高度为cuH+4。
第一图像块的运动信息包括参考图像和运动矢量等信息。本实施的帧间预测采用基于光流的双向预测方式,所以第一图像块的运动信息包括前向参考图像、后向参考图像、前向运动矢量和后向运动矢量等信息。
在本实施例的方法应用于编码器的情况下,编码器可以采用Merge模式或者AMVP模式或者其他模式确定得到第一图像块的运动信息。在本步骤中,获取编码器确定的第一图像块的运动信息。
在本实施例的方法应用于解码器的情况下,解码器接收来自编码器的视频码流中包括第一图像块的运动信息。在本步骤中,从视频码流中提取第一图像块的运动信息。
第一图像块的第二预测块包括第二前向预测块和第二后向预测块。在本步骤中可以通过如下(1)至(8)的步骤获取第一图像块的第二前向预测块和第二后向预测块。该(1)至(8)的步骤可以为:
(1):根据第一图像块在待处理图像块中的第一位置和运动信息,在前向参考图像中确定第一前向区域,第一前向区域的宽度为blkW+4,高度为blkH+4。
例如,参见图13,第一图像块B的运动信息包括前向参考图像Ref0、后向参考图像Ref1、前向运动矢量MV0和后向运动矢量MV1。根据第一图像块B的第一位置在前向参考图像Ref0 中确定第二前向区域B11,第二前向区域B11的宽度为blkW,高度为blkH。根据前向运动矢量MV0和第二前向区域B11的位置确定第三前向区域B12,第三前向区域B12的宽度为blkW,高度为blkH。确定包括第三前向区域B12的第一前向区域A1,第一前向区域A1的宽度为blkW+4,高度为blkH+4,第三前向区域B12的中心和第一前向区域A1的中心重合。
(2):在前向参考图像中,判断第一前向区域的顶点位置是否与前向参考图像中的像素点位置重合,如果与前向参考图像中的像素点的位置重合,则从前向参考图像中获取位于第一前向区域内的图像块作为第一图像块的第二前向预测块;如果不与前向参考图像中的像素点的位置重合,则执行步骤(3)。
例如,参见图13,以第一前向区域A1的左上顶点为例,假设在前向参考图像Ref0中,第一前向区域A1的左上顶点的顶点位置为(15,16),则该左上顶点的顶点位置与前向参考图像Ref0中的一个像素点的位置重合,该像素点是前向参考图像Ref0中的位置为(15,16)的像素点。再例如,假设在前向参考图像Ref0中,第一前向区域A1的左上顶点的顶点位置为(15.3,16.2),则该左上顶点的顶点位置不与前向参考图像Ref0中的像素点的位置重合,也就是说在前向参考图像Ref0中的位置(15.3,16.2)处无像素点。
(3):在前向参考图像中,确定与第一前向区域的顶点位置最近的一个像素点,以该像素点为顶点确定第四前向区域,第四前向区域的宽度为blkW+4,高度为blkH+4。
对于第一前向区域的任一个顶点位置,假设以第一前向区域的左上顶点位置,在前向参考图像中,确定与左上顶点位置最近的一个像素点,以该像素点为左上顶点确定第四前向区域,第四前向区域的宽度为blkW+4,高度为blkH+4。
例如,参见图13,第一前向区域A1的左上顶点的顶点位置为(15.3,16.2),在前向参考图像Ref0中确定离顶点位置(15.3,16.2)最近的一个像素点的位置为(15,16),以位置为(15,16)的像素点为左上顶点确定第四前向区域A2,第四前向区域A2的宽度为blkW+4,高度为blkH+4。
(4):确定包括第四前向区域的第五前向区域,第四前向区域的中心和第五前向区域的中心重合,第五前向区域的宽度为blkW+n+3,高度为blkH+n+3,在前向参考图像中获取位于第五前向区域的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块的第二前向预测块,第二前向预测块的宽度为blkW+4,高度为blkH+4,n为插值滤波器的抽头数目。
例如,以8抽头的插值滤波器为例,参见图13,确定包括第四前向区域A2的第五前向区域A3,第四前向区域A2的中心和第五前向区域A3的中心重合,第五前向区域A3的宽度为blkW+11,高度为blkH+11,在前向参考图像Ref0中获取位于第五前向区域A3的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块B的第二前向预测块,第二前向预测块的宽度为blkW+4,高度为blkH+4。
(5):根据第一图像块的第一位置和运动信息,在后向参考图像中确定第一后向区域,第一后向区域的宽度为blkW+4,高度为blkH+4。
例如,参见图13,根据第一图像块B的第一位置,在后向参考图像Ref1中确定第二后向区域C11,第二后向区域C11的宽度为blkW,高度为blkH。根据后向运动矢量MV1和第二后向区域C11的位置确定第三后向区域C12,第三后向区域C12的宽度为blkW,高度为blkH。确定包括第三后向区域C12的第一后向区域D1,第一后向区域D1的宽度为blkW+4,高度为blkH+4。第三后向区域C12的中心和第一后向区域D1的中心可以重合。
(6):在后向参考图像中,判断第一后向区域的顶点位置是否与后向参考图像中的像素点位置重合,如果与后向参考图像中的像素点的位置重合,则从后向参考图像中获取位于第一后向区域内的图像块作为第一图像块的第二后向预测块;如果不与后向参考图像中的像素点的位置重合,则执行步骤(7)。
例如,参见图13,以第一后向区域A1的左上顶点为例,假设在后向参考图像Ref0中,第一后向区域A1的左上顶点的顶点位置为(5,6),则该左上顶点的顶点位置与后向参考图像Ref0中的一个像素点的位置重合,该像素点是后向参考图像Ref0中的位置为(5,6)的像素点。再例如,假设在后向参考图像Ref0中,第一后向区域D1的左上顶点的顶点位置为(5.3,6.2),则该左上顶点的顶点位置不与后向参考图像Ref0中的像素点的位置重合,也就是说在后向参考图像Ref0中的位置(5.3,6.2)处无像素点。
(7):在后向参考图像中,确定与第一后向区域的顶点位置最近的一个像素点,以该像素点为顶点确定第四后向区域,第四后向区域的宽度为blkW+4,高度为blkH+4。
对于第一后向区域的任一个顶点位置,假设以第一后向区域的左上顶点位置,在后向参考图像中,确定与左上顶点位置最近的一个像素点,以该像素点为左上顶点确定第四后向区域,第四后向区域的宽度为blkW+4,高度为blkH+4。
例如,参见图13,第一后向区域D1的左上顶点的顶点位置为(5.3,6.2),在后向参考图像Ref1中确定离顶点位置(5.3,6.2)最近的一个像素点的位置为(5,6),以位置为(5,6)的像素点为左上顶点确定第四后向区域D2,第四后向区域D2的宽度为blkW+4,高度为blkH+4。
(8):确定包括第四后向区域的第五后向区域,第四后向区域的中心和第五后向区域的中心重合,第五后向区域的宽度为blkW+n+3,高度为blkH+n+3,在后向参考图像中获取位于第五后向区域的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块的第二后向预测块,第二后向预测块的宽度为blkW+4,高度为blkH+4。
例如,以8抽头的插值滤波器为例,参见图13,确定包括第四后向区域D2的第五后向区域D3,第四后向区域D2的中心和第五后向区域D3的中心重合,第五后向区域D3的宽度为blkW+11,高度为blkH+11,在后向参考图像Ref1中获取位于第五后向区域D3的图像块,使用插值滤波器对该图像块进行插值滤波得到第一图像块B的第二后向预测块,第二后向预测块的宽度为blkW+4,高度为blkH+4,n为插值滤波器的抽头数目。
步骤303:对第一图像块的第二预测块进行梯度运算,得到第一图像块的第一梯度值矩阵,第一梯度值矩阵的宽度为cuW+2,高度为cuH+2。
第一梯度值矩阵包括第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵。
在本步骤中,对第一图像块的第二预测块进行梯度运算得到第一梯度值矩阵的详细实现过程,可以参见图12所示的实施例中的步骤104中得到第一梯度值矩阵的详细过程,在此不再详细说明。
第一预测块包括第二前向预测块和第二后向预测块,根据第二前向预测块,可以得到宽度为cuW+2,高度为cuH+2的第二前向水平梯度矩阵和宽度为cuW+2,高度为cuH+2的第二前向竖直梯度矩阵。根据第二后向预测块,可以得到宽度为cuW+2,高度为cuH+2的第二后向水平梯度矩阵和宽度为cuW+2,高度为cuH+2的第二后向竖直梯度矩阵。
步骤304:在第二预测块中确定第一图像块的第一预测块,第一预测块的宽度为cuW+2,高度为cuH+2,执行步骤308。
第一预测块的中心和第二预测块的中心重合。
第一预测块包括第一前向预测块和第一后向预测块。
在本步骤中,在第二前向预测块中确定第一图像块的宽度为cuW+2,高度为cuH+2的第一前向预测块;在第二后向预测块中确定第一图像块的宽度为cuW+2,高度为cuH+2的第一后向预测块。
步骤305:基于第一图像块的运动信息获取第一图像块的第一预测块,第一预测块的宽度为cuW+2,第一预测块的高度为cuH+2。
在本步骤中,获取第一预测块的详细过程可以参见图12所示实施例中的步骤103中的相关内容,在此不再详细说明。
步骤306:对第一图像块的第一预测块进行梯度运算,得到第一图像块的第一梯度值矩阵,第一梯度值矩阵的宽度为cuW,高度为cuH。
第一梯度值矩阵包括第一前向水平梯度值矩阵、第一前向竖直梯度值矩阵、第一后向水平梯度值矩阵和第一后向竖直梯度值矩阵。
本步骤的详细实现过程可以参见图12所示实施例中的步骤104中的相关内容,在此不再详细说明。
步骤307:基于第一梯度值矩阵的矩阵边缘位置的梯度值,对第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度为和高度分别比第一图像块的宽度和高度大2个像素点的距离。
本步骤的详细实现过程可以参见图12所示实施例中的步骤105中的相关内容,在此不再详细说明。
步骤308-310:分别与步骤106-108相同,在此不再详细说明。
对上述图15所示的帧间预测的方法,可以概括为如下步骤1至6的操作。该步骤1至6的操作可以分别为:
步骤1:确定当前CU的运动信息
当前CU的运动信息可以Merge模式或者AMVP模式(见背景技术中描述)或者其他模式确定得到,在此不做限定。
需要说明的是,其他运动信息的确定方法也可应用到本申请中,在此不再赘述。
步骤2:判断当前CU是否满足BIO的使用条件
若当前CU采用双向预测,并且前向参考帧号POC_L0、后向参考帧号POC_L1和当前帧号POC_Cur的关系满足以下公式,则当前CU满足BIO的使用条件:
(POC_L0–POC_Cur)*(POC_L1–POC_Cur)<0
需要说明的是,其他BIO的使用条件也可应用到本申请中,在此不再赘述。
若当前CU满足BIO的使用条件,执行步骤3;否则,按照其他方式进行运动补偿。
步骤3:计算当前CU的前后向预测值
若cuW大于等于VPDU_X或cuH大于等于VPDU_Y,利用运动信息,进行运动补偿,得到前后向预测值I (k)(i,j),其中i=-2..cuW+1,j=-2..cuH+1(则采用相同的插值滤波器得到(cuW+4)*(cuH+4)的预测矩阵);
否则,利用运动信息,进行运动补偿,得到前后向预测值I (k)(i,j),其中i=-1..cuW,j=-1..cuH(则得到(cuW+2)*(cuH+2)的预测矩阵)。
其中,I (k)(i,j)中,i=0..cuW-1,j=0..cuH-1,通过8抽头插值滤波器进行插值得到,其他位置预测值(扩展1行1列位置)通过bilinear插值滤波器插值得到。
应理解,可以以VPDU的尺寸为预测值获得的最小单元来获得预测值,也可以使用比VPDU的尺寸更小的块尺寸为预测值获得的最小单元来获得预测值,不做限定。
需要说明的是,扩展区域的预测值也可以采用其他方法获得,如同样采用8抽头插值滤波器,或者直接采用整像素位置的参考像素,在此不做限定。
需要说明的是,在计算前后向预测值之间的SAD,判断其是否小于阈值TH_CU,若小于,则不执行BIO。否则,执行BIO。其他判断方法也可应用到本申请中,在此不再赘述。
SAD计算公式如下:
Figure PCTCN2019122735-appb-000036
阈值TH_CU可以设置为(1<<(BD–8+shift))*cuW*cuH,shift为Max(2,14-BD)。
步骤4:计算当前CU的前后向预测值的水平和竖直的梯度值
若cuW大于等于VPDU_X或cuH大于等于VPDU_Y,按照公式(4)计算得到水平和竖直的梯度值
Figure PCTCN2019122735-appb-000037
Figure PCTCN2019122735-appb-000038
其中i=-1..cuW,j=-1..cuH(则得到(cuW+2)*(cuH+2)的梯度矩阵),
否则,根据前后向预测值按照公式(4)计算得到水平和竖直的梯度值
Figure PCTCN2019122735-appb-000039
Figure PCTCN2019122735-appb-000040
其中i=0..cuW-1,j=0..cuH-1(则得到cuW*cuH的梯度矩阵)。
步骤5:若cuW小于VPDU_X并且cuH小于VPDU_Y,对当前CU的前后向预测值,及水平和竖直方向的梯度值进行Padding
如图9的方法进行Padding,得到I (k)(i,j)、
Figure PCTCN2019122735-appb-000041
Figure PCTCN2019122735-appb-000042
其中i=-1..cuW,j=-1..cuH(则得到(cuW+2)*(cuH+2)的预测矩阵、水平梯度矩阵和竖直梯度矩阵)。
步骤6:推导每个4x4子块的修正运动矢量,再进行加权
对于每个4x4的子块,按照公式(2)得到vx,vy,最后根据公式(6)进行加权,得到每个4x4子块的预测值。
需要说明的是,可以通过计算每个4x4子块的前后向预测值之间的SAD,判断其是否小于阈值TH_SCU,若小于,则直接进行加权平均;否则,根据公式(2)得到vx,vy,再根据公式(6)进行加权。其他判断方法也可应用到本申请中,在此不再赘述。TU_SCU可以设置为1<<(BD–3+shift)。
在本申请实施例中,将VPDU的边界按照CU的边界相同的方式进行BIO预测,当CU包含多个VPDU时,降低运动补偿预测的实现复杂度。
在本申请实施例中,在cuW大于或等于Width和/或在cuH大于或等于Hight时,根据第一图像块的运动信息获取第一图像块的第二预测块,由于第二预测块的宽度cuW+4,高度为cuH+4,这样:对第一图像块的第二预测块进行梯度运算,得到宽度为cuW+2,高度为cuH+2的第一梯度值矩阵,如此可以省去对第一梯度值矩阵的边缘进行扩展处理,提高帧间预测的效率。
图17为本申请实施例的示意性方法流程图,如图所示,提供了一种帧间预测的方法,包括:
S1201、获取待处理图像块的运动信息,所述待处理图像块包括多个虚拟流水数据单元,所述虚拟流水数据单元包括至少一个基本处理单元;
S1202、根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵;
S1203、根据每个所述预测值矩阵,计算每个所述虚拟流水数据单元的水平预测梯度矩阵和竖直预测梯度矩阵;
S1204、根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量。
在一种可行的实施方式中,所述根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵,包括:根据所述运动信息,获得每个所述虚拟流水数据单元的初始预测矩阵,所述初始预测矩阵和所述虚拟流水数据单元大小相等;将所述初始预测矩阵作为所述预测值矩阵。
在一种可行的实施方式中,在所述获得每个所述虚拟流水数据单元的初始预测矩阵之后,还包括:对所述初始预测矩阵的边沿进行像素点扩展,以获得扩展预测矩阵,所述扩展预测矩阵的尺寸大于所述初始预测矩阵的尺寸;对应的,所述将所述初始预测矩阵作为所述预测值矩阵,包括:将所述扩展预测矩阵作为所述预测值矩阵。
在一种可行的实施方式中,所述对所述初始预测矩阵的边沿进行像素点扩展,包括:基于所述初始预测矩阵内的像素点的像素值插值获得所述初始预测矩阵外的像素点的像素值,或者,以所述初始预测矩阵边沿的像素点的像素值作为所述初始预测矩阵外与所述边沿相邻的像素点的像素值。
在一种可行的实施方式中,所述虚拟流水数据单元包括多个运动补偿单元,所述根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵,包括:根据所述运动信息,获得每个所述运动补偿单元的补偿值矩阵;组合所述多个运动补偿单元的补偿值矩阵以获得所述预测值矩阵。
在一种可行的实施方式中,所述根据每个所述预测值矩阵,计算每个所述虚拟流水数据单元的水平预测梯度矩阵和竖直预测梯度矩阵,包括:对所述预测值矩阵进行水平梯度计算和竖直梯度计算,以分别获得所述水平预测梯度矩阵和所述竖直预测梯度矩阵。
在一种可行的实施方式中,在所述根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量之前,还包括:对所述预测值矩阵的边沿进行像素点扩展,以获得填充预测矩阵,所述填充预测矩阵具有预设尺寸;对所述水平预测梯度矩阵的边沿和所述竖直预测梯度矩阵的边沿分别进行梯度值扩展,以获得填充水平梯度矩阵和填充竖直梯度矩阵,所述填充水平梯度矩阵和所述填充竖直梯度矩阵分别具有所述预设尺寸;对应的,所述根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量,包括:根据所述填充预测矩阵、所述填充水平梯度矩阵和所述填充竖直梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量。
在一种可行的实施方式中,在所述对所述预测值矩阵的边沿进行像素点扩展之前,还包 括:确定所述预测值矩阵的尺寸小于所述预设尺寸。
在一种可行的实施方式中,在所述对所述水平预测梯度矩阵的边沿和所述竖直预测梯度矩阵的边沿分别进行梯度值扩展之前,还包括:确定所述水平预测梯度矩阵的尺寸和/或所述竖直预测梯度矩阵的尺寸小于所述预设尺寸。
在一种可行的实施方式中,在所述计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量之后,所述方法还包括:根据所述虚拟流水数据单元的预测值矩阵和所述虚拟流水数据单元中每个所述基本处理单元的运动修正量,获得每个所述基本处理单元的预测值。
在一种可行的实施方式中,所述方法用于双向预测;对应的,所述运动信息包括第一参考帧列表运动信息和第二参考帧列表运动信息;所述预测值矩阵包括第一预测值矩阵和第二预测值矩阵,所述第一预测值矩阵根据所述第一参考帧列表运动信息获得,所述第二预测值矩阵根据所述第二参考帧列表运动信息获得;所述水平预测梯度矩阵包括第一水平预测梯度矩阵和第二水平预测梯度矩阵,所述第一水平预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二水平预测梯度矩阵根据所述第二预测值矩阵计算获得;所述竖直预测梯度矩阵包括第一竖直预测梯度矩阵和第二竖直预测梯度矩阵,所述第一竖直预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二竖直预测梯度矩阵根据所述第二预测值矩阵计算获得;所述运动信息修正量包括第一参考帧列表运动信息修正量和第二参考帧列表运动信息修正量,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第一竖直预测梯度矩阵计算获得,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第二竖直预测梯度矩阵计算获得。
在一种可行的实施方式中,在所述对所述初始预测矩阵的边沿进行像素点扩展之前,还包括:确定所述待处理图像块所在的图像帧的时域位置位于所述第一参考帧列表运动信息所指示的第一参考帧和所述第二参考帧列表运动信息所指示的第二参考帧之间。
在一种可行的实施方式中,在所述获得每个所述虚拟流水数据单元的预测值矩阵之后,还包括:确定所述第一预测值矩阵和所述第二预测值矩阵的差异小于第一阈值。
在一种可行的实施方式中,所述基本处理单元的运动信息修正量对应所述预测值矩阵中的一个基本预测值矩阵,在所述根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量之前,还包括:确定所述第一基本预测值矩阵和所述第二基本预测值矩阵的差异小于第二阈值。
在一种可行的实施方式中,所述基本处理单元的尺寸为4x4。
在一种可行的实施方式中,所述虚拟流水数据单元的宽为W,高为H,所述扩展预测矩阵的尺寸为(W+n+2)x(H+n+2),对应的,所述水平预测梯度矩阵的尺寸为(W+n)x(H+n),所述竖直预测梯度矩阵的尺寸为(W+n)x(H+n),其中,W,H为正整数,n为偶数。
在一种可行的实施方式中,n为0、2或-2。
在一种可行的实施方式中,在所述获取待处理图像块的运动信息之前,还包括:确定所述待处理图像块包括所述多个虚拟流水数据单元。
图18为本申请实施例的示意性方法流程图,如图所示,提供了一种帧间预测的装置,包括:
获取模块1301,用于获取待处理图像块的运动信息,所述待处理图像块包括多个虚拟流 水数据单元,所述虚拟流水数据单元包括至少一个基本处理单元;
补偿模块1302,用于根据所述运动信息,获得每个所述虚拟流水数据单元的预测值矩阵;
计算模块1303,用于根据每个所述预测值矩阵,计算每个所述虚拟流水数据单元的水平预测梯度矩阵和竖直预测梯度矩阵;
修正模块1304,用于根据所述预测值矩阵、所述水平预测梯度矩阵和所述竖直预测梯度矩阵,计算每个所述虚拟流水数据单元中每个所述基本处理单元的运动信息修正量。
在一种可行的实施方式中,所述补偿模块1302具体用于:根据所述运动信息,获得每个所述虚拟流水数据单元的初始预测矩阵,所述初始预测矩阵和所述虚拟流水数据单元大小相等;将所述初始预测矩阵作为所述预测值矩阵。
在一种可行的实施方式中,所述补偿模块1302具体用于:对所述初始预测矩阵的边沿进行像素点扩展,以获得扩展预测矩阵,所述扩展预测矩阵的尺寸大于所述初始预测矩阵的尺寸;将所述扩展预测矩阵作为所述预测值矩阵。
在一种可行的实施方式中,所述补偿模块1302具体用于:基于所述初始预测矩阵内的像素点的像素值插值获得所述初始预测矩阵外的像素点的像素值,或者,以所述初始预测矩阵边沿的像素点的像素值作为所述初始预测矩阵外与所述边沿相邻的像素点的像素值。
在一种可行的实施方式中,所述虚拟流水数据单元包括多个运动补偿单元,所述补偿模块具体用于:根据所述运动信息,获得每个所述运动补偿单元的补偿值矩阵;组合所述多个运动补偿单元的补偿值矩阵以获得所述预测值矩阵。
在一种可行的实施方式中,所述计算模块1303具体用于:对所述预测值矩阵进行水平梯度计算和竖直梯度计算,以分别获得所述水平预测梯度矩阵和所述竖直预测梯度矩阵。
在一种可行的实施方式中,还包括填充模块1305,用于:对所述预测值矩阵的边沿进行像素点扩展,以获得填充预测矩阵,所述填充预测矩阵具有预设尺寸;对所述水平预测梯度矩阵的边沿和所述竖直预测梯度矩阵的边沿分别进行梯度值扩展,以获得填充水平梯度矩阵和填充竖直梯度矩阵,所述填充水平梯度矩阵和所述填充竖直梯度矩阵分别具有所述预设尺寸;根据所述填充预测矩阵、所述填充水平梯度矩阵和所述填充竖直梯度矩阵,计算每个所述虚拟流水数据单元中每个基本处理单元的运动信息修正量。
在一种可行的实施方式中,还包括判断模块1306,用于:确定所述预测值矩阵的尺寸小于所述预设尺寸。
在一种可行的实施方式中,所述判断模块1306还用于:确定所述水平预测梯度矩阵的尺寸和/或所述竖直预测梯度矩阵的尺寸小于所述预设尺寸。
在一种可行的实施方式中,所述修正模块1304还用于:根据所述虚拟流水数据单元的预测值矩阵和所述虚拟流水数据单元中每个所述基本处理单元的运动修正量,获得每个所述基本处理单元的预测值。
在一种可行的实施方式中,所述装置用于双向预测;对应的,所述运动信息包括第一参考帧列表运动信息和第二参考帧列表运动信息;所述预测值矩阵包括第一预测值矩阵和第二预测值矩阵,所述第一预测值矩阵根据所述第一参考帧列表运动信息获得,所述第二预测值矩阵根据所述第二参考帧列表运动信息获得;所述水平预测梯度矩阵包括第一水平预测梯度矩阵和第二水平预测梯度矩阵,所述第一水平预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二水平预测梯度矩阵根据所述第二预测值矩阵计算获得;所述竖直预测梯度矩阵 包括第一竖直预测梯度矩阵和第二竖直预测梯度矩阵,所述第一竖直预测梯度矩阵根据所述第一预测值矩阵计算获得,所述第二竖直预测梯度矩阵根据所述第二预测值矩阵计算获得;所述运动信息修正量包括第一参考帧列表运动信息修正量和第二参考帧列表运动信息修正量,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第一竖直预测梯度矩阵计算获得,所述第一参考帧列表运动信息修正量根据所述第一预测值矩阵、所述第一水平预测梯度矩阵和所述第二竖直预测梯度矩阵计算获得。
在一种可行的实施方式中,所述判断模块1306还用于:确定所述待处理图像块所在的图像帧的时域位置位于所述第一参考帧列表运动信息所指示的第一参考帧和所述第二参考帧列表运动信息所指示的第二参考帧之间。
在一种可行的实施方式中,所述判断模块1306还用于:确定所述第一预测值矩阵和所述第二预测值矩阵的差异小于第一阈值。
在一种可行的实施方式中,所述判断模块1306还用于:确定所述第一基本预测值矩阵和所述第二基本预测值矩阵的差异小于第二阈值。
在一种可行的实施方式中,所述基本处理单元的尺寸为4x4。
在一种可行的实施方式中,所述虚拟流水数据单元的宽为W,高为H,所述扩展预测矩阵的尺寸为(W+n+2)x(H+n+2),对应的,所述水平预测梯度矩阵的尺寸为(W+n)x(H+n),所述竖直预测梯度矩阵的尺寸为(W+n)x(H+n),其中,W,H为正整数,n为偶数。
在一种可行的实施方式中,n为0、2或-2。
在一种可行的实施方式中,所述判断模块1306还用于:确定所述待处理图像块包括所述多个虚拟流水数据单元。
参见图19,为本申请实施例的示意性方法流程图,如图所示,提供了一种帧间预测的装置1400,包括:
确定模块1401,用于根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块;
预测模块1402,用于对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值;
组合模块1403,用于组合所述多个第一图像块的预测值,以获得所述待处理图像块的预测值。
在一种可行的实施方式中,所述确定模块1401,用于:
比较所述预设图像划分宽度和所述待处理图像块的宽度,以确定所述第一图像块的宽度;
比较所述预设图像划分高度和所述待处理图像块的高度,以确定所述第一图像块的高度;
根据所述第一图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块。
在一种可行的实施方式中,所述第一图像块的宽度为所述预设图像划分宽度和所述待处理图像块的宽度之间的最小值,且所述第一图像块的高度为所述预设图像划分高度和所述待处理图像块的高度之间的最小值。
在一种可行的实施方式中,所述预测模块1402,用于:
基于所述待处理图像块的运动信息,获得所述第一图像块的第一预测块;
对所述第一预测块进行梯度运算,以获得所述第一图像块的第一梯度值矩阵;
根据所述第一预测块和所述第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量;
基于所述每个基本处理单元的运动信息修正量,获得所述第一图像块的预测值。
在一种可行的实施方式中,所述装置1400还包括第一扩展模块1404:
所述第一扩展模块,用于基于所述第一预测块进行块边缘位置的像素值,对所述第一预测块的宽度和高度进行第一扩展,以使第一扩展后的第一预测块的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;和/或,基于所述第一梯度值矩阵进行矩阵边缘位置的梯度值,对所述第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;
对应的,所述预测模块1402,用于根据所述第一扩展后的第一预测块和/或所述第一扩展后的第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量。
在一种可行的实施方式中,所述装置还包括第二扩展模块1405:
所述第二扩展模块,用于对所述第一预测块的块边缘区域的像素值进行插值滤波,或者,对所述第一预测块的块边缘位置的像素值进行复制,以对所述第一预测块的宽度和高度进行第二扩展;
对应的,所述预测模块1402,用于对所述第二扩展后的第一预测块进行梯度运算。
在一种可行的实施方式中,所述第一预测块包括前向预测块和后向预测块,所述第一梯度值矩阵包括前向水平梯度值矩阵、前向竖直梯度值矩阵、后向水平梯度值矩阵和后向竖直梯度值矩阵。
在一种可行的实施方式中,所述预设图像划分宽度为64、32或16,所述预设图像划分高度为64、32或16。
在一种可行的实施方式中,所述基本处理单元为4x4的像素矩阵。
在本申请实施例中,由于确定模块根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块,这样第一图像块的尺寸受到预设图像划分宽度和预设图像划分高度的约束,不会使确定的每个第一图像块的面积较大,从而可以减小对内存等硬件资源的消耗,降低帧间预测的实现复杂度,提高处理效率。
本领域技术人员能够领会,结合本文公开描述的各种说明性逻辑框、模块和算法步骤所描述的功能可以硬件、软件、固件或其任何组合来实施。如果以软件来实施,那么各种说明性逻辑框、模块、和步骤描述的功能可作为一或多个指令或代码在计算机可读媒体上存储或传输,且由基于硬件的处理单元执行。计算机可读媒体可包含计算机可读存储媒体,其对应于有形媒体,例如数据存储媒体,或包括任何促进将计算机程序从一处传送到另一处的媒体(例如,根据通信协议)的通信媒体。以此方式,计算机可读媒体大体上可对应于(1)非暂时性的有形计算机可读存储媒体,或(2)通信媒体,例如信号或载波。数据存储媒体可为可由一或多个计算机或一或多个处理器存取以检索用于实施本申请中描述的技术的指令、代码和/或数据结构的任何可用媒体。计算机程序产品可包含计算机可读媒体。
作为实例而非限制,此类计算机可读存储媒体可包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储装置、磁盘存储装置或其它磁性存储装置、快闪存储器或可用来存储指令或 数据结构的形式的所要程序代码并且可由计算机存取的任何其它媒体。并且,任何连接被恰当地称作计算机可读媒体。举例来说,如果使用同轴缆线、光纤缆线、双绞线、数字订户线(DSL)或例如红外线、无线电和微波等无线技术从网站、服务器或其它远程源传输指令,那么同轴缆线、光纤缆线、双绞线、DSL或例如红外线、无线电和微波等无线技术包含在媒体的定义中。但是,应理解,所述计算机可读存储媒体和数据存储媒体并不包括连接、载波、信号或其它暂时媒体,而是实际上针对于非暂时性有形存储媒体。如本文中所使用,磁盘和光盘包含压缩光盘(CD)、激光光盘、光学光盘、数字多功能光盘(DVD)和蓝光光盘,其中磁盘通常以磁性方式再现数据,而光盘利用激光以光学方式再现数据。以上各项的组合也应包含在计算机可读媒体的范围内。
可通过例如一或多个数字信号处理器(DSP)、通用微处理器、专用集成电路(ASIC)、现场可编程逻辑阵列(FPGA)或其它等效集成或离散逻辑电路等一或多个处理器来执行指令。因此,如本文中所使用的术语“处理器”可指前述结构或适合于实施本文中所描述的技术的任一其它结构中的任一者。另外,在一些方面中,本文中所描述的各种说明性逻辑框、模块、和步骤所描述的功能可以提供于经配置以用于编码和解码的专用硬件和/或软件模块内,或者并入在组合编解码器中。而且,所述技术可完全实施于一或多个电路或逻辑元件中。
本申请的技术可在各种各样的装置或设备中实施,包含无线手持机、集成电路(IC)或一组IC(例如,芯片组)。本申请中描述各种组件、模块或单元是为了强调用于执行所揭示的技术的装置的功能方面,但未必需要由不同硬件单元实现。实际上,如上文所描述,各种单元可结合合适的软件和/或固件组合在编码解码器硬件单元中,或者通过互操作硬件单元(包含如上文所描述的一或多个处理器)来提供。
在上述实施例中,对各个实施例的描述各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
以上所述,仅为本申请示例性的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应该以权利要求的保护范围为准。

Claims (19)

  1. 一种帧间预测的方法,其特征在于,包括:
    根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块;
    对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值;
    组合所述多个第一图像块的预测值,以获得所述待处理图像块的预测值。
  2. 根据权利要求1所述的方法,其特征在于,所述根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块,包括:
    比较所述预设图像划分宽度和所述待处理图像块的宽度,以确定所述第一图像块的宽度;
    比较所述预设图像划分高度和所述待处理图像块的高度,以确定所述第一图像块的高度;
    根据所述第一图像块的宽度和高度,在所述待处理图像块中确定所述多个第一图像块。
  3. 根据权利要求1或2所述的方法,其特征在于,所述第一图像块的宽度为所述预设图像划分宽度和所述待处理图像块的宽度之间的最小值,且所述第一图像块的高度为所述预设图像划分高度和所述待处理图像块的高度之间的最小值。
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值,包括:
    基于所述待处理图像块的运动信息,获得所述第一图像块的第一预测块;
    对所述第一预测块进行梯度运算,以获得所述第一图像块的第一梯度值矩阵;
    根据所述第一预测块和所述第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量;
    基于所述每个基本处理单元的运动信息修正量,获得所述第一图像块的预测值。
  5. 根据权利要求4所述的方法,其特征在于,在所述根据所述第一预测块和所述第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量之前,还包括:
    基于所述第一预测块进行块边缘位置的像素值,对所述第一预测块的宽度和高度进行第一扩展,以使第一扩展后的第一预测块的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;和/或,
    基于所述第一梯度值矩阵进行矩阵边缘位置的梯度值,对所述第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;
    对应的,所述根据所述第一预测块和所述第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量,包括:
    根据所述第一扩展后的第一预测块和/或所述第一扩展后的第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量。
  6. 根据权利要求4或5所述的方法,其特征在于,在所述对所述第一预测块进行梯度运算之前,还包括:
    对所述第一预测块的块边缘区域的像素值进行插值滤波,或者,对所述第一预测块的块边缘位置的像素值进行复制,以对所述第一预测块的宽度和高度进行第二扩展;
    对应的,所述对所述第一预测块进行梯度运算,包括:
    对所述第二扩展后的第一预测块进行梯度运算。
  7. 根据权利要求1至6任一项所述的方法,其特征在于,所述第一预测块包括前向预测块和后向预测块,所述第一梯度值矩阵包括前向水平梯度值矩阵、前向竖直梯度值矩阵、后向水平梯度值矩阵和后向竖直梯度值矩阵。
  8. 根据权利要求1至7任一项所述的方法,其特征在于,所述预设图像划分宽度为64、32或16,所述预设图像划分高度为64、32或16。
  9. 根据权利要求1至8任一项所述的方法,其特征在于,所述基本处理单元为4x4的像素矩阵。
  10. 一种帧间预测的装置,其特征在于,包括:
    确定模块,用于根据预设图像划分宽度、预设图像划分高度、所述待处理图像块的宽度和高度,在所述待处理图像块中确定多个第一图像块;
    预测模块,用于对所述多个第一图像块分别进行基于光流的双向预测,以获得每个第一图像块的预测值;
    组合模块,用于组合所述多个第一图像块的预测值,以获得所述待处理图像块的预测值。
  11. 根据权利要求10所述的装置,其特征在于,所述确定模块,用于:
    比较所述预设图像划分宽度和所述待处理图像块的宽度,以确定所述第一图像块的宽度;
    比较所述预设图像划分高度和所述待处理图像块的高度,以确定所述第一图像块的高度;
    根据所述第一图像块的宽度和高度,在所述待处理图像块中确定所述多个第一图像块。
  12. 根据权利要求10或11所述的装置,其特征在于,所述第一图像块的宽度为所述预设图像划分宽度和所述待处理图像块的宽度之间的最小值,且所述第一图像块的高度为所述预设图像划分高度和所述待处理图像块的高度之间的最小值。
  13. 根据权利要求10至12任一项所述的装置,其特征在于,所述预测模块,用于:
    基于所述待处理图像块的运动信息,获得所述第一图像块的第一预测块;
    对所述第一预测块进行梯度运算,以获得所述第一图像块的第一梯度值矩阵;
    根据所述第一预测块和所述第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量;
    基于所述每个基本处理单元的运动信息修正量,获得所述第一图像块的预测值。
  14. 根据权利要求13所述的装置,其特征在于,所述装置还包括第一扩展模块:
    所述第一扩展模块,用于基于所述第一预测块进行块边缘位置的像素值,对所述第一预测块的宽度和高度进行第一扩展,以使第一扩展后的第一预测块的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;和/或,基于所述第一梯度值矩阵进行矩阵边缘位置的梯度值,对所述第一梯度值矩阵的宽度和高度进行第一扩展,以使第一扩展后的第一梯度值矩阵的宽度和高度分别比所述第一图像块的宽度和高度大2个像素点距离;
    对应的,所述预测模块,用于根据所述第一扩展后的第一预测块和/或所述第一扩展后的第一梯度值矩阵,计算所述第一图像块中每个基本处理单元的运动信息修正量。
  15. 根据权利要求13或14所述的装置,其特征在于,所述装置还包括第二扩展模块:
    所述第二扩展模块,用于对所述第一预测块的块边缘区域的像素值进行插值滤波,或者,对所述第一预测块的块边缘位置的像素值进行复制,以对所述第一预测块的宽度和高度进行第二扩展;
    对应的,所述预测模块,用于对所述第二扩展后的第一预测块进行梯度运算。
  16. 根据权利要求10至15任一项所述的装置,其特征在于,所述第一预测块包括前向预测块和后向预测块,所述第一梯度值矩阵包括前向水平梯度值矩阵、前向竖直梯度值矩阵、后向水平梯度值矩阵和后向竖直梯度值矩阵。
  17. 根据权利要求10至16任一项所述的装置,其特征在于,所述预设图像划分宽度为64、32或16,所述预设图像划分高度为64、32或16。
  18. 根据权利要求10至17任一项所述的装置,其特征在于,所述基本处理单元为4x4的像素矩阵。
  19. 一种帧间预测的设备,其特征在于,包括:相互耦合的非易失性存储器和处理器,所述处理器调用存储在所述存储器中的程序代码以执行如权利要求1-9任一项所描述的方法。
PCT/CN2019/122735 2018-12-13 2019-12-03 一种帧间预测的方法及装置 WO2020119525A1 (zh)

Priority Applications (12)

Application Number Priority Date Filing Date Title
JP2021533635A JP7384908B2 (ja) 2018-12-13 2019-12-03 インター予測方法および装置
BR112021011307-0A BR112021011307A2 (pt) 2018-12-13 2019-12-03 Método e aparelho de predição inter, fluxo de bits e mídia de armazenamento não transitória
CN201980013385.6A CN112088534B (zh) 2018-12-13 2019-12-03 一种帧间预测的方法、装置、设备及存储介质
AU2019397944A AU2019397944B2 (en) 2018-12-13 2019-12-03 Inter-frame prediction method and device
KR1020217021694A KR20210096282A (ko) 2018-12-13 2019-12-03 인터 예측 방법 및 장치
EP19897262.2A EP3890325A4 (en) 2018-12-13 2019-12-03 METHOD AND DEVICE FOR INTER-FRAME PREDICTION
MX2021006787A MX2021006787A (es) 2018-12-13 2019-12-03 Metodo y aparato de inter prediccion, flujo de bits y un medio de almacenamiento no transitorio.
CA3122618A CA3122618A1 (en) 2018-12-13 2019-12-03 Inter prediction method and apparatus, bit stream and a non-transitory storage medium
SG11202105848YA SG11202105848YA (en) 2018-12-13 2019-12-03 Inter prediction method and apparatus, bit stream and a non-transitory storage medium
US17/345,556 US20210306644A1 (en) 2018-12-13 2021-06-11 Inter prediction method and apparatus
JP2023191838A JP2024014927A (ja) 2018-12-13 2023-11-09 インター予測方法および装置
AU2024200854A AU2024200854A1 (en) 2018-12-13 2024-02-09 Inter-frame prediction method and device

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201811530481.1 2018-12-13
CN201811530481 2018-12-13
CN201910325612.0 2019-04-22
CN201910325612.0A CN111327907B (zh) 2018-12-13 2019-04-22 一种帧间预测的方法、装置、设备及存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/345,556 Continuation US20210306644A1 (en) 2018-12-13 2021-06-11 Inter prediction method and apparatus

Publications (1)

Publication Number Publication Date
WO2020119525A1 true WO2020119525A1 (zh) 2020-06-18

Family

ID=71076235

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122735 WO2020119525A1 (zh) 2018-12-13 2019-12-03 一种帧间预测的方法及装置

Country Status (1)

Country Link
WO (1) WO2020119525A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414895A (zh) * 2013-07-29 2013-11-27 复旦大学 一种适用于hevc标准的编码器帧内预测装置及方法
CN106134192A (zh) * 2014-03-25 2016-11-16 株式会社索思未来 图像解码装置、图像解码方法及集成电路
WO2017134957A1 (ja) * 2016-02-03 2017-08-10 シャープ株式会社 動画像復号装置、動画像符号化装置、および予測画像生成装置
CN108028929A (zh) * 2015-09-28 2018-05-11 高通股份有限公司 用于视频译码的改进双向光流

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414895A (zh) * 2013-07-29 2013-11-27 复旦大学 一种适用于hevc标准的编码器帧内预测装置及方法
CN106134192A (zh) * 2014-03-25 2016-11-16 株式会社索思未来 图像解码装置、图像解码方法及集成电路
CN108028929A (zh) * 2015-09-28 2018-05-11 高通股份有限公司 用于视频译码的改进双向光流
WO2017134957A1 (ja) * 2016-02-03 2017-08-10 シャープ株式会社 動画像復号装置、動画像符号化装置、および予測画像生成装置

Similar Documents

Publication Publication Date Title
WO2020125595A1 (zh) 视频译码器及相应方法
WO2020114394A1 (zh) 视频编解码方法、视频编码器和视频解码器
WO2020244579A1 (zh) Mpm列表构建方法、色度块的帧内预测模式获取方法及装置
WO2020232845A1 (zh) 一种帧间预测的方法和装置
CN115243048A (zh) 视频图像解码、编码方法及装置
JP2024056899A (ja) インター予測の方法および装置、並びに対応するエンコーダおよびデコーダ
CN112088534B (zh) 一种帧间预测的方法、装置、设备及存储介质
WO2020253681A1 (zh) 融合候选运动信息列表的构建方法、装置及编解码器
CN111432219B (zh) 一种帧间预测方法及装置
CN111263166B (zh) 一种视频图像预测方法及装置
CN112135137A (zh) 视频编码器、视频解码器及相应方法
US20210344899A1 (en) Video encoder, video decoder, and corresponding methods
WO2020259353A1 (zh) 语法元素的熵编码/解码方法、装置以及编解码器
CN111405277B (zh) 帧间预测方法、装置以及相应的编码器和解码器
CN111726617B (zh) 用于融合运动矢量差技术的优化方法、装置及编解码器
CN111372086B (zh) 视频图像解码方法及装置
WO2020114509A1 (zh) 视频图像解码、编码方法及装置
WO2020114393A1 (zh) 变换方法、反变换方法以及视频编码器和视频解码器
WO2020135371A1 (zh) 一种标志位的上下文建模方法及装置
WO2020181476A1 (zh) 视频图像预测方法及装置
WO2020119525A1 (zh) 一种帧间预测的方法及装置
RU2787885C2 (ru) Способ и оборудование взаимного прогнозирования, поток битов и энергонезависимый носитель хранения
WO2020187062A1 (zh) 用于融合运动矢量差技术的优化方法、装置及编解码器
CN113170147B (zh) 视频编码器、视频解码器、及对应方法
WO2020108168A1 (zh) 一种视频图像预测方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19897262

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2019397944

Country of ref document: AU

ENP Entry into the national phase

Ref document number: 3122618

Country of ref document: CA

ENP Entry into the national phase

Ref document number: 2021533635

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112021011307

Country of ref document: BR

ENP Entry into the national phase

Ref document number: 2019397944

Country of ref document: AU

Date of ref document: 20191203

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2019897262

Country of ref document: EP

Effective date: 20210630

Ref document number: 20217021694

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 112021011307

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20210610