From patchwork Mon Aug 29 08:47:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17220 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D089BC0DA4 for ; Mon, 29 Aug 2022 08:47:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4598161F9F; Mon, 29 Aug 2022 10:47:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1661762878; bh=STS+H1xnciYgViQtLfcVNyEJ6HkgR+BSr+0nb+i3Ojw=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=b7ixindNrgARnNyRq5UrdUlr9fzmEj/m02ZxF7c4HbqLVqMS85kCTxRAau0NGXiLx qV6xRM91HYI2IU7ZuY3fXqe5wDQ+aGIMIwprw4S6ACfvs11pDW0bzcRDGjYblUCDqj kxtqfv8YOmuby1jUf2B4B4XGwQSPAgWHGUa3ZD+/PLvlawp97bHsfM3UcYf7LWEM6L 7HoHzBw4aEpKw5bim31ioIfSvW5QNXQwGrndQC+IEH0uA6hRw90d8SFuPVolAQN1U3 L38BgJUp2KI2WmYyLpMaIAJhwPHlP+BzHqO5nUYfGEvYsU2hmF/bxrUUdRCSoPCyxi f2ZPaCDYMKQzw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C36E61F9F for ; Mon, 29 Aug 2022 10:47:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Z3TFe/kQ"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0122E481; Mon, 29 Aug 2022 10:47:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1661762876; bh=STS+H1xnciYgViQtLfcVNyEJ6HkgR+BSr+0nb+i3Ojw=; h=From:To:Cc:Subject:Date:From; b=Z3TFe/kQ8R/87e7lvbJkb4iUVor2C27levdHMO6IY8qr9+jqI0ztc2AmgP41EHDSY n5OVEhMSzRwWpgAzyr+TwVEdD3rCwRyZa2VFIXZ++K11kSmLIl4AMfTmvhLC0+foEr Sla/raL8IS+tIV+3y8sTOefhc/TJ5sWQG+Di2v0s= To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Aug 2022 11:47:46 +0300 Message-Id: <20220829084746.23405-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] utils: rkisp1: gen-csc-table: Specify coefficients with full precision X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The Rec01, Rec709, Rec2020 and SMTPE 240M standards specify the Cb and Cr coefficients of the RGB to Y'CbCr conversion matrix using a quotient of two values. Use the exact same formulas instead of hardcoding the division results with a lower precision. Signed-off-by: Laurent Pinchart Reviewed-by: Florian Sylvestre Reviewed-by: Umang Jain --- utils/rkisp1/gen-csc-table.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) base-commit: 3fad116f89e0d3497567043cbf6d8c49f1c102db diff --git a/utils/rkisp1/gen-csc-table.py b/utils/rkisp1/gen-csc-table.py index ca0187ec24c6..2fb702746421 100755 --- a/utils/rkisp1/gen-csc-table.py +++ b/utils/rkisp1/gen-csc-table.py @@ -12,24 +12,24 @@ import sys encodings = { 'rec601': [ - [ 0.2990, 0.5870, 0.1140 ], - [ -0.1687, -0.3313, 0.5 ], - [ 0.5, -0.4187, -0.0813 ] + [ 0.299, 0.587, 0.114 ], + [ -0.299 / 1.772, -0.587 / 1.772, 0.886 / 1.772 ], + [ 0.701 / 1.402, -0.587 / 1.402, -0.114 / 1.402 ] ], 'rec709': [ - [ 0.2126, 0.7152, 0.0722 ], - [ -0.1146, -0.3854, 0.5 ], - [ 0.5, -0.4542, -0.0458 ] + [ 0.2126, 0.7152, 0.0722 ], + [ -0.2126 / 1.8556, -0.7152 / 1.8556, 0.9278 / 1.8556 ], + [ 0.7874 / 1.5748, -0.7152 / 1.5748, -0.0722 / 1.5748 ] ], 'rec2020': [ - [ 0.2627, 0.6780, 0.0593 ], - [ -0.1396, -0.3604, 0.5 ], - [ 0.5, -0.4598, -0.0402 ] + [ 0.2627, 0.6780, 0.0593 ], + [ -0.2627 / 1.8814, -0.6780 / 1.8814, 0.9407 / 1.8814 ], + [ 0.7373 / 1.4746, -0.6780 / 1.4746, -0.0593 / 1.4746 ], ], 'smpte240m': [ - [ 0.2122, 0.7013, 0.0865 ], - [ -0.1161, -0.3839, 0.5 ], - [ 0.5, -0.4451, -0.0549 ] + [ 0.2122, 0.7013, 0.0865 ], + [ -0.2122 / 1.8270, -0.7013 / 1.8270, 0.9135 / 1.8270 ], + [ 0.7878 / 1.5756, -0.7013 / 1.5756, -0.0865 / 1.5756 ], ], }