From patchwork Tue Dec 27 23:17:54 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: 39776 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3761482pzb; Tue, 27 Dec 2022 15:19:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXvIKIsC+WM3RhCXBcP08Ws3zPqXGWR5sYMFcGMnpG8d8vwzSkmlYr+XXtMXhF+ddROYnISH X-Received: by 2002:a17:907:8c86:b0:7c1:1adc:46fd with SMTP id td6-20020a1709078c8600b007c11adc46fdmr20670211ejc.34.1672183192086; Tue, 27 Dec 2022 15:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672183192; cv=none; d=google.com; s=arc-20160816; b=HL6T/d75JT47W2s9TSqpz6ZvlK5l/kuSP2nxmIqEIXMC9iTTL28OJnb9mXoFU8yimZ 0n8bwkaE9Gg3dAJWYebNE7KeU3pgkoJfTc63HKdNTAHNZurL/f+qzokeDRx+YlSQmU/k SiuS859YTtq99hukOO6J494haINb1XrOwFpOghZ/aH4qtr3AtWNAiSv5IfG5dGSoiaTF RHgXhG404ZduwPwdIxBnm3Mk9Hp1mSS/P5wAOEb6TybgPvibd9Aj8zdF/NHYmGEWFyLw TQ9Tyu0l4malehJLQLXxKVySVf4tLMainIsig3ANccMrAY9g0li8a0E6UYbyhyYTXC2P uvXw== 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=VEbk1mCudzep47/eJR3N07s3IGoPCsLZKunv74FNZvo=; b=svLgXuWpHZpkOfbhs6+szHXNm3ylDaZfXP8yI3i/1IireG+9O26k4xbUSsRxudVC3p VQmSWixYIW56t7C37vgEl8hCGv/HxCmNpvMaME4UJub1N13NQaD4QMRoYNiC//GTPP7S czL7C302OP1uE33sG/fGflsdzlgt6cI9jdpug3XOrwHlXldWmvYkka+1/g+2Mi281CsW k6595mZ4YPYDUAYfeGrASHkOFEMkIJTmp/f/lmqMkv4zUmMKGQQ7F+g/Ck4/DLK4t4sD YuwkSt8YSADetxBdPFalTM1yT+6+zcM3VtTjq3vdfs1g900UISKbGlbG+4iB4AoDpmoC Dx7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=LPh+G8HG; 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 hb16-20020a170907161000b00839f873bf5asi11550181ejc.217.2022.12.27.15.19.51; Tue, 27 Dec 2022 15:19:52 -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=LPh+G8HG; 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 737E468BCE9; Wed, 28 Dec 2022 01:18:38 +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 2619B68BCAB for ; Wed, 28 Dec 2022 01:18:33 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1672183098; 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=POT4QO3NFT7zwPFKrGNpvdtkmGnt/sBuLuMkraWmHDM=; b=LPh+G8HGLQGf07WS9dq7tTMhDZZatKtKhvcyrsAyA7NsZDpVuxgoXSAYu1nN2Bh5VMpuBK I6TCqKAklRqzjjVM5nz45dKZplwaUBz3o0gvqKjHJDPIWbrtxMYfk4bnCnsmAbbPB/QLbW YxdZBYS1ZwQXGvzoCrSFUsSg8LCmJMI= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id 8ec0a9aa; Tue, 27 Dec 2022 23:18:18 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Dec 2022 00:17:54 +0100 Message-Id: <20221227231814.2520181-13-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 12/32] avfilter/palettegen: use box->major_axis without intermediate variable 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: tuyBvpqQ76GV --- libavfilter/vf_palettegen.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index ed1448755c..aa0c8fdc5b 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -363,22 +363,21 @@ static AVFrame *get_palette_frame(AVFilterContext *ctx) s->nb_boxes = 1; while (box && box->len > 1) { - int i, longest; + int i; uint64_t median, box_weight; compute_box_stats(s, box); - longest = box->major_axis; box_weight = box->weight; ff_dlog(ctx, "box #%02X [%6d..%-6d] (%6d) w:%-6"PRIu64" sort by %c (already sorted:%c) ", box_id, box->start, box->start + box->len - 1, box->len, box_weight, - "rgb"[longest], box->sorted_by == longest ? 'y':'n'); + "rgb"[box->major_axis], box->sorted_by == box->major_axis ? 'y':'n'); - /* sort the range by its longest axis if it's not already sorted */ - if (box->sorted_by != longest) { - cmp_func cmpf = cmp_funcs[longest]; + /* sort the range by its major axis if it's not already sorted */ + if (box->sorted_by != box->major_axis) { + cmp_func cmpf = cmp_funcs[box->major_axis]; AV_QSORT(&s->refs[box->start], box->len, const struct color_ref *, cmpf); - box->sorted_by = longest; + box->sorted_by = box->major_axis; } /* locate the median where to split */