Discrete dynamics for convex and non-convex smoothing functionals in PDE based image restoration