From patchwork Mon May 31 07:55:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 27998 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp2656624iof; Mon, 31 May 2021 00:56:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLVekNQBNqmKI7Y/fh+vShKCKU6+p2mEjOjl/yfx/tYY9OnhOA7k+jgmHslsI+nP2i/Kj9 X-Received: by 2002:a17:906:68c1:: with SMTP id y1mr19938360ejr.32.1622447814795; Mon, 31 May 2021 00:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622447814; cv=none; d=google.com; s=arc-20160816; b=lSCb99vZcYJJvneA/kwBCwwDmglrAaICtW/9Dh4Ns8S5s9vL8+p4nbnM4ZdLhF5dyN GyNIb1S+QnLJZu85tq7urFcmZ1b9PN5eTmwcQvswsZ92+bDJNuQVpgEVLvsJ3fLDiTyI fMU9I9ireLzvk/TrZ8m+lzGAdfdnnVzWGZS2dYRG7bHPX8g9lU+1Iccs/cK4Go14Gr7T Pa2yKlnLRApF/mh7cPZxN26ANxe0p164aOz4IC5Ti0Ij9jOksv3hm7zzuiik/hVLmijC Lrz4NsjHIbd0c/3YtqMpPh7vz0CQ97Gtg9FVM+r4aONPhCztjqgxrkdsu708jR58yO0w gPyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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:delivered-to; bh=IAxK3BNuyU0q+hpLhS1k2WwewuvPDh5yIiLFoOvEbGg=; b=zbQR3lEVp3tjrkCn3KEXr6jwZkzO48URoy4QDI0jWQKmssDJUSWkLmfE0v2QBW+Z1p 8w4RsW9gFQPT8F84audDdGbOWD9iWfsE6VHKv0GV70wbJ1DnwsDAwCtPOhONj6lOrEtz anR9fIinsQo10trzU8Nbp7dGHPZoiU2iNZORhwIKPsZA7a7YUL8LPv3TOIbN+IhxU1gB ekd7GIWw3vz2xnXWIOH/n7ZyIafw3RqiOV0LhlcEQMgT5YmW9lCCZFPwrFBl9Xx6PWzc oi7iwXZl5at31CFzqcU2e0cvSTxEGhIb2bm5QMrPaMWgjs+TmU8BFp/LkEhSS2E08Vxr CWJA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t7si2002239ejj.44.2021.05.31.00.56.54; Mon, 31 May 2021 00:56:54 -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 BDED9689248; Mon, 31 May 2021 10:55:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EBEF86805BE for ; Mon, 31 May 2021 10:55:28 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D4E5224069C for ; Mon, 31 May 2021 09:55:25 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id nAZQRREXs7WK for ; Mon, 31 May 2021 09:55:25 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 4D46924069F for ; Mon, 31 May 2021 09:55:22 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 256E73A1853; Mon, 31 May 2021 09:55:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 May 2021 09:55:10 +0200 Message-Id: <20210531075515.19544-19-anton@khirnov.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210531075515.19544-1-anton@khirnov.net> References: <20210531075515.19544-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/24] sws: move updating the palette higher up 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jDKx+bjIEBJr It does not interact in any way with the code setting up the image pointers/strides, so it should not be intermixed with it. --- libswscale/swscale.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b9b2826911..3b03fd16dd 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -911,6 +911,9 @@ int attribute_align_arg sws_scale(struct SwsContext *c, for (i = 0; i < 4; i++) memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2)); + if (usePal(c->srcFormat)) + update_palette(c, (const uint32_t *)srcSlice[1]); + memcpy(src2, srcSlice, sizeof(src2)); memcpy(dst2, dst, sizeof(dst2)); memcpy(srcStride2, srcStride, sizeof(srcStride2)); @@ -925,9 +928,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c, c->sliceDir = (srcSliceY == 0) ? 1 : -1; } - if (usePal(c->srcFormat)) - update_palette(c, (const uint32_t *)srcSlice[1]); - if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) { uint8_t *base; int x,y;