A High-Speed Static Huffman Decoder

By Brenton Hoff

Dr. Dobb's Journal November 1997

(a) 
0x00  ABANDON
0x01  AGAIN
0x02  AGAIN
 ...
'w'   AGAIN
'x'   COMPLETED
'y'   AGAIN
 ...
(b)
for (;;) {
  NextCh = *pText++;
  Action = pState[NextCh];
  switch (Action) {
   case AGAIN: continue;
   case COMPLETED: return TRUE;
   case ABANDON: return FALSE;
  }
}
(c)
AGAIN: 	 lodsb 	 ;   Address 0
 	 xlat
 	 jmp  ax
COMPLETED: mov  ax,1 ;   Address 4
          ret
ABANDON:  mov ax,0	 ;   Address 8
          ret

Example 1: Search actions for "x": (a) State table; (b) C version; (c) 80x86 assembly-language version.

Back to Article


Copyright © 1997, Dr. Dobb's Journal