@nikitsaraf I don't think the thresholding is really the same thing, but I'm not sure if this padding idea will really help.  Would you care to try it?