frameencoder: store the reference state of the picture in FrameEncoder

We find that reference state of the reference frame changed during the encode
when we use frame-thread > 1 this cause the CU level QP for the frame is
non-deterministic, this is leading the non-deterministic encoded output for the
frame, to avoid this store the reference state of the frame to
FrameEncoder->m_isReferenced and when the QP is calculate for CU, refer the
reference state of the frame from FrameEncoder->m_isReferenced this stat will
never change during the encode

Moved slice reference state initialization from dpb to FrameEncoder initSlice()
Merge with stable
threadpool: use a mutex to protect pool allocation

We only want to allow one thread to create the singleton thread pool. Rename
the static instance variable to s_instance as per our coding style