function [ residual ] = motion_prediction_hp( frame_mb, ref, u, v, n, m )

MB_size = size( frame_mb, 1 );
ind_y = (n-1)*MB_size + 1 + v : n*MB_size + v;
ind_x = (m-1)*MB_size + 1 + u : m*MB_size + u;
ind_x(ind_x<=0) = 1;     ind_x(ind_x>=size(ref,2)) = size(ref,2);
ind_y(ind_y<=0) = 1;     ind_y(ind_y>=size(ref,1)) = size(ref,1);
US =2;


ref_upsamp  = imresize(  ref, US );

residual = frame_mb - ref_upsamp( ind_y*US ,   ind_x*US, : );

end

