Populate q_index in multi-thread encoding