[FFmpeg-devel] [PATCH 02/13] avcodec: Clear MMX state in ff_thread_report_progress(INT_MAX)

Michael Niedermayer michael at niedermayer.cc
Sat Oct 22 22:02:00 EEST 2016


This decreases the number of FPU state violations in fate on x86-64 from 309 to 79

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 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)
-- 
2.10.1



More information about the ffmpeg-devel mailing list