上面提到的原代码(C语言)—2 - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- 上面提到的原代码(C语言)—2 (http://www.webasp.net/article/5/4178.htm) |
| -- 作者:未知 -- 发布日期: 2003-07-12 |
| void MyImageDestory(pmyimg p){ free(p->data); free(p); } int huffman1(){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x7;/*f 4*/ } else { return 0x6;/*e 4*/ } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x40;/*1b 5*/ } else { if (GetNextBit()){ return 0xf;/*35 6*/ } else { return 0xe;/*34 6*/ } } } else { return 0x5;/*c 4*/ } } } else { if (!GetNextBit()){ if (!GetNextBit()){ return 0x3;/*8 4*/ } else { if (GetNextBit()){ return 0x8;/*13 5*/ } else { return 0x80;/*12 5*/ } } } else { if (GetNextBit()){ return 0x4;/*b 4*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x11;/*2b 6*/ } else { return 0x10;/*2a 6*/ } } else { return 0x9;/*14 5*/ } } } } } else { if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ /*error in analysis 4624*/ return 0 ; } else { if (GetNextBit()){ return 0x1e;/*3 8*/ } else { return 0x1d;/*2 8*/ } } } else { if (GetNextBit()){ return 0x16;/*3 7*/ } else { if (GetNextBit()){ return 0x2e;/*5 8*/ } else { return 0x2d;/*4 8*/ } } } } else { if (GetNextBit()){ return 0xd;/*3 6*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x30;/*b 8*/ } else { return 0x2f;/*a 8*/ } } else { return 0x17;/*4 7*/ } } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x26;/*17 8*/ } else { return 0x25;/*16 8*/ } } else { if (GetNextBit()){ return 0x24;/*15 8*/ } else { return 0x23;/*14 8*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x22;/*13 8*/ } else { return 0x21;/*12 8*/ } } else { return 0x14;/*8 7*/ } } } else { if (GetNextBit()){ return 0x1;/*7 6*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x20;/*1b 8*/ } else { return 0x1f;/*1a 8*/ } } else { return 0x13;/*c 7*/ } } } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x15;/*17 7*/ } else { if (GetNextBit()){ return 0x2c;/*2d 8*/ } else { return 0x2b;/*2c 8*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x2a;/*2b 8*/ } else { return 0x29;/*2a 8*/ } } else { if (GetNextBit()){ return 0x28;/*29 8*/ } else { return 0x27;/*28 8*/ } } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x1a;/*13 7*/ } else { if (GetNextBit()){ return 0x36;/*25 8*/ } else { return 0x35;/*24 8*/ } } } else { return 0xc;/*8 6*/ } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x180;/*37 8*/ } else { return 0x140;/*36 8*/ } } else { if (GetNextBit()){ return 0x0;/*35 8*/ } else { return 0x3f;/*34 8*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x3e;/*33 8*/ } else { return 0x3d;/*32 8*/ } } else { return 0x1c;/*18 7*/ } } } else { return 0xa;/*7 5*/ } } } } else { if (GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x280;/*67 8*/ } else { if (GetNextBit()){ return 0x300;/*cd 9*/ } else { return 0x2c0;/*cc 9*/ } } } else { if (GetNextBit()){ return 0x200;/*65 8*/ } else { return 0x1c0;/*64 8*/ } } } else { return 0x680;/*18 6*/ } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x480;/*d7 9*/ } else { return 0x440;/*d6 9*/ } } else { if (GetNextBit()){ return 0x400;/*d5 9*/ } else { return 0x3c0;/*d4 9*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x380;/*d3 9*/ } else { return 0x340;/*d2 9*/ } } else { return 0x240;/*68 8*/ } } } else { if (GetNextBit()){ return 0x100;/*37 7*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x580;/*db 9*/ } else { return 0x540;/*da 9*/ } } else { if (GetNextBit()){ return 0x500;/*d9 9*/ } else { return 0x4c0;/*d8 9*/ } } } } } } else { return 0x2;/*7 4*/ } } else { if (!GetNextBit()){ if (!GetNextBit()){ return 0xb;/*8 5*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x12;/*27 7*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x6c0;/*9b 9*/ } else { return 0x640;/*9a 9*/ } } else { if (GetNextBit()){ return 0x600;/*99 9*/ } else { return 0x5c0;/*98 9*/ } } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x3c;/*4b 8*/ } else { return 0x3b;/*4a 8*/ } } else { return 0x1b;/*24 7*/ } } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x19;/*2b 7*/ } else { if (GetNextBit()){ return 0x34;/*55 8*/ } else { return 0x33;/*54 8*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x32;/*53 8*/ } else { return 0x31;/*52 8*/ } } else { return 0x18;/*28 7*/ } } } else { if (GetNextBit()){ return 0xc0;/*17 6*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x3a;/*5b 8*/ } else { return 0x39;/*5a 8*/ } } else { if (GetNextBit()){ return 0x38;/*59 8*/ } else { return 0x37;/*58 8*/ } } } } } } } } } int huffman2(){ if (GetNextBit()){ if (GetNextBit()){ return 0x2;/*3 2*/ } else { return 0x3;/*2 2*/ } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x4;/*3 3*/ } else { return 0x1;/*2 3*/ } } else { if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ /*error in analysis 6313*/ return 0 ; } else { if (!GetNextBit()){ if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x37;/*27 12*/ } else { if (GetNextBit()){ return 0x340;/*4d 13*/ } else { return 0x300;/*4c 13*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x2c0;/*4b 13*/ } else { return 0x280;/*4a 13*/ } } else { return 0x34;/*24 12*/ } } } else { return 0x12;/*8 10*/ } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x3b;/*2b 12*/ } else { if (GetNextBit()){ return 0x5c0;/*55 13*/ } else { return 0x580;/*54 13*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x540;/*53 13*/ } else { return 0x500;/*52 13*/ } } else { return 0x38;/*28 12*/ } } } else { if (GetNextBit()){ return 0x18;/*17 11*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x640;/*5b 13*/ } else { return 0x600;/*5a 13*/ } } else { return 0x3c;/*2c 12*/ } } } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x35;/*37 12*/ } else { if (GetNextBit()){ return 0x240;/*6d 13*/ } else { return 0x200;/*6c 13*/ } } } else { if (GetNextBit()){ return 0x1c0;/*35 12*/ } else { return 0x180;/*34 12*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x140;/*33 12*/ } else { if (GetNextBit()){ return 0x6c0;/*65 13*/ } else { return 0x680;/*64 13*/ } } } else { return 0x19;/*18 11*/ } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x4c0;/*77 13*/ } else { return 0x480;/*76 13*/ } } else { if (GetNextBit()){ return 0x440;/*75 13*/ } else { return 0x400;/*74 13*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x3c0;/*73 13*/ } else { return 0x380;/*72 13*/ } } else { return 0x36;/*38 12*/ } } } else { return 0x40;/*f 10*/ } } } } } else { if (!GetNextBit()){ if (GetNextBit()){ if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x2f;/*57 12*/ } else { return 0x2e;/*56 12*/ } } else { if (GetNextBit()){ return 0x2d;/*55 12*/ } else { return 0x2c;/*54 12*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x33;/*53 12*/ } else { return 0x32;/*52 12*/ } } else { return 0x17;/*28 11*/ } } } else { if (GetNextBit()){ return 0x10;/*17 10*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x100;/*5b 12*/ } else { return 0x3d;/*5a 12*/ } } else { if (GetNextBit()){ return 0x3a;/*59 12*/ } else { return 0x39;/*58 12*/ } } } } } else { return 0xd;/*4 8*/ } } else { if (!GetNextBit()){ if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x3f;/*67 12*/ } else { return 0x3e;/*66 12*/ } } else { if (GetNextBit()){ return 0x31;/*65 12*/ } else { return 0x30;/*64 12*/ } } } else { return 0x11;/*18 10*/ } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x16;/*37 11*/ } else { if (GetNextBit()){ return 0x29;/*6d 12*/ } else { return 0x28;/*6c 12*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x21;/*6b 12*/ } else { return 0x20;/*6a 12*/ } } else { if (GetNextBit()){ return 0x1f;/*69 12*/ } else { return 0x1e;/*68 12*/ } } } } } else { return 0xe;/*7 8*/ } } } } else { if (GetNextBit()){ if (!GetNextBit()){ if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x13;/*67 11*/ } else { if (GetNextBit()){ return 0x1d;/*cd 12*/ } else { return 0x1c;/*cc 12*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x1b;/*cb 12*/ } else { return 0x1a;/*ca 12*/ } } else { if (GetNextBit()){ return 0xc0;/*c9 12*/ } else { return 0x80;/*c8 12*/ } } } } else { return 0xf;/*18 9*/ } } else { if (!GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ if (GetNextBit()){ return 0x27;/*d7 12*/ } else { return 0x26;/*d6 12*/ } } else { if (GetNextBit()){ return 0x25;/*d5 12*/ } else { return 0x24;/*d4 12*/ } } } else { if (GetNextBit()){ if (GetNextBit()){ return 0x23;/*d3 12*/ } else { return 0x22;/*d2 12*/ } } else { return 0x14;/*68 11*/ } } } else { if (GetNextBit()){ return 0x0;/*37 10*/ } else { if (GetNextBit()){ if (GetNextBit()){ return 0x2b;/*db 12*/ } else { return 0x2a;/*da 12*/ } } else { return 0x15;/*6c 11*/ } } } } } else { return 0xc;/*7 7*/ } } else { if (GetNextBit()){ return 0xb;/*5 7*/ } else { return 0xa;/*4 7*/ } } } } else { if (GetNextBit()){ return 0x7;/*3 5*/ } else { if (GetNextBit()){ return 0x8;/*5 6*/ } else { return 0x9;/*4 6*/ } } } } else { if (GetNextBit()){ return 0x5;/*3 4*/ } else { return 0x6;/*2 4*/ } } } } } int readhuffman1(){ int c1; c1=huffman1(); while(c1>0x6c0) c1+=huffman1(); if(c1>=0x40){ c1+=huffman1(); } return c1; } int readhuffman2(){ int c1; c1=huffman2(); while(c1>0x6c0) c1+=huffman2(); if(c1>=0x40){ c1+=huffman2(); } return c1; } |
| webasp.net |