h264: factor out common code from init() and init_thread_copy()