TW202209893A - Inter-frame prediction method, coder, decoder and computer storage medium characterized by reducing the prediction errors and promoting the coding performance to increase the coding/decoding efficiency - Google Patents

Inter-frame prediction method, coder, decoder and computer storage medium characterized by reducing the prediction errors and promoting the coding performance to increase the coding/decoding efficiency Download PDF

Info

Publication number
TW202209893A
TW202209893A TW110130848A TW110130848A TW202209893A TW 202209893 A TW202209893 A TW 202209893A TW 110130848 A TW110130848 A TW 110130848A TW 110130848 A TW110130848 A TW 110130848A TW 202209893 A TW202209893 A TW 202209893A
Authority
TW
Taiwan
Prior art keywords
motion vector
deviation
sub
block
prediction
Prior art date
Application number
TW110130848A
Other languages
Chinese (zh)
Inventor
謝志煌
Original Assignee
大陸商Oppo廣東移動通信有限公司
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
Application filed by 大陸商Oppo廣東移動通信有限公司 filed Critical 大陸商Oppo廣東移動通信有限公司
Publication of TW202209893A publication Critical patent/TW202209893A/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel
    • 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
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • 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
    • H04N19/51Motion estimation or motion compensation
    • H04N19/533Motion estimation using multistep search, e.g. 2D-log search or one-at-a-time search [OTS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

Disclosed are an inter-frame prediction method, a coder, a decoder and a computer storage medium. The decoder parses a bit stream and obtains the prediction mode parameters of the current block. When the prediction mode parameters indicate to use the inter-frame prediction mode to determine the inter-frame prediction value of the current block, the first motion vector of the sub-block of the current block is determined. When the current block includes several sub-blocks, based on the first motion vector, the first prediction value of the sub-block and the first motion vector deviation between the each pixel position in the sub-block and the sub-block are determined. Based on the first motion vector deviation value, the center position corresponding to each pixel position and the second motion vector deviation are determined. Based on the first prediction value, the center position and the second motion vector deviation to perform the second prediction or the PROF process, the second prediction value of the sub-block is determined and the second prediction value is determined to be the inter-frame prediction value of the sub-block.

Description

幀間預測方法、編碼器、解碼器以及電腦儲存媒介Inter-frame prediction method, encoder, decoder and computer storage medium

本申請涉及影像編解碼技術領域,尤其涉及一種幀間預測方法、編碼器、解碼器以及電腦儲存媒介。The present application relates to the technical field of image coding and decoding, and in particular, to an inter-frame prediction method, an encoder, a decoder, and a computer storage medium.

在影像編解碼領域,為了兼顧性能和代價,一般情況下,在多功能影像編碼(Versatile Video Coding,VVC)及數位音頻視頻編解碼技術標準工作組(Audio Video coding Standard Workgroup of China,AVS)中的仿射預測是基於子塊來實現的。目前,一方面提出了使用光流原理的預測修正(prediction refinement with optical flow,PROF)使用光流原理對基於子塊的仿射預測進行修正;另一方面提出了在基於子塊的預測之後使用二次預測獲得更加準確的預測值,從而實現了對仿射預測的改善。具體地,PROF依賴於基準位置的水平方向和垂直方向的梯度來修正仿射預測結果,而二次預測則是使用濾波器對子塊中的一個像素位置再次進行預測。In the field of video coding and decoding, in order to take into account the performance and cost, under normal circumstances, in the Versatile Video Coding (VVC) and Digital Audio Video coding Standard Workgroup of China (AVS) The affine prediction of is implemented based on sub-blocks. At present, on the one hand, a prediction refinement with optical flow (PROF) is proposed to use the optical flow principle to modify the sub-block-based affine prediction; The quadratic prediction achieves a more accurate prediction value, thus achieving an improvement over affine prediction. Specifically, PROF relies on the horizontal and vertical gradients of the reference position to correct the affine prediction results, while the secondary prediction uses a filter to predict a pixel position in a sub-block again.

然而,當二次預測或PROF需要使用的濾波器的中心位置如果存在較大的運動向量偏差時,預測的準確性可能會大大降低,也就是說,現有的PROF修正預測值方法和二次預測方法其實並不嚴謹,在對仿射預測進行改善時,並不能很好的適用於全部場景,編碼性能有待提升。However, when there is a large motion vector deviation in the center position of the filter that the secondary prediction or PROF needs to use, the accuracy of the prediction may be greatly reduced, that is, the existing PROF correction prediction method and secondary prediction In fact, the method is not rigorous. When improving affine prediction, it cannot be well applied to all scenarios, and the coding performance needs to be improved.

本申請提出一種幀間預測方法、編碼器、解碼器以及電腦儲存媒介,可以減小預測的誤差,大大提升編碼性能,從而提高了編解碼效率。The present application proposes an inter-frame prediction method, an encoder, a decoder, and a computer storage medium, which can reduce prediction errors, greatly improve encoding performance, and thus improve encoding and decoding efficiency.

本申請的技術方案是這樣實現的:The technical solution of the present application is realized as follows:

第一方面,本申請實施例提供了一種幀間預測方法,應用於解碼器,該方法包括:In a first aspect, an embodiment of the present application provides an inter-frame prediction method, which is applied to a decoder, and the method includes:

解析位元流,獲取當前塊的預測模式參數;Parse the bit stream to obtain the prediction mode parameters of the current block;

當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;When the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, a first motion vector of a subblock of the current block is determined; wherein the current block includes a plurality of subblocks;

基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;determining a first predicted value for the subblock based on the first motion vector, and a first motion vector offset between each pixel position in the subblock and the subblock;

根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation;

基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。Based on the first predicted value, secondary prediction or PROF processing is performed according to the center position and the deviation of the second motion vector, the second predicted value of the sub-block is determined, and the second predicted value is determined as the Inter-predicted value of the sub-block.

第二方面,本申請實施例提供了一種幀間預測方法,應用於編碼器,該方法包括:In a second aspect, an embodiment of the present application provides an inter-frame prediction method, which is applied to an encoder, and the method includes:

確定當前塊的預測模式參數;determine the prediction mode parameter of the current block;

當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;When the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, a first motion vector of a subblock of the current block is determined; wherein the current block includes a plurality of subblocks;

基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;determining a first predicted value for the subblock based on the first motion vector, and a first motion vector offset between each pixel position in the subblock and the subblock;

根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation;

基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。Based on the first predicted value, secondary prediction or PROF processing is performed according to the center position and the deviation of the second motion vector, the second predicted value of the sub-block is determined, and the second predicted value is determined as the Inter-predicted value of the sub-block.

第三方面,本申請實施例提供了一種解碼器,所述解碼器包括解析單元,第一確定單元;In a third aspect, an embodiment of the present application provides a decoder, where the decoder includes a parsing unit and a first determining unit;

所述解析單元,用於解析位元流,獲取當前塊的預測模式參數;The parsing unit is used to parse the bit stream to obtain the prediction mode parameter of the current block;

所述第一確定單元,用於當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;以及基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;以及根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;以及基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。The first determining unit is configured to determine a first motion vector of a sub-block of the current block when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode; wherein the the current block includes a plurality of sub-blocks; and determining a first predictor for the sub-block based on the first motion vector, and a first motion vector between each pixel position in the sub-block and the sub-block and determining a center position corresponding to each pixel position and a second motion vector deviation according to the first motion vector deviation; and based on the first predicted value, according to the center position and the second motion vector The deviation is subjected to secondary prediction or PROF processing, the second prediction value of the sub-block is determined, and the second prediction value is determined as the inter-frame prediction value of the sub-block.

第四方面,本申請實施例提供了一種解碼器,所述解碼器包括第一處理器、儲存有所述第一處理器可執行指令的第一記憶體,當所述指令被執行時,所述第一處理器執行時實現如上所述的幀間預測方法。In a fourth aspect, an embodiment of the present application provides a decoder. The decoder includes a first processor and a first memory storing an executable instruction of the first processor. When the instruction is executed, the When executed by the first processor, the above-mentioned inter-frame prediction method is implemented.

第五方面,本申請實施例提供了一種編碼器,所述編碼器包括第二確定單元;In a fifth aspect, an embodiment of the present application provides an encoder, where the encoder includes a second determining unit;

所述第二確定單元,用於確定當前塊的預測模式參數;以及當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;以及基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;以及根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;以及基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。the second determining unit, configured to determine a prediction mode parameter of the current block; and when the prediction mode parameter indicates that an inter prediction value of the current block is determined using an inter prediction mode, determining a subblock of the current block The first motion vector of the a first motion vector deviation between sub-blocks; and determining a center position corresponding to each pixel position and a second motion vector deviation according to the first motion vector deviation; and based on the first predicted value, according to the Perform secondary prediction or PROF processing on the center position and the second motion vector deviation, determine the second prediction value of the sub-block, and determine the second prediction value as the inter-frame prediction value of the sub-block.

第六方面,本申請實施例提供了一種編碼器,所述編碼器包括第二處理器、儲存有所述第二處理器可執行指令的第二記憶體,當所述指令被執行時,所述第二處理器執行時實現如上所述的幀間預測方法。In a sixth aspect, an embodiment of the present application provides an encoder, the encoder includes a second processor, and a second memory storing an executable instruction of the second processor, when the instruction is executed, the When executed by the second processor, the inter-frame prediction method as described above is implemented.

第七方面,本申請實施例提供了一種電腦儲存媒介,該電腦儲存媒介儲存有電腦程式,所述電腦程式被第一處理器和第二處理器執行時,實現如上所述的幀間預測方法。In a seventh aspect, an embodiment of the present application provides a computer storage medium, the computer storage medium stores a computer program, and when the computer program is executed by the first processor and the second processor, the above-mentioned inter-frame prediction method is implemented .

本申請實施例所提供的一種幀間預測方法、編碼器、解碼器以及電腦儲存媒介,解碼器解析位元流,獲取當前塊的預測模式參數;當預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值時,確定當前塊的子塊的第一運動向量;其中,當前塊包括多個子塊;基於第一運動向量確定子塊的第一預測值,和子塊中的每一個像素位置與子塊之間的第一運動向量偏差;根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差;基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值。編碼器確定當前塊的預測模式參數;當預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值時,確定當前塊的子塊的第一運動向量;其中,當前塊包括多個子塊;基於第一運動向量確定子塊的第一預測值,和子塊中的每一個像素位置與子塊之間的第一運動向量偏差;根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差;基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值。也就是說,本申請提出的幀間預測方法,可以在基於子塊的預測之後,對運動向量與子塊的運動向量之間的第一運動向量偏差較大的像素位置,可以基於第一運動向量偏差重新確定進行二次預測或PROF處理所使用的中心位置和第二運動向量偏差的確定,從而可以在基於子塊的第一預測值的基礎上,利用中心位置和第二運動向量偏差進行基於點的二次預測,獲得第二預測值。可見,本申請提出的幀間預測方法能夠很好的適用於全部場景,可以減小預測的誤差,大大提升編碼性能,從而提高了編解碼效率。An inter-frame prediction method, an encoder, a decoder, and a computer storage medium provided by the embodiments of the present application. The decoder parses the bit stream and obtains the prediction mode parameter of the current block; when the prediction mode parameter indicates that the inter-frame prediction mode is used to determine the current When the inter-frame prediction value of the block is used, the first motion vector of the sub-block of the current block is determined; wherein, the current block includes a plurality of sub-blocks; the first prediction value of the sub-block is determined based on the first motion vector, and each pixel in the sub-block The first motion vector deviation between the position and the sub-block; the center position and the second motion vector deviation corresponding to each pixel position are determined according to the first motion vector deviation; based on the first predicted value, according to the center position and the second motion vector deviation Secondary prediction or PROF processing is performed to determine the second prediction value of the sub-block, and the second prediction value is determined as the inter-frame prediction value of the sub-block. The encoder determines the prediction mode parameter of the current block; when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, the first motion vector of the subblock of the current block is determined; wherein, the current block includes a plurality of subblocks Determine the first predicted value of the sub-block based on the first motion vector, and the first motion vector deviation between each pixel position in the sub-block and the sub-block; Determine the center position corresponding to each pixel position according to the first motion vector deviation and the second motion vector deviation; based on the first predicted value, carry out secondary prediction or PROF processing according to the center position and the second motion vector deviation, determine the second predicted value of the sub-block, and determine the second predicted value as the frame of the sub-block inter-prediction value. That is to say, the inter-frame prediction method proposed in this application can, after the prediction based on the sub-block, for the pixel position with a large deviation of the first motion vector between the motion vector and the motion vector of the sub-block, it can be based on the first motion vector. The vector deviation re-determines the determination of the center position and the second motion vector deviation used for secondary prediction or PROF processing, so that the center position and the second motion vector deviation can be used on the basis of the first prediction value based on the sub-block. Based on the secondary prediction of the points, a second predicted value is obtained. It can be seen that the inter-frame prediction method proposed in this application can be well applied to all scenarios, can reduce the prediction error, greatly improve the coding performance, and thus improve the coding and decoding efficiency.

下面將結合本申請實施例中的附圖,對本申請實施例中的技術方案進行清楚、完整地描述。可以理解的是,此處所描述的具體實施例僅僅用於解釋相關申請,而非對該申請的限定。另外還需要說明的是,為了便於描述,附圖中僅示出了與有關申請相關的部分。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the related application, but not to limit the application. In addition, it should be noted that, for the convenience of description, only the parts related to the relevant application are shown in the drawings.

目前,通用的影像編解碼標準基於都採用基於塊的混合編碼框架。影像圖像中的每一幀被分割成相同大小(比如128×128,64×64等)的正方形的最大編碼單元(Largest Coding Unit,LCU),每個最大編碼單元還可以根據規則劃分成矩形的編碼單元(Coding Unit,CU);而且編碼單元可能還會劃分成更小的預測單元(Prediction Unit,PU)。具體地,混合編碼框架可以包括有預測、變換(Transform)、量化(Quantization)、熵編碼(EntropyCoding)、迴路濾波(In Loop Filter)等模組;其中,預測模組可以包括幀內預測(intraPrediction)和幀間預測(interPrediction),幀間預測可以包括運動估計(motion estimation)和運動補償(motion compensation)。由於影像圖像的一個幀內相鄰像素之間存在很強的相關性,在影像編解碼技術中使用幀內預測方式能夠消除相鄰像素之間的空間冗餘;但是由於影像圖像中的相鄰幀之間也存在著很強的相似性,在影像編解碼技術中使用幀間預測方式消除相鄰幀之間的時間冗餘,從而能夠提高編碼效率。下述本申請將以幀間預測進行詳細描述。Currently, common video coding standards are based on the use of block-based hybrid coding frameworks. Each frame in the video image is divided into square Largest Coding Units (LCUs) of the same size (such as 128×128, 64×64, etc.), and each LCU can also be divided into rectangles according to rules The coding unit (Coding Unit, CU); and the coding unit may be divided into smaller prediction units (Prediction Unit, PU). Specifically, the hybrid coding framework may include modules such as prediction, transform (Transform), quantization (Quantization), entropy coding (EntropyCoding), and loop filtering (In Loop Filter); wherein, the prediction module may include intraPrediction (intraPrediction) ) and inter-frame prediction (interPrediction), inter-frame prediction can include motion estimation (motion estimation) and motion compensation (motion compensation). Since there is a strong correlation between adjacent pixels in a frame of an image image, the use of intra-frame prediction in the image coding and decoding technology can eliminate the spatial redundancy between adjacent pixels; There is also a strong similarity between adjacent frames. In the image coding and decoding technology, the inter-frame prediction method is used to eliminate the temporal redundancy between adjacent frames, thereby improving the coding efficiency. The present application will be described in detail below in terms of inter prediction.

幀間預測即使用已經編/解碼的幀來預測當前幀中需要編/解碼的部分,在基於塊的編解碼框架裡,需要編/解碼的部分通常是編碼單元或預測單元。這裡把需要編/解碼的編碼單元或預測單元統稱為當前塊。平移運動是影像中的一種常見而且簡單的運動方式,所以平移的預測也是影像編解碼中的一種傳統的預測方法。影像中的平移運動可以理解為一部分內容隨著時間的變化,從一個幀上的某一個位置移動到了另一個幀上的某一個位置。平移的一個簡單的單向預測可以用某一幀與當前幀之間的一個運動向量(motion vector,MV)來表示。這裡所說的某一幀為當前幀的一個參考幀,當前塊透過這個包含參考幀和運動向量的運動訊息可以找到參考幀上的一個與當前塊大小相同的參考塊,把這個參考塊作為當前塊的預測塊。理想的平移運動中,當前塊的內容在不同幀之間沒有變形、旋轉等變化以及亮度顏色的變化等,然而,影像中的內容並不總是符合這樣的理想情況。雙向預測在一定程度上可以解決上述問題。通常的雙向預測是指雙向的平移的預測。雙向預測即是用兩個參考幀和運動向量的運動訊息分別從兩個參考幀(兩個參考幀可能是同一個參考幀)找到兩個與當前塊大小相同的參考塊,利用這兩個參考塊生成當前塊的預測塊。生成方法包括平均、加權平均以及一些其他的計算等。Inter-frame prediction is to use the already encoded/decoded frame to predict the part that needs to be encoded/decoded in the current frame. In the block-based encoding/decoding framework, the part that needs to be encoded/decoded is usually a coding unit or a prediction unit. Here, the coding unit or prediction unit that needs to be encoded/decoded is collectively referred to as the current block. Translation motion is a common and simple motion method in images, so translation prediction is also a traditional prediction method in image coding and decoding. The translational motion in the image can be understood as the change of a part of the content over time, moving from a certain position on one frame to a certain position on another frame. A simple unidirectional prediction of translation can be represented by a motion vector (MV) between a certain frame and the current frame. A certain frame mentioned here is a reference frame of the current frame. The current block can find a reference block on the reference frame with the same size as the current block through the motion information including the reference frame and motion vector, and use this reference block as the current block. The predicted block for the block. In an ideal translation motion, the content of the current block does not change from frame to frame, such as deformation, rotation, and brightness and color. However, the content in the image does not always conform to such an ideal situation. Bidirectional prediction can solve the above problems to a certain extent. The usual bidirectional prediction refers to bidirectional translation prediction. Bidirectional prediction is to use the motion information of two reference frames and motion vectors to find two reference blocks with the same size as the current block from two reference frames (the two reference frames may be the same reference frame), and use these two reference frames. The block generates a predicted block for the current block. Generation methods include averaging, weighted averaging, and some other calculations.

在本申請中,可以認為預測是運動補償的一部分,有些文獻會把本申請中的預測稱為運動補償,如本申請所說仿射預測,有些文獻會叫作仿射運動補償。In this application, prediction can be considered as a part of motion compensation, and some documents will call the prediction in this application motion compensation, and as mentioned in this application, affine prediction, some documents will call it affine motion compensation.

旋轉、放大、縮小、扭曲、形變等也是在影像中常見的變化,然而,普通的平移預測並不能很好地處理這種變化,於是仿射(affine)預測模型被應用於影像編解碼中,如VVC和AVS中的仿射,其中,VVC和AVS3的仿射預測模型相似。在旋轉、放大、縮小、扭曲、形變等變化中,可以認為當前塊不是所有點都使用相同的MV,因此需要匯出每一個點的MV。仿射預測模型用少量的幾個參數透過計算匯出每一個點的MV。VVC和AVS3的仿射預測模型都使用了2控制點(4參數)和3控制點(6參數)模型。2控制點即當前塊的左上角和右上角2個控制點,3控制點即當前塊的左上角、右上角和左下角3個控制點。示例性的,圖1為仿射模型的示意圖一,圖2為仿射模型的示意圖二,如圖1和2所示。因為每個MV包括一個x分量和一個y分量,所以2個控制點有4個參數,3個控制點有6個參數。Rotation, enlargement, reduction, distortion, deformation, etc. are also common changes in images. However, ordinary translation prediction cannot handle such changes well, so affine prediction models are used in image encoding and decoding. Such as affine in VVC and AVS, where the affine prediction models of VVC and AVS3 are similar. In changes such as rotation, enlargement, reduction, distortion, deformation, etc., it can be considered that not all points in the current block use the same MV, so the MV of each point needs to be exported. The affine prediction model uses a small number of parameters to export the MV of each point by calculating. Both VVC and AVS3 affine prediction models use 2-control point (4-parameter) and 3-control point (6-parameter) models. The 2 control point is the 2 control points in the upper left corner and the upper right corner of the current block, and the 3 control point is the 3 control points in the upper left corner, the upper right corner and the lower left corner of the current block. Exemplarily, FIG. 1 is a schematic diagram 1 of an affine model, and FIG. 2 is a schematic diagram 2 of an affine model, as shown in FIGS. 1 and 2 . Because each MV includes an x-component and a y-component, 2 control points have 4 parameters, and 3 control points have 6 parameters.

根據仿射預測模型可以為每一個像素位置匯出一個MV,每一個像素位置都可以在參考幀中找到其對應的位置,如果這個位置不是整像素位置,那麼需要透過插值的方法得出這個分像素位置的值。現在影像編解碼標準中使用的插值方法通常都是有限脈衝反應(Finite Impulse Response,FIR)濾波器來實現,而按這種方式實現複雜度(成本)是很高的。例如,在AVS3中,對亮度分量使用8抽頭的插值濾波器,而且普通模式分像素精度是1/4像素的,affine模式的分像素精度是1/16像素的。對每一個符合1/16像素精度的分像素點,需要使用水平方向的8個整像素和垂直方向8個整像素即64個整像素插值得到。圖3為像素的插值示意圖,如圖3所示,圓形像素是想要得到的分像素點,深色的正方形像素是該分像素對應的整像素的位置,它們兩個之間的向量就是分像素的運動向量,淺色的正方形像素是對圓形分像素位置的插值需要用到的像素,要得到該分像素位置的值,需要這些8x8的淺色的正方形像素區域的像素值進行插值,也包含深色的像素位置。According to the affine prediction model, an MV can be exported for each pixel position, and each pixel position can be found in the reference frame. The value of the pixel position. The interpolation methods used in the current image coding and decoding standards are usually implemented by Finite Impulse Response (FIR) filters, and the complexity (cost) is very high to implement in this way. For example, in AVS3, an 8-tap interpolation filter is used for the luminance component, and the sub-pixel accuracy of normal mode is 1/4 pixel, and the sub-pixel accuracy of affine mode is 1/16 pixel. For each sub-pixel point that meets the 1/16 pixel precision, it needs to be obtained by using 8 integer pixels in the horizontal direction and 8 integer pixels in the vertical direction, that is, 64 integer pixels. Figure 3 is a schematic diagram of pixel interpolation. As shown in Figure 3, the circular pixel is the desired sub-pixel point, the dark square pixel is the position of the integer pixel corresponding to the sub-pixel, and the vector between them is The motion vector of the sub-pixels, the light-colored square pixels are the pixels that need to be used for the interpolation of the circular sub-pixel positions. To get the value of the sub-pixel position, the pixel values of these 8x8 light-colored square pixel areas need to be interpolated. , which also contains dark pixel locations.

在傳統的平移的預測中,當前塊的每個像素位置的MV是相同的。如果進一步地引入子塊的概念,子塊的大小如4x4,8x8等。圖4為子塊插值的示意圖一,4x4的塊插值需要使用的像素區域如圖4所示。圖5為子塊插值的示意圖二,8x8的塊插值需要使用的像素區域如圖5所示。In traditional translational prediction, the MV of each pixel location of the current block is the same. If the concept of sub-block is further introduced, the size of the sub-block is 4x4, 8x8, etc. FIG. 4 is a schematic diagram 1 of sub-block interpolation. The pixel area that needs to be used for 4×4 block interpolation is shown in FIG. 4 . FIG. 5 is a schematic diagram 2 of sub-block interpolation. The pixel area that needs to be used for 8×8 block interpolation is shown in FIG. 5 .

如果一個子塊中的每個像素位置的MV是相同的。那麼一個子塊中的像素位置可以一起進行插值,從而分攤頻寬、使用同一個相位的濾波器以及共用插值過程的中間值。但是如果每一個像素點使用一個MV,那麼頻寬就會增加,而且可能會使用不同相位的濾波器以及不能共用插值過程的中間值。If the MV of each pixel location in a sub-block is the same. The pixel positions in a sub-block can then be interpolated together, sharing the bandwidth, using filters of the same phase, and sharing the intermediate values of the interpolation process. But if one MV is used per pixel, the bandwidth will increase, and filters of different phases may be used and intermediate values that cannot be shared in the interpolation process.

基於點的仿射預測代價很高,因此,為了兼顧性能和代價,在VVC和AVS3中的仿射預測是基於子塊來實現的。AVS3中的子塊大小有4x4和8x8兩種大小,VVC中使用4x4的子塊大小。每一個子塊有一個MV,子塊內部的像素位置共用同一個MV。從而對子塊內部的所有像素位置統一做插值。透過上述方法,基於子塊的仿射預測與其他基於子塊的預測方法的運動補償複雜度相近。Point-based affine prediction is expensive. Therefore, in order to balance performance and cost, affine prediction in VVC and AVS3 is implemented based on sub-blocks. The sub-block size in AVS3 is 4x4 and 8x8, and the 4x4 sub-block size is used in VVC. Each sub-block has one MV, and the pixel positions within the sub-block share the same MV. In this way, all pixel positions inside the sub-block are uniformly interpolated. Through the above method, the motion compensation complexity of sub-block-based affine prediction is similar to that of other sub-block-based prediction methods.

可見,基於子塊的仿射預測方法中,子塊內部的像素位置共用同一個MV,其中,確定這個共用MV的方法是取當前子塊中心的MV。而對4x4、8x8等水平垂直方向上至少有一個是偶數個像素的子塊來說,其中心其實是落在非整數像素位置上的。目前的標準中都取一個整數像素的位置,例如,如對4x4子塊,取距離左上角位置為(2,2)的像素位置。對8x8子塊,取距離左上角位置為(4,4)的像素位置。It can be seen that in the sub-block-based affine prediction method, the pixel positions inside the sub-block share the same MV, and the method for determining this shared MV is to take the MV of the center of the current sub-block. For 4x4, 8x8 and other sub-blocks with at least one even number of pixels in the horizontal and vertical directions, the center of the sub-block actually falls on a non-integer pixel position. In the current standard, the position of an integer pixel is taken. For example, for a 4x4 sub-block, the position of the pixel from the upper left corner position is (2, 2). For an 8x8 subblock, take the pixel position (4, 4) from the upper left corner.

仿射預測模型可以根據當前塊所使用的控制點(2個控制點或3個控制點)匯出每一個像素位置的MV。在基於子塊的仿射預測中,根據上一段中像素位置計算出這個位置的MV,作為該子塊的MV。圖6為每個子塊的運動向量示意圖,如圖6所示,為了推導每個子塊的運動向量,每個子塊的中心採樣的運動向量如圖所示,取整到1/16精度,然後進行運動補償。The affine prediction model can export the MV for each pixel location based on the control points (2 control points or 3 control points) used by the current block. In sub-block-based affine prediction, the MV of this position is calculated according to the pixel position in the previous segment as the MV of the sub-block. Figure 6 is a schematic diagram of the motion vector of each sub-block. As shown in Figure 6, in order to derive the motion vector of each sub-block, the motion vector sampled by the center of each sub-block is as shown in the figure, rounded to 1/16 precision, and then motion compensation.

隨著技術的發展,一個叫做使用光流的預測改進技術PROF的方法被提出。這個技術可以在不增加頻寬的情況下,對基於塊的仿射預測的預測值進行改進。在基於子塊的仿射預測做完後,對每一個已完成基於子塊的仿射預測的像素點計算其水平方向和垂直方向的梯度。在VVC中PROF計算梯度時使用的是3抽頭的濾波器[-1,0,1],其計算方法和雙向光流(Bi-directional Optical flow,BDOF)的方法相同。之後,對每一個像素位置,計算其運動向量偏差,該運動向量偏差即為當前像素位置的運動向量與整個子塊使用MV的差值。這些運動向量偏差都可以根據仿射預測模型的公式計算得出。由於公式的特性,一些子塊的相同位置的運動向量偏差是相同的,對這些子塊,只需要計算出一組運動向量偏差,其他子塊可以直接複用這些值。對每一個像素位置,使用該點的水平像素垂直梯度及運動向量偏差(包括水平方向的偏差和垂直方向的偏差)計算出該像素位置的預測值的修正值,然後將原預測值,即基於子塊的仿射預測的預測值,加上預測值的修正值,便可以得到修正後的預測值。With the development of technology, a method called prediction improvement technique PROF using optical flow was proposed. This technique can improve the prediction value of block-based affine prediction without increasing bandwidth. After the sub-block-based affine prediction is completed, the gradients in the horizontal and vertical directions are calculated for each pixel for which the sub-block-based affine prediction has been completed. In VVC, PROF uses a 3-tap filter [-1, 0, 1] when calculating the gradient, and its calculation method is the same as that of Bi-directional Optical flow (BDOF). Then, for each pixel position, calculate its motion vector deviation, which is the difference between the motion vector of the current pixel position and the MV used for the entire sub-block. These motion vector deviations can be calculated according to the formula of the affine prediction model. Due to the characteristics of the formula, the motion vector deviations at the same position of some sub-blocks are the same. For these sub-blocks, only a set of motion vector deviations need to be calculated, and other sub-blocks can directly reuse these values. For each pixel position, use the horizontal pixel vertical gradient of the point and the motion vector deviation (including the deviation in the horizontal direction and the deviation in the vertical direction) to calculate the corrected value of the predicted value of the pixel position, and then use the original predicted value, that is, based on The predicted value of the affine prediction of the sub-block is added to the modified value of the predicted value to obtain the modified predicted value.

計算水平垂直方向的梯度時,使用[-1,0,1]濾波器,也就是對當前像素位置,水平方向會使用到其左邊距離為1的像素位置和右邊距離為1的像素位置的預測值,垂直方向會使用到其上邊距離為1的像素位置和下邊距離為1的像素位置的預測值。如果當前像素位置是當前塊的邊界位置,那麼上述的幾個像素位置中有的會超過當前塊的邊界一個像素距離。使用當前塊的邊界的預測值向外填充一個像素距離的位置以滿足梯度計算,從而不需要額外地增加上述超過當前塊的邊界一個像素距離的預測值。由於梯度計算只需要使用基於子塊的仿射預測的預測值,所以不需要增加額外的頻寬。When calculating the gradient in the horizontal and vertical directions, the [-1, 0, 1] filter is used, that is, for the current pixel position, the horizontal direction will use the prediction of the pixel position with a distance of 1 on the left and a pixel position with a distance of 1 on the right. value, the vertical direction will use the predicted value to the pixel position with a distance of 1 above and a pixel position with a distance of 1 below. If the current pixel position is the boundary position of the current block, some of the above-mentioned pixel positions will exceed the boundary position of the current block by a distance of one pixel. The predicted value of the boundary of the current block is used to fill the position of one pixel distance outward to satisfy the gradient calculation, so that there is no need to additionally increase the predicted value of one pixel distance beyond the boundary of the current block. Since the gradient calculation only needs to use the predicted value of the sub-block-based affine prediction, no additional bandwidth needs to be added.

在VVC標準文本中,對根據控制點的MV匯出當前塊的各個子塊的MV以及子塊內的各像素位置的運動向量偏差。VVC中每個子塊使用的作為子塊MV的像素位置都相同,所以只需要匯出一組子塊的運動向量偏差,其他子塊可以複用該子塊。進一步地,在VVC標準文本中,對PROF流程的描述,PROF對運動向量偏差的計算包含在上面的流程中。In the VVC standard text, the MV of each sub-block of the current block and the motion vector deviation of each pixel position in the sub-block are derived from the MV of the control point. Each sub-block in VVC uses the same pixel position as the sub-block MV, so it is only necessary to export the motion vector deviation of a group of sub-blocks, and other sub-blocks can reuse the sub-block. Further, in the VVC standard text, the description of the PROF process, the calculation of the motion vector deviation by PROF is included in the above process.

AVS3的仿射預測在計算子塊的MV時,和VVC的基本原理相同,但AVS3對當前塊的左上角子塊A,右上角子塊B和左下角子塊C有特殊的處理。AVS3's affine prediction has the same basic principle as VVC when calculating the MV of a sub-block, but AVS3 has special processing for the upper-left sub-block A, upper-right sub-block B and lower-left sub-block C of the current block.

下面是AVS3標準文本對仿射運動單元子塊運動向量陣列的匯出的描述:The following is the AVS3 standard text description of the export of affine motion unit subblock motion vector arrays:

如果仿射控制點運動向量組中有3個運動向量,那麼運動向量組可以表示為mvsAffine(mv0,mv1,mv2);如果仿射控制點運動向量組中有2個運動向量,那麼運動向量組可以表示為mvsAffine(mv0,mv1)。接著,可以按照以下步驟匯出仿射運動單元子塊運動向量陣列:If there are 3 motion vectors in the affine control point motion vector group, then the motion vector group can be expressed as mvsAffine(mv0, mv1, mv2); if there are 2 motion vectors in the affine control point motion vector group, then the motion vector group Can be represented as mvsAffine(mv0, mv1). Then, the affine motion unit subblock motion vector array can be exported according to the following steps:

1、計算變數dHorX、dVerX、dHorY和dVerY:1. Calculate the variables dHorX, dVerX, dHorY and dVerY:

dHorX=(mv1_x-mv0_x)<<(7-Log(width));dHorX=(mv1_x-mv0_x)<<(7-Log(width));

dHorY=(mv1_y-mv0_y)<<(7-Log(width));dHorY=(mv1_y-mv0_y)<<(7-Log(width));

若運動向量組為mvsAffine(mv0,mv1,mv2),則:If the motion vector group is mvsAffine(mv0, mv1, mv2), then:

dVerX=(mv2_x-mv0_x)<<(7-Log(height));dVerX=(mv2_x-mv0_x)<<(7-Log(height));

dVerY=(mv2_y-mv0_y)<<(7-Log(height));dVerY=(mv2_y-mv0_y)<<(7-Log(height));

若運動向量組為mvsAffine(mv0,mv1),則:If the motion vector group is mvsAffine(mv0, mv1), then:

dVerX=−dHorY;dVerX=−dHorY;

dVerY=dHorX;dVerY=dHorX;

需要說明的是,圖7為樣本位置示意圖,如圖7所示,(xE,yE)是當前預測單元亮度預測塊左上角樣本在當前圖像的亮度樣本矩陣中的位置,當前預測單元的寬度和高度分別是width和height,每個子塊的寬度和高度分別是subwidth和subheight,當前預測單元亮度預測塊的左上角樣本所在的子塊為A,右上角樣本所在的子塊為B,左下角樣本所在的子塊為C。It should be noted that Figure 7 is a schematic diagram of the sample position. As shown in Figure 7, (xE, yE) is the position of the upper left sample of the luminance prediction block of the current prediction unit in the luminance sample matrix of the current image, and the width of the current prediction unit and height are width and height respectively, the width and height of each sub-block are subwidth and subheight respectively, the sub-block where the upper-left corner sample of the luminance prediction block of the current prediction unit is located is A, the sub-block where the upper-right sample is located is B, and the lower-left corner is located. The subblock where the sample is located is C.

2.1、如果當前預測單元的預測參考模式是‘Pred_List01’或AffineSubblockSizeFlag等於1(AffineSubblockSizeFlag用於指示子塊尺寸的大小),則subwidth和subheight均等於8,(x,y)是尺寸為8x8的子塊左上角位置的座標,則可以計算每個8x8亮度子塊的運動向量mvE(mvE_x,mvE_y):2.1. If the prediction reference mode of the current prediction unit is 'Pred_List01' or AffineSubblockSizeFlag is equal to 1 (AffineSubblockSizeFlag is used to indicate the size of the subblock size), then subwidth and subheight are both equal to 8, (x, y) is a subblock of size 8x8 The coordinates of the upper left corner position, then the motion vector mvE (mvE_x, mvE_y) of each 8x8 luminance sub-block can be calculated:

如果子塊是A,則xPos和yPos均等於0;If the subblock is A, both xPos and yPos are equal to 0;

如果子塊是B,則xPos等於width,yPos等於0;If the subblock is B, then xPos is equal to width and yPos is equal to 0;

如果子塊為C且mvsAffine中有3個運動向量,則xPos等於0,yPos等於height;If the sub-block is C and there are 3 motion vectors in mvsAffine, then xPos is equal to 0 and yPos is equal to height;

否則,xPos等於(x-xE)+4,yPos等於(y-yE)+4;Otherwise, xPos is equal to (x-xE)+4, and yPos is equal to (y-yE)+4;

因此,當前8x8子塊的運動向量mvE為:Therefore, the motion vector mvE of the current 8x8 subblock is:

mvE_x=Clip3(-131072,131071,Rounding((mv0_x<<7)+dHorX×xPos+dVerX×yPos,7));mvE_x=Clip3(-131072,131071,Rounding((mv0_x<<7)+dHorX×xPos+dVerX×yPos,7));

mvE_y=Clip3(-131072,131071,Rounding((mv0_y<<7)+dHorY×xPos+dVerY×yPos,7));mvE_y=Clip3(-131072,131071,Rounding((mv0_y<<7)+dHorY×xPos+dVerY×yPos,7));

2.2、如果當前預測單元的預測參考模式是‘Pred_List0’或‘Pred_List1’,且AffineSubblockSizeFlag等於0,則subwidth和subheight均等於4,(x,y)是尺寸為4x4的子塊左上角位置的座標,計算每個4x4亮度子塊的運動向量mvE(mvE_x,mvE_y):2.2. If the prediction reference mode of the current prediction unit is 'Pred_List0' or 'Pred_List1', and AffineSubblockSizeFlag is equal to 0, then both subwidth and subheight are equal to 4, (x, y) is the coordinate of the upper left corner of the subblock with size 4x4, Compute the motion vector mvE(mvE_x, mvE_y) for each 4x4 luma subblock:

如果子塊是A,則xPos和yPos均等於0;If the subblock is A, both xPos and yPos are equal to 0;

如果子塊是B,則xPos等於width,yPos等於0;If the subblock is B, then xPos is equal to width and yPos is equal to 0;

如果子塊是C且mvAffine中有3個運動向量,則xPos等於0,yPos等height;If the sub-block is C and there are 3 motion vectors in mvAffine, xPos is equal to 0, yPos, etc. height;

否則,xPos等於(x-xE)+2,yPos等於(y-yE)+2;Otherwise, xPos is equal to (x-xE)+2, and yPos is equal to (y-yE)+2;

因此,當前4x4子塊的運動向量mvE為:Therefore, the motion vector mvE of the current 4x4 subblock is:

mvE_x=Clip3(-131072,131071,Rounding((mv0_x<<7)+dHorX×xPos+dVerX×yPos,7));mvE_x=Clip3(-131072,131071,Rounding((mv0_x<<7)+dHorX×xPos+dVerX×yPos,7));

mvE_y=Clip3(-131072,131071,Rounding((mv0_y<<7)+dHorY×xPos+dVerY×yPos,7))。mvE_y=Clip3(-131072,131071,Rounding((mv0_y<<7)+dHorY×xPos+dVerY×yPos,7)).

下面是AVS3文本對於仿射預測樣本匯出及亮度、色度樣本插值的描述:The following is the description of the AVS3 text for the export of affine prediction samples and the interpolation of luma and chroma samples:

如果當前預測單元亮度預測塊左上角樣本在當前圖像的亮度樣本矩陣中的位置為(xE,yE)。If the position of the upper left sample of the luma prediction block of the current prediction unit is (xE, yE) in the luma sample matrix of the current image.

如果當前預測單元的預測參考模式是‘PRED_List0’且AffineSubblockSizeFlag的值為0,mv0E0是MvArrayL0運動向量集合在(xE+x,yE+y)位置的、4x4單元的LO運動向量。亮度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值,是參考圖像佇列0中參考索引為RefIdxL0的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E0_x,(yE+y)<<4)+mv0E0_y)))的樣本值,色度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值,是參考圖像佇列0中參考索引為RefIdxL0的1/32精度色度樣本矩陣中位置為(((xE+2x)<<4)+MvC_x,(yE+2y)<<4)+MvC_y)))的樣本值。其中,x1=((xE+2x)>>3)<<3,y1=((yE+2y)>>3)<<3,mv1E0是MvArrayL0運動向量集合在(x1,y1)位置的4x4單元的LO運動向量,mv2E0是MvArrayL0運動向量集合在(x1+4,y1)位置的4x4單元的LO運動向量,mv3E0是MvArrayL0運動向量集合在(x1,y1+4)位置的4x4單元的LO運動向量,mv4E0是MvArrayL0運動向量集合在(x1+4,y1+4)位置的4x4單元的LO運動向量。If the prediction reference mode of the current prediction unit is 'PRED_List0' and the value of AffineSubblockSizeFlag is 0, mv0E0 is the LO motion vector of the 4x4 unit with the MvArrayL0 motion vector set at (xE+x, yE+y) position. The value of the element predMatrixL0[x][y] in the luma prediction sample matrix predMatrixL0 is the position in the 1/16-precision luma sample matrix with the reference index RefIdxL0 in the reference image queue 0 (((xE+x)<< 4) The sample value of +mv0E0_x, (yE+y)<<4)+mv0E0_y))), the value of the element predMatrixL0[x][y] in the chrominance prediction sample matrix predMatrixL0, which is in the reference image queue 0 The reference index is the sample value at position (((xE+2x)<<4)+MvC_x, (yE+2y)<<4)+MvC_y))) in the 1/32-precision chroma sample matrix of RefIdxL0. Among them, x1=((xE+2x)>>3)<<3, y1=((yE+2y)>>3)<<3, mv1E0 is the 4x4 unit of MvArrayL0 motion vector set at (x1, y1) position The LO motion vector of the , mv4E0 is the LO motion vector of the 4x4 unit of the MvArrayL0 motion vector set at the (x1+4, y1+4) position.

MvC_x=(mv1E0_x+mv2E0_x+mv3E0_x+mv4E0_x+2)>>2MvC_x=(mv1E0_x+mv2E0_x+mv3E0_x+mv4E0_x+2)>>2

MvC_y=(mv1E0_y+mv2E0_y+mv3E0_y+mv4E0_y+2)>>2MvC_y=(mv1E0_y+mv2E0_y+mv3E0_y+mv4E0_y+2)>>2

如果當前預測單元的預測參考模式是‘PRED_List0’且AffineSubblockSizeFlag的值為1,mv0E0是MvArrayL0運動向量集合在(xE+x,yE+y)位置的、8x8單元的LO運動向量。亮度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值,是參考圖像佇列0中參考索引為RefIdxL0的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E0_x,(yE+y)<<4)+mv0E0_y)))的樣本值,色度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/32精度色度樣本矩陣中位置為(((xE+2x)<<4)+MvC_x,(yE+2y)<<4)+MvC_y)))的樣本值。其中,MvC_x等於mv0E0_x,MvC_y等於mv0E0。If the prediction reference mode of the current prediction unit is 'PRED_List0' and the value of AffineSubblockSizeFlag is 1, mv0E0 is the LO motion vector of the 8x8 unit with the MvArrayL0 motion vector set at (xE+x, yE+y) position. The value of the element predMatrixL0[x][y] in the luma prediction sample matrix predMatrixL0 is the position in the 1/16-precision luma sample matrix with the reference index RefIdxL0 in the reference image queue 0 (((xE+x)<< 4) The sample value of +mv0E0_x, (yE+y)<<4)+mv0E0_y))), the value of the element predMatrixL0[x][y] in the chroma prediction sample matrix predMatrixL0 is the reference in the reference image queue 0 The sample value at position (((xE+2x)<<4)+MvC_x, (yE+2y)<<4)+MvC_y))) in the 1/32-precision chroma sample matrix with index RefIdxL0. Among them, MvC_x is equal to mv0E0_x, and MvC_y is equal to mv0E0.

如果當前預測單元的預測參考模式是‘PRED_List1’且AffineSubblockSizeFlag的值為0,mv0E1是MvArrayL1運動向量集合在(xE+x,yE+y)位置的、4x4單元的L1運動向量。亮度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值,是參考圖像佇列1中參考索引為RefIdxL1的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E1_x,(yE+y)<<4)+mv0E1_y)))的樣本值,色度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/32精度色度樣本矩陣中位置為(((xE+2x)<<4)+MvC_x,(yE+2y)<<4)+MvC_y)))的樣本值。其中,x1=((xE+2x)>>3)<<3,y1=((yE+2y)>>3)<<3,mv1E1是MvArrayL1運動向量集合在(x1,y1)位置的4x4單元的L1運動向量,mv2E1是MvArrayL1運動向量集合在(x1+4,y1)位置的4x4單元的L1運動向量,mv3E1是MvArrayL1運動向量集合在(x1,y1+4)位置的4x4單元的L1運動向量,mv4E1是MvArrayL1運動向量集合在(x1+4,y1+4)位置的4x4單元的L1運動向量。If the prediction reference mode of the current prediction unit is 'PRED_List1' and the value of AffineSubblockSizeFlag is 0, mv0E1 is the L1 motion vector of the 4x4 unit with the MvArrayL1 motion vector set at (xE+x, yE+y) position. The value of the element predMatrixL1[x][y] in the luma prediction sample matrix predMatrixL1 is the position in the 1/16-precision luma sample matrix whose reference index is RefIdxL1 in the reference image queue 1 is (((xE+x)<< 4) The sample value of +mv0E1_x, (yE+y)<<4)+mv0E1_y))), the value of the element predMatrixL1[x][y] in the chroma prediction sample matrix predMatrixL1 is the reference in the reference image queue 1 The index is the sample value at position (((xE+2x)<<4)+MvC_x, (yE+2y)<<4)+MvC_y))) in the 1/32-precision chroma sample matrix of RefIdxL1. Among them, x1=((xE+2x)>>3)<<3, y1=((yE+2y)>>3)<<3, mv1E1 is the 4x4 unit of MvArrayL1 motion vector set at (x1, y1) position , mv2E1 is the L1 motion vector of the 4x4 unit of the MvArrayL1 motion vector set at the (x1+4, y1) position, mv3E1 is the MvArrayL1 motion vector set at the (x1, y1+4) position of the 4x4 unit L1 motion vector of the unit , mv4E1 is the L1 motion vector of the 4x4 unit of the MvArrayL1 motion vector set at the (x1+4, y1+4) position.

MvC_x=(mv1E1_x+mv2E1_x+mv3E1_x+mv4E1_x+2)>>2MvC_x=(mv1E1_x+mv2E1_x+mv3E1_x+mv4E1_x+2)>>2

MvC_y=(mv1E1_y+mv2E1_y+mv3E1_y+mv4E1_y+2)>>2MvC_y=(mv1E1_y+mv2E1_y+mv3E1_y+mv4E1_y+2)>>2

如果當前預測單元的預測參考模式是‘PRED_List1’且AffineSubblockSizeFlag的值為1,mv0E1是MvArrayL1運動向量集合在(xE+x,yE+y)位置的、8x8單元的L1運動向量。亮度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值,是參考圖像佇列1中參考索引為RefIdxL1的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E1_x,(yE+y)<<4)+mv0E1_y)))的樣本值,色度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/32精度色度樣本矩陣中位置為(((xE+2x)<<4)+MvC_x,(yE+2y)<<4)+MvC_y)))的樣本值。其中MvC_x等於mv0E1_x,MvC_y等於mv0E1。If the prediction reference mode of the current prediction unit is 'PRED_List1' and the value of AffineSubblockSizeFlag is 1, mv0E1 is the L1 motion vector of the 8x8 unit with the MvArrayL1 motion vector set at (xE+x, yE+y) position. The value of the element predMatrixL1[x][y] in the luma prediction sample matrix predMatrixL1 is the position in the 1/16-precision luma sample matrix whose reference index is RefIdxL1 in the reference image queue 1 is (((xE+x)<< 4) The sample value of +mv0E1_x, (yE+y)<<4)+mv0E1_y))), the value of the element predMatrixL1[x][y] in the chroma prediction sample matrix predMatrixL1 is the reference in the reference image queue 1 The index is the sample value at position (((xE+2x)<<4)+MvC_x, (yE+2y)<<4)+MvC_y))) in the 1/32-precision chroma sample matrix of RefIdxL1. where MvC_x is equal to mv0E1_x and MvC_y is equal to mv0E1.

如果當前預測單元的預測模式是‘PRED_List01’,mv0E0是MvArrayL0運動向量集合在(xE+x,yE+y)位置的8x8單元的L0運動向量,mv0E1是MvArrayL1運動向量集合在(x,y)位置的、8x8單元的L1運動向量。亮度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E0_x,(yE+y)<<4)+mv0E0_y)))的樣本值,色度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/32精度色度樣本矩陣中位置為(((xE+2x)<<4)+MvC0_x,(yE+2y)<<4)+MvC0_y)))的樣本值,亮度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/16精度亮度樣本矩陣中位置為((((xE+x)<<4)+mv0E1_x,(yE+y)<<4)+mv0E1_y))))的樣本值,色度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/32精度色度樣本矩陣中位置為(((xE+2x)<<4)+MvC1_x,(yE+2y)<<4)+MvC1_y)))的樣本值。其中MvC0_x等於mv0E0_x,MvC0_y等於mv0E0_y,MvC1_x等於mv0E1_x,MvC1_y等於mv0E1_y。If the prediction mode of the current prediction unit is 'PRED_List01', mv0E0 is the L0 motion vector of the 8x8 unit with the MvArrayL0 motion vector set at the (xE+x, yE+y) position, and mv0E1 is the MvArrayL1 motion vector set at the (x, y) position , an L1 motion vector of 8x8 cells. The value of the element predMatrixL0[x][y] in the luma prediction sample matrix predMatrixL0 is the position in the 1/16-precision luma sample matrix with the reference index RefIdxL0 in the reference image queue 0 (((xE+x)<<4 )+mv0E0_x, (yE+y)<<4)+mv0E0_y))), the value of the element predMatrixL0[x][y] in the chroma prediction sample matrix predMatrixL0 is the reference index in the reference image queue 0 It is the sample value whose position is (((xE+2x)<<4)+MvC0_x, (yE+2y)<<4)+MvC0_y))) in the 1/32 precision chroma sample matrix of RefIdxL0, and the luminance prediction sample matrix The value of the element predMatrixL1[x][y] in predMatrixL1 is the position in the 1/16-precision luminance sample matrix whose reference index is RefIdxL1 in the reference image queue 1 is ((((xE+x)<<4)+mv0E1_x , (yE+y)<<4)+mv0E1_y)))), the value of the element predMatrixL1[x][y] in the chroma prediction sample matrix predMatrixL1 is the reference index in the reference image queue 1 RefIdxL1 The sample value at position (((xE+2x)<<4)+MvC1_x,(yE+2y)<<4)+MvC1_y))) in the 1/32 precision chroma sample matrix of . Where MvC0_x is equal to mv0E0_x, MvC0_y is equal to mv0E0_y, MvC1_x is equal to mv0E1_x, and MvC1_y is equal to mv0E1_y.

其中,參考圖像的亮度1/16精度樣本矩陣和色度1/32精度樣本矩陣中各個位置的元素值透過如下的仿射亮度樣本插值過程和仿射色度樣本插值過程所定義的插值方法得到。參考圖像外的整數樣本應使用該圖像內距離該樣本最近的整數樣本(邊緣或角樣本)代替,即運動向量能指向參考圖像外的樣本。Among them, the element values of each position in the luminance 1/16 precision sample matrix and the chrominance 1/32 precision sample matrix of the reference image pass through the interpolation method defined by the following affine luminance sample interpolation process and affine chrominance sample interpolation process get. Integer samples outside the reference image should be replaced by the nearest integer samples (edge or corner samples) within the image to the sample, i.e. the motion vector can point to samples outside the reference image.

具體地,仿射亮度樣本插值過程如下:Specifically, the affine luminance sample interpolation process is as follows:

A,B,C,D是相鄰整像素樣本,dx與dy是整像素樣本A周邊分像素樣本a(dx,dy)與A的水平和垂直距離,dx等於fx&15,dy等於fy&15,其中(fx,fy)是該分像素樣本在1/16精度的亮度樣本矩陣中的座標。整像素Ax,y的周邊有的255個分像素樣本ax,y(dx,dy)。A, B, C, D are adjacent integer pixel samples, dx and dy are the horizontal and vertical distances between sub-pixel samples a(dx, dy) and A around integer pixel sample A, dx is equal to fx&15, dy is equal to fy&15, where ( fx, fy) are the coordinates of the sub-pixel sample in the 1/16-precision luminance sample matrix. There are 255 sub-pixel samples ax, y (dx, dy) around the integer pixel Ax, y.

具體地,樣本位置ax,0(x=1~15)由水平方向上距離插值點最近得8個整數值濾波得到,預測值的獲取方式如下:Specifically, the sample position ax, 0 (x=1~15) is obtained by filtering the 8 integer values closest to the interpolation point in the horizontal direction, and the predicted value is obtained as follows:

ax,0=Clip1((fL[x][0]×A−3,0+fL[x][1]×A−2,0+fL[x][2]×A−1,0+fL[x][3]×A0,0+fL[x][4]×A1,0+fL[x][5]×A2,0+fL[x][6]×A3,0+fL[x][7]×A4,0+32)>>6)。ax,0=Clip1((fL[x][0]×A−3,0+fL[x][1]×A−2,0+fL[x][2]×A−1,0+fL [x][3]×A0, 0+fL[x][4]×A1, 0+fL[x][5]×A2, 0+fL[x][6]×A3, 0+fL[x ][7]×A4, 0+32) >> 6).

具體地,樣本位置a0,y(y=1~15)由垂直方向上距離插值點最近得8個整數值濾波得到,預測值的獲取方式如下:Specifically, the sample positions a0, y (y=1~15) are obtained by filtering the 8 integer values closest to the interpolation point in the vertical direction, and the predicted values are obtained as follows:

a0,y=Clip1((fL[y][0]×A0,−3+fL[y][1]×A−2,0+fL[y][2]×A−1,0+fL[y][3]×A0,0+fL[y][4]×A1,0+fL[y][5]×A2,0+fL[y][6]×A3,0+fL[y][7]×A−4,0+32)>>6)。a0,y=Clip1((fL[y][0]×A0,−3+fL[y][1]×A−2,0+fL[y][2]×A−1,0+fL[ y][3]×A0, 0+fL[y][4]×A1, 0+fL[y][5]×A2, 0+fL[y][6]×A3, 0+fL[y] [7]×A−4, 0+32) >> 6).

具體地,樣本位置ax,y(x=1~15,y=1~15)的預測值的獲取方式如下:Specifically, the acquisition method of the predicted value of the sample position ax, y (x=1~15, y=1~15) is as follows:

ax,y=Clip1((fL[y][0]×a'x,y-3+fL[y][1]×a'x,y-2+fL[y][2]×a'x,y-1+fL[y][3]×a'x,y+fL[y][4]×a'x,y+1+fL[y][5]×a'x,y+2+fL[y][6]×a'x,y+3+fL[y][7]×a'x,y+4+(1<<(19-BitDepth)))>>(20-BitDepth))。ax,y=Clip1((fL[y][0]×a'x,y-3+fL[y][1]×a'x,y-2+fL[y][2]×a'x , y-1+fL[y][3]×a'x, y+fL[y][4]×a'x, y+1+fL[y][5]×a'x, y+2 +fL[y][6]×a'x,y+3+fL[y][7]×a'x,y+4+(1<<(19-BitDepth)))>>(20-BitDepth) )).

其中:in:

a'x,y=(fL[x][0]×A−3,y+fL[x][1]×A−2,y+fL[x][2]×A−1,y+fL[x][3]×A0,y+fL[x][4]×A1,y+fL[x][5]×A2,y+fL[x][6]×A3,y+fL[x][7]×A4,y+((1<<(BitDepth-8))>>1))>>(BitDepth-8)。a'x,y=(fL[x][0]×A−3,y+fL[x][1]×A−2,y+fL[x][2]×A−1,y+fL [x][3]×A0, y+fL[x][4]×A1, y+fL[x][5]×A2, y+fL[x][6]×A3, y+fL[x ][7]×A4,y+((1<<(BitDepth-8))>>1))>>(BitDepth-8).

亮度插值濾波器係數如表1所示:The luminance interpolation filter coefficients are shown in Table 1:

表1 分像素點位置 亮度插值濾波器係數 fL[p][0] fL[p][1] fL[p][2] fL[p][3] fL[p][4] fL[p][5] fL[p][6] fL[p][7] 1 0 1 −3 63 4 −2 1 0 2 −1 2 −5 62 8 −3 1 0 3 −1 3 −8 60 13 −4 1 0 4 −1 4 −10 58 17 −5 1 0 5 −1 4 −11 52 26 −8 3 −1 6 −1 3 −9 47 31 −10 4 −1 7 −1 4 −11 45 34 −10 4 −1 8 −1 4 −11 40 40 −11 4 −1 9 −1 4 −10 34 45 −11 4 −1 10 −1 4 −10 31 47 −9 3 −1 11 −1 3 −8 26 52 −11 4 −1 12 0 1 −5 17 58 −10 4 −1 13 0 1 −4 13 60 −8 3 −1 14 0 1 −3 8 62 −5 2 −1 15 0 1 −2 4 63 −3 1 0 Table 1 sub-pixel position Luminance interpolation filter coefficients fL[p][0] fL[p][1] fL[p][2] fL[p][3] fL[p][4] fL[p][5] fL[p][6] fL[p][7] 1 0 1 −3 63 4 −2 1 0 2 −1 2 −5 62 8 −3 1 0 3 −1 3 −8 60 13 −4 1 0 4 −1 4 −10 58 17 −5 1 0 5 −1 4 −11 52 26 −8 3 −1 6 −1 3 −9 47 31 −10 4 −1 7 −1 4 −11 45 34 −10 4 −1 8 −1 4 −11 40 40 −11 4 −1 9 −1 4 −10 34 45 −11 4 −1 10 −1 4 −10 31 47 −9 3 −1 11 −1 3 −8 26 52 −11 4 −1 12 0 1 −5 17 58 −10 4 −1 13 0 1 −4 13 60 −8 3 −1 14 0 1 −3 8 62 −5 2 −1 15 0 1 −2 4 63 −3 1 0

具體地,仿射色度樣本插值過程如下:Specifically, the affine chroma sample interpolation process is as follows:

A,B,C,D是相鄰整像素樣本,dx與dy是整像素樣本A周邊分像素樣本a(dx,dy)與A的水平和垂直距離,dx等於fx& 31,dy等於fy& 31,其中(fx,fy)是該分像素樣本在1/32精度的色度樣本矩陣中的座標。整像素Ax,y的周邊有1023個分像素樣本ax,y(dx,dy)。A, B, C, D are adjacent integer pixel samples, dx and dy are the horizontal and vertical distances between the sub-pixel samples a(dx, dy) and A around the integer pixel sample A, dx is equal to fx&31, dy is equal to fy&31, where (fx, fy) are the coordinates of the sub-pixel sample in the 1/32-precision chroma sample matrix. There are 1023 sub-pixel samples ax,y(dx,dy) around the whole pixel Ax,y.

具體地,對於dx等於0或dy等於0的分像素點,可直接用色度整像素插值得到,對於dx不等於0且dy不等於0的點,使用整像素行(dy等於0)上的分像素進行計算: if(dx==0){ ax,y(0,dy)=Clip3(0,(1<<BitDepth)-1,(fC[dy][0]×Ax,y-1+fC[dy][1]×Ax,y+fC[dy][2]×Ax,y+1+fC[dy][3]×Ax,y+2+32)>>6) } else if(dy==0){ ax,y(dx,0)=Clip3(0,(1<<BitDepth)-1,(fC[dx][0]×Ax-1,y+fC[dx][1]×Ax,y+fC[dx][2]×Ax+1,y+fC[dx][3]×Ax+2,y+32)>>6) } else{ ax,y(dx,dy)=Clip3(0,(1<<BitDepth)-1,(C[dy][0]×a'x,y-1(dx,0)+C[dy][1]×a'x,y(dx,0)+C[dy][2]×a'x,y+1(dx,0)+C[dy][3]×a'x,y+2(dx,0)+(1<<(19-BitDepth)))>>(20-BitDepth)) }Specifically, for the sub-pixel points where dx is equal to 0 or dy is equal to 0, it can be directly obtained by chrominance integer pixel interpolation. Calculate by pixel: if(dx==0){ ax,y(0,dy)=Clip3(0,(1<<BitDepth)-1,(fC[dy][0]×Ax,y-1+fC[dy][1]×Ax,y+fC [dy][2]×Ax,y+1+fC[dy][3]×Ax,y+2+32)>>6) } else if(dy==0){ ax,y(dx,0)=Clip3(0,(1<<BitDepth)-1,(fC[dx][0]×Ax-1,y+fC[dx][1]×Ax,y+fC [dx][2]×Ax+1, y+fC[dx][3]×Ax+2, y+32) >> 6) } else{ ax,y(dx,dy)=Clip3(0,(1<<BitDepth)-1,(C[dy][0]×a'x,y-1(dx,0)+C[dy][1 ]×a'x,y(dx,0)+C[dy][2]×a'x,y+1(dx,0)+C[dy][3]×a'x,y+2( dx, 0)+(1<<(19-BitDepth)))>>(20-BitDepth)) }

其中,a'x,y(dx,0)是整像素行上的分像素的臨時值,定義為:a'x,y(dx,0)=(fC[dx][0]×Ax-1,y+fC[dx][1]×Ax,y+fC[dx][2]×Ax+1,y+fC[dx][3]×Ax+2,y+((1<<(BitDepth-8))>>1))>>(BitDepth-8)。where a'x,y(dx,0) is the temporary value of the sub-pixel on the whole pixel row, defined as: a'x,y(dx,0)=(fC[dx][0]×Ax-1 , y+fC[dx][1]×Ax, y+fC[dx][2]×Ax+1, y+fC[dx][3]×Ax+2, y+((1<<(BitDepth- 8))>>1))>>(BitDepth-8).

色度插值濾波器係數如表2所示:The chroma interpolation filter coefficients are shown in Table 2:

表2 分像素位置 插值濾波器係數 fC[p][0] fC[p][1] fC[p][2] fC[p][3] 1 −1 63 2 0 2 −2 62 4 0 3 -2 60 7 −1 4 −2 58 10 −2 5 −3 57 12 −2 6 −4 56 14 −2 7 −4 55 15 −2 8 −4 54 16 −2 9 −5 53 18 −2 10 −6 52 20 −2 11 −6 49 24 −3 12 −6 46 28 −4 13 −5 44 29 −4 14 −4 42 30 −4 15 −4 39 33 −4 16 −4 36 36 −4 17 −4 33 39 −4 18 −4 30 42 −4 19 −4 29 44 −5 20 −4 28 46 −6 21 −3 24 49 −6 22 −2 20 52 −6 23 −2 18 53 −5 24 −2 16 54 −4 25 −2 15 55 −4 26 −2 14 56 −4 27 −2 12 57 −3 28 −2 10 58 −2 29 −1 7 60 −2 30 0 4 62 −2 31 0 2 63 −1 Table 2 sub-pixel position Interpolation filter coefficients fC[p][0] fC[p][1] fC[p][2] fC[p][3] 1 −1 63 2 0 2 −2 62 4 0 3 -2 60 7 −1 4 −2 58 10 −2 5 −3 57 12 −2 6 −4 56 14 −2 7 −4 55 15 −2 8 −4 54 16 −2 9 −5 53 18 −2 10 −6 52 20 −2 11 −6 49 twenty four −3 12 −6 46 28 −4 13 −5 44 29 −4 14 −4 42 30 −4 15 −4 39 33 −4 16 −4 36 36 −4 17 −4 33 39 −4 18 −4 30 42 −4 19 −4 29 44 −5 20 −4 28 46 −6 twenty one −3 twenty four 49 −6 twenty two −2 20 52 −6 twenty three −2 18 53 −5 twenty four −2 16 54 −4 25 −2 15 55 −4 26 −2 14 56 −4 27 −2 12 57 −3 28 −2 10 58 −2 29 −1 7 60 −2 30 0 4 62 −2 31 0 2 63 −1

常見的仿射預測的方法可以包括以下步驟:Common affine prediction methods can include the following steps:

步驟101、確定控制點的運動向量。Step 101: Determine the motion vector of the control point.

步驟102、根據控制點的運動向量確定子塊的運動向量。Step 102: Determine the motion vector of the sub-block according to the motion vector of the control point.

步驟103、根據子塊的運動向量對子塊進行預測。Step 103: Predict the sub-block according to the motion vector of the sub-block.

目前,在透過PROF改進基於塊的仿射預測的預測值時,具體可以包括以下步驟:At present, when improving the predicted value of block-based affine prediction through PROF, the following steps can be specifically included:

步驟101、確定控制點的運動向量。Step 101: Determine the motion vector of the control point.

步驟102、根據控制點的運動向量確定子塊的運動向量。Step 102: Determine the motion vector of the sub-block according to the motion vector of the control point.

步驟103、根據子塊的運動向量對子塊進行預測。Step 103: Predict the sub-block according to the motion vector of the sub-block.

步驟104、根據控制點的運動向量與子塊的運動向量確定子塊內每個位置與子塊的運動向量偏差。Step 104: Determine the motion vector deviation between each position in the sub-block and the sub-block according to the motion vector of the control point and the motion vector of the sub-block.

步驟105、根據控制點的運動向量確定子塊的運動向量。Step 105: Determine the motion vector of the sub-block according to the motion vector of the control point.

步驟106、使用基於子塊的預測值匯出每一個位置計算水平和垂直方向的梯度。Step 106: Use the sub-block-based prediction value to export each position to calculate the gradients in the horizontal and vertical directions.

步驟107、利用光流原理,根據每一個位置的運動向量偏差和水平、垂直方向的梯度,計算每一個位置的預測值的偏差值。Step 107: Calculate the deviation value of the predicted value of each position according to the motion vector deviation of each position and the gradients in the horizontal and vertical directions by using the principle of optical flow.

步驟108、對每一個位置基於子塊的預測值加上預測值的偏差值,得到修正後的預測值。Step 108: Add the deviation value of the prediction value to the prediction value based on the sub-block for each position to obtain the revised prediction value.

目前,在透過PROF改進基於塊的仿射預測的預測值時,具體還可以包括以下步驟:At present, when improving the predicted value of block-based affine prediction through PROF, the following steps can be specifically included:

步驟101、確定控制點的運動向量。Step 101: Determine the motion vector of the control point.

步驟109、根據控制點的運動向量確定子塊的運動向量及子塊內每個位置與子塊的運動向量的偏差。Step 109: Determine the motion vector of the sub-block and the deviation between each position in the sub-block and the motion vector of the sub-block according to the motion vector of the control point.

步驟103、根據子塊的運動向量對子塊進行預測。Step 103: Predict the sub-block according to the motion vector of the sub-block.

步驟106、使用基於子塊的預測值匯出每一個位置計算水平和垂直方向的梯度。Step 106: Use the sub-block-based prediction value to export each position to calculate the gradients in the horizontal and vertical directions.

步驟107、利用光流原理,根據每一個位置的運動向量偏差和水平、垂直方向的梯度,計算每一個位置的預測值的偏差值。Step 107: Calculate the deviation value of the predicted value of each position according to the motion vector deviation of each position and the gradients in the horizontal and vertical directions by using the principle of optical flow.

步驟108、對每一個位置基於子塊的預測值加上預測值的偏差值,得到修正後的預測值。Step 108: Add the deviation value of the prediction value to the prediction value based on the sub-block for each position to obtain the revised prediction value.

PROF可以使用光流原理對基於子塊的仿射預測進行修正,提高了壓縮性能。然而,PROF的應用是基於子塊內的像素位置的運動向量與子塊運動向量的偏差非常小的情況,也就是說,子塊內的像素位置的運動向量與子塊運動向量的偏差非常小的情況下使用PROF的光流計算方法是有效的,但是,由於PROF依賴於基準位置的水平方向和垂直方向的梯度,在實際位置離基準位置較遠的情況下,基準位置的水平和垂直方向的梯度並不能真實的反映基準位置和實際位置之間的水平和垂直方向的梯度,因此,在子塊內的像素位置的運動向量與子塊運動向量的偏差較大的情況下,該方法就不是特別有效了。PROF can revise sub-block-based affine prediction using the principle of optical flow, which improves the compression performance. However, the application of PROF is based on the case where the motion vector of the pixel position within the sub-block has a very small deviation from the sub-block motion vector, that is, the deviation of the motion vector of the pixel position within the sub-block from the sub-block motion vector is very small. The optical flow calculation method using PROF is effective in the case of The gradient does not truly reflect the gradient in the horizontal and vertical directions between the reference position and the actual position. Therefore, when the motion vector of the pixel position in the sub-block has a large deviation from the motion vector of the sub-block, this method will Not particularly effective anymore.

此時,提出了二次預測的方法來克服PROF的缺陷。解碼器進行二次預測的方法可以包括以下步驟:At this time, the method of quadratic prediction is proposed to overcome the shortcomings of PROF. The decoder's method for secondary prediction may include the following steps:

步驟201、根據子塊的運動向量對子塊進行預測,獲得預測值。Step 201: Predict the sub-block according to the motion vector of the sub-block to obtain a predicted value.

步驟202、確定子塊內每一個位置與子塊的運動向量偏差。Step 202: Determine the motion vector deviation between each position in the sub-block and the sub-block.

步驟203、根據每一個位置的運動向量偏差,利用二維濾波器對預測值進行濾波,得到二次預測的預測值。Step 203: According to the motion vector deviation of each position, use a two-dimensional filter to filter the predicted value to obtain the predicted value of secondary prediction.

也就是說,二次預測方法可以在基於子塊的預測之後,對運動向量與子塊的運動向量有偏差的像素位置,在基於子塊的預測的基礎上進行基於點的二次預測,最終完成對預測值的修正,獲得新的預測值,即二次預測的預測值。That is to say, the secondary prediction method can perform point-based secondary prediction on the basis of the sub-block-based prediction for the pixel positions where the motion vector deviates from the motion vector of the sub-block after the sub-block-based prediction, and finally The correction of the predicted value is completed, and a new predicted value is obtained, that is, the predicted value of the secondary prediction.

具體地,基於點的二次預測使用二維濾波器。二維濾波器是相鄰的構成預設形狀的點的構成的濾波器。相鄰的構成預設形狀的點可以為9個點。對一個像素位置,濾波器處理的結果為該位置的二次預測的預測值。其中,二維濾波器的濾波係數由每一個位置的運動向量偏差確定,二維濾波器的輸入為預測值,輸出為二次預測的預測值。Specifically, point-based secondary prediction uses a two-dimensional filter. A two-dimensional filter is a filter composed of adjacent points forming a preset shape. Adjacent points constituting the preset shape can be 9 points. For a pixel location, the result of the filter processing is the predicted value of the secondary prediction for that location. Among them, the filter coefficient of the two-dimensional filter is determined by the motion vector deviation of each position, the input of the two-dimensional filter is the predicted value, and the output is the predicted value of the secondary prediction.

進一步地,在本申請中,如果本申請中對當前塊使用仿射模式,那麼需要先對控制點的運動向量進行確定。解碼器進行二次預測的方法可以包括以下步驟:Further, in this application, if the affine mode is used for the current block in this application, the motion vector of the control point needs to be determined first. The decoder's method for secondary prediction may include the following steps:

步驟204、確定控制點的運動向量。Step 204: Determine the motion vector of the control point.

步驟205、根據控制點的運動向量確定子塊的運動向量。Step 205: Determine the motion vector of the sub-block according to the motion vector of the control point.

步驟201、根據子塊的運動向量對子塊進行預測,獲得預測值。Step 201: Predict the sub-block according to the motion vector of the sub-block to obtain a predicted value.

步驟202、確定子塊內每一個位置與子塊的運動向量偏差。Step 202: Determine the motion vector deviation between each position in the sub-block and the sub-block.

步驟203、根據每一個位置的運動向量偏差,利用二維濾波器對預測值進行濾波,得到二次預測的預測值。Step 203: Use a two-dimensional filter to filter the predicted value according to the motion vector deviation of each position to obtain the predicted value of secondary prediction.

由此可見,在本申請的實施例中,在對控制點的運動向量進行確定之後,可以利用控制點的運動向量對子塊進行預測處理,並在確定出子塊中的像素位置與子塊的運動向量偏差之後,對運動向量與子塊的運動向量有偏差的像素位置,在基於子塊的預測的基礎上進行基於點的二次預測,最終完成對預測值的修正,獲得新的預測值,即二次預測的預測值。It can be seen that, in the embodiments of the present application, after the motion vector of the control point is determined, the motion vector of the control point can be used to perform prediction processing on the sub-block, and the pixel position in the sub-block and the sub-block can be determined after the pixel position in the sub-block is determined. After the motion vector deviation of the sub-block, the pixel position where the motion vector is deviated from the motion vector of the sub-block is subjected to the point-based secondary prediction based on the sub-block-based prediction, and finally the correction of the predicted value is completed, and a new prediction is obtained. value, which is the predicted value of the secondary prediction.

進一步地,在本申請中,也可以將確定子塊的運動向量和確定子塊內每個位置與子塊的運動向量偏差的兩個步驟同時進行。解碼器進行二次預測的方法可以包括以下步驟:Further, in the present application, the two steps of determining the motion vector of the sub-block and determining the deviation of each position in the sub-block from the motion vector of the sub-block may also be performed simultaneously. The decoder's method for secondary prediction may include the following steps:

步驟204、確定控制點的運動向量。Step 204: Determine the motion vector of the control point.

步驟206、根據控制點的運動向量確定子塊的運動向量,和子塊內每一個位置與子塊的運動向量偏差。Step 206: Determine the motion vector of the sub-block according to the motion vector of the control point, and the deviation of each position in the sub-block from the motion vector of the sub-block.

步驟201、根據子塊的運動向量對子塊進行預測,獲得預測值。Step 201: Predict the sub-block according to the motion vector of the sub-block to obtain a predicted value.

步驟203、根據每一個位置的運動向量偏差,利用二維濾波器對預測值進行濾波,得到二次預測的預測值。Step 203: Use a two-dimensional filter to filter the predicted value according to the motion vector deviation of each position to obtain the predicted value of secondary prediction.

由此可見,在本申請的實施例中,在對控制點的運動向量進行確定之後,可以同時進行子塊的運動向量和子塊內每一個位置與子塊的運動向量偏差的確定,然後對運動向量與子塊的運動向量有偏差的像素位置,在基於子塊的預測的基礎上進行基於點的二次預測,最終完成對預測值的修正,獲得新的預測值,即二次預測的預測值。It can be seen that in the embodiments of the present application, after the motion vector of the control point is determined, the motion vector of the sub-block and the deviation of each position in the sub-block from the motion vector of the sub-block can be determined at the same time, and then the motion vector of the sub-block can be determined. The pixel position where the vector is deviated from the motion vector of the sub-block, the point-based secondary prediction is performed on the basis of the sub-block-based prediction, and finally the correction of the prediction value is completed, and a new prediction value is obtained, that is, the prediction of the secondary prediction value.

需要說明的是,因為仿射模型可以明確地計算出每一個像素位置的運動向量,或者說子塊內每一個像素位置與子塊運動向量的偏差,因此,二次預測方法可以用於對仿射預測進行改善,當然,二次預測也可以應用於其他基於子塊的預測的改善。也就是說,本申請所提出的基於子塊的預測包括但不限於仿射基於子塊的預測。It should be noted that, because the affine model can explicitly calculate the motion vector of each pixel position, or the deviation between each pixel position in the sub-block and the motion vector of the sub-block, the secondary prediction method can be used for simulating Of course, secondary prediction can also be applied to improve other sub-block-based predictions. That is to say, the sub-block-based prediction proposed in this application includes, but is not limited to, affine sub-block-based prediction.

進一步地,二次預測方法可以以AVS3標準為基礎,也可以應用於VVC標準,本申請不作具體限定。Further, the secondary prediction method may be based on the AVS3 standard, and may also be applied to the VVC standard, which is not specifically limited in this application.

對於子塊中的每一個像素位置的像素,在進行二次預測或PROF處理時,預設的濾波器的中心點是基於子塊的預測的預測塊中與該像素位置相同的像素位置,假設運動向量偏差為0,那麼該像素位置的預測值就是基於子塊的預測的預測塊中與該像素位置相同的像素位置的值。一般情況下,上述方法可以應用於像素位置與子塊之間的運動向量偏差很小的條件。但是,對於像素位置與子塊之間的運動向量偏差不是很小的情況,例如在水平或垂直方向上,偏差超過半個像素或一定的比例時,二次預測或PROF處理獲得的預測效果可能會大大降低。For the pixel of each pixel position in the sub-block, when performing secondary prediction or PROF processing, the center point of the preset filter is the same pixel position as the pixel position in the prediction block based on the prediction of the sub-block. If the motion vector deviation is 0, then the predicted value of the pixel position is the value of the same pixel position as the pixel position in the predicted block based on the prediction of the sub-block. In general, the above method can be applied to the condition that the motion vector deviation between the pixel position and the sub-block is small. However, for the case where the motion vector deviation between the pixel position and the sub-block is not very small, such as in the horizontal or vertical direction, when the deviation exceeds half a pixel or a certain proportion, the prediction effect obtained by secondary prediction or PROF processing may be will be greatly reduced.

圖8為中心位置的示意圖一,如圖8所示,正方形表示基於子塊的預測的預測塊的像素位置,圓形表示待預測像素位置在基於子塊的預測的預測塊中的實際位置,其中,正方形1表示基於子塊的預測的預測塊中與該待預測像素位置相同的像素位置,即子塊的(1,1)位置。該正方形1即是預設的基於點的預測的基準位置,即濾波器的中心位置,其運動向量偏差記為(dmv_x0,dmv_y0)。Figure 8 is a schematic diagram of the center position. As shown in Figure 8, the square represents the pixel position of the prediction block based on the prediction of the sub-block, and the circle represents the actual position of the pixel position to be predicted in the prediction block based on the prediction of the sub-block, The square 1 represents the pixel position in the prediction block based on the prediction of the sub-block that is the same as the pixel position to be predicted, that is, the (1, 1) position of the sub-block. The square 1 is the preset reference position of point-based prediction, that is, the center position of the filter, and the motion vector deviation thereof is recorded as (dmv_x0, dmv_y0).

圖9為中心位置的示意圖二,如圖9所示,如果dmv_x0和dmv_y0都大於二分之一個像素,那麼在該子塊中,該正方形1與待預測像素位置之間存在較大的距離,如果以該正方形1作為濾波器的中心位置進行二次預測或PROF處理,最終獲得的預測結果會存在較大的誤差。Figure 9 is a schematic diagram of the center position. As shown in Figure 9, if both dmv_x0 and dmv_y0 are greater than one-half of a pixel, then in this sub-block, there is a large distance between the square 1 and the position of the pixel to be predicted , if the square 1 is used as the center position of the filter to perform secondary prediction or PROF processing, there will be a large error in the final prediction result.

由此可見,當二次預測或PROF需要使用的濾波器的中心位置如果存在較大的運動向量偏差時,可能會造成預測性能下降的問題,即現有的PROF修正預測值方法和二次預測方法其實並不嚴謹,在對仿射預測進行改善時,並不能很好的適用於全部場景,編碼性能有待提升。It can be seen that when there is a large motion vector deviation in the center position of the filter that the secondary prediction or PROF needs to use, it may cause the problem of degraded prediction performance, that is, the existing PROF correction prediction method and secondary prediction method In fact, it is not rigorous. When improving affine prediction, it cannot be well applied to all scenarios, and the coding performance needs to be improved.

為了解決現有技術中存在的缺陷,在本申請的實施例中,可以在基於子塊的預測之後,對運動向量與子塊的運動向量之間的第一運動向量偏差較大的像素位置,可以基於第一運動向量偏差重新確定進行二次預測或PROF處理所使用的中心位置和第二運動向量偏差的確定,從而可以在基於子塊的第一預測值的基礎上,利用中心位置和第二運動向量偏差進行基於點的二次預測,獲得第二預測值。可見,本申請提出的幀間預測方法能夠很好的適用於全部場景,可以減小預測的誤差,大大提升編碼性能,從而提高了編解碼效率。In order to solve the defects in the prior art, in the embodiments of the present application, after the prediction based on the sub-block, for the pixel position with a large deviation of the first motion vector between the motion vector and the motion vector of the sub-block, the The center position and the second motion vector offset used for secondary prediction or PROF processing are re-determined based on the first motion vector offset, so that the center position and the second The motion vector bias performs point-based secondary prediction to obtain a second predicted value. It can be seen that the inter-frame prediction method proposed in this application can be well applied to all scenarios, can reduce the prediction error, greatly improve the coding performance, and thus improve the coding and decoding efficiency.

應理解,本申請實施例提供一種影像編碼系統,圖10為本申請實施例提供的一種影像編碼系統的組成方塊圖示意圖,如圖10所示,該影像編碼系統11可以包括:變換單元111、量化單元112、模式選擇和編碼控制邏輯單元113、幀內預測單元114、幀間預測單元115(包括:運動補償和運動估計)、反量化單元116、反變換單元117、迴路濾波單元118、編碼單元119和解碼圖像暫存單元110;針對輸入的原始影像訊號,透過編碼樹單元(Coding Tree Unit,CTU)的劃分可以得到一個影像重建塊,透過模式選擇和編碼控制邏輯單元113確定編碼模式,然後,對經過幀內或幀間預測後得到的殘差像素訊息,透過變換單元111、量化單元112對該影像重建塊進行變換,包括將殘差訊息從像素域變換到變換域,並對所得的變換係數進行量化,用以進一步減少位元速率;幀內預測單元114用於對該影像重建塊進行幀內預測;其中,幀內預測單元114用於確定該影像重建塊的最優幀內預測模式(即目標預測模式);幀間預測單元115用於執行所接收的影像重建塊相對於一或多個參考幀中的一或多個塊的幀間預測編碼,以提供時間預測訊息;其中,運動估計為產生運動向量的過程,運動向量可以估計該影像重建塊的運動,然後,運動補償基於由運動估計所確定的運動向量執行運動補償;在確定幀間預測模式之後,幀間預測單元115還用於將所選擇的幀間預測資料提供到編碼單元119,而且,將所計算確定的運動向量資料也發送到編碼單元119;此外,反量化單元116和反變換單元117用於該影像重建塊的重構建,在像素域中重構建殘差塊,該重構建殘差塊透過迴路濾波單元118去除區塊效應假影,然後,將該重構殘差塊添加到解碼圖像暫存單元110的幀中的一個預測性塊,用以產生經重構建的影像重建塊;編碼單元119是用於編碼各種編碼參數及量化後的變換係數。而解碼圖像暫存單元110用於存放重構建的影像重建塊,用於預測參考。隨著影像圖像編碼的進行,會不斷生成新的重構建的影像重建塊,這些重構建的影像重建塊都會被存放在解碼圖像暫存單元110中。It should be understood that an embodiment of the present application provides an image encoding system, and FIG. 10 is a schematic block diagram of the composition of an image encoding system provided by an embodiment of the present application. As shown in FIG. 10 , the image encoding system 11 may include: a transformation unit 111 , Quantization unit 112, mode selection and encoding control logic unit 113, intra prediction unit 114, inter prediction unit 115 (including: motion compensation and motion estimation), inverse quantization unit 116, inverse transform unit 117, in-loop filtering unit 118, encoding The unit 119 and the decoded image temporary storage unit 110; for the input original image signal, an image reconstruction block can be obtained through the division of the coding tree unit (Coding Tree Unit, CTU), and the coding mode is determined through the mode selection and coding control logic unit 113. , and then transform the image reconstruction block through the transform unit 111 and the quantization unit 112 for the residual pixel information obtained after intra-frame or inter-frame prediction, including transforming the residual information from the pixel domain to the transform domain, and The obtained transform coefficients are quantized to further reduce the bit rate; the intra-frame prediction unit 114 is used to perform intra-frame prediction on the image reconstruction block; wherein, the intra-frame prediction unit 114 is used to determine the optimal frame of the image reconstruction block Intra-prediction mode (ie, target prediction mode); the inter-prediction unit 115 is used to perform inter-prediction encoding of the received image reconstruction block relative to one or more blocks in one or more reference frames to provide temporal prediction information ; wherein, motion estimation is a process of generating a motion vector, and the motion vector can estimate the motion of the image reconstruction block, and then, motion compensation performs motion compensation based on the motion vector determined by motion estimation; after determining the inter-frame prediction mode, the inter-frame The prediction unit 115 is also used to provide the selected inter-frame prediction data to the coding unit 119, and also to send the calculated motion vector data to the coding unit 119; in addition, the inverse quantization unit 116 and the inverse transform unit 117 are used for The reconstruction of the image reconstruction block reconstructs a residual block in the pixel domain, the reconstructed residual block removes blocking artifacts through the in-loop filtering unit 118, and then adds the reconstructed residual block to the decoded image A predictive block in the frame of the temporary storage unit 110 is used to generate a reconstructed image reconstruction block; the encoding unit 119 is used to encode various coding parameters and quantized transform coefficients. The decoded image temporary storage unit 110 is used for storing reconstructed image reconstruction blocks for prediction reference. As the image encoding proceeds, new reconstructed image reconstruction blocks are continuously generated, and these reconstructed image reconstruction blocks are stored in the decoded image temporary storage unit 110 .

本申請實施例還提供一種影像解碼系統,圖11為本申請實施例提供的一種影像解碼系統的組成方塊圖示意圖,如圖11所示,該影像解碼系統12可以包括:解碼單元121、反變換單元127,與反量化單元122、幀內預測單元123、運動補償單元124、迴路濾波單元125和解碼圖像暫存單元126單元;輸入的影像訊號經過影像編碼系統11進行編碼處理之後,輸出該影像訊號的位元流;該位元流輸入影像解碼系統12中,首先經過解碼單元121,用於得到解碼後的變換係數;針對該變換係數透過反變換單元127與反量化單元122進行處理,以便在像素域中產生殘差塊;幀內預測單元123可用於基於所確定的幀內預測方向和來自當前幀或圖片的先前經解碼塊的資料而產生當前影像解碼塊的預測資料;運動補償單元124是透過剖析運動向量和其他關聯語法元素來確定用於影像解碼塊的預測訊息,並使用該預測訊息以產生正被解碼的影像解碼塊的預測性塊;透過對來自反變換單元127與反量化單元122的殘差塊與由幀內預測單元123或運動補償單元124產生的對應預測性塊進行求和,而形成解碼的影像塊;該解碼的影像訊號透過迴路濾波單元125以便去除區塊效應假影,可以改善影像品質;然後將經解碼的影像塊儲存於解碼圖像暫存單元126中,解碼圖像暫存單元126儲存用於後續幀內預測或運動補償的參考圖像,同時也用於影像訊號的輸出,得到所恢復的原始影像訊號。An embodiment of the present application also provides an image decoding system. FIG. 11 is a schematic block diagram of the composition of an image decoding system provided by an embodiment of the present application. As shown in FIG. 11 , the image decoding system 12 may include: a decoding unit 121 , an inverse transform The unit 127, together with the inverse quantization unit 122, the intra-frame prediction unit 123, the motion compensation unit 124, the loop filtering unit 125 and the decoded image temporary storage unit 126; The bit stream of the video signal; the bit stream is input into the video decoding system 12, and firstly passes through the decoding unit 121 to obtain the decoded transform coefficients; the transform coefficients are processed by the inverse transform unit 127 and the inverse quantization unit 122, to generate residual blocks in the pixel domain; intra-prediction unit 123 may be used to generate prediction data for the current image decoding block based on the determined intra-prediction direction and data from previously decoded blocks of the current frame or picture; motion compensation Unit 124 determines prediction information for the image decoding block by parsing the motion vector and other associated syntax elements, and uses the prediction information to generate the prediction block for the image decoding block being decoded; The residual block of inverse quantization unit 122 is summed with the corresponding predictive blocks generated by intra prediction unit 123 or motion compensation unit 124 to form a decoded image block; the decoded image signal is passed through in-loop filter unit 125 to remove regions Blocking artifacts can improve image quality; the decoded image blocks are then stored in the decoded image temporary storage unit 126, which stores a reference image for subsequent intra prediction or motion compensation, At the same time, it is also used for the output of the image signal to obtain the restored original image signal.

本申請實施例提供的一種幀間預測方法主要作用於影像編碼系統11的幀間預測單元115和影像解碼系統12的幀間預測單元,即運動補償單元124;也就是說,如果在影像編碼系統11能夠透過本申請實施例提供的幀間預測方法得到一個較好的預測效果,那麼,對應地,在影像解碼系統12,也能夠改善影像解碼恢復品質。An inter-frame prediction method provided by this embodiment of the present application mainly acts on the inter-frame prediction unit 115 of the image coding system 11 and the inter-frame prediction unit of the image decoding system 12, that is, the motion compensation unit 124; 11. A better prediction effect can be obtained through the inter-frame prediction method provided in the embodiment of the present application, and correspondingly, the image decoding system 12 can also improve the image decoding and restoration quality.

基於此,下面結合附圖和實施例對本申請的技術方案進一步詳細闡述。在進行詳細闡述之前,需要說明的是,說明書通篇中提到的“第一”、“第二”、“第三”等,僅僅是為了區分不同的特徵,不具有限定優先順序、先後順序、大小關係等功能。Based on this, the technical solutions of the present application are further elaborated below with reference to the accompanying drawings and embodiments. Before going into detail, it should be noted that the "first", "second", "third", etc. mentioned throughout the specification are only for distinguishing different features, and do not have a limited priority or sequence. , size relationship and other functions.

需要說明的是,本實施例以AVS3標準為基礎進行示例性說明,本申請提出的幀間預測方法同樣可以適用於VVC等其他編碼標準技術,不申請對此不作具體限定。It should be noted that this embodiment is exemplified based on the AVS3 standard, and the inter-frame prediction method proposed in this application can also be applied to other coding standard technologies such as VVC, which is not specifically limited in this application.

本申請實施例提供一種幀間預測方法,該方法應用於影像解碼設備,即解碼器。該方法所實現的功能可以透過解碼器中的第一處理器調用電腦程式來實現,當然電腦程式可以保存在第一記憶體中,可見,該解碼器至少包括第一處理器和第一記憶體。An embodiment of the present application provides an inter-frame prediction method, which is applied to an image decoding device, that is, a decoder. The function realized by the method can be realized by calling the computer program through the first processor in the decoder. Of course, the computer program can be stored in the first memory. It can be seen that the decoder includes at least the first processor and the first memory. .

進一步地,在本申請的實施例中,圖12為幀間預測方法的實現流程示意圖一,如圖12所示,解碼器進行幀間預測的方法可以包括以下步驟:Further, in the embodiment of the present application, FIG. 12 is a schematic diagram 1 of the implementation flow of the inter-frame prediction method. As shown in FIG. 12 , the method for performing the inter-frame prediction by the decoder may include the following steps:

步驟S301、解析位元流,獲取當前塊的預測模式參數。Step S301 , parse the bit stream to obtain the prediction mode parameter of the current block.

在本申請的實施例中,解碼器可以先解析二進位位元流,從而獲得當前塊的預測模式參數。其中,預測模式參數可以用於對當前塊所使用的預測模式進行確定。In the embodiment of the present application, the decoder may first parse the binary bit stream to obtain the prediction mode parameter of the current block. The prediction mode parameter may be used to determine the prediction mode used by the current block.

需要說明的是,待解碼圖像可以劃分為多個圖像塊,而當前待解碼的圖像塊可以稱為當前塊(可以用CU表示),與當前塊相鄰的圖像塊可以稱為相鄰塊;即在待解碼圖像中,當前塊與相鄰塊之間具有相鄰關係。這裡,每個當前塊可以包括第一圖像分量、第二圖像分量和第三圖像分量,也即當前塊表示待解碼圖像中當前待進行第一圖像分量、第二圖像分量或者第三圖像分量預測的圖像塊。It should be noted that the image to be decoded can be divided into multiple image blocks, and the current image block to be decoded can be called the current block (which can be represented by CU), and the image block adjacent to the current block can be called as Neighboring block; that is, in the image to be decoded, the current block and the neighboring block have an adjacent relationship. Here, each current block may include a first image component, a second image component, and a third image component, that is, the current block indicates that the first image component, the second image component and the second image component are currently to be decoded in the image to be decoded. or the predicted image block of the third image component.

其中,假定當前塊進行第一圖像分量預測,而且第一圖像分量為亮度分量,即待預測圖像分量為亮度分量,那麼當前塊也可以稱為亮度塊;或者,假定當前塊進行第二圖像分量預測,而且第二圖像分量為色度分量,即待預測圖像分量為色度分量,那麼當前塊也可以稱為色度塊。Wherein, it is assumed that the current block performs the first image component prediction, and the first image component is a luminance component, that is, the image component to be predicted is a luminance component, then the current block can also be called a luminance block; Two image components are predicted, and the second image component is a chrominance component, that is, the image component to be predicted is a chrominance component, then the current block may also be called a chrominance block.

進一步地,在本申請的實施例中,預測模式參數不僅可以指示當前塊採用的預測模式,還可以指示與該預測模式相關的參數。Further, in this embodiment of the present application, the prediction mode parameter may not only indicate the prediction mode adopted by the current block, but may also indicate parameters related to the prediction mode.

可以理解的是,在本申請的實施例中,預測模式可以包括有幀間預測模式、傳統幀內預測模式以及非傳統幀內預測模式等。It can be understood that, in the embodiment of the present application, the prediction mode may include an inter prediction mode, a traditional intra prediction mode, a non-traditional intra prediction mode, and the like.

也就是說,在編碼側,編碼器可以選取最優的預測模式對當前塊進行預編碼,在這過程中就可以確定出當前塊的預測模式,然後確定用於指示預測模式的預測模式參數,從而將相應的預測模式參數寫入位元流,由編碼器傳輸到解碼器。That is to say, on the encoding side, the encoder can select the optimal prediction mode to pre-encode the current block. In the process, the prediction mode of the current block can be determined, and then the prediction mode parameters used to indicate the prediction mode can be determined. Thereby, the corresponding prediction mode parameters are written into the bit stream and transmitted from the encoder to the decoder.

相應地,在解碼器側,解碼器透過解析位元流便可以直接獲取到當前塊的預測模式參數,並根據解析獲得的預測模式參數確定當前塊所使用的預測模式,以及該預測模式對應的相關參數。Correspondingly, on the decoder side, the decoder can directly obtain the prediction mode parameters of the current block by parsing the bit stream, and determine the prediction mode used by the current block according to the prediction mode parameters obtained by parsing, and the corresponding prediction mode of the prediction mode. Related parameters.

進一步地,在本申請的實施例中,解碼器在解析獲得預測模式參數之後,可以基於預測模式參數確定當前塊是否使用幀間預測模式。Further, in the embodiment of the present application, after the decoder obtains the prediction mode parameter by parsing, it may determine whether the current block uses the inter prediction mode based on the prediction mode parameter.

步驟S302、當預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值時,確定當前塊的子塊的第一運動向量;其中,當前塊包括多個子塊。Step S302 , when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, determine the first motion vector of the sub-block of the current block; wherein the current block includes a plurality of sub-blocks.

在本申請的實施例中,解碼器在解析獲得預測模式參數之後,如果解析獲得的預測模式參數指示當前塊使用幀間預測模式確定當前塊的幀間預測值,那麼解碼器可以先確定出當前塊的每一個子塊的第一運動向量。其中,一個子塊對應有一個第一運動向量。In the embodiment of the present application, after the decoder obtains the prediction mode parameter by parsing, if the prediction mode parameter obtained by parsing indicates that the current block uses the inter prediction mode to determine the inter prediction value of the current block, the decoder may first determine the current block. The first motion vector for each sub-block of the block. Wherein, one sub-block corresponds to one first motion vector.

需要說明的是,在本申請的實施例中,當前塊為當前幀中待解碼的圖像塊,當前幀以圖像塊的形式按一定順序依次進行解碼,該當前塊為當前幀內按該順序下一時刻待解碼的圖像塊。當前塊可具有多種規格尺寸,例如16x16、32x32或32x16等規格,其中數字表示當前塊上像素點的行數和列數。It should be noted that, in the embodiments of the present application, the current block is the image block to be decoded in the current frame, the current frame is decoded in a certain order in the form of image blocks, and the current block is the image block in the current frame according to the The image block to be decoded at the next moment in order. The current block may have various sizes, such as 16x16, 32x32 or 32x16, where the numbers represent the number of rows and columns of pixels on the current block.

進一步對,在本申請的實施例中,當前塊可以劃分為多個子塊,其中,每一個子塊的尺寸大小都是相同的,子塊為較小規格的像素點集合。子塊的尺寸可以為8x8或4x4。Further, in the embodiments of the present application, the current block may be divided into a plurality of sub-blocks, wherein the size of each sub-block is the same, and the sub-block is a set of pixel points of a smaller specification. The size of the sub-block can be 8x8 or 4x4.

示例性的,在本申請中,當前塊的尺寸為16x16,可以劃分為4個尺寸均為8x8的子塊。Exemplarily, in this application, the size of the current block is 16×16, which can be divided into 4 sub-blocks each with a size of 8×8.

可以理解的是,在本申請的實施例中,在解碼器解析位元流獲取到預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值的情況下,就可以繼續採用本申請實施例所提供的幀間預測方法。It can be understood that, in the embodiment of the present application, when the decoder parses the bit stream and obtains the prediction mode parameter indicating that the inter-frame prediction value of the current block is determined using the inter-frame prediction mode, the implementation of the present application can be continued. Example of the inter prediction method provided.

在本申請的實施例中,進一步地,當預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值時,解碼器確定當前塊的子塊的第一運動向量的方法可以包括以下步驟:In the embodiment of the present application, further, when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, the method for the decoder to determine the first motion vector of the sub-block of the current block may include the following steps :

步驟S302a、解析位元流,獲取當前塊的仿射模式參數和預測參考模式。Step S302a: Parse the bit stream to obtain the affine mode parameter and prediction reference mode of the current block.

步驟S302b、當仿射模式參數指示使用仿射模式時,確定控制點模式和子塊尺寸參數。Step S302b, when the affine mode parameter indicates to use the affine mode, determine the control point mode and the sub-block size parameter.

步驟S302c、根據預測參考模式、控制點模式以及子塊尺寸參數,確定第一運動向量。Step S302c: Determine the first motion vector according to the prediction reference mode, the control point mode and the sub-block size parameter.

在本申請的實施例中,解碼器在解析獲得預測模式參數之後,如果解析獲得的預測模式參數指示當前塊使用幀間預測模式確定當前塊的幀間預測值,那麼解碼器可以透過解析位元流,獲得仿射模式參數和預測參考模式。In the embodiment of the present application, after the decoder obtains the prediction mode parameter by parsing, if the prediction mode parameter obtained by parsing indicates that the current block uses the inter prediction mode to determine the inter prediction value of the current block, the decoder can parse the bit stream to obtain the affine mode parameters and the prediction reference mode.

需要說明的是,在本申請的實施例中,仿射模式參數用於對是否使用仿射模式進行指示。具體地,仿射模式參數可以為仿射運動補償允許標誌affine_enable_flag,解碼器透過仿射模式參數的取值的確定,可以進一步確定是否使用仿射模式。It should be noted that, in the embodiments of the present application, the affine mode parameter is used to indicate whether to use the affine mode. Specifically, the affine mode parameter may be the affine motion compensation enable flag affine_enable_flag, and the decoder may further determine whether to use the affine mode by determining the value of the affine mode parameter.

也就是說,在本申請中,仿射模式參數可以為一個二值變數。若仿射模式參數的取值為1,則指示使用仿射模式;若仿射模式參數的取值為0,則指示不使用仿射模式。That is, in this application, the affine mode parameter can be a binary variable. If the value of the affine mode parameter is 1, it indicates that the affine mode is used; if the value of the affine mode parameter is 0, it indicates that the affine mode is not used.

可以理解的是,在本申請中,解碼器解析位元流,如果未解析得到仿射模式參數,那麼也可以理解為指示不使用仿射模式。It can be understood that, in this application, the decoder parses the bit stream, and if the affine mode parameter is not obtained by parsing, it can also be understood as indicating that the affine mode is not used.

示例性的,在本申請中,仿射模式參數的取值可以等於仿射運動補償允許標誌affine_enable_flag的值,如果affine_enable_flag的值為‘1’,表示可使用仿射運動補償;如果affine_enable_flag的值為‘0’,表示不應使用仿射運動補償。Exemplarily, in this application, the value of the affine mode parameter may be equal to the value of the affine motion compensation enable flag affine_enable_flag, if the value of affine_enable_flag is '1', it means that affine motion compensation can be used; if the value of affine_enable_flag is affine motion compensation '0', indicating that affine motion compensation should not be used.

進一步地,在本申請的實施例中,如果解碼器解析位元流所獲取的仿射模式參數指示使用仿射模式,那麼解碼器可以進行控制點模式和子塊尺寸參數的獲取。Further, in the embodiment of the present application, if the affine mode parameter obtained by the decoder parsing the bit stream indicates that the affine mode is used, the decoder may obtain the control point mode and the sub-block size parameter.

需要說明的是,在本申請的實施例中,控制點模式用於對控制點的個數進行確定。在仿射模型中,一個子塊可以有2個控制點或者3個控制點,相應地,控制點模式可以為2個控制點對應的控制點模式,或者為3個控制點對應的控制點模式。即控制點模式可以包括4參數模式和6參數模式。It should be noted that, in the embodiments of the present application, the control point mode is used to determine the number of control points. In the affine model, a sub-block can have 2 control points or 3 control points, correspondingly, the control point pattern can be the control point pattern corresponding to 2 control points, or the control point pattern corresponding to 3 control points . That is, the control point mode can include a 4-parameter mode and a 6-parameter mode.

可以理解的是,在本申請的實施例中,對於AVS3標準,如果當前塊使用了仿射模式,那麼解碼器還需要確定出當前塊在仿射模式中控制點的個數進行確定,從而可以確定出使用的是4參數(2個控制點)模式,還是6參數(3個控制點)模式。It can be understood that, in the embodiments of the present application, for the AVS3 standard, if the current block uses the affine mode, the decoder also needs to determine the number of control points in the affine mode of the current block to determine, so that it can be determined. Determine if you are using 4-parameter (2 control points) mode or 6-parameter (3 control points) mode.

進一步地,在本申請的實施例中,如果解碼器解析位元流所獲取的仿射模式參數指示使用仿射模式,那麼解碼器可以透過解析位元流,進一步獲取子塊尺寸參數。Further, in the embodiment of the present application, if the affine mode parameter obtained by the decoder parsing the bit stream indicates that the affine mode is used, the decoder can further obtain the sub-block size parameter by parsing the bit stream.

具體地,子塊尺寸參數可以透過仿射預測子塊尺寸標誌affine_subblock_size_flag確定,解碼器透過解析位元流,獲得子塊尺寸標誌,並根據子塊標誌的取值確定當前塊的子塊的尺寸大小。其中,子塊的尺寸大小可以為8x8或4x4。具體地,在本申請中,子塊尺寸標誌可以為一個二值變數。若子塊尺寸標誌的取值為1,則指示子塊尺寸參數為8x8;若子塊尺寸標誌的取值為0,則指示子塊尺寸參數為4x4。Specifically, the sub-block size parameter can be determined by the affine prediction sub-block size flag affine_subblock_size_flag. The decoder obtains the sub-block size flag by parsing the bit stream, and determines the sub-block size of the current block according to the value of the sub-block flag . The size of the sub-block may be 8x8 or 4x4. Specifically, in this application, the sub-block size flag may be a binary variable. If the value of the subblock size flag is 1, it indicates that the subblock size parameter is 8x8; if the value of the subblock size flag is 0, it indicates that the subblock size parameter is 4x4.

示例性的,在本申請中,子塊尺寸標誌的取值可以等於仿射預測子塊尺寸標誌affine_subblock_size_flag的值,如果affine_subblock_size_flag的值為‘1’,則當前塊劃分為尺寸為8x8的子塊;如果affine_subblock_size_flag的值為‘0’,則當前塊劃分為尺寸為4x4的子塊。Exemplarily, in this application, the value of the subblock size flag may be equal to the value of the affine prediction subblock size flag affine_subblock_size_flag, if the value of affine_subblock_size_flag is '1', the current block is divided into subblocks with a size of 8x8; If the value of affine_subblock_size_flag is '0', the current block is divided into sub-blocks of size 4x4.

可以理解的是,在本申請中,解碼器解析位元流,如果未解析得到子塊尺寸標誌,那麼也可以理解為當前塊劃分為4x4的子塊。也就是說,如果位元流中不存在affine_subblock_size_flag,可以直接將子塊尺寸標誌的取值設置為0。It can be understood that, in this application, the decoder parses the bit stream, and if the sub-block size flag is not obtained by parsing, it can also be understood that the current block is divided into 4×4 sub-blocks. That is to say, if the affine_subblock_size_flag does not exist in the bit stream, the value of the subblock size flag can be directly set to 0.

進一步地,在本申請的實施例中,解碼器在確定控制點模式和子塊尺寸參數之後,便可以根據預測參考模式、控制點模式以及子塊尺寸參數,進一步確定出當前塊中的子塊的第一運動向量。Further, in the embodiment of the present application, after determining the control point mode and the sub-block size parameter, the decoder can further determine the size of the sub-block in the current block according to the prediction reference mode, the control point mode and the sub-block size parameter. The first motion vector.

具體地,在本申請的實施例中,解碼器可以先根據預測參考模式確定控制點運動向量組;然後可以基於控制點運動向量組、控制點模式以及子塊尺寸參數,確定出子塊的第一運動向量。Specifically, in the embodiment of the present application, the decoder may first determine the control point motion vector group according to the prediction reference mode; a motion vector.

可以理解的是,在本申請的實施例中,控制點運動向量組可以用於對控制點的運動向量進行確定。It can be understood that, in the embodiment of the present application, the control point motion vector group may be used to determine the motion vector of the control point.

需要說明的是,在本申請的實施例中,解碼器可以按照上述方法,遍歷當前塊中的每一個子塊,利用每一個子塊的控制點運動向量組、控制點模式以及子塊尺寸參數,確定出每一個子塊的第一運動向量,從而可以根據每一個子塊的第一運動向量構建獲得運動向量集合。It should be noted that, in the embodiment of the present application, the decoder can traverse each sub-block in the current block according to the above method, and use the control point motion vector group, control point mode and sub-block size parameter of each sub-block , the first motion vector of each sub-block is determined, so that the motion vector set can be obtained by constructing and obtaining the first motion vector of each sub-block.

可以理解的是,在本申請的實施例中,當前塊的運動向量集合中可以包括當前塊的每一個子塊的第一運動向量。It can be understood that, in this embodiment of the present application, the motion vector set of the current block may include the first motion vector of each sub-block of the current block.

進一步地,在本申請的實施例中,解碼器在根據控制點運動向量組、控制點模式以及子塊尺寸參數,確定第一運動向量時,可以先根據控制點運動向量組、控制點模式以及當前塊的尺寸參數,確定差值變數;然後可以基於預測模式參數和子塊尺寸參數,確定子塊位置;最後,便可以利用差值變數和子塊位置,確定子塊的第一運動向量,進而可以獲得當前塊的多個子塊的運動向量集合。Further, in the embodiment of the present application, when determining the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter, the decoder may first determine the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter. The size parameter of the current block is used to determine the difference variable; then the sub-block position can be determined based on the prediction mode parameter and the sub-block size parameter; finally, the first motion vector of the sub-block can be determined by using the difference variable and the sub-block position, and then the sub-block can be determined. Obtain a set of motion vectors for multiple sub-blocks of the current block.

示例性的,在本申請中,差值變數可以包括4個變數,具體為dHorX、dVerX、dHorY和dVerY,在計算差值變數時,解碼器需要先確定出控制點運動向量組,其中,控制點運動向量組可以對控制點的運動向量進行表徵。Exemplarily, in this application, the difference variable may include 4 variables, specifically dHorX, dVerX, dHorY and dVerY. When calculating the difference variable, the decoder needs to determine the control point motion vector group first, wherein the control point The point motion vector group can characterize the motion vector of the control point.

具體地,如果控制點模式為6參數模式,即存在3個控制點,那麼控制點運動向量組可以為包括3個運動向量的運動向量組,表示為mvsAffine(mv0,mv1,mv2);如果控制點模式為4參數模式,即存在2個控制點,那麼控制點運動向量組可以為包括2個運動向量的運動向量組,表示為mvsAffine(mv0,mv1)。Specifically, if the control point mode is a 6-parameter mode, that is, there are 3 control points, then the control point motion vector group may be a motion vector group including 3 motion vectors, expressed as mvsAffine(mv0, mv1, mv2); if the control point If the point mode is a 4-parameter mode, that is, there are 2 control points, then the control point motion vector group may be a motion vector group including 2 motion vectors, which is expressed as mvsAffine(mv0, mv1).

接著,解碼器便可以利用控制點運動向量組進行差值變數的計算:Then, the decoder can use the control point motion vector group to calculate the difference variable:

dHorX=(mv1_x-mv0_x)<<(7-Log(width));dHorX=(mv1_x-mv0_x)<<(7-Log(width));

dHorY=(mv1_y-mv0_y)<<(7-Log(width));dHorY=(mv1_y-mv0_y)<<(7-Log(width));

若運動向量組為mvsAffine(mv0,mv1,mv2),則:If the motion vector group is mvsAffine(mv0, mv1, mv2), then:

dVerX=(mv2_x-mv0_x)<<(7-Log(height));dVerX=(mv2_x-mv0_x)<<(7-Log(height));

dVerY=(mv2_y-mv0_y)<<(7-Log(height));dVerY=(mv2_y-mv0_y)<<(7-Log(height));

若運動向量組為mvsAffine(mv0,mv1),則:If the motion vector group is mvsAffine(mv0, mv1), then:

dVerX=−dHorY;dVerX=−dHorY;

dVerY=dHorX。dVerY=dHorX.

其中,width和height分別為當前塊的寬度和高度,即當前塊的尺寸參數,具體地,當前塊的尺寸參數可以為解碼器透過解析位元流獲取的。The width and height are respectively the width and height of the current block, that is, the size parameter of the current block. Specifically, the size parameter of the current block may be obtained by the decoder by parsing the bit stream.

進一步地,在本申請的實施例中,解碼器在確定出差值變數之後,可以接著基於預測模式參數和子塊尺寸參數,確定子塊位置。具體地,解碼器可以透過子塊尺寸標誌確定出子塊的尺寸,同時可以透過預測模式參數確定具體使用哪一種預測模式,然後便可以根據子塊的尺寸和使用的預測模式,確定出子塊位置。Further, in the embodiment of the present application, after determining the difference variable, the decoder may then determine the sub-block position based on the prediction mode parameter and the sub-block size parameter. Specifically, the decoder can determine the size of the sub-block through the sub-block size flag, and can determine which prediction mode to use through the prediction mode parameter, and then can determine the sub-block according to the size of the sub-block and the prediction mode used Location.

示例性的,在本申請中,如果當前塊的預測參考模式的取值為2,即為第三參考模式‘Pred_List01’,或者,子塊尺寸標誌的取值為1,即子塊的寬度subwidth和高度subheight均等於8,則(x,y)是8×8子塊左上角位置的座標,那麼可以透過以下方式確定子塊位置的座標xPos和yPos:Exemplarily, in this application, if the value of the prediction reference mode of the current block is 2, it is the third reference mode 'Pred_List01', or, the value of the subblock size flag is 1, that is, the width subwidth of the subblock. and height subheight are both equal to 8, then (x, y) is the coordinates of the upper left corner of the 8×8 sub-block, then the coordinates xPos and yPos of the sub-block position can be determined in the following ways:

如果子塊是當前塊的左上角的控制點,則xPos和yPos均等於0;If the sub-block is the control point in the upper left corner of the current block, both xPos and yPos are equal to 0;

如果子塊是當前塊的右上角的控制點,則xPos等於width,yPos等於0;If the subblock is the control point in the upper right corner of the current block, xPos equals width and yPos equals 0;

如果子塊是當前塊的左下角的控制點,控制點運動向量組可以為包括3個運動向量的運動向量組,則xPos等於0,yPos等於height;If the sub-block is the control point in the lower left corner of the current block, the control point motion vector group may be a motion vector group including 3 motion vectors, then xPos is equal to 0, and yPos is equal to height;

否則,xPos等於(x-xE)+4,yPos等於(y-yE)+4。Otherwise, xPos equals (x-xE)+4 and yPos equals (y-yE)+4.

示例性的,在本申請中,如果當前塊的預測參考模式的取值0或1,即為第一參考模式‘Pred_List0’或第二參考模式‘Pred_List1’,且子塊尺寸標誌的取值為0,即子塊的寬度subwidth和高度subheight均等於4,(x,y)是4×4子塊左上角位置的座標,那麼可以透過以下方式確定子塊位置的座標xPos和yPos:Exemplarily, in this application, if the prediction reference mode of the current block is 0 or 1, it is the first reference mode 'Pred_List0' or the second reference mode 'Pred_List1', and the value of the subblock size flag is 0, that is, the width subwidth and height subheight of the subblock are both equal to 4, (x, y) is the coordinate of the upper left corner of the 4×4 subblock, then the coordinates xPos and yPos of the subblock position can be determined by the following methods:

如果子塊是當前塊的左上角的控制點,則xPos和yPos均等於0;If the sub-block is the control point in the upper left corner of the current block, both xPos and yPos are equal to 0;

如果子塊是當前塊的右上角的控制點,則xPos等於width,yPos等於0;If the subblock is the control point in the upper right corner of the current block, xPos equals width and yPos equals 0;

如果子塊是當前塊的左下角的控制點,控制點運動向量組可以為包括3個運動向量的運動向量組,則xPos等於0,yPos等於height;If the sub-block is the control point in the lower left corner of the current block, the control point motion vector group may be a motion vector group including 3 motion vectors, then xPos is equal to 0, and yPos is equal to height;

否則,xPos等於(x-xE)+2,yPos等於(y-yE)+2。Otherwise, xPos is equal to (x-xE)+2 and yPos is equal to (y-yE)+2.

進一步地,在本申請的實施例中,解碼器計算獲得子塊位置之後,接著可以基於子塊位置和差值變數確定出該子塊的第一運動向量,最後,遍歷當前塊的每一個子塊,獲得每一個子塊的第一運動向量,便可以構建獲得當前塊的多個子塊的運動向量集合。Further, in the embodiment of the present application, after the decoder obtains the sub-block position by calculation, the first motion vector of the sub-block can be determined based on the sub-block position and the difference variable, and finally, each sub-block of the current block is traversed. block, and obtain the first motion vector of each sub-block, then a motion vector set for obtaining multiple sub-blocks of the current block can be constructed.

示例性的,在本申請中,解碼器在確定出子塊位置xPos和yPos之後,可以透過以下方式確定出子塊的第一運動向量mvE(mvE_x,mvE_y)Exemplarily, in this application, after determining the sub-block positions xPos and yPos, the decoder may determine the first motion vector mvE of the sub-block in the following manner (mvE_x, mvE_y)

mvE_x=Clip3(-131072,131071,Rounding((mv0_x<<7)+dHorX×xPos+dVerX×yPos,7));mvE_x=Clip3(-131072,131071,Rounding((mv0_x<<7)+dHorX×xPos+dVerX×yPos,7));

mvE_y=Clip3(-131072,131071,Rounding((mv0_y<<7)+dHorY×xPos+dVerY×yPos,7))。mvE_y=Clip3(-131072,131071,Rounding((mv0_y<<7)+dHorY×xPos+dVerY×yPos,7)).

需要說明的是,在本申請中,在確定子塊內的每個位置與子塊的運動向量的偏差時,如果當前塊使用的是仿射預測模型,可以根據仿射預測模型的公式計算出子塊內的每個位置的運動向量,與子塊的運動向量相減得到它們的偏差。如果子塊的運動向量都選擇子塊內同一位置的運動向量,如4x4的塊使用距離左上角(2,2)的位置,8x8的塊使用距離左上角(4,4)的位置,根據現在標準包括VVC和AVS3中使用的仿射模型,每個子塊相同位置的運動向量偏差都是相同的。但是AVS在左上角,右上角,以及3個控制點的情況下的左下角(上述AVS3文本中的,如圖7所示的A,B,C位置)與其他塊使用的位置不同,相應地在計算左上角,右上角,以及3控制點的情況下的左下角的子塊的運動向量偏差時與其他塊也不同。It should be noted that, in this application, when determining the deviation between each position in the sub-block and the motion vector of the sub-block, if the current block uses an affine prediction model, it can be calculated according to the formula of the affine prediction model. The motion vector of each position within the sub-block is subtracted from the motion vector of the sub-block to obtain their offset. If the motion vectors of the sub-blocks all select the motion vector at the same position in the sub-block, for example, the 4x4 block uses the position from the upper left corner (2, 2), and the 8x8 block uses the position from the upper left corner (4, 4). The standard includes the affine model used in VVC and AVS3, and the motion vector bias at the same location of each sub-block is the same. But AVS is in the upper left corner, upper right corner, and lower left corner in the case of 3 control points (the A, B, C positions in the above AVS3 text, as shown in Figure 7) are different from the positions used by other blocks, correspondingly The calculation of the motion vector deviation of the upper left corner, the upper right corner, and the lower left sub-block in the case of three control points is also different from other blocks.

步驟S303、基於第一運動向量確定子塊的第一預測值,和子塊中的每一個像素位置與子塊之間的第一運動向量偏差。Step S303: Determine the first predicted value of the sub-block based on the first motion vector, and the first motion vector deviation between each pixel position in the sub-block and the sub-block.

在本申請的實施例中,解碼器在確定出當前塊的每一個子塊的第一運動向量之後,可以基於子塊的第一運動向量,分別確定出子塊的第一預測值和該子塊中的每一個像素位置與該子塊之間的第一運動向量偏差,其中,一個像素位置對應一個第一運動向量偏差。In the embodiment of the present application, after determining the first motion vector of each sub-block of the current block, the decoder may separately determine the first predicted value of the sub-block and the sub-block based on the first motion vector of the sub-block. The first motion vector offset between each pixel position in the block and the sub-block, where one pixel position corresponds to one first motion vector offset.

可以理解的是,在本申請的實施例中,步驟S303具體可以包括:It can be understood that, in the embodiment of the present application, step S303 may specifically include:

步驟S303a、基於第一運動向量確定子塊的第一預測值。Step S303a: Determine the first predicted value of the sub-block based on the first motion vector.

步驟S303b、基於第一運動向量確定子塊中的每一個像素位置與子塊之間的第一運動向量偏差。Step S303b: Determine the first motion vector deviation between each pixel position in the sub-block and the sub-block based on the first motion vector.

其中,本申請實施例提出的幀間預測方法對解碼器執行步驟S303a和步驟S303b的順序不進行限定,也就是說,在本申請中,在確定出當前塊的每一個子塊的第一運動向量之後,解碼器可以先執行步驟S303a,然後執行步驟S303b,也可以先執行步驟S303b,再執行步驟S303a,還可以同時執行步驟S303a和步驟S303b。The inter-frame prediction method proposed in this embodiment of the present application does not limit the order in which the decoder performs step S303a and step S303b, that is, in the present application, after determining the first motion of each sub-block of the current block After the vector, the decoder may first perform step S303a and then step S303b, or may first perform step S303b and then step S303a, or simultaneously perform step S303a and step S303b.

進一步地,在本申請的實施例中,解碼器在基於第一運動向量確定子塊的第一預測值時,可以先確定樣本矩陣;其中,樣本矩陣包括亮度樣本矩陣和色度樣本矩陣;然後可以根據預測參考模式、子塊尺寸參數、樣本矩陣以及運動向量集合,確定第一預測值。Further, in the embodiment of the present application, when determining the first predicted value of the subblock based on the first motion vector, the decoder may first determine a sample matrix; wherein, the sample matrix includes a luminance sample matrix and a chrominance sample matrix; then The first predictor may be determined from a prediction reference mode, a subblock size parameter, a sample matrix, and a set of motion vectors.

需要說明的是,在本申請的實施例中,解碼器在根據預測參考模式、子塊尺寸參數、樣本矩陣以及運動向量集合,確定第一預測值時,可以先根據預測參考模式和子塊尺寸參數,從運動向量集合中確定目標運動向量;然後可以利用預測參考模式對應的參考圖像佇列和參考索引樣本矩陣以及目標運動向量,確定預測樣本矩陣;其中,預測樣本矩陣包括多個子塊的第一預測值。It should be noted that, in the embodiment of the present application, when the decoder determines the first prediction value according to the prediction reference mode, the sub-block size parameter, the sample matrix, and the motion vector set, it can first determine the first prediction value according to the prediction reference mode and the sub-block size parameter. , determine the target motion vector from the motion vector set; then the reference image queue corresponding to the prediction reference mode and the reference index sample matrix and the target motion vector can be used to determine the prediction sample matrix; wherein, the prediction sample matrix a predicted value.

具體地,在本申請的實施例中,樣本矩陣可以包括亮度樣本矩陣和色度樣本矩陣,相應地,解碼器確定出的預測樣本矩陣可以包括亮度預測樣本矩陣和色度預測樣本矩陣,其中,亮度預測樣本矩陣包括多個子塊的第一亮度預測值,色度預測樣本矩陣包括多個子塊的第一色度預測值,第一亮度預測值和第一色度預測值構成子塊的第一預測值。Specifically, in the embodiment of the present application, the sample matrix may include a luma sample matrix and a chroma sample matrix, and correspondingly, the predicted sample matrix determined by the decoder may include a luma predicted sample matrix and a chrominance predicted sample matrix, wherein, The luma prediction sample matrix includes the first luma predicted values of multiple sub-blocks, the chrominance prediction sample matrix includes the first chrominance predicted values of the multiple sub-blocks, and the first luma predicted value and the first chrominance predicted value constitute the first luma predicted value of the sub-block. Predictive value.

示例性的,在本申請中,假設當前塊左上角樣本在當前圖像的亮度樣本矩陣中的位置為(xE,yE)。如果當前塊的預測參考模式取值為0,即使用第一參考模式‘PRED_List0’,且子塊尺寸標誌的取值為0,即子塊尺寸參數為4×4,那麼目標運動向量mv0E0是當前塊的運動向量集合在(xE+x,yE+y)位置的4×4子塊的第一運動向量。亮度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E0_x,(yE+y)<<4)+mv0E0_y)))的樣本值,色度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/32精度色度樣本矩陣中位置為(((xE+2×x)<<4)+MvC_x,(yE+2×y)<<4)+MvC_y)))的樣本值。其中,x1=((xE+2×x)>>3)<<3,y1=((yE+2×y)>>3)<<3,mv1E0是當前塊的運動向量集合在(x1,y1)位置的4×4單元的第一運動向量,mv2E0是當前塊的運動向量集合在(x1+4,y1)位置的4×4單元的第一運動向量,mv3E0是當前塊的運動向量集合在(x1,y1+4)位置的4×4單元的第一運動向量,mv4E0是當前塊的運動向量集合在(x1+4,y1+4)位置的4×4單元的第一運動向量。Exemplarily, in this application, it is assumed that the position of the upper left sample of the current block in the luminance sample matrix of the current image is (xE, yE). If the prediction reference mode of the current block is 0, that is, the first reference mode 'PRED_List0' is used, and the sub-block size flag is 0, that is, the sub-block size parameter is 4×4, then the target motion vector mv0E0 is the current The motion vector of the block sets the first motion vector of the 4×4 sub-block at the (xE+x, yE+y) position. The value of the element predMatrixL0[x][y] in the luma prediction sample matrix predMatrixL0 is the position in the 1/16-precision luma sample matrix with the reference index RefIdxL0 in the reference image queue 0 (((xE+x)<<4 )+mv0E0_x, (yE+y)<<4)+mv0E0_y))), the value of the element predMatrixL0[x][y] in the chroma prediction sample matrix predMatrixL0 is the reference index in the reference image queue 0 It is the sample value at position (((xE+2×x)<<4)+MvC_x, (yE+2×y)<<4)+MvC_y))) in the 1/32 precision chroma sample matrix of RefIdxL0. Among them, x1=((xE+2×x)>>3)<<3, y1=((yE+2×y)>>3)<<3, mv1E0 is the motion vector set of the current block in (x1, y1) The first motion vector of the 4×4 unit at the position, mv2E0 is the first motion vector of the 4×4 unit at the position (x1+4, y1) of the motion vector set of the current block, and mv3E0 is the motion vector set of the current block. The first motion vector of the 4×4 unit at the (x1, y1+4) position, mv4E0 is the first motion vector of the 4×4 unit of the current block’s motion vector set at the (x1+4, y1+4) position.

具體地,MvC_x和MvC_y可以透過以下方式確定:Specifically, MvC_x and MvC_y can be determined in the following ways:

MvC_x=(mv1E0_x+mv2E0_x+mv3E0_x+mv4E0_x+2)>>2MvC_x=(mv1E0_x+mv2E0_x+mv3E0_x+mv4E0_x+2)>>2

MvC_y=(mv1E0_y+mv2E0_y+mv3E0_y+mv4E0_y+2)>>2MvC_y=(mv1E0_y+mv2E0_y+mv3E0_y+mv4E0_y+2)>>2

示例性的,在本申請中,假設當前塊左上角樣本在當前圖像的亮度樣本矩陣中的位置為(xE,yE),如果當前塊的預測參考模式取值為0,即使用第一參考模式‘PRED_List0’,且子塊尺寸標誌的取值為1,即子塊尺寸參數為8×8,那麼目標運動向量mv0E0是當前塊的運動向量集合在(xE+x,yE+y)位置的8×8單元的第一運動向量。亮度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E0_x,(yE+y)<<4)+mv0E0_y)))的樣本值,色度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/32精度色度樣本矩陣中位置為(((xE+2×x)<<4)+MvC_x,(yE+2×y)<<4)+MvC_y)))的樣本值。其中,MvC_x等於mv0E0_x,MvC_y等於mv0E0。Exemplarily, in this application, it is assumed that the position of the upper left corner sample of the current block in the luminance sample matrix of the current image is (xE, yE), if the prediction reference mode of the current block is 0, that is, the first reference Mode 'PRED_List0', and the value of the sub-block size flag is 1, that is, the sub-block size parameter is 8 × 8, then the target motion vector mv0E0 is the motion vector set of the current block at (xE+x, yE+y) position The first motion vector of the 8x8 unit. The value of the element predMatrixL0[x][y] in the luma prediction sample matrix predMatrixL0 is the position in the 1/16-precision luma sample matrix with the reference index RefIdxL0 in the reference image queue 0 (((xE+x)<<4 )+mv0E0_x, (yE+y)<<4)+mv0E0_y))), the value of the element predMatrixL0[x][y] in the chroma prediction sample matrix predMatrixL0 is the reference index in the reference image queue 0 It is the sample value at position (((xE+2×x)<<4)+MvC_x, (yE+2×y)<<4)+MvC_y))) in the 1/32 precision chroma sample matrix of RefIdxL0. Among them, MvC_x is equal to mv0E0_x, and MvC_y is equal to mv0E0.

示例性的,在本申請中,假設當前塊左上角樣本在當前圖像的亮度樣本矩陣中的位置為(xE,yE)。如果當前塊的預測參考模式取值為1,即使用第二參考模式‘PRED_List1’,且子塊尺寸標誌的取值為0,即子塊尺寸參數為4×4,那麼目標運動向量mv0E1是當前塊的運動向量集合在(xE+x,yE+y)位置的4×4單元的第一運動向量。亮度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E1_x,(yE+y)<<4)+mv0E1_y)))的樣本值,色度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/32精度色度樣本矩陣中位置為(((xE+2×x)<<4)+MvC_x,(yE+2×y)<<4)+MvC_y)))的樣本值。其中,x1=((xE+2×x)>>3)<<3,y1=((yE+2×y)>>3)<<3,mv1E1是MvArray第一運動向量集合在(x1,y1)位置的4×4單元的第一運動向量,mv2E1是MvArray第一運動向量集合在(x1+4,y1)位置的4×4單元的第一運動向量,mv3E1是MvArray第一運動向量集合在(x1,y1+4)位置的4×4單元的第一運動向量,mv4E1是MvArray第一運動向量集合在(x1+4,y1+4)位置的4×4單元的第一運動向量。Exemplarily, in this application, it is assumed that the position of the upper left sample of the current block in the luminance sample matrix of the current image is (xE, yE). If the prediction reference mode of the current block is 1, that is, the second reference mode 'PRED_List1' is used, and the sub-block size flag is 0, that is, the sub-block size parameter is 4×4, then the target motion vector mv0E1 is the current The block's motion vector sets the first motion vector of the 4x4 unit at the (xE+x, yE+y) position. The value of the element predMatrixL1[x][y] in the luma prediction sample matrix predMatrixL1 is the position in the 1/16-precision luma sample matrix whose reference index is RefIdxL1 in the reference image queue 1 is (((xE+x)<<4 )+mv0E1_x, (yE+y)<<4)+mv0E1_y))), the value of the element predMatrixL1[x][y] in the chroma prediction sample matrix predMatrixL1 is the reference index in the reference image queue 1 It is the sample value at position (((xE+2×x)<<4)+MvC_x, (yE+2×y)<<4)+MvC_y))) in the 1/32 precision chroma sample matrix of RefIdxL1. Among them, x1=((xE+2×x)>>3)<<3, y1=((yE+2×y)>>3)<<3, mv1E1 is the first motion vector set of MvArray in (x1, y1) the first motion vector of the 4×4 unit at the position, mv2E1 is the first motion vector of the 4×4 unit of the MvArray first motion vector set at the (x1+4, y1) position, mv3E1 is the MvArray first motion vector set The first motion vector of the 4×4 element at the (x1, y1+4) position, mv4E1 is the first motion vector of the 4×4 element of the MvArray first motion vector set at the (x1+4, y1+4) position.

具體地,MvC_x和MvC_y可以透過以下方式確定:Specifically, MvC_x and MvC_y can be determined in the following ways:

MvC_x=(mv1E1_x+mv2E1_x+mv3E1_x+mv4E1_x+2)>>2MvC_x=(mv1E1_x+mv2E1_x+mv3E1_x+mv4E1_x+2)>>2

MvC_y=(mv1E1_y+mv2E1_y+mv3E1_y+mv4E1_y+2)>>2MvC_y=(mv1E1_y+mv2E1_y+mv3E1_y+mv4E1_y+2)>>2

示例性的,在本申請中,假設當前塊左上角樣本在當前圖像的亮度樣本矩陣中的位置為(xE,yE)。如果當前塊的預測參考模式取值為1,即使用第二參考模式‘PRED_List1’,且子塊尺寸標誌的取值為1,即子塊尺寸參數為8×8,那麼目標運動向量mv0E1是當前塊的運動向量集合在(xE+x,yE+y)位置的8×8單元的第一運動向量。亮度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E1_x,(yE+y)<<4)+mv0E1_y)))的樣本值,色度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/32精度色度樣本矩陣中位置為(((xE+2×x)<<4)+MvC_x,(yE+2×y)<<4)+MvC_y)))的樣本值。其中MvC_x等於mv0E1_x,MvC_y等於mv0E1。Exemplarily, in this application, it is assumed that the position of the upper left sample of the current block in the luminance sample matrix of the current image is (xE, yE). If the prediction reference mode of the current block is 1, that is, the second reference mode 'PRED_List1' is used, and the sub-block size flag is 1, that is, the sub-block size parameter is 8×8, then the target motion vector mv0E1 is the current The block's motion vector sets the first motion vector of an 8x8 unit at (xE+x, yE+y) position. The value of the element predMatrixL1[x][y] in the luma prediction sample matrix predMatrixL1 is the position in the 1/16-precision luma sample matrix whose reference index is RefIdxL1 in the reference image queue 1 is (((xE+x)<<4 )+mv0E1_x, (yE+y)<<4)+mv0E1_y))), the value of the element predMatrixL1[x][y] in the chroma prediction sample matrix predMatrixL1 is the reference index in the reference image queue 1 It is the sample value at position (((xE+2×x)<<4)+MvC_x, (yE+2×y)<<4)+MvC_y))) in the 1/32 precision chroma sample matrix of RefIdxL1. where MvC_x is equal to mv0E1_x and MvC_y is equal to mv0E1.

示例性的,在本申請中,假設當前塊左上角樣本在當前圖像的亮度樣本矩陣中的位置為(xE,yE)。如果當前塊的預測參考模式取值為2,即使用第三參考模式‘PRED_List01’,那麼目標運動向量mv0E0是當前塊的運動向量集合在(xE+x,yE+y)位置的8×8單元的第一運動向量,目標運動向量mv0E1是當前塊的運動向量集合在(x,y)位置的8×8單元的第一運動向量。亮度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/16精度亮度樣本矩陣中位置為(((xE+x)<<4)+mv0E0_x,(yE+y)<<4)+mv0E0_y)))的樣本值,色度預測樣本矩陣predMatrixL0中的元素predMatrixL0[x][y]的值是參考圖像佇列0中參考索引為RefIdxL0的1/32精度色度樣本矩陣中位置為(((xE+2×x)<<4)+MvC0_x,(yE+2×y)<<4)+MvC0_y)))的樣本值,亮度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/16精度亮度樣本矩陣中位置為((((xE+x)<<4)+mv0E1_x,(yE+y)<<4)+mv0E1_y))))的樣本值,色度預測樣本矩陣predMatrixL1中的元素predMatrixL1[x][y]的值是參考圖像佇列1中參考索引為RefIdxL1的1/32精度色度樣本矩陣中位置為(((xE+2×x)<<4)+MvC1_x,(yE+2×y)<<4)+MvC1_y)))的樣本值。其中MvC0_x等於mv0E0_x,MvC0_y等於mv0E0_y,MvC1_x等於mv0E1_x,MvC1_y等於mv0E1_y。Exemplarily, in this application, it is assumed that the position of the upper left sample of the current block in the luminance sample matrix of the current image is (xE, yE). If the prediction reference mode of the current block is 2, that is, the third reference mode 'PRED_List01' is used, then the target motion vector mv0E0 is an 8×8 unit where the motion vector set of the current block is located at (xE+x, yE+y) position The first motion vector of , the target motion vector mv0E1 is the first motion vector of the 8×8 unit of the motion vector set of the current block at the (x, y) position. The value of the element predMatrixL0[x][y] in the luma prediction sample matrix predMatrixL0 is the position in the 1/16-precision luma sample matrix with the reference index RefIdxL0 in the reference image queue 0 (((xE+x)<<4 )+mv0E0_x, (yE+y)<<4)+mv0E0_y))), the value of the element predMatrixL0[x][y] in the chroma prediction sample matrix predMatrixL0 is the reference index in the reference image queue 0 is the sample value whose position is (((xE+2×x)<<4)+MvC0_x, (yE+2×y)<<4)+MvC0_y))) in the 1/32 precision chroma sample matrix of RefIdxL0, The value of the element predMatrixL1[x][y] in the luma prediction sample matrix predMatrixL1 is the 1/16 precision luma sample matrix whose reference index is RefIdxL1 in the reference image queue 1. The position in the matrix is ((((xE+x)<< 4) The sample value of +mv0E1_x, (yE+y)<<4)+mv0E1_y)))), the value of the element predMatrixL1[x][y] in the chroma prediction sample matrix predMatrixL1 is the reference image queue 1 The sample whose reference index is 1/32 precision chroma sample matrix of RefIdxL1 is (((xE+2×x)<<4)+MvC1_x,(yE+2×y)<<4)+MvC1_y)))) value. Where MvC0_x is equal to mv0E0_x, MvC0_y is equal to mv0E0_y, MvC1_x is equal to mv0E1_x, and MvC1_y is equal to mv0E1_y.

需要說明的是,在申請的實施例中,樣本矩陣中的亮度樣本矩陣可以為1/16精度亮度樣本矩陣,樣本矩陣中的色度樣本矩陣可以為1/32精度色度樣本矩陣。It should be noted that, in the embodiment of the application, the luminance sample matrix in the sample matrix may be a 1/16 precision luminance sample matrix, and the chrominance sample matrix in the sample matrix may be a 1/32 precision chrominance sample matrix.

可以理解的是,在本申請的實施例中,對於不同的預測參考模式,解碼器透過解析位元流所獲取的參考圖像佇列和參考索引是不相同的。It can be understood that, in the embodiments of the present application, for different prediction reference modes, the reference picture queue and reference index obtained by the decoder by parsing the bit stream are different.

進一步地,在本申請的實施例中,解碼器確定樣本矩陣時,可以先獲取亮度插值濾波器係數和色度插值濾波器係數;然後可以基於亮度插值濾波器係數確定亮度樣本矩陣,同時,可以基於色度插值濾波器係數確定色度樣本矩陣。Further, in the embodiment of the present application, when the decoder determines the sample matrix, it can first obtain the luminance interpolation filter coefficients and the chrominance interpolation filter coefficients; then the luminance sample matrix can be determined based on the luminance interpolation filter coefficients, and at the same time, it can A matrix of chroma samples is determined based on the chroma interpolation filter coefficients.

示例性的,在本申請中,解碼器在確定亮度樣本矩陣時,獲取的亮度插值濾波器係數如上述表1所示,然後按照像素位置和樣本位置,計算獲得亮度樣本矩陣。Exemplarily, in the present application, when the decoder determines the luminance sample matrix, the obtained luminance interpolation filter coefficients are shown in Table 1, and then calculates and obtains the luminance sample matrix according to the pixel position and the sample position.

具體地,樣本位置ax,0(x=1~15)由水平方向上距離插值點最近得8個整數值濾波得到,預測值的獲取方式如下:Specifically, the sample position ax, 0 (x=1~15) is obtained by filtering the 8 integer values closest to the interpolation point in the horizontal direction, and the predicted value is obtained as follows:

ax,0=Clip1((fL[x][0]×A−3,0+fL[x][1]×A−2,0+fL[x][2]×A−1,0+fL[x][3]×A0,0+fL[x][4]×A1,0+fL[x][5]×A2,0+fL[x][6]×A3,0+fL[x][7]×A4,0+32)>>6)。ax,0=Clip1((fL[x][0]×A−3,0+fL[x][1]×A−2,0+fL[x][2]×A−1,0+fL [x][3]×A0, 0+fL[x][4]×A1, 0+fL[x][5]×A2, 0+fL[x][6]×A3, 0+fL[x ][7]×A4, 0+32) >> 6).

具體地,樣本位置a0,y(y=1~15)由垂直方向上距離插值點最近得8個整數值濾波得到,預測值的獲取方式如下:Specifically, the sample positions a0, y (y=1~15) are obtained by filtering the 8 integer values closest to the interpolation point in the vertical direction, and the predicted values are obtained as follows:

a0,y=Clip1((fL[y][0]×A0,−3+fL[y][1]×A−2,0+fL[y][2]×A−1,0+fL[y][3]×A0,0+fL[y][4]×A1,0+fL[y][5]×A2,0+fL[y][6]×A3,0+fL[y][7]×A−4,0+32)>>6)。a0,y=Clip1((fL[y][0]×A0,−3+fL[y][1]×A−2,0+fL[y][2]×A−1,0+fL[ y][3]×A0, 0+fL[y][4]×A1, 0+fL[y][5]×A2, 0+fL[y][6]×A3, 0+fL[y] [7]×A−4, 0+32) >> 6).

具體地,樣本位置ax,y(x=1~15,y=1~15)的預測值的獲取方式如下:Specifically, the acquisition method of the predicted value of the sample position ax, y (x=1~15, y=1~15) is as follows:

ax,y=Clip1((fL[y][0]×a'x,y-3+fL[y][1]×a'x,y-2+fL[y][2]×a'x,y-1+fL[y][3]×a'x,y+fL[y][4]×a'x,y+1+fL[y][5]×a'x,y+2+fL[y][6]×a'x,y+3+fL[y][7]×a'x,y+4+(1<<(19-BitDepth)))>>(20-BitDepth))。ax,y=Clip1((fL[y][0]×a'x,y-3+fL[y][1]×a'x,y-2+fL[y][2]×a'x , y-1+fL[y][3]×a'x, y+fL[y][4]×a'x, y+1+fL[y][5]×a'x, y+2 +fL[y][6]×a'x,y+3+fL[y][7]×a'x,y+4+(1<<(19-BitDepth)))>>(20-BitDepth) )).

其中:in:

a'x,y=(fL[x][0]×A−3,y+fL[x][1]×A−2,y+fL[x][2]×A−1,y+fL[x][3]×A0,y+fL[x][4]×A1,y+fL[x][5]×A2,y+fL[x][6]×A3,y+fL[x][7]×A4,y+((1<<(BitDepth-8))>>1))>>(BitDepth-8)。a'x,y=(fL[x][0]×A−3,y+fL[x][1]×A−2,y+fL[x][2]×A−1,y+fL [x][3]×A0, y+fL[x][4]×A1, y+fL[x][5]×A2, y+fL[x][6]×A3, y+fL[x ][7]×A4,y+((1<<(BitDepth-8))>>1))>>(BitDepth-8).

示例性的,在本申請中,解碼器在確定色度樣本矩陣時,可以先解析位元流獲得色度插值濾波器係數如上述表2所示,然後按照像素位置和樣本位置,計算獲得色度樣本矩陣。Exemplarily, in this application, when the decoder determines the chroma sample matrix, it can first parse the bit stream to obtain the chroma interpolation filter coefficients as shown in Table 2 above, and then calculate and obtain the chroma according to the pixel position and the sample position. Degree sample matrix.

具體地,對於dx等於0或dy等於0的分像素點,可直接用色度整像素插值得到,對於dx不等於0且dy不等於0的點,使用整像素行(dy等於0)上的分像素進行計算: if(dx==0){ ax,y(0,dy)=Clip3(0,(1<<BitDepth)-1,(fC[dy][0]×Ax,y-1+fC[dy][1]×Ax,y+fC[dy][2]×Ax,y+1+fC[dy][3]×Ax,y+2+32)>>6) } else if(dy==0){ ax,y(dx,0)=Clip3(0,(1<<BitDepth)-1,(fC[dx][0]×Ax-1,y+fC[dx][1]×Ax,y+fC[dx][2]×Ax+1,y+fC[dx][3]×Ax+2,y+32)>>6) } else{ ax,y(dx,dy)=Clip3(0,(1<<BitDepth)-1,(C[dy][0]×a'x,y-1(dx,0)+C[dy][1]×a'x,y(dx,0)+C[dy][2]×a'x,y+1(dx,0)+C[dy][3]×a'x,y+2(dx,0)+(1<<(19-BitDepth)))>>(20-BitDepth)) } 其中,a'x,y(dx,0)是整像素行上的分像素的臨時值,定義為:a'x,y(dx,0)=(fC[dx][0]×Ax-1,y+fC[dx][1]×Ax,y+fC[dx][2]×Ax+1,y+fC[dx][3]×Ax+2,y+((1<<(BitDepth-8))>>1))>>(BitDepth-8)。Specifically, for the sub-pixel points where dx is equal to 0 or dy is equal to 0, it can be obtained directly by chrominance integer pixel interpolation. Calculate by pixel: if(dx==0){ ax,y(0,dy)=Clip3(0,(1<<BitDepth)-1,(fC[dy][0]×Ax,y-1+fC[dy][1]×Ax,y+fC [dy][2]×Ax,y+1+fC[dy][3]×Ax,y+2+32)>>6) } else if(dy==0){ ax,y(dx,0)=Clip3(0,(1<<BitDepth)-1,(fC[dx][0]×Ax-1,y+fC[dx][1]×Ax,y+fC [dx][2]×Ax+1, y+fC[dx][3]×Ax+2, y+32) >> 6) } else{ ax,y(dx,dy)=Clip3(0,(1<<BitDepth)-1,(C[dy][0]×a'x,y-1(dx,0)+C[dy][1 ]×a'x,y(dx,0)+C[dy][2]×a'x,y+1(dx,0)+C[dy][3]×a'x,y+2( dx, 0)+(1<<(19-BitDepth)))>>(20-BitDepth)) } where a'x,y(dx,0) is the temporary value of the sub-pixel on the whole pixel row, defined as: a'x,y(dx,0)=(fC[dx][0]×Ax-1 , y+fC[dx][1]×Ax, y+fC[dx][2]×Ax+1, y+fC[dx][3]×Ax+2, y+((1<<(BitDepth- 8))>>1))>>(BitDepth-8).

進一步地,在本申請的實施例中,解碼器在基於像素位置與子塊之間的第一運動向量偏差時,可以先解析位元流,獲取二次預測參數;如果二次預測參數指示使用二次預測,那麼解碼器可以基於值變數確定子塊與每一個像素位置之間的第一運動向量偏差。Further, in the embodiment of the present application, when the decoder is based on the first motion vector deviation between the pixel position and the sub-block, it can first parse the bit stream to obtain the secondary prediction parameter; if the secondary prediction parameter indicates to use Secondary prediction, the decoder can then determine the first motion vector offset between the sub-block and each pixel location based on the value variable.

具體地,在本申請的實施例中,解碼器在基於差值變數確定子塊與每一個像素位置之間的第一運動向量偏差時,可以按照上述步驟S302所提出的方法,根據控制點運動向量組、控制點模式以及當前塊的尺寸參數,確定出dHorX、dVerX、dHorY和dVerY這4個差值變數,然後再利用差值變數進一步確定出子塊中的每一個像素位置所對應的第一運動向量偏差。Specifically, in the embodiment of the present application, when the decoder determines the first motion vector deviation between the sub-block and each pixel position based on the difference variable, the decoder can follow the method proposed in the above step S302 according to the control point motion. The vector group, the control point mode, and the size parameters of the current block, determine the four difference variables of dHorX, dVerX, dHorY, and dVerY, and then use the difference variables to further determine the number of pixels corresponding to each pixel position in the sub-block. A motion vector bias.

示例性的,在本申請中,width和height分別為解碼器獲取的當前塊的寬度和高度,利用子塊尺寸參數所確定出子塊的寬度subwidth和高度subheight。假設(i,j)為子塊內部的任意像素點的座標,其中,i的取值範圍是0~(subwidth-1),j的取值範圍是0~(subheight-1),那麼,可以透過以下方法計算4不同類型的子塊的內部每個像素(i,j)位置的第一運動向量偏差:Exemplarily, in this application, width and height are the width and height of the current block obtained by the decoder, respectively, and the width subwidth and height subheight of the subblock are determined by using the subblock size parameter. Assuming that (i, j) is the coordinate of any pixel inside the sub-block, where the value range of i is 0~(subwidth-1), and the value range of j is 0~(subheight-1), then, we can The first motion vector bias at each pixel (i, j) position inside the 4 different types of sub-blocks is calculated by the following method:

如果子塊是當前塊的左上角的控制點A,那麼(i,j)像素的第一運動向量偏差dMvA[i][j]:If the sub-block is the control point A in the upper left corner of the current block, then the first motion vector deviation dMvA[i][j] of the (i, j) pixel:

dMvA[i][j][0]=dHorX×i+dVerX×jdMvA[i][j][0]=dHorX×i+dVerX×j

dMvA[i][j][1]=dHorY×i+dVerY×j;dMvA[i][j][1]=dHorY×i+dVerY×j;

如果子塊是當前塊的右上角的控制點B,那麼(i,j)像素的第一運動向量偏差dMvB[i][j]:If the sub-block is the control point B in the upper right corner of the current block, then the first motion vector deviation dMvB[i][j] of the (i, j) pixel:

dMvB[i][j][0]=dHorX×(i-subwidth)+dVerX×jdMvB[i][j][0]=dHorX×(i-subwidth)+dVerX×j

dMvB[i][j][1]=dHorY×(i-subwidth)+dVerY×j;dMvB[i][j][1]=dHorY×(i-subwidth)+dVerY×j;

如果子塊是當前塊的左下角的控制點C,控制點運動向量組可以為包括3個運動向量的運動向量組,那麼(i,j)像素的第一運動向量偏差dMvC[i][j]:If the sub-block is the control point C in the lower left corner of the current block, the control point motion vector group may be a motion vector group including 3 motion vectors, then the first motion vector deviation of the (i, j) pixel dMvC[i][j ]:

dMvC[i][j][0]=dHorX×i+dVerX×(j-subheight)dMvC[i][j][0]=dHorX×i+dVerX×(j-subheight)

dMvC[i][j][1]=dHorY×i+dVerY×(j-subheight);dMvC[i][j][1]=dHorY×i+dVerY×(j-subheight);

否則,(i,j)像素的第一運動向量偏差dMvN[i][j]:Otherwise, the first motion vector offset dMvN[i][j] of the (i, j) pixel:

dMvN[i][j][0]=dHorX×(i–(subwidth>>1))+dVerX×(j–(subheight>>1))dMvN[i][j][0]=dHorX×(i–(subwidth>>1))+dVerX×(j–(subheight>>1))

dMvN[i][j][1]=dHorY×(i–(subwidth>>1))+dVerY×(j–(subheight>>1))。dMvN[i][j][1]=dHorY×(i-(subwidth>>1))+dVerY×(j-(subheight>>1)).

其中,dMvX[i][j][0]表示第一運動向量偏差在水平分量的偏差值,dMvX[i][j][1]表示第一運動向量偏差在垂直分量的偏差值。X為A,B,C或N。Wherein, dMvX[i][j][0] represents the deviation value of the first motion vector deviation in the horizontal component, and dMvX[i][j][1] represents the deviation value of the first motion vector deviation in the vertical component. X is A, B, C or N.

可以理解的是,在本申請的實施例中,解碼器在基於差值變數確定子塊與每一個像素位置之間的第一運動向量偏差之後,便可以利用子塊內的全部像素位置對應的全部第一運動向量偏差,構建出該子塊對應的運動向量偏差矩陣。可見,運動向量偏差矩陣中包括有子塊與任意一個內部的像素點之間的運動向量偏差,即第一運動向量偏差。It can be understood that, in the embodiment of the present application, after the decoder determines the first motion vector deviation between the sub-block and each pixel position based on the difference variable, it can use the corresponding data of all pixel positions in the sub-block. All the first motion vector deviations are used to construct a motion vector deviation matrix corresponding to the sub-block. It can be seen that the motion vector deviation matrix includes the motion vector deviation between the sub-block and any internal pixel point, that is, the first motion vector deviation.

進一步地,在本申請的實施例中,如果解碼器解析位元流獲得的二次預測參數指示不使用二次預測,那麼,解碼器可以選擇直接將上述步驟S303a中所獲得的當前塊的子塊的第一預測值作為子塊的第二預測值,而不再進行下述步驟S304和步驟S305的處理。Further, in the embodiment of the present application, if the secondary prediction parameter obtained by the decoder parsing the bit stream indicates that secondary prediction is not used, then the decoder may choose to directly The first predicted value of the block is used as the second predicted value of the sub-block, and the processing of steps S304 and S305 described below is not performed.

具體地,在本申請的實施例中,如果二次預測參數指示不使用二次預測,那麼解碼器可以利用預測樣本矩陣確定出第二預測值。其中,預測樣本矩陣包括多個子塊的第一預測值,解碼器可以將像素位置所在的子塊的第一預測值確定為自身的第二預測值。Specifically, in the embodiment of the present application, if the secondary prediction parameter indicates that secondary prediction is not used, the decoder may determine the second prediction value by using the prediction sample matrix. The prediction sample matrix includes the first prediction values of multiple sub-blocks, and the decoder may determine the first prediction value of the sub-block where the pixel position is located as its own second prediction value.

示例性的,在本申請中,如果當前塊的預測參考模式取值為0或1,即使用第一參考模式‘PRED_List0’,或使用第二參考模式‘PRED_List1’,那麼可以直接從包括有一個亮度預測樣本矩陣和兩個色度預測樣本矩陣的預測樣本矩陣中,選擇像素位置所在的子塊的第一預測值,並將該第一預測值確定為像素位置的幀間預測值,即第二預測值。Exemplarily, in this application, if the prediction reference mode of the current block takes a value of 0 or 1, that is, the first reference mode 'PRED_List0' or the second reference mode 'PRED_List1' is used, it can be directly obtained from including a In the prediction sample matrix of the luminance prediction sample matrix and the two chrominance prediction sample matrices, the first prediction value of the sub-block where the pixel position is located is selected, and the first prediction value is determined as the inter-frame prediction value of the pixel position, that is, the first prediction value is the first prediction value of the pixel position. Two predicted values.

示例性的,在本申請中,如果當前塊的預測參考模式取值為2,即使用第三參考模式‘PRED_List01’,那麼可以先對預測樣本矩陣中所包括的2個亮度預測樣本矩陣(2組共4個色度預測樣本矩陣)進行均值運算,得到1個平均後的亮度預測樣本(2個平均後的色度預測樣本),最後便從這個平均後的亮度預測樣本(2個平均後的色度預測樣本)中,選擇像素位置所在的子塊的第一預測值,並將該第一預測值確定為像素位置的幀間預測值,即第二預測值。Exemplarily, in this application, if the prediction reference mode of the current block is 2, that is, the third reference mode 'PRED_List01' is used, then the two luma prediction sample matrices (2 A total of 4 chrominance prediction sample matrices in the group) are averaged to obtain 1 averaged luminance prediction sample (2 averaged chrominance prediction samples), and finally from the averaged luminance prediction sample (2 averaged In the chroma prediction sample), the first prediction value of the sub-block where the pixel position is located is selected, and the first prediction value is determined as the inter-frame prediction value of the pixel position, that is, the second prediction value.

步驟S304、根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差。Step S304: Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation.

在本申請的實施例中,解碼器在基於第一運動向量分別確定子塊的第一預測值,和子塊中的每一個像素位置與子塊之間的第一運動向量偏差之後,便可以根據第一運動向量偏差每一個像素位置對應的中心位置和第二運動向量偏差。In the embodiment of the present application, after the decoder determines the first prediction value of the sub-block and the first motion vector deviation between each pixel position in the sub-block and the sub-block based on the first motion vector, the decoder can determine the first prediction value according to the first motion vector. The first motion vector offset is the center position corresponding to each pixel position and the second motion vector offset.

需要說明的是,在本申請的實施例中,對於子塊中的每一個像素位置的像素,在進行二次預測或PROF處理時,如果濾波器使用的預設的中心位置與子塊之間的運動向量偏差較大,那麼獲得的預測結果就可能存在較大的誤差,因此,解碼器在確定出每一個像素位置與子塊之間的第一運動向量偏差之後,可以先對每一個像素位置是否適合作為某個像素二次預測或PROF處理時所使用的濾波器的中心位置進行確認,如果不適合,還可以重新進行中心位置的調整。It should be noted that, in the embodiments of the present application, for the pixel at each pixel position in the sub-block, when performing secondary prediction or PROF processing, if the preset center position used by the filter is between the sub-block If the motion vector deviation is large, the obtained prediction results may have large errors. Therefore, after determining the first motion vector deviation between each pixel position and the sub-block, the decoder can Check whether the position is suitable as the center position of the filter used in the secondary prediction of a pixel or PROF processing. If it is not suitable, the center position can be adjusted again.

可以理解的是,在本申請中,一個像素位置對應的中心位置和第二運動向量偏差,可以為對該像素位置進行二次預測或PROF處理時所使用的濾波器的中心位置和運動向量偏差。即中心位置和第二運動向量偏差用於對該像素位置進行二次預測或PROF處理。It can be understood that, in this application, the center position and the second motion vector deviation corresponding to a pixel position can be the center position and the motion vector deviation of the filter used when performing secondary prediction or PROF processing on the pixel position. . That is, the center position and the second motion vector deviation are used to perform secondary prediction or PROF processing on the pixel position.

進一步地,在本申請的實施例中,解碼器根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差的方法可以包括以下步驟:Further, in the embodiment of the present application, the method for the decoder to determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation may include the following steps:

步驟S304a、確定第一運動向量偏差的水平偏差和垂直偏差;Step S304a, determine the horizontal deviation and vertical deviation of the first motion vector deviation;

步驟S304b、根據水平偏差的第一絕對值、垂直偏差的第二絕對值以及預設偏差閾值,確定中心位置和第二運動向量偏差。Step S304b: Determine the center position and the second motion vector deviation according to the first absolute value of the horizontal deviation, the second absolute value of the vertical deviation, and a preset deviation threshold.

在本申請的實施例中,解碼器可以先去確定出第一運動向量偏差在不同方向上的偏差值,即確定出第一運動向量偏差對應的水平偏差和垂直偏差。接著,解碼器可以進一步計算水平偏差的絕對值,即第一絕對值,以及垂直偏差的絕對值,即第二絕對值。最後,解碼器可以根據該第一絕對值、第二絕對值以及預設偏差閾值,進一步確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。In the embodiment of the present application, the decoder may first determine the deviation values of the first motion vector deviation in different directions, that is, determine the horizontal deviation and the vertical deviation corresponding to the first motion vector deviation. Next, the decoder may further calculate the absolute value of the horizontal deviation, ie, the first absolute value, and the absolute value of the vertical deviation, ie, the second absolute value. Finally, the decoder can further determine the center position and the second motion vector deviation used for secondary prediction or PROF processing according to the first absolute value, the second absolute value and the preset deviation threshold.

需要說明的是,在申請的實施例中,解碼器可以將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較,從而可以根據比較結果進行中心位置和第二運動向量偏差的確定。其中,預設偏差閾值可以為預先設置的、用於判斷是否進行中心位置和運動向量偏差的調整。It should be noted that, in the embodiment of the application, the decoder can compare the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, so that the center position and the first absolute value can be determined according to the comparison result. 2. Determination of motion vector bias. The preset deviation threshold may be preset and used to determine whether to adjust the deviation of the center position and the motion vector.

示例性的,在本申請中,預設偏差閾值可以以像素為單元,具體地,預設偏差閾值可以為k個像素;其中,k大於0.5且小於或者等於1。也就是說,可以預先將預設偏差閾值設置為二分之一個像素、四分之三個像素或者一個像素。Exemplarily, in the present application, the preset deviation threshold may be in units of pixels, and specifically, the preset deviation threshold may be k pixels; where k is greater than 0.5 and less than or equal to 1. That is, the preset deviation threshold may be set in advance to be one-half pixel, three-quarter pixel, or one pixel.

進一步,在本申請的實施例中,解碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第一絕對值和第二絕對值均小於預設偏差閾值,那麼可以將第一運動向量偏差確定為第二運動向量偏差,將每一個像素位置確定為中心位置。Further, in the embodiment of the present application, when the decoder determines the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the first absolute value and the second absolute value are both smaller than the preset deviation If the deviation threshold is set, the first motion vector deviation may be determined as the second motion vector deviation, and each pixel position may be determined as the center position.

可以理解的是,在申請的實施例中,解碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第一絕對值和第二絕對值均小於預設偏差,便可以認為像素位置與子塊之間的向量偏差較小,使用該像素位置作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果比較準確,因此,可以直接將該像素位置對應的第一運動向量偏差確定為用於進行二次預測或PROF處理的第二運動向量偏差,同時,可以直接將該像素位置確定為進行二次預測或PROF處理的濾波器所使用的中心位置。It can be understood that, in the embodiment of the application, after the decoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the first absolute value and the second absolute value are If the values are less than the preset deviation, it can be considered that the vector deviation between the pixel position and the sub-block is small, and the prediction result obtained by using the pixel position as the center position of the filter for secondary prediction or PROF processing is more accurate. Therefore, The first motion vector deviation corresponding to the pixel position can be directly determined as the second motion vector deviation used for secondary prediction or PROF processing, and at the same time, the pixel position can be directly determined as the filtering for secondary prediction or PROF processing. the center position used by the device.

進一步,在本申請的實施例中,解碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第一絕對值大於或者等於預設偏差閾值,且第二絕對值小於預設偏差閾值,那麼可以根據水平偏差確定第一調整方向;然後可以根據第一調整方向,確定中心位置和第二運動向量偏差。Further, in the embodiment of the present application, when the decoder determines the deviation between the center position and the second motion vector according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the first absolute value is greater than or equal to the preset deviation threshold, and If the second absolute value is smaller than the preset deviation threshold, the first adjustment direction may be determined according to the horizontal deviation; then, the deviation between the center position and the second motion vector may be determined according to the first adjustment direction.

需要說明的是,在本申請的實施例中,第一調整方向用於對第一運動向量在水平方向上進行調整,因此,第一調整方向包括左側和右側。It should be noted that, in the embodiment of the present application, the first adjustment direction is used to adjust the first motion vector in the horizontal direction. Therefore, the first adjustment direction includes left and right sides.

可以理解的是,在申請的實施例中,解碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第一絕對值大於或者等於預設偏差閾值,且第二絕對值小於預設偏差閾值,便可以認為像素位置與子塊之間在水平方向上的運動向量偏差較大,如果使用該像素作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果可能存在誤差,因此,需要進一步按照水平偏差確定出第一調整方向,然後再根據第一調整方向進行調整,最終便可以確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。It can be understood that, in the embodiment of the application, after the decoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the first absolute value is greater than or equal to the preset deviation threshold If the deviation threshold is set, and the second absolute value is less than the preset deviation threshold, it can be considered that the motion vector deviation in the horizontal direction between the pixel position and the sub-block is relatively large. If the pixel is used as the center position of the filter for secondary prediction Or the prediction results obtained by PROF processing may have errors. Therefore, it is necessary to further determine the first adjustment direction according to the horizontal deviation, and then adjust according to the first adjustment direction, and finally determine the second prediction or PROF processing. Use the center position and the second motion vector offset.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0.75,0),預設偏差閾值為1/2像素時,第一絕對值為0.75,第二絕對值為0,可見,第一絕對值大於預設偏差閾值,第二絕對值小於預設偏差閾值,即該像素位置在水平方向上的運動向量偏差較大,且基於對應的水平偏差0.75可以確定其更靠近右側,因此,可以確定第一調整方向為右側。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0.75, 0), and the preset deviation threshold is 1/2 pixel, the first absolute value is 0.75, and the second absolute value is 0, It can be seen that the first absolute value is greater than the preset deviation threshold, and the second absolute value is smaller than the preset deviation threshold, that is, the motion vector deviation of the pixel position in the horizontal direction is relatively large, and based on the corresponding horizontal deviation of 0.75, it can be determined that it is closer to the right side , therefore, it can be determined that the first adjustment direction is the right side.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(-0.75,0),預設偏差閾值為1/2像素時,第一絕對值為0.75,第二絕對值為0,可見,第一絕對值大於預設偏差閾值,第二絕對值小於預設偏差閾值,即該像素位置在水平方向上的運動向量偏差較大,且基於對應的水平偏差-0.75可以確定其更靠近左側,因此,可以確定第一調整方向為左側。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (-0.75, 0) and the preset deviation threshold is 1/2 pixel, the first absolute value is 0.75, and the second absolute value is 0 , it can be seen that the first absolute value is greater than the preset deviation threshold, and the second absolute value is less than the preset deviation threshold, that is, the motion vector deviation of the pixel position in the horizontal direction is relatively large, and based on the corresponding horizontal deviation -0.75 can be determined to be more It is close to the left side, therefore, it can be determined that the first adjustment direction is the left side.

進一步地,在本申請的實施例中,解碼器在根據第一調整方向,確定中心位置和第二運動向量偏差時,如果第一調整方向為左側,那麼可以將該任一像素位置的相鄰左側像素位置作為中心位置,然後,可以將第一運動向量偏差加(1,0),從而可以獲得對應的第二運動向量偏差。Further, in the embodiment of the present application, when the decoder determines the deviation between the center position and the second motion vector according to the first adjustment direction, if the first adjustment direction is the left side, then the adjacent pixel position of any pixel can be adjusted. The left pixel position is taken as the center position, and then, (1, 0) can be added to the first motion vector deviation, so that the corresponding second motion vector deviation can be obtained.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(-0.75,0),預設偏差閾值為1/2像素時,確定第一調整方向為左側,那麼可以將與該像素位置相鄰的、左側的像素位置作為濾波器使用的中心位置,然後,便可以將對應的第一運動向量偏差(-0.75,0)加(1,0),最終獲得的第二運動向量偏差為(0.25,0)。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (-0.75, 0) and the preset deviation threshold is 1/2 pixel, it is determined that the first adjustment direction is the left side, then the The pixel position adjacent to the pixel position and the left pixel position is used as the center position of the filter. Then, the corresponding first motion vector deviation (-0.75, 0) can be added to (1, 0), and finally the second motion vector can be obtained. The deviation is (0.25, 0).

進一步地,在本申請的實施例中,解碼器在根據第一調整方向,確定中心位置和第二運動向量偏差,如果第一調整方向為右側,那麼可以將任一像素位置的相鄰右側像素位置作為中心位置,然後,可以將第一運動向量偏差減(1,0),從而可以獲得第二運動向量偏差。Further, in the embodiment of the present application, the decoder determines the deviation between the center position and the second motion vector according to the first adjustment direction. If the first adjustment direction is the right side, then the adjacent right pixel of any pixel position can be adjusted. The position is taken as the center position, and then the first motion vector deviation can be subtracted by (1, 0), so that the second motion vector deviation can be obtained.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0.75,0),預設偏差閾值為1/2像素時,確定第一調整方向為右側,那麼可以將與該像素位置相鄰的、右側的像素位置作為濾波器使用的中心位置,然後,便可以將對應的第一運動向量偏差(0.75,0)減(1,0),最終獲得的第二運動向量偏差為(-0.25,0)。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0.75, 0) and the preset deviation threshold is 1/2 pixel, it is determined that the first adjustment direction is the right side, then the The pixel position of the adjacent and right side is used as the center position of the filter. Then, the corresponding first motion vector deviation (0.75, 0) can be subtracted by (1, 0), and the final obtained second motion vector deviation is (-0.25, 0).

進一步,在本申請的實施例中,解碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第二絕對值大於或者等於預設偏差閾值,且第一絕對值小於預設偏差閾值,那麼可以根據垂直偏差確定第二調整方向;然後可以根據第二調整方向,確定中心位置和第二運動向量偏差。Further, in the embodiment of the present application, when the decoder determines the deviation between the center position and the second motion vector according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the second absolute value is greater than or equal to the preset deviation threshold, and If the first absolute value is smaller than the preset deviation threshold, the second adjustment direction may be determined according to the vertical deviation; then the center position and the second motion vector deviation may be determined according to the second adjustment direction.

需要說明的是,在本申請的實施例中,第二調整方向用於對第一運動向量在垂直方向上進行調整,因此,第二調整方向包括上側和下側。It should be noted that, in the embodiment of the present application, the second adjustment direction is used to adjust the first motion vector in the vertical direction. Therefore, the second adjustment direction includes an upper side and a lower side.

可以理解的是,在申請的實施例中,解碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第二絕對值大於或者等於預設偏差閾值,且第一絕對值小於預設偏差閾值,便可以認為像素位置與子塊之間在垂直方向上的運動向量偏差較大,如果使用該像素作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果可能存在誤差,因此,需要進一步按照垂直偏差確定出第二調整方向,然後再根據第二調整方向進行調整,最終便可以確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。It can be understood that, in the embodiment of the application, after the decoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the second absolute value is greater than or equal to the preset deviation threshold If the deviation threshold is set, and the first absolute value is smaller than the preset deviation threshold, it can be considered that the deviation of the motion vector in the vertical direction between the pixel position and the sub-block is relatively large. If the pixel is used as the center position of the filter for secondary prediction Or the prediction results obtained by PROF processing may have errors. Therefore, it is necessary to further determine the second adjustment direction according to the vertical deviation, and then adjust according to the second adjustment direction. Finally, it can be determined that the second adjustment direction is used for secondary prediction or PROF processing. Use the center position and the second motion vector offset.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0,0.75),預設偏差閾值為1/2像素時,第二絕對值為0.75,第一絕對值為0,可見,第二絕對值大於預設偏差閾值,第一絕對值小於預設偏差閾值,即該像素位置在垂直方向上的運動向量偏差較大,且基於對應的垂直偏差0.75可以確定其更靠近下側,因此,可以確定第二調整方向為下側。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0, 0.75), and the preset deviation threshold is 1/2 pixel, the second absolute value is 0.75, and the first absolute value is 0, It can be seen that the second absolute value is greater than the preset deviation threshold, and the first absolute value is smaller than the preset deviation threshold, that is, the motion vector deviation of the pixel position in the vertical direction is relatively large, and based on the corresponding vertical deviation of 0.75, it can be determined that it is closer to the bottom. Therefore, it can be determined that the second adjustment direction is the lower side.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0,-0.75),預設偏差閾值為1/2像素時,第二絕對值為0.75,第一絕對值為0,可見,第二絕對值大於預設偏差閾值,第一絕對值小於預設偏差閾值,即該像素位置在垂直方向上的運動向量偏差較大,且基於對應的垂直偏差-0.75可以確定其更靠近上側,因此,可以確定第二調整方向為上側。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0, -0.75), and the preset deviation threshold is 1/2 pixel, the second absolute value is 0.75, and the first absolute value is 0 , it can be seen that the second absolute value is greater than the preset deviation threshold, and the first absolute value is smaller than the preset deviation threshold, that is, the motion vector deviation of the pixel position in the vertical direction is relatively large, and based on the corresponding vertical deviation -0.75, it can be determined that its more Close to the upper side, therefore, it can be determined that the second adjustment direction is the upper side.

進一步地,在本申請的實施例中,解碼器在根據第二調整方向,確定中心位置和第二運動向量偏差時,如果第二調整方向為上側,那麼可以將該任一像素位置的相鄰上側像素位置作為中心位置,然後,可以將第一運動向量偏差加(0,1),從而可以獲得對應的第二運動向量偏差。Further, in the embodiment of the present application, when the decoder determines the deviation between the center position and the second motion vector according to the second adjustment direction, if the second adjustment direction is the upper side, then the adjacent pixel position of any pixel can be adjusted. The upper pixel position is taken as the center position, and then (0, 1) can be added to the first motion vector deviation, so that the corresponding second motion vector deviation can be obtained.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0,-0.75),預設偏差閾值為1/2像素時,確定第二調整方向為上側,那麼可以將與該像素位置相鄰的、上側的像素位置作為濾波器使用的中心位置,然後,便可以將對應的第一運動向量偏差(0,-0.75)加(0,1),最終獲得的第二運動向量偏差為(0,0.25)。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0, -0.75) and the preset deviation threshold is 1/2 pixel, it is determined that the second adjustment direction is the upper side, then the The pixel position on the upper side adjacent to the pixel position is used as the center position of the filter. Then, the corresponding first motion vector deviation (0, -0.75) can be added to (0, 1), and finally the second motion vector is obtained. The deviation is (0, 0.25).

進一步地,在本申請的實施例中,解碼器在根據第二調整方向,確定中心位置和第二運動向量偏差,如果第二調整方向為下側,那麼可以將任一像素位置的相鄰下側像素位置作為中心位置,然後,可以將第一運動向量偏差減(0,1),從而可以獲得第二運動向量偏差。Further, in the embodiment of the present application, the decoder determines the deviation between the center position and the second motion vector according to the second adjustment direction. If the second adjustment direction is the lower side, then the adjacent lower side of any pixel position can be adjusted. The side pixel position is taken as the center position, and then, the first motion vector offset can be subtracted by (0, 1), so that the second motion vector offset can be obtained.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0,0.75),預設偏差閾值為1/2像素時,確定第二調整方向為下側,那麼可以將與該像素位置相鄰的、下側的像素位置作為濾波器使用的中心位置,然後,便可以將對應的第一運動向量偏差(0,0.75)減(0,1),最終獲得的第二運動向量偏差為(0,0.25)。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0, 0.75) and the preset deviation threshold is 1/2 pixel, it is determined that the second adjustment direction is the lower side, then the The pixel position adjacent to the pixel position and the lower side pixel position is used as the center position of the filter. Then, the corresponding first motion vector deviation (0, 0.75) can be subtracted by (0, 1), and finally the second motion vector can be obtained. The deviation is (0, 0.25).

進一步,在本申請的實施例中,解碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第一絕對值和第二絕對值均大於或者等於預設偏差閾值,那麼可以根據水平偏差和垂直偏差確定第三調整方向;然後可以根據第三調整方向,確定中心位置和第二運動向量偏差。Further, in the embodiment of the present application, when the decoder determines the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the first absolute value and the second absolute value are both greater than or equal to If the deviation threshold is preset, the third adjustment direction may be determined according to the horizontal deviation and the vertical deviation; and then the center position and the deviation of the second motion vector may be determined according to the third adjustment direction.

需要說明的是,在本申請的實施例中,第三調整方向用於對第一運動向量在水平方向和垂直方向上同時進行調整,因此,第三調整方向包括右上側、右下側、左上側以及左下側。It should be noted that, in the embodiment of the present application, the third adjustment direction is used to adjust the first motion vector in the horizontal direction and the vertical direction at the same time. Therefore, the third adjustment direction includes the upper right side, the lower right side, the upper left side side and lower left.

可以理解的是,在申請的實施例中,解碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第一絕對值和第二絕對值都大於或者等於預設偏差閾值,便可以認為像素位置與子塊之間在水平方向和垂直方向上的運動向量偏差均較大,如果使用該像素作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果可能存在誤差,因此,需要進一步按照水平偏差和垂直偏差確定出第三調整方向,然後再根據第三調整方向進行調整,最終便可以確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。It can be understood that, in the embodiment of the application, after the decoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the first absolute value and the second absolute value are If the value is greater than or equal to the preset deviation threshold, it can be considered that the deviation of the motion vector between the pixel position and the sub-block in the horizontal and vertical directions is large. If the pixel is used as the center position of the filter for secondary prediction or There may be errors in the prediction results obtained by PROF processing. Therefore, it is necessary to further determine the third adjustment direction according to the horizontal deviation and vertical deviation, and then adjust according to the third adjustment direction. Finally, it can be determined to perform secondary prediction or PROF processing. The center position and the second motion vector offset used when .

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0.75,0.75),預設偏差閾值為1/2像素時,第一絕對值為0.75,第二絕對值為0.75,可見,第一絕對值和第二絕對值均大於預設偏差閾值,即該像素位置在水平方向和垂直方向上的運動向量偏差較大,且基於對應的水平偏差0.75可以確定其更靠近右側,同時,基於對應的垂直偏差0.75可以確定其更靠近下側,因此,可以確定第三調整方向為右下側。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0.75, 0.75), and the preset deviation threshold is 1/2 pixel, the first absolute value is 0.75, and the second absolute value is 0.75, It can be seen that both the first absolute value and the second absolute value are greater than the preset deviation threshold, that is, the motion vector deviation of the pixel position in the horizontal direction and the vertical direction is relatively large, and based on the corresponding horizontal deviation of 0.75, it can be determined that it is closer to the right side, Meanwhile, based on the corresponding vertical deviation of 0.75, it can be determined that it is closer to the lower side, therefore, it can be determined that the third adjustment direction is the lower right side.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(-0.75,-0.75),預設偏差閾值為1/2像素時,第一絕對值為-0.75,第二絕對值為-0.75,可見,第一絕對值和第二絕對值均大於預設偏差閾值,即該像素位置在水平方向和垂直方向上的運動向量偏差較大,且基於對應的水平偏差-0.75可以確定其更靠近左側,同時,基於對應的垂直偏差-0.75可以確定其更靠近上側,因此,可以確定第三調整方向為左上側。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (-0.75, -0.75), and the preset deviation threshold is 1/2 pixel, the first absolute value is -0.75, and the second absolute value is -0.75. is -0.75, it can be seen that the first absolute value and the second absolute value are both greater than the preset deviation threshold, that is, the motion vector deviation of the pixel position in the horizontal and vertical directions is relatively large, and can be determined based on the corresponding horizontal deviation -0.75 It is closer to the left side, and at the same time, it can be determined that it is closer to the upper side based on the corresponding vertical deviation -0.75, therefore, it can be determined that the third adjustment direction is the upper left side.

進一步地,在本申請的實施例中,解碼器在根據第三調整方向,確定中心位置和第二運動向量偏差時,如果第三調整方向為左上側,那麼可以將該任一像素位置的相鄰左上側像素位置作為中心位置,然後,可以將第一運動向量偏差加(1,1),從而可以獲得對應的第二運動向量偏差。Further, in the embodiment of the present application, when the decoder determines the deviation between the center position and the second motion vector according to the third adjustment direction, if the third adjustment direction is the upper left side, then the phase difference of any pixel position can be determined. The pixel position adjacent to the upper left side is taken as the center position, and then, (1, 1) can be added to the first motion vector deviation, so that the corresponding second motion vector deviation can be obtained.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(-0.75,-0.75),預設偏差閾值為1/2像素時,確定第三調整方向為左上側,那麼可以將與該像素位置相鄰的、左上側的像素位置作為濾波器使用的中心位置,然後,便可以將對應的第一運動向量偏差(-0.75,-0.75)加(1,1),最終獲得的第二運動向量偏差為(0.25,0.25)。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (-0.75, -0.75), and the preset deviation threshold is 1/2 pixel, it is determined that the third adjustment direction is the upper left side, then the The pixel position on the upper left side adjacent to the pixel position is used as the center position of the filter, and then the corresponding first motion vector deviation (-0.75, -0.75) can be added (1, 1), and finally obtained The second motion vector bias is (0.25, 0.25).

進一步地,在本申請的實施例中,解碼器在根據第三調整方向,確定中心位置和第二運動向量偏差,如果第三調整方向為右下側,那麼可以將任一像素位置的相鄰右下側像素位置作為中心位置,然後,可以將第一運動向量偏差減(1,1),從而可以獲得第二運動向量偏差。Further, in the embodiment of the present application, the decoder determines the deviation between the center position and the second motion vector according to the third adjustment direction. If the third adjustment direction is the lower right side, then the adjacent pixel position of any pixel The pixel position on the lower right side is taken as the center position, and then, the first motion vector deviation can be subtracted by (1, 1), so that the second motion vector deviation can be obtained.

示例性的,在本申請中,當像素位置的第一運動向量偏差為(0.75,0.75),預設偏差閾值為1/2像素時,確定第三調整方向為右下側,那麼可以將與該像素位置相鄰的、右下側的像素位置作為濾波器使用的中心位置,然後,便可以將對應的第一運動向量偏差(0.75,0.75)減(1,1),最終獲得的第二運動向量偏差為(-0.25,-0.25)。Exemplarily, in this application, when the first motion vector deviation of the pixel position is (0.75, 0.75), and the preset deviation threshold is 1/2 pixel, it is determined that the third adjustment direction is the lower right side, then it can be combined with The pixel position adjacent to the pixel position on the lower right side is used as the center position of the filter. Then, the corresponding first motion vector deviation (0.75, 0.75) can be subtracted by (1, 1), and finally the second The motion vector bias is (-0.25, -0.25).

可以理解的是,在本申請的實施例中,第二運動向量偏差在水平方向和垂直方向上的偏差值均小於預設偏差閾值。It can be understood that, in the embodiment of the present application, the deviation values of the second motion vector deviation in the horizontal direction and the vertical direction are both smaller than the preset deviation threshold.

也就是說,在本申請中,解碼器在確定出子塊中的每一個像素位置的運動向量與子塊的運動向量的偏差之後,且在對基於子塊的預測的預測塊進行濾波之前,可以先進行中心位置和第二運動向量偏差的確定,其中,中心位置和第二運動向量用於進行二次預測或PROF處理。That is, in the present application, after the decoder determines the deviation of the motion vector of each pixel position in the sub-block from the motion vector of the sub-block, and before filtering the prediction block based on the prediction of the sub-block, The center position and the second motion vector deviation may be determined first, wherein the center position and the second motion vector are used for secondary prediction or PROF processing.

具體地,在本申請中,對於子塊中的每一個像素位置,可以先確定其與子塊之間的第一運動向量偏差的大小,其中包括第一運動向量偏差在水平方向和垂直方向上的水平偏差和垂直偏差。如果某個像素位置的運動向量偏差的水平方向和/或垂直方向的絕對值大於預設偏差閾值,那麼可以確定該像素位置對應的濾波器的中心位置不再是該像素位置本身,而需要進一步對中心位置和第二運動向量偏差進行確定。Specifically, in this application, for each pixel position in a sub-block, the magnitude of the first motion vector deviation between it and the sub-block can be determined first, including the horizontal and vertical directions of the first motion vector deviation horizontal and vertical deviations. If the absolute value of the horizontal direction and/or the vertical direction of the motion vector deviation of a certain pixel position is greater than the preset deviation threshold, it can be determined that the center position of the filter corresponding to the pixel position is no longer the pixel position itself, and further The center position and the second motion vector offset are determined.

示例性的,在本申請中,假設前像素位置為CURRENT,相應地,當前像素位置在水平方向左側的像素位置為LEFT,則LEFT為CURRENT的座標加上(-1,0);當前像素位置在水平方向右側的像素位置為RIGHT,則RIGHT為CURRENT的座標加上(1,0);當前像素位置在垂直方向上側的像素位置為UP,則UP為CURRENT的座標加上(0,-1);當前像素位置在垂直方向下側的像素位置為DOWN,則DOWN為CURRENT的座標加上(0,1);當前像素位置左上側的像素位置為UPLEFT,則UPLEFT為CURRENT的座標加上(-1,-1);當前像素位置右上側的像素位置為UPRIGHT,則UPRIGHT為CURRENT的座標加上(1,-1);當前像素位置左下側的像素位置為DOWNLEFT,則DOWNLEFT為CURRENT的座標加上(-1,1);當前像素位置右下側的像素位置為DOWNRIGHT,則DOWNRIGHT為CURRENT的座標加上(1,1)。Exemplarily, in this application, it is assumed that the previous pixel position is CURRENT, correspondingly, the pixel position of the current pixel position on the left side of the horizontal direction is LEFT, then LEFT is the coordinate of CURRENT plus (-1, 0); the current pixel position The pixel position on the right side of the horizontal direction is RIGHT, then RIGHT is the coordinate of CURRENT plus (1, 0); the pixel position of the current pixel position on the upper side of the vertical direction is UP, then UP is the coordinate of CURRENT plus (0, -1) ); the pixel position of the current pixel position on the lower side of the vertical direction is DOWN, then DOWN is the coordinate of CURRENT plus (0, 1); the pixel position of the upper left of the current pixel position is UPLEFT, then UPLEFT is the coordinate of CURRENT plus ( -1, -1); the pixel position on the upper right side of the current pixel position is UPRIGHT, then UPRIGHT is the coordinate of CURRENT plus (1, -1); the pixel position on the lower left side of the current pixel position is DOWNLEFT, then DOWNLEFT is the coordinate of CURRENT Add (-1, 1); the pixel position on the lower right side of the current pixel position is DOWNRIGHT, then DOWNRIGHT is the coordinate of CURRENT plus (1, 1).

進一步地,在本申請的實施例中,在對子塊中的一個像素位置進行二次預測或PROF處理之前,如果確定該像素位置與子塊之間的第一運動向量偏差在水平方向和\或垂直方向的偏差分量的絕對值大於或者等於預設偏差閾值(如1/2像素、3/4像素或1像素),那麼便需要對二次預測或PROF處理所使用的起始點進行調整,即二次預測或PROF處理所使用的二維濾波器的中心位置進行調整。Further, in the embodiment of the present application, before performing secondary prediction or PROF processing on a pixel position in the sub-block, if it is determined that the first motion vector deviation between the pixel position and the sub-block is in the horizontal direction and \ Or the absolute value of the deviation component in the vertical direction is greater than or equal to the preset deviation threshold (such as 1/2 pixel, 3/4 pixel or 1 pixel), then the starting point used for secondary prediction or PROF processing needs to be adjusted. , that is, the center position of the two-dimensional filter used in secondary prediction or PROF processing is adjusted.

可以理解的是,在本申請中,在對中心位置和運動向量偏差進行調整時,可以在當前塊中選擇該與像素位置在水平方向和垂直方向上的運動向量偏差均小於或者等於預設偏差閾值的另一個像素位置。It can be understood that, in this application, when adjusting the center position and the motion vector deviation, it can be selected in the current block that the motion vector deviation from the pixel position in the horizontal direction and the vertical direction is less than or equal to the preset deviation. Another pixel location for the threshold.

示例性的,在本申請中,如果子塊中的當前像素位置的運動向量與子塊的運動向量的第一運動向量偏差是(0.75,0),預設偏差閾值為1/2像素,那麼可以使用當前像素位置CURRENT的右側的像素位置,即RIGHT作為當前像素位置的二次預測的起始位置,即二維濾波器的中心位置。相應地,在調整了二次預測的起始位置之後,對應地需要調整第一運動向量偏差,具體地,可以按照當前像素位置的運動向量與中心位置的運動向量之間的偏差確定第二運動向量偏差。例如,由於起始位置由CURRENT調整到了RIGHT,第一運動向量偏差需要減去(1,0),那麼調整後的第二運動向量偏差是(-0.25,0)。Exemplarily, in this application, if the first motion vector deviation between the motion vector of the current pixel position in the sub-block and the motion vector of the sub-block is (0.75, 0), and the preset deviation threshold is 1/2 pixel, then The pixel position to the right of the current pixel position CURRENT, that is, RIGHT, can be used as the starting position of the secondary prediction of the current pixel position, that is, the center position of the two-dimensional filter. Correspondingly, after adjusting the starting position of the secondary prediction, the deviation of the first motion vector needs to be adjusted accordingly. Specifically, the second motion can be determined according to the deviation between the motion vector at the current pixel position and the motion vector at the center position. Vector bias. For example, since the starting position is adjusted to RIGHT from CURRENT, the first motion vector offset needs to be subtracted by (1, 0), then the adjusted second motion vector offset is (-0.25, 0).

示例性的,在本申請中,如果子塊中的當前像素位置的運動向量與子塊的運動向量的第一運動向量偏差是(0.75,0.75),預設偏差閾值為1/2像素,那麼可以使用當前像素位置CURRENT的右下側的像素位置,即DOWNRIGHT作為當前像素位置的PROF處理的起始位置,即一維濾波器的中心位置。相應地,在調整了二次預測的起始位置之後,對應地需要調整第一運動向量偏差,具體地,可以按照當前像素位置的運動向量與中心位置的運動向量之間的偏差確定第二運動向量偏差。例如,由於起始位置由CURRENT調整到了DOWNRIGHT,第一運動向量偏差需要減去(1,1),那麼調整後的第二運動向量偏差是(-0.25,-0.25)。Exemplarily, in this application, if the first motion vector deviation between the motion vector of the current pixel position in the sub-block and the motion vector of the sub-block is (0.75, 0.75), and the preset deviation threshold is 1/2 pixel, then The pixel position on the lower right side of the current pixel position CURRENT, that is, DOWNRIGHT, can be used as the starting position of PROF processing of the current pixel position, that is, the center position of the one-dimensional filter. Correspondingly, after adjusting the starting position of the secondary prediction, the deviation of the first motion vector needs to be adjusted accordingly. Specifically, the second motion can be determined according to the deviation between the motion vector at the current pixel position and the motion vector at the center position. Vector bias. For example, since the starting position is adjusted from CURRENT to DOWNRIGHT, the first motion vector deviation needs to be subtracted by (1, 1), then the adjusted second motion vector deviation is (-0.25, -0.25).

基於上述圖9,圖13為中心位置的示意圖三,如圖13所示,dmv_x0和dmv_y0都大於二分之一像素,可以看出離圓形最近的是座標為(2,2)的正方形2的像素位置,如果把基準位置也就是濾波器的中心位置設置在這個位置上,可以認為獲得的預測結果比原來的更精確。調整後的運動向量偏差為(dmv_x,dmv_y),dmv_x的絕對值比dmv_x0要小,dmv_y的絕對值比dmv_y0要小。圖中虛線框表示調整前的濾波器使用的像素位置,圖中的實線框表示調整後的濾波器使用的像素位置。Based on the above Figure 9, Figure 13 is a schematic diagram of the center position. As shown in Figure 13, both dmv_x0 and dmv_y0 are greater than one-half of a pixel. It can be seen that the closest to the circle is the square 2 with the coordinates (2, 2). If the reference position, that is, the center position of the filter, is set at this position, it can be considered that the obtained prediction result is more accurate than the original one. The adjusted motion vector deviation is (dmv_x, dmv_y), the absolute value of dmv_x is smaller than dmv_x0, and the absolute value of dmv_y is smaller than dmv_y0. The dotted box in the figure represents the pixel position used by the filter before adjustment, and the solid line box in the figure represents the pixel position used by the filter after adjustment.

在本申請的實施例中,進一步地,圖14為幀間預測方法的實現流程示意圖二,如圖14所示,在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之前,即步驟S304之前,解碼器進行幀間預測的方法還可以包括以下步驟:In the embodiment of the present application, further, FIG. 14 is a schematic diagram 2 of the implementation flow of the inter-frame prediction method. As shown in FIG. 14 , the center position and the second motion corresponding to each pixel position are determined according to the first motion vector deviation. Before the vector deviation, that is, before step S304, the method for performing inter-frame prediction by the decoder may further include the following steps:

步驟S306、按照預設偏差範圍對第一運動向量偏差進行限制處理;其中,預設偏差範圍包括偏差下限值和偏差上限值。Step S306 , performing limiting processing on the deviation of the first motion vector according to a preset deviation range, wherein the preset deviation range includes a deviation lower limit value and a deviation upper limit value.

在本申請的實施例中,解碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之前,可以先對第一運動向量進行限制。具體地,解碼器可以按照預設偏差範圍對第一運動向量偏差進行限制處理;其中,預設偏差範圍包括偏差下限值和偏差上限值。In the embodiment of the present application, before determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the decoder may first limit the first motion vector. Specifically, the decoder may limit the deviation of the first motion vector according to a preset deviation range, wherein the preset deviation range includes a lower deviation value and an upper deviation value.

進一步地,在本申請的實施例中,解碼器按照預設偏差範圍對第一運動向量偏差進行限制處理時,如果水平偏差和\或垂直偏差小於偏差下限值,那麼可以將水平偏差和\或垂直偏差設置為偏差下限值;如果水平偏差和\或垂直偏差大於偏差上限值,那麼可以將水平偏差和\或垂直偏差設置為偏差上限值。Further, in the embodiment of the present application, when the decoder performs limiting processing on the first motion vector deviation according to the preset deviation range, if the horizontal deviation and/or the vertical deviation are less than the lower limit value of the deviation, then the horizontal deviation and \ Or vertical deviation is set as the lower deviation value; if the horizontal deviation and\or vertical deviation is greater than the upper deviation value, then the horizontal deviation and\or vertical deviation can be set as the upper deviation value.

需要說明的是,在本申請中,解碼器既可以不對第一運動向量偏差進行限制,即不進行步驟S306,而是直接根據第一運動向量偏差將中心位置調整到任何合適的像素位置。也可以先按照步驟S306執行對第一運動向量偏差的限制處理,或者是對可調整的範圍及運動向量偏差進行限制。It should be noted that, in this application, the decoder may not limit the first motion vector deviation, that is, without performing step S306, but directly adjust the center position to any suitable pixel position according to the first motion vector deviation. It is also possible to first execute the limitation process on the first motion vector deviation according to step S306, or to limit the adjustable range and the motion vector deviation.

進一步地,在本申請的實施例中,預設偏差範圍可以由偏差下限值min和偏差上限值max構成,即預設偏差範圍可以表示為(min,max),在對第一運動向量偏差進行限制處理時,如果第一運動向量偏差的水平方向和\或垂直方向的偏差值小於偏差下限值min,那麼可以直接將該偏差值設為min;如果第一運動向量偏差的水平方向和\或垂直方向的偏差值大於max,那麼可以直接將該偏差值設為max。Further, in the embodiment of the present application, the preset deviation range may be composed of a lower deviation limit min and an upper deviation upper limit max, that is, the preset deviation range may be expressed as (min, max), and when the first motion vector When the deviation is limited, if the deviation value of the horizontal direction and/or vertical direction of the first motion vector deviation is less than the deviation lower limit value min, then the deviation value can be directly set as min; if the horizontal direction of the first motion vector deviation And \ or the deviation value in the vertical direction is greater than max, then you can directly set the deviation value to max.

示例性的,在本申請中,假設上限值max為1,即限制第一運動向量偏差為1個像素,如果第一運動向量偏差的水平方向和\或垂直方向的偏差值的絕對值(第一絕對值和\或第二絕對值)大於1,則將第一運動向量偏差的水平方向和\或垂直方向的偏差值的絕對值設置為1個像素。Exemplarily, in this application, it is assumed that the upper limit value max is 1, that is, the first motion vector deviation is limited to 1 pixel. If the first absolute value and \ or the second absolute value) are greater than 1, the absolute value of the horizontal direction and \ or vertical direction of the deviation of the first motion vector is set to 1 pixel.

在本申請的實施例中,進一步地,圖15為幀間預測方法的實現流程示意圖三,如圖15所示,在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,即步驟S304之後,解碼器進行幀間預測的方法還可以包括以下步驟:In the embodiment of the present application, further, FIG. 15 is a schematic diagram 3 of the implementation flow of the inter-frame prediction method. As shown in FIG. 15 , the center position and the second motion corresponding to each pixel position are determined according to the first motion vector deviation. After the vector deviation, that is, after step S304, the method for performing inter-frame prediction by the decoder may further include the following steps:

步驟S307、若中心位置不屬於當前塊,則按照當前塊中的像素位置重新確定中心位置。Step S307, if the center position does not belong to the current block, re-determine the center position according to the pixel position in the current block.

在本申請的實施例中,解碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,可以先對中心位置是否超出了當前塊進行確定,如果中心位置超出了當前塊的範圍,即中心位置不屬於當前塊,那麼解碼器便需要按照當前塊中的像素位置重新確定中心位置。In the embodiment of the present application, after determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the decoder may first determine whether the center position exceeds the current block, if the center position If it exceeds the range of the current block, that is, the center position does not belong to the current block, the decoder needs to re-determine the center position according to the pixel position in the current block.

在本申請的實施例中,進一步地,圖16為幀間預測方法的實現流程示意圖四,如圖16所示,在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,即步驟S304之後,解碼器進行幀間預測的方法還可以包括以下步驟:In the embodiment of the present application, further, FIG. 16 is a schematic diagram of the implementation flow of the inter-frame prediction method. As shown in FIG. 16 , the center position and the second motion corresponding to each pixel position are determined according to the first motion vector deviation. After the vector deviation, that is, after step S304, the method for performing inter-frame prediction by the decoder may further include the following steps:

步驟S308、若中心位置不屬於當前塊,則直接將每一個像素位置確定為每一個像素位置對應的中心位置。Step S308: If the center position does not belong to the current block, directly determine each pixel position as the center position corresponding to each pixel position.

在本申請的實施例中,解碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,可以先對中心位置是否超出了當前塊進行確定,如果中心位置超出了當前塊的範圍,即中心位置不屬於當前塊,那麼解碼器可以直接將對應的、原始的像素位置確定為中心位置。即基於子塊中的每一個像素位置對應的第一運動向量偏差所確定的中心位置如果超出了當前塊的範圍,那麼解碼器可以選擇任然將該每一個像素位置作為中心位置。In the embodiment of the present application, after determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the decoder may first determine whether the center position exceeds the current block, if the center position If it exceeds the range of the current block, that is, the center position does not belong to the current block, the decoder can directly determine the corresponding, original pixel position as the center position. That is, if the center position determined based on the first motion vector deviation corresponding to each pixel position in the sub-block exceeds the range of the current block, the decoder may choose to still use the position of each pixel as the center position.

也就是說,在本申請的實施例中,對於調整後的二次預測的起始位置,即基於第一運動向量偏差所確定的濾波器使用的中心位置,解碼器可以限制該中心位置不超過當前塊的範圍,即不會超過當前塊中的所有像素位置在調整前的二次預測的起始位置的範圍。That is to say, in the embodiment of the present application, for the starting position of the adjusted secondary prediction, that is, the center position used by the filter determined based on the first motion vector deviation, the decoder can limit the center position to no more than The range of the current block, that is, will not exceed the range of the starting positions of all pixel positions in the current block before the adjustment of the secondary prediction.

步驟S305、基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值。Step S305 , based on the first predicted value, perform secondary prediction or PROF processing according to the center position and the second motion vector deviation, determine the second predicted value of the subblock, and determine the second predicted value as the inter-frame predicted value of the subblock.

在本申請的實施例中,解碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,便可以基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,從而可以獲得每一個像素位置的像素的預測值。In the embodiment of the present application, after the decoder determines the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the decoder can determine the center position and the second motion vector deviation based on the first predicted value. The deviation is subjected to secondary prediction or PROF processing, so that the predicted value of the pixel at each pixel position can be obtained.

進一步地,在本申請的實施例中,解碼器在遍歷子塊中的每一個像素位置,獲得每一個像素位置的像素的預測值之後,便可以根據每一個像素位置的像素的預測值確定出子塊的第二預測值,從而可以將第二預測值確定為子塊的幀間預測值。Further, in the embodiment of the present application, after traversing each pixel position in the sub-block and obtaining the predicted value of the pixel at each pixel position, the decoder can determine the predicted value of the pixel at each pixel position according to the predicted value of the pixel at each pixel position. the second predicted value of the sub-block, so that the second predicted value can be determined as the inter-frame predicted value of the sub-block.

需要說明的是,在本申請的實施例中,由於中心位置和第二運動向量偏差可以用於對子塊中的每一個像素位置的像素點進行二次預測或PROF處理,因此,在獲得中心位置和第二運動向量偏差以後,解碼器可以基於第一預測值,利用中心位置和第二運動向量偏差對每一個像素位置的像素點進行二次預測或PROF處理,最終可以獲得子塊對應的第二預測值,從而便可以將第二預測值確定為子塊的幀間預測值。It should be noted that, in the embodiments of the present application, since the center position and the second motion vector deviation can be used to perform secondary prediction or PROF processing on the pixel points of each pixel position in the sub-block, therefore, after obtaining the center After the position and the second motion vector deviation, the decoder can use the center position and the second motion vector deviation to perform secondary prediction or PROF processing on the pixels of each pixel position based on the first predicted value, and finally obtain the corresponding sub-block. the second predicted value, so that the second predicted value can be determined as the inter-frame predicted value of the sub-block.

進一步地,在本申請的實施例中,解碼器基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值的方法可以包括以下步驟:Further, in the embodiments of the present application, the decoder performs secondary prediction or PROF processing according to the center position and the second motion vector deviation based on the first predicted value, determines the second predicted value of the sub-block, and converts the second predicted value to the second predicted value. The method of determining an inter-predicted value for a sub-block may include the following steps:

步驟S305a、解析位元流,獲取PROF參數;Step S305a, parsing the bit stream to obtain PROF parameters;

步驟S305b、當PROF參數指示進行PROF處理時,基於第一預測值確定中心位置對應的像素水平梯度和像素垂直梯度;Step S305b, when the PROF parameter indicates that PROF processing is performed, the pixel horizontal gradient and the pixel vertical gradient corresponding to the center position are determined based on the first predicted value;

步驟S305c、根據像素水平梯度、像素垂直梯度以及第二運動向量偏差,計算每一個像素位置對應的偏差值;Step S305c, calculate the deviation value corresponding to each pixel position according to the pixel horizontal gradient, the pixel vertical gradient and the second motion vector deviation;

步驟S305d、基於第一預測值和偏差值,獲得每一個像素位置的像素的預測值;Step S305d, based on the first predicted value and the deviation value, obtain the predicted value of the pixel of each pixel position;

步驟S305e、利用每一個像素位置的像素的預測值,確定第二預測值。Step S305e, using the predicted value of the pixel at each pixel position to determine the second predicted value.

在本申請的實施例中,解碼器可以先解析位元流,獲得PROF參數,如果PROF參數指示進行PROF處理,那麼解碼器可以基於第一預測值確定中心位置對應的像素水平梯度和像素垂直梯度;其中,像素水平梯度即為中心位置對應的像素值與水平方向上的、相鄰像素位置對應的像素值之間的梯度值;像素垂直梯度即為中心位置對應的像素值與垂直方向上的、相鄰像素位置對應的像素值之間的梯度值。In the embodiment of the present application, the decoder may first parse the bit stream to obtain the PROF parameter, and if the PROF parameter indicates to perform PROF processing, the decoder may determine the pixel horizontal gradient and the pixel vertical gradient corresponding to the center position based on the first predicted value ; Among them, the pixel horizontal gradient is the gradient value between the pixel value corresponding to the center position and the pixel value corresponding to the adjacent pixel position in the horizontal direction; the pixel vertical gradient is the pixel value corresponding to the center position and the vertical direction. , the gradient value between the pixel values corresponding to the adjacent pixel positions.

進一步地,在本申請的實施例中,解碼器可以根據每一個像素位置對應的中心位置的像素水平梯度、像素垂直梯度以及第二運動向量偏差,計算獲得與每一個像素位置對應的偏差值。其中,該偏差值可以用於對每一個像素位置的像素值的預測值進行修正處理。Further, in the embodiment of the present application, the decoder can calculate and obtain the deviation value corresponding to each pixel position according to the pixel horizontal gradient, the pixel vertical gradient and the second motion vector deviation of the center position corresponding to each pixel position. Wherein, the deviation value can be used to correct the predicted value of the pixel value of each pixel position.

需要說明的是,在本申請的實施例中,解碼器可以進一步根據第一預測值和偏差值,獲得任一個像素位置所對應的修正後預測值,並在遍歷當前子塊中的每一個像素位置,獲得每一個像素位置對應的修正後預測值之後,利用全部像素位置對應的修正後預測值確定出當前子塊對應的第二預測值,從而確定出對應的幀間預測值。具體地,在本申請中,在完成基於子塊的預測之後,將當前子塊的第一預測值作為每一個像素位置的預測值,接著,將第一預測值與每一個像素位置對應的偏差值相加,即可以完成對每一個像素位置的預測值的修正處理,獲得修正後預測值,從而可以進一步獲得當前子塊的第二預測值,並將第二預測值作為當前子塊對應的幀間預測值。It should be noted that, in the embodiment of the present application, the decoder can further obtain the corrected predicted value corresponding to any pixel position according to the first predicted value and the deviation value, and traverse each pixel in the current sub-block After obtaining the modified predicted value corresponding to each pixel position, the second predicted value corresponding to the current sub-block is determined by using the modified predicted value corresponding to all pixel positions, thereby determining the corresponding inter-frame predicted value. Specifically, in the present application, after the prediction based on the sub-block is completed, the first prediction value of the current sub-block is used as the prediction value of each pixel position, and then the deviation corresponding to the first prediction value and each pixel position is used The value is added, that is, the correction processing of the predicted value of each pixel position can be completed, and the corrected predicted value can be obtained, so that the second predicted value of the current sub-block can be further obtained, and the second predicted value can be used as the corresponding value of the current sub-block. Interframe prediction value.

進一步地,在本申請的實施例中,解碼器基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值的方法可以包括以下步驟:Further, in the embodiments of the present application, the decoder performs secondary prediction or PROF processing according to the center position and the second motion vector deviation based on the first predicted value, determines the second predicted value of the sub-block, and converts the second predicted value to the second predicted value. The method of determining an inter-predicted value for a sub-block may include the following steps:

步驟S305f、解析位元流,獲取二次預測參數;Step S305f, parsing the bit stream to obtain secondary prediction parameters;

步驟S305g、當二次預測參數指示使用二次預測時,根據第二運動向量偏差確定二維濾波器的濾波係數;其中,二維濾波器用於按照預設形狀進行二次預測處理;Step S305g, when the secondary prediction parameter indicates the use of secondary prediction, determine the filter coefficient of the two-dimensional filter according to the second motion vector deviation; wherein, the two-dimensional filter is used to perform secondary prediction processing according to a preset shape;

步驟S305h、基於濾波係數和第一預測值,確定每一個像素位置的像素的預測值;Step S305h, based on the filter coefficient and the first predicted value, determine the predicted value of the pixel at each pixel position;

步驟S305i、利用每一個像素位置的像素的預測值,確定第二預測值。Step S305i, using the predicted value of the pixel at each pixel position to determine the second predicted value.

在本申請的實施例中,解碼器可以先解析位元流,獲得二次預測參數,如果二次預測參數指示使用二次預測,那麼解碼器可以根據第二運動向量偏差確定二維濾波器的濾波係數;其中,二維濾波器用於按照預設形狀進行二次預測處理。In this embodiment of the present application, the decoder may first parse the bit stream to obtain secondary prediction parameters. If the secondary prediction parameters indicate to use secondary prediction, the decoder may determine the size of the two-dimensional filter according to the second motion vector deviation. Filter coefficient; wherein, the two-dimensional filter is used to perform secondary prediction processing according to the preset shape.

需要說明的是,在本申請的實施例中,二維濾波器的濾波器係數是與目標像素位置所對應的第二運動向量偏差相關的。也就是說,對於不同的目標像素位置,如果對應的第二運動向量偏差不同,那麼使用的二維濾波器的濾波係數也是不同的。It should be noted that, in the embodiment of the present application, the filter coefficient of the two-dimensional filter is related to the deviation of the second motion vector corresponding to the target pixel position. That is to say, for different target pixel positions, if the corresponding second motion vector deviations are different, the filter coefficients of the used two-dimensional filters are also different.

可以理解的是,在本申請的實施例中,二維濾波器用於利用多個相鄰的、構成預設形狀的像素位置進行二次預測。其中,預設形狀為矩形、菱形或任意一種對稱形狀。It can be understood that, in the embodiment of the present application, a two-dimensional filter is used to perform secondary prediction by using a plurality of adjacent pixel positions that form a preset shape. The preset shape is a rectangle, a rhombus or any symmetrical shape.

也就是說,在本申請的中,用於進行二次預測的二維濾波器是相鄰的構成預設形狀的點所構成的濾波器。相鄰的構成預設形狀的點可以包括多個點,例如由9個點構成。預設形狀可以為對稱形狀,例如,預設形狀可以包括矩形、菱形或其他任意一種對稱形狀。That is to say, in the present application, the two-dimensional filter used for secondary prediction is a filter formed by adjacent points forming a preset shape. The adjacent dots constituting the preset shape may include a plurality of dots, for example, composed of 9 dots. The predetermined shape may be a symmetrical shape, for example, the predetermined shape may include a rectangle, a rhombus, or any other symmetrical shape.

示例性的,在本申請中,二維濾波器是一個矩形的濾波器,具體地,二維濾波器是由9個相鄰的構成矩形的像素位置組成的濾波器。在9個像素位置中,位於中心的像素位置是當前需要二次預測的像素的像素位置,即當前像素位置。Exemplarily, in this application, the two-dimensional filter is a rectangular filter, and specifically, the two-dimensional filter is a filter composed of 9 adjacent pixel positions forming a rectangle. Among the 9 pixel positions, the pixel position located in the center is the pixel position of the pixel currently requiring secondary prediction, that is, the current pixel position.

進一步地,在本申請的實施例中,解碼器在根據第二運動向量偏差確定二維濾波器的濾波係數時,可以先解析位元流,獲取比例參數,然後可以根據比例參數和第二運動向量偏差,確定像素位置對應的濾波器係數。Further, in the embodiment of the present application, when the decoder determines the filter coefficient of the two-dimensional filter according to the second motion vector deviation, it can first parse the bit stream to obtain the scale parameter, and then can obtain the scale parameter according to the scale parameter and the second motion vector. Vector bias, which determines the filter coefficients corresponding to the pixel positions.

需要說明的是,在本申請的實施例中,比例參數可以包括至少一個比例值,第二運動向量偏差包括水平偏差和垂直偏差;其中,至少一個比例值均為非零實數。It should be noted that, in the embodiment of the present application, the scale parameter may include at least one scale value, and the second motion vector deviation includes a horizontal deviation and a vertical deviation; wherein, at least one scale value is a non-zero real number.

具體地,在本申請中,當二維濾波器利用9個相鄰的、構成矩形的像素位置進行二次預測時,位於矩形的中心的像素位置為待預測位置,即當前像素位置,其他8個目標像素位置依次位於當前像素位置的左上、上、右上、右、右下、下、左下、左這8個方向。Specifically, in this application, when the two-dimensional filter uses 9 adjacent pixel positions that form a rectangle to perform secondary prediction, the pixel position located in the center of the rectangle is the position to be predicted, that is, the current pixel position, and the other 8 The target pixel positions are sequentially located in the eight directions of the upper left, upper, upper right, right, lower right, lower, lower left, and left of the current pixel position.

相應地,在本申請中,解碼器可以基於至少一個比例值和待預測位置的第二運動向量偏差,按照預設計算規則計算獲得9個相鄰的像素位置對應的9個濾波器係數。Correspondingly, in the present application, the decoder may calculate and obtain 9 filter coefficients corresponding to 9 adjacent pixel positions based on at least one scale value and the deviation of the second motion vector of the position to be predicted according to a preset calculation rule.

需要說明的是,在本申請中,預設計算規則可以包括多種不同的計算方式,如加法運算、減法運算、乘法運算等。其中,對於不同的像素位置,可以使用不同的計算方式進行濾波器係數的計算。It should be noted that, in this application, the preset calculation rule may include various calculation methods, such as addition operation, subtraction operation, multiplication operation, and the like. Among them, for different pixel positions, different calculation methods can be used to calculate the filter coefficients.

可以理解的是,在本申請中,解碼器在按照預設計算規則中不同的計算方法計算獲得多個像素位置對應的多個濾波器係數中,部分濾波器係數可以為第二運動向量偏差的一次函數,即兩者為線性關係,還可以為第二運動向量偏差的二次函數或高次函數,即兩者為非線性關係。It can be understood that, in this application, when the decoder calculates and obtains multiple filter coefficients corresponding to multiple pixel positions according to different calculation methods in the preset calculation rules, some filter coefficients may be the difference of the second motion vector deviation. The linear function, that is, the two are in a linear relationship, may also be a quadratic function or a higher-order function of the deviation of the second motion vector, that is, the two are in a non-linear relationship.

也就是說,在本申請中,多個相鄰的像素位置對應的多個濾波器係數中的任意一個濾波器係數,可以為第二運動向量偏差的一次函數、二次函數或者高次函數。That is to say, in the present application, any one of the multiple filter coefficients corresponding to multiple adjacent pixel positions may be a linear function, a quadratic function, or a higher-order function of the second motion vector deviation.

示例性的,在本申請中,假設像素位置的第二運動向量偏差為(dmv_x,dmv_y),其中,如果目標像素位置的座標為(i,j),那麼dmv_x可以表示為dMvX[i][j][0],即表示第二運動向量偏差在水平分量的偏差值,dmv_y可以表示為dMvX[i][j][1],即表示第二運動向量偏差在垂直分量的偏差值。Exemplarily, in this application, it is assumed that the second motion vector deviation of the pixel position is (dmv_x, dmv_y), wherein, if the coordinates of the target pixel position are (i, j), then dmv_x can be expressed as dMvX[i][ j][0], that is, the deviation value of the second motion vector deviation in the horizontal component, and dmv_y can be expressed as dMvX[i][j][1], that is, the deviation value of the second motion vector deviation in the vertical component.

相應地,表3為基於第二運動向量偏差(dmv_x,dmv_y)所獲得的濾波器係數,如表3所示,對於二維濾波器,按照像素位置的第二運動向量偏差(水平偏差為dmv_x,垂直偏差為dmv_y)和不同的比例參數,如m和n,可以獲得9個相鄰的像素位置對應的9個濾波器係數,其中,解碼器可以直接將中心的當前像素位置的濾波器係數設置為1。Correspondingly, Table 3 shows the filter coefficients obtained based on the second motion vector deviation (dmv_x, dmv_y). As shown in Table 3, for a two-dimensional filter, the second motion vector deviation according to the pixel position (the horizontal deviation is dmv_x , the vertical deviation is dmv_y) and different scale parameters, such as m and n, 9 filter coefficients corresponding to 9 adjacent pixel positions can be obtained, where the decoder can directly convert the filter coefficients of the current pixel position in the center Set to 1.

表3 像素位置 濾波器係數 左上 (-dmv_x-dmv_y)×m -dmv_x×n 左下 (-dmv_x+dmv_y)×m -dmv_y×n 中心 1 dmv_y× n 右上 (dmv_x-dmv_y)×m dmv_x×n 右下 (dmv_x+dmv_y)×m table 3 pixel position filter coefficients upper left (-dmv_x-dmv_y)×m left -dmv_x×n lower left (-dmv_x+dmv_y)×m superior -dmv_y×n center 1 Down dmv_y×n top right (dmv_x-dmv_y)×m right dmv_x×n lower right (dmv_x+dmv_y)×m

其中,比例參數m和n一般是小數或分數,一種可能的情況是m和n都是2的冪,如1/2,1/4,1/8等。這裡的dmv_x,dmv_y都是其實際的大小,即dmv_x,dmv_y的1表示1個像素的距離,dmv_x,dmv_y是小數或者分數。Among them, the scale parameters m and n are generally decimals or fractions, and a possible situation is that both m and n are powers of 2, such as 1/2, 1/4, 1/8 and so on. Here, dmv_x and dmv_y are their actual sizes, that is, 1 of dmv_x and dmv_y represents the distance of 1 pixel, and dmv_x and dmv_y are decimals or fractions.

需要說明的是,在本申請的實施例中,與現有的8抽頭的濾波器相比,目前常見的8抽頭的濾波器所對應的整像素位置和分像素位置的運動向量在水平和垂直方向均為非負的,且大小均屬於0像素到1像素之間,即dmv_x,dmv_y不可以為負的。而在本申請中,濾波器對應的整像素位置和分像素位置的運動向量在水平和垂直方向都可以為負的,即dmv_x,dmv_y可以為負的。It should be noted that, in the embodiment of the present application, compared with the existing 8-tap filter, the motion vectors of the integer pixel position and the sub-pixel position corresponding to the current common 8-tap filter are in the horizontal and vertical directions. All are non-negative, and the size is between 0 pixel and 1 pixel, that is, dmv_x and dmv_y cannot be negative. In this application, the motion vectors of the integer pixel position and the sub-pixel position corresponding to the filter may be negative in both the horizontal and vertical directions, that is, dmv_x and dmv_y may be negative.

示例性的,在本申請的實施例中,如果比例參數m為1/16,n為1/2,那麼上述表3可以表示為下表4:Exemplarily, in the embodiment of the present application, if the proportional parameter m is 1/16 and n is 1/2, then the above Table 3 can be expressed as the following Table 4:

表4 像素位置 濾波器係數 左上 (-dmv_x-dmv_y)/16 -dmv_x/2 左下 (-dmv_x+dmv_y)/16 -dmv_y/2 中心 1 dmv_y/2 右上 (dmv_x-dmv_y)/16 dmv_x/2 右下 (dmv_x+dmv_y)/16 Table 4 pixel position filter coefficients upper left (-dmv_x-dmv_y)/16 left -dmv_x/2 lower left (-dmv_x+dmv_y)/16 superior -dmv_y/2 center 1 Down dmv_y/2 top right (dmv_x-dmv_y)/16 right dmv_x/2 lower right (dmv_x+dmv_y)/16

可以理解的是,在本申請的實施例中,在影像編解碼技術以及標準中,通常使用放大倍數以避免小數,浮點數運算,然後將計算的結果縮小合適的倍數以得到正確的結果。放大倍數時通常使用左移,縮小倍數時通常使用右移。因此,在透過二維濾波器進行二次預測時,在實際應用時會寫成如下的形式:It can be understood that, in the embodiments of the present application, in the video coding and decoding technology and standards, a magnification is usually used to avoid decimals, floating-point number operations, and then the calculated result is reduced by an appropriate multiple to obtain a correct result. Left shift is usually used when zooming in, and right shift is usually used when zooming out. Therefore, when performing secondary prediction through a two-dimensional filter, it will be written in the following form in practical application:

假設像素位置的第二運動向量偏差為(dmv_x,dmv_y),經過左移shift1得到(dmv_x’,dmv_y’),基於上述表4,二維濾波器的係數可以表示為下表5:Assuming that the second motion vector deviation of the pixel position is (dmv_x, dmv_y), which is obtained by shifting left by shift1 (dmv_x', dmv_y'), based on the above Table 4, the coefficients of the two-dimensional filter can be expressed as Table 5 below:

表5 像素位置 濾波器係數 左上 -dmv_x’-dmv_y’ -dmv_x’×8 左下 -dmv_x’+dmv_y’ -dmv_y’×8 中心 16<<shift1 dmv_y’×8 右上 dmv_x’-dmv_y’ dmv_x×8 右下 dmv_x’+dmv_y’ table 5 pixel position filter coefficients upper left -dmv_x'-dmv_y' left -dmv_x'×8 lower left -dmv_x'+dmv_y' superior -dmv_y'×8 center 16<<shift1 Down dmv_y'×8 top right dmv_x'-dmv_y' right dmv_x×8 lower right dmv_x'+dmv_y'

圖17為二維濾波器的示意圖一,如圖17所示,以基於子塊的預測的結果為二次預測的基礎,淺色正方形為該濾波器的整像素位置,也就是基於子塊的預測得到的位置。圓形是需要進行二次預測的分像素位置,即像素位置的位置,深色正方形是該分像素位置對應的整像素位置,插值得到這個分像素位置時需要如圖所示的9個整像素位置。Fig. 17 is a schematic diagram 1 of a two-dimensional filter. As shown in Fig. 17, the sub-block-based prediction result is used as the basis for the secondary prediction, and the light-colored square is the integer pixel position of the filter, that is, the sub-block-based Predicted location. The circle is the sub-pixel position that needs to be predicted twice, that is, the position of the pixel position, and the dark square is the integer pixel position corresponding to the sub-pixel position. When the sub-pixel position is obtained by interpolation, 9 integer pixels as shown in the figure are required. Location.

圖18為二維濾波器的示意圖二,如圖18所示,以基於子塊的預測的結果為二次預測的基礎,淺色正方形為該濾波器的整像素位置,也就是基於子塊的預測得到的位置。圓形是需要進行二次預測的分像素位置,即像素位置的位置,深色正方形是該分像素位置對應的整像素位置,插值得到這個分像素位置時需要如圖所示的13個整像素位置。Fig. 18 is a schematic diagram 2 of a two-dimensional filter. As shown in Fig. 18, the result of the sub-block-based prediction is used as the basis for the secondary prediction, and the light-colored square is the integer pixel position of the filter, that is, the sub-block-based Predicted location. The circle is the sub-pixel position that needs to be predicted twice, that is, the position of the pixel position, and the dark square is the integer pixel position corresponding to the sub-pixel position. When the sub-pixel position is obtained by interpolation, 13 integer pixels are required as shown in the figure. Location.

進一步地,在本申請的實施例中,解碼器在根據第二運動向量偏差確定出二維濾波器的濾波係數之後,便可以基於濾波係數和第一預測值,確定當前子塊的第二預測值,從而可以實現對當前子塊的二次預測。Further, in the embodiment of the present application, after determining the filter coefficient of the two-dimensional filter according to the second motion vector deviation, the decoder can determine the second prediction of the current sub-block based on the filter coefficient and the first prediction value. value, so that the secondary prediction of the current sub-block can be realized.

可以理解的是,在本申請的實施例中,解碼器利用像素位置所對應的第二運動向量偏差確定出濾波器係數,從而可以按照濾波器係數,透過二維濾波器對第一預測值進行修正,獲得修正後的、當前子塊的第二預測值。可見,第二預測值為基於第一預測值的修正值。It can be understood that, in the embodiment of the present application, the decoder determines the filter coefficient by using the second motion vector deviation corresponding to the pixel position, so that the first predicted value can be processed through the two-dimensional filter according to the filter coefficient. Correction to obtain the corrected second predicted value of the current sub-block. It can be seen that the second predicted value is a modified value based on the first predicted value.

進一步地,在本申請的實施例中,解碼器在基於濾波係數和第一預測值,確定當前子塊的第二預測值時,可以先對濾波器係數與第一預測值進行乘法運算,獲得乘積結果,遍歷當前子塊中的全部像素位置之後,再對當前子塊的全部像素位置的乘積結果進行加法運算,獲得求和結果,最後可以對加法結果進行歸一化處理,最終便可以獲得當前子塊修正後的第二預測值。Further, in the embodiment of the present application, when determining the second predicted value of the current subblock based on the filter coefficient and the first predicted value, the decoder may first perform a multiplication operation on the filter coefficient and the first predicted value to obtain: Product result, after traversing all pixel positions in the current sub-block, add the product results of all pixel positions in the current sub-block to obtain the summation result, and finally normalize the addition result, and finally obtain The modified second predicted value of the current sub-block.

需要說明的是,在本申請的實施例中,在進行二次預測之前,一般情況下是將像素位置所在的當前子塊的第一預測值作為該像素位置的修正前的預測值,因此,在透過二維濾波器進行濾波時,可以將濾波器係數與對應像素位置的預測值,即第一預測值相乘,並對每一個像素位置對應的乘積結果進行累加,然後歸一化。It should be noted that, in the embodiments of the present application, before the secondary prediction is performed, the first prediction value of the current sub-block where the pixel position is located is generally used as the prediction value before the correction of the pixel position. Therefore, When filtering through a two-dimensional filter, the filter coefficient can be multiplied by the predicted value of the corresponding pixel position, that is, the first predicted value, and the multiplication results corresponding to each pixel position can be accumulated and then normalized.

可以理解的是,在本申請中,解碼器可以透過多種方式進行歸一化處理,例如,可以將濾波器係數與對應的像素位置的預測值相乘後累加的結果,右移4+shift1位。或者,還可以將濾波器係數與對應的像素位置的預測值相乘後累加的結果,再加上(1<<(3+shift1)),然後右移4+shift1位。It can be understood that in this application, the decoder can perform normalization processing in various ways. For example, the accumulated result can be multiplied by the filter coefficient and the predicted value of the corresponding pixel position, and shifted by 4+shift1 bits to the right. . Alternatively, it is also possible to multiply the filter coefficient by the predicted value of the corresponding pixel position and then add (1<<(3+shift1)) to the accumulated result, and then shift to the right by 4+shift1 bits.

可見,在本申請中,在獲得當前子塊內部的像素位置對應的第二運動向量偏差之後,對每一個子塊,以及每一個子塊中的每一個像素位置,可以根據第二運動向量偏差,基於當前子塊的運動補償的第一預測值,使用二維濾波器進行濾波,完成對當前子塊的二次預測,得到新的第二預測值。It can be seen that in this application, after obtaining the second motion vector deviation corresponding to the pixel position inside the current sub-block, for each sub-block and each pixel position in each sub-block, the second motion vector deviation can be obtained according to the second motion vector deviation. , based on the first prediction value of the motion compensation of the current sub-block, use a two-dimensional filter to perform filtering, complete the secondary prediction of the current sub-block, and obtain a new second prediction value.

進一步地,在本申請的實施例中,二維濾波器可以理解為利用多個相鄰的、構成預設形狀的像素位置進行二次預測。其中,預設形狀可以為矩形、菱形或任意一種對稱形狀。Further, in the embodiments of the present application, the two-dimensional filter can be understood as performing secondary prediction by using a plurality of adjacent pixel positions that form a preset shape. The preset shape may be a rectangle, a rhombus or any symmetrical shape.

具體地,在本申請的實施例中,二維濾波器在利用9個相鄰的、構成矩形的像素位置進行二次預測時,可以先確定當前塊的預測樣本矩陣,和當前塊的當前子塊的運動向量偏差矩陣;其中,運動向量偏差矩陣包括全部像素位置對應的第二運動向量偏差;然後基於9個相鄰的、構成矩形的像素位置,利用預測樣本矩陣和運動向量偏差矩陣,確定當前塊的二次預測後的樣本矩陣。Specifically, in the embodiment of the present application, when the two-dimensional filter uses 9 adjacent pixel positions that form a rectangle to perform secondary prediction, it can first determine the prediction sample matrix of the current block, and the current sub-frame of the current block. The motion vector deviation matrix of the block; wherein, the motion vector deviation matrix includes the second motion vector deviation corresponding to all pixel positions; then based on 9 adjacent pixel positions that form a rectangle, using the predicted sample matrix and the motion vector deviation matrix, determine The sub-predicted sample matrix for the current block.

示例性的,在本申請中,如果當前塊的寬度和高度分別是width和height,每個子塊的寬度和高度分別是subwidth和subheight。如圖7所示,當前塊的亮度預測樣本矩陣的左上角樣本所在的子塊為A,右上角樣本所在的子塊為B,左下角樣本所在的子塊為C,其他位置所在子塊為其它子塊。Exemplarily, in this application, if the width and height of the current block are width and height, respectively, the width and height of each sub-block are subwidth and subheight, respectively. As shown in Figure 7, the sub-block where the upper-left sample of the luminance prediction sample matrix of the current block is located is A, the sub-block where the upper-right sample is located is B, the sub-block where the lower-left sample is located is C, and the sub-blocks where the other positions are located are other sub-blocks.

對當前塊中的每個子塊,可以將子塊的運動向量偏差矩陣記為dMv,那麼:For each sub-block in the current block, the motion vector deviation matrix of the sub-block can be denoted as dMv, then:

1、如果子塊是A,dMv等於dMvA;1. If the sub-block is A, dMv is equal to dMvA;

2、如果子塊是B,dMv等於dMvB;2. If the sub-block is B, dMv is equal to dMvB;

3、如果子塊為C,且該當前子塊的控制點運動向量組mvAffine中有3個運動向量,dMv等於dMvC;3. If the sub-block is C, and there are 3 motion vectors in the control point motion vector group mvAffine of the current sub-block, dMv is equal to dMvC;

4、如果子塊為A、B、C以外的其他子塊,dMv等於dMvN。4. If the sub-block is other than A, B, and C, dMv is equal to dMvN.

進一步地,假設(x,y)是當前子塊左上角位置的座標,(i,j)是亮度子塊內部像素的座標,i的取值範圍是0~(subwidth-1),j的取值範圍是0~(subheight-1),基於子塊的預測樣本矩陣為PredMatrixSb,二次預測的預測樣本矩陣為PredMatrixS,dCenterX,dCenterY為二次預測起始位置水平方向和豎直方向的偏移量矩陣,可以按照以下方法計算(x+i,y+j)的二次預測的預測樣本PredMatrixS[x+i][y+j]: dCenterX[i][j]=(dMv[i][j][0]<0?-1:1)*((abs(dMv[i][j][0])+(1<<10))/(1<<11)) dCenterX[i][j]=CLIP3(-i, width-1-i) dCenterY[i][j]=(dMv[i][j][1]<0?-1:1)*((abs(dMv[i][j][1])+(1<<10))/(1<<11)) dCenterY[i][j]=CLIP3(-j, height-1-j) dMv[i][j][0]=dMv[i][j][0]–dCenterX *(1<<11) dMv[i][j][1]=dMv[i][j][1]–dCenterY *(1<<11) PredMatrixS[x+i][y+j]= (UPLEFT(x+i,y+j)×(-dMv[i][j][0]-dMv[i][j][1])+ UP(x+i,y+j)×((-dMv[i][j][1])<<3)+ UPRIGHT(x+i,y+j)×(dMv[i][j][0]-dMv[i][j][1])+ LEFT(x+i,y+j)×((-dMv[i][j][0])<<3)+ CENTER(x+i,y+j)×(1<<15)+ RIGHT(x+i,y+j)×(dMv[i][j][0]<<3)+ DOWNLEFT(x+i,y+j)×(-dMv[i][j][0]+dMv[i][j][1])+ DOWN(x+i,y+j)×(dMv[i][j][1]<<3)+ DOWNRIGHT(x+i,y+j)×(dMv[i][j][0]+dMv[i][j][1])+ (1<<14))>>15 PredMatrixS[x+i][y+j]=Clip3(0,(1<<BitDepth)-1,PredMatrixS[x+i][y+j])。Further, it is assumed that (x, y) is the coordinate of the upper left corner of the current sub-block, (i, j) is the coordinate of the pixel inside the luminance sub-block, the value range of i is 0~(subwidth-1), and the value of j The value range is 0~(subheight-1), the prediction sample matrix based on sub-block is PredMatrixSb, the prediction sample matrix of secondary prediction is PredMatrixS, dCenterX, dCenterY are the offsets of the secondary prediction starting position in the horizontal and vertical directions Quantity matrix, the predicted sample PredMatrixS[x+i][y+j] of the secondary prediction of (x+i, y+j) can be calculated as follows: dCenterX[i][j]=(dMv[i][j][0]<0?-1:1)*((abs(dMv[i][j][0])+(1<<10) )/(1<<11)) dCenterX[i][j]=CLIP3(-i, width-1-i) dCenterY[i][j]=(dMv[i][j][1]<0?-1:1)*((abs(dMv[i][j][1])+(1<<10) )/(1<<11)) dCenterY[i][j]=CLIP3(-j, height-1-j) dMv[i][j][0]=dMv[i][j][0]–dCenterX * (1<<11) dMv[i][j][1]=dMv[i][j][1]–dCenterY * (1<<11) PredMatrixS[x+i][y+j]= (UPLEFT(x+i,y+j)×(-dMv[i][j][0]-dMv[i][j][1])+ UP(x+i,y+j)×((-dMv[i][j][1])<<3)+ UPRIGHT(x+i,y+j)×(dMv[i][j][0]-dMv[i][j][1])+ LEFT(x+i,y+j)×((-dMv[i][j][0])<<3)+ CENTER(x+i,y+j)×(1<<15)+ RIGHT(x+i,y+j)×(dMv[i][j][0]<<3)+ DOWNLEFT(x+i,y+j)×(-dMv[i][j][0]+dMv[i][j][1])+ DOWN(x+i, y+j)×(dMv[i][j][1]<<3)+ DOWNRIGHT(x+i,y+j)×(dMv[i][j][0]+dMv[i][j][1])+ (1<<14))>>15 PredMatrixS[x+i][y+j]=Clip3(0, (1<<BitDepth)-1, PredMatrixS[x+i][y+j]).

其中,UPLEFT(x+i,y+j)=PredMatrixSb[max(0,x+i+dCenterX[i][j]-1)][max(0,y+j+dCenterY[i][j]-1)] UP(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][max(0,y+j+dCenterY[i][j]-1)] UPRIGHT(x+i,y+j)=PredMatrixSb[min(width-1,x+i+dCenterX[i][j]+1)][max(0,y+j+dCenterY[i][j]-1)] LEFT(x+i,y+j)=PredMatrixSb[max(0,x+i+dCenterX[i][j]-1)][y+j+dCenterY[i][j]] CENTER(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]] RIGHT(x+i,y+j)=PredMatrixSb[min(width-1,x+i+dCenterX[i][j]+1)][y+j+dCenterY[i][j]] DOWNLEFT(x+i,y+j)=PredMatrixSb[max(0,x+i+dCenterX[i][j]-1)][min(height-1,y+j+dCenterY[i][j]+1)] DOWN (x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][max(0,x+i+dCenterX[i][j]-1)][min(height-1,y+j+dCenterY[i][j]+1)] DOWNRIGHT(x+i,y+j)=PredMatrixSb[min(width-1,x+i+dCenterX[i][j]+1)][max(0,x+i+dCenterX[i][j]-1)][min(height-1,y+j+dCenterY[i][j]+1)]Where, UPLEFT(x+i,y+j)=PredMatrixSb[max(0,x+i+dCenterX[i][j]-1)][max(0,y+j+dCenterY[i][j] -1)] UP(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][max(0,y+j+dCenterY[i][j]-1)] UPRIGHT(x+i,y+j)=PredMatrixSb[min(width-1,x+i+dCenterX[i][j]+1)][max(0,y+j+dCenterY[i][j] -1)] LEFT(x+i,y+j)=PredMatrixSb[max(0,x+i+dCenterX[i][j]-1)][y+j+dCenterY[i][j]] CENTER(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]] RIGHT(x+i,y+j)=PredMatrixSb[min(width-1,x+i+dCenterX[i][j]+1)][y+j+dCenterY[i][j]] DOWNLEFT(x+i,y+j)=PredMatrixSb[max(0,x+i+dCenterX[i][j]-1)][min(height-1,y+j+dCenterY[i][j] +1)] DOWN(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][max(0,x+i+dCenterX[i][j]-1)][min(height- 1, y+j+dCenterY[i][j]+1)] DOWNRIGHT(x+i,y+j)=PredMatrixSb[min(width-1,x+i+dCenterX[i][j]+1)][max(0,x+i+dCenterX[i][j] -1)][min(height-1,y+j+dCenterY[i][j]+1)]

其中,可以將max(a,b)理解為取a,b中的較大值,可以將min(a,b)理解為取a,b中的較小值。Among them, max(a, b) can be understood as taking the larger value of a and b, and min(a, b) can be understood as taking the smaller value of a and b.

進一步地,在本申請中,如果採用了對基於子塊的預測的預測塊擴充一行一列的方法,即擴充出predMatrix的-1和height的行以及-1和width列,上一段可表示為: UPLEFT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]-1][y+j+dCenterY[i][j]-1] UP(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]-1] UPRIGHT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]+1][y+j+dCenterY[i][j]-1] LEFT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]-1][y+j+dCenterY[i][j]] CENTER(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]] RIGHT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]+1][y+j+dCenterY[i][j]] DOWNLEFT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]-1][y+j+dCenterY[i][j]+1] DOWN(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]+1] DOWNRIGHT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]+1][y+j+dCenterY[i][j]+1]。Further, in the present application, if the method of extending one row and one column to the prediction block based on the prediction of the sub-block is adopted, that is, the rows of -1 and height and the -1 and width columns of the predMatrix are expanded, and the previous paragraph can be expressed as: UPLEFT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]-1][y+j+dCenterY[i][j]-1] UP(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]-1] UPRIGHT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]+1][y+j+dCenterY[i][j]-1] LEFT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]-1][y+j+dCenterY[i][j]] CENTER(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]] RIGHT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]+1][y+j+dCenterY[i][j]] DOWNLEFT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]-1][y+j+dCenterY[i][j]+1] DOWN(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]][y+j+dCenterY[i][j]+1] DOWNRIGHT(x+i,y+j)=PredMatrixSb[x+i+dCenterX[i][j]+1][y+j+dCenterY[i][j]+1].

進一步地,在本申請中,dCenterX,dCenterY也可以不寫成矩陣的形式,而寫成臨時變數的形式。Further, in this application, dCenterX and dCenterY can also be written in the form of temporary variables instead of in the form of matrices.

可以理解的是,在本申請的實施例中,CENTER(x+i,y+j)像素位置可以為上述9個相鄰的、構成矩形的像素位置中的中心位置,然後可以基於該(x+i,y+j)像素位置,以及與其相鄰的其他8個像素位置,進行二次預測處理。具體地,其他8個像素位置分別為UP(上)、UPRIGHT(右上)、LEFT(左)、RIGHT(右)、DOWNLEFT(左下)、DOWN(下)、DOWNRIGHT(右下)、UPLEFT(左上)。It can be understood that, in the embodiment of the present application, the CENTER (x+i, y+j) pixel position may be the center position of the above-mentioned 9 adjacent pixel positions that form a rectangle, and then based on the (x +i, y+j) pixel position, and the other 8 pixel positions adjacent to it, perform secondary prediction processing. Specifically, the other 8 pixel positions are UP (upper), UPRIGHT (upper right), LEFT (left), RIGHT (right), DOWNLEFT (lower left), DOWN (lower), DOWNRIGHT (lower right), UPLEFT (upper left) .

需要說明的是,在本申請中,PredMatrixS[x+i][y+j]的計算公式的精度可以使用更低的精度。比如將每一個乘法右邊的項都右移,如dMv[i][j][0]和dMv[i][j][1]都右移shift3位,相應的,1<<15變為1<<(15-shift3), …+(1<<10))>>11變為…+(1<<(10-shift3)))>>(11-shift3)。It should be noted that, in this application, the precision of the calculation formula of PredMatrixS[x+i][y+j] may use a lower precision. For example, the item on the right side of each multiplication is shifted to the right. For example, dMv[i][j][0] and dMv[i][j][1] are shifted to the right by 3 bits. Correspondingly, 1<<15 becomes 1 <<(15-shift3), …+(1<<10))>>11 becomes …+(1<<(10-shift3)))>>(11-shift3).

示例性的,可以限制運動向量的大小在一個合理的範圍,如上述使用的運動向量在水平方向和垂直方向的正負值都不超過1個像素或1/2像素或1/4像素等。Exemplarily, the size of the motion vector can be limited to a reasonable range. For example, the positive and negative values of the motion vector used above in the horizontal and vertical directions do not exceed 1 pixel, 1/2 pixel, or 1/4 pixel.

可以理解的是,如果當前塊的預測參考模式是‘Pred_List01’,那麼解碼器將各分量的多個預測樣本矩陣平均得到該分量的最終的預測樣本矩陣。例如,2個亮度預測樣本矩陣平均後得到新的亮度預測樣本矩陣。It can be understood that, if the prediction reference mode of the current block is 'Pred_List01', the decoder averages the multiple prediction sample matrices of each component to obtain the final prediction sample matrix of the component. For example, two luminance prediction sample matrices are averaged to obtain a new luminance prediction sample matrix.

進一步地,在本申請的實施例中,在得到當前塊的預測樣本矩陣後,如果當前塊沒有變換係數,那麼預測矩陣就作為當前塊的解碼結果,如果當前塊還有變換係數,那麼,可以先解碼變換係數,並透過反變換、反量化得到殘差矩陣,將殘差矩陣加到預測矩陣上得到解碼結果。Further, in the embodiment of the present application, after obtaining the prediction sample matrix of the current block, if the current block has no transform coefficients, then the prediction matrix is used as the decoding result of the current block, and if the current block has transform coefficients, then First decode the transform coefficients, and obtain the residual matrix through inverse transformation and inverse quantization, and add the residual matrix to the prediction matrix to obtain the decoding result.

可以理解的是,本申請提出的幀間預測方法,可以先基於子塊中的一個像素位置所對應的第一運動向量偏差來調整二次預測的初始位置,即調整進行二次預測或PROF處理的濾波器所使用的中心位置,然後可以基於調整後所確定的中心位置進一步對第一運動向量進行調整,獲得第二運動向量偏差,最終便可以利用該中心位置和第二運動向量偏差對該像素位置進行基於點的預測,進而獲得子塊的第二預測值。It can be understood that the inter-frame prediction method proposed in this application can first adjust the initial position of the secondary prediction based on the first motion vector deviation corresponding to a pixel position in the sub-block, that is, adjust the secondary prediction or PROF processing. The center position of the filter used by the filter, and then the first motion vector can be further adjusted based on the center position determined after the adjustment to obtain the second motion vector deviation, and finally the center position and the second motion vector deviation can be used for this Point-based prediction is performed on the pixel position, thereby obtaining the second prediction value of the sub-block.

需要說明的是,本申請提出的幀間預測方法,可以適用於任何一個圖像分量上,在本實施例中示例性的對亮度分量使用二次預測方案,但是也可以用於色度分量,或者其他格式的任一分量。本申請提出的幀間預測方法也可以適用於任何一種影像格式上,包括但不限於YUV格式,包括但不限於YUV格式的亮度分量。It should be noted that the inter-frame prediction method proposed in this application can be applied to any image component. In this embodiment, a secondary prediction scheme is exemplarily used for the luminance component, but it can also be used for the chrominance component. or any component in other formats. The inter-frame prediction method proposed in this application can also be applied to any image format, including but not limited to the YUV format, including but not limited to the luminance component of the YUV format.

本實施例提供了一種幀間預測方法,可以在基於子塊的預測之後,對運動向量與子塊的運動向量之間的第一運動向量偏差較大的像素位置,可以基於第一運動向量偏差重新確定進行二次預測或PROF處理所使用的中心位置和第二運動向量偏差的確定,從而可以在基於子塊的第一預測值的基礎上,利用中心位置和第二運動向量偏差進行基於點的二次預測,獲得第二預測值。可見,本申請提出的幀間預測方法能夠很好的適用於全部場景,可以減小預測的誤差,大大提升編碼性能,從而提高了編解碼效率。This embodiment provides an inter-frame prediction method. After prediction based on sub-blocks, for pixel positions with a large deviation of the first motion vector between the motion vector and the motion vector of the sub-block, the deviation of the first motion vector can be determined based on the first motion vector deviation. Redetermine the determination of the center position and the second motion vector offset used for secondary prediction or PROF processing, so that the center position and the second motion vector offset can be used for point-based point-based The secondary prediction of , obtains the second prediction value. It can be seen that the inter-frame prediction method proposed in this application can be well applied to all scenarios, can reduce the prediction error, greatly improve the coding performance, and thus improve the coding and decoding efficiency.

本申請實施例提供一種幀間預測方法,該方法應用於影像編碼設備,即編碼器。該方法所實現的功能可以透過編碼器中的第二處理器調用電腦程式來實現,當然電腦程式可以保存在第二記憶體中,可見,該編碼器至少包括第二處理器和第二記憶體。An embodiment of the present application provides an inter-frame prediction method, which is applied to an image encoding device, that is, an encoder. The functions implemented by the method can be implemented by calling a computer program through the second processor in the encoder. Of course, the computer program can be stored in the second memory. It can be seen that the encoder includes at least a second processor and a second memory. .

圖19為幀間預測方法的實現流程示意圖五,如圖19所示,編碼器進行幀間預測的方法可以包括以下步驟:FIG. 19 is a schematic diagram 5 of the implementation flow of the inter-frame prediction method. As shown in FIG. 19 , the method for performing the inter-frame prediction by the encoder may include the following steps:

步驟S401、確定當前塊的預測模式參數。Step S401: Determine the prediction mode parameter of the current block.

在本申請的實施例中,編碼器可以先確定當前塊的預測模式參數。具體地,編碼器可以先確定當前塊使用的預測模式,然後基於該預測模式確定對應的預測模式參數。其中,預測模式參數可以用於對當前塊所使用的預測模式進行確定。In the embodiment of the present application, the encoder may first determine the prediction mode parameter of the current block. Specifically, the encoder may first determine the prediction mode used by the current block, and then determine the corresponding prediction mode parameter based on the prediction mode. The prediction mode parameter may be used to determine the prediction mode used by the current block.

需要說明的是,在本申請的實施例中,待編碼圖像可以劃分為多個圖像塊,當前待編碼的圖像塊可以稱為當前塊,與當前塊相鄰的圖像塊可以稱為相鄰塊;即在待編碼圖像中,當前塊與相鄰塊之間具有相鄰關係。這裡,每個當前塊可以包括第一圖像分量、第二圖像分量和第三圖像分量;也即當前塊為待編碼圖像中當前待進行第一圖像分量、第二圖像分量或者第三圖像分量預測的圖像塊。It should be noted that, in the embodiments of the present application, the image to be encoded may be divided into multiple image blocks, the image block to be encoded currently may be referred to as the current block, and the image block adjacent to the current block may be referred to as the current block. is an adjacent block; that is, in the to-be-coded image, the current block and the adjacent block have an adjacent relationship. Here, each current block may include a first image component, a second image component, and a third image component; that is, the current block is the first image component, the second image component, and the current to-be-encoded image. or the predicted image block of the third image component.

其中,假定當前塊進行第一圖像分量預測,而且第一圖像分量為亮度分量,即待預測圖像分量為亮度分量,那麼當前塊也可以稱為亮度塊;或者,假定當前塊進行第二圖像分量預測,而且第二圖像分量為色度分量,即待預測圖像分量為色度分量,那麼當前塊也可以稱為色度塊。Wherein, it is assumed that the current block performs the first image component prediction, and the first image component is a luminance component, that is, the image component to be predicted is a luminance component, then the current block can also be called a luminance block; Two image components are predicted, and the second image component is a chrominance component, that is, the image component to be predicted is a chrominance component, then the current block may also be called a chrominance block.

需要說明的是,在本申請的實施例中,預測模式參數指示了當前塊採用的預測模式以及與該預測模式相關的參數。這裡,針對預測模式參數的確定,可以採用簡單的決策策略,比如根據失真值的大小進行確定;也可以採用複雜的決策策略,比如根據位元率失真優化(Rate Distortion Optimization,RDO)的結果進行確定,本申請實施例不作任何限定。通常而言,可以採用RDO方式來確定當前塊的預測模式參數。It should be noted that, in this embodiment of the present application, the prediction mode parameter indicates the prediction mode adopted by the current block and parameters related to the prediction mode. Here, for the determination of the prediction mode parameters, a simple decision-making strategy can be adopted, such as determining according to the size of the distortion value; or a complex decision-making strategy can be adopted, such as conducting according to the result of Rate Distortion Optimization (RDO) It is confirmed that the embodiments of the present application do not make any limitation. Generally speaking, the RDO method can be used to determine the prediction mode parameter of the current block.

具體地,在一些實施例中,編碼器在確定當前塊的預測模式參數時,可以先利用多種預測模式對當前塊進行預編碼處理,獲得每一種預測模式對應的位元率失真代價值;然後從所獲得的多個位元率失真代價值中選擇最小位元率失真代價值,並根據最小位元率失真代價值對應的預測模式確定當前塊的預測模式參數。Specifically, in some embodiments, when the encoder determines the prediction mode parameter of the current block, it may first perform precoding processing on the current block by using multiple prediction modes to obtain the bit rate distortion cost value corresponding to each prediction mode; then A minimum rate-distortion cost value is selected from the obtained multiple rate-distortion cost values, and a prediction mode parameter of the current block is determined according to the prediction mode corresponding to the minimum rate-distortion cost value.

也就是說,在編碼器側,針對當前塊可以採用多種預測模式分別對當前塊進行預編碼處理。這裡,多種預測模式通常包括有幀間預測模式、傳統幀內預測模式和非傳統幀內預測模式;其中,傳統幀內預測模式可以包括有直流(Direct Current,DC)模式、平面(PLANAR)模式和角度模式等,非傳統幀內預測模式可以包括有基於矩陣的幀內預測(Matrix-based IntraPrediction,MIP)模式、跨分量線性模型預測(Cross-component LinearmodelPrediction,CCLM)模式、幀內塊複製(Intra Block Copy,IBC)模式和PLT(Palette)模式等,而幀間預測模式可以包括有普通幀間預測模式、GPM模式和AWP模式等。That is to say, on the encoder side, multiple prediction modes may be used for the current block to perform precoding processing on the current block respectively. Here, the multiple prediction modes usually include an inter prediction mode, a traditional intra prediction mode, and a non-traditional intra prediction mode; wherein, the traditional intra prediction mode may include a direct current (DC) mode, a plane (PLANAR) mode and angle mode, etc., non-traditional intra prediction modes can include matrix-based intra prediction (Matrix-based IntraPrediction, MIP) mode, cross-component linear model prediction (Cross-component Linear model prediction, CCLM) mode, intra block copy ( Intra Block Copy, IBC) mode and PLT (Palette) mode, etc., and the inter-frame prediction mode may include ordinary inter-frame prediction mode, GPM mode, and AWP mode.

這樣,在利用多種預測模式分別對當前塊進行預編碼之後,可以得到每一種預測模式對應的位元率失真代價值;然後從所得到的多個位元率失真代價值中選取最小位元率失真代價值,並將該最小位元率失真代價值對應的預測模式確定為當前塊的預測模式參數。除此之外,還可以在利用多種預測模式分別對當前塊進行預編碼之後,得到每一種預測模式對應的失真值;然後從所得到的多個失真值中選取最小失真值,然後將該最小失真值對應的預測模式確定為當前塊使用的預測模式,並根據該預測模式設置對應的預測模式參數。如此,最終使用所確定的預測模式參數對當前塊進行編碼,而且在這種預測模式下,可以使得預測殘差較小,能夠提高編碼效率。In this way, after precoding the current block with multiple prediction modes, the corresponding bit rate distortion cost value of each prediction mode can be obtained; then the minimum bit rate is selected from the obtained multiple rate distortion cost values. The distortion cost value is determined, and the prediction mode corresponding to the minimum bit rate distortion cost value is determined as the prediction mode parameter of the current block. In addition, it is also possible to obtain the distortion value corresponding to each prediction mode after precoding the current block with multiple prediction modes; then select the minimum distortion value from the obtained multiple distortion values, and then select the minimum distortion value from the obtained distortion values. The prediction mode corresponding to the distortion value is determined as the prediction mode used by the current block, and corresponding prediction mode parameters are set according to the prediction mode. In this way, the current block is finally encoded using the determined prediction mode parameters, and in this prediction mode, the prediction residual can be made smaller, and the encoding efficiency can be improved.

也就是說,在編碼側,編碼器可以選取最優的預測模式對當前塊進行預編碼,在這過程中就可以確定出當前塊的預測模式,然後確定用於指示預測模式的預測模式參數,從而將相應的預測模式參數寫入位元流,由編碼器傳輸到解碼器。That is to say, on the encoding side, the encoder can select the optimal prediction mode to pre-encode the current block. In the process, the prediction mode of the current block can be determined, and then the prediction mode parameters used to indicate the prediction mode can be determined. Thereby, the corresponding prediction mode parameters are written into the bit stream and transmitted from the encoder to the decoder.

相應地,在解碼器側,解碼器透過解析位元流便可以直接獲取到當前塊的預測模式參數,並根據解析獲得的預測模式參數確定當前塊所使用的預測模式,以及該預測模式對應的相關參數。Correspondingly, on the decoder side, the decoder can directly obtain the prediction mode parameters of the current block by parsing the bit stream, and determine the prediction mode used by the current block according to the prediction mode parameters obtained by parsing, and the corresponding prediction mode of the prediction mode. Related parameters.

步驟S402、當預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值時,確定當前塊的子塊的第一運動向量;其中,當前塊包括多個子塊。Step S402 , when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, determine the first motion vector of the sub-block of the current block; wherein the current block includes a plurality of sub-blocks.

在本申請的實施例中,如果預測模式參數指示當前塊使用幀間預測模式確定當前塊的幀間預測值,那麼編碼器可以先確定出當前塊的每一個子塊的第一運動向量。其中,一個子塊對應有一個第一運動向量。In the embodiment of the present application, if the prediction mode parameter indicates that the current block uses the inter prediction mode to determine the inter prediction value of the current block, the encoder may first determine the first motion vector of each subblock of the current block. Wherein, one sub-block corresponds to one first motion vector.

需要說明的是,在本申請的實施例中,當前塊為當前幀中待編碼的圖像塊,當前幀以圖像塊的形式按一定順序依次進行編碼,該當前塊為當前幀內按該順序下一時刻待編碼的圖像塊。當前塊可具有多種規格尺寸,例如16x16、32x32或32x16等規格,其中數字表示當前塊上像素點的行數和列數。It should be noted that, in the embodiments of the present application, the current block is the image block to be encoded in the current frame, the current frame is encoded in a certain order in the form of image blocks, and the current block is the image block in the current frame according to the The image block to be encoded at the next moment in order. The current block may have various sizes, such as 16x16, 32x32 or 32x16, where the numbers represent the number of rows and columns of pixels on the current block.

進一步對,在本申請的實施例中,當前塊可以劃分為多個子塊,其中,每一個子塊的尺寸大小都是相同的,子塊為較小規格的像素點集合。子塊的尺寸可以為8x8或4x4。Further, in the embodiments of the present application, the current block may be divided into a plurality of sub-blocks, wherein the size of each sub-block is the same, and the sub-block is a set of pixel points of a smaller specification. The size of the sub-block can be 8x8 or 4x4.

示例性的,在本申請中,當前塊的尺寸為16x16,可以劃分為4個尺寸均為8x8的子塊。Exemplarily, in this application, the size of the current block is 16×16, which can be divided into 4 sub-blocks each with a size of 8×8.

可以理解的是,在本申請的實施例中,在編碼器確定預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值的情況下,就可以繼續採用本申請實施例所提供的幀間預測方法。It can be understood that, in the embodiments of the present application, when the encoder determines that the prediction mode parameter indicates that the inter-frame prediction mode is used to determine the inter-frame prediction value of the current block, the frame provided by the embodiments of the present application can continue to be used. inter-prediction method.

在本申請的實施例中,進一步地,當預測模式參數指示使用幀間預測模式確定當前塊的幀間預測值時,編碼器確定當前塊的子塊的第一運動向量時,可以確定當前塊的仿射模式參數和預測參考模式。當仿射模式參數指示使用仿射模式時,確定控制點模式和子塊尺寸參數。最後可以根據預測參考模式、控制點模式以及子塊尺寸參數,確定第一運動向量。In the embodiment of the present application, further, when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, and the encoder determines the first motion vector of the sub-block of the current block, the current block can be determined. The affine mode parameters and the prediction reference mode. When the affine mode parameter indicates to use the affine mode, the control point mode and subblock size parameters are determined. Finally, the first motion vector may be determined according to the prediction reference mode, the control point mode and the sub-block size parameter.

在本申請的實施例中,編碼器在確定預測模式參數之後,如果預測模式參數指示當前塊使用幀間預測模式確定當前塊的幀間預測值,那麼編碼器可以確定仿射模式參數和預測參考模式。In the embodiment of the present application, after the encoder determines the prediction mode parameter, if the prediction mode parameter indicates that the current block uses the inter prediction mode to determine the inter prediction value of the current block, the encoder may determine the affine mode parameter and the prediction reference model.

需要說明的是,在本申請的實施例中,仿射模式參數用於對是否使用仿射模式進行指示。具體地,仿射模式參數可以為仿射運動補償允許標誌affine_enable_flag,編碼器透過仿射模式參數的取值的確定,可以進一步確定是否使用仿射模式。It should be noted that, in the embodiments of the present application, the affine mode parameter is used to indicate whether to use the affine mode. Specifically, the affine mode parameter may be the affine motion compensation enable flag affine_enable_flag, and the encoder may further determine whether to use the affine mode by determining the value of the affine mode parameter.

也就是說,在本申請中,仿射模式參數可以為一個二值變數。若仿射模式參數的取值為1,則指示使用仿射模式;若仿射模式參數的取值為0,則指示不使用仿射模式。That is, in this application, the affine mode parameter can be a binary variable. If the value of the affine mode parameter is 1, it indicates that the affine mode is used; if the value of the affine mode parameter is 0, it indicates that the affine mode is not used.

示例性的,在本申請中,仿射模式參數的取值可以等於仿射運動補償允許標誌affine_enable_flag的值,如果affine_enable_flag的值為‘1’,表示可使用仿射運動補償;如果affine_enable_flag的值為‘0’,表示不應使用仿射運動補償。Exemplarily, in this application, the value of the affine mode parameter may be equal to the value of the affine motion compensation enable flag affine_enable_flag, if the value of affine_enable_flag is '1', it means that affine motion compensation can be used; if the value of affine_enable_flag is affine motion compensation '0', indicating that affine motion compensation should not be used.

進一步地,在本申請的實施例中,如果編碼器確定的仿射模式參數指示使用仿射模式,那麼編碼器可以進行獲取控制點模式和子塊尺寸參數。Further, in the embodiment of the present application, if the affine mode parameter determined by the encoder indicates that the affine mode is used, the encoder may acquire the control point mode and the sub-block size parameter.

需要說明的是,在本申請的實施例中,控制點模式用於對控制點的個數進行確定。在仿射模型中,一個子塊可以有2個控制點或者3個控制點,相應地,控制點模式可以為2個控制點對應的控制點模式,或者為3個控制點對應的控制點模式。即控制點模式可以包括4參數模式和6參數模式。It should be noted that, in the embodiments of the present application, the control point mode is used to determine the number of control points. In the affine model, a sub-block can have 2 control points or 3 control points, correspondingly, the control point pattern can be the control point pattern corresponding to 2 control points, or the control point pattern corresponding to 3 control points . That is, the control point mode can include a 4-parameter mode and a 6-parameter mode.

可以理解的是,在本申請的實施例中,對於AVS3標準,如果當前塊使用了仿射模式,那麼編碼器還需要確定出當前塊在仿射模式中控制點的個數進行確定,從而可以確定出使用的是4參數(2個控制點)模式,還是6參數(3個控制點)模式。It can be understood that, in the embodiments of the present application, for the AVS3 standard, if the current block uses the affine mode, the encoder also needs to determine the number of control points in the affine mode of the current block to determine, so that the affine mode can be determined. Determine if you are using 4-parameter (2 control points) mode or 6-parameter (3 control points) mode.

進一步地,在本申請的實施例中,如果編碼器確定的仿射模式參數指示使用仿射模式,那麼編碼器可以進一步確定子塊尺寸參數。Further, in the embodiment of the present application, if the affine mode parameter determined by the encoder indicates that the affine mode is used, the encoder may further determine the sub-block size parameter.

具體地,可以透過仿射預測子塊尺寸標誌affine_subblock_size_flag表徵子塊尺寸參數,編碼器可以對子塊尺寸標誌的取值的設定來指示子塊尺寸參數,即指示當前塊的子塊的尺寸大小。其中,子塊的尺寸大小可以為8x8或4x4。具體地,在本申請中,子塊尺寸標誌可以為一個二值變數。若子塊尺寸標誌的取值為1,則指示子塊尺寸參數為8x8;若子塊尺寸標誌的取值為0,則指示子塊尺寸參數為4x4。Specifically, the subblock size parameter can be represented by the affine prediction subblock size flag affine_subblock_size_flag, and the encoder can set the value of the subblock size flag to indicate the subblock size parameter, that is, the size of the subblock of the current block. The size of the sub-block may be 8x8 or 4x4. Specifically, in this application, the sub-block size flag may be a binary variable. If the value of the subblock size flag is 1, it indicates that the subblock size parameter is 8x8; if the value of the subblock size flag is 0, it indicates that the subblock size parameter is 4x4.

示例性的,在本申請中,子塊尺寸標誌的取值可以等於仿射預測子塊尺寸標誌affine_subblock_size_flag的值,如果affine_subblock_size_flag的值為‘1’,則當前塊劃分為尺寸為8x8的子塊;如果affine_subblock_size_flag的值為‘0’,則當前塊劃分為尺寸為4x4的子塊。Exemplarily, in this application, the value of the subblock size flag may be equal to the value of the affine prediction subblock size flag affine_subblock_size_flag, if the value of affine_subblock_size_flag is '1', the current block is divided into subblocks with a size of 8x8; If the value of affine_subblock_size_flag is '0', the current block is divided into sub-blocks of size 4x4.

進一步地,在本申請的實施例中,編碼器在確定控制點模式和子塊尺寸參數之後,便可以根據預測參考模式、控制點模式以及子塊尺寸參數,進一步確定出當前塊中的子塊的第一運動向量。Further, in the embodiment of the present application, after determining the control point mode and the sub-block size parameter, the encoder can further determine the sub-block in the current block according to the prediction reference mode, the control point mode and the sub-block size parameter. The first motion vector.

具體地,在本申請的實施例中,編碼器可以先根據預測參考模式確定控制點運動向量組;然後可以基於控制點運動向量組、控制點模式以及子塊尺寸參數,確定出子塊的第一運動向量。Specifically, in the embodiment of the present application, the encoder may first determine the control point motion vector group according to the prediction reference mode; a motion vector.

可以理解的是,在本申請的實施例中,控制點運動向量組可以用於對控制點的運動向量進行確定。It can be understood that, in the embodiment of the present application, the control point motion vector group may be used to determine the motion vector of the control point.

需要說明的是,在本申請的實施例中,編碼器可以按照上述方法,遍歷當前塊中的每一個子塊,利用每一個子塊的控制點運動向量組、控制點模式以及子塊尺寸參數,確定出每一個子塊的第一運動向量,從而可以根據每一個子塊的第一運動向量構建獲得運動向量集合。It should be noted that, in the embodiment of the present application, the encoder can traverse each sub-block in the current block according to the above method, and use the control point motion vector group, control point mode and sub-block size parameter of each sub-block , the first motion vector of each sub-block is determined, so that the motion vector set can be obtained by constructing and obtaining the first motion vector of each sub-block.

可以理解的是,在本申請的實施例中,當前塊的運動向量集合中可以包括當前塊的每一個子塊的第一運動向量。It can be understood that, in this embodiment of the present application, the motion vector set of the current block may include the first motion vector of each sub-block of the current block.

進一步地,在本申請的實施例中,編碼器在根據控制點運動向量組、控制點模式以及子塊尺寸參數,確定第一運動向量時,可以先根據控制點運動向量組、控制點模式以及當前塊的尺寸參數,確定差值變數;然後可以基於預測模式參數和子塊尺寸參數,確定子塊位置;最後,便可以利用差值變數和子塊位置,確定子塊的第一運動向量,進而可以獲得當前塊的多個子塊的運動向量集合。Further, in the embodiment of the present application, when the encoder determines the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter, it may first determine the first motion vector according to the control point motion vector group, the control point mode and the The size parameter of the current block is used to determine the difference variable; then the sub-block position can be determined based on the prediction mode parameter and the sub-block size parameter; finally, the first motion vector of the sub-block can be determined by using the difference variable and the sub-block position, and then the sub-block can be determined. Obtain a set of motion vectors for multiple sub-blocks of the current block.

需要說明的是,在本申請中,在確定子塊內的每個位置與子塊的運動向量的偏差時,如果當前塊使用的是仿射預測模型,可以根據仿射預測模型的公式計算出子塊內的每個位置的運動向量,與子塊的運動向量相減得到它們的偏差。如果子塊的運動向量都選擇子塊內同一位置的運動向量,如4x4的塊使用距離左上角(2,2)的位置,8x8的塊使用距離左上角(4,4)的位置,根據現在標準包括VVC和AVS3中使用的仿射模型,每個子塊相同位置的運動向量偏差都是相同的。但是AVS在左上角,右上角,以及3控制點的情況下的左下角(上述AVS3文本中的,如圖7所示的A,B,C位置)與其他塊使用的位置不同,相應地在計算左上角,右上角,以及3控制點的情況下的左下角的子塊的運動向量偏差時與其他塊也不同。具體如實施例。It should be noted that, in this application, when determining the deviation between each position in the sub-block and the motion vector of the sub-block, if the current block uses an affine prediction model, it can be calculated according to the formula of the affine prediction model. The motion vector of each position within the sub-block is subtracted from the motion vector of the sub-block to obtain their offset. If the motion vectors of the sub-blocks all select the motion vector at the same position in the sub-block, for example, the 4x4 block uses the position from the upper left corner (2, 2), and the 8x8 block uses the position from the upper left corner (4, 4). The standard includes the affine model used in VVC and AVS3, and the motion vector bias at the same location of each sub-block is the same. But AVS is in the upper left corner, upper right corner, and lower left corner in the case of 3 control points (the A, B, C positions in the above AVS3 text, as shown in Figure 7) are different from the positions used by other blocks, correspondingly in The calculation of the motion vector deviation of the upper left corner, the upper right corner, and the lower left sub-block in the case of three control points is also different from that of other blocks. Specific examples are as follows.

步驟S403、基於第一運動向量確定子塊的第一預測值,和子塊中的每一個像素位置與子塊之間的第一運動向量偏差。Step S403: Determine the first predicted value of the sub-block based on the first motion vector, and the first motion vector deviation between each pixel position in the sub-block and the sub-block.

在本申請的實施例中,編碼器在確定出當前塊的每一個子塊的第一運動向量之後,可以基於子塊的第一運動向量,分別確定出子塊的第一預測值和子塊中的每一個像素位置與子塊之間的第一運動向量偏差。In the embodiment of the present application, after determining the first motion vector of each sub-block of the current block, the encoder may separately determine the first predicted value of the sub-block and the sub-block based on the first motion vector of the sub-block. The first motion vector offset between each pixel position of and the sub-block.

可以理解的是,在本申請的實施例中,步驟S403具體可以包括:It can be understood that, in the embodiment of the present application, step S403 may specifically include:

步驟S403a、基於第一運動向量確定子塊的第一預測值。Step S403a: Determine the first predicted value of the sub-block based on the first motion vector.

步驟S403b、基於第一運動向量確定子塊中的每一個像素位置與子塊之間的第一運動向量偏差。Step S403b: Determine the first motion vector deviation between each pixel position in the sub-block and the sub-block based on the first motion vector.

其中,本申請實施例提出的幀間預測方法對編碼器執行步驟S403a和步驟S403b的順序不進行限定,也就是說,在本申請中,在確定出當前塊的每一個子塊的第一運動向量之後,編碼器可以先執行步驟S403a,然後執行步驟S403b,也可以先執行步驟S403b,再執行步驟S403a,還可以同時執行步驟S403a和步驟S403b。The inter-frame prediction method proposed in this embodiment of the present application does not limit the order in which the encoder performs step S403a and step S403b, that is, in the present application, after determining the first motion of each sub-block of the current block After the vector, the encoder may first perform step S403a and then step S403b, or may first perform step S403b and then step S403a, or simultaneously perform step S403a and step S403b.

進一步地,在本申請的實施例中,編碼器在基於第一運動向量確定子塊的第一預測值時,可以先確定樣本矩陣;其中,樣本矩陣包括亮度樣本矩陣和色度樣本矩陣;然後可以根據預測參考模式、子塊尺寸參數、樣本矩陣以及運動向量集合,確定第一預測值。Further, in the embodiment of the present application, when the encoder determines the first predicted value of the sub-block based on the first motion vector, it may first determine a sample matrix; wherein, the sample matrix includes a luminance sample matrix and a chrominance sample matrix; then The first predictor may be determined from a prediction reference mode, a subblock size parameter, a sample matrix, and a set of motion vectors.

需要說明的是,在本申請的實施例中,編碼器在根據預測參考模式、子塊尺寸參數、樣本矩陣以及運動向量集合,確定第一預測值時,可以先根據預測參考模式和子塊尺寸參數,從運動向量集合中確定目標運動向量;然後可以利用預測參考模式對應的參考圖像佇列和參考索引樣本矩陣以及目標運動向量,確定預測樣本矩陣;其中,預測樣本矩陣包括多個子塊的第一預測值。It should be noted that, in the embodiments of the present application, when the encoder determines the first prediction value according to the prediction reference mode, the sub-block size parameter, the sample matrix, and the motion vector set, the encoder may first determine the first prediction value according to the prediction reference mode and the sub-block size parameter. , determine the target motion vector from the motion vector set; then the reference image queue corresponding to the prediction reference mode and the reference index sample matrix and the target motion vector can be used to determine the prediction sample matrix; wherein, the prediction sample matrix a predicted value.

具體地,在本申請的實施例中,樣本矩陣可以包括亮度樣本矩陣和色度樣本矩陣,相應地,編碼器確定出的預測樣本矩陣可以包括亮度預測樣本矩陣和色度預測樣本矩陣,其中,亮度預測樣本矩陣包括多個子塊的第一亮度預測值,色度預測樣本矩陣包括多個子塊的第一色度預測值,第一亮度預測值和第一色度預測值構成子塊的第一預測值。Specifically, in the embodiment of the present application, the sample matrix may include a luma sample matrix and a chroma sample matrix, and accordingly, the predicted sample matrix determined by the encoder may include a luma predicted sample matrix and a chrominance predicted sample matrix, wherein, The luma prediction sample matrix includes the first luma predicted values of multiple sub-blocks, the chrominance prediction sample matrix includes the first chrominance predicted values of the multiple sub-blocks, and the first luma predicted value and the first chrominance predicted value constitute the first luma predicted value of the sub-block. Predictive value.

需要說明的是,在申請的實施例中,樣本矩陣中的亮度樣本矩陣可以為1/16精度亮度樣本矩陣,樣本矩陣中的色度樣本矩陣可以為1/32精度色度樣本矩陣。It should be noted that, in the embodiment of the application, the luminance sample matrix in the sample matrix may be a 1/16 precision luminance sample matrix, and the chrominance sample matrix in the sample matrix may be a 1/32 precision chrominance sample matrix.

可以理解的是,在本申請的實施例中,對於不同的預測參考模式,編碼器獲取的參考圖像佇列和參考索引是不相同的。It can be understood that, in the embodiment of the present application, for different prediction reference modes, the reference picture queue and reference index obtained by the encoder are different.

進一步地,在本申請的實施例中,編碼器確定樣本矩陣時,可以先獲取亮度插值濾波器係數和色度插值濾波器係數;然後可以基於亮度插值濾波器係數確定亮度樣本矩陣,同時,可以基於色度插值濾波器係數確定色度樣本矩陣。Further, in the embodiment of the present application, when the encoder determines the sample matrix, it may first obtain the luminance interpolation filter coefficients and the chrominance interpolation filter coefficients; then the luminance sample matrix may be determined based on the luminance interpolation filter coefficients, and at the same time, A matrix of chroma samples is determined based on the chroma interpolation filter coefficients.

進一步地,在本申請的實施例中,編碼器在確定子塊中的每一個像素位置與子塊之間的第一運動向量偏差時,可以確定二次預測參數;如果二次預測參數指示使用二次預測,那麼編碼器可以基於差值變數確定子塊與每一個像素位置之間的第一運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the first motion vector deviation between each pixel position in the sub-block and the sub-block, it can determine the secondary prediction parameter; if the secondary prediction parameter indicates to use Secondary prediction, the encoder can then determine the first motion vector offset between the sub-block and each pixel location based on the difference variable.

可以理解的是,在本申請的實施例中,編碼器在基於差值變數確定子塊與每一個像素位置之間的第一運動向量偏差之後,便可以利用子塊內的全部像素位置對應的全部第一運動向量偏差,構建出該子塊對應的運動向量偏差矩陣。可見,運動向量偏差矩陣中包括有子塊與任意一個內部的像素點之間的運動向量偏差,即第一運動向量偏差。It can be understood that, in the embodiment of the present application, after the encoder determines the first motion vector deviation between the sub-block and each pixel position based on the difference variable, the encoder can use the corresponding data of all pixel positions in the sub-block. All the first motion vector deviations are used to construct a motion vector deviation matrix corresponding to the sub-block. It can be seen that the motion vector deviation matrix includes the motion vector deviation between the sub-block and any internal pixel point, that is, the first motion vector deviation.

進一步地,在本申請的實施例中,如果編碼器確定的二次預測參數指示不使用二次預測,那麼,編碼器可以選擇直接將上述步驟S403a中所獲得的當前塊的子塊的第一預測值作為子塊的第二預測值,而不再進行下述步驟S404和步驟S405的處理。Further, in the embodiment of the present application, if the secondary prediction parameter determined by the encoder indicates that secondary prediction is not used, then the encoder may choose to directly use the first sub-block of the current block obtained in the above step S403a. The predicted value is used as the second predicted value of the sub-block, and the processes of steps S404 and S405 described below are not performed.

具體地,在本申請的實施例中,如果二次預測參數指示不使用二次預測,那麼編碼器可以利用預測樣本矩陣確定出第二預測值。其中,預測樣本矩陣包括多個子塊的第一預測值,編碼器可以將像素位置所在的子塊的第一預測值確定為自身的第二預測值。Specifically, in the embodiment of the present application, if the secondary prediction parameter indicates that secondary prediction is not used, the encoder may determine the second prediction value by using the prediction sample matrix. The prediction sample matrix includes the first prediction values of multiple sub-blocks, and the encoder may determine the first prediction value of the sub-block where the pixel position is located as its own second prediction value.

示例性的,在本申請中,如果當前塊的預測參考模式取值為0或1,即使用第一參考模式‘PRED_List0’,或使用第二參考模式‘PRED_List1’,那麼可以直接從包括有1個亮度預測樣本矩陣(2個色度預測樣本矩陣)的預測樣本矩陣中,選擇像素位置所在的子塊的第一預測值,並將該第一預測值確定為像素位置的幀間預測值,即第二預測值。Exemplarily, in this application, if the prediction reference mode of the current block takes a value of 0 or 1, that is, the first reference mode 'PRED_List0' or the second reference mode 'PRED_List1' is used, then it can be directly obtained from including 1 In the prediction sample matrix of the luma prediction sample matrix (two chrominance prediction sample matrices), the first prediction value of the sub-block where the pixel position is located is selected, and the first prediction value is determined as the inter frame prediction value of the pixel position, That is, the second predicted value.

示例性的,在本申請中,如果當前塊的預測參考模式取值為2,即使用第三參考模式‘PRED_List01’,那麼可以先對預測樣本矩陣中所包括的2個亮度預測樣本矩陣(2組共4個色度預測樣本矩陣)進行均值運算,得到1個平均後的亮度預測樣本(2個平均後的色度預測樣本),最後便從這個平均後的亮度預測樣本(2個平均後的色度預測樣本)中,選擇像素位置所在的子塊的第一預測值,並將該第一預測值確定為像素位置的幀間預測值,即第二預測值。Exemplarily, in this application, if the prediction reference mode of the current block is 2, that is, the third reference mode 'PRED_List01' is used, then the two luma prediction sample matrices (2 A total of 4 chrominance prediction sample matrices in the group) are averaged to obtain 1 averaged luminance prediction sample (2 averaged chrominance prediction samples), and finally from the averaged luminance prediction sample (2 averaged In the chroma prediction sample), the first prediction value of the sub-block where the pixel position is located is selected, and the first prediction value is determined as the inter-frame prediction value of the pixel position, that is, the second prediction value.

步驟S404、根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差。Step S404: Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation.

在本申請的實施例中,編碼器在基於第一運動向量分別確定子塊的第一預測值,和子塊中的每一個像素位置與子塊之間的第一運動向量偏差之後,便可以根據第一運動向量偏差每一個像素位置對應的中心位置和第二運動向量偏差。In the embodiment of the present application, after the encoder determines the first prediction value of the sub-block and the first motion vector deviation between each pixel position in the sub-block and the sub-block based on the first motion vector, the encoder can The first motion vector offset is the center position corresponding to each pixel position and the second motion vector offset.

需要說明的是,在本申請的實施例中,對於子塊中的每一個像素位置的像素,在進行二次預測或PROF處理時,如果濾波器使用的預設的中心位置與子塊之間的運動向量偏差較大,那麼獲得的預測結果就可能存在較大的誤差,因此,編碼器在確定出每一個像素位置與子塊之間的第一運動向量偏差之後,可以先對每一個像素位置是否適合作為某個像素二次預測或PROF處理時所使用的濾波器的中心位置進行確認,如果不適合,還可以重新進行中心位置的調整。It should be noted that, in the embodiments of the present application, for the pixel at each pixel position in the sub-block, when performing secondary prediction or PROF processing, if the preset center position used by the filter is between the sub-block If the deviation of the motion vector is large, the obtained prediction result may have a large error. Therefore, after determining the first motion vector deviation between each pixel position and the sub-block, the encoder can Check whether the position is suitable as the center position of the filter used in the secondary prediction of a pixel or PROF processing. If it is not suitable, the center position can be adjusted again.

可以理解的是,在本申請中,一個像素位置對應的中心位置和第二運動向量偏差,可以為對該像素位置進行二次預測或PROF處理時所使用的濾波器的中心位置和運動向量偏差。即中心位置和第二運動向量偏差用於對該像素位置進行二次預測或PROF處理。It can be understood that, in this application, the center position and the second motion vector deviation corresponding to a pixel position can be the center position and the motion vector deviation of the filter used when performing secondary prediction or PROF processing on the pixel position. . That is, the center position and the second motion vector deviation are used to perform secondary prediction or PROF processing on the pixel position.

進一步地,在本申請的實施例中,編碼器根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差的方法可以包括以下步驟:Further, in the embodiment of the present application, the method for the encoder to determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation may include the following steps:

步驟S404a、確定第一運動向量偏差的水平偏差和垂直偏差;Step S404a, determine the horizontal deviation and vertical deviation of the first motion vector deviation;

步驟S404b、根據水平偏差的第一絕對值、垂直偏差的第二絕對值以及預設偏差閾值,確定中心位置和第二運動向量偏差。Step S404b: Determine the center position and the second motion vector deviation according to the first absolute value of the horizontal deviation, the second absolute value of the vertical deviation, and a preset deviation threshold.

在本申請的實施例中,編碼器可以先去確定出第一運動向量偏差在不同方向上的偏差值,即確定出第一運動向量偏差對應的水平偏差和垂直偏差。接著,編碼器可以進一步計算水平偏差的絕對值,即第一絕對值,以及垂直偏差的絕對值,即第二絕對值。最後,編碼器可以根據該第一絕對值、第二絕對值以及預設偏差閾值,進一步確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。In the embodiment of the present application, the encoder may first determine the deviation values of the first motion vector deviation in different directions, that is, determine the horizontal deviation and the vertical deviation corresponding to the first motion vector deviation. Next, the encoder may further calculate the absolute value of the horizontal deviation, that is, the first absolute value, and the absolute value of the vertical deviation, that is, the second absolute value. Finally, the encoder can further determine the center position and the second motion vector deviation used in secondary prediction or PROF processing according to the first absolute value, the second absolute value and the preset deviation threshold.

需要說明的是,在申請的實施例中,編碼器可以將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較,從而可以根據比較結果進行中心位置和第二運動向量偏差的確定。其中,預設偏差閾值可以為預先設置的、用於判斷是否進行中心位置和運動向量偏差的調整。It should be noted that, in the embodiment of the application, the encoder can compare the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, so that the center position and the first absolute value can be compared according to the comparison result. 2. Determination of motion vector bias. The preset deviation threshold may be preset and used to determine whether to adjust the deviation of the center position and the motion vector.

進一步,在本申請的實施例中,編碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第一絕對值和第二絕對值均小於預設偏差閾值,那麼可以將第一運動向量偏差確定為第二運動向量偏差,將每一個像素位置確定為中心位置。Further, in the embodiment of the present application, when the encoder determines the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the first absolute value and the second absolute value are both smaller than the preset deviation If the deviation threshold is set, the first motion vector deviation may be determined as the second motion vector deviation, and each pixel position may be determined as the center position.

可以理解的是,在申請的實施例中,編碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第一絕對值和第二絕對值均小於預設偏差,便可以認為像素位置與子塊之間的向量偏差較小,使用該像素位置作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果比較準確,因此,可以直接將該像素位置對應的第一運動向量偏差確定為用於進行二次預測或PROF處理的第二運動向量偏差,同時,可以直接將該像素位置確定為進行二次預測或PROF處理的濾波器所使用的中心位置。It can be understood that, in the embodiment of the application, after the encoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the first absolute value and the second absolute value are If the values are less than the preset deviation, it can be considered that the vector deviation between the pixel position and the sub-block is small, and the prediction result obtained by using the pixel position as the center position of the filter for secondary prediction or PROF processing is more accurate. Therefore, The first motion vector deviation corresponding to the pixel position can be directly determined as the second motion vector deviation used for secondary prediction or PROF processing, and at the same time, the pixel position can be directly determined as the filtering for secondary prediction or PROF processing. the center position used by the device.

進一步,在本申請的實施例中,編碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第一絕對值大於或者等於預設偏差閾值,且第二絕對值小於預設偏差閾值,那麼可以根據水平偏差確定第一調整方向;然後可以根據第一調整方向,確定中心位置和第二運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the deviation between the center position and the second motion vector according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the first absolute value is greater than or equal to the preset deviation threshold, and If the second absolute value is smaller than the preset deviation threshold, the first adjustment direction may be determined according to the horizontal deviation; then, the deviation between the center position and the second motion vector may be determined according to the first adjustment direction.

需要說明的是,在本申請的實施例中,第一調整方向用於對第一運動向量在水平方向上進行調整,因此,第一調整方向包括左側和右側。It should be noted that, in the embodiment of the present application, the first adjustment direction is used to adjust the first motion vector in the horizontal direction. Therefore, the first adjustment direction includes left and right sides.

可以理解的是,在申請的實施例中,編碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第一絕對值大於或者等於預設偏差閾值,且第二絕對值小於預設偏差閾值,便可以認為像素位置與子塊之間在水平方向上的運動向量偏差較大,如果使用該像素作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果可能存在誤差,因此,需要進一步按照水平偏差確定出第一調整方向,然後再根據第一調整方向進行調整,最終便可以確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。It can be understood that, in the embodiment of the application, after the encoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the first absolute value is greater than or equal to the preset deviation threshold If the deviation threshold is set, and the second absolute value is less than the preset deviation threshold, it can be considered that the motion vector deviation in the horizontal direction between the pixel position and the sub-block is relatively large. If the pixel is used as the center position of the filter for secondary prediction Or the prediction results obtained by PROF processing may have errors. Therefore, it is necessary to further determine the first adjustment direction according to the horizontal deviation, and then adjust according to the first adjustment direction, and finally determine the second prediction or PROF processing. Use the center position and the second motion vector offset.

進一步地,在本申請的實施例中,編碼器在根據第一調整方向,確定中心位置和第二運動向量偏差時,如果第一調整方向為左側,那麼可以將該任一像素位置的相鄰左側像素位置作為中心位置,然後,可以將第一運動向量偏差加(1,0),從而可以獲得對應的第二運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the deviation between the center position and the second motion vector according to the first adjustment direction, if the first adjustment direction is the left side, then the adjacent pixel position of the encoder can be adjusted. The left pixel position is taken as the center position, and then, (1, 0) can be added to the first motion vector deviation, so that the corresponding second motion vector deviation can be obtained.

進一步地,在本申請的實施例中,編碼器在根據第一調整方向,確定中心位置和第二運動向量偏差,如果第一調整方向為右側,那麼可以將任一像素位置的相鄰右側像素位置作為中心位置,然後,可以將第一運動向量偏差減(1,0),從而可以獲得第二運動向量偏差。Further, in the embodiment of the present application, the encoder determines the deviation between the center position and the second motion vector according to the first adjustment direction. If the first adjustment direction is the right side, then the adjacent right pixels of any pixel position can be adjusted. The position is taken as the center position, and then the first motion vector deviation can be subtracted by (1, 0), so that the second motion vector deviation can be obtained.

進一步,在本申請的實施例中,編碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第二絕對值大於或者等於預設偏差閾值,且第一絕對值小於預設偏差閾值,那麼可以根據垂直偏差確定第二調整方向;然後可以根據第二調整方向,確定中心位置和第二運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the deviation between the center position and the second motion vector according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the second absolute value is greater than or equal to the preset deviation threshold, and If the first absolute value is smaller than the preset deviation threshold, the second adjustment direction may be determined according to the vertical deviation; then the center position and the second motion vector deviation may be determined according to the second adjustment direction.

需要說明的是,在本申請的實施例中,第二調整方向用於對第一運動向量在垂直方向上進行調整,因此,第二調整方向包括上側和下側。It should be noted that, in the embodiment of the present application, the second adjustment direction is used to adjust the first motion vector in the vertical direction. Therefore, the second adjustment direction includes an upper side and a lower side.

可以理解的是,在申請的實施例中,編碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第二絕對值大於或者等於預設偏差閾值,且第一絕對值小於預設偏差閾值,便可以認為像素位置與子塊之間在垂直方向上的運動向量偏差較大,如果使用該像素作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果可能存在誤差,因此,需要進一步按照垂直偏差確定出第二調整方向,然後再根據第二調整方向進行調整,最終便可以確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。It can be understood that, in the embodiment of the application, after the encoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the second absolute value is greater than or equal to the preset deviation threshold If the deviation threshold is set, and the first absolute value is smaller than the preset deviation threshold, it can be considered that the deviation of the motion vector in the vertical direction between the pixel position and the sub-block is relatively large. If the pixel is used as the center position of the filter for secondary prediction Or the prediction results obtained by PROF processing may have errors. Therefore, it is necessary to further determine the second adjustment direction according to the vertical deviation, and then adjust according to the second adjustment direction. Finally, it can be determined that the second adjustment direction is used for secondary prediction or PROF processing. Use the center position and the second motion vector offset.

進一步地,在本申請的實施例中,編碼器在根據第二調整方向,確定中心位置和第二運動向量偏差時,如果第二調整方向為上側,那麼可以將該任一像素位置的相鄰上側像素位置作為中心位置,然後,可以將第一運動向量偏差加(0,1),從而可以獲得對應的第二運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the deviation between the center position and the second motion vector according to the second adjustment direction, if the second adjustment direction is the upper side, then the adjacent position of any pixel can be adjusted. The upper pixel position is taken as the center position, and then (0, 1) can be added to the first motion vector deviation, so that the corresponding second motion vector deviation can be obtained.

進一步地,在本申請的實施例中,編碼器在根據第二調整方向,確定中心位置和第二運動向量偏差,如果第二調整方向為下側,那麼可以將任一像素位置的相鄰下側像素位置作為中心位置,然後,可以將第一運動向量偏差減(0,1),從而可以獲得第二運動向量偏差。Further, in the embodiment of the present application, the encoder determines the deviation between the center position and the second motion vector according to the second adjustment direction, and if the second adjustment direction is the lower side, then the adjacent lower side of any pixel position can be adjusted. The side pixel position is taken as the center position, and then, the first motion vector offset can be subtracted by (0, 1), so that the second motion vector offset can be obtained.

進一步,在本申請的實施例中,編碼器在根據水平偏差、垂直偏差以及預設偏差閾值,確定中心位置和第二運動向量偏差時,如果第一絕對值和第二絕對值均大於或者等於預設偏差閾值,那麼可以根據水平偏差和垂直偏差確定第三調整方向;然後可以根據第三調整方向,確定中心位置和第二運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and the preset deviation threshold, if the first absolute value and the second absolute value are both greater than or equal to If the deviation threshold is preset, the third adjustment direction may be determined according to the horizontal deviation and the vertical deviation; and then the center position and the deviation of the second motion vector may be determined according to the third adjustment direction.

需要說明的是,在本申請的實施例中,第三調整方向用於對第一運動向量在水平方向和垂直方向上同時進行調整,因此,第三調整方向包括右上側、右下側、左上側以及左下側。It should be noted that, in the embodiment of the present application, the third adjustment direction is used to adjust the first motion vector in the horizontal direction and the vertical direction at the same time. Therefore, the third adjustment direction includes the upper right side, the lower right side, the upper left side side and lower left.

可以理解的是,在申請的實施例中,編碼器在將水平偏差的第一絕對值和垂直偏差的第二絕對值分別與預設偏差閾值進行比較之後,如果第一絕對值和第二絕對值都大於或者等於預設偏差閾值,便可以認為像素位置與子塊之間在水平方向和垂直方向上的運動向量偏差均較大,如果使用該像素作為濾波器的中心位置進行二次預測或PROF處理所獲得的預測結果可能存在誤差,因此,需要進一步按照水平偏差和垂直偏差確定出第三調整方向,然後再根據第三調整方向進行調整,最終便可以確定出進行二次預測或PROF處理時所使用的中心位置和第二運動向量偏差。It can be understood that, in the embodiment of the application, after the encoder compares the first absolute value of the horizontal deviation and the second absolute value of the vertical deviation with the preset deviation threshold respectively, if the first absolute value and the second absolute value are If the value is greater than or equal to the preset deviation threshold, it can be considered that the deviation of the motion vector between the pixel position and the sub-block in the horizontal and vertical directions is large. If the pixel is used as the center position of the filter for secondary prediction or There may be errors in the prediction results obtained by PROF processing. Therefore, it is necessary to further determine the third adjustment direction according to the horizontal deviation and vertical deviation, and then adjust according to the third adjustment direction. Finally, it can be determined to perform secondary prediction or PROF processing. The center position and the second motion vector offset used when .

進一步地,在本申請的實施例中,編碼器在根據第三調整方向,確定中心位置和第二運動向量偏差時,如果第三調整方向為左上側,那麼可以將該任一像素位置的相鄰左上側像素位置作為中心位置,然後,可以將第一運動向量偏差加(1,1),從而可以獲得對應的第二運動向量偏差。Further, in the embodiment of the present application, when the encoder determines the deviation between the center position and the second motion vector according to the third adjustment direction, if the third adjustment direction is the upper left side, then the phase difference of any pixel position can be determined. The pixel position adjacent to the upper left side is taken as the center position, and then, (1, 1) can be added to the first motion vector deviation, so that the corresponding second motion vector deviation can be obtained.

進一步地,在本申請的實施例中,編碼器在根據第三調整方向,確定中心位置和第二運動向量偏差,如果第三調整方向為右下側,那麼可以將任一像素位置的相鄰右下側像素位置作為中心位置,然後,可以將第一運動向量偏差減(1,1),從而可以獲得第二運動向量偏差。Further, in the embodiment of the present application, the encoder determines the deviation between the center position and the second motion vector according to the third adjustment direction. If the third adjustment direction is the lower right side, then the adjacent pixel position of any pixel The pixel position on the lower right side is taken as the center position, and then, the first motion vector deviation can be subtracted by (1, 1), so that the second motion vector deviation can be obtained.

可以理解的是,在本申請的實施例中,第二運動向量偏差在水平方向和垂直方向上的偏差值均小於預設偏差閾值。It can be understood that, in the embodiment of the present application, the deviation values of the second motion vector deviation in the horizontal direction and the vertical direction are both smaller than the preset deviation threshold.

也就是說,在本申請中,編碼器在確定出子塊中的每一個像素位置的運動向量與子塊的運動向量的偏差之後,且在對基於子塊的預測的預測塊進行濾波之前,可以先進行中心位置和第二運動向量偏差的確定,其中,中心位置和第二運動向量用於進行二次預測或PROF處理。That is, in the present application, after the encoder determines the deviation of the motion vector of each pixel position in the sub-block from the motion vector of the sub-block, and before filtering the prediction block based on the prediction of the sub-block, The center position and the second motion vector deviation may be determined first, wherein the center position and the second motion vector are used for secondary prediction or PROF processing.

具體地,在本申請中,對於子塊中的每一個像素位置,可以先確定其與子塊之間的第一運動向量偏差的大小,其中包括第一運動向量偏差在水平方向和垂直方向上的水平偏差和垂直偏差。如果某個像素位置的運動向量偏差的水平方向和/或垂直方向的絕對值大於預設偏差閾值,那麼可以確定該像素位置對應的濾波器的中心位置不再是該像素位置本身,而需要進一步對中心位置和第二運動向量偏差進行確定。Specifically, in this application, for each pixel position in a sub-block, the magnitude of the first motion vector deviation between it and the sub-block can be determined first, including the horizontal and vertical directions of the first motion vector deviation horizontal and vertical deviations. If the absolute value of the horizontal direction and/or the vertical direction of the motion vector deviation of a certain pixel position is greater than the preset deviation threshold, it can be determined that the center position of the filter corresponding to the pixel position is no longer the pixel position itself, and further The center position and the second motion vector offset are determined.

進一步地,在本申請的實施例中,在對子塊中的一個像素位置進行二次預測或PROF處理之前,如果確定該像素位置與子塊之間的第一運動向量偏差在水平方向和\或垂直方向的偏差分量的絕對值大於或者等於預設偏差閾值(如1/2像素、3/4像素或1像素),那麼便需要對二次預測或PROF處理所使用的起始點進行調整,即二次預測或PROF處理所使用的二維濾波器的中心位置進行調整。Further, in the embodiment of the present application, before performing secondary prediction or PROF processing on a pixel position in the sub-block, if it is determined that the first motion vector deviation between the pixel position and the sub-block is in the horizontal direction and \ Or the absolute value of the deviation component in the vertical direction is greater than or equal to the preset deviation threshold (such as 1/2 pixel, 3/4 pixel or 1 pixel), then the starting point used for secondary prediction or PROF processing needs to be adjusted. , that is, the center position of the two-dimensional filter used in secondary prediction or PROF processing is adjusted.

可以理解的是,在本申請中,在對中心位置和運動向量偏差進行調整時,可以在當前塊中選擇該與像素位置在水平方向和垂直方向上的運動向量偏差均小於或者等於預設偏差閾值的另一個像素位置。It can be understood that, in this application, when adjusting the center position and the motion vector deviation, it can be selected in the current block that the motion vector deviation from the pixel position in the horizontal direction and the vertical direction is less than or equal to the preset deviation. Another pixel location for the threshold.

在本申請的實施例中,進一步地,在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之前,即步驟S404之前,編碼器進行幀間預測的方法還可以包括以下步驟:In the embodiment of the present application, further, before determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, that is, before step S404, the method for performing inter-frame prediction by the encoder may also be Include the following steps:

步驟406、按照預設偏差範圍對第一運動向量偏差進行限制處理;其中,預設偏差範圍包括偏差下限值和偏差上限值。Step 406: Limit the deviation of the first motion vector according to a preset deviation range, wherein the preset deviation range includes a deviation lower limit value and a deviation upper limit value.

在本申請的實施例中,編碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之前,可以先對第一運動向量進行限制。具體地,編碼器可以按照預設偏差範圍對第一運動向量偏差進行限制處理;其中,預設偏差範圍包括偏差下限值和偏差上限值。In the embodiment of the present application, before determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the encoder may first limit the first motion vector. Specifically, the encoder may limit the deviation of the first motion vector according to a preset deviation range, wherein the preset deviation range includes a deviation lower limit value and a deviation upper limit value.

進一步地,在本申請的實施例中,編碼器按照預設偏差範圍對第一運動向量偏差進行限制處理時,如果水平偏差和\或垂直偏差小於偏差下限值,那麼可以將水平偏差和\或垂直偏差設置為偏差下限值;如果水平偏差和\或垂直偏差大於偏差上限值,那麼可以將水平偏差和\或垂直偏差設置為偏差上限值。Further, in the embodiment of the present application, when the encoder performs limiting processing on the first motion vector deviation according to the preset deviation range, if the horizontal deviation and\or the vertical deviation are less than the deviation lower limit value, then the horizontal deviation and\ Or vertical deviation is set as the lower deviation value; if the horizontal deviation and\or vertical deviation is greater than the upper deviation value, then the horizontal deviation and\or vertical deviation can be set as the upper deviation value.

需要說明的是,在本申請中,編碼器既可以不對第一運動向量偏差進行限制,即不進行步驟407,而是直接根據第一運動向量偏差將中心位置調整到任何合適的像素位置。也可以先按照步驟407執行對第一運動向量偏差的限制處理,或者是對可調整的範圍及運動向量偏差進行限制。It should be noted that, in this application, the encoder may not limit the first motion vector deviation, that is, without performing step 407, but directly adjust the center position to any suitable pixel position according to the first motion vector deviation. It is also possible to first perform the limitation processing on the first motion vector deviation according to step 407, or to limit the adjustable range and the motion vector deviation.

進一步地,在本申請的實施例中,預設偏差範圍可以由偏差下限值min和偏差上限值max構成,即預設偏差範圍可以表示為(min,max),在對第一運動向量偏差進行限制處理時,如果第一運動向量偏差的水平方向和\或垂直方向的偏差值小於偏差下限值min,那麼可以直接將該偏差值設為min;如果第一運動向量偏差的水平方向和\或垂直方向的偏差值大於max,那麼可以直接將該偏差值設為max。Further, in the embodiment of the present application, the preset deviation range may be composed of a lower deviation limit min and an upper deviation upper limit max, that is, the preset deviation range may be expressed as (min, max), and when the first motion vector When the deviation is limited, if the deviation value of the horizontal direction and/or vertical direction of the first motion vector deviation is less than the deviation lower limit value min, then the deviation value can be directly set as min; if the horizontal direction of the first motion vector deviation And \ or the deviation value in the vertical direction is greater than max, then you can directly set the deviation value to max.

在本申請的實施例中,進一步地,在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,即步驟S404之後,編碼器進行幀間預測的方法還可以包括以下步驟:In the embodiment of the present application, further, after determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, that is, after step S404, the method for performing inter-frame prediction by the encoder may also Include the following steps:

步驟407、若中心位置不屬於當前塊,則按照當前塊中的像素位置重新確定中心位置。Step 407: If the center position does not belong to the current block, re-determine the center position according to the pixel position in the current block.

在本申請的實施例中,編碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,可以先對中心位置是否超出了當前塊進行確定,如果中心位置超出了當前塊的範圍,即中心位置不屬於當前塊,那麼編碼器便需要按照當前塊中的像素位置重新確定中心位置。In the embodiment of the present application, after determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the encoder may first determine whether the center position exceeds the current block, if the center position If it exceeds the range of the current block, that is, the center position does not belong to the current block, the encoder needs to re-determine the center position according to the pixel position in the current block.

在本申請的實施例中,進一步地,在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,即步驟S404之後,編碼器進行幀間預測的方法還可以包括以下步驟:In the embodiment of the present application, further, after determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, that is, after step S404, the method for performing inter-frame prediction by the encoder may also Include the following steps:

步驟408、若中心位置不屬於當前塊,則直接將每一個像素位置確定為每一個像素位置對應的中心位置。Step 408: If the center position does not belong to the current block, directly determine each pixel position as the center position corresponding to each pixel position.

在本申請的實施例中,編碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,可以先對中心位置是否超出了當前塊進行確定,如果中心位置超出了當前塊的範圍,即中心位置不屬於當前塊,那麼編碼器可以直接將對應的、原始的像素位置確定為中心位置。即基於子塊中的每一個像素位置對應的第一運動向量偏差所確定的中心位置如果超出了當前塊的範圍,那麼編碼器可以選擇任然將該每一個像素位置作為中心位置。In the embodiment of the present application, after determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the encoder may first determine whether the center position exceeds the current block, if the center position If it exceeds the range of the current block, that is, the center position does not belong to the current block, the encoder can directly determine the corresponding, original pixel position as the center position. That is, if the center position determined based on the first motion vector deviation corresponding to each pixel position in the sub-block is beyond the range of the current block, the encoder may choose to still use each pixel position as the center position.

也就是說,在本申請的實施例中,對於調整後的二次預測的起始位置,即基於第一運動向量偏差所確定的濾波器使用的中心位置,編碼器可以限制該中心位置不超過當前塊的範圍,即不會超過當前塊中的所有像素位置在調整前的二次預測的起始位置的範圍。That is to say, in the embodiment of the present application, for the starting position of the adjusted secondary prediction, that is, the center position used by the filter determined based on the first motion vector deviation, the encoder can limit the center position to no more than The range of the current block, that is, will not exceed the range of the starting positions of all pixel positions in the current block before the adjustment of the secondary prediction.

步驟S405、基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值。Step S405 , based on the first predicted value, perform secondary prediction or PROF processing according to the center position and the second motion vector deviation, determine the second predicted value of the subblock, and determine the second predicted value as the inter-frame predicted value of the subblock.

在本申請的實施例中,編碼器在根據第一運動向量偏差確定每一個像素位置對應的中心位置和第二運動向量偏差之後,便可以基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,從而可以獲得每一個像素位置的像素的預測值。In the embodiment of the present application, after the encoder determines the center position and the second motion vector deviation corresponding to each pixel position according to the first motion vector deviation, the encoder can determine the center position and the second motion vector deviation based on the first predicted value The deviation is subjected to secondary prediction or PROF processing, so that the predicted value of the pixel at each pixel position can be obtained.

進一步地,在本申請的實施例中,編碼器在遍歷子塊中的每一個像素位置,獲得每一個像素位置的像素的預測值之後,便可以根據每一個像素位置的像素的預測值確定出子塊的第二預測值,從而可以將第二預測值確定為子塊的幀間預測值。Further, in the embodiment of the present application, after the encoder traverses each pixel position in the sub-block and obtains the predicted value of the pixel at each pixel position, it can determine the predicted value according to the predicted value of the pixel at each pixel position. the second predicted value of the sub-block, so that the second predicted value can be determined as the inter-frame predicted value of the sub-block.

需要說明的是,在本申請的實施例中,由於中心位置和第二運動向量偏差可以用於對子塊中的每一個像素位置的像素點進行二次預測或PROF處理,因此,在獲得中心位置和第二運動向量偏差以後,編碼器可以基於第一預測值,利用中心位置和第二運動向量偏差對每一個像素位置的像素點進行二次預測或PROF處理,最終可以獲得子塊對應的第二預測值,從而便可以將第二預測值確定為子塊的幀間預測值。It should be noted that, in the embodiments of the present application, since the center position and the second motion vector deviation can be used to perform secondary prediction or PROF processing on the pixel points of each pixel position in the sub-block, therefore, after obtaining the center After the position and the second motion vector deviation, the encoder can use the center position and the second motion vector deviation to perform secondary prediction or PROF processing on the pixels of each pixel position based on the first predicted value, and finally obtain the corresponding sub-block. the second predicted value, so that the second predicted value can be determined as the inter-frame predicted value of the sub-block.

進一步地,在本申請的實施例中,編碼器基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值的方法可以包括以下步驟:Further, in the embodiment of the present application, the encoder performs secondary prediction or PROF processing according to the center position and the second motion vector deviation based on the first predicted value, determines the second predicted value of the sub-block, and uses the second predicted value The method of determining an inter-predicted value for a sub-block may include the following steps:

步驟S405a、確定PROF參數;Step S405a, determine PROF parameters;

步驟S405b、當PROF參數指示進行PROF處理時,基於第一預測值確定中心位置對應的像素水平梯度和像素垂直梯度;Step S405b, when the PROF parameter indicates that PROF processing is performed, the pixel horizontal gradient and the pixel vertical gradient corresponding to the center position are determined based on the first predicted value;

步驟S405c、根據像素水平梯度、像素垂直梯度以及第二運動向量偏差,計算每一個像素位置對應的偏差值;Step S405c, according to the pixel horizontal gradient, the pixel vertical gradient and the second motion vector deviation, calculate the deviation value corresponding to each pixel position;

步驟S405d、基於第一預測值和偏差值,獲得每一個像素位置的像素的預測值;Step S405d, based on the first predicted value and the deviation value, obtain the predicted value of the pixel at each pixel position;

步驟S405e、利用每一個像素位置的像素的預測值,確定第二預測值。Step S405e, using the predicted value of the pixel at each pixel position to determine the second predicted value.

在本申請的實施例中,編碼器可以先確定PROF參數,如果PROF參數指示進行PROF處理,那麼編碼器可以基於第一預測值確定中心位置對應的像素水平梯度和像素垂直梯度;其中,像素水平梯度即為中心位置對應的像素值與水平方向上的、相鄰像素位置對應的像素值之間的梯度值;像素垂直梯度即為中心位置對應的像素值與垂直方向上的、相鄰像素位置對應的像素值之間的梯度值。In the embodiment of the present application, the encoder may first determine the PROF parameter, and if the PROF parameter indicates that PROF processing is performed, the encoder may determine the pixel horizontal gradient and the pixel vertical gradient corresponding to the center position based on the first predicted value; The gradient is the gradient value between the pixel value corresponding to the center position and the pixel value corresponding to the adjacent pixel position in the horizontal direction; the vertical gradient of the pixel is the pixel value corresponding to the center position and the adjacent pixel position in the vertical direction. The gradient value between corresponding pixel values.

進一步地,在本申請的實施例中,編碼器可以根據每一個像素位置對應的中心位置的像素水平梯度、像素垂直梯度以及第二運動向量偏差,計算獲得與每一個像素位置對應的偏差值。其中,該偏差值可以用於對每一個像素位置的像素值的預測值進行修正處理。Further, in the embodiment of the present application, the encoder can calculate and obtain the deviation value corresponding to each pixel position according to the pixel horizontal gradient, the pixel vertical gradient and the second motion vector deviation of the center position corresponding to each pixel position. Wherein, the deviation value can be used to correct the predicted value of the pixel value of each pixel position.

需要說明的是,在本申請的實施例中,編碼器可以進一步根據第一預測值和偏差值,獲得任一個像素位置所對應的修正後預測值,並在遍歷當前子塊中的每一個像素位置,獲得每一個像素位置對應的修正後預測值之後,利用全部像素位置對應的修正後預測值確定出當前子塊對應的第二預測值,從而確定出對應的幀間預測值。具體地,在本申請中,在完成基於子塊的預測之後,將當前子塊的第一預測值作為每一個像素位置的預測值,接著,將第一預測值與每一個像素位置對應的偏差值相加,即可以完成對每一個像素位置的預測值的修正處理,獲得修正後預測值,從而可以進一步獲得當前子塊的第二預測值,並將第二預測值作為當前子塊對應的幀間預測值。It should be noted that, in the embodiment of the present application, the encoder can further obtain the corrected predicted value corresponding to any pixel position according to the first predicted value and the deviation value, and traverse each pixel in the current sub-block After obtaining the modified predicted value corresponding to each pixel position, the second predicted value corresponding to the current sub-block is determined by using the modified predicted value corresponding to all pixel positions, thereby determining the corresponding inter-frame predicted value. Specifically, in this application, after the sub-block-based prediction is completed, the first prediction value of the current sub-block is used as the prediction value of each pixel position, and then the deviation corresponding to the first prediction value and each pixel position is used The value is added, that is, the correction processing of the predicted value of each pixel position can be completed, and the corrected predicted value can be obtained, so that the second predicted value of the current sub-block can be further obtained, and the second predicted value can be used as the corresponding value of the current sub-block. Interframe prediction value.

進一步地,在本申請的實施例中,編碼器基於第一預測值,按照中心位置和第二運動向量偏差進行二次預測或PROF處理,確定子塊的第二預測值,將第二預測值確定為子塊的幀間預測值的方法可以包括以下步驟:Further, in the embodiment of the present application, the encoder performs secondary prediction or PROF processing according to the center position and the second motion vector deviation based on the first predicted value, determines the second predicted value of the sub-block, and uses the second predicted value The method of determining an inter-predicted value for a sub-block may include the following steps:

步驟S405f、確定二次預測參數;Step S405f, determine secondary prediction parameters;

步驟S405g、當二次預測參數指示使用二次預測時,根據第二運動向量偏差確定二維濾波器的濾波係數;其中,二維濾波器用於按照預設形狀進行二次預測處理;Step S405g, when the secondary prediction parameter indicates the use of secondary prediction, determine the filter coefficient of the two-dimensional filter according to the second motion vector deviation; wherein, the two-dimensional filter is used to perform secondary prediction processing according to a preset shape;

步驟S405h、基於濾波係數和第一預測值,確定每一個像素位置的像素的預測值;Step S405h, based on the filter coefficient and the first predicted value, determine the predicted value of the pixel at each pixel position;

步驟S405i、利用每一個像素位置的像素的預測值,確定第二預測值。Step S405i, using the predicted value of the pixel at each pixel position to determine the second predicted value.

在本申請的實施例中,編碼器可以先確定二次預測參數,如果二次預測參數指示使用二次預測,那麼編碼器可以根據第二運動向量偏差確定二維濾波器的濾波係數;其中,二維濾波器用於按照預設形狀進行二次預測處理。In the embodiment of the present application, the encoder may first determine the secondary prediction parameter, and if the secondary prediction parameter indicates to use the secondary prediction, the encoder may determine the filter coefficient of the two-dimensional filter according to the second motion vector deviation; wherein, The two-dimensional filter is used for secondary prediction processing according to the preset shape.

需要說明的是,在本申請的實施例中,二維濾波器的濾波器係數是與目標像素位置所對應的第二運動向量偏差相關的。也就是說,對於不同的目標像素位置,如果對應的第二運動向量偏差不同,那麼使用的二維濾波器的濾波係數也是不同的。It should be noted that, in the embodiment of the present application, the filter coefficient of the two-dimensional filter is related to the deviation of the second motion vector corresponding to the target pixel position. That is to say, for different target pixel positions, if the corresponding second motion vector deviations are different, the filter coefficients of the used two-dimensional filters are also different.

可以理解的是,在本申請的實施例中,二維濾波器用於利用多個相鄰的、構成預設形狀的像素位置進行二次預測。其中,預設形狀為矩形、菱形或任意一種對稱形狀。It can be understood that, in the embodiment of the present application, a two-dimensional filter is used to perform secondary prediction by using a plurality of adjacent pixel positions that form a preset shape. The preset shape is a rectangle, a rhombus or any symmetrical shape.

也就是說,在本申請的中,用於進行二次預測的二維濾波器是相鄰的構成預設形狀的點所構成的濾波器。相鄰的構成預設形狀的點可以包括多個點,例如由9個點構成。預設形狀可以為對稱形狀,例如,預設形狀可以包括矩形、菱形或其他任意一種對稱形狀。That is to say, in the present application, the two-dimensional filter used for secondary prediction is a filter formed by adjacent points forming a preset shape. The adjacent dots constituting the preset shape may include a plurality of dots, for example, composed of 9 dots. The predetermined shape may be a symmetrical shape, for example, the predetermined shape may include a rectangle, a rhombus, or any other symmetrical shape.

示例性的,在本申請中,二維濾波器是一個矩形的濾波器,具體地,二維濾波器是由9個相鄰的構成矩形的像素位置組成的濾波器。在9個像素位置中,位於中心的像素位置是當前需要二次預測的像素的像素位置,即當前像素位置。Exemplarily, in this application, the two-dimensional filter is a rectangular filter, and specifically, the two-dimensional filter is a filter composed of 9 adjacent pixel positions forming a rectangle. Among the 9 pixel positions, the pixel position located in the center is the pixel position of the pixel currently requiring secondary prediction, that is, the current pixel position.

進一步地,在本申請的實施例中,編碼器在根據第二運動向量偏差確定二維濾波器的濾波係數時,可以先確定比例參數,然後可以根據比例參數和第二運動向量偏差,確定像素位置對應的濾波器係數。Further, in the embodiment of the present application, when the encoder determines the filter coefficient of the two-dimensional filter according to the second motion vector deviation, it can first determine the scale parameter, and then can determine the pixel according to the scale parameter and the second motion vector deviation. The filter coefficients corresponding to the positions.

需要說明的是,在本申請的實施例中,比例參數可以包括至少一個比例值,第二運動向量偏差包括水平偏差和垂直偏差;其中,至少一個比例值均為非零實數。It should be noted that, in the embodiment of the present application, the scale parameter may include at least one scale value, and the second motion vector deviation includes a horizontal deviation and a vertical deviation; wherein, at least one scale value is a non-zero real number.

具體地,在本申請中,當二維濾波器利用9個相鄰的、構成矩形的像素位置進行二次預測時,位於矩形的中心的像素位置為待預測位置,即當前像素位置,其他8個目標像素位置依次位於當前像素位置的左上、上、右上、右、右下、下、左下、左這8個方向。Specifically, in this application, when the two-dimensional filter uses 9 adjacent pixel positions that form a rectangle to perform secondary prediction, the pixel position located in the center of the rectangle is the position to be predicted, that is, the current pixel position, and the other 8 The target pixel positions are sequentially located in the eight directions of the upper left, upper, upper right, right, lower right, lower, lower left, and left of the current pixel position.

相應地,在本申請中,編碼器可以基於至少一個比例值和待預測位置的第二運動向量偏差,按照預設計算規則計算獲得9個相鄰的像素位置對應的9個濾波器係數。Correspondingly, in the present application, the encoder can calculate and obtain 9 filter coefficients corresponding to 9 adjacent pixel positions based on at least one scale value and the deviation of the second motion vector of the position to be predicted according to a preset calculation rule.

需要說明的是,在本申請中,預設計算規則可以包括多種不同的計算方式,如加法運算、減法運算、乘法運算等。其中,對於不同的像素位置,可以使用不同的計算方式進行濾波器係數的計算。It should be noted that, in this application, the preset calculation rule may include various calculation methods, such as addition operation, subtraction operation, multiplication operation, and the like. Among them, for different pixel positions, different calculation methods can be used to calculate the filter coefficients.

可以理解的是,在本申請中,編碼器在按照預設計算規則中不同的計算方法計算獲得多個像素位置對應的多個濾波器係數中,部分濾波器係數可以為第二運動向量偏差的一次函數,即兩者為線性關係,還可以為第二運動向量偏差的二次函數或高次函數,即兩者為非線性關係。It can be understood that, in this application, when the encoder calculates and obtains multiple filter coefficients corresponding to multiple pixel positions according to different calculation methods in the preset calculation rules, some filter coefficients may be the difference of the second motion vector deviation. The linear function, that is, the two are in a linear relationship, may also be a quadratic function or a higher-order function of the deviation of the second motion vector, that is, the two are in a non-linear relationship.

也就是說,在本申請中,多個相鄰的像素位置對應的多個濾波器係數中的任意一個濾波器係數,可以為第二運動向量偏差的一次函數、二次函數或者高次函數。That is to say, in the present application, any one of the multiple filter coefficients corresponding to multiple adjacent pixel positions may be a linear function, a quadratic function, or a higher-order function of the second motion vector deviation.

可以理解的是,在本申請中,編碼器可以將預測模式參數、仿射模式參數、預測參考模式寫入位元流。還可以將PROF參數、二次預測參數寫入位元流。It can be understood that, in this application, the encoder can write prediction mode parameters, affine mode parameters, and prediction reference modes into the bitstream. PROF parameters, secondary prediction parameters can also be written to the bitstream.

本實施例提供了一種幀間預測方法,可以在基於子塊的預測之後,對運動向量與子塊的運動向量之間的第一運動向量偏差較大的像素位置,可以基於第一運動向量偏差重新確定進行二次預測或PROF處理所使用的中心位置和第二運動向量偏差的確定,從而可以在基於子塊的第一預測值的基礎上,利用中心位置和第二運動向量偏差進行基於點的二次預測,獲得第二預測值。可見,本申請提出的幀間預測方法能夠很好的適用於全部場景,可以減小預測的誤差,大大提升編碼性能,從而提高了編編碼效率。This embodiment provides an inter-frame prediction method. After prediction based on sub-blocks, for pixel positions with a large deviation of the first motion vector between the motion vector and the motion vector of the sub-block, the deviation of the first motion vector can be determined based on the first motion vector deviation. Redetermine the determination of the center position and the second motion vector offset used for secondary prediction or PROF processing, so that the center position and the second motion vector offset can be used for point-based point-based The secondary prediction of , obtains the second prediction value. It can be seen that the inter-frame prediction method proposed in the present application can be well applied to all scenarios, can reduce the prediction error, greatly improve the coding performance, and thus improve the coding efficiency.

基於上述實施例,在本申請的再一實施例中,圖20為解碼器的組成結構示意圖一,如圖20所示,本申請實施例提出的解碼器300可以包括解析單元301和第一確定單元302;Based on the above embodiment, in yet another embodiment of the present application, FIG. 20 is a schematic diagram of the composition and structure of a decoder. As shown in FIG. 20 , the decoder 300 proposed in this embodiment of the present application may include a parsing unit 301 and a first determining unit 302;

所述解析單元301,用於解析位元流,獲取當前塊的預測模式參數;The parsing unit 301 is used for parsing the bit stream to obtain the prediction mode parameter of the current block;

所述第一確定單元302,用於當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。The first determining unit 302 is configured to determine the first motion vector of the sub-block of the current block when the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode; wherein, The current block includes a plurality of sub-blocks; a first predictor of the sub-block is determined based on the first motion vector, and a first motion vector between each pixel position in the sub-block and the sub-block deviation; determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation; based on the first predicted value, perform according to the center position and the second motion vector deviation Secondary prediction or PROF processing, determining a second prediction value of the sub-block, and determining the second prediction value as an inter-frame prediction value of the sub-block.

圖21為解碼器的組成結構示意圖二,如圖21所示,本申請實施例提出的解碼器300還可以包括第一處理器303、儲存有第一處理器303可執行指令的第一記憶體304、第一通訊介面305,和用於連接第一處理器303、第一記憶體304以及第一通訊介面305的第一匯流排306。FIG. 21 is a second schematic diagram of the structure of the decoder. As shown in FIG. 21 , the decoder 300 proposed in this embodiment of the present application may further include a first processor 303 and a first memory storing instructions executable by the first processor 303 304 , a first communication interface 305 , and a first bus bar 306 for connecting the first processor 303 , the first memory 304 and the first communication interface 305 .

進一步地,在本申請的實施例中,上述第一處理器303,用於解析位元流,獲取當前塊的預測模式參數;當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。Further, in the embodiment of the present application, the above-mentioned first processor 303 is configured to parse the bit stream to obtain the prediction mode parameter of the current block; when the prediction mode parameter indicates that the current block is determined using the inter prediction mode when the inter-frame prediction value of and the first motion vector deviation between each pixel position in the sub-block and the sub-block; determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation Based on the first predicted value, carry out secondary prediction or PROF processing according to the center position and the second motion vector deviation, determine the second predicted value of the sub-block, and determine the second predicted value as the inter-predicted value of the sub-block.

圖22為編碼器的組成結構示意圖一,如圖22所示,本申請實施例提出的編碼器400可以包括第二確定單元401;FIG. 22 is a schematic diagram 1 of the composition structure of the encoder. As shown in FIG. 22 , the encoder 400 proposed in this embodiment of the present application may include a second determining unit 401;

所述第二確定單元401,用於確定當前塊的預測模式參數;當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。The second determining unit 401 is configured to determine a prediction mode parameter of the current block; when the prediction mode parameter indicates that an inter prediction value of the current block is determined using an inter prediction mode, determine a subblock of the current block The first motion vector of the first motion vector deviation between blocks; determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation; based on the first predicted value, according to the center position and The second motion vector deviation is subjected to secondary prediction or PROF processing, a second prediction value of the sub-block is determined, and the second prediction value is determined as an inter-frame prediction value of the sub-block.

圖23為編碼器的組成結構示意圖二,如圖23所示,本申請實施例提出的編碼器400還可以包括第二處理器402、儲存有第二處理器402可執行指令的第二記憶體403、第二通訊介面404,和用於連接第二處理器402、第二記憶體403以及第二通訊介面404的第二匯流排405。FIG. 23 is a second schematic diagram of the composition and structure of the encoder. As shown in FIG. 23 , the encoder 400 proposed in this embodiment of the present application may further include a second processor 402 and a second memory storing instructions executable by the second processor 402 403 , a second communication interface 404 , and a second bus bar 405 for connecting the second processor 402 , the second memory 403 and the second communication interface 404 .

進一步地,在本申請的實施例中,上述第二處理器402,用於確定當前塊的預測模式參數;當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。Further, in the embodiment of the present application, the above-mentioned second processor 402 is configured to determine the prediction mode parameter of the current block; when the prediction mode parameter indicates that the inter prediction mode is used to determine the inter prediction value of the current block When , determine the first motion vector of the sub-block of the current block; wherein, the current block includes a plurality of sub-blocks; determine the first predicted value of the sub-block based on the first motion vector, and the sub-block The first motion vector deviation between each pixel position in the sub-block and the sub-block; the center position corresponding to each pixel position and the second motion vector deviation are determined according to the first motion vector deviation; a predicted value, perform secondary prediction or PROF processing according to the center position and the deviation of the second motion vector, determine the second predicted value of the sub-block, and determine the second predicted value as the second predicted value of the sub-block Interframe prediction value.

本申請實施例提供了一種解碼器和編碼器,可以在基於子塊的預測之後,對運動向量與子塊的運動向量之間的第一運動向量偏差較大的像素位置,可以基於第一運動向量偏差重新確定進行二次預測或PROF處理所使用的中心位置和第二運動向量偏差的確定,從而可以在基於子塊的第一預測值的基礎上,利用中心位置和第二運動向量偏差進行基於點的二次預測,獲得第二預測值。可見,本申請提出的幀間預測方法能夠很好的適用於全部場景,可以減小預測的誤差,大大提升編碼性能,從而提高了編編碼效率。The embodiments of the present application provide a decoder and an encoder, which can, after prediction based on a sub-block, for a pixel position with a large deviation of the first motion vector between the motion vector and the motion vector of the sub-block, based on the first motion The vector deviation re-determines the determination of the center position and the second motion vector deviation used for secondary prediction or PROF processing, so that the center position and the second motion vector deviation can be used on the basis of the first prediction value based on the sub-block. Based on the secondary prediction of the points, a second predicted value is obtained. It can be seen that the inter-frame prediction method proposed in the present application can be well applied to all scenarios, can reduce the prediction error, greatly improve the coding performance, and thus improve the coding efficiency.

本申請實施例提供電腦可讀儲存媒介和電腦可讀儲存媒介,其上儲存有程式,該程式被處理器執行時實現如上述實施例所述的方法。Embodiments of the present application provide a computer-readable storage medium and a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the method described in the above-mentioned embodiments is implemented.

具體來講,本實施例中的一種幀間預測方法對應的程式指令可以被儲存在光碟,硬碟,隨身碟等儲存媒介上,當儲存媒介中的與一種幀間預測方法對應的程式指令被一電子設備讀取或被執行時,包括如下步驟:Specifically, a program instruction corresponding to an inter-frame prediction method in this embodiment may be stored on a storage medium such as an optical disc, a hard disk, a pen drive, etc. When the program instruction corresponding to an inter-frame prediction method in the storage medium is When an electronic device reads or is executed, it includes the following steps:

解析位元流,獲取當前塊的預測模式參數;Parse the bit stream to obtain the prediction mode parameters of the current block;

當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;When the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, a first motion vector of a subblock of the current block is determined; wherein the current block includes a plurality of subblocks;

基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;determining a first predicted value for the subblock based on the first motion vector, and a first motion vector offset between each pixel position in the subblock and the subblock;

根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation;

基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。Based on the first predicted value, secondary prediction or PROF processing is performed according to the center position and the deviation of the second motion vector, the second predicted value of the sub-block is determined, and the second predicted value is determined as the Inter-predicted value of the sub-block.

具體來講,本實施例中的一種幀間預測方法對應的程式指令可以被儲存在光碟,硬碟,隨身碟等儲存媒介上,當儲存媒介中的與一種幀間預測方法對應的程式指令被一電子設備讀取或被執行時,包括如下步驟:Specifically, a program instruction corresponding to an inter-frame prediction method in this embodiment may be stored on a storage medium such as an optical disc, a hard disk, a pen drive, etc. When the program instruction corresponding to an inter-frame prediction method in the storage medium is When an electronic device reads or is executed, it includes the following steps:

確定當前塊的預測模式參數;determine the prediction mode parameter of the current block;

當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;When the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, a first motion vector of a subblock of the current block is determined; wherein the current block includes a plurality of subblocks;

基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;determining a first predicted value for the subblock based on the first motion vector, and a first motion vector offset between each pixel position in the subblock and the subblock;

根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation;

基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。Based on the first predicted value, secondary prediction or PROF processing is performed according to the center position and the deviation of the second motion vector, the second predicted value of the sub-block is determined, and the second predicted value is determined as the Inter-predicted value of the sub-block.

本領域內的技術人員應明白,本申請的實施例可提供為方法、系統、或電腦程式產品。因此,本申請可採用硬體實施例、軟體實施例、或結合軟體和硬體方面的實施例的形式。而且,本申請可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存媒介(包括但不限於磁碟記憶體和光學記憶體等)上實施的電腦程式產品的形式。It should be apparent to those skilled in the art that the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, magnetic disk memory, optical memory, and the like) having computer-usable program code embodied therein.

本申請是參照根據本申請實施例的方法、設備(系統)、和電腦程式產品的實現流程示意圖和/或方方塊圖來描述的。應理解可由電腦程式指令實現流程示意圖和/或方方塊圖中的每一流程和/或方塊、以及實現流程示意圖和/或方方塊圖中的流程和/或方塊的結合。可提供這些電腦程式指令到通用電腦、專用電腦、嵌入式處理機或其他可程式資料處理設備的處理器以產生一個機器,使得透過電腦或其他可程式資料處理設備的處理器執行的指令產生用於實現在實現流程示意圖一個流程或多個流程和/或方方塊圖一個方塊或多個方塊中指定的功能的裝置。The present application is described with reference to schematic flowcharts and/or block diagrams of implementations of methods, apparatuses (systems), and computer program products according to embodiments of the present application. It will be understood that each process and/or block in the schematic flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the schematic flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device generate a Means for implementing the functions specified in a process or processes and/or a block or blocks of a block diagram.

這些電腦程式指令也可儲存在能引導電腦或其他可程式資料處理設備以特定方式工作的電腦可讀記憶體中,使得儲存在該電腦可讀記憶體中的指令產生包括指令裝置的製造品,該指令裝置實現在實現流程示意圖一個流程或多個流程和/或方方塊圖一個方塊或多個方塊中指定的功能。These computer program instructions may also be stored in computer-readable memory capable of directing a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, The instruction means implements the functions specified in the flow or blocks of the implementation flow diagram and/or the block or blocks of the block diagram.

這些電腦程式指令也可裝載到電腦或其他可程式資料處理設備上,使得在電腦或其他可程式設備上執行一系列操作步驟以產生電腦實現的處理,從而在電腦或其他可程式設備上執行的指令提供用於實現在實現流程示意圖一個流程或多個流程和/或方方塊圖一個方塊或多個方塊中指定的功能的步驟。These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are performed on the computer or other programmable device to produce a computer-implemented process, thereby executing a computer-implemented process on the computer or other programmable device. The instructions provide steps for implementing the functions specified in the flow or blocks of the implementation flow diagram and/or the block or blocks of the block diagram.

本申請所提供的幾個方法實施例中所揭露的方法,在不衝突的情況下可以任意組合,得到新的方法實施例。The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined under the condition of no conflict to obtain new method embodiments.

本申請所提供的幾個產品實施例中所揭露的特徵,在不衝突的情況下可以任意組合,得到新的產品實施例。The features disclosed in the several product embodiments provided in this application can be combined arbitrarily without conflict to obtain a new product embodiment.

本申請所提供的幾個方法或設備實施例中所揭露的特徵,在不衝突的情況下可以任意組合,得到新的方法實施例或設備實施例。The features disclosed in several method or device embodiments provided in this application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.

以上所述,僅為本申請的具體實施方式,但本申請的保護範圍並不局限於此,任何熟悉本技術領域的技術人員在本申請揭露的技術範圍內,可輕易想到變化或替換,都應涵蓋在本申請的保護範圍之內。因此,本申請的保護範圍應以所述請求項的保護範圍為準。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claimed item.

11:影像編碼系統 110:解碼圖像暫存單元 111:變換單元 112:量化單元 113:模式選擇和編碼控制邏輯單元 114:幀內預測單元 115:幀間預測單元 116:反量化單元 117:反變換單元 118:迴路濾波單元 119:編碼單元 12:影像解碼系統 121:解碼單元 122:反量化單元 123:幀內預測單元 124:運動補償單元 125:迴路濾波單元 126:解碼圖像暫存單元 127:反變換單元 300:解碼器 301:解析單元 302:第一確定單元 303:第一處理器 304:第一記憶體 305:第一通訊介面 306:第一匯流排 400:編碼器 401:第二確定單元 402:第二處理器 403:第二記憶體 404:第二通訊介面 405:第二匯流排 S301~S308:步驟 S401~S405:步驟11: Video coding system 110: Decoding image temporary storage unit 111: Transform unit 112: Quantization unit 113: Mode selection and coding control logic unit 114: Intra prediction unit 115: Inter prediction unit 116: Inverse quantization unit 117: Inverse transformation unit 118: Loop filter unit 119: coding unit 12: Video decoding system 121: decoding unit 122: Inverse quantization unit 123: Intra prediction unit 124: Motion compensation unit 125: Loop filter unit 126: Decoding image temporary storage unit 127: Inverse transform unit 300: decoder 301: parsing unit 302: The first determination unit 303: first processor 304: first memory 305: The first communication interface 306: First busbar 400: Encoder 401: Second determination unit 402: second processor 403: second memory 404: Second communication interface 405: Second busbar S301~S308: Steps S401~S405: Steps

圖1為仿射模型的示意圖一;Fig. 1 is the schematic diagram 1 of the affine model;

圖2為仿射模型的示意圖二;Fig. 2 is the schematic diagram two of affine model;

圖3為像素的插值示意圖;Fig. 3 is the interpolation schematic diagram of the pixel;

圖4為子塊插值的示意圖一;4 is a schematic diagram 1 of sub-block interpolation;

圖5為子塊插值的示意圖二;5 is a schematic diagram 2 of sub-block interpolation;

圖6為每個子塊的運動向量示意圖;Fig. 6 is the motion vector schematic diagram of each sub-block;

圖7為樣本位置示意圖;Figure 7 is a schematic diagram of the sample location;

圖8為中心位置的示意圖一;Fig. 8 is the schematic diagram one of the center position;

圖9為中心位置的示意圖二;Fig. 9 is the schematic diagram two of the center position;

圖10為本申請實施例提供的一種影像編碼系統的組成方塊圖示意圖;FIG. 10 is a schematic block diagram of the composition of an image coding system according to an embodiment of the present application;

圖11為本申請實施例提供的一種影像解碼系統的組成方塊圖示意圖;FIG. 11 is a schematic block diagram of the composition of an image decoding system according to an embodiment of the present application;

圖12為幀間預測方法的實現流程示意圖一;FIG. 12 is a schematic diagram 1 of the implementation flow of the inter-frame prediction method;

圖13為中心位置的示意圖三;Figure 13 is a schematic diagram three of the center position;

圖14為幀間預測方法的實現流程示意圖二;14 is a schematic diagram 2 of the implementation flow of the inter-frame prediction method;

圖15為幀間預測方法的實現流程示意圖三;15 is a schematic diagram 3 of the implementation flow of the inter-frame prediction method;

圖16為幀間預測方法的實現流程示意圖四;FIG. 16 is a schematic diagram 4 of the implementation flow of the inter-frame prediction method;

圖17為二維濾波器的示意圖二;17 is a schematic diagram two of a two-dimensional filter;

圖18為幀間預測方法的實現流程示意圖三;18 is a schematic diagram 3 of the implementation flow of the inter-frame prediction method;

圖19為幀間預測方法的實現流程示意圖四;FIG. 19 is a schematic diagram four of the implementation flow of the inter-frame prediction method;

圖20為解碼器的組成結構示意圖一;Figure 20 is a schematic diagram of the composition structure of a decoder;

圖21為解碼器的組成結構示意圖二;Figure 21 is a schematic diagram of the composition structure of the decoder 2;

圖22為編碼器的組成結構示意圖一;Figure 22 is a schematic diagram of the composition structure of the encoder one;

圖23為編碼器的組成結構示意圖二。FIG. 23 is a second schematic diagram of the composition and structure of the encoder.

S301~S305:步驟S301~S305: Steps

Claims (65)

一種幀間預測方法,應用於解碼器,所述方法包括: 解析位元流,獲取當前塊的預測模式參數; 當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊; 基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差; 根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差; 基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或使用光流原理的預測修正PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。An inter-frame prediction method, applied to a decoder, the method comprising: Parse the bit stream to obtain the prediction mode parameters of the current block; When the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, a first motion vector of a subblock of the current block is determined; wherein the current block includes a plurality of subblocks; determining a first predicted value for the subblock based on the first motion vector, and a first motion vector offset between each pixel position in the subblock and the subblock; Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation; Based on the first predicted value, perform secondary prediction according to the deviation of the center position and the second motion vector, or perform prediction correction PROF processing using the principle of optical flow, determine the second predicted value of the sub-block, and use the The second predicted value is determined to be the inter predicted value of the sub-block. 根據請求項1所述的方法,其中,所述確定所述當前塊的子塊的第一運動向量,包括: 解析所述位元流,獲取所述當前塊的仿射模式參數和預測參考模式; 當所述仿射模式參數指示使用仿射模式時,確定控制點模式和子塊尺寸參數; 根據所述預測參考模式、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量。The method according to claim 1, wherein the determining the first motion vector of the sub-block of the current block comprises: Parsing the bit stream to obtain the affine mode parameter and the prediction reference mode of the current block; When the affine mode parameter indicates to use the affine mode, determining a control point mode and a sub-block size parameter; The first motion vector is determined according to the prediction reference mode, the control point mode, and the subblock size parameter. 根據請求項2所述的方法,其中,所述根據所述預測參考模式、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量,包括: 根據所述預測參考模式確定控制點運動向量組; 根據所述控制點運動向量組、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量。The method according to claim 2, wherein the determining the first motion vector according to the prediction reference mode, the control point mode and the sub-block size parameter includes: determining a control point motion vector group according to the prediction reference mode; The first motion vector is determined according to the control point motion vector group, the control point pattern and the sub-block size parameter. 根據請求項3所述的方法,其中,所述根據所述控制點運動向量組、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量,包括: 根據所述控制點運動向量組、所述控制點模式以及所述當前塊的尺寸參數,確定差值變數; 基於所述預測模式參數和所述子塊尺寸參數,確定子塊位置; 利用所述差值變數和所述子塊位置,確定所述當前子塊的所述第一運動向量。The method according to claim 3, wherein the determining the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter includes: determining a difference variable according to the control point motion vector group, the control point mode and the size parameter of the current block; determining a sub-block position based on the prediction mode parameter and the sub-block size parameter; Using the difference variable and the sub-block position, the first motion vector of the current sub-block is determined. 根據請求項2至4任一項所述的方法,所述方法還包括: 遍歷所述當前塊的每一個子塊,根據所述每一個子塊的第一運動向量構建運動向量集合。The method according to any one of claim 2 to 4, further comprising: Traverse each sub-block of the current block, and construct a motion vector set according to the first motion vector of each sub-block. 根據請求項5所述的方法,其中,所述根據所述控制點運動向量組、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量,包括: 根據所述控制點運動向量組、所述控制點模式以及所述當前塊的尺寸參數,確定差值變數; 基於所述預測模式參數和所述子塊尺寸參數,確定子塊位置; 利用所述差值變數和所述子塊位置,確定所述子塊的所述第一運動向量。The method according to claim 5, wherein the determining the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter includes: determining a difference variable according to the control point motion vector group, the control point mode and the size parameter of the current block; determining a sub-block position based on the prediction mode parameter and the sub-block size parameter; Using the difference variable and the sub-block position, the first motion vector of the sub-block is determined. 根據請求項5所述的方法,其中,所述基於所述第一運動向量確定所述子塊的第一預測值,包括: 確定樣本矩陣;其中,所述樣本矩陣包括亮度樣本矩陣和色度樣本矩陣; 根據所述預測參考模式、所述子塊尺寸參數、所述樣本矩陣以及所述運動向量集合,確定所述第一預測值。The method according to claim 5, wherein the determining the first predicted value of the sub-block based on the first motion vector comprises: determining a sample matrix; wherein the sample matrix includes a luminance sample matrix and a chrominance sample matrix; The first predictor is determined from the prediction reference mode, the subblock size parameter, the sample matrix, and the set of motion vectors. 根據請求項7所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差,包括: 確定所述第一運動向量偏差的水平偏差和垂直偏差; 根據所述水平偏差的第一絕對值、所述垂直偏差的第二絕對值以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差。The method according to claim 7, wherein the determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation comprises: determining a horizontal offset and a vertical offset of the first motion vector offset; The center position and the second motion vector deviation are determined according to the first absolute value of the horizontal deviation, the second absolute value of the vertical deviation, and a preset deviation threshold. 根據請求項8所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一絕對值和所述第二絕對值均小於所述預設偏差閾值,則將所述第一運動向量偏差確定為所述第二運動向量偏差,將所述每一個像素位置確定為所述中心位置。The method according to claim 8, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If both the first absolute value and the second absolute value are smaller than the preset deviation threshold, the first motion vector deviation is determined as the second motion vector deviation, and the position of each pixel is determined for the central location. 根據請求項8所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一絕對值大於或者等於所述預設偏差閾值,且所述第二絕對值小於所述預設偏差閾值,則根據所述水平偏差確定第一調整方向;其中,所述第一調整方向包括左側和右側; 根據所述第一調整方向,確定所述中心位置和所述第二運動向量偏差。The method according to claim 8, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If the first absolute value is greater than or equal to the preset deviation threshold, and the second absolute value is less than the preset deviation threshold, a first adjustment direction is determined according to the horizontal deviation; wherein the first adjustment direction is The adjustment direction includes left and right; According to the first adjustment direction, the deviation of the center position and the second motion vector is determined. 根據請求項10所述的方法,其中,所述根據所述第一調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一調整方向為左側,則將所述任一像素位置的相鄰左側像素位置作為所述中心位置; 將所述第一運動向量偏差加(1,0),獲得所述第二運動向量偏差。The method according to claim 10, wherein the determining the deviation between the center position and the second motion vector according to the first adjustment direction comprises: If the first adjustment direction is the left side, the adjacent left pixel position of any pixel position is used as the center position; The second motion vector offset is obtained by adding (1, 0) to the first motion vector offset. 根據請求項10所述的方法,其中,所述根據所述第一調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一調整方向為右側,則將所述任一像素位置的相鄰右側像素位置作為所述中心位置; 將所述第一運動向量偏差減(1,0),獲得所述第二運動向量偏差。The method according to claim 10, wherein the determining the deviation between the center position and the second motion vector according to the first adjustment direction comprises: If the first adjustment direction is the right side, the adjacent right pixel position of any pixel position is used as the center position; The second motion vector offset is obtained by subtracting (1, 0) from the first motion vector offset. 根據請求項8所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第二絕對值大於或者等於所述預設偏差閾值,且所述第一絕對值小於所述預設偏差閾值,則根據所述垂直偏差確定第二調整方向;其中,所述第二調整方向包括上側和下側; 根據所述第二調整方向,確定所述中心位置和所述第二運動向量偏差。The method according to claim 8, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If the second absolute value is greater than or equal to the preset deviation threshold, and the first absolute value is less than the preset deviation threshold, a second adjustment direction is determined according to the vertical deviation; wherein the second The adjustment direction includes the upper side and the lower side; According to the second adjustment direction, the center position and the second motion vector deviation are determined. 根據請求項13所述的方法,其中,所述根據所述第二調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第二調整方向為上側,則將所述任一像素位置的相鄰上側像素位置作為所述中心位置; 將所述第一運動向量偏差加(0,1),獲得所述第二運動向量偏差。The method according to claim 13, wherein the determining the deviation between the center position and the second motion vector according to the second adjustment direction comprises: If the second adjustment direction is the upper side, the adjacent upper pixel position of any pixel position is used as the center position; Add (0, 1) to the first motion vector offset to obtain the second motion vector offset. 根據請求項13所述的方法,其中,所述根據所述第二調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第二調整方向為下側,則將所述任一像素位置的相鄰下側像素位置作為所述中心位置; 將所述第一運動向量偏差減(0,1),獲得所述第二運動向量偏差。The method according to claim 13, wherein the determining the deviation between the center position and the second motion vector according to the second adjustment direction comprises: If the second adjustment direction is the lower side, use the adjacent lower pixel position of any pixel position as the center position; The second motion vector offset is obtained by subtracting (0, 1) from the first motion vector offset. 根據請求項8所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一絕對值和所述第二絕對值均大於或者等於所述預設偏差閾值,則根據所述水平偏差和所述垂直偏差確定第三調整方向;其中,所述第三調整方向包括右上側、右下側、左上側以及左下側; 根據所述第三調整方向,確定所述中心位置和所述第二運動向量偏差。The method according to claim 8, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If both the first absolute value and the second absolute value are greater than or equal to the preset deviation threshold, a third adjustment direction is determined according to the horizontal deviation and the vertical deviation; wherein, the third adjustment direction Including the upper right side, the lower right side, the upper left side and the lower left side; According to the third adjustment direction, the center position and the second motion vector deviation are determined. 根據請求項8至16任一項所述的方法,其中,所述預設偏差閾值為k個像素;其中,k大於0.5且小於或者等於1。The method according to any one of claims 8 to 16, wherein the preset deviation threshold is k pixels; wherein k is greater than 0.5 and less than or equal to 1. 根據請求項8所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差之前,所述方法還包括: 按照預設偏差範圍對所述第一運動向量偏差進行限制處理;其中,所述預設偏差範圍包括偏差下限值和偏差上限值。The method according to claim 8, wherein, before determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation, the method further comprises: The first motion vector deviation is limited according to a preset deviation range; wherein, the preset deviation range includes a deviation lower limit value and a deviation upper limit value. 根據請求項18所述的方法,其中,所述按照預設偏差範圍對所述第一運動向量偏差進行限制處理,包括: 若所述水平偏差和\或所述垂直偏差小於所述偏差下限值,則將所述水平偏差和\或所述垂直偏差設置為所述偏差下限值; 若所述水平偏差和\或所述垂直偏差大於所述偏差上限值,則將所述水平偏差和\或所述垂直偏差設置為所述偏差上限值。The method according to claim 18, wherein the performing limiting processing on the first motion vector deviation according to a preset deviation range includes: If the horizontal deviation and\or the vertical deviation are less than the deviation lower limit value, then the horizontal deviation and\or the vertical deviation are set as the deviation lower limit value; If the horizontal deviation and\or the vertical deviation are greater than the deviation upper limit value, set the horizontal deviation and\or the vertical deviation as the deviation upper limit value. 根據請求項1所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差之後,所述方法還包括: 若所述中心位置不屬於所述當前塊,則按照所述當前塊中的像素位置重新確定所述中心位置。The method according to claim 1, wherein after the center position corresponding to each pixel position and the second motion vector deviation are determined according to the first motion vector deviation, the method further includes: If the center position does not belong to the current block, the center position is re-determined according to the pixel positions in the current block. 根據請求項1所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差之後,所述方法還包括: 若所述中心位置不屬於所述當前塊,則直接將所述每一個像素位置確定為所述每一個像素位置對應的所述中心位置。The method according to claim 1, wherein after the center position corresponding to each pixel position and the second motion vector deviation are determined according to the first motion vector deviation, the method further includes: If the center position does not belong to the current block, the position of each pixel is directly determined as the center position corresponding to the position of each pixel. 根據請求項1所述的方法,其中,所述基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值,包括: 解析所述位元流,獲取PROF參數; 當所述PROF參數指示進行PROF處理時,基於所述第一預測值確定所述中心位置對應的像素水平梯度和像素垂直梯度; 根據所述像素水平梯度、所述像素垂直梯度以及所述第二運動向量偏差,計算所述每一個像素位置對應的偏差值; 基於所述第一預測值和所述偏差值,獲得所述每一個像素位置的像素的預測值; 利用所述每一個像素位置的像素的預測值,確定所述第二預測值。The method according to claim 1, wherein the second prediction or PROF processing is performed according to the center position and the second motion vector deviation based on the first prediction value, and the second prediction value of the sub-block is determined. The predicted value, the second predicted value is determined as the inter-frame predicted value of the sub-block, including: Parse the bit stream to obtain PROF parameters; When the PROF parameter indicates that PROF processing is performed, the pixel horizontal gradient and the pixel vertical gradient corresponding to the center position are determined based on the first predicted value; Calculate the deviation value corresponding to each pixel position according to the pixel horizontal gradient, the pixel vertical gradient and the second motion vector deviation; Based on the first predicted value and the deviation value, obtain the predicted value of the pixel at each pixel position; The second predicted value is determined using the predicted value of the pixel at each pixel location. 根據請求項1所述的方法,其中,所述基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值,包括: 解析所述位元流,獲取二次預測參數; 當所述二次預測參數指示使用二次預測時,根據所述第二運動向量偏差確定二維濾波器的濾波係數;其中,所述二維濾波器用於按照預設形狀進行二次預測處理; 基於所述濾波係數和所述第一預測值,確定所述每一個像素位置的像素的預測值; 利用所述每一個像素位置的像素的預測值,確定所述第二預測值。The method according to claim 1, wherein the second prediction or PROF processing is performed according to the center position and the second motion vector deviation based on the first prediction value, and the second prediction value of the sub-block is determined. The predicted value, the second predicted value is determined as the inter-frame predicted value of the sub-block, including: Parse the bit stream to obtain secondary prediction parameters; When the secondary prediction parameter indicates the use of secondary prediction, the filter coefficient of the two-dimensional filter is determined according to the second motion vector deviation; wherein, the two-dimensional filter is used to perform secondary prediction processing according to a preset shape; based on the filter coefficient and the first predicted value, determining a predicted value of the pixel at each pixel position; The second predicted value is determined using the predicted value of the pixel at each pixel location. 根據請求項23所述的方法,其中,所述二維濾波器用於利用多個相鄰的、構成所述預設形狀的像素位置進行二次預測。The method of claim 23, wherein the two-dimensional filter is used to perform secondary prediction using a plurality of adjacent pixel positions constituting the preset shape. 根據請求項24所述的方法,其中,所述預設形狀為矩形、菱形或任意一種對稱形狀。The method according to claim 24, wherein the preset shape is a rectangle, a rhombus, or any symmetrical shape. 根據請求項25所述的方法,其中, 若所述仿射模式參數的取值為1,則指示使用所述仿射模式; 若所述仿射模式參數的取值為0,或者,未解析得到所述仿射模式參數,則指示不使用所述仿射模式。The method of claim 25, wherein, If the value of the affine mode parameter is 1, it indicates that the affine mode is used; If the value of the affine mode parameter is 0, or the affine mode parameter is not obtained through analysis, it indicates that the affine mode is not used. 根據請求項2所述的方法,其中,所述確定子塊尺寸參數,包括: 解析所述位元流,獲得子塊尺寸標誌; 若所述子塊尺寸標誌的取值為1,則確定所述子塊尺寸參數為8x8; 若所述子塊尺寸標誌的取值為0,或者,未解析得到所述子塊尺寸標誌,則確定所述子塊尺寸參數為4x4。The method according to claim 2, wherein the determining the sub-block size parameter includes: parsing the bit stream to obtain a sub-block size flag; If the value of the sub-block size flag is 1, determine that the sub-block size parameter is 8×8; If the value of the sub-block size flag is 0, or the sub-block size flag is not obtained by parsing, the sub-block size parameter is determined to be 4×4. 根據請求項2所述的方法,其中,所述控制點模式包括4參數模式和6參數模式。The method of claim 2, wherein the control point mode includes a 4-parameter mode and a 6-parameter mode. 一種幀間預測方法,應用於編碼器,所述方法包括: 確定當前塊的預測模式參數; 當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊; 基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差; 根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差; 基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。An inter-frame prediction method, applied to an encoder, the method comprising: determine the prediction mode parameter of the current block; When the prediction mode parameter indicates that the inter prediction value of the current block is determined using the inter prediction mode, a first motion vector of a subblock of the current block is determined; wherein the current block includes a plurality of subblocks; determining a first predicted value for the subblock based on the first motion vector, and a first motion vector offset between each pixel position in the subblock and the subblock; Determine the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation; Based on the first predicted value, secondary prediction or PROF processing is performed according to the center position and the deviation of the second motion vector, the second predicted value of the sub-block is determined, and the second predicted value is determined as the Inter-predicted value of the sub-block. 根據請求項29所述的方法,其中,所述確定當前塊的預測模式參數,包括: 利用多種預測模式對所述當前塊進行預編碼處理,獲得每一種預測模式對應的位元率失真代價值; 從所獲得的多個位元率失真代價值中選擇最小位元率失真代價值,根據所述最小位元率失真代價值對應的預測模式確定當前塊的預測模式參數。The method according to claim 29, wherein the determining the prediction mode parameter of the current block comprises: Use multiple prediction modes to perform precoding processing on the current block to obtain a rate-distortion cost value corresponding to each prediction mode; A minimum rate-distortion cost value is selected from the obtained multiple rate-distortion cost values, and a prediction mode parameter of the current block is determined according to the prediction mode corresponding to the minimum rate-distortion cost value. 根據請求項29所述的方法,其中,所述確定所述當前塊的子塊的第一運動向量,包括: 確定所述當前塊的仿射模式參數和預測參考模式; 當所述仿射模式參數指示使用仿射模式時,確定控制點模式和子塊尺寸參數; 根據所述預測參考模式、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量。The method according to claim 29, wherein the determining the first motion vector of the sub-block of the current block comprises: determining an affine mode parameter and a prediction reference mode for the current block; When the affine mode parameter indicates to use the affine mode, determining a control point mode and a sub-block size parameter; The first motion vector is determined according to the prediction reference mode, the control point mode, and the subblock size parameter. 根據請求項31所述的方法,其中,所述根據所述預測參考模式、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量,包括: 根據所述預測參考模式確定控制點運動向量組; 根據所述控制點運動向量組、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量。The method according to claim 31, wherein the determining the first motion vector according to the prediction reference mode, the control point mode and the sub-block size parameter comprises: determining a control point motion vector group according to the prediction reference mode; The first motion vector is determined according to the control point motion vector group, the control point pattern and the sub-block size parameter. 根據請求項32所述的方法,其中,所述根據所述控制點運動向量組、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量,包括: 根據所述控制點運動向量組、所述控制點模式以及所述當前塊的尺寸參數,確定差值變數; 基於所述預測模式參數和所述子塊尺寸參數,確定子塊位置; 利用所述差值變數和所述子塊位置,確定所述當前子塊的所述第一運動向量。The method according to claim 32, wherein the determining the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter comprises: determining a difference variable according to the control point motion vector group, the control point mode and the size parameter of the current block; determining a sub-block position based on the prediction mode parameter and the sub-block size parameter; Using the difference variable and the sub-block position, the first motion vector of the current sub-block is determined. 根據請求項31至33任一項所述的方法,所述方法還包括: 遍歷所述當前塊的每一個子塊,根據所述每一個子塊的第一運動向量構建運動向量集合。The method according to any one of claims 31 to 33, further comprising: Traverse each sub-block of the current block, and construct a motion vector set according to the first motion vector of each sub-block. 根據請求項34所述的方法,其中,所述根據所述控制點運動向量組、所述控制點模式以及所述子塊尺寸參數,確定所述第一運動向量,包括: 根據所述控制點運動向量組、所述控制點模式以及所述當前塊的尺寸參數,確定差值變數; 基於所述預測模式參數和所述子塊尺寸參數,確定子塊位置; 利用所述差值變數和所述子塊位置,確定所述子塊的所述第一運動向量。The method according to claim 34, wherein the determining the first motion vector according to the control point motion vector group, the control point mode and the sub-block size parameter comprises: determining a difference variable according to the control point motion vector group, the control point mode and the size parameter of the current block; determining a sub-block position based on the prediction mode parameter and the sub-block size parameter; Using the difference variable and the sub-block position, the first motion vector of the sub-block is determined. 根據請求項34所述的方法,其中,所述基於所述第一運動向量確定所述子塊的第一預測值,包括: 確定樣本矩陣;其中,所述樣本矩陣包括亮度樣本矩陣和色度樣本矩陣; 根據所述預測參考模式、所述子塊尺寸參數、所述樣本矩陣以及所述運動向量集合,確定所述第一預測值。The method of claim 34, wherein the determining the first predicted value of the sub-block based on the first motion vector comprises: determining a sample matrix; wherein the sample matrix includes a luminance sample matrix and a chrominance sample matrix; The first predictor is determined from the prediction reference mode, the subblock size parameter, the sample matrix, and the set of motion vectors. 根據請求項36所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差,包括: 確定所述第一運動向量偏差的水平偏差和垂直偏差; 根據所述水平偏差的第一絕對值、所述垂直偏差的第二絕對值以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差。The method according to claim 36, wherein the determining the center position corresponding to each pixel position and the second motion vector deviation according to the first motion vector deviation comprises: determining a horizontal offset and a vertical offset of the first motion vector offset; The center position and the second motion vector deviation are determined according to the first absolute value of the horizontal deviation, the second absolute value of the vertical deviation, and a preset deviation threshold. 根據請求項37所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一絕對值和所述第二絕對值均小於所述預設偏差閾值,則將所述第一運動向量偏差確定為所述第二運動向量偏差,將所述每一個像素位置確定為所述中心位置。The method according to claim 37, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If both the first absolute value and the second absolute value are smaller than the preset deviation threshold, the first motion vector deviation is determined as the second motion vector deviation, and the position of each pixel is determined for the central location. 根據請求項37所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一絕對值大於或者等於所述預設偏差閾值,且所述第二絕對值小於所述預設偏差閾值,則根據所述水平偏差確定第一調整方向;其中,所述第一調整方向包括左側和右側; 根據所述第一調整方向,確定所述中心位置和所述第二運動向量偏差。The method according to claim 37, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If the first absolute value is greater than or equal to the preset deviation threshold, and the second absolute value is less than the preset deviation threshold, a first adjustment direction is determined according to the horizontal deviation; wherein the first adjustment direction is The adjustment direction includes left and right; According to the first adjustment direction, the deviation of the center position and the second motion vector is determined. 根據請求項39所述的方法,其中,所述根據所述第一調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一調整方向為左側,則將所述任一像素位置的相鄰左側像素位置作為所述中心位置; 將所述第一運動向量偏差加(1,0),獲得所述第二運動向量偏差。The method according to claim 39, wherein the determining the deviation between the center position and the second motion vector according to the first adjustment direction comprises: If the first adjustment direction is the left side, the adjacent left pixel position of any pixel position is used as the center position; The second motion vector offset is obtained by adding (1, 0) to the first motion vector offset. 根據請求項39所述的方法,其中,所述根據所述第一調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一調整方向為右側,則將所述任一像素位置的相鄰右側像素位置作為所述中心位置; 將所述第一運動向量偏差減(1,0),獲得所述第二運動向量偏差。The method according to claim 39, wherein the determining the deviation between the center position and the second motion vector according to the first adjustment direction comprises: If the first adjustment direction is the right side, the adjacent right pixel position of any pixel position is used as the center position; The second motion vector offset is obtained by subtracting (1, 0) from the first motion vector offset. 根據請求項37所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第二絕對值大於或者等於所述預設偏差閾值,且所述第一絕對值小於所述預設偏差閾值,則根據所述垂直偏差確定第二調整方向;其中,所述第二調整方向包括上側和下側; 根據所述第二調整方向,確定所述中心位置和所述第二運動向量偏差。The method according to claim 37, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If the second absolute value is greater than or equal to the preset deviation threshold, and the first absolute value is less than the preset deviation threshold, a second adjustment direction is determined according to the vertical deviation; wherein the second The adjustment direction includes the upper side and the lower side; According to the second adjustment direction, the center position and the second motion vector deviation are determined. 根據請求項42所述的方法,其中,所述根據所述第二調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第二調整方向為上側,則將所述任一像素位置的相鄰上側像素位置作為所述中心位置; 將所述第一運動向量偏差加(0,1),獲得所述第二運動向量偏差。The method according to claim 42, wherein the determining the deviation between the center position and the second motion vector according to the second adjustment direction comprises: If the second adjustment direction is the upper side, the adjacent upper pixel position of any pixel position is used as the center position; Add (0, 1) to the first motion vector offset to obtain the second motion vector offset. 根據請求項42所述的方法,其中,所述根據所述第二調整方向,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第二調整方向為下側,則將所述任一像素位置的相鄰下側像素位置作為所述中心位置; 將所述第一運動向量偏差減(0,1),獲得所述第二運動向量偏差。The method according to claim 42, wherein the determining the deviation between the center position and the second motion vector according to the second adjustment direction comprises: If the second adjustment direction is the lower side, use the adjacent lower pixel position of any pixel position as the center position; The second motion vector offset is obtained by subtracting (0, 1) from the first motion vector offset. 根據請求項37所述的方法,其中,所述根據所述水平偏差、所述垂直偏差以及預設偏差閾值,確定所述中心位置和所述第二運動向量偏差,包括: 若所述第一絕對值和所述第二絕對值均大於或者等於所述預設偏差閾值,則根據所述水平偏差和所述垂直偏差確定第三調整方向;其中,所述第三調整方向包括右上側、右下側、左上側以及左下側; 根據所述第三調整方向,確定所述中心位置和所述第二運動向量偏差。The method according to claim 37, wherein the determining the center position and the second motion vector deviation according to the horizontal deviation, the vertical deviation and a preset deviation threshold comprises: If both the first absolute value and the second absolute value are greater than or equal to the preset deviation threshold, a third adjustment direction is determined according to the horizontal deviation and the vertical deviation; wherein, the third adjustment direction Including the upper right side, the lower right side, the upper left side and the lower left side; According to the third adjustment direction, the center position and the second motion vector deviation are determined. 根據請求項37至45任一項所述的方法,其中,所述預設偏差閾值為k個像素;其中,k大於0.5且小於或者等於1。The method according to any one of claims 37 to 45, wherein the preset deviation threshold is k pixels; wherein k is greater than 0.5 and less than or equal to 1. 根據請求項37所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差之前,所述方法還包括: 按照預設偏差範圍對所述第一運動向量偏差進行限制處理;其中,所述預設偏差範圍包括偏差下限值和偏差上限值。The method according to claim 37, wherein, before the center position corresponding to each pixel position and the second motion vector deviation are determined according to the first motion vector deviation, the method further comprises: The first motion vector deviation is limited according to a preset deviation range; wherein, the preset deviation range includes a deviation lower limit value and a deviation upper limit value. 根據請求項47所述的方法,其中,所述按照預設偏差範圍對所述第一運動向量偏差進行限制處理,包括: 若所述水平偏差和\或所述垂直偏差小於所述偏差下限值,則將所述水平偏差和\或所述垂直偏差設置為所述偏差下限值; 若所述水平偏差和\或所述垂直偏差大於所述偏差上限值,則將所述水平偏差和\或所述垂直偏差設置為所述偏差上限值。The method according to claim 47, wherein the performing limiting processing on the deviation of the first motion vector according to a preset deviation range includes: If the horizontal deviation and\or the vertical deviation are less than the deviation lower limit value, then the horizontal deviation and\or the vertical deviation are set as the deviation lower limit value; If the horizontal deviation and\or the vertical deviation are greater than the deviation upper limit value, set the horizontal deviation and\or the vertical deviation as the deviation upper limit value. 根據請求項29所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差之後,所述方法還包括: 若所述中心位置不屬於所述當前塊,則按照所述當前塊中的像素位置重新確定所述中心位置。The method according to claim 29, wherein after the center position corresponding to each pixel position and the second motion vector deviation are determined according to the first motion vector deviation, the method further comprises: If the center position does not belong to the current block, the center position is re-determined according to the pixel positions in the current block. 根據請求項29所述的方法,其中,所述根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差之後,所述方法還包括: 若所述中心位置不屬於所述當前塊,則直接將所述每一個像素位置確定為所述每一個像素位置對應的所述中心位置。The method according to claim 29, wherein after the center position corresponding to each pixel position and the second motion vector deviation are determined according to the first motion vector deviation, the method further comprises: If the center position does not belong to the current block, the position of each pixel is directly determined as the center position corresponding to the position of each pixel. 根據請求項29所述的方法,其中,所述基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值,包括: 確定PROF參數; 當所述PROF參數指示進行PROF處理時,基於所述第一預測值確定所述中心位置對應的像素水平梯度和像素垂直梯度; 根據所述像素水平梯度、所述像素垂直梯度以及所述第二運動向量偏差,計算所述每一個像素位置對應的偏差值; 基於所述第一預測值和所述偏差值,獲得所述每一個像素位置的像素的預測值; 利用所述每一個像素位置的像素的預測值,確定所述第二預測值。The method according to claim 29, wherein the second prediction or PROF processing is performed according to the center position and the second motion vector deviation based on the first prediction value, and the second prediction of the sub-block is determined. The predicted value, the second predicted value is determined as the inter-frame predicted value of the sub-block, including: Determine PROF parameters; When the PROF parameter indicates that PROF processing is performed, the pixel horizontal gradient and the pixel vertical gradient corresponding to the center position are determined based on the first predicted value; Calculate the deviation value corresponding to each pixel position according to the pixel horizontal gradient, the pixel vertical gradient and the second motion vector deviation; Based on the first predicted value and the deviation value, obtain the predicted value of the pixel at each pixel position; The second predicted value is determined using the predicted value of the pixel at each pixel location. 根據請求項29所述的方法,其中,所述基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值,包括: 確定二次預測參數; 當所述二次預測參數指示使用二次預測時,根據所述第二運動向量偏差確定二維濾波器的濾波係數;其中,所述二維濾波器用於按照預設形狀進行二次預測處理; 基於所述濾波係數和所述第一預測值,確定所述每一個像素位置的像素的預測值; 利用所述每一個像素位置的像素的預測值,確定所述第二預測值。The method according to claim 29, wherein the second prediction or PROF processing is performed according to the center position and the second motion vector deviation based on the first prediction value, and the second prediction of the sub-block is determined. The predicted value, the second predicted value is determined as the inter-frame predicted value of the sub-block, including: Determine the quadratic prediction parameters; When the secondary prediction parameter indicates the use of secondary prediction, the filter coefficient of the two-dimensional filter is determined according to the second motion vector deviation; wherein, the two-dimensional filter is used to perform secondary prediction processing according to a preset shape; based on the filter coefficient and the first predicted value, determining a predicted value of the pixel at each pixel position; The second predicted value is determined using the predicted value of the pixel at each pixel location. 根據請求項52所述的方法,其中,所述二維濾波器用於利用多個相鄰的、構成所述預設形狀的像素位置進行二次預測。The method of claim 52, wherein the two-dimensional filter is used to perform secondary prediction using a plurality of adjacent pixel positions forming the preset shape. 根據請求項53所述的方法,其中,所述預設形狀為矩形、菱形或任意一種對稱形狀。The method according to claim 53, wherein the preset shape is a rectangle, a rhombus, or any symmetrical shape. 根據請求項54所述的方法,其中, 若所述仿射模式參數的取值為1,則指示使用所述仿射模式; 若所述仿射模式參數的取值為0,或者,未解析得到所述仿射模式參數,則指示不使用所述仿射模式。The method of claim 54, wherein, If the value of the affine mode parameter is 1, it indicates that the affine mode is used; If the value of the affine mode parameter is 0, or the affine mode parameter is not obtained through analysis, it indicates that the affine mode is not used. 根據請求項31所述的方法,其中, 若所述子塊尺寸參數為8x8,則將所述子塊尺寸標誌的設置為1,並將所述子塊尺寸標誌寫入位元流; 若所述子塊尺寸參數為4x4,則將所述子塊尺寸標誌的設置為0,並將所述子塊尺寸標誌寫入位元流。The method of claim 31, wherein, If the sub-block size parameter is 8×8, then the sub-block size flag is set to 1, and the sub-block size flag is written into the bit stream; If the sub-block size parameter is 4×4, the sub-block size flag is set to 0, and the sub-block size flag is written into the bit stream. 根據請求項31所述的方法,其中,所述控制點模式包括4參數模式和6參數模式。The method of claim 31, wherein the control point modes include a 4-parameter mode and a 6-parameter mode. 根據請求項31所述的方法,其中, 將所述預測模式參數、所述仿射模式參數、所述預測參考模式寫入位元流。The method of claim 31, wherein, The prediction mode parameter, the affine mode parameter, and the prediction reference mode are written into a bitstream. 根據權利要51所述的方法,其中, 將所述PROF參數寫入位元流。The method of claim 51, wherein, Write the PROF parameters to the bitstream. 根據權利要52所述的方法,其中, 將所述二次預測參數寫入位元流。The method of claim 52, wherein, The secondary prediction parameters are written to the bitstream. 一種解碼器,所述解碼器包括解析單元,第一確定單元; 所述解析單元,用於解析位元流,獲取當前塊的預測模式參數; 所述第一確定單元,用於當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;以及基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;以及根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;以及基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。A decoder, the decoder includes a parsing unit and a first determining unit; The parsing unit is used to parse the bit stream to obtain the prediction mode parameter of the current block; the first determining unit, configured to determine the first motion vector of the sub-block of the current block when the prediction mode parameter indicates that the inter prediction value of the current block is determined by using the inter prediction mode; wherein, the the current block includes a plurality of sub-blocks; and determining a first predictor for the sub-block based on the first motion vector, and a first motion vector between each pixel position in the sub-block and the sub-block and determining a center position corresponding to each pixel position and a second motion vector deviation according to the first motion vector deviation; and based on the first predicted value, according to the center position and the second motion vector The deviation is subjected to secondary prediction or PROF processing, the second prediction value of the sub-block is determined, and the second prediction value is determined as the inter-frame prediction value of the sub-block. 一種解碼器,所述解碼器包括第一處理器、儲存有所述第一處理器可執行指令的第一記憶體,當所述指令被執行時,所述第一處理器執行時實現如請求項1-28任一項所述的方法。A decoder, the decoder comprising a first processor and a first memory storing executable instructions of the first processor, when the instructions are executed, the first processor implements as requested The method of any one of items 1-28. 一種編碼器,所述編碼器包括第二確定單元; 所述第二確定單元,用於確定當前塊的預測模式參數;以及當所述預測模式參數指示使用幀間預測模式確定所述當前塊的幀間預測值時,確定所述當前塊的子塊的第一運動向量;其中,所述當前塊包括多個子塊;以及基於所述第一運動向量確定所述子塊的第一預測值,和所述子塊中的每一個像素位置與所述子塊之間的第一運動向量偏差;以及根據所述第一運動向量偏差確定所述每一個像素位置對應的中心位置和第二運動向量偏差;以及基於所述第一預測值,按照所述中心位置和所述第二運動向量偏差進行二次預測或PROF處理,確定所述子塊的第二預測值,將所述第二預測值確定為所述子塊的幀間預測值。An encoder comprising a second determination unit; the second determination unit, configured to determine a prediction mode parameter of the current block; and when the prediction mode parameter indicates that an inter prediction value of the current block is determined using an inter prediction mode, determining a subblock of the current block The first motion vector of the a first motion vector deviation between sub-blocks; and determining a center position corresponding to each pixel position and a second motion vector deviation according to the first motion vector deviation; and based on the first predicted value, according to the Perform secondary prediction or PROF processing on the center position and the second motion vector deviation, determine the second prediction value of the sub-block, and determine the second prediction value as the inter-frame prediction value of the sub-block. 一種編碼器,所述編碼器包括第二處理器、儲存有所述第二處理器可執行指令的第二記憶體,當所述指令被執行時,所述第二處理器執行時實現如請求項29-60任一項所述的方法。An encoder comprising a second processor and a second memory storing instructions executable by the second processor, when the instructions are executed, the second processor implements as requested The method of any of items 29-60. 一種電腦儲存媒介,所述電腦儲存媒介儲存有電腦程式,所述電腦程式被第一處理器執行時實現如請求項1-28任一項所述的方法,或者,被第二處理器執行時實現如請求項29-60任一項所述的方法。A computer storage medium, the computer storage medium stores a computer program, and when the computer program is executed by a first processor, the method as described in any one of claim 1-28 is implemented, or, when executed by a second processor Implement the method of any of claims 29-60.
TW110130848A 2020-08-26 2021-08-20 Inter-frame prediction method, coder, decoder and computer storage medium characterized by reducing the prediction errors and promoting the coding performance to increase the coding/decoding efficiency TW202209893A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010873979.9 2020-08-26
CN202010873979.9A CN114125466A (en) 2020-08-26 2020-08-26 Inter-frame prediction method, encoder, decoder, and computer storage medium

Publications (1)

Publication Number Publication Date
TW202209893A true TW202209893A (en) 2022-03-01

Family

ID=80374203

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110130848A TW202209893A (en) 2020-08-26 2021-08-20 Inter-frame prediction method, coder, decoder and computer storage medium characterized by reducing the prediction errors and promoting the coding performance to increase the coding/decoding efficiency

Country Status (2)

Country Link
CN (1) CN114125466A (en)
TW (1) TW202209893A (en)

Also Published As

Publication number Publication date
CN114125466A (en) 2022-03-01

Similar Documents

Publication Publication Date Title
CN112425169B (en) Interpolation filtering method and apparatus for intra prediction and inter prediction in video coding
US20180332292A1 (en) Method and apparatus for intra prediction mode using intra prediction filter in video and image compression
CN117528105A (en) Image encoding method, image decoding method, and method for transmitting bit stream
KR102359415B1 (en) Interpolation filter for inter prediction apparatus and method for video coding
JP6784836B2 (en) Equipment and methods for video coding
TW201347559A (en) Image processing device and method
JP7322285B2 (en) Quantization Parameter Offset for Chroma de Block Filtering
TW202315408A (en) Block-based prediction
JP7318120B2 (en) Padding process in adaptive loop filtering
CN114586366A (en) Inter-frame prediction method, encoder, decoder, and storage medium
JP7326600B2 (en) Adaptive loop filtering between different video units
TW201311010A (en) Video encoding method and apparatus, video decoding method and apparatus, and programs thereof
JP2022535859A (en) Method for constructing MPM list, method for obtaining intra-prediction mode of chroma block, and apparatus
WO2022116113A1 (en) Intra-frame prediction method and device, decoder, and encoder
TW201328362A (en) Video encoding method and apparatus, video decoding method and apparatus, and programs thereof
WO2022022278A1 (en) Inter-frame prediction method, encoder, decoder, and computer storage medium
WO2022061680A1 (en) Inter-frame prediction method, encoder, decoder, and computer storage medium
TW202209893A (en) Inter-frame prediction method, coder, decoder and computer storage medium characterized by reducing the prediction errors and promoting the coding performance to increase the coding/decoding efficiency
TW202332274A (en) Mip for all channels in the case of 4:4:4-chroma format and of single tree
WO2022077495A1 (en) Inter-frame prediction methods, encoder and decoders and computer storage medium
WO2022037344A1 (en) Inter-frame prediction method, encoder, decoder, and computer storage medium
CN115280778A (en) Inter-frame prediction method, encoder, decoder, and storage medium
WO2022194197A1 (en) Separate Tree Coding Restrictions
JP7102663B2 (en) Inter-predictors and methods for video coding
EP3984228A1 (en) Sample value clipping on mip reduced prediction