Two-wave mixing by phase and absorption gratings in saturable absorbers