 //     }
 //     assert(zeros_before_even == ref_zeros_before_even);
     
-//     // TODO: set to true if any nonzero value follows thread's even value
-//     bool ref_nonzero_follows = false;
-//     for(int i = load_idx + 1; i < 64; i++) {
-//         if(s_in[i]) {
-//             ref_nonzero_follows = true;
-//             break;
-//         }
-//     }
+    // TODO: set to true if any nonzero value follows thread's even value
+    bool ref_nonzero_follows = false;
+    for(int i = load_idx + 1; i < 64; i++) {
+        if(s_in[i]) {
+            ref_nonzero_follows = true;
+            break;
+        }
+    }
     
     // count of consecutive zeros before odd value (either one more than 
     // even if even is zero or none if even value itself is nonzero)


        // Write Category offset
        if ( gpujpeg_huffman_gpu_encoder_emit_bits((unsigned int) temp2, nbits, put_value, put_bits, data_compressed) != 0 )
            return -1;
    }

    // If all the left coefs were zero, emit an end-of-block code
    if ( last_nonzero_idx != 63 ) {
        if ( gpujpeg_huffman_gpu_encoder_emit_bits(d_table_ac->code[256], d_table_ac->size[256], put_value, put_bits, data_compressed) != 0 )
            return -1;
    }


    ((short2*)s_in)[load_idx].y = zeros_before_even & 0xF;
    ((short2*)s_in)[load_idx + 1].x = in_odd;
    ((short2*)s_in)[load_idx + 1].y = zeros_before_odd & 0xF;
    if(!ref_nonzero_follows && !in_odd) {
        ((short2*)s_in)[load_idx + 1].y = -1;
    }
    __threadfence_block();
    
    
