Joint near-lossless compression and watermarking of still images for authentication and tamper localization