From patchwork Tue Dec 27 23:18:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 39775 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3762867pzb; Tue, 27 Dec 2022 15:22:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtMPHVNeeHuNliZRH26lWqSj5uMkj0mHiKPQzYI8OhefQJCBpHdwLjSd5+IcuIlcFUrVXfq X-Received: by 2002:a05:6402:28cd:b0:46c:fabc:5897 with SMTP id ef13-20020a05640228cd00b0046cfabc5897mr19003475edb.7.1672183368373; Tue, 27 Dec 2022 15:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672183368; cv=none; d=google.com; s=arc-20160816; b=xpVaF1OWfIkVff0+KauKix08UOs3ifRBgXmWB5TJ4poP6NDWJqhJlJrO+QV098L6Rl 4Wq0xVKPvvJRn/a0O9ZPkW+iLWLe+pXQ4IrcTN3VtmWd2l6Bqnvsl/4BoY65XueDxI/2 TEUVfSSCbSGzH1RQN8VrgLwNUdkrphoXDVph+B/EM/6VVDPjlf6HkPewqjYMDg02UuXT VBJZTV9PQoyZdpjXuK0AE6VkE4XS5i1JuSrmDfZDy/07TJ3s4+xUOuYzyxe4bFSF+hLL p98djapMReN5S6gNfFP6jHiMTvTH5YdLc7J7zcRm5YD39c6iLUG1hMQZTah/8msRK9Ur P8fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=FVjsjh6r4uOuZxLnQ49ZtYX/c7Xp73lgXkNHFnlOqLc=; b=FCxNE5N/FkAUEIa7ZKboOUlF0PhEQ8JDUsjMdLMkHtInK+mryY7CBUe4teyX3hT5/n MnXhjaZSNRh6yI5AACLgmpWC3tCPhC150UvwsjACYpSCPD0MlWKWHcVg75j7cFTEmov1 DpnssRcOEQ6YFsp8OIrJlSZ4aRinDzvXZI6fy4hQvBy7+syJP7bWNt688Ga96U44q1Zt yJvZlDibb0jXbeZkQeLl6Q/Qst8H5P1tlnjHrSIeA9XA1kS+84/G8axZK3x2K3ycNoRN 6LUcCrWY3tFV5xFCshYhoc7elEWoc7JzWR8sZ+Q/DEWHvQf4yqpRJqGaTx6SaQDICWhk R6FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=rjhhaG5B; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=pkh.me Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b8-20020aa7d488000000b00473d8c56c90si10571685edr.139.2022.12.27.15.22.48; Tue, 27 Dec 2022 15:22:48 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=rjhhaG5B; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=pkh.me Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01CE668BDCA; Wed, 28 Dec 2022 01:18:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ssq0.pkh.me (laubervilliers-656-1-228-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B93BA68BD08 for ; Wed, 28 Dec 2022 01:18:36 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1672183100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MUKAZyh05rPS/aWwUSGl1sssz/Jezjhn2fajvPihBNY=; b=rjhhaG5B823cU98XjczWbvAALJOCtZbNjBx+QGKYfZ6aKz3tOCoSW+jnAiPZ9DbrLEZheY d5FacvWp0ylXQlDhqEI914HN60ORDODoF3YGJTsBDbVnQYXb4+jFpOLVLNggU+uNUVUkRn xblwzRQ0vpyNPpnJG3z9oFj6AJupLzo= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id 38e30e2a; Tue, 27 Dec 2022 23:18:20 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Dec 2022 00:18:13 +0100 Message-Id: <20221227231814.2520181-32-u@pkh.me> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221227231814.2520181-1-u@pkh.me> References: <20221105152617.1809282-1-u@pkh.me> <20221227231814.2520181-1-u@pkh.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 31/32] avfilter/paletteuse: move r, g, b computation in a more local scope X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: D3KUc/dvEaWJ --- libavfilter/vf_paletteuse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c index 33b8e70293..e3462b4abb 100644 --- a/libavfilter/vf_paletteuse.c +++ b/libavfilter/vf_paletteuse.c @@ -262,9 +262,6 @@ static av_always_inline int color_get(PaletteUseContext *s, uint32_t color) static av_always_inline int get_dst_color_err(PaletteUseContext *s, uint32_t c, int *er, int *eg, int *eb) { - const uint8_t r = c >> 16 & 0xff; - const uint8_t g = c >> 8 & 0xff; - const uint8_t b = c & 0xff; uint32_t dstc; const int dstx = color_get(s, c); if (dstx < 0) @@ -273,6 +270,9 @@ static av_always_inline int get_dst_color_err(PaletteUseContext *s, if (dstx == s->transparency_index) { *er = *eg = *eb = 0; } else { + const uint8_t r = c >> 16 & 0xff; + const uint8_t g = c >> 8 & 0xff; + const uint8_t b = c & 0xff; *er = (int)r - (int)(dstc >> 16 & 0xff); *eg = (int)g - (int)(dstc >> 8 & 0xff); *eb = (int)b - (int)(dstc & 0xff);