Fixes for UBsan issues
For testing spurious wakeups I temporarily redefined pthread_cond_wait()
to a sequence of unlock(), sleep(), lock()
. Prior to this MR doing so would randomly cause dav1d_apply_grain()
to return before the grain application was completed, leading to various issues. It now passes all tests.