| CPC H04N 19/513 (2014.11) [H04N 19/176 (2014.11); H04N 19/189 (2014.11); H04N 19/567 (2014.11)] | 18 Claims |

|
1. A motion vector obtaining method for use in image encoding or image decoding implemented by a coding device, comprising:
determining a target offset motion vector of a to-be-processed block in a current picture and identifier information of a target picture, wherein the to-be-processed block comprises at least one to-be-processed sub-block;
determining, based on a location of the to-be-processed sub-block and the target offset motion vector, an initial location of a collocated sub-block that is of the to-be-processed sub-block and that is in the target picture;
determining the initial location as a target location when the initial location is inside a preset area of the target picture;
determining a location that is in the preset area and that is closest to the initial location as a target location when the initial location is outside the preset area; and
obtaining a motion vector of the to-be-processed sub-block based on a motion vector corresponding to the target location,
wherein
the preset area is represented by a horizontal coordinate value range and a vertical coordinate value range,
wherein the horizontal coordinate value range comprises a minimum horizontal coordinate value and a maximum horizontal coordinate value, and the vertical coordinate value range comprises a minimum vertical coordinate value and a maximum vertical coordinate value, and
wherein the target location is determined according to following formulas:
x(i,j)=Clip3(HorMin,HorMax,x(i,j)); and
y(i,j)=Clip3(VerMin,VerMax,y(i,j)), wherein
HorMin is the minimum horizontal coordinate value, HorMax is the maximum horizontal coordinate value, VerMin is the minimum vertical coordinate value, VerMax is the maximum vertical coordinate value, a Clip3 function is a clipping function, and the Clip3 function is defined as follows:
![]() and
wherein one or more of HorMin, HorMax, VerMin or VerMax of the preset area is determined based on a location and a size of a coding tree unit (CTU) in which the to-be-processed block is included, a size of the target picture, and an extension range of a temporal motion vector field of the CTU.
|