Sample program for converting RGB to YCbCr to DCT coefficients and vice versa.
#ifndef COMMON_H
#define COMMON_H
//an RGB pixel
typedef struct {
unsigned char R; //[0, 255]
unsigned char G; //[0, 255]
unsigned char B; //[0, 255]
} RGB;
typedef struct {
short Y; //[0, 255]
short Cb; //[-127, 127]
short Cr; //[-127, 127]
} YCbCr;
//use 4:2:0 YCbCr
typedef struct {
short Y[256]; //16x16 ( four 8x8 samples )
short Cb[64]; //8x8
short Cr[64]; //8x8
} YCbCr_MACRO;
#endif