From patchwork Thu Jan 31 13:09:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11925 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 41FCB44C974 for ; Thu, 31 Jan 2019 15:10:09 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 54EC268AC2A; Thu, 31 Jan 2019 15:09:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E89AE68A974 for ; Thu, 31 Jan 2019 15:09:50 +0200 (EET) Received: from [172.31.218.54] (helo=vie01a-dmta-pe08-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gpC6d-0008AB-RJ for ffmpeg-devel@ffmpeg.org; Thu, 31 Jan 2019 14:10:11 +0100 Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gpC6Y-0002ho-0O for ffmpeg-devel@ffmpeg.org; Thu, 31 Jan 2019 14:10:06 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id pC5agPnGl2WSspC5agiMTn; Thu, 31 Jan 2019 14:09:06 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=E7kcWpVl c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=T-ILl4f1xMltUgNwZfUA:9 a=pHzHmUro8NiASowvMSCR:22 a=n87TN5wuljxrRezIQYnT:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 31 Jan 2019 14:09:02 +0100 Message-Id: <20190131130902.26536-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190131130902.26536-1-michael@niedermayer.cc> References: <20190131130902.26536-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLonrZ0E2449gkiqdjFgJvP0mVkoH8GtexwxvqTPYZ2UoCcyWtWYu1ry9BfUYaBXGRtIl0FGdwwvfycTlyxp9Rh9AiMx9B5PgJWb+XEUoPaMrtvSlLI9 2hIQb9U6GLLv6SEbmCFCx82h3O+gHZ9XWxwxtIfwFDiqlRWVKV6Rqkmm Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/gifdec: Optimize gif_fill() by using av_memset_bytes() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Improves speed for 780/clusterfuzz-testcase-6393552642768896 from 95 sec to 60 sec Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/gifdec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 2115da163f..c85f310140 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -86,11 +86,7 @@ static void gif_read_palette(GifState *s, uint32_t *pal, int nb) static void gif_fill(AVFrame *picture, uint32_t color) { - uint32_t *p = (uint32_t *)picture->data[0]; - uint32_t *p_end = p + (picture->linesize[0] / sizeof(uint32_t)) * picture->height; - - for (; p < p_end; p++) - *p = color; + av_memset_bytes(picture->data[0], picture->linesize[0] * picture->height, &color, 4); } static void gif_fill_rect(AVFrame *picture, uint32_t color, int l, int t, int w, int h)