A flexible error resilient scheme for JPEG 2000