📄 vp3huff.c
字号:
{0x03B6,10},{0x076E,11},{0x1DBF,13},{0x76FB,15}, {0x76FA,15},{0x3B79,14},{0x3B78,14},{0x000D, 4}, {0x001F, 5},{0x0013, 5},{0x000A, 5},{0x0008, 5}, {0x000C, 4},{0x0008, 4},{0x0009, 5},{0x003A, 6} }, { {0x0005, 3},{0x0003, 4},{0x0004, 5},{0x0010, 5}, {0x008F, 8},{0x0475,11},{0x11D1,13},{0x0079, 7}, {0x0027, 6},{0x0002, 3},{0x0003, 3},{0x0001, 4}, {0x0000, 4},{0x0026, 6},{0x0046, 7},{0x011C, 9}, {0x0477,11},{0x08ED,12},{0x11D0,13},{0x11D3,13}, {0x11D2,13},{0x11D9,13},{0x11D8,13},{0x000D, 4}, {0x001F, 5},{0x0012, 5},{0x0005, 5},{0x003D, 6}, {0x000C, 4},{0x000E, 4},{0x0022, 6},{0x0078, 7} }, { {0x0005, 3},{0x000C, 4},{0x001B, 5},{0x0000, 4}, {0x0006, 6},{0x03E2,10},{0x3E3D,14},{0x000F, 7}, {0x0034, 6},{0x0003, 3},{0x0002, 3},{0x001E, 5}, {0x001D, 5},{0x007D, 7},{0x01F0, 9},{0x07C6,11}, {0x3E3C,14},{0x3E3F,14},{0x3E3E,14},{0x3E39,14}, {0x3E38,14},{0x3E3B,14},{0x3E3A,14},{0x0008, 4}, {0x001C, 5},{0x0002, 5},{0x003F, 6},{0x0035, 6}, {0x0009, 4},{0x0001, 3},{0x000E, 7},{0x00F9, 8} }, { {0x0004, 3},{0x000B, 4},{0x0001, 4},{0x000A, 4}, {0x001E, 6},{0x00E0, 9},{0x0E1E,13},{0x0071, 8}, {0x0039, 7},{0x0007, 3},{0x0006, 3},{0x000D, 5}, {0x000C, 5},{0x0020, 7},{0x01C2,10},{0x1C3F,14}, {0x1C3E,14},{0x0E19,13},{0x0E18,13},{0x0E1B,13}, {0x0E1A,13},{0x0E1D,13},{0x0E1C,13},{0x0000, 4}, {0x0009, 5},{0x001D, 6},{0x001F, 6},{0x0011, 6}, {0x0005, 4},{0x0001, 3},{0x0043, 8},{0x0042, 8} }, { {0x0004, 3},{0x000D, 4},{0x0007, 4},{0x0002, 3}, {0x0014, 5},{0x016C, 9},{0x16D1,13},{0x02DF,10}, {0x016E, 9},{0x0000, 2},{0x0007, 3},{0x002C, 6}, {0x002B, 6},{0x02DE,10},{0x16D0,13},{0x16D3,13}, {0x16D2,13},{0x2DB5,14},{0x2DB4,14},{0x2DB7,14}, {0x2DB6,14},{0x16D9,13},{0x16D8,13},{0x000C, 5}, {0x002A, 6},{0x005A, 7},{0x001B, 6},{0x001A, 6}, {0x0017, 5},{0x000C, 4},{0x05B7,11},{0x05B5,11} }, { {0x0002, 2},{0x000F, 4},{0x001C, 5},{0x000C, 4}, {0x003B, 6},{0x01AC, 9},{0x1AD8,13},{0x35B3,14}, {0x35B2,14},{0x0001, 2},{0x0000, 2},{0x0069, 7}, {0x0068, 7},{0x35BD,14},{0x35BC,14},{0x35BF,14}, {0x35BE,14},{0x35B9,14},{0x35B8,14},{0x35BB,14}, {0x35BA,14},{0x35B5,14},{0x35B4,14},{0x01A9, 9}, {0x01A8, 9},{0x035A,10},{0x00D7, 8},{0x00D5, 8}, {0x003A, 6},{0x001B, 5},{0x35B7,14},{0x35B6,14} }, { {0x0000, 3},{0x0010, 5},{0x0072, 7},{0x0071, 7}, {0x0154, 9},{0x0AAB,12},{0x0AA8,12},{0x0014, 5}, {0x0070, 7},{0x0002, 3},{0x0003, 3},{0x000C, 4}, {0x000B, 4},{0x0003, 4},{0x0011, 5},{0x0073, 7}, {0x0054, 7},{0x00AB, 8},{0x02AB,10},{0x1553,13}, {0x1552,13},{0x1555,13},{0x1554,13},{0x000D, 4}, {0x001E, 5},{0x0012, 5},{0x003E, 6},{0x002B, 6}, {0x0002, 4},{0x003F, 6},{0x001D, 5},{0x0013, 5} }, { {0x0003, 3},{0x001F, 5},{0x0029, 6},{0x003D, 6}, {0x000C, 7},{0x0069,10},{0x0345,13},{0x0002, 5}, {0x0028, 6},{0x0002, 3},{0x0001, 3},{0x000E, 4}, {0x000C, 4},{0x0015, 5},{0x0007, 6},{0x001B, 8}, {0x006B,10},{0x006A,10},{0x0344,13},{0x0347,13}, {0x0346,13},{0x01A1,12},{0x01A0,12},{0x000B, 4}, {0x001A, 5},{0x0012, 5},{0x0000, 5},{0x003C, 6}, {0x0008, 4},{0x001B, 5},{0x0013, 5},{0x0001, 5} }, { {0x0004, 3},{0x0004, 4},{0x003F, 6},{0x0014, 5}, {0x0056, 7},{0x015C, 9},{0x15D5,13},{0x003C, 6}, {0x002A, 6},{0x0000, 3},{0x0001, 3},{0x000E, 4}, {0x000D, 4},{0x000C, 5},{0x00AF, 8},{0x02BB,10}, {0x15D4,13},{0x15D7,13},{0x15D6,13},{0x15D1,13}, {0x15D0,13},{0x15D3,13},{0x15D2,13},{0x000B, 4}, {0x0019, 5},{0x000D, 5},{0x003E, 6},{0x0031, 6}, {0x0007, 4},{0x0005, 4},{0x003D, 6},{0x0030, 6} }, { {0x0005, 3},{0x0008, 4},{0x001A, 5},{0x0000, 4}, {0x0036, 6},{0x0011, 8},{0x0106,12},{0x000A, 7}, {0x006E, 7},{0x0002, 3},{0x0003, 3},{0x0003, 4}, {0x0002, 4},{0x006F, 7},{0x0021, 9},{0x020F,13}, {0x020E,13},{0x0101,12},{0x0100,12},{0x0103,12}, {0x0102,12},{0x0105,12},{0x0104,12},{0x000C, 4}, {0x001E, 5},{0x0003, 5},{0x003E, 6},{0x003F, 6}, {0x0009, 4},{0x000E, 4},{0x000B, 7},{0x0009, 7} }, { {0x0002, 3},{0x000E, 4},{0x001E, 5},{0x000C, 4}, {0x001F, 5},{0x006E, 7},{0x00AD,10},{0x00AF,10}, {0x0014, 7},{0x0004, 3},{0x0003, 3},{0x001A, 5}, {0x0017, 5},{0x002A, 8},{0x0576,13},{0x0AEF,14}, {0x0AEE,14},{0x0571,13},{0x0570,13},{0x0573,13}, {0x0572,13},{0x0575,13},{0x0574,13},{0x0003, 4}, {0x0016, 5},{0x0004, 5},{0x0036, 6},{0x000B, 6}, {0x000A, 4},{0x0000, 3},{0x006F, 7},{0x00AC,10} }, { {0x0004, 3},{0x0005, 4},{0x0003, 3},{0x0001, 3}, {0x0004, 4},{0x002F, 6},{0x0526,11},{0x1495,13}, {0x00A6, 8},{0x0007, 3},{0x0006, 3},{0x002D, 6}, {0x002C, 6},{0x1494,13},{0x1497,13},{0x1496,13}, {0x1491,13},{0x1490,13},{0x1493,13},{0x1492,13}, {0x293D,14},{0x293C,14},{0x293F,14},{0x0000, 3}, {0x0028, 6},{0x00A5, 8},{0x0148, 9},{0x00A7, 8}, {0x002E, 6},{0x0015, 5},{0x0A4E,12},{0x293E,14} }, { {0x0004, 3},{0x0005, 4},{0x0003, 3},{0x0001, 3}, {0x0004, 4},{0x002F, 6},{0x0526,11},{0x1495,13}, {0x00A6, 8},{0x0007, 3},{0x0006, 3},{0x002D, 6}, {0x002C, 6},{0x1494,13},{0x1497,13},{0x1496,13}, {0x1491,13},{0x1490,13},{0x1493,13},{0x1492,13}, {0x293D,14},{0x293C,14},{0x293F,14},{0x0000, 3}, {0x0028, 6},{0x00A5, 8},{0x0148, 9},{0x00A7, 8}, {0x002E, 6},{0x0015, 5},{0x0A4E,12},{0x293E,14} }, { {0x0004, 3},{0x0005, 4},{0x0003, 3},{0x0001, 3}, {0x0004, 4},{0x002F, 6},{0x0526,11},{0x1495,13}, {0x00A6, 8},{0x0007, 3},{0x0006, 3},{0x002D, 6}, {0x002C, 6},{0x1494,13},{0x1497,13},{0x1496,13}, {0x1491,13},{0x1490,13},{0x1493,13},{0x1492,13}, {0x293D,14},{0x293C,14},{0x293F,14},{0x0000, 3}, {0x0028, 6},{0x00A5, 8},{0x0148, 9},{0x00A7, 8}, {0x002E, 6},{0x0015, 5},{0x0A4E,12},{0x293E,14} }, { {0x0003, 3},{0x0011, 5},{0x0020, 6},{0x0074, 7}, {0x010D, 9},{0x0863,12},{0x0860,12},{0x000A, 5}, {0x0075, 7},{0x0001, 3},{0x0000, 3},{0x000B, 4}, {0x000A, 4},{0x0018, 5},{0x0038, 6},{0x0042, 7}, {0x010F, 9},{0x010E, 9},{0x0219,10},{0x10C3,13}, {0x10C2,13},{0x10C5,13},{0x10C4,13},{0x000F, 4}, {0x0004, 4},{0x0019, 5},{0x000B, 5},{0x0039, 6}, {0x0009, 4},{0x001B, 5},{0x001A, 5},{0x003B, 6} }, { {0x0005, 3},{0x0001, 4},{0x003E, 6},{0x0001, 5}, {0x00E2, 8},{0x1C6F,13},{0x38D9,14},{0x0039, 6}, {0x001F, 6},{0x0002, 3},{0x0001, 3},{0x0009, 4}, {0x0008, 4},{0x0000, 5},{0x0070, 7},{0x01C7, 9}, {0x038C,10},{0x071A,11},{0x38D8,14},{0x38DB,14}, {0x38DA,14},{0x38DD,14},{0x38DC,14},{0x000D, 4}, {0x001D, 5},{0x000E, 5},{0x003F, 6},{0x003C, 6}, {0x000C, 4},{0x0006, 4},{0x003D, 6},{0x001E, 6} }, { {0x0006, 3},{0x000B, 4},{0x0011, 5},{0x001E, 5}, {0x0074, 7},{0x03AA,10},{0x1D5C,13},{0x0001, 6}, {0x0021, 6},{0x0001, 3},{0x0002, 3},{0x0007, 4}, {0x0006, 4},{0x003E, 6},{0x00EB, 8},{0x01D4, 9}, {0x0EAF,12},{0x3ABB,14},{0x3ABA,14},{0x1D59,13}, {0x1D58,13},{0x1D5B,13},{0x1D5A,13},{0x000A, 4}, {0x001C, 5},{0x0001, 5},{0x003F, 6},{0x003B, 6}, {0x0001, 4},{0x0009, 4},{0x0020, 6},{0x0000, 6} }, { {0x0004, 3},{0x000A, 4},{0x0017, 5},{0x0004, 4}, {0x0016, 6},{0x016A, 9},{0x16B1,13},{0x0017, 7}, {0x005B, 7},{0x0006, 3},{0x0007, 3},{0x0001, 4}, {0x0000, 4},{0x000A, 6},{0x02D7,10},{0x0B5A,12}, {0x16B0,13},{0x16B3,13},{0x16B2,13},{0x2D6D,14}, {0x2D6C,14},{0x2D6F,14},{0x2D6E,14},{0x0006, 4}, {0x000A, 5},{0x0004, 5},{0x002C, 6},{0x0017, 6}, {0x0003, 4},{0x0007, 4},{0x0016, 7},{0x00B4, 8} }, { {0x0005, 3},{0x000D, 4},{0x0005, 4},{0x0009, 4}, {0x0033, 6},{0x0193, 9},{0x192C,13},{0x0061, 8}, {0x0031, 7},{0x0000, 2},{0x0007, 3},{0x0010, 5}, {0x0011, 5},{0x00C8, 8},{0x192F,13},{0x325B,14}, {0x325A,14},{0x1929,13},{0x1928,13},{0x192B,13}, {0x192A,13},{0x325D,14},{0x325C,14},{0x0018, 5}, {0x001A, 6},{0x001B, 6},{0x0065, 7},{0x0019, 6}, {0x0004, 4},{0x0007, 4},{0x0060, 8},{0x0324,10} }, { {0x0006, 3},{0x0000, 3},{0x0002, 4},{0x000F, 4}, {0x0039, 6},{0x01D9, 9},{0x1D82,13},{0x0761,11}, {0x03BE,10},{0x0001, 2},{0x0002, 2},{0x000F, 6}, {0x000E, 6},{0x0762,11},{0x3B07,14},{0x3B06,14}, {0x3B1D,14},{0x3B1C,14},{0x3B1F,14},{0x3B1E,14}, {0x3B19,14},{0x3B18,14},{0x3B1B,14},{0x0038, 6}, {0x01DE, 9},{0x00ED, 8},{0x03BF,10},{0x00EE, 8}, {0x003A, 6},{0x0006, 5},{0x0EC0,12},{0x3B1A,14} }, { {0x0000, 2},{0x0002, 3},{0x000F, 5},{0x0006, 4}, {0x001C, 6},{0x01D0,10},{0x0E8C,13},{0x1D1B,14}, {0x1D1A,14},{0x0003, 2},{0x0002, 2},{0x00EA, 9}, {0x00E9, 9},{0x0E89,13},{0x0E88,13},{0x0E8B,13}, {0x0E8A,13},{0x1D65,14},{0x1D64,14},{0x1D67,14}, {0x1D66,14},{0x1D61,14},{0x1D60,14},{0x03AD,11}, {0x1D63,14},{0x1D62,14},{0x1D1D,14},{0x1D1C,14}, {0x003B, 7},{0x01D7,10},{0x1D1F,14},{0x1D1E,14} }, { {0x0002, 2},{0x000F, 4},{0x001C, 5},{0x000C, 4}, {0x003B, 6},{0x01AC, 9},{0x1AD8,13},{0x35B3,14}, {0x35B2,14},{0x0001, 2},{0x0000, 2},{0x0069, 7}, {0x0068, 7},{0x35BD,14},{0x35BC,14},{0x35BF,14}, {0x35BE,14},{0x35B9,14},{0x35B8,14},{0x35BB,14}, {0x35BA,14},{0x35B5,14},{0x35B4,14},{0x01A9, 9}, {0x01A8, 9},{0x035A,10},{0x00D7, 8},{0x00D5, 8}, {0x003A, 6},{0x001B, 5},{0x35B7,14},{0x35B6,14} }};/*A description of a Huffman code value used when encoding the tree.*/typedef struct{ /*The bit pattern, left-shifted so that the MSB of all patterns is aligned.*/ unsigned long pattern; /*The amount the bit pattern was shifted.*/ int shift; /*The token this bit pattern represents.*/ int token;}oc_huff_entry;/*Compares two oc_huff_entry structures by their bit patterns. _c1: The first entry to compare. _c2: The second entry to compare. Return: <0 if _c1<_c2, >0 if _c1>_c2.*/static int huff_entry_cmp(const void *_c1,const void *_c2){ unsigned long b1; unsigned long b2; b1=((const oc_huff_entry *)_c1)->pattern; b2=((const oc_huff_entry *)_c2)->pattern; return b1<b2?-1:b1>b2?1:0;}int oc_huff_codes2latex(const theora_huff_code _codes[80][32]){ int i; printf("\\twocolumn\n"); for(i=0;i<80;i++){ oc_huff_entry entries[32]; int bpos; int maxlen; int mask; int j; /*First, find the maximum code length so we can align all the bit patterns.*/ maxlen=_codes[i][0].nbits; for(j=1;j<32;j++)if(maxlen<_codes[i][j].nbits)maxlen=_codes[i][j].nbits; mask=(1<<maxlen)-1; /*Copy over the codes into our temporary workspace. The bit patterns are aligned, and the original entry each code is from is stored as well.*/ for(j=0;j<32;j++){ entries[j].shift=maxlen-_codes[i][j].nbits; entries[j].pattern=_codes[i][j].pattern<<entries[j].shift&mask; entries[j].token=j; } /*Sort the codes into ascending order. This is the order they will be presented in.*/ qsort(entries,32,sizeof(entries[0]),huff_entry_cmp); printf("\\begin{center}\n"); printf("\\begin{tabular}{lr}\\toprule\n"); printf("\\multicolumn{1}{c}{Huffman Code} & Token Value \\\\\\midrule\n"); for(j=0;j<32;j++){ int k; printf("\\bin{"); for(k=maxlen;k-->entries[j].shift;){ printf("%c",(entries[j].pattern>>k&1)+'0'); } printf("}"); for(;k>=0;k--)printf(" "); printf(" & "); if(entries[j].token<10)printf(" "); printf("$%i$ \\\\\n",entries[j].token); } printf("\\bottomrule\n"); printf("\\\\\n"); printf("\\multicolumn{2}{c}{VP3.1 Huffman Table Number $%i$}\n",i); printf("\\end{tabular}\n"); printf("\\end{center}\n"); printf("\\vfill\n"); printf("\n"); } printf("\\onecolumn\n"); return 0;}int main(int _argc,char **_argv){ oc_huff_codes2latex(OC_VP31_HUFF_CODES); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -