A method for encoding a current frame of a video, the method comprising: jointly determining , for each of multiple reference frames of the current frame, one or more respective global motion models, the reference frames used for encoding the current frame; and encoding the current frame using the global motion models, such that a block of the current frame is encoded using a respective one of the global motion models; wherein jointly determining the one or more respective global motion models for the reference frames comprises: determining a first aggregated residual for a first combination of the global motion models by: for each block of the current frame, determining the respective global motion model that provides the smallest residual error for the block; and combining the residual errors for each block of the current frame to determine the aggregated residual; determining whether the first aggregated residual meets an objective function; and if the first aggregated residual does not meet the objective function, iteratively refining the one or more respective global motion models for the reference frames to determine refined global motion models until the aggregated residual of the refined global motion models meets the objective function; and wherein encoding the current frame using the global motion models, such that a block of the current frame is encoded using a respective one of the global motion models comprises associating, with each block of the current frame, one of the refined global motion models and encoding the block with the associated refined global motion model. jointly determining , for each of multiple reference frames of the current frame, one or more respective global motion models, the reference frames used for encoding the current frame; and encoding the current frame using the global motion models, such that a block of the current frame is encoded using a respective one of the global motion models; determining a first aggregated residual for a first combination of the global motion models by: for each block of the current frame, determining the respective global motion model that provides the smallest residual error for the block; and combining the residual errors for each block of the current frame to determine the aggregated residual; for each block of the current frame, determining the respective global motion model that provides the smallest residual error for the block; and combining the residual errors for each block of the current frame to determine the aggregated residual; determining whether the first aggregated residual meets an objective function; and if the first aggregated residual does not meet the objective function, iteratively refining the one or more respective global motion models for the reference frames to determine refined global motion models until the aggregated residual of the refined global motion models meets the objective function; and wherein encoding the current frame using the global motion models, such that a block of the current frame is encoded using a respective one of the global motion models comprises associating, with each block of the current frame, one of the refined global motion models and encoding the block with the associated refined global motion model. <EOS>