Discrimination of simple and complex gratings