frame_thread_encoder: use ref-counting to avoid memcpy of all input frames

Apparently uneeded lock/unlock removed by commiter

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>