From patchwork Tue Dec 27 23:17:48 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: 39793 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3762682pzb; Tue, 27 Dec 2022 15:22:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXu0FqatR7z6rFY9Ok2jMOx+gBuRSbO6yBp/zgHa6TBa9R0DLD8sgdm+B3fJvxCbEkiaeQgK X-Received: by 2002:a17:906:c2cb:b0:842:32e9:f1e9 with SMTP id ch11-20020a170906c2cb00b0084232e9f1e9mr15492139ejb.69.1672183342672; Tue, 27 Dec 2022 15:22:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672183342; cv=none; d=google.com; s=arc-20160816; b=QviLVOysnvP2SAtLgZHO2pQndBifEoPd2vlENZeltqoCqsAMkYjAR5uMtGE5d/Km7E junUUo6pO7CIQ81nZyUjN7o9yzHWSiVU6phSW3KsiT9bxOZTyOztjhZ7qIZltuVcQfts cAyGZ5degRrVwBupYe8i/VnJReV5i5u7A1NodbvV1HGimDjyquR5P5niyTgVf09ploCP RimY8N95PxcEkmbjUz8L+CKS3hq2oCEcaCnMbZH5zMU340zPwX9epZaXBHvMS4YsuFg4 Hw1tIH+lYRYNV+UlaZpzPb8KvxHzYb7hJfacE9GHZ2Sow6sKHRC7Rlbg8X6+s+gtxmYs ziDA== 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=KQwaQGYCBnZWzB91v1DdBaxVOV2Zq83CvKQoDBIRmXQ=; b=MIz6mSQaCgKsQpGogWsJ7JppJGHORE9p3m2xmjkl8tLt3O3v+vpGna8hE5dPY4Nt9S V/TWh5MN+UML5g4uLPZTLeG0x5BTWWqg1UG+J0JjEW67vPqNu0PPblD3oAKNcdIAsJEB +hN0XY15kgHagB2G9TrRtFvMztgVXWFDa4xKZtaRJ1zoeorvXXF2P/CKOcxfWyWUUj7M PRu6uS4ex5hPCpqqDEj6mx2EjL1TEnG4Mq6QKR81tX0dMKwKtv7jm31IrEDgCVKNs42J /VMsL8T7Hc7O5s5MBsgn3FT2rk1IFdE74H+xpz565xELTh2jgMPJhao9BzpFaRKbIeec FfIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=jmwtxRYD; 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 va28-20020a17090711dc00b007ba713e241dsi9683210ejb.894.2022.12.27.15.22.22; Tue, 27 Dec 2022 15:22:22 -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=jmwtxRYD; 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 D14C168BCD3; Wed, 28 Dec 2022 01:18:55 +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 8D08B68BD08 for ; Wed, 28 Dec 2022 01:18:31 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1672183097; 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=gftig9AtoI+N9WP5jPYT6YVzxLXOU1+I/WgnPjw0S78=; b=jmwtxRYDyWvSYk7QqKvp6qNPhZswKV58PGco7xm7e74XBWgCcTR64Jb0vIZCNFGRiqd6UA Y5AhL+Tu2R2FTcnj13WNZzi1YX0dXPy374LF5pPQyRCU0OWhSrtQTiAQNExkw9FCbonOg3 oh6O1u4Un4Yzo6768UD+rf1+yjMmXos= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id 1cfd3f3c; Tue, 27 Dec 2022 23:18:17 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Dec 2022 00:17:48 +0100 Message-Id: <20221227231814.2520181-7-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 06/32] avfilter/paletteuse: name target color arg consistently in colormap functions 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: DzvC48yFgXTS --- libavfilter/vf_paletteuse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c index fb4016b11c..f43f077454 100644 --- a/libavfilter/vf_paletteuse.c +++ b/libavfilter/vf_paletteuse.c @@ -180,7 +180,7 @@ static av_always_inline int diff(const uint32_t a, const uint32_t b, const int t } } -static av_always_inline uint8_t colormap_nearest_bruteforce(const uint32_t *palette, const uint32_t argb, const int trans_thresh) +static av_always_inline uint8_t colormap_nearest_bruteforce(const uint32_t *palette, const uint32_t target, const int trans_thresh) { int i, pal_id = -1, min_dist = INT_MAX; @@ -188,7 +188,7 @@ static av_always_inline uint8_t colormap_nearest_bruteforce(const uint32_t *pale const uint32_t c = palette[i]; if (c >> 24 >= trans_thresh) { // ignore transparent entry - const int d = diff(palette[i], argb, trans_thresh); + const int d = diff(palette[i], target, trans_thresh); if (d < min_dist) { pal_id = i; min_dist = d; @@ -235,10 +235,10 @@ static void colormap_nearest_node(const struct color_node *map, } } -static av_always_inline uint8_t colormap_nearest_recursive(const struct color_node *node, const uint8_t rgb, const int trans_thresh) +static av_always_inline uint8_t colormap_nearest_recursive(const struct color_node *node, const uint8_t target, const int trans_thresh) { struct nearest_color res = {.dist_sqd = INT_MAX, .node_pos = -1}; - colormap_nearest_node(node, 0, rgb, trans_thresh, &res); + colormap_nearest_node(node, 0, target, trans_thresh, &res); return node[res.node_pos].palette_id; }