From patchwork Sat Oct 22 19:02:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 1123 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp1557137vsd; Sat, 22 Oct 2016 12:02:30 -0700 (PDT) X-Received: by 10.194.220.232 with SMTP id pz8mr6321357wjc.154.1477162950024; Sat, 22 Oct 2016 12:02:30 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r2si4236335wmb.12.2016.10.22.12.02.29; Sat, 22 Oct 2016 12:02:29 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 34FAE689C63; Sat, 22 Oct 2016 22:02:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-2.mx.upcmail.net (vie01a-dmta-pe02-2.mx.upcmail.net [62.179.121.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 216F66897C1 for ; Sat, 22 Oct 2016 22:02:12 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1by1Yc-00044w-O9 for ffmpeg-devel@ffmpeg.org; Sat, 22 Oct 2016 21:02:14 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id yj2D1t01H0S5wYM01j2EyT; Sat, 22 Oct 2016 21:02:14 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 22 Oct 2016 21:02:00 +0200 Message-Id: <20161022190211.16526-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161022190211.16526-1-michael@niedermayer.cc> References: <20161022190211.16526-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 02/13] avcodec: Clear MMX state in ff_thread_report_progress(INT_MAX) X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This decreases the number of FPU state violations in fate on x86-64 from 309 to 79 Signed-off-by: Michael Niedermayer --- libavcodec/pthread_frame.c | 3 +++ libavcodec/utils.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 7ef5e9f..b6c6027 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -473,6 +473,9 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field) PerThreadContext *p; volatile int *progress = f->progress ? (int*)f->progress->data : NULL; + if (n >= INT_MAX) + emms_c(); + if (!progress || progress[field] >= n) return; p = f->owner->internal->thread_ctx; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 7c26485..bc28cf9 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3959,6 +3959,8 @@ void ff_thread_finish_setup(AVCodecContext *avctx) void ff_thread_report_progress(ThreadFrame *f, int progress, int field) { + if (progress >= INT_MAX) + emms_c(); } void ff_thread_await_progress(ThreadFrame *f, int progress, int field)