From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C00E440BB7 for ; Sat, 5 Nov 2022 15:28:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A3AA68B83A; Sat, 5 Nov 2022 17:26:49 +0200 (EET) 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 824A868B4BB for ; Sat, 5 Nov 2022 17:26:41 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1667661983; 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=NwZfvrBilWpFfUhEOzve9x5SFeWbMCPVdq3yWFen5uQ=; b=YL9HY+oqFkzdFBxLJ35LzISYPBfiPIQl5RjG4ORbwbY+QwQs3m7MpKqqVPOFktkL5pZjLV UxOCspvif+Jy5mrflG3qnQhtfUIHA2bqPcxO1YfoqMaZZpbsM1ZZwBwCzRqA80XlqkKeAj UJ7BbvG54Eh9P5EliEunZirLTW+DZLw= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id f925775e; Sat, 5 Nov 2022 15:26:23 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 5 Nov 2022 16:26:16 +0100 Message-Id: <20221105152617.1809282-15-u@pkh.me> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221105152617.1809282-1-u@pkh.me> References: <20221105152617.1809282-1-u@pkh.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/15] avfilter/palettegen: rename longest to split_axis 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?q?Cl=C3=A9ment=20B=C5=93sch?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: The split heuristic is not based on the length property of the axis anymore. --- libavfilter/vf_palettegen.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index 2976012512..9d537f8f37 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -360,7 +360,7 @@ static AVFrame *get_palette_frame(AVFilterContext *ctx) s->nb_boxes = 1; while (box && box->len > 1) { - int i, longest; + int i, split_axis; double Lv, av, bv; uint64_t median, box_weight = 0; @@ -375,20 +375,20 @@ static AVFrame *get_palette_frame(AVFilterContext *ctx) Lv = box->axis_variance[0]; av = box->axis_variance[1]; bv = box->axis_variance[2]; - longest = 0; - if (bv >= Lv && bv >= av) longest = 2; - if (av >= Lv && av >= bv) longest = 1; - if (Lv >= av && Lv >= bv) longest = 0; + split_axis = 0; + if (bv >= Lv && bv >= av) split_axis = 2; + if (av >= Lv && av >= bv) split_axis = 1; + if (Lv >= av && Lv >= bv) split_axis = 0; ff_dlog(ctx, "box #%02X [%6d..%-6d] (%6d) w:%-6"PRIu64" var:[%.3f %.3f %.3f] sort by %c (already sorted:%c) ", box_id, box->start, box->start + box->len - 1, box->len, box_weight, - Lv, av, bv, "Lab"[longest], box->sorted_by == longest ? 'y':'n'); + Lv, av, bv, "Lab"[split_axis], box->sorted_by == split_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 split axis if it's not already sorted */ + if (box->sorted_by != split_axis) { + cmp_func cmpf = cmp_funcs[split_axis]; AV_QSORT(&s->refs[box->start], box->len, const struct color_ref *, cmpf); - box->sorted_by = longest; + box->sorted_by = split_axis; } /* locate the median where to split */ -- 2.38.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".