/*********************************************************************/ /* dct_main perfomes a dct and idct function on an image. */ /*********************************************************************/ /*****************************************************/ /* include files */ /*****************************************************/ #include #include #include "dct_main.h" /* Includes and Constants used */ #pragma DATA_SECTION (image_in,"myvar0") #pragma DATA_SECTION (image_out,"myvar1") #include "scenary.h" /* an h file containing input image as a 1D array */ /* 1D array to hold output image */ unsigned char image_out[IMAGE_SIZE]; /* 1D array to hold the current block */ short block[BLOCK_SIZE]; /*********************************************************************/ /* Q12 DCT coefficients (actual coefficient x 2^12 ) */ /* */ /*********************************************************************/ const short coe[8][8]= { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 5681, 4816, 3218, 1130, -1130, -3218, -4816, -5681, 5352, 2217, -2217, -5352, -5352, -2217, 2217, 5352, 4816, -1130, -5681, -3218, 3218, 5681, 1130, -4816, 4096, -4096, -4096, 4096, 4096, -4096, -4096, 4096, 3218, -5681, 1130, 4816, -4816, -1130, 5681, -3218, 2217, -5352, 5352, -2217, -2217, 5352, -5352, 2217, 1130, -3218, 4816, -5681, 5681, -4816, 3218, -1130 }; /*********************************************************************/ /* FUNCTIONS USED */ /*********************************************************************/ /* dct.c */ void dct(void); /* idct.c */ void idct(void); /*********************************************************************/ /* MAIN FUNCTION */ /*********************************************************************/ void main() { int row, col, x, y, i; /*************************************************** * FORWARD DCT/ INVERSE DCT * ***************************************************/ /* block by block processing */ for (row=0; row