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 6D6CA44148 for ; Tue, 27 Dec 2022 23:20:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E990B68BD1D; Wed, 28 Dec 2022 01:18:39 +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 7EC5168BCAB 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=Om0KPh4Ov3l3YG/fnc7SkoXe9javK+0NuCRnIW31IZ0=; b=P7BzlXT63pFvXeN2qyIgqj2llvjIJF/1X9aaSiGDYtnUpGDVzqrUSj9l8cQ4SVsV0wCKIJ bT4/Q1XqIfxvGiBfXViWSHCtEWLAZNu8OT+zcM11Z9qJ333EzvSDdGbc04N7B1TJ9jPhtg LQUdc7UyCHqoq1EDKMfPhk+Ff9MPwaY= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id e90a3119; Tue, 27 Dec 2022 23:18:18 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Dec 2022 00:17:56 +0100 Message-Id: <20221227231814.2520181-15-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 14/32] avfilter/palettegen: rename variance to cut_score 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: "Variance" wasn't exactly the correct word; "cut score" is more agnostic, which will be useful when changing the algorithm in the next commit. --- libavfilter/vf_palettegen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index ca1e02444c..7ecb1211ba 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -42,7 +42,7 @@ struct range_box { uint32_t color; // average color int major_axis; // best axis candidate for cutting the box uint64_t weight; // sum of all the weights of the colors - int64_t variance; // overall variance of the box (how much the colors are spread) + int64_t cut_score; // how likely the box is to be cut down (higher implying more likely) int start; // index in PaletteGenContext->refs int len; // number of referenced colors int sorted_by; // whether range of colors is sorted by red (0), green (1) or blue (2) @@ -171,25 +171,25 @@ static void compute_box_stats(PaletteGenContext *s, struct range_box *box) if (er2[0] >= er2[1] && er2[0] >= er2[2]) box->major_axis = 0; if (er2[1] >= er2[0] && er2[1] >= er2[2]) box->major_axis = 1; // prefer green again - box->variance = er2[0] + er2[1] + er2[2]; + box->cut_score = er2[0] + er2[1] + er2[2]; } /** - * Find the next box to split: pick the one with the highest variance + * Find the next box to split: pick the one with the highest cut score */ static int get_next_box_id_to_split(PaletteGenContext *s) { int box_id, best_box_id = -1; - int64_t max_variance = -1; + int64_t max_score = -1; if (s->nb_boxes == s->max_colors - s->reserve_transparent) return -1; for (box_id = 0; box_id < s->nb_boxes; box_id++) { struct range_box *box = &s->boxes[box_id]; - if (s->boxes[box_id].len >= 2 && box->variance > max_variance) { + if (s->boxes[box_id].len >= 2 && box->cut_score > max_score) { best_box_id = box_id; - max_variance = box->variance; + max_score = box->cut_score; } } return best_box_id; -- 2.39.0 _______________________________________________ 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".