Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp32905imm; Tue, 17 Jul 2018 20:04:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfm01Uxz5dGutRDh9xql0ejaQkfPB0L4fAmfPQOtvamItO4c9WelWekmzqKm5d/W/XhjX/w X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr3344594pfn.77.1531883081320; Tue, 17 Jul 2018 20:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531883081; cv=none; d=google.com; s=arc-20160816; b=SKW+rrwuQ6bEXllFcQeKvQijrXG5UQ7sQXitQbIaoeULSfEWxXekIRg89upTjS74k5 00DKOF/7qPW11cM/Xtmdo8YseGkNxQAGPhWBWx37mtRVpgioJM+C4xoBBpnXq9bS5b91 YLx3NbU2w4uZ4tjwXhckHWmE3ALn2qaazO9DcFUEMZLyawU+IKc6bqprIAK/43BfkCc2 QoJgx82cUsu68hHt6hKPq/wWG6/ArlabMj+QmFVJ7NMpKs49YzDSGiMXx8us3N4jsFAo qY7WUm2JUNUuSGhAFuvcF6JhGPDpIzJ6PqmDwYrUFAbl2qw6Nqk5QwkqzPowRfO1DQQy KyPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=pttGXFmxD+xi77CsOZ69XmR12rF9J0QfsNDTRkHqosI=; b=OHKViK4WB5noyxxlF84o4boZlxot08QD2xtSvit7rnfNrC5PNIcluiMf4aG5YQAg0B EFhJyOAiytbvmhPbwtqPJDcGGuCLC0wCikzsWUY6J2EqRpPTlzLyj6Vz5r4/6yQMcY/r dBwxntkBv2yZdWlFzuhPw9fnm3dtRO4XYk+eyZp7Yk0raS8bFSxJM1IdBYeL2Ds3PN8c 3CTLjUsthPAFpCLE1/S2USLMy5MlV1QfS6RzdfrbD62ccrdD5h5m5f1R3myMhol2L5r8 7nyYxxFS8PnF0sy4tyipYswTNgwhnEM3OZuK/eLR0AjZaeMtSBjiCvjgS1X0SV3zGqgF pVng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7-v6si1426931pll.162.2018.07.17.20.04.26; Tue, 17 Jul 2018 20:04:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731662AbeGRDj0 (ORCPT + 99 others); Tue, 17 Jul 2018 23:39:26 -0400 Received: from tartarus.angband.pl ([89.206.35.136]:37784 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731295AbeGRDjZ (ORCPT ); Tue, 17 Jul 2018 23:39:25 -0400 Received: from 89-71-158-145.dynamic.chello.pl ([89.71.158.145] helo=umbar.angband.pl) by tartarus.angband.pl with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffckZ-0007zO-4n; Wed, 18 Jul 2018 05:03:39 +0200 Received: from kilobyte by umbar.angband.pl with local (Exim 4.91) (envelope-from ) id 1ffckY-0000AT-Pj; Wed, 18 Jul 2018 05:03:34 +0200 From: Adam Borowski To: Greg Kroah-Hartman , Jiri Slaby , linux-console@vger.kernel.org, Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Adam Borowski Date: Wed, 18 Jul 2018 05:03:26 +0200 Message-Id: <20180718030327.579-5-kilobyte@angband.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718030327.579-1-kilobyte@angband.pl> References: <20180718030152.kdq53mwpdfusvwl5@angband.pl> <20180718030327.579-1-kilobyte@angband.pl> X-SA-Exim-Connect-IP: 89.71.158.145 X-SA-Exim-Mail-From: kilobyte@angband.pl X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tartarus X-Spam-Level: X-Spam-Status: No, score=-2.9 required=8.0 tests=ALL_TRUSTED=-1,BAYES_00=-1.9, TVD_RCVD_IP=0.001 autolearn=ham autolearn_force=no languages=en Subject: [PATCH 5/6] vt: compensate for brightening the 256-color palette X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on tartarus.angband.pl) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The algorithm for 256-to-16 conversion was designed with wrong input palette but actually tuned on mainstream GUI terminals. This resulted in something that works well only for data we convert ourselves (ie, 256 not 24-bit). As the change is non-linear, I did not bother replicating it exactly, thus there are some differences, among others: * values very close to black go to 0 (black) rather than 8 (dark grey) * grayscale ramp is more even A comparison of the old vs new vs FreeBSD's teken is at: https://github.com/kilobyte/colorkernel Signed-off-by: Adam Borowski --- drivers/tty/vt/vt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 8c61caafdf3c..c777f4c91df0 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1559,17 +1559,17 @@ static void rgb_foreground(struct vc_data *vc, const struct rgb *c) { u8 hue = 0, max = max3(c->r, c->g, c->b); - if (c->r > max / 2) + if (c->r > max / 2 + 32) hue |= 4; - if (c->g > max / 2) + if (c->g > max / 2 + 32) hue |= 2; - if (c->b > max / 2) + if (c->b > max / 2 + 32) hue |= 1; - if (hue == 7 && max <= 0x55) { + if (hue == 7 && max <= 0x70) { hue = 0; vc->vc_intensity = 2; - } else if (max > 0xaa) + } else if (max > 0xc0) vc->vc_intensity = 2; else vc->vc_intensity = 1; -- 2.18.0