                 unsigned int & s_byte_idx, const uint4* & d_byte, unsigned int & d_byte_chunk_count,
                 const unsigned int table_offset, unsigned int & coefficient_idx)
 {
-    // Peek next 16 bits and use them to find all the info.
-    const unsigned int bits = gpujpeg_huffman_gpu_decoder_peek_bits(16, r_bit, r_bit_count, s_byte, s_byte_idx, d_byte, d_byte_chunk_count);
-    const unsigned int packed_info = gpujpeg_huffman_gpu_decoder_tables[table_offset + bits];
+    // Peek next 16 bits and use them as an index into decoder table to find all the info.
+    const unsigned int table_idx = table_offset + gpujpeg_huffman_gpu_decoder_peek_bits(16, r_bit, r_bit_count, s_byte, s_byte_idx, d_byte, d_byte_chunk_count);
+    
+    // Try the quick table first (use the full table only if not succeded with the quick table)
+    unsigned int packed_info = gpujpeg_huffman_gpu_decoder_tables_quick[table_idx >> (16 - QUICK_CHECK_BITS)];
+    if(0 == packed_info) {
+        packed_info = gpujpeg_huffman_gpu_decoder_tables_full[table_idx];
+    }
     
     // remove the right number of bits from the bit buffer
     gpujpeg_huffman_gpu_decoder_discard_bits((packed_info >> 4) & 0x1F, r_bit, r_bit_count);

 * 
 * Each entry consists of:
 *   - Number of bits of code corresponding to this entry (0 - 16, both inclusive) - bits 4 to 8
 *   - Number of run-length coded zeros before currently decoded coefficient (0 - 64, both inclusive) - bits 9 to 15
 *   - Number of bits representing the value of currently decoded coefficient (0 - 15, both inclusive) - bits 0 to 3
 * bit #:    15                      9   8               4   3           0
 *         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 * value:  |      RLE zero count       |   code bit size   | value bit size|
 *         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 */
__device__ uint16_t gpujpeg_huffman_gpu_decoder_tables[4 * (1 << 16)];





) {
    // Each thread uses all 4 Huffman tables to "decode" one symbol from its unique 16bits.
    const int idx = threadIdx.x + blockIdx.x * blockDim.x;
    gpujpeg_huffman_gpu_decoder_table_setup(idx, d_table_y_dc, 0);
    gpujpeg_huffman_gpu_decoder_table_setup(idx, d_table_y_ac, 1);
    gpujpeg_huffman_gpu_decoder_table_setup(idx, d_table_cbcr_dc, 2);
    gpujpeg_huffman_gpu_decoder_table_setup(idx, d_table_cbcr_ac, 3);
}

/** Documented at declaration */
