added #ifdef to switch on/off bilinear sampling