Merge horizontal and vertical hpel code