A video encoding method, comprising: determining the usage of spatially varying transform, SVT, for a residual block; determining a SVT type for the residual block when SVT is used for the residual block, wherein the SVT type for the residual block is either a SVT-V type or a SVT-H type, wherein the SVT-V type indicates that the width of a transform block of the residual block is the half size of the width of the residual block, and the height of the transform block is the same size of the height of the residual block, wherein the SVT-H type indicates that the width of the transform block is the same size of the width of the residual block, and the height of the transform block is the half size of the height of the residual block, wherein the rest samples inside the residual block are treated as to be zero; deriving a transform block size of the transform block according to the SVT type; determining a transform block position of the transform block; determining a transform type of the transform block according to the SVT type and the transform block position of the transform block, wherein the transform type indicates a horizontal transform and a vertical transform for the transform block, wherein the vertical transform for the SVT-V type for all transform block positions and the horizontal transform for the SVT-H type for all transform block positions are set as DST-7, and the other transform is based on the transform block position; obtaining transform coefficients of the transform block according to the transform block size, the transform type, and the transform block position; and encoding the transform coefficients of the transform block into a bitstream, wherein the bitstream further includes a syntax element indicates the usage of SVT for the residual block, a syntax element indicates the SVT type for the residual block, and a syntax element indicates the transform block position. determining the usage of spatially varying transform, SVT, for a residual block; determining a SVT type for the residual block when SVT is used for the residual block, wherein the SVT type for the residual block is either a SVT-V type or a SVT-H type, wherein the SVT-V type indicates that the width of a transform block of the residual block is the half size of the width of the residual block, and the height of the transform block is the same size of the height of the residual block, wherein the SVT-H type indicates that the width of the transform block is the same size of the width of the residual block, and the height of the transform block is the half size of the height of the residual block, wherein the rest samples inside the residual block are treated as to be zero; deriving a transform block size of the transform block according to the SVT type; determining a transform block position of the transform block; determining a transform type of the transform block according to the SVT type and the transform block position of the transform block, wherein the transform type indicates a horizontal transform and a vertical transform for the transform block, wherein the vertical transform for the SVT-V type for all transform block positions and the horizontal transform for the SVT-H type for all transform block positions are set as DST-7, and the other transform is based on the transform block position; obtaining transform coefficients of the transform block according to the transform block size, the transform type, and the transform block position; and encoding the transform coefficients of the transform block into a bitstream, wherein the bitstream further includes a syntax element indicates the usage of SVT for the residual block, a syntax element indicates the SVT type for the residual block, and a syntax element indicates the transform block position.