A novel all optical reversible 4 × 2 encoder based on photonic crystals