Spatiotemporal error concealment with optimized mode selection and application to H.264