From patchwork Fri Oct 21 13:31:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 1100 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp1070807vsd; Fri, 21 Oct 2016 06:32:25 -0700 (PDT) X-Received: by 10.194.152.167 with SMTP id uz7mr786938wjb.178.1477056745507; Fri, 21 Oct 2016 06:32:25 -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 g132si1737950wmf.125.2016.10.21.06.32.24; Fri, 21 Oct 2016 06:32:25 -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 546CD689C52; Fri, 21 Oct 2016 16:31:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe01-1.mx.upcmail.net (vie01a-dmta-pe01-1.mx.upcmail.net [62.179.121.154]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9EB27689C39 for ; Fri, 21 Oct 2016 16:31:48 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1bxZvL-0003wZ-O6 for ffmpeg-devel@ffmpeg.org; Fri, 21 Oct 2016 15:31:51 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id yDXq1t00s0S5wYM01DXrcQ; Fri, 21 Oct 2016 15:31:51 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 21 Oct 2016 15:31:43 +0200 Message-Id: <20161021133146.11956-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161021133146.11956-1-michael@niedermayer.cc> References: <20161021133146.11956-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/7] avcodec/mpegvideo_enc: Add missing emms_c() to clear MMX state after SIMD use 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" Fixes undefined behavior due to calling libc allocation with unclean FPU state Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index f34003e..b2c5eab 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1320,6 +1320,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) EDGE_BOTTOM); } } + emms_c(); } } ret = av_frame_copy_props(pic->f, pic_arg); @@ -1890,6 +1891,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, return ret; vbv_retry: ret = encode_picture(s, s->picture_number); +// emms_c(); if (growing_buffer) { av_assert0(s->pb.buf == avctx->internal->byte_buffer); pkt->data = s->pb.buf;