encode thread 1 -> 2