Tone-mapping high dynamic range images and videos for bit-depth scalable coding and 3D displaying