Calculating the Normal & displacement map dynalically from the diffuse texture

Hi,

I want to know if someone can help over making a macro in which if you pass a texture to it returns the normal & displacement map of it. this can be really helpful for the dynamic materials in which you have to calculate it per update of the input texture.