I am using Rice-Golumb encoding for image compression. Compression and decompression working perfectly on 12-bit greyscale image. The pixels are saved in a short int type array. But when compressing it is saved in a long int type buffer. My question is If the input is short int type then can it be saved in a short int type buffer? Because it will increase the compression ratio.

If possible, Any idea how to do it?

Tahnk you.

Just check if all values in the resulting long array are within the value range of short. If so, you can transfer the data over to a short array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.