Don't use bpp, just use 4 and use a value which covers all codecs. All codecs take into account discarding the output in favor of the uncompressed data when the compressed data is larger than the uncompressed data. Also, all the surface command codecs are 32-bpp based anyway. What we need to ensure is putting enough reserved space for headers and frame markers.