Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2053063imj; Fri, 8 Feb 2019 11:44:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IZYeJd1AuCm5GVTUJshPoKkH9SUmLqK0k4b3NdnsOpj9MAy+yNA+MPmDARj5UqUP5+XgL3y X-Received: by 2002:a63:5b1f:: with SMTP id p31mr21851611pgb.56.1549655083508; Fri, 08 Feb 2019 11:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549655083; cv=none; d=google.com; s=arc-20160816; b=RLyKuLxKjNMdiTBk8naBM2QCW6V5W3XSi1Y9dYayRoQmJRa29o3j00NcMiqjGwL9hP RIPtIblbs6big2MesDhhGrZ9opdmkPDEEMLCPR+bahoRHMg63tT9i/eaZxCeYX8ioGIF MtgpEJmhoPQfGXmWPitqrXCqybDGvcP+TxLGBco+C2TLwijmVOtkJY2n7BsiE8bdsLdj QnSArXn+hbHePkuv8+sL4OOy1Wv1WFcm2EynETLV1tXO3gCgH8P9r62E2owg7REau47v ArxH3w0Z+CiQREGCoH9yd4+x7xBuHjyGRYkwYW051qg435pRhys4+azQztcVUeSAtQ9v vylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=LNLh7fiEUgpdrV87cZRzOzgatsSJFrmOUrkiGIqiIBs=; b=b3XemiTVEopdNE9XTC7bS3m7slNuByOH4Wdkxq+4/XBpb0yFytSbwFxUnkTNFjl5Xr bP0fsOTAPlYB8FzrFHikCTQki9R84iSy3rnsourrNn+8upqKSbEegZsuSHgifg8CVpLp IuLUFa1z4A7BP15f4jIGmXkVOARYvnnfC0WrEBQYu+qjmCtuWdPydyPk4UCST7bvGZrH y2OfbZWwccUFOmRh4a7vunNbh95mmzR0iehD0fhp9TU/cvsk1RXrbkMFRnC0IIXGIWtp bFuxHHkZTk62fty5e+JsY8uWiUzzGNa9P8vN3Jg1eYT2kAo5byMcJXoGeQCSk1vfxdQJ NGaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tw6MBKhY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si2830040pgg.571.2019.02.08.11.44.27; Fri, 08 Feb 2019 11:44:43 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tw6MBKhY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727806AbfBHT2x (ORCPT + 99 others); Fri, 8 Feb 2019 14:28:53 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41920 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727144AbfBHT2x (ORCPT ); Fri, 8 Feb 2019 14:28:53 -0500 Received: by mail-pf1-f194.google.com with SMTP id b7so2134014pfi.8; Fri, 08 Feb 2019 11:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LNLh7fiEUgpdrV87cZRzOzgatsSJFrmOUrkiGIqiIBs=; b=tw6MBKhYhPn5ZDiVtw1sFoGaxyY2bruW9XLfT57cDa8zpWbhiFk0K0gtiC+vAB4fYC vXx4LLibUIgZiRQI3tMu/yoULQp26qpNNTmwgQAUJ1Xmfophah4kpLZ//Oxlr8uLmR1M FzD2CTKqgZ5blMg8o+xUijiiaL/4yYikwLzniVuogFpGL+ts+3yZ4Xv1M7hFFkyAWyhw 8T/eF8yFpgFCrGc1TwKQOX+VUNLdIMhP5aPgIP8DHvJC6kiNepaKMa6sbvHi29yMxu5X QjZv69ZrjoSRbnYdCBtCBZ4DjzbS6JHG/d3T4DRF9JitInXP+hGxBy89tt8oygjVVB9C Gh2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LNLh7fiEUgpdrV87cZRzOzgatsSJFrmOUrkiGIqiIBs=; b=SzIlubHJttsT5EGh4ONyiBXiU1MbNuJTRRsVSdst+z88lqTnjAbYn1OIh4+h6hi4zV rrIvDNe0I3MQKGOMVbexKVIrQX0Mzka56DN6tn+Dhgs4r+1YujbnNl9mTni92x5u8Zun 8ADgdo7na3fNtVlYZS6QgrTvBN6JSRX5nwec4KimpX0dy5dWIrhM6Ye3gTKDefGrVF5g TaX4SawCGoJOETgd8VyhOP5kCREmxJOz6eBwHf5SSlTShMHaggTALVBrOCgAlejqUyZu MHrQSDsK2E1wF+JzTLyxkWGesottZQq/Z8I+1QOkndmQDuJhbZqRoNA1CcmO8ti5TwKS 2qdg== X-Gm-Message-State: AHQUAuZxTSkg/TlGtdW7Z3PcpSMh5LNcVE1oJwNOVDyrHZsrIolFGkJD HzwlSUH+xllWns5rgIYGj8ARTAL2 X-Received: by 2002:a63:2507:: with SMTP id l7mr6342320pgl.22.1549654131357; Fri, 08 Feb 2019 11:28:51 -0800 (PST) Received: from majic.sklembedded.com (c-73-202-231-77.hsd1.ca.comcast.net. [73.202.231.77]) by smtp.googlemail.com with ESMTPSA id e128sm4443129pfe.67.2019.02.08.11.28.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 11:28:50 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Tim Harvey , Steve Longerbeam , Philipp Zabel , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR FREESCALE IMX), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 1/4] gpu: ipu-v3: ipu-ic: Rename yuv2rgb encoding matrices Date: Fri, 8 Feb 2019 11:28:41 -0800 Message-Id: <20190208192844.13930-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190208192844.13930-1-slongerbeam@gmail.com> References: <20190208192844.13930-1-slongerbeam@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ycbcr2rgb and inverse rgb2ycbcr matrices define the BT.601 encoding coefficients, so rename them to indicate that. And add some comments to make clear these are BT.601 coefficients encoding between YUV limited range and RGB full range. The ic_csc_rgb2rgb matrix is just an identity matrix, so rename to ic_csc_identity. No functional changes. Signed-off-by: Steve Longerbeam --- Changes in v2: - rename ic_csc_rgb2rgb matrix to ic_csc_identity. --- drivers/gpu/ipu-v3/ipu-ic.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index 594c3cbc8291..3ef61f0b509b 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -183,11 +183,13 @@ struct ic_csc_params { }; /* + * BT.601 encoding from RGB full range to YUV limited range: + * * Y = R * .299 + G * .587 + B * .114; * U = R * -.169 + G * -.332 + B * .500 + 128.; * V = R * .500 + G * -.419 + B * -.0813 + 128.; */ -static const struct ic_csc_params ic_csc_rgb2ycbcr = { +static const struct ic_csc_params ic_csc_rgb2ycbcr_bt601 = { .coeff = { { 77, 150, 29 }, { 469, 427, 128 }, @@ -197,8 +199,11 @@ static const struct ic_csc_params ic_csc_rgb2ycbcr = { .scale = 1, }; -/* transparent RGB->RGB matrix for graphics combining */ -static const struct ic_csc_params ic_csc_rgb2rgb = { +/* + * identity matrix, used for transparent RGB->RGB graphics + * combining. + */ +static const struct ic_csc_params ic_csc_identity = { .coeff = { { 128, 0, 0 }, { 0, 128, 0 }, @@ -208,11 +213,13 @@ static const struct ic_csc_params ic_csc_rgb2rgb = { }; /* + * Inverse BT.601 encoding from YUV limited range to RGB full range: + * * R = (1.164 * (Y - 16)) + (1.596 * (Cr - 128)); * G = (1.164 * (Y - 16)) - (0.392 * (Cb - 128)) - (0.813 * (Cr - 128)); * B = (1.164 * (Y - 16)) + (2.017 * (Cb - 128); */ -static const struct ic_csc_params ic_csc_ycbcr2rgb = { +static const struct ic_csc_params ic_csc_ycbcr2rgb_bt601 = { .coeff = { { 149, 0, 204 }, { 149, 462, 408 }, @@ -238,11 +245,11 @@ static int init_csc(struct ipu_ic *ic, (priv->tpmem_base + ic->reg->tpmem_csc[csc_index]); if (inf == IPUV3_COLORSPACE_YUV && outf == IPUV3_COLORSPACE_RGB) - params = &ic_csc_ycbcr2rgb; + params = &ic_csc_ycbcr2rgb_bt601; else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_YUV) - params = &ic_csc_rgb2ycbcr; + params = &ic_csc_rgb2ycbcr_bt601; else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_RGB) - params = &ic_csc_rgb2rgb; + params = &ic_csc_identity; else { dev_err(priv->ipu->dev, "Unsupported color space conversion\n"); return -EINVAL; -- 2.17.1