Fix tearing issue with multithreaded optimizations and QSV