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 38CAB44136 for ; Tue, 27 Dec 2022 23:21:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9D23468BCC3; Wed, 28 Dec 2022 01:18:50 +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 9799B68BC7B for ; Wed, 28 Dec 2022 01:18:35 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1672183099; 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=cHkfus3J1yRc4KQa6wqTZ4JXNvgqCDU5Nx77+aV5JSA=; b=Az6mR/ID8Mr0LKM2BC0JTKNEtC71pfPC4RM3byNVVpuEYZp4L2OsW3J34UtsjzbW9xeXtG OiGiJen5/lgOjKla63wj0yl+R754a9UirvYO9jv6U00ntONr4qO6xUrMMr0V77Lwxu7bli +UIwIDFlolEO9vGrSo9tMrCHDJ1gRH8= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id b3c90244; Tue, 27 Dec 2022 23:18:19 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Dec 2022 00:18:07 +0100 Message-Id: <20221227231814.2520181-26-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 25/32] avfilter/palette: add lowbias32 hashing 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: --- libavfilter/palette.c | 10 ++++++++++ libavfilter/palette.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/libavfilter/palette.c b/libavfilter/palette.c index 03e48fc71e..e21ab6ff4d 100644 --- a/libavfilter/palette.c +++ b/libavfilter/palette.c @@ -208,3 +208,13 @@ uint32_t ff_oklab_int_to_srgb_u8(struct Lab c) return r<<16 | g<<8 | b; } + +uint32_t ff_lowbias32(uint32_t x) +{ + x ^= x >> 16; + x *= 0x7feb352d; + x ^= x >> 15; + x *= 0x846ca68b; + x ^= x >> 16; + return x; +} diff --git a/libavfilter/palette.h b/libavfilter/palette.h index 6839bf6fc6..d3acc854ba 100644 --- a/libavfilter/palette.h +++ b/libavfilter/palette.h @@ -55,4 +55,9 @@ struct Lab ff_srgb_u8_to_oklab_int(uint32_t srgb); */ uint32_t ff_oklab_int_to_srgb_u8(struct Lab c); +/* + * lowbias32 hashing from https://nullprogram.com/blog/2018/07/31/ + */ +uint32_t ff_lowbias32(uint32_t x); + #endif /* AVFILTER_PALETTE_H */ -- 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".