Tham khảo tài liệu 'nén ảnh part 5', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chương trình . Đảo ngược FCT. Kích thước khối sử dụng trên ảnh gốc. Program . Inverse FCT. Block size used on the original image should be known to the user. This program is for carrying out the inverse of the 2-D Fast Cosine Transform. define PI include include include include include include void IFCT float unsigned int float int int void bit_reversal unsigned int int int void WTSINV float int int void main int m N i j k1 k2 NB NT NS k float X C w unsigned int L double nsq FILE fptri fptro char file_name 14 float buffi unsigned char buffo clrscr printf This program is for the inverse 2-D FCT . n printf Enter name of input file ------- scanf s file_name fptri fopen file_name rb if fptri NULL printf nNo such file exists. n exit 1 357 nsq double filelength fileno fptri -------------------- Assume image is square ---------------------- N int sqrt nsq sizeof float m int log10 double N log10 double k 1 for i 0 i m i k 1 if k N printf nTransform image must have dimensions printf which are multiples of 2. n exit 1 printf Enter name for Output file - - - scanf s file_name fptro fopen file_name wb printf nEnter block size used . 8x8 16xI6 etc. -- scanf dx d NB NB m int log10 double NB log10 double NT N NB ----------------------------- Blocks of NBxNB were considered. -------------------------------- ------------------- Assigning memory. ----------------- buffi float malloc NT sizeof float buffo unsigned char malloc NT sizeof char x float malloc NB sizeof float L unsigned int malloc NB sizeof int C float malloc NB-1 sizeof float w float malloc NB sizeof float for i 0 i NB i w i float malloc NB sizeof float bit_reversal L m NB WTSINV C m NB NS N m ------------------------------------- 358 2-D inverse FCT using the row-column approach. ------------------------------------ for i 0 i NS i fread buffi NT sizeof float fptri for j 0 j NS j for k1 0 k1 NB k1 for k2 0 k2 NB k2 w k1 k2 buffi