change thread the implementation of the jpeg callback