Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EFECC433EF for ; Sun, 10 Jul 2022 11:55:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC31F113712; Sun, 10 Jul 2022 11:55:55 +0000 (UTC) Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54F961135DA for ; Sun, 10 Jul 2022 11:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=sl6VoKbkWuLeqSDckxMqFupQqky69Mgc4GHkmn0W8Uc=; b=ayg7WXbuOLxfFcUQGgCyIwaqq9oBroKQCQKAWYCECnfqOaDyaX764YkO0Q0TU4tGEPe0CxpdgnHGh E0IjiTUbyrgXHQ9lZU8poic9ghmEYFR0ACDWRYaQhUvWrx8DasP/pAMYs947Onun1XrnCYcZWl9f+Z xZmsDMnaFASPjxEy2kFsRV6ZfcU10q1BvGhmrKJHT6gOg/LQCHqMd0dkBw2hdSF2pxuX5AVGxi7HVL 0Ik0aV1SmYDfKC/s1sdqBKb39wZRfPK3ChIbCkiQtQwUb+PSFoCeSlr6PQbTyv8GRhxqOFpbrHTahu RoxAVaLn3nmOS7rsd219iM/TVJetWSQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=sl6VoKbkWuLeqSDckxMqFupQqky69Mgc4GHkmn0W8Uc=; b=Fr+VKWXXhJiZu5zYOcXUJNbsrScvyKVf+nOb0ZmDVbpAoQHkhTAoYX+cpAxE8B5GZ8bemePTxcK7J 3eYQlOxBA== X-HalOne-Cookie: ae0e36a951df1365868c870872e99beb831bb273 X-HalOne-ID: 3e797074-0047-11ed-823d-d0431ea8bb10 Received: from mailproxy2.cst.dirpod3-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 3e797074-0047-11ed-823d-d0431ea8bb10; Sun, 10 Jul 2022 11:55:51 +0000 (UTC) Date: Sun, 10 Jul 2022 13:55:49 +0200 From: Sam Ravnborg To: Geert Uytterhoeven Subject: Re: [PATCH libdrm v2 01/10] util: Improve SMPTE color LUT accuracy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: DRI Development Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Geert, On Sun, Jul 10, 2022 at 01:04:23PM +0200, Geert Uytterhoeven wrote: > Hi Sam, > > On Sun, Jul 10, 2022 at 12:31 PM Sam Ravnborg wrote: > > On Fri, Jul 08, 2022 at 08:21:31PM +0200, Geert Uytterhoeven wrote: > > > Fill in the LSB when converting color components from 8-bit to 16-bit. > > > > > > Signed-off-by: Geert Uytterhoeven > > > --- > > > v2: > > > - New. > > > --- > > > tests/util/pattern.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/tests/util/pattern.c b/tests/util/pattern.c > > > index 178aee8341a38920..3753ebc1eeae6c9a 100644 > > > --- a/tests/util/pattern.c > > > +++ b/tests/util/pattern.c > > > @@ -646,9 +646,9 @@ void util_smpte_c8_gamma(unsigned size, struct drm_color_lut *lut) > > > memset(lut, 0, size * sizeof(struct drm_color_lut)); > > > > > > #define FILL_COLOR(idx, r, g, b) \ > > > - lut[idx].red = (r) << 8; \ > > > - lut[idx].green = (g) << 8; \ > > > - lut[idx].blue = (b) << 8 > > > + lut[idx].red = (r) * 0x101; \ > > > > (lut[idx].red = (r) << 8) | 1; > > > > had IMO been easier to read. > > I guess you mean "| (r)" instead of "| 1"? Well, I meant what I wrote but it is obviously wrong. So yes lut[idx].red = (r) << 8 | (r); is the equivalent of multiplying with 0x101. Whatever works, but if you update this patch, then please update the later patch where the multiply with 0x101 is also used. Sam