I need a C++ implementation of the LOCO-I algorithm: one method will encode (or perform the LOCO-I algorithm) a 16-bit grayscale image, and one method will decode (or perform the reverse LOCO-I algorithm) the encoded data back to the original. I do all work in Visual Studio, version 2010 is preferred.
The best place to start for information is [login to view URL] However, a web search will reveal quite a few PDFs that can be used for reference.
I will eventually incorporate this code into a larger project. Here are the specifications for the class and public methods.
Class Name: CLoco-I
// This method takes three arguments
// nWidth is the width of the image in pixels
// nHeight is the height of the image in pixels
// Note that total pixels can be calculated by nWidth * nHeight
// p16BitGrayPixels is the buffer containing 16-bit values, each of which represent a gray
// pixel value. Note that the size of this buffer in bytes is the number of pixels * 2
//
// Returns: The decorrelated, contextualized, and error corrected image data
unsigned char *DoLocoIEncoding( int nWidth, int nHeight, unsigned char *p16BitGrayPixels );
// This method takes three arguments
// nWidth is the width of the image in pixels
// nHeight is the height of the image in pixels
// Note that total pixels can be calculated by nWidth * nHeight
// p16BitGrayPixelsProcessedByLocoIAlgorithm is the buffer containing 16-bit values, each of which
// represent a gray. However, this data has already been processed by the LOCO-I algorithm
// (decorrelated, contextualized, and error corrected image data) and needs to be returned to
// pre-processed values. Note that the size of this buffer in bytes is the number of pixels * 2
//
// Returns: The restored image data
unsigned char *DoLocoIDecoding( int nWidth, int nHeight,
unsigned char *p16BitGrayPixelsProcessedByLocoIAlgorithm );
Please note that this code has nothing to do with huffman or gzip. It is only the LOCO-I algorithm.
All source code must be thoroughly commented. Source code should be formatted as follows:
void function( int args )
{
}
Please use hungarian variable names as follows:
Local:
int nValue;
double dNumber;
float fNumber;
char szBuffer[200];
Class members:
int m_nValue;
double m_dNumber;
float m_fNumber;
char m_szBuffer[200];