Reduce bitrate of lossless codecs through dynamic bitdepth reduction