Fix nearest neighbor and linear filtering
Merge remote-tracking branch 'upstream/master'